summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
committerBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
commitabada90e3f84dc703b8ddc9efcbed8a946fadead (patch)
tree2c6f9dccd510ea97cb927a7bd635422efaae547a /cpp
parentremoving trace message (diff)
downloadice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip
Expanded tabs into spaces
Diffstat (limited to 'cpp')
-rw-r--r--cpp/RPMTools.py620
-rwxr-xr-xcpp/allTests.py56
-rw-r--r--cpp/config/IceGridAdmin.py28
-rw-r--r--cpp/config/TestUtil.py178
-rwxr-xr-xcpp/config/convertssl.py184
-rw-r--r--cpp/config/findSliceFiles.py14
-rw-r--r--cpp/config/makeprops.py372
-rwxr-xr-xcpp/config/upgradeicegrid.py6
-rwxr-xr-xcpp/config/upgradeicestorm.py4
-rw-r--r--cpp/demo/Database/Oracle/occi/Client.cpp606
-rw-r--r--cpp/demo/Database/Oracle/occi/DeptFactoryI.cpp72
-rw-r--r--cpp/demo/Database/Oracle/occi/DeptFactoryI.h8
-rw-r--r--cpp/demo/Database/Oracle/occi/DeptI.cpp92
-rw-r--r--cpp/demo/Database/Oracle/occi/EmpI.cpp120
-rwxr-xr-xcpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp54
-rw-r--r--cpp/demo/Database/Oracle/occi/Server.cpp48
-rw-r--r--cpp/demo/Database/Oracle/occi/Util.cpp66
-rw-r--r--cpp/demo/Database/Oracle/occi/Util.h4
-rw-r--r--cpp/demo/Database/Oracle/proc/Client.cpp606
-rw-r--r--cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc82
-rw-r--r--cpp/demo/Database/Oracle/proc/DeptFactoryI.pc28
-rw-r--r--cpp/demo/Database/Oracle/proc/DeptI.pc52
-rw-r--r--cpp/demo/Database/Oracle/proc/EmpI.pc34
-rw-r--r--cpp/demo/Database/Oracle/proc/Server.pc14
-rw-r--r--cpp/demo/Database/Oracle/proc/Util.pc4
-rw-r--r--cpp/demo/Freeze/backup/Client.cpp78
-rw-r--r--cpp/demo/Freeze/bench/Client.cpp794
-rw-r--r--cpp/demo/Freeze/library/Client.cpp6
-rw-r--r--cpp/demo/Freeze/library/Collocated.cpp10
-rw-r--r--cpp/demo/Freeze/library/Library.ice16
-rw-r--r--cpp/demo/Freeze/library/LibraryI.cpp132
-rw-r--r--cpp/demo/Freeze/library/LibraryI.h4
-rw-r--r--cpp/demo/Freeze/library/Parser.cpp440
-rw-r--r--cpp/demo/Freeze/library/RunParser.cpp176
-rw-r--r--cpp/demo/Freeze/library/Server.cpp4
-rw-r--r--cpp/demo/Freeze/phonebook/Client.cpp6
-rw-r--r--cpp/demo/Freeze/phonebook/Collocated.cpp10
-rw-r--r--cpp/demo/Freeze/phonebook/Parser.cpp396
-rw-r--r--cpp/demo/Freeze/phonebook/PhoneBookI.cpp34
-rw-r--r--cpp/demo/Freeze/phonebook/RunParser.cpp176
-rw-r--r--cpp/demo/Freeze/phonebook/Server.cpp4
-rw-r--r--cpp/demo/Glacier2/callback/CallbackI.cpp22
-rw-r--r--cpp/demo/Glacier2/callback/Client.cpp246
-rw-r--r--cpp/demo/Glacier2/callback/SessionI.cpp2
-rwxr-xr-xcpp/demo/Glacier2/chat/ChatSessionI.cpp40
-rwxr-xr-xcpp/demo/Glacier2/chat/Client.cpp310
-rwxr-xr-xcpp/demo/Glacier2/chat/Server.cpp16
-rw-r--r--cpp/demo/Ice/MFC/client/HelloClient.cpp6
-rw-r--r--cpp/demo/Ice/MFC/client/stdafx.h24
-rw-r--r--cpp/demo/Ice/MFC/server/HelloServer.cpp6
-rw-r--r--cpp/demo/Ice/MFC/server/LogI.cpp4
-rw-r--r--cpp/demo/Ice/MFC/server/stdafx.h24
-rw-r--r--cpp/demo/Ice/async/Client.cpp84
-rw-r--r--cpp/demo/Ice/async/WorkQueue.cpp60
-rw-r--r--cpp/demo/Ice/async/WorkQueue.h2
-rw-r--r--cpp/demo/Ice/bidir/CallbackI.cpp58
-rw-r--r--cpp/demo/Ice/bidir/CallbackI.h18
-rw-r--r--cpp/demo/Ice/bidir/Client.cpp6
-rw-r--r--cpp/demo/Ice/bidir/Server.cpp6
-rw-r--r--cpp/demo/Ice/callback/CallbackSenderI.cpp8
-rw-r--r--cpp/demo/Ice/callback/Client.cpp198
-rw-r--r--cpp/demo/Ice/converter/Client.cpp106
-rw-r--r--cpp/demo/Ice/converter/StringConverterI.cpp76
-rw-r--r--cpp/demo/Ice/hello/Client.cpp292
-rw-r--r--cpp/demo/Ice/invoke/Client.cpp6
-rw-r--r--cpp/demo/Ice/latency/Client.cpp6
-rw-r--r--cpp/demo/Ice/minimal/Client.cpp44
-rw-r--r--cpp/demo/Ice/minimal/Server.cpp32
-rw-r--r--cpp/demo/Ice/nested/Client.cpp46
-rw-r--r--cpp/demo/Ice/nested/NestedI.cpp2
-rwxr-xr-xcpp/demo/Ice/session/Client.cpp248
-rwxr-xr-xcpp/demo/Ice/session/ReapThread.cpp62
-rwxr-xr-xcpp/demo/Ice/session/ReapThread.h8
-rwxr-xr-xcpp/demo/Ice/session/SessionI.cpp34
-rw-r--r--cpp/demo/Ice/throughput/Client.cpp628
-rw-r--r--cpp/demo/Ice/throughput/ThroughputI.cpp10
-rw-r--r--cpp/demo/Ice/value/Client.cpp108
-rw-r--r--cpp/demo/Ice/value/ObjectFactory.cpp4
-rw-r--r--cpp/demo/IceBox/hello/Client.cpp190
-rw-r--r--cpp/demo/IceBox/hello/HelloServiceI.h4
-rw-r--r--cpp/demo/IceGrid/allocate/Client.cpp194
-rw-r--r--cpp/demo/IceGrid/replication/Client.cpp10
-rw-r--r--cpp/demo/IceGrid/sessionActivation/Client.cpp170
-rw-r--r--cpp/demo/IceGrid/simple/Client.cpp86
-rwxr-xr-xcpp/demo/IcePatch2/MFC/PatchClientDlg.cpp196
-rwxr-xr-xcpp/demo/IcePatch2/MFC/stdafx.h24
-rw-r--r--cpp/demo/IceStorm/clock/Publisher.cpp58
-rw-r--r--cpp/demo/IceStorm/clock/Subscriber.cpp84
-rw-r--r--cpp/demo/IceStorm/counter/Client.cpp78
-rw-r--r--cpp/demo/IceStorm/counter/CounterI.cpp2
-rw-r--r--cpp/demo/IceStorm/counter/Server.cpp28
-rw-r--r--cpp/demo/IceStorm/replicated/Publisher.cpp2
-rw-r--r--cpp/demo/IceStorm/replicated/Subscriber.cpp40
-rw-r--r--cpp/demo/IceUtil/workqueue/WorkQueue.cpp96
-rw-r--r--cpp/demo/book/evictor/EvictorBase.cpp50
-rw-r--r--cpp/demo/book/evictor/EvictorBase.h10
-rwxr-xr-xcpp/demo/book/printer/Client.cpp34
-rwxr-xr-xcpp/demo/book/printer/Printer.ice2
-rwxr-xr-xcpp/demo/book/printer/Server.cpp38
-rwxr-xr-xcpp/demo/book/simple_filesystem/Client.cpp64
-rwxr-xr-xcpp/demo/book/simple_filesystem/Filesystem.ice10
-rwxr-xr-xcpp/demo/book/simple_filesystem/FilesystemI.cpp10
-rwxr-xr-xcpp/demo/book/simple_filesystem/FilesystemI.h30
-rwxr-xr-xcpp/demo/book/simple_filesystem/Server.cpp80
-rwxr-xr-xcpp/fixCopyright.py4
-rwxr-xr-xcpp/fixVersion.py122
-rwxr-xr-xcpp/iceemakedist.py54
-rw-r--r--cpp/include/Freeze/Initialize.h28
-rw-r--r--cpp/include/Freeze/Map.h776
-rw-r--r--cpp/include/Ice/BasicStream.h166
-rw-r--r--cpp/include/Ice/Buffer.h224
-rw-r--r--cpp/include/Ice/FactoryTable.h2
-rwxr-xr-xcpp/include/Ice/GCShared.h4
-rw-r--r--cpp/include/Ice/Handle.h186
-rw-r--r--cpp/include/Ice/IncomingAsync.h2
-rw-r--r--cpp/include/Ice/Initialize.h14
-rw-r--r--cpp/include/Ice/Object.h2
-rw-r--r--cpp/include/Ice/Outgoing.h10
-rw-r--r--cpp/include/Ice/OutgoingAsync.h4
-rw-r--r--cpp/include/Ice/Proxy.h156
-rw-r--r--cpp/include/Ice/ProxyHandle.h190
-rwxr-xr-xcpp/include/Ice/StringConverter.h8
-rw-r--r--cpp/include/IcePatch2/Util.h144
-rw-r--r--cpp/include/IceStorm/Service.h10
-rw-r--r--cpp/include/IceUtil/AbstractMutex.h18
-rw-r--r--cpp/include/IceUtil/Cache.h298
-rw-r--r--cpp/include/IceUtil/Cond.h40
-rw-r--r--cpp/include/IceUtil/DisableWarnings.h4
-rw-r--r--cpp/include/IceUtil/Functional.h32
-rw-r--r--cpp/include/IceUtil/Handle.h184
-rw-r--r--cpp/include/IceUtil/InputUtil.h4
-rw-r--r--cpp/include/IceUtil/Lock.h58
-rw-r--r--cpp/include/IceUtil/Monitor.h100
-rw-r--r--cpp/include/IceUtil/Mutex.h74
-rwxr-xr-xcpp/include/IceUtil/Options.h6
-rw-r--r--cpp/include/IceUtil/OutputUtil.h4
-rw-r--r--cpp/include/IceUtil/RWRecMutex.h158
-rw-r--r--cpp/include/IceUtil/RecMutex.h6
-rw-r--r--cpp/include/IceUtil/ScopedArray.h24
-rw-r--r--cpp/include/IceUtil/Shared.h112
-rw-r--r--cpp/include/IceUtil/StaticMutex.h78
-rw-r--r--cpp/include/IceUtil/Thread.h4
-rw-r--r--cpp/include/IceUtil/Time.h88
-rw-r--r--cpp/include/IceUtil/Unicode.h14
-rw-r--r--cpp/include/Slice/CPlusPlusUtil.h10
-rw-r--r--cpp/include/Slice/CsUtil.h2
-rw-r--r--cpp/include/Slice/JavaUtil.h14
-rw-r--r--cpp/include/Slice/Parser.h60
-rw-r--r--cpp/include/Slice/VbUtil.h2
-rwxr-xr-xcpp/install/common/components.py602
-rwxr-xr-xcpp/install/common/makewindist.py892
-rwxr-xr-xcpp/install/rpm/makeSRPMs.py18
-rwxr-xr-xcpp/makebindist.py704
-rwxr-xr-xcpp/makedist.py6
-rw-r--r--cpp/slice/Glacier2/Router.ice6
-rw-r--r--cpp/slice/Glacier2/Session.ice4
-rw-r--r--cpp/slice/Ice/Locator.ice10
-rw-r--r--cpp/slice/IceGrid/Admin.ice94
-rwxr-xr-xcpp/slice/IceGrid/FileParser.ice2
-rw-r--r--cpp/slice/IceGrid/Registry.ice8
-rw-r--r--cpp/slice/IceGrid/Session.ice6
-rw-r--r--cpp/slice/IceGrid/UserAccountMapper.ice2
-rw-r--r--cpp/slice/IcePatch2/FileServer.ice4
-rw-r--r--cpp/slice/IceStorm/IceStorm.ice2
-rw-r--r--cpp/src/Freeze/ConnectionI.cpp36
-rw-r--r--cpp/src/Freeze/ConnectionI.h6
-rw-r--r--cpp/src/Freeze/EvictorI.cpp2280
-rw-r--r--cpp/src/Freeze/EvictorI.h16
-rw-r--r--cpp/src/Freeze/EvictorIteratorI.cpp274
-rw-r--r--cpp/src/Freeze/IndexI.cpp402
-rw-r--r--cpp/src/Freeze/MapI.cpp1552
-rw-r--r--cpp/src/Freeze/MapI.h30
-rw-r--r--cpp/src/Freeze/ObjectStore.cpp362
-rw-r--r--cpp/src/Freeze/ObjectStore.h2
-rw-r--r--cpp/src/Freeze/SharedDb.cpp402
-rw-r--r--cpp/src/Freeze/SharedDb.h34
-rw-r--r--cpp/src/Freeze/SharedDbEnv.cpp374
-rw-r--r--cpp/src/Freeze/TransactionHolder.cpp50
-rw-r--r--cpp/src/Freeze/TransactionI.cpp160
-rw-r--r--cpp/src/Freeze/TransactionI.h2
-rw-r--r--cpp/src/Freeze/Util.cpp72
-rw-r--r--cpp/src/Freeze/Util.h4
-rw-r--r--cpp/src/FreezeScript/Data.cpp44
-rw-r--r--cpp/src/FreezeScript/DumpDB.cpp268
-rw-r--r--cpp/src/FreezeScript/DumpDescriptors.cpp24
-rw-r--r--cpp/src/FreezeScript/DumpDescriptors.h2
-rw-r--r--cpp/src/FreezeScript/Functions.cpp4
-rw-r--r--cpp/src/FreezeScript/Functions.h2
-rw-r--r--cpp/src/FreezeScript/TransformAnalyzer.cpp20
-rw-r--r--cpp/src/FreezeScript/TransformAnalyzer.h4
-rw-r--r--cpp/src/FreezeScript/Transformer.cpp82
-rw-r--r--cpp/src/FreezeScript/Transformer.h6
-rw-r--r--cpp/src/FreezeScript/Util.cpp42
-rw-r--r--cpp/src/FreezeScript/transformdb.cpp738
-rw-r--r--cpp/src/Glacier2/Blobject.cpp510
-rw-r--r--cpp/src/Glacier2/Blobject.h2
-rw-r--r--cpp/src/Glacier2/ClientBlobject.cpp138
-rw-r--r--cpp/src/Glacier2/ClientBlobject.h2
-rwxr-xr-xcpp/src/Glacier2/CryptPermissionsVerifierI.cpp4
-rwxr-xr-xcpp/src/Glacier2/FilterI.h76
-rwxr-xr-xcpp/src/Glacier2/FilterManager.cpp350
-rwxr-xr-xcpp/src/Glacier2/FilterManager.h12
-rw-r--r--cpp/src/Glacier2/Glacier2Router.cpp342
-rw-r--r--cpp/src/Glacier2/ProxyVerifier.cpp1010
-rw-r--r--cpp/src/Glacier2/RequestQueue.cpp402
-rw-r--r--cpp/src/Glacier2/RequestQueue.h2
-rw-r--r--cpp/src/Glacier2/RouterI.cpp104
-rw-r--r--cpp/src/Glacier2/RouterI.h2
-rw-r--r--cpp/src/Glacier2/RoutingTable.cpp126
-rw-r--r--cpp/src/Glacier2/RoutingTable.h4
-rw-r--r--cpp/src/Glacier2/ServerBlobject.cpp4
-rw-r--r--cpp/src/Glacier2/ServerBlobject.h2
-rw-r--r--cpp/src/Glacier2/SessionRouterI.cpp1028
-rw-r--r--cpp/src/Glacier2/SessionRouterI.h18
-rw-r--r--cpp/src/Ice/Application.cpp624
-rw-r--r--cpp/src/Ice/BasicStream.cpp1148
-rw-r--r--cpp/src/Ice/Buffer.cpp20
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp146
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp1436
-rw-r--r--cpp/src/Ice/ConnectionFactory.h18
-rw-r--r--cpp/src/Ice/ConnectionI.cpp3414
-rw-r--r--cpp/src/Ice/ConnectionI.h36
-rw-r--r--cpp/src/Ice/ConnectionMonitor.cpp104
-rwxr-xr-xcpp/src/Ice/DLLMain.cpp2
-rw-r--r--cpp/src/Ice/DefaultsAndOverrides.cpp22
-rw-r--r--cpp/src/Ice/Direct.cpp110
-rw-r--r--cpp/src/Ice/DynamicLibrary.cpp32
-rw-r--r--cpp/src/Ice/EndpointFactoryManager.cpp4
-rwxr-xr-xcpp/src/Ice/EventLoggerI.cpp2
-rw-r--r--cpp/src/Ice/Exception.cpp78
-rw-r--r--cpp/src/Ice/FactoryTableDef.cpp106
-rwxr-xr-xcpp/src/Ice/GC.cpp302
-rw-r--r--cpp/src/Ice/IdentityUtil.cpp4
-rw-r--r--cpp/src/Ice/ImplicitContextI.cpp308
-rw-r--r--cpp/src/Ice/Incoming.cpp610
-rw-r--r--cpp/src/Ice/IncomingAsync.cpp120
-rw-r--r--cpp/src/Ice/Initialize.cpp74
-rw-r--r--cpp/src/Ice/Instance.cpp684
-rw-r--r--cpp/src/Ice/Instance.h8
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp436
-rw-r--r--cpp/src/Ice/LoggerI.cpp6
-rw-r--r--cpp/src/Ice/LoggerUtil.cpp8
-rw-r--r--cpp/src/Ice/Network.cpp1164
-rw-r--r--cpp/src/Ice/Object.cpp110
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.cpp146
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp994
-rw-r--r--cpp/src/Ice/ObjectAdapterI.h6
-rw-r--r--cpp/src/Ice/ObjectFactoryManager.cpp102
-rw-r--r--cpp/src/Ice/Outgoing.cpp714
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp596
-rw-r--r--cpp/src/Ice/PluginManagerI.cpp198
-rw-r--r--cpp/src/Ice/PropertiesI.cpp142
-rw-r--r--cpp/src/Ice/Protocol.cpp2
-rw-r--r--cpp/src/Ice/Proxy.cpp974
-rw-r--r--cpp/src/Ice/ProxyFactory.cpp190
-rw-r--r--cpp/src/Ice/Reference.cpp904
-rw-r--r--cpp/src/Ice/Reference.h30
-rw-r--r--cpp/src/Ice/ReferenceFactory.cpp656
-rw-r--r--cpp/src/Ice/ReferenceFactory.h10
-rw-r--r--cpp/src/Ice/RouterInfo.cpp164
-rw-r--r--cpp/src/Ice/ServantManager.cpp198
-rwxr-xr-xcpp/src/Ice/Service.cpp366
-rw-r--r--cpp/src/Ice/SharedContext.h4
-rw-r--r--cpp/src/Ice/SliceChecksums.cpp8
-rwxr-xr-xcpp/src/Ice/StringConverter.cpp66
-rw-r--r--cpp/src/Ice/TcpAcceptor.cpp40
-rw-r--r--cpp/src/Ice/TcpConnector.cpp8
-rw-r--r--cpp/src/Ice/TcpEndpointI.cpp352
-rw-r--r--cpp/src/Ice/TcpTransceiver.cpp452
-rw-r--r--cpp/src/Ice/ThreadPool.cpp1192
-rw-r--r--cpp/src/Ice/ThreadPool.h8
-rw-r--r--cpp/src/Ice/TraceUtil.cpp514
-rw-r--r--cpp/src/Ice/UdpEndpointI.cpp602
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp460
-rw-r--r--cpp/src/Ice/UnknownEndpointI.cpp16
-rw-r--r--cpp/src/IceBox/Admin.cpp130
-rw-r--r--cpp/src/IceBox/Service.cpp6
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp620
-rw-r--r--cpp/src/IceBox/ServiceManagerI.h8
-rw-r--r--cpp/src/IceGrid/Activator.cpp1182
-rw-r--r--cpp/src/IceGrid/Activator.h12
-rw-r--r--cpp/src/IceGrid/AdapterCache.cpp274
-rw-r--r--cpp/src/IceGrid/AdapterCache.h2
-rw-r--r--cpp/src/IceGrid/AdminI.cpp362
-rw-r--r--cpp/src/IceGrid/AdminI.h4
-rw-r--r--cpp/src/IceGrid/AdminSessionI.cpp266
-rw-r--r--cpp/src/IceGrid/AdminSessionI.h8
-rw-r--r--cpp/src/IceGrid/Allocatable.cpp476
-rw-r--r--cpp/src/IceGrid/Allocatable.h8
-rw-r--r--cpp/src/IceGrid/AllocatableObjectCache.cpp224
-rw-r--r--cpp/src/IceGrid/AllocatableObjectCache.h24
-rw-r--r--cpp/src/IceGrid/Cache.h114
-rw-r--r--cpp/src/IceGrid/Client.cpp644
-rw-r--r--cpp/src/IceGrid/Database.cpp1358
-rw-r--r--cpp/src/IceGrid/Database.h4
-rw-r--r--cpp/src/IceGrid/DescriptorBuilder.cpp216
-rw-r--r--cpp/src/IceGrid/DescriptorBuilder.h4
-rw-r--r--cpp/src/IceGrid/DescriptorHelper.cpp2678
-rw-r--r--cpp/src/IceGrid/DescriptorHelper.h18
-rw-r--r--cpp/src/IceGrid/DescriptorParser.cpp1220
-rw-r--r--cpp/src/IceGrid/DescriptorParser.h8
-rw-r--r--cpp/src/IceGrid/FileCache.cpp170
-rwxr-xr-xcpp/src/IceGrid/FileParserI.cpp6
-rw-r--r--cpp/src/IceGrid/FileUserAccountMapperI.cpp82
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp518
-rw-r--r--cpp/src/IceGrid/IceGridRegistry.cpp74
-rw-r--r--cpp/src/IceGrid/Internal.ice40
-rw-r--r--cpp/src/IceGrid/InternalRegistryI.cpp62
-rw-r--r--cpp/src/IceGrid/InternalRegistryI.h6
-rw-r--r--cpp/src/IceGrid/LocatorI.cpp414
-rw-r--r--cpp/src/IceGrid/LocatorI.h42
-rw-r--r--cpp/src/IceGrid/LocatorRegistryI.cpp370
-rw-r--r--cpp/src/IceGrid/LocatorRegistryI.h10
-rw-r--r--cpp/src/IceGrid/NodeCache.cpp824
-rw-r--r--cpp/src/IceGrid/NodeI.cpp1066
-rw-r--r--cpp/src/IceGrid/NodeI.h20
-rw-r--r--cpp/src/IceGrid/NodeSessionI.cpp208
-rw-r--r--cpp/src/IceGrid/NodeSessionI.h4
-rw-r--r--cpp/src/IceGrid/NodeSessionManager.cpp458
-rw-r--r--cpp/src/IceGrid/NodeSessionManager.h50
-rw-r--r--cpp/src/IceGrid/ObjectCache.cpp36
-rw-r--r--cpp/src/IceGrid/ObjectCache.h14
-rw-r--r--cpp/src/IceGrid/Parser.cpp1744
-rw-r--r--cpp/src/IceGrid/PlatformInfo.cpp158
-rw-r--r--cpp/src/IceGrid/QueryI.cpp40
-rw-r--r--cpp/src/IceGrid/QueryI.h2
-rw-r--r--cpp/src/IceGrid/ReapThread.cpp146
-rw-r--r--cpp/src/IceGrid/ReapThread.h48
-rw-r--r--cpp/src/IceGrid/RegistryI.cpp942
-rw-r--r--cpp/src/IceGrid/RegistryI.h8
-rw-r--r--cpp/src/IceGrid/ReplicaCache.cpp194
-rw-r--r--cpp/src/IceGrid/ReplicaSessionI.cpp134
-rw-r--r--cpp/src/IceGrid/ReplicaSessionI.h4
-rw-r--r--cpp/src/IceGrid/ReplicaSessionManager.cpp698
-rw-r--r--cpp/src/IceGrid/ReplicaSessionManager.h40
-rw-r--r--cpp/src/IceGrid/ServerAdapterI.cpp140
-rw-r--r--cpp/src/IceGrid/ServerCache.cpp1000
-rw-r--r--cpp/src/IceGrid/ServerI.cpp2484
-rw-r--r--cpp/src/IceGrid/ServerI.h32
-rw-r--r--cpp/src/IceGrid/SessionI.cpp168
-rw-r--r--cpp/src/IceGrid/SessionI.h6
-rw-r--r--cpp/src/IceGrid/SessionManager.h352
-rw-r--r--cpp/src/IceGrid/SessionServantLocatorI.cpp4
-rw-r--r--cpp/src/IceGrid/SessionServantLocatorI.h6
-rw-r--r--cpp/src/IceGrid/Topics.cpp530
-rw-r--r--cpp/src/IceGrid/Util.cpp72
-rw-r--r--cpp/src/IceGrid/Util.h26
-rw-r--r--cpp/src/IceGrid/WaitQueue.cpp160
-rw-r--r--cpp/src/IceGrid/WellKnownObjectsManager.cpp6
-rw-r--r--cpp/src/IcePatch2/Calc.cpp308
-rw-r--r--cpp/src/IcePatch2/Client.cpp264
-rwxr-xr-xcpp/src/IcePatch2/ClientUtil.cpp1144
-rw-r--r--cpp/src/IcePatch2/FileServerI.cpp58
-rw-r--r--cpp/src/IcePatch2/FileServerI.h2
-rw-r--r--cpp/src/IcePatch2/OS.cpp4
-rw-r--r--cpp/src/IcePatch2/Server.cpp116
-rw-r--r--cpp/src/IcePatch2/Util.cpp1518
-rw-r--r--cpp/src/IceSSL/AcceptorI.cpp58
-rwxr-xr-xcpp/src/IceSSL/Certificate.cpp236
-rw-r--r--cpp/src/IceSSL/ConnectorI.cpp206
-rw-r--r--cpp/src/IceSSL/EndpointI.cpp328
-rw-r--r--cpp/src/IceSSL/Instance.cpp1156
-rw-r--r--cpp/src/IceSSL/PluginI.cpp186
-rw-r--r--cpp/src/IceSSL/RFC2253.cpp444
-rw-r--r--cpp/src/IceSSL/TrustManager.cpp174
-rw-r--r--cpp/src/IceSSL/Util.cpp288
-rw-r--r--cpp/src/IceStorm/Admin.cpp310
-rw-r--r--cpp/src/IceStorm/BatchFlusher.cpp110
-rw-r--r--cpp/src/IceStorm/Instance.cpp20
-rw-r--r--cpp/src/IceStorm/Parser.cpp550
-rw-r--r--cpp/src/IceStorm/Parser.h4
-rw-r--r--cpp/src/IceStorm/Service.cpp60
-rw-r--r--cpp/src/IceStorm/Subscriber.cpp504
-rw-r--r--cpp/src/IceStorm/Subscriber.h14
-rw-r--r--cpp/src/IceStorm/SubscriberPool.cpp422
-rw-r--r--cpp/src/IceStorm/TopicI.cpp484
-rw-r--r--cpp/src/IceStorm/TopicI.h2
-rw-r--r--cpp/src/IceStorm/TopicManagerI.cpp52
-rw-r--r--cpp/src/IceStorm/TopicManagerI.h6
-rw-r--r--cpp/src/IceUtil/Cond.cpp96
-rwxr-xr-xcpp/src/IceUtil/ConvertUTF.cpp478
-rwxr-xr-xcpp/src/IceUtil/ConvertUTF.h34
-rw-r--r--cpp/src/IceUtil/CountDownLatch.cpp70
-rw-r--r--cpp/src/IceUtil/CtrlCHandler.cpp120
-rw-r--r--cpp/src/IceUtil/Exception.cpp4
-rw-r--r--cpp/src/IceUtil/InputUtil.cpp130
-rw-r--r--cpp/src/IceUtil/MD5I.cpp128
-rw-r--r--cpp/src/IceUtil/MD5I.h16
-rwxr-xr-xcpp/src/IceUtil/Options.cpp1210
-rw-r--r--cpp/src/IceUtil/OutputUtil.cpp146
-rw-r--r--cpp/src/IceUtil/RWRecMutex.cpp318
-rw-r--r--cpp/src/IceUtil/Random.cpp126
-rw-r--r--cpp/src/IceUtil/RecMutex.cpp116
-rw-r--r--cpp/src/IceUtil/StaticMutex.cpp40
-rw-r--r--cpp/src/IceUtil/StringUtil.cpp358
-rw-r--r--cpp/src/IceUtil/Thread.cpp132
-rw-r--r--cpp/src/IceUtil/ThreadException.cpp46
-rw-r--r--cpp/src/IceUtil/Time.cpp2
-rw-r--r--cpp/src/IceUtil/UUID.cpp26
-rw-r--r--cpp/src/IceUtil/Unicode.cpp116
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp1428
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp1260
-rwxr-xr-xcpp/src/Slice/DotNetNames.cpp130
-rw-r--r--cpp/src/Slice/JavaUtil.cpp1844
-rw-r--r--cpp/src/Slice/Parser.cpp3934
-rw-r--r--cpp/src/Slice/Preprocessor.cpp226
-rw-r--r--cpp/src/Slice/PythonUtil.cpp468
-rw-r--r--cpp/src/Slice/RubyUtil.cpp1778
-rwxr-xr-xcpp/src/Slice/VbUtil.cpp1298
-rw-r--r--cpp/src/ca/ImportKey.java184
-rw-r--r--cpp/src/icecpp/cccp.c6174
-rw-r--r--cpp/src/icecpp/gansidecl.h12
-rw-r--r--cpp/src/icecpp/pcp.h14
-rw-r--r--cpp/src/icecpp/prefix.c30
-rw-r--r--cpp/src/slice2cpp/Gen.cpp4608
-rw-r--r--cpp/src/slice2cpp/Gen.h348
-rw-r--r--cpp/src/slice2cpp/Main.cpp152
-rw-r--r--cpp/src/slice2cppe/Gen.cpp2388
-rw-r--r--cpp/src/slice2cppe/Gen.h204
-rw-r--r--cpp/src/slice2cppe/Main.cpp150
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp4664
-rw-r--r--cpp/src/slice2cs/Gen.h144
-rw-r--r--cpp/src/slice2cs/Main.cpp170
-rw-r--r--cpp/src/slice2docbook/Gen.cpp1678
-rw-r--r--cpp/src/slice2docbook/Main.cpp120
-rw-r--r--cpp/src/slice2freeze/Main.cpp2142
-rw-r--r--cpp/src/slice2freezej/Main.cpp1436
-rw-r--r--cpp/src/slice2html/Gen.cpp2186
-rw-r--r--cpp/src/slice2html/Gen.h4
-rw-r--r--cpp/src/slice2html/Main.cpp164
-rw-r--r--cpp/src/slice2java/Gen.cpp3508
-rw-r--r--cpp/src/slice2java/Gen.h12
-rw-r--r--cpp/src/slice2java/Main.cpp204
-rw-r--r--cpp/src/slice2javae/Gen.cpp1432
-rw-r--r--cpp/src/slice2javae/Gen.h2
-rw-r--r--cpp/src/slice2javae/Main.cpp162
-rw-r--r--cpp/src/slice2py/Main.cpp182
-rw-r--r--cpp/src/slice2rb/Main.cpp152
-rwxr-xr-xcpp/src/slice2vb/Gen.cpp5302
-rw-r--r--cpp/src/slice2vb/Gen.h140
-rw-r--r--cpp/src/slice2vb/Main.cpp170
-rw-r--r--cpp/test/Freeze/complex/Client.cpp126
-rw-r--r--cpp/test/Freeze/complex/NodeI.h48
-rw-r--r--cpp/test/Freeze/complex/Parser.cpp14
-rw-r--r--cpp/test/Freeze/dbmap/Client.cpp596
-rw-r--r--cpp/test/Freeze/evictor/Client.cpp896
-rw-r--r--cpp/test/Freeze/evictor/Test.ice2
-rw-r--r--cpp/test/Freeze/evictor/TestI.cpp42
-rw-r--r--cpp/test/Freeze/evictor/TestI.h2
-rw-r--r--cpp/test/Freeze/oldevictor/Client.cpp896
-rw-r--r--cpp/test/Freeze/oldevictor/Test.ice2
-rw-r--r--cpp/test/Freeze/oldevictor/TestI.cpp42
-rw-r--r--cpp/test/Freeze/oldevictor/TestI.h2
-rwxr-xr-xcpp/test/FreezeScript/dbmap/run.py4
-rw-r--r--cpp/test/FreezeScript/evictor/makedb.cpp2
-rw-r--r--cpp/test/Glacier2/attack/Client.cpp92
-rw-r--r--cpp/test/Glacier2/attack/Server.cpp6
-rwxr-xr-xcpp/test/Glacier2/dynamicFiltering/Client.cpp136
-rwxr-xr-xcpp/test/Glacier2/dynamicFiltering/Server.cpp32
-rwxr-xr-xcpp/test/Glacier2/dynamicFiltering/SessionI.cpp2
-rwxr-xr-xcpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp194
-rw-r--r--cpp/test/Glacier2/dynamicFiltering/TestControllerI.h24
-rwxr-xr-xcpp/test/Glacier2/dynamicFiltering/run.py6
-rw-r--r--cpp/test/Glacier2/router/Callback.ice4
-rw-r--r--cpp/test/Glacier2/router/CallbackI.cpp122
-rw-r--r--cpp/test/Glacier2/router/CallbackI.h22
-rw-r--r--cpp/test/Glacier2/router/Client.cpp1252
-rw-r--r--cpp/test/Glacier2/sessionControl/Client.cpp22
-rw-r--r--cpp/test/Glacier2/sessionControl/SessionI.cpp10
-rwxr-xr-xcpp/test/Glacier2/sessionControl/run.py4
-rwxr-xr-xcpp/test/Glacier2/ssl/Client.cpp34
-rwxr-xr-xcpp/test/Glacier2/ssl/Server.cpp90
-rwxr-xr-xcpp/test/Glacier2/ssl/run.py4
-rwxr-xr-xcpp/test/Glacier2/staticFiltering/Client.cpp180
-rw-r--r--cpp/test/Glacier2/staticFiltering/Server.cpp38
-rwxr-xr-xcpp/test/Glacier2/staticFiltering/run.py248
-rw-r--r--cpp/test/Ice/adapterDeactivation/AllTests.cpp38
-rw-r--r--cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp2
-rw-r--r--cpp/test/Ice/adapterDeactivation/TestI.cpp2
-rw-r--r--cpp/test/Ice/binding/AllTests.cpp1108
-rw-r--r--cpp/test/Ice/binding/Client.cpp26
-rw-r--r--cpp/test/Ice/binding/Server.cpp26
-rw-r--r--cpp/test/Ice/binding/TestI.cpp4
-rw-r--r--cpp/test/Ice/binding/TestI.h2
-rw-r--r--cpp/test/Ice/checksum/client/Client.cpp26
-rw-r--r--cpp/test/Ice/checksum/server/Server.cpp26
-rw-r--r--cpp/test/Ice/custom/AllTests.cpp1530
-rw-r--r--cpp/test/Ice/custom/Client.cpp4
-rw-r--r--cpp/test/Ice/custom/Collocated.cpp10
-rw-r--r--cpp/test/Ice/custom/MyByteSeq.cpp6
-rw-r--r--cpp/test/Ice/custom/Server.cpp10
-rw-r--r--cpp/test/Ice/custom/ServerAMD.cpp12
-rw-r--r--cpp/test/Ice/custom/StringConverterI.cpp4
-rw-r--r--cpp/test/Ice/custom/StringConverterI.h4
-rw-r--r--cpp/test/Ice/custom/Test.ice10
-rw-r--r--cpp/test/Ice/custom/TestAMD.ice10
-rw-r--r--cpp/test/Ice/custom/TestAMDI.cpp130
-rw-r--r--cpp/test/Ice/custom/TestAMDI.h128
-rw-r--r--cpp/test/Ice/custom/TestI.cpp98
-rw-r--r--cpp/test/Ice/custom/TestI.h96
-rw-r--r--cpp/test/Ice/custom/WstringAMDI.cpp24
-rw-r--r--cpp/test/Ice/custom/WstringAMDI.h24
-rw-r--r--cpp/test/Ice/custom/WstringI.cpp20
-rw-r--r--cpp/test/Ice/custom/WstringI.h20
-rw-r--r--cpp/test/Ice/exceptions/AllTests.cpp1346
-rw-r--r--cpp/test/Ice/exceptions/Client.cpp26
-rw-r--r--cpp/test/Ice/exceptions/Collocated.cpp26
-rw-r--r--cpp/test/Ice/exceptions/Server.cpp26
-rw-r--r--cpp/test/Ice/exceptions/ServerAMD.cpp26
-rw-r--r--cpp/test/Ice/exceptions/Test.ice2
-rw-r--r--cpp/test/Ice/exceptions/TestAMD.ice2
-rw-r--r--cpp/test/Ice/exceptions/TestAMDI.cpp46
-rw-r--r--cpp/test/Ice/exceptions/TestAMDI.h34
-rw-r--r--cpp/test/Ice/exceptions/TestI.cpp12
-rw-r--r--cpp/test/Ice/facets/AllTests.cpp12
-rw-r--r--cpp/test/Ice/facets/Client.cpp26
-rw-r--r--cpp/test/Ice/facets/Collocated.cpp26
-rw-r--r--cpp/test/Ice/facets/Server.cpp26
-rw-r--r--cpp/test/Ice/faultTolerance/AllTests.cpp328
-rw-r--r--cpp/test/Ice/faultTolerance/Client.cpp66
-rw-r--r--cpp/test/Ice/faultTolerance/Server.cpp72
-rw-r--r--cpp/test/Ice/gc/Client.cpp634
-rw-r--r--cpp/test/Ice/gc/Test.ice54
-rw-r--r--cpp/test/Ice/hold/AllTests.cpp2
-rw-r--r--cpp/test/Ice/hold/Client.cpp26
-rw-r--r--cpp/test/Ice/hold/Server.cpp26
-rw-r--r--cpp/test/Ice/hold/TestI.cpp6
-rw-r--r--cpp/test/Ice/inheritance/Client.cpp26
-rw-r--r--cpp/test/Ice/inheritance/Collocated.cpp26
-rw-r--r--cpp/test/Ice/inheritance/Server.cpp26
-rw-r--r--cpp/test/Ice/inheritance/TestI.h2
-rw-r--r--cpp/test/Ice/location/AllTests.cpp120
-rw-r--r--cpp/test/Ice/location/Client.cpp30
-rw-r--r--cpp/test/Ice/location/Server.cpp34
-rw-r--r--cpp/test/Ice/location/ServerLocator.cpp14
-rw-r--r--cpp/test/Ice/location/ServerLocator.h12
-rw-r--r--cpp/test/Ice/location/TestI.cpp20
-rw-r--r--cpp/test/Ice/location/TestI.h2
-rw-r--r--cpp/test/Ice/objects/AllTests.cpp52
-rw-r--r--cpp/test/Ice/objects/Client.cpp56
-rw-r--r--cpp/test/Ice/objects/Collocated.cpp26
-rw-r--r--cpp/test/Ice/objects/Server.cpp26
-rw-r--r--cpp/test/Ice/objects/TestI.cpp2
-rw-r--r--cpp/test/Ice/operations/AllTests.cpp44
-rw-r--r--cpp/test/Ice/operations/BatchOneways.cpp36
-rw-r--r--cpp/test/Ice/operations/Client.cpp68
-rw-r--r--cpp/test/Ice/operations/Collocated.cpp30
-rw-r--r--cpp/test/Ice/operations/Server.cpp32
-rw-r--r--cpp/test/Ice/operations/ServerAMD.cpp32
-rw-r--r--cpp/test/Ice/operations/Test.ice44
-rw-r--r--cpp/test/Ice/operations/TestAMD.ice44
-rw-r--r--cpp/test/Ice/operations/TestAMDI.cpp168
-rw-r--r--cpp/test/Ice/operations/TestAMDI.h110
-rw-r--r--cpp/test/Ice/operations/TestI.cpp168
-rw-r--r--cpp/test/Ice/operations/TestI.h152
-rw-r--r--cpp/test/Ice/operations/Twoways.cpp1252
-rw-r--r--cpp/test/Ice/operations/TwowaysAMI.cpp1474
-rw-r--r--cpp/test/Ice/retry/AllTests.cpp46
-rw-r--r--cpp/test/Ice/retry/Client.cpp44
-rw-r--r--cpp/test/Ice/retry/Server.cpp26
-rw-r--r--cpp/test/Ice/retry/TestI.cpp2
-rw-r--r--cpp/test/Ice/servantLocator/AllTests.cpp94
-rw-r--r--cpp/test/Ice/servantLocator/Collocated.cpp12
-rw-r--r--cpp/test/Ice/servantLocator/ServantLocatorI.cpp26
-rw-r--r--cpp/test/Ice/servantLocator/Server.cpp12
-rw-r--r--cpp/test/Ice/servantLocator/ServerAMD.cpp12
-rw-r--r--cpp/test/Ice/slicing/exceptions/AllTests.cpp914
-rw-r--r--cpp/test/Ice/slicing/exceptions/Client.cpp26
-rw-r--r--cpp/test/Ice/slicing/exceptions/Server.cpp26
-rw-r--r--cpp/test/Ice/slicing/exceptions/ServerAMD.cpp26
-rw-r--r--cpp/test/Ice/slicing/exceptions/TestAMDI.cpp8
-rw-r--r--cpp/test/Ice/slicing/exceptions/TestAMDI.h32
-rw-r--r--cpp/test/Ice/slicing/objects/AllTests.cpp2418
-rw-r--r--cpp/test/Ice/slicing/objects/Client.cpp26
-rw-r--r--cpp/test/Ice/slicing/objects/Server.cpp26
-rw-r--r--cpp/test/Ice/slicing/objects/ServerAMD.cpp26
-rw-r--r--cpp/test/Ice/slicing/objects/Test.ice4
-rw-r--r--cpp/test/Ice/slicing/objects/TestAMD.ice4
-rw-r--r--cpp/test/Ice/slicing/objects/TestAMDI.cpp34
-rw-r--r--cpp/test/Ice/slicing/objects/TestAMDI.h16
-rw-r--r--cpp/test/Ice/slicing/objects/TestI.cpp30
-rw-r--r--cpp/test/Ice/stream/Client.cpp4
-rw-r--r--cpp/test/Ice/timeout/AllTests.cpp462
-rw-r--r--cpp/test/Ice/timeout/Client.cpp52
-rw-r--r--cpp/test/Ice/timeout/Server.cpp38
-rw-r--r--cpp/test/Ice/timeout/TestI.cpp6
-rw-r--r--cpp/test/IceGrid/activation/AllTests.cpp844
-rw-r--r--cpp/test/IceGrid/activation/Client.cpp26
-rw-r--r--cpp/test/IceGrid/activation/Server.cpp8
-rw-r--r--cpp/test/IceGrid/allocation/AllTests.cpp1868
-rw-r--r--cpp/test/IceGrid/allocation/Client.cpp30
-rw-r--r--cpp/test/IceGrid/allocation/PermissionsVerifier.cpp12
-rw-r--r--cpp/test/IceGrid/deployer/AllTests.cpp88
-rw-r--r--cpp/test/IceGrid/deployer/Client.cpp64
-rw-r--r--cpp/test/IceGrid/deployer/Service.cpp16
-rw-r--r--cpp/test/IceGrid/distribution/AllTests.cpp142
-rw-r--r--cpp/test/IceGrid/distribution/Client.cpp30
-rw-r--r--cpp/test/IceGrid/distribution/TestI.cpp4
-rwxr-xr-xcpp/test/IceGrid/distribution/run.py2
-rw-r--r--cpp/test/IceGrid/replicaGroup/AllTests.cpp798
-rw-r--r--cpp/test/IceGrid/replicaGroup/Client.cpp26
-rw-r--r--cpp/test/IceGrid/replicaGroup/Service.cpp8
-rw-r--r--cpp/test/IceGrid/replication/AllTests.cpp1730
-rw-r--r--cpp/test/IceGrid/replication/Client.cpp28
-rw-r--r--cpp/test/IceGrid/session/AllTests.cpp3072
-rw-r--r--cpp/test/IceGrid/session/Client.cpp34
-rw-r--r--cpp/test/IceGrid/session/PermissionsVerifier.cpp26
-rw-r--r--cpp/test/IceGrid/session/Server.cpp22
-rw-r--r--cpp/test/IceGrid/simple/AllTests.cpp42
-rw-r--r--cpp/test/IceGrid/simple/Client.cpp44
-rw-r--r--cpp/test/IceGrid/simple/Server.cpp2
-rwxr-xr-xcpp/test/IceGrid/simple/run.py2
-rw-r--r--cpp/test/IceGrid/update/AllTests.cpp2152
-rw-r--r--cpp/test/IceGrid/update/Client.cpp30
-rwxr-xr-xcpp/test/IceGrid/update/run.py2
-rw-r--r--cpp/test/IceSSL/configuration/AllTests.cpp2446
-rw-r--r--cpp/test/IceSSL/configuration/Client.cpp30
-rw-r--r--cpp/test/IceSSL/configuration/Server.cpp26
-rw-r--r--cpp/test/IceSSL/configuration/TestI.cpp28
-rw-r--r--cpp/test/IceStorm/federation/Publisher.cpp70
-rw-r--r--cpp/test/IceStorm/federation/Subscriber.cpp110
-rwxr-xr-xcpp/test/IceStorm/federation/run.py4
-rw-r--r--cpp/test/IceStorm/federation2/Publisher.cpp44
-rw-r--r--cpp/test/IceStorm/federation2/Subscriber.cpp102
-rwxr-xr-xcpp/test/IceStorm/federation2/run.py92
-rw-r--r--cpp/test/IceStorm/single/Publisher.cpp46
-rw-r--r--cpp/test/IceStorm/single/Subscriber.cpp238
-rw-r--r--cpp/test/IceStorm/stress/Publisher.cpp70
-rw-r--r--cpp/test/IceStorm/stress/Subscriber.cpp306
-rwxr-xr-xcpp/test/IceStorm/stress/run.py90
-rw-r--r--cpp/test/IceUtil/ctrlCHandler/Client.cpp14
-rw-r--r--cpp/test/IceUtil/inputUtil/Client.cpp16
-rw-r--r--cpp/test/IceUtil/thread/AliveTest.cpp36
-rw-r--r--cpp/test/IceUtil/thread/Client.cpp14
-rw-r--r--cpp/test/IceUtil/thread/CountDownLatchTest.cpp72
-rw-r--r--cpp/test/IceUtil/thread/CreateTest.cpp24
-rw-r--r--cpp/test/IceUtil/thread/MonitorMutexTest.cpp102
-rw-r--r--cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp94
-rw-r--r--cpp/test/IceUtil/thread/MutexTest.cpp172
-rw-r--r--cpp/test/IceUtil/thread/RWRecMutexTest.cpp954
-rw-r--r--cpp/test/IceUtil/thread/RecMutexTest.cpp68
-rw-r--r--cpp/test/IceUtil/thread/StartTest.cpp16
-rw-r--r--cpp/test/IceUtil/thread/StaticMutexTest.cpp148
-rw-r--r--cpp/test/IceUtil/thread/TestBase.cpp6
-rw-r--r--cpp/test/IceUtil/unicode/Client.cpp214
-rw-r--r--cpp/test/IceUtil/uuid/Client.cpp122
-rw-r--r--cpp/test/Slice/errorDetection/CaseInsensitive.ice4
-rw-r--r--cpp/test/Slice/errorDetection/ChangedMeaning.ice56
-rw-r--r--cpp/test/Slice/errorDetection/ConstDef.ice60
-rw-r--r--cpp/test/Slice/errorDetection/DerivedRedefinition.ice16
-rw-r--r--cpp/test/Slice/errorDetection/IdentAsKeyword.ice14
-rw-r--r--cpp/test/Slice/errorDetection/IllegalDictionary.ice40
-rw-r--r--cpp/test/Slice/errorDetection/IllegalLocal.ice38
-rw-r--r--cpp/test/Slice/errorDetection/IllegalMI.ice44
-rw-r--r--cpp/test/Slice/errorDetection/Reserved.ice2
-rw-r--r--cpp/test/Slice/errorDetection/SelfContainment.ice4
-rw-r--r--cpp/test/Slice/errorDetection/StructMembers.ice26
-rwxr-xr-xcpp/test/Slice/errorDetection/run.py4
658 files changed, 86357 insertions, 86357 deletions
diff --git a/cpp/RPMTools.py b/cpp/RPMTools.py
index 06eb1c1ff98..698390914d0 100644
--- a/cpp/RPMTools.py
+++ b/cpp/RPMTools.py
@@ -44,51 +44,51 @@ class Package:
self.group = group
self.description = description
self.filelist = filelist
- self.other = other
- self.prepTextGen = []
- self.buildTextGen = []
- self.installTextGen = []
+ self.other = other
+ self.prepTextGen = []
+ self.buildTextGen = []
+ self.installTextGen = []
def writeHdr(self, ofile, version, release, installDir, targetHost):
- ofile.write('%define _unpackaged_files_terminate_build 0\n')
- ofile.write('\n%define core_arches %{ix86} x86_64\n')
- ofile.write('Summary: ' + self.summary + '\n')
- ofile.write('Name: ' + self.name + '\n')
- ofile.write('Version: ' + version + '\n')
- ofile.write('Release: ' + release + '\n')
- if len(self.requires) != 0:
+ ofile.write('%define _unpackaged_files_terminate_build 0\n')
+ ofile.write('\n%define core_arches %{ix86} x86_64\n')
+ ofile.write('Summary: ' + self.summary + '\n')
+ ofile.write('Name: ' + self.name + '\n')
+ ofile.write('Version: ' + version + '\n')
+ ofile.write('Release: ' + release + '\n')
+ if len(self.requires) != 0:
if self.requires.find('%version%'):
self.requires = self.requires.replace('%version%', version)
- ofile.write('Requires: ' + self.requires + '\n')
- ofile.write('License: GPL\n')
- ofile.write('Group:' + self.group + '\n')
- ofile.write('Vendor: ZeroC, Inc\n')
- ofile.write('URL: http://www.zeroc.com/\n')
-
- #
- # major.minor is part of the URL, this needs to be parameterized.
- #
+ ofile.write('Requires: ' + self.requires + '\n')
+ ofile.write('License: GPL\n')
+ ofile.write('Group:' + self.group + '\n')
+ ofile.write('Vendor: ZeroC, Inc\n')
+ ofile.write('URL: http://www.zeroc.com/\n')
+
+ #
+ # major.minor is part of the URL, this needs to be parameterized.
+ #
minorVer = version[0:3]
- ofile.write('Source0: http://www.zeroc.com/download/Ice/' + minorVer + '/Ice-%{version}.tar.gz\n')
- ofile.write('Source1: http://www.zeroc.com/download/Ice/' + minorVer + '/IceJ-%{version}-java2.tar.gz\n')
- ofile.write('Source2: http://www.zeroc.com/download/Ice/' + minorVer + '/IcePy-%{version}.tar.gz\n')
- ofile.write('Source3: http://www.zeroc.com/download/Ice/' + minorVer + '/IceCS-%{version}.tar.gz\n')
- ofile.write('Source4: http://www.zeroc.com/download/Ice/' + minorVer + '/IceJ-%{version}-java5.tar.gz\n')
- ofile.write('Source5: http://www.zeroc.com/download/Ice/' + minorVer + '/IcePHP-%{version}.tar.gz\n')
+ ofile.write('Source0: http://www.zeroc.com/download/Ice/' + minorVer + '/Ice-%{version}.tar.gz\n')
+ ofile.write('Source1: http://www.zeroc.com/download/Ice/' + minorVer + '/IceJ-%{version}-java2.tar.gz\n')
+ ofile.write('Source2: http://www.zeroc.com/download/Ice/' + minorVer + '/IcePy-%{version}.tar.gz\n')
+ ofile.write('Source3: http://www.zeroc.com/download/Ice/' + minorVer + '/IceCS-%{version}.tar.gz\n')
+ ofile.write('Source4: http://www.zeroc.com/download/Ice/' + minorVer + '/IceJ-%{version}-java5.tar.gz\n')
+ ofile.write('Source5: http://www.zeroc.com/download/Ice/' + minorVer + '/IcePHP-%{version}.tar.gz\n')
ofile.write('Source6: http://www.zeroc.com/download/Ice/' + minorVer + '/THIRD_PARTY_LICENSE\n')
- ofile.write('Source7: http://www.zeroc.com/download/Ice/' + minorVer + '/ice.ini\n')
- ofile.write('Source8: http://www.zeroc.com/download/Ice/' + minorVer + '/README.Linux-RPM\n')
+ ofile.write('Source7: http://www.zeroc.com/download/Ice/' + minorVer + '/ice.ini\n')
+ ofile.write('Source8: http://www.zeroc.com/download/Ice/' + minorVer + '/README.Linux-RPM\n')
ofile.write('Source9: http://www.zeroc.com/download/Ice/' + minorVer + '/SOURCES\n')
- if targetHost != "suse":
- ofile.write('Source10: http://www.zeroc.com/download/Ice/' + minorVer + '/IceRuby-%{version}.tar.gz\n')
-
- ofile.write('\n')
- if len(installDir) != 0:
- ofile.write('BuildRoot: ' + installDir + '\n')
- else:
- ofile.write('BuildRoot: /var/tmp/Ice-' + version + '-' + release + '-buildroot\n')
+ if targetHost != "suse":
+ ofile.write('Source10: http://www.zeroc.com/download/Ice/' + minorVer + '/IceRuby-%{version}.tar.gz\n')
+
+ ofile.write('\n')
+ if len(installDir) != 0:
+ ofile.write('BuildRoot: ' + installDir + '\n')
+ else:
+ ofile.write('BuildRoot: /var/tmp/Ice-' + version + '-' + release + '-buildroot\n')
ofile.write('\n')
- ofile.write('''
+ ofile.write('''
%ifarch x86_64
%define icelibdir lib64
%else
@@ -99,109 +99,109 @@ class Package:
''')
ofile.write('BuildRequires: mono-core >= 1.2.2\n')
- ofile.write('\n%endif\n')
+ ofile.write('\n%endif\n')
- buildRequiresList = ['python >= 2.3.4', 'python-devel >= 2.3.4',
- 'expat >= 0.5.0', 'libstdc++ >= 3.2', 'gcc >= 3.2', 'gcc-c++ >= 3.2', 'tar',
- 'binutils >= 2.10', 'openssl >= 0.9.7a', 'openssl-devel >= 0.9.7a', 'ncurses >= 5.4']
+ buildRequiresList = ['python >= 2.3.4', 'python-devel >= 2.3.4',
+ 'expat >= 0.5.0', 'libstdc++ >= 3.2', 'gcc >= 3.2', 'gcc-c++ >= 3.2', 'tar',
+ 'binutils >= 2.10', 'openssl >= 0.9.7a', 'openssl-devel >= 0.9.7a', 'ncurses >= 5.4']
- if targetHost == "suse":
- buildRequiresList.extend(['bzip >= 1.0.2', 'php5 >= 5.1.2', 'php5-devel >= 5.1.2'])
- else:
- buildRequiresList.extend(['bzip2-devel >= 1.0.2', 'bzip2-libs >= 1.0.2', 'db45 >= 4.5.20',
- 'expat-devel >= 0.5.0', 'php >= 5.1.4', 'php-devel >= 5.1.4'])
+ if targetHost == "suse":
+ buildRequiresList.extend(['bzip >= 1.0.2', 'php5 >= 5.1.2', 'php5-devel >= 5.1.2'])
+ else:
+ buildRequiresList.extend(['bzip2-devel >= 1.0.2', 'bzip2-libs >= 1.0.2', 'db45 >= 4.5.20',
+ 'expat-devel >= 0.5.0', 'php >= 5.1.4', 'php-devel >= 5.1.4'])
- for f in buildRequiresList:
+ for f in buildRequiresList:
ofile.write('BuildRequires: ' + f + '\n')
- ofile.write('\n')
-
- ofile.write('Provides: %s-%%{_arch}\n' % self.name)
- ofile.write('%description\n')
- ofile.write(self.description)
- ofile.write('\n')
- ofile.write('%prep\n')
- for g in self.prepTextGen:
- g(ofile, version, targetHost)
- ofile.write('\n')
- ofile.write('%build\n')
- for g in self.buildTextGen:
- g(ofile, version, targetHost)
- ofile.write('\n')
- ofile.write('%install\n')
- for g in self.installTextGen:
- g(ofile, version, targetHost)
- ofile.write('\n')
- ofile.write('%clean\n')
- ofile.write('\n')
- ofile.write('%changelog\n')
- ofile.write('* Fri Dec 6 2006 ZeroC Staff\n')
- ofile.write('- See source distributions or the ZeroC website for more information\n')
- ofile.write(' about the changes in this release\n')
- ofile.write('\n')
+ ofile.write('\n')
+
+ ofile.write('Provides: %s-%%{_arch}\n' % self.name)
+ ofile.write('%description\n')
+ ofile.write(self.description)
+ ofile.write('\n')
+ ofile.write('%prep\n')
+ for g in self.prepTextGen:
+ g(ofile, version, targetHost)
+ ofile.write('\n')
+ ofile.write('%build\n')
+ for g in self.buildTextGen:
+ g(ofile, version, targetHost)
+ ofile.write('\n')
+ ofile.write('%install\n')
+ for g in self.installTextGen:
+ g(ofile, version, targetHost)
+ ofile.write('\n')
+ ofile.write('%clean\n')
+ ofile.write('\n')
+ ofile.write('%changelog\n')
+ ofile.write('* Fri Dec 6 2006 ZeroC Staff\n')
+ ofile.write('- See source distributions or the ZeroC website for more information\n')
+ ofile.write(' about the changes in this release\n')
+ ofile.write('\n')
def writeFileList(self, ofile, version, intVersion, installDir):
ofile.write('%defattr(644, root, root, 755)\n\n')
for perm, f in self.filelist:
prefix = ''
-
- #
- # Select an RPM spec file attribute depending on the type of
- # file or directory we've specified.
- #
+
+ #
+ # Select an RPM spec file attribute depending on the type of
+ # file or directory we've specified.
+ #
if perm == 'exe' or perm == 'lib':
prefix = '%attr(755, root, root) '
- elif perm == 'cfg':
- prefix = '%config'
- elif perm == 'xdir':
- prefix = '%dir '
+ elif perm == 'cfg':
+ prefix = '%config'
+ elif perm == 'xdir':
+ prefix = '%dir '
if f.find('%version%'):
f = f.replace('%version%', version)
if perm == 'lib' and f.endswith('.VERSION'):
- fname = os.path.splitext(f)[0]
+ fname = os.path.splitext(f)[0]
ofile.write(prefix + '/usr/' + fname + '.' + version + '\n')
ofile.write(prefix + '/usr/' + fname + '.' + str(intVersion) + '\n')
- elif perm == 'cfg':
- ofile.write(f + '\n')
- else:
- ofile.write(prefix + '/usr/' + f + '\n')
+ elif perm == 'cfg':
+ ofile.write(f + '\n')
+ else:
+ ofile.write(prefix + '/usr/' + f + '\n')
ofile.write('\n')
def writePostInstall(self, ofile, version, intVersion, installDir):
- pass
+ pass
def writePostUninstall(self, ofile, version, intVersion, installDir):
- pass
+ pass
def writeFilesImpl(self, ofile, version, intVersion, installDir):
ofile.write('%files\n')
self.writeFileList(ofile, version, intVersion, installDir)
- ofile.write('\n')
+ ofile.write('\n')
- ofile.write('%post\n')
- self.writePostInstall(ofile, version, intVersion, installDir)
+ ofile.write('%post\n')
+ self.writePostInstall(ofile, version, intVersion, installDir)
- ofile.write('%postun\n')
- self.writePostUninstall(ofile, version, intVersion, installDir)
- ofile.write('\n')
+ ofile.write('%postun\n')
+ self.writePostUninstall(ofile, version, intVersion, installDir)
+ ofile.write('\n')
def writeFiles(self, ofile, version, intVersion, installDir):
- ofile.write('\n%ifarch %{core_arches}\n')
- self.writeFilesImpl(ofile, version, intVersion, installDir)
- ofile.write('\n%else\n')
- ofile.write('%files\n')
- ofile.write('\n%endif\n')
+ ofile.write('\n%ifarch %{core_arches}\n')
+ self.writeFilesImpl(ofile, version, intVersion, installDir)
+ ofile.write('\n%else\n')
+ ofile.write('%files\n')
+ ofile.write('\n%endif\n')
def addPrepGenerator(self, gen):
- self.prepTextGen.append(gen)
+ self.prepTextGen.append(gen)
def addBuildGenerator(self, gen):
- self.buildTextGen.append(gen)
+ self.buildTextGen.append(gen)
def addInstallGenerator(self, gen):
- self.installTextGen.append(gen)
+ self.installTextGen.append(gen)
#
# Represents subpackages in an RPM spec file.
@@ -211,67 +211,67 @@ class Subpackage(Package):
def writeFilesImpl(self, ofile, version, intVersion, installDir):
ofile.write('%%files %s\n' % self.name)
self.writeFileList(ofile, version, intVersion, installDir)
- ofile.write('\n')
+ ofile.write('\n')
- ofile.write('%%post %s\n' % self.name)
- self.writePostInstall(ofile, version, intVersion, installDir)
+ ofile.write('%%post %s\n' % self.name)
+ self.writePostInstall(ofile, version, intVersion, installDir)
- ofile.write('%%postun %s\n' % self.name)
- self.writePostUninstall(ofile, version, intVersion, installDir)
- ofile.write('\n')
+ ofile.write('%%postun %s\n' % self.name)
+ self.writePostUninstall(ofile, version, intVersion, installDir)
+ ofile.write('\n')
def writeFiles(self, ofile, version, intVersion, installDir):
- ofile.write('\n%ifarch %{core_arches}\n')
- self.writeFilesImpl(ofile, version, intVersion, installDir)
- ofile.write('\n%endif\n')
+ ofile.write('\n%ifarch %{core_arches}\n')
+ self.writeFilesImpl(ofile, version, intVersion, installDir)
+ ofile.write('\n%endif\n')
def writeSubpackageHeader(self, ofile, version, release, installDir):
ofile.write('%package ' + self.name + '\n')
ofile.write('Summary: ' + self.summary + '\n')
ofile.write('Group: ' + self.group + '\n')
- if len(self.requires) != 0:
+ if len(self.requires) != 0:
if self.requires.find('%version%'):
self.requires = self.requires.replace('%version%', version)
- ofile.write('Requires: ' + self.requires + '\n')
- if len(self.other) != 0:
- ofile.write(self.other + '\n')
+ ofile.write('Requires: ' + self.requires + '\n')
+ if len(self.other) != 0:
+ ofile.write(self.other + '\n')
ofile.write('%description ' + self.name + '\n')
ofile.write(self.description)
def writeHdr(self, ofile, version, release, installDir, targetHost):
- ofile.write('\n%ifarch %{core_arches}\n')
- self.writeSubpackageHeader(ofile, version, release, installDir)
- ofile.write('\n%endif\n')
+ ofile.write('\n%ifarch %{core_arches}\n')
+ self.writeSubpackageHeader(ofile, version, release, installDir)
+ ofile.write('\n%endif\n')
class NoarchSubpackage(Subpackage):
def writeHdr(self, ofile, version, release, installDir, targetHost):
- ofile.write('\n%ifarch noarch\n')
- self.writeSubpackageHeader(ofile, version, release, installDir)
- ofile.write('\n%endif\n')
+ ofile.write('\n%ifarch noarch\n')
+ self.writeSubpackageHeader(ofile, version, release, installDir)
+ ofile.write('\n%endif\n')
def writeFiles(self, ofile, version, intVersion, installDir):
- ofile.write('\n%ifarch noarch\n')
- self.writeFilesImpl(ofile, version, intVersion, installDir)
- ofile.write('\n%endif\n')
+ ofile.write('\n%ifarch noarch\n')
+ self.writeFilesImpl(ofile, version, intVersion, installDir)
+ ofile.write('\n%endif\n')
class DotNetPackage(Subpackage):
def writePostInstall(self, ofile, version, intVersion, installDir):
- ofile.write('\n%ifnarch noarch\n')
- ofile.write('''
+ ofile.write('\n%ifnarch noarch\n')
+ ofile.write('''
pklibdir="%{icelibdir}"
for f in icecs glacier2cs iceboxcs icegridcs icepatch2cs icestormcs;
do
sed -i.bak -e "s/^mono_root.*$/mono_root = \/usr/" /usr/$pklibdir/pkgconfig/$f.pc ;
done
- ''')
- ofile.write('\n%endif\n')
+ ''')
+ ofile.write('\n%endif\n')
class DotNetPackage(Subpackage):
def writePostInstall(self, ofile, version, intVersion, installDir):
- ofile.write('\n%ifnarch noarch\n')
- ofile.write('''
+ ofile.write('\n%ifnarch noarch\n')
+ ofile.write('''
pklibdir="lib"
%ifarch x86_64
@@ -282,37 +282,37 @@ for f in icecs glacier2cs iceboxcs icegridcs icepatch2cs icestormcs;
do
sed -i.bak -e "s/^mono_root.*$/mono_root = \/usr/" /usr/$pklibdir/pkgconfig/$f.pc ;
done
- ''')
- ofile.write('\n%endif\n')
+ ''')
+ ofile.write('\n%endif\n')
#
# NOTE: File transforms should be listed before directory transforms.
#
transforms = [ ('file', 'ice.ini', 'etc/php.d/ice.ini'),
- ('dir', 'lib', 'usr/lib'),
- ('dir', '%{icelibdir}', 'usr/%{icelibdir}'),
- ('file', 'usr/%{icelibdir}/IcePHP.so', 'usr/%{icelibdir}/php/modules/IcePHP.so'),
- ('file', 'usr/lib/Ice.jar', 'usr/lib/Ice-%version%/Ice.jar' ),
- ('dir', 'usr/lib/java2', 'usr/lib/Ice-%version%/java2' ),
- ('file', 'usr/lib/IceGridGUI.jar', 'usr/lib/Ice-%version%/IceGridGUI.jar' ),
- ('file', 'bin/icecs.dll', 'usr/lib/mono/gac/icecs/%version%.0__1f998c50fec78381/icecs.dll'),
- ('file', 'bin/glacier2cs.dll',
- 'usr/lib/mono/gac/glacier2cs/%version%.0__1f998c50fec78381/glacier2cs.dll'),
- ('file', 'bin/iceboxcs.dll',
- 'usr/lib/mono/gac/iceboxcs/%version%.0__1f998c50fec78381/iceboxcs.dll'),
- ('file', 'bin/icegridcs.dll',
- 'usr/lib/mono/gac/icegridcs/%version%.0__1f998c50fec78381/icegridcs.dll'),
- ('file', 'bin/icepatch2cs.dll',
- 'usr/lib/mono/gac/icepatch2cs/%version%.0__1f998c50fec78381/icepatch2cs.dll'),
- ('file', 'bin/icestormcs.dll',
- 'usr/lib/mono/gac/icestormcs/%version%.0__1f998c50fec78381/icestormcs.dll'),
- ('dir', 'ant', 'usr/lib/Ice-%version%/ant'),
- ('dir', 'config', 'usr/share/Ice-%version%'),
- ('dir', 'slice', 'usr/share/slice'),
- ('dir', 'bin', 'usr/bin'),
- ('dir', 'include', 'usr/include'),
- ('dir', 'python', 'usr/%{icelibdir}/Ice-%version%/python'),
- ('dir', 'ruby', 'usr/%{icelibdir}/Ice-%version%/ruby'),
+ ('dir', 'lib', 'usr/lib'),
+ ('dir', '%{icelibdir}', 'usr/%{icelibdir}'),
+ ('file', 'usr/%{icelibdir}/IcePHP.so', 'usr/%{icelibdir}/php/modules/IcePHP.so'),
+ ('file', 'usr/lib/Ice.jar', 'usr/lib/Ice-%version%/Ice.jar' ),
+ ('dir', 'usr/lib/java2', 'usr/lib/Ice-%version%/java2' ),
+ ('file', 'usr/lib/IceGridGUI.jar', 'usr/lib/Ice-%version%/IceGridGUI.jar' ),
+ ('file', 'bin/icecs.dll', 'usr/lib/mono/gac/icecs/%version%.0__1f998c50fec78381/icecs.dll'),
+ ('file', 'bin/glacier2cs.dll',
+ 'usr/lib/mono/gac/glacier2cs/%version%.0__1f998c50fec78381/glacier2cs.dll'),
+ ('file', 'bin/iceboxcs.dll',
+ 'usr/lib/mono/gac/iceboxcs/%version%.0__1f998c50fec78381/iceboxcs.dll'),
+ ('file', 'bin/icegridcs.dll',
+ 'usr/lib/mono/gac/icegridcs/%version%.0__1f998c50fec78381/icegridcs.dll'),
+ ('file', 'bin/icepatch2cs.dll',
+ 'usr/lib/mono/gac/icepatch2cs/%version%.0__1f998c50fec78381/icepatch2cs.dll'),
+ ('file', 'bin/icestormcs.dll',
+ 'usr/lib/mono/gac/icestormcs/%version%.0__1f998c50fec78381/icestormcs.dll'),
+ ('dir', 'ant', 'usr/lib/Ice-%version%/ant'),
+ ('dir', 'config', 'usr/share/Ice-%version%'),
+ ('dir', 'slice', 'usr/share/slice'),
+ ('dir', 'bin', 'usr/bin'),
+ ('dir', 'include', 'usr/include'),
+ ('dir', 'python', 'usr/%{icelibdir}/Ice-%version%/python'),
+ ('dir', 'ruby', 'usr/%{icelibdir}/Ice-%version%/ruby'),
('dir', 'doc', 'usr/share/doc/Ice-%version%/doc'),
('file', 'README', 'usr/share/doc/Ice-%version%/README'),
('file', 'ICE_LICENSE', 'usr/share/doc/Ice-%version%/ICE_LICENSE'),
@@ -324,10 +324,10 @@ transforms = [ ('file', 'ice.ini', 'etc/php.d/ice.ini'),
fileLists = [
Package('ice',
'',
- 'The Ice base runtime and services',
+ 'The Ice base runtime and services',
'System Environment/Libraries',
- iceDescription,
- 'Provides: ice-%{_arch}',
+ iceDescription,
+ 'Provides: ice-%{_arch}',
[('xdir', 'share/doc/Ice-%version%'),
('doc', 'share/doc/Ice-%version%/ICE_LICENSE'),
('doc', 'share/doc/Ice-%version%/LICENSE'),
@@ -363,121 +363,121 @@ fileLists = [
('lib', '%{icelibdir}/libSlice.so.VERSION'),
('lib', '%{icelibdir}/libIceGrid.so.VERSION'),
('xdir', 'lib/Ice-%version%'),
- ('file', 'lib/Ice-%version%/IceGridGUI.jar'),
+ ('file', 'lib/Ice-%version%/IceGridGUI.jar'),
('dir', 'share/slice'),
('dir', 'share/doc/Ice-%version%/doc'),
- ('xdir', 'share/Ice-%version%'),
- ('file', 'share/Ice-%version%/templates.xml'),
- ('exe', 'share/Ice-%version%/convertssl.py'),
+ ('xdir', 'share/Ice-%version%'),
+ ('file', 'share/Ice-%version%/templates.xml'),
+ ('exe', 'share/Ice-%version%/convertssl.py'),
('exe', 'share/Ice-%version%/upgradeicegrid.py'),
('file', 'share/Ice-%version%/icegrid-slice.3.1.ice.gz')]),
Subpackage('c++-devel',
'ice = %version%',
'Tools for developing Ice applications in C++',
'Development/Tools',
- iceDescription,
- 'Requires: ice-%{_arch}',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
[('exe', 'bin/slice2cpp'),
('exe', 'bin/slice2freeze'),
('dir', 'include'),
- ('lib', '%{icelibdir}/libFreeze.so'),
- ('lib', '%{icelibdir}/libGlacier2.so'),
- ('lib', '%{icelibdir}/libIceBox.so'),
- ('lib', '%{icelibdir}/libIceGrid.so'),
- ('lib', '%{icelibdir}/libIcePatch2.so'),
- ('lib', '%{icelibdir}/libIce.so'),
- ('lib', '%{icelibdir}/libIceSSL.so'),
- ('lib', '%{icelibdir}/libIceStormService.so'),
- ('lib', '%{icelibdir}/libIceStorm.so'),
- ('lib', '%{icelibdir}/libIceUtil.so'),
- ('lib', '%{icelibdir}/libIceXML.so'),
- ('lib', '%{icelibdir}/libSlice.so')
- ]),
+ ('lib', '%{icelibdir}/libFreeze.so'),
+ ('lib', '%{icelibdir}/libGlacier2.so'),
+ ('lib', '%{icelibdir}/libIceBox.so'),
+ ('lib', '%{icelibdir}/libIceGrid.so'),
+ ('lib', '%{icelibdir}/libIcePatch2.so'),
+ ('lib', '%{icelibdir}/libIce.so'),
+ ('lib', '%{icelibdir}/libIceSSL.so'),
+ ('lib', '%{icelibdir}/libIceStormService.so'),
+ ('lib', '%{icelibdir}/libIceStorm.so'),
+ ('lib', '%{icelibdir}/libIceUtil.so'),
+ ('lib', '%{icelibdir}/libIceXML.so'),
+ ('lib', '%{icelibdir}/libSlice.so')
+ ]),
DotNetPackage('csharp-devel',
- 'ice-dotnet = %version%',
- 'Tools for developing Ice applications in C#',
- 'Development/Tools',
- iceDescription,
- 'Requires: ice-%{_arch}',
- [('exe', 'bin/slice2cs'),
- ('xdir', 'share/doc/Ice-%version%'),
- ('file', '%{icelibdir}/pkgconfig/icecs.pc'),
- ('file', '%{icelibdir}/pkgconfig/glacier2cs.pc'),
- ('file', '%{icelibdir}/pkgconfig/iceboxcs.pc'),
- ('file', '%{icelibdir}/pkgconfig/icegridcs.pc'),
- ('file', '%{icelibdir}/pkgconfig/icepatch2cs.pc'),
- ('file', '%{icelibdir}/pkgconfig/icestormcs.pc')]),
+ 'ice-dotnet = %version%',
+ 'Tools for developing Ice applications in C#',
+ 'Development/Tools',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
+ [('exe', 'bin/slice2cs'),
+ ('xdir', 'share/doc/Ice-%version%'),
+ ('file', '%{icelibdir}/pkgconfig/icecs.pc'),
+ ('file', '%{icelibdir}/pkgconfig/glacier2cs.pc'),
+ ('file', '%{icelibdir}/pkgconfig/iceboxcs.pc'),
+ ('file', '%{icelibdir}/pkgconfig/icegridcs.pc'),
+ ('file', '%{icelibdir}/pkgconfig/icepatch2cs.pc'),
+ ('file', '%{icelibdir}/pkgconfig/icestormcs.pc')]),
Subpackage('java-devel',
'ice-java = %version%',
'Tools for developing Ice applications in Java',
'Development/Tools',
- iceDescription,
- 'Requires: ice-%{_arch}',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
[('exe', 'bin/slice2java'),
('exe', 'bin/slice2freezej'),
- ('xdir', 'lib/Ice-%version%'),
- ('dir', 'lib/Ice-%version%/ant'), ]),
+ ('xdir', 'lib/Ice-%version%'),
+ ('dir', 'lib/Ice-%version%/ant'), ]),
Subpackage('python',
'ice = %version%, python >= 2.3.4',
'The Ice runtime for Python applications',
'System Environment/Libraries',
- iceDescription,
- 'Requires: ice-%{_arch}',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
[('dir', '%{icelibdir}/Ice-%version%/python')]),
Subpackage('python-devel',
'ice-python = %version%',
'Tools for developing Ice applications in Python',
'Development/Tools',
- iceDescription,
- 'Requires: ice-%{_arch}',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
[('exe', 'bin/slice2py')]),
Subpackage('ruby',
'ice = %version%, ruby >= 1.8.1',
'The Ice runtime for Ruby applications',
'System Environment/Libraries',
- iceDescription,
- 'Requires: ice-%{_arch}',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
[('dir', '%{icelibdir}/Ice-%version%/ruby')]),
Subpackage('ruby-devel',
'ice-ruby = %version%',
'Tools for developing Ice applications in Python',
'Development/Tools',
- iceDescription,
- 'Requires: ice-%{_arch}',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
[('exe', 'bin/slice2rb')]),
Subpackage('php',
- 'ice = %version%, php >= 5.1.2',
- 'The Ice runtime for PHP applications',
- 'System Environment/Libraries',
- iceDescription,
- 'Requires: ice-%{_arch}',
- [('lib', '%{icelibdir}/php/modules'), ('cfg', '/etc/php.d/ice.ini')]
- ),
+ 'ice = %version%, php >= 5.1.2',
+ 'The Ice runtime for PHP applications',
+ 'System Environment/Libraries',
+ iceDescription,
+ 'Requires: ice-%{_arch}',
+ [('lib', '%{icelibdir}/php/modules'), ('cfg', '/etc/php.d/ice.ini')]
+ ),
NoarchSubpackage('java',
- 'ice = %version%, db45-java >= 4.5.20',
- 'The Ice runtime for Java',
- 'System Environment/Libraries',
- iceDescription,
- '',
- [ ('xdir', 'lib/Ice-%version%'),
- ('file', 'lib/Ice-%version%/Ice.jar'),
+ 'ice = %version%, db45-java >= 4.5.20',
+ 'The Ice runtime for Java',
+ 'System Environment/Libraries',
+ iceDescription,
+ '',
+ [ ('xdir', 'lib/Ice-%version%'),
+ ('file', 'lib/Ice-%version%/Ice.jar'),
('xdir', 'lib/Ice-%version%/java2'),
- ('file', 'lib/Ice-%version%/java2/Ice.jar')
- ]),
+ ('file', 'lib/Ice-%version%/java2/Ice.jar')
+ ]),
NoarchSubpackage('dotnet',
'ice = %version%, mono-core >= 1.2.2',
- 'The Ice runtime for C# applications',
- 'System Environment/Libraries',
- iceDescription,
- '',
- [('dll', 'lib/mono/gac/glacier2cs/%version%.0__1f998c50fec78381/glacier2cs.dll'),
- ('dll', 'lib/mono/gac/icecs/%version%.0__1f998c50fec78381/icecs.dll'),
- ('dll', 'lib/mono/gac/iceboxcs/%version%.0__1f998c50fec78381/iceboxcs.dll'),
- ('dll', 'lib/mono/gac/icegridcs/%version%.0__1f998c50fec78381/icegridcs.dll'),
- ('dll', 'lib/mono/gac/icepatch2cs/%version%.0__1f998c50fec78381/icepatch2cs.dll'),
- ('dll', 'lib/mono/gac/icestormcs/%version%.0__1f998c50fec78381/icestormcs.dll'),
- ('exe', 'bin/iceboxnet.exe'),
- ('exe', 'bin/iceboxadminnet.exe')])
+ 'The Ice runtime for C# applications',
+ 'System Environment/Libraries',
+ iceDescription,
+ '',
+ [('dll', 'lib/mono/gac/glacier2cs/%version%.0__1f998c50fec78381/glacier2cs.dll'),
+ ('dll', 'lib/mono/gac/icecs/%version%.0__1f998c50fec78381/icecs.dll'),
+ ('dll', 'lib/mono/gac/iceboxcs/%version%.0__1f998c50fec78381/iceboxcs.dll'),
+ ('dll', 'lib/mono/gac/icegridcs/%version%.0__1f998c50fec78381/icegridcs.dll'),
+ ('dll', 'lib/mono/gac/icepatch2cs/%version%.0__1f998c50fec78381/icepatch2cs.dll'),
+ ('dll', 'lib/mono/gac/icestormcs/%version%.0__1f998c50fec78381/icestormcs.dll'),
+ ('exe', 'bin/iceboxnet.exe'),
+ ('exe', 'bin/iceboxadminnet.exe')])
]
############################################################################
@@ -494,51 +494,51 @@ def _transformDirectories(transforms, version, installDir):
cwd = os.getcwd()
os.chdir(installDir)
for type, source, dest in transforms:
- dest = dest.replace('%version%', version)
- source = source.replace('%version%', version)
+ dest = dest.replace('%version%', version)
+ source = source.replace('%version%', version)
- libdir = 'lib' # Key on architecture.
- dest = dest.replace('%{icelibdir}', libdir)
- source = source.replace('%{icelibdir}', libdir)
+ libdir = 'lib' # Key on architecture.
+ dest = dest.replace('%{icelibdir}', libdir)
+ source = source.replace('%{icelibdir}', libdir)
sourcedir = source
destdir = dest
- if os.path.exists('./tmp'):
- shutil.rmtree('./tmp')
-
- try:
- if not os.path.isdir(sourcedir):
- if os.path.exists(source):
- os.renames(source, dest)
- else:
- #
- # This is a special problem. What this implies is that
- # we are trying to move the contents of a directory into
- # a subdirectory of itself. The regular shutil.move()
- # won't cut it.
- #
- if os.path.isdir(sourcedir) and sourcedir.split("/")[0] == destdir.split("/")[0]:
- os.renames(sourcedir, "./tmp/" + sourcedir)
- os.renames("./tmp/" + sourcedir, destdir)
- else:
- print 'Renaming ' + source + ' to ' + dest
- if os.path.exists(source):
- os.renames(source, dest)
-
- except OSError:
- print "Exception occurred while trying to transform " + source + " to " + dest
- raise
+ if os.path.exists('./tmp'):
+ shutil.rmtree('./tmp')
+
+ try:
+ if not os.path.isdir(sourcedir):
+ if os.path.exists(source):
+ os.renames(source, dest)
+ else:
+ #
+ # This is a special problem. What this implies is that
+ # we are trying to move the contents of a directory into
+ # a subdirectory of itself. The regular shutil.move()
+ # won't cut it.
+ #
+ if os.path.isdir(sourcedir) and sourcedir.split("/")[0] == destdir.split("/")[0]:
+ os.renames(sourcedir, "./tmp/" + sourcedir)
+ os.renames("./tmp/" + sourcedir, destdir)
+ else:
+ print 'Renaming ' + source + ' to ' + dest
+ if os.path.exists(source):
+ os.renames(source, dest)
+
+ except OSError:
+ print "Exception occurred while trying to transform " + source + " to " + dest
+ raise
os.chdir(cwd)
def createArchSpecFile(ofile, installDir, version, soVersion, targetHost):
for v in fileLists:
- v.writeHdr(ofile, version, "1", installDir, targetHost)
- ofile.write("\n\n\n")
+ v.writeHdr(ofile, version, "1", installDir, targetHost)
+ ofile.write("\n\n\n")
for v in fileLists:
- v.writeFiles(ofile, version, soVersion, installDir)
- ofile.write("\n")
+ v.writeFiles(ofile, version, soVersion, installDir)
+ ofile.write("\n")
def createFullSpecFile(ofile, installDir, version, soVersion, targetHost):
fullFileList = fileLists
@@ -548,21 +548,21 @@ def createFullSpecFile(ofile, installDir, version, soVersion, targetHost):
fullFileList[0].addInstallGenerator(writeTransformCommands)
for v in fullFileList:
- #
- # Skip ruby on SuSE
- #
- if targetHost == "suse" and v.name.startswith("ruby"):
- continue
- v.writeHdr(ofile, version, "1", '', targetHost)
- ofile.write("\n\n\n")
+ #
+ # Skip ruby on SuSE
+ #
+ if targetHost == "suse" and v.name.startswith("ruby"):
+ continue
+ v.writeHdr(ofile, version, "1", '', targetHost)
+ ofile.write("\n\n\n")
for v in fullFileList:
- #
- # Skip ruby on SuSE
- #
- if targetHost == "suse" and v.name.startswith("ruby"):
- continue
- v.writeFiles(ofile, version, soVersion, '')
- ofile.write("\n")
+ #
+ # Skip ruby on SuSE
+ #
+ if targetHost == "suse" and v.name.startswith("ruby"):
+ continue
+ v.writeFiles(ofile, version, soVersion, '')
+ ofile.write("\n")
def writeUnpackingCommands(ofile, version, targetHost):
ofile.write('%setup -n Ice-%{version} -q -T -D -b 0\n')
@@ -585,7 +585,7 @@ cd $RPM_BUILD_DIR
cp $RPM_SOURCE_DIR/ice.ini $RPM_BUILD_DIR/IcePHP-%{version}
""")
if targetHost != "suse":
- ofile.write("""
+ ofile.write("""
%setup -q -n IceRuby-%{version} -T -D -b 10
sed -i -e 's/^prefix.*$/prefix = $\(RPM_BUILD_ROOT\)/' $RPM_BUILD_DIR/IceRuby-%{version}/config/Make.rules
@@ -622,10 +622,10 @@ cd $RPM_BUILD_DIR/IcePHP-%{version}
gmake OPTIMIZE=yes ICE_HOME=$RPM_BUILD_DIR/Ice-%{version} RPM_BUILD_ROOT=$RPM_BUILD_ROOT embedded_runpath_prefix=""
""")
if targetHost != "suse":
- ofile.write("""
+ ofile.write("""
cd $RPM_BUILD_DIR/IceRuby-%{version}
gmake OPTIMIZE=yes ICE_HOME=$RPM_BUILD_DIR/Ice-%{version} RPM_BUILD_ROOT=$RPM_BUILD_ROOT embedded_runpath_prefix=""
- """)
+ """)
def writeInstallCommands(ofile, version, targetHost):
ofile.write("""
@@ -677,10 +677,10 @@ done
""")
if targetHost != "suse":
- ofile.write("""
+ ofile.write("""
cd $RPM_BUILD_DIR/IceRuby-%{version}
gmake OPTIMIZE=yes ICE_HOME=$RPM_BUILD_DIR/Ice-%{version} RPM_BUILD_ROOT=$RPM_BUILD_ROOT embedded_runpath_prefix="" install
- """)
+ """)
def writeTransformCommands(ofile, version, targetHost):
#
@@ -693,31 +693,31 @@ def writeTransformCommands(ofile, version, targetHost):
ofile.write('# Linux system.\n')
ofile.write('#\n\n')
for type, source, dest in transforms:
- dest = dest.replace('%version%', version)
- source = source.replace('%version%', version)
- if type == 'file':
- ofile.write('# Rule 1\n')
- ofile.write('mkdir -p $RPM_BUILD_ROOT/' + os.path.dirname(dest) + '\n')
- ofile.write('mv $RPM_BUILD_ROOT/' + source + ' $RPM_BUILD_ROOT/' + dest + '\n')
- elif type == 'dir':
- if os.path.dirname(dest) <> '' and source.split('/')[0] == dest.split('/')[0]:
- ofile.write('# Rule 2\n')
- ofile.write('mkdir -p $RPM_BUILD_ROOT/arraftmp\n')
- ofile.write('mkdir -p $RPM_BUILD_ROOT/arraftmp/%s\n' % os.path.dirname(source))
- ofile.write('mv $RPM_BUILD_ROOT/' + source + ' $RPM_BUILD_ROOT/arraftmp/' + source + '\n')
- ofile.write('mkdir -p $RPM_BUILD_ROOT/' + os.path.dirname(dest) + '\n')
- ofile.write('mv $RPM_BUILD_ROOT/arraftmp/' + source + ' $RPM_BUILD_ROOT/' + dest + '\n')
- ofile.write('rm -rf $RPM_BUILD_ROOT/arraftmp\n')
- elif os.path.dirname(dest) <> '':
- ofile.write('# Rule 3\n')
- ofile.write('if test -d $RPM_BUILD_ROOT/' + source + '\n')
- ofile.write('then\n')
- ofile.write(' mkdir -p $RPM_BUILD_ROOT/' + os.path.dirname(dest) + '\n')
- ofile.write(' mv $RPM_BUILD_ROOT/' + source + ' $RPM_BUILD_ROOT/' + dest + '\n')
- ofile.write('fi\n')
- else:
- ofile.write('# Rule 4\n')
- ofile.write('mv $RPM_BUILD_ROOT/usr/' + source + ' $RPM_BUILD_ROOT/usr/' + dest + '\n')
-
+ dest = dest.replace('%version%', version)
+ source = source.replace('%version%', version)
+ if type == 'file':
+ ofile.write('# Rule 1\n')
+ ofile.write('mkdir -p $RPM_BUILD_ROOT/' + os.path.dirname(dest) + '\n')
+ ofile.write('mv $RPM_BUILD_ROOT/' + source + ' $RPM_BUILD_ROOT/' + dest + '\n')
+ elif type == 'dir':
+ if os.path.dirname(dest) <> '' and source.split('/')[0] == dest.split('/')[0]:
+ ofile.write('# Rule 2\n')
+ ofile.write('mkdir -p $RPM_BUILD_ROOT/arraftmp\n')
+ ofile.write('mkdir -p $RPM_BUILD_ROOT/arraftmp/%s\n' % os.path.dirname(source))
+ ofile.write('mv $RPM_BUILD_ROOT/' + source + ' $RPM_BUILD_ROOT/arraftmp/' + source + '\n')
+ ofile.write('mkdir -p $RPM_BUILD_ROOT/' + os.path.dirname(dest) + '\n')
+ ofile.write('mv $RPM_BUILD_ROOT/arraftmp/' + source + ' $RPM_BUILD_ROOT/' + dest + '\n')
+ ofile.write('rm -rf $RPM_BUILD_ROOT/arraftmp\n')
+ elif os.path.dirname(dest) <> '':
+ ofile.write('# Rule 3\n')
+ ofile.write('if test -d $RPM_BUILD_ROOT/' + source + '\n')
+ ofile.write('then\n')
+ ofile.write(' mkdir -p $RPM_BUILD_ROOT/' + os.path.dirname(dest) + '\n')
+ ofile.write(' mv $RPM_BUILD_ROOT/' + source + ' $RPM_BUILD_ROOT/' + dest + '\n')
+ ofile.write('fi\n')
+ else:
+ ofile.write('# Rule 4\n')
+ ofile.write('mv $RPM_BUILD_ROOT/usr/' + source + ' $RPM_BUILD_ROOT/usr/' + dest + '\n')
+
if __name__ == "main":
print 'Ice RPM Tools module'
diff --git a/cpp/allTests.py b/cpp/allTests.py
index 60f469568bd..0e7997bd70a 100755
--- a/cpp/allTests.py
+++ b/cpp/allTests.py
@@ -51,25 +51,25 @@ def runTests(args, tests, num = 0):
#
for i in tests:
- i = os.path.normpath(i)
- dir = os.path.join(toplevel, "test", i)
+ i = os.path.normpath(i)
+ dir = os.path.join(toplevel, "test", i)
- print
- if(num > 0):
- print "[" + str(num) + "]",
- print "*** running tests in " + dir,
- print
+ print
+ if(num > 0):
+ print "[" + str(num) + "]",
+ print "*** running tests in " + dir,
+ print
if isWin9x():
- status = os.system("python " + os.path.join(dir, "run.py " + args))
+ status = os.system("python " + os.path.join(dir, "run.py " + args))
else:
status = os.system(os.path.join(dir, "run.py " + args))
- if status:
- if(num > 0):
- print "[" + str(num) + "]",
- print "test in " + dir + " failed with exit status", status,
- sys.exit(status)
+ if status:
+ if(num > 0):
+ print "[" + str(num) + "]",
+ print "test in " + dir + " failed with exit status", status,
+ sys.exit(status)
#
# List of all basic tests.
@@ -142,7 +142,7 @@ def usage():
try:
opts, args = getopt.getopt(sys.argv[1:], "lr:R:", \
- ["debug", "protocol=", "compress", "host=", "threadPerConnection", "disablePool"])
+ ["debug", "protocol=", "compress", "host=", "threadPerConnection", "disablePool"])
except getopt.GetoptError:
usage()
@@ -155,26 +155,26 @@ for o, a in opts:
if o == "-l":
loop = 1
if o == "-r" or o == '-R':
- import re
- regexp = re.compile(a)
- if o == '-r':
- def rematch(x): return regexp.search(x)
- else:
- def rematch(x): return not regexp.search(x)
- tests = filter(rematch, tests)
+ import re
+ regexp = re.compile(a)
+ if o == '-r':
+ def rematch(x): return regexp.search(x)
+ else:
+ def rematch(x): return not regexp.search(x)
+ tests = filter(rematch, tests)
if o == "--protocol":
- if a not in ( "ssl", "tcp"):
- usage()
- args += " " + o + " " + a
+ if a not in ( "ssl", "tcp"):
+ usage()
+ args += " " + o + " " + a
if o == "--host" :
- args += " " + o + " " + a
+ args += " " + o + " " + a
if o in ( "--debug", "--compress", "--threadPerConnection", "--disablePool" ):
- args += " " + o
+ args += " " + o
if loop:
num = 1
while 1:
- runTests(args, tests, num)
- num += 1
+ runTests(args, tests, num)
+ num += 1
else:
runTests(args, tests)
diff --git a/cpp/config/IceGridAdmin.py b/cpp/config/IceGridAdmin.py
index 1095cca520b..05076c45d5a 100644
--- a/cpp/config/IceGridAdmin.py
+++ b/cpp/config/IceGridAdmin.py
@@ -36,7 +36,7 @@ nodeOptions = r' --Ice.Warn.Connections=0' + \
r' --IceGrid.Node.Trace.Server=0' + \
r' --Ice.OA.IceGrid.Node.ThreadPool.SizeWarn=0' + \
r' --IceGrid.Node.PrintServersReady=node' + \
- r' --Ice.NullHandleAbort' + \
+ r' --Ice.NullHandleAbort' + \
r' --Ice.ThreadPool.Server.Size=0' + \
r' --Ice.ServerIdleTime=0';
@@ -83,10 +83,10 @@ def startIceGridRegistry(testdir, dynamicRegistration = False):
i = 0
while i < (nreplicas + 1):
- if i == 0:
+ if i == 0:
name = "registry"
- else:
- name = "replica-" + str(i)
+ else:
+ name = "replica-" + str(i)
dataDir = os.path.join(testdir, "db", name)
if not os.path.exists(dataDir):
@@ -101,10 +101,10 @@ def startIceGridRegistry(testdir, dynamicRegistration = False):
r' --IceGrid.Registry.Data=' + dataDir
if i > 0:
- cmd += r' --IceGrid.Registry.ReplicaName=' + name + ' ' + getDefaultLocatorProperty()
+ cmd += r' --IceGrid.Registry.ReplicaName=' + name + ' ' + getDefaultLocatorProperty()
if TestUtil.debug:
- print "(" + cmd + ")",
+ print "(" + cmd + ")",
pipe = os.popen(cmd + " 2>&1")
TestUtil.getServerPid(pipe)
@@ -137,7 +137,7 @@ def startIceGridNode(testdir):
cleanDbDir(dataDir)
overrideOptions = '"' + TestUtil.clientServerOptions.replace("--", "") + \
- ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"'
+ ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"'
print "starting icegrid node...",
command = iceGrid + TestUtil.clientServerOptions + ' --nowarn ' + nodeOptions + \
@@ -164,7 +164,7 @@ def iceGridAdmin(cmd, ignoreFailure = False):
user = r"admin1"
if cmd == "registry shutdown":
- user = r"shutdown"
+ user = r"shutdown"
command = iceGridAdmin + TestUtil.clientOptions + ' ' + getDefaultLocatorProperty() + \
r" --IceGridAdmin.Username=" + user + " --IceGridAdmin.Password=test1 " + \
r' -e "' + cmd + '"'
@@ -303,11 +303,11 @@ def cleanDbDir(path):
fullpath = os.path.join(path, filename);
if os.path.isdir(fullpath):
cleanDbDir(fullpath)
- try:
- os.rmdir(fullpath)
- except OSError:
- # This might fail if the directory is empty (because it itself is
- # a CVS directory).
- pass
+ try:
+ os.rmdir(fullpath)
+ except OSError:
+ # This might fail if the directory is empty (because it itself is
+ # a CVS directory).
+ pass
else:
os.remove(fullpath)
diff --git a/cpp/config/TestUtil.py b/cpp/config/TestUtil.py
index 4196c013721..3fbbfbc0060 100644
--- a/cpp/config/TestUtil.py
+++ b/cpp/config/TestUtil.py
@@ -61,17 +61,17 @@ except getopt.GetoptError:
for o, a in opts:
if o == "--debug":
- debug = 1
+ debug = 1
if o == "--protocol":
- if a not in ( "tcp", "ssl"):
- usage()
- protocol = a
+ if a not in ( "tcp", "ssl"):
+ usage()
+ protocol = a
if o == "--compress":
- compress = 1
+ compress = 1
if o == "--threadPerConnection":
- threadPerConnection = 1
+ threadPerConnection = 1
if o == "--host":
- host = a
+ host = a
def getIceVersion():
@@ -148,16 +148,16 @@ def isDarwin():
def closePipe(pipe):
try:
- status = pipe.close()
+ status = pipe.close()
except IOError, ex:
- # TODO: There's a waitpid problem on CentOS, so we have to ignore ECHILD.
- if ex.errno == errno.ECHILD:
- status = 0
+ # TODO: There's a waitpid problem on CentOS, so we have to ignore ECHILD.
+ if ex.errno == errno.ECHILD:
+ status = 0
# This happens with the test/IceGrid/simple test on AIX
elif ex.errno == 0:
status = 0
- else:
- raise
+ else:
+ raise
return status
class ReaderThread(Thread):
@@ -171,20 +171,20 @@ class ReaderThread(Thread):
while 1:
line = self.pipe.readline()
if not line: break
- # Suppress "adapter ready" messages. Under windows the eol isn't \n.
- if not line.endswith(" ready\n") and not line.endswith(" ready\r\n"):
- print line,
+ # Suppress "adapter ready" messages. Under windows the eol isn't \n.
+ if not line.endswith(" ready\n") and not line.endswith(" ready\r\n"):
+ print line,
except IOError:
pass
- #print "TERMINATED: " + str(self.pipe)
- self.status = closePipe(self.pipe)
+ #print "TERMINATED: " + str(self.pipe)
+ self.status = closePipe(self.pipe)
def getPipe(self):
- return self.pipe
+ return self.pipe
def getStatus(self):
- return self.status
+ return self.status
serverPids = []
serverThreads = []
@@ -194,8 +194,8 @@ def joinServers():
global serverThreads
global allServerThreads
for t in serverThreads:
- t.join()
- allServerThreads.append(t)
+ t.join()
+ allServerThreads.append(t)
serverThreads = []
# This joins with all servers and if any of them failed then
@@ -204,9 +204,9 @@ def serverStatus():
global allServerThreads
joinServers()
for t in allServerThreads:
- status = t.getStatus()
- if status:
- return status
+ status = t.getStatus()
+ if status:
+ return status
return 0
# This joins with a specific server (the one started with the given pipe)
@@ -215,13 +215,13 @@ def serverStatus():
def specificServerStatus(pipe, timeout = None):
global serverThreads
for t in serverThreads:
- if t.getPipe() == pipe:
- serverThreads.remove(t)
- t.join(timeout)
- if t.isAlive():
- raise "server with pipe " + str(pipe) + " did not exit within the timeout period."
- status = t.getStatus()
- return status
+ if t.getPipe() == pipe:
+ serverThreads.remove(t)
+ t.join(timeout)
+ if t.isAlive():
+ raise "server with pipe " + str(pipe) + " did not exit within the timeout period."
+ status = t.getStatus()
+ return status
raise "can't find server with pipe: " + str(pipe)
def killServers():
@@ -259,32 +259,32 @@ def getServerPid(pipe):
global serverThreads
while 1:
- output = pipe.readline().strip()
- if not output:
- print "failed!"
- killServers()
- sys.exit(1)
- if output.startswith("warning: "):
- continue
- break
+ output = pipe.readline().strip()
+ if not output:
+ print "failed!"
+ killServers()
+ sys.exit(1)
+ if output.startswith("warning: "):
+ continue
+ break
try:
- serverPids.append(int(output))
+ serverPids.append(int(output))
except ValueError:
- print "Output is not a PID: " + output
- raise
+ print "Output is not a PID: " + output
+ raise
def ignorePid(pipe):
while 1:
- output = pipe.readline().strip()
- if not output:
- print "failed!"
- killServers()
- sys.exit(1)
- if output.startswith("warning: "):
- continue
- break
+ output = pipe.readline().strip()
+ if not output:
+ print "failed!"
+ killServers()
+ sys.exit(1)
+ if output.startswith("warning: "):
+ continue
+ break
def getAdapterReady(pipe, createThread = True, count = 1):
global serverThreads
@@ -300,9 +300,9 @@ def getAdapterReady(pipe, createThread = True, count = 1):
# Start a thread for this server.
if createThread:
- serverThread = ReaderThread(pipe)
- serverThread.start()
- serverThreads.append(serverThread)
+ serverThread = ReaderThread(pipe)
+ serverThread.start()
+ serverThreads.append(serverThread)
def getIceBox(testdir):
@@ -312,23 +312,23 @@ def getIceBox(testdir):
iceBox = ""
if isWin32():
- #
- # Read the build.txt file from the test directory to figure out
- # how the IceBox service was built ("debug" vs. "release") and
- # decide which icebox executable to use.
- #
- build = open(os.path.join(testdir, "build.txt"), "r")
- type = build.read().strip()
- if type == "debug":
- iceBox = os.path.join(toplevel, "bin", "iceboxd.exe")
+ #
+ # Read the build.txt file from the test directory to figure out
+ # how the IceBox service was built ("debug" vs. "release") and
+ # decide which icebox executable to use.
+ #
+ build = open(os.path.join(testdir, "build.txt"), "r")
+ type = build.read().strip()
+ if type == "debug":
+ iceBox = os.path.join(toplevel, "bin", "iceboxd.exe")
elif type == "release":
iceBox = os.path.join(toplevel, "bin", "icebox.exe")
else:
- iceBox = os.path.join(toplevel, "bin", "icebox")
+ iceBox = os.path.join(toplevel, "bin", "icebox")
if iceBox == "" or not os.path.exists(iceBox):
- print "couldn't find icebox executable to run the test"
- sys.exit(0)
+ print "couldn't find icebox executable to run the test"
+ sys.exit(0)
return iceBox;
@@ -345,9 +345,9 @@ def waitServiceReady(pipe, token, createThread = True):
# Start a thread for this server.
if createThread:
- serverThread = ReaderThread(pipe)
- serverThread.start()
- serverThreads.append(serverThread)
+ serverThread = ReaderThread(pipe)
+ serverThread.start()
+ serverThreads.append(serverThread)
def printOutputFromPipe(pipe):
@@ -359,15 +359,15 @@ def printOutputFromPipe(pipe):
def addLdPath(path):
if isWin32():
- if isCygwin():
- os.environ["PATH"] = path + ":" + os.getenv("PATH", "")
- else:
- os.environ["PATH"] = path + ";" + os.getenv("PATH", "")
+ if isCygwin():
+ os.environ["PATH"] = path + ":" + os.getenv("PATH", "")
+ else:
+ os.environ["PATH"] = path + ";" + os.getenv("PATH", "")
elif isAIX():
- os.environ["LIBPATH"] = path + ":" + os.getenv("LIBPATH", "")
+ os.environ["LIBPATH"] = path + ":" + os.getenv("LIBPATH", "")
else:
- os.environ["LD_LIBRARY_PATH"] = path + ":" + os.getenv("LD_LIBRARY_PATH", "")
- os.environ["LD_LIBRARY_PATH_64"] = path + ":" + os.getenv("LD_LIBRARY_PATH_64", "")
+ os.environ["LD_LIBRARY_PATH"] = path + ":" + os.getenv("LD_LIBRARY_PATH", "")
+ os.environ["LD_LIBRARY_PATH_64"] = path + ":" + os.getenv("LD_LIBRARY_PATH_64", "")
for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
toplevel = os.path.normpath(toplevel)
@@ -378,9 +378,9 @@ else:
if isWin32():
if isCygwin():
- os.environ["PATH"] = os.path.join(toplevel, "bin") + ":" + os.getenv("PATH", "")
+ os.environ["PATH"] = os.path.join(toplevel, "bin") + ":" + os.getenv("PATH", "")
else:
- os.environ["PATH"] = os.path.join(toplevel, "bin") + ";" + os.getenv("PATH", "")
+ os.environ["PATH"] = os.path.join(toplevel, "bin") + ";" + os.getenv("PATH", "")
elif isHpUx():
os.environ["SHLIB_PATH"] = os.path.join(toplevel, "lib") + ":" + os.getenv("SHLIB_PATH", "")
elif isDarwin():
@@ -393,7 +393,7 @@ else:
os.environ["LD_LIBRARY_PATH_64"] = os.path.join(toplevel, "lib") + ":" + os.getenv("LD_LIBRARY_PATH_64", "")
if protocol == "ssl":
- plugin = " --Ice.Plugin.IceSSL=IceSSL:createIceSSL"
+ plugin = " --Ice.Plugin.IceSSL=IceSSL:createIceSSL"
clientProtocol = plugin + " --Ice.Default.Protocol=ssl" + \
" --IceSSL.DefaultDir=" + os.path.join(toplevel, "certs") + \
" --IceSSL.CertFile=c_rsa1024_pub.pem" + \
@@ -430,7 +430,7 @@ if threadPerConnection:
commonServerOptions += " --Ice.ThreadPerConnection"
else:
commonServerOptions += " --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3" + \
- " --Ice.ThreadPool.Server.SizeWarn=0"
+ " --Ice.ThreadPool.Server.SizeWarn=0"
clientOptions = clientProtocol + defaultHost + commonClientOptions
serverOptions = serverProtocol + defaultHost + commonServerOptions
@@ -447,7 +447,7 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona
print "starting " + serverName + "...",
serverCmd = server + serverOptions + additionalServerOptions
if debug:
- print "(" + serverCmd + ")",
+ print "(" + serverCmd + ")",
serverPipe = os.popen(serverCmd + " 2>&1")
getServerPid(serverPipe)
getAdapterReady(serverPipe)
@@ -456,7 +456,7 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona
print "starting " + clientName + "...",
clientCmd = client + clientOptions + additionalClientOptions
if debug:
- print "(" + clientCmd + ")",
+ print "(" + clientCmd + ")",
clientPipe = os.popen(clientCmd + " 2>&1")
print "ok"
@@ -464,7 +464,7 @@ def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additiona
clientStatus = closePipe(clientPipe)
if clientStatus:
- killServers()
+ killServers()
joinServers()
@@ -488,7 +488,7 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl
print "starting server...",
serverCmd = server + clientServerOptions + additionalServerOptions
if debug:
- print "(" + serverCmd + ")",
+ print "(" + serverCmd + ")",
serverPipe = os.popen(serverCmd + " 2>&1")
getServerPid(serverPipe)
getAdapterReady(serverPipe)
@@ -497,7 +497,7 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl
print "starting client...",
clientCmd = client + clientServerOptions + additionalClientOptions
if debug:
- print "(" + clientCmd + ")",
+ print "(" + clientCmd + ")",
clientPipe = os.popen(clientCmd + " 2>&1")
ignorePid(clientPipe)
getAdapterReady(clientPipe, False)
@@ -508,10 +508,10 @@ def mixedClientServerTestWithOptions(name, additionalServerOptions, additionalCl
clientStatus = closePipe(clientPipe)
if clientStatus:
- killServers()
+ killServers()
if clientStatus or serverStatus():
- sys.exit(1)
+ sys.exit(1)
def mixedClientServerTest(name):
@@ -525,7 +525,7 @@ def collocatedTestWithOptions(name, additionalOptions):
print "starting collocated...",
command = collocated + collocatedOptions + additionalOptions
if debug:
- print "(" + command + ")",
+ print "(" + command + ")",
collocatedPipe = os.popen(command + " 2>&1")
print "ok"
@@ -534,7 +534,7 @@ def collocatedTestWithOptions(name, additionalOptions):
collocatedStatus = closePipe(collocatedPipe)
if collocatedStatus:
- sys.exit(1)
+ sys.exit(1)
def collocatedTest(name):
diff --git a/cpp/config/convertssl.py b/cpp/config/convertssl.py
index 348023bb26f..8950ccd1685 100755
--- a/cpp/config/convertssl.py
+++ b/cpp/config/convertssl.py
@@ -52,8 +52,8 @@ else:
def findChild(parent, name):
for i in parent.childNodes:
- if i.localName == name:
- return i
+ if i.localName == name:
+ return i
return None
def printConfig(node, name, comment=""):
@@ -62,98 +62,98 @@ def printConfig(node, name, comment=""):
result = result + "#\n# NOTE: You may need to define IceSSL.DefaultDir\n"
general = findChild(node, "general")
if general:
- if general.attributes.has_key("version"):
- version = general.attributes["version"].nodeValue
- if version == "SSLv3":
- result = result + prefix + "Protocols=SSLv3\n"
- elif version == "TLSv1":
- result = result + prefix + "Protocols=TLSv1\n"
- elif version != "SSLv23":
- print "unknown value `" + version + "' for version attribute"
- sys.exit(1)
-
- if general.attributes.has_key("cipherlist"):
- result = result + prefix + "Ciphers=" + general.attributes["cipherlist"].nodeValue + "\n"
-
- if general.attributes.has_key("verifymode"):
- verifymode = general.attributes["verifymode"].nodeValue
- if verifymode == "none":
- result = result + prefix + "VerifyPeer=0\n"
- elif verifymode == "peer":
- result = result + prefix + "VerifyPeer=1\n"
- elif verifymode.find("fail") != -1:
- result = result + prefix + "VerifyPeer=2\n"
- elif verifymode.find("client_once") != -1:
- result = result + prefix + "VerifyPeer=2\n"
- else:
- print "unknown value `" + verifymode + "' for verifymode attribute"
- sys.exit(1)
-
- if general.attributes.has_key("verifydepth"):
- result = result + prefix + "VerifyDepthMax=" + general.attributes["verifydepth"].nodeValue + "\n"
-
- if general.attributes.has_key("randombytes"):
- result = result + "# NOTE: You may need to use IceSSL.EntropyDaemon\n"
- result = result + prefix + "Random=" + general.attributes["randombytes"].nodeValue + "\n"
+ if general.attributes.has_key("version"):
+ version = general.attributes["version"].nodeValue
+ if version == "SSLv3":
+ result = result + prefix + "Protocols=SSLv3\n"
+ elif version == "TLSv1":
+ result = result + prefix + "Protocols=TLSv1\n"
+ elif version != "SSLv23":
+ print "unknown value `" + version + "' for version attribute"
+ sys.exit(1)
+
+ if general.attributes.has_key("cipherlist"):
+ result = result + prefix + "Ciphers=" + general.attributes["cipherlist"].nodeValue + "\n"
+
+ if general.attributes.has_key("verifymode"):
+ verifymode = general.attributes["verifymode"].nodeValue
+ if verifymode == "none":
+ result = result + prefix + "VerifyPeer=0\n"
+ elif verifymode == "peer":
+ result = result + prefix + "VerifyPeer=1\n"
+ elif verifymode.find("fail") != -1:
+ result = result + prefix + "VerifyPeer=2\n"
+ elif verifymode.find("client_once") != -1:
+ result = result + prefix + "VerifyPeer=2\n"
+ else:
+ print "unknown value `" + verifymode + "' for verifymode attribute"
+ sys.exit(1)
+
+ if general.attributes.has_key("verifydepth"):
+ result = result + prefix + "VerifyDepthMax=" + general.attributes["verifydepth"].nodeValue + "\n"
+
+ if general.attributes.has_key("randombytes"):
+ result = result + "# NOTE: You may need to use IceSSL.EntropyDaemon\n"
+ result = result + prefix + "Random=" + general.attributes["randombytes"].nodeValue + "\n"
ca = findChild(node, "certauthority")
if ca:
- if ca.attributes.has_key("file"):
- result = result + prefix + "CertAuthFile=" + ca.attributes["file"].nodeValue + "\n"
- if ca.attributes.has_key("path"):
- result = result + prefix + "CertAuthDir=" + ca.attributes["path"].nodeValue + "\n"
+ if ca.attributes.has_key("file"):
+ result = result + prefix + "CertAuthFile=" + ca.attributes["file"].nodeValue + "\n"
+ if ca.attributes.has_key("path"):
+ result = result + prefix + "CertAuthDir=" + ca.attributes["path"].nodeValue + "\n"
basecerts = findChild(node, "basecerts")
if basecerts:
- certFile = ""
- keyFile = ""
- rsacert = findChild(basecerts, "rsacert")
- if rsacert:
- pub = findChild(rsacert, "public")
- if pub.attributes.has_key("encoding"):
- if pub.attributes["encoding"].nodeValue != "PEM":
- result = result + "# NOTE: Only PEM encoding is supported for certificates!\n"
- if pub.attributes.has_key("filename"):
- certFile = pub.attributes["filename"].nodeValue
- priv = findChild(rsacert, "private")
- if priv.attributes.has_key("encoding"):
- if priv.attributes["encoding"].nodeValue != "PEM":
- result = result + "# NOTE: Only PEM encoding is supported for private keys!\n"
- if priv.attributes.has_key("filename"):
- keyFile = priv.attributes["filename"].nodeValue
- dsacert = findChild(basecerts, "dsacert")
- if dsacert:
- pub = findChild(dsacert, "public")
- if pub.attributes.has_key("encoding"):
- if pub.attributes["encoding"].nodeValue != "PEM":
- result = result + "# NOTE: Only PEM encoding is supported for certificates!\n"
- if pub.attributes.has_key("filename"):
- if len(certFile) > 0:
- certFile = certFile + sep + pub.attributes["filename"].nodeValue
- else:
- certFile = pub.attributes["filename"].nodeValue
- priv = findChild(rsacert, "private")
- if priv.attributes.has_key("encoding"):
- if priv.attributes["encoding"].nodeValue != "PEM":
- result = result + "# NOTE: Only PEM encoding is supported for private keys!\n"
- if priv.attributes.has_key("filename"):
- if len(keyFile) > 0:
- keyFile = keyFile + sep + priv.attributes["filename"].nodeValue
- else:
- keyFile = priv.attributes["filename"].nodeValue
- if len(certFile) > 0:
- result = result + prefix + "CertFile=" + certFile + "\n"
- if len(keyFile) > 0:
- result = result + prefix + "KeyFile=" + keyFile + "\n"
-
- for child in basecerts.childNodes:
- if child.localName == "dhparams":
- keysize = child.attributes["keysize"].nodeValue
- if child.attributes.has_key("encoding"):
- if child.attributes["encoding"].nodeValue != "PEM":
- result = result + "# NOTE: Only PEM encoding is supported for DH parameters!\n"
- filename = child.attributes["filename"].nodeValue
- result = result + prefix + "DH." + keysize + "=" + filename + "\n"
+ certFile = ""
+ keyFile = ""
+ rsacert = findChild(basecerts, "rsacert")
+ if rsacert:
+ pub = findChild(rsacert, "public")
+ if pub.attributes.has_key("encoding"):
+ if pub.attributes["encoding"].nodeValue != "PEM":
+ result = result + "# NOTE: Only PEM encoding is supported for certificates!\n"
+ if pub.attributes.has_key("filename"):
+ certFile = pub.attributes["filename"].nodeValue
+ priv = findChild(rsacert, "private")
+ if priv.attributes.has_key("encoding"):
+ if priv.attributes["encoding"].nodeValue != "PEM":
+ result = result + "# NOTE: Only PEM encoding is supported for private keys!\n"
+ if priv.attributes.has_key("filename"):
+ keyFile = priv.attributes["filename"].nodeValue
+ dsacert = findChild(basecerts, "dsacert")
+ if dsacert:
+ pub = findChild(dsacert, "public")
+ if pub.attributes.has_key("encoding"):
+ if pub.attributes["encoding"].nodeValue != "PEM":
+ result = result + "# NOTE: Only PEM encoding is supported for certificates!\n"
+ if pub.attributes.has_key("filename"):
+ if len(certFile) > 0:
+ certFile = certFile + sep + pub.attributes["filename"].nodeValue
+ else:
+ certFile = pub.attributes["filename"].nodeValue
+ priv = findChild(rsacert, "private")
+ if priv.attributes.has_key("encoding"):
+ if priv.attributes["encoding"].nodeValue != "PEM":
+ result = result + "# NOTE: Only PEM encoding is supported for private keys!\n"
+ if priv.attributes.has_key("filename"):
+ if len(keyFile) > 0:
+ keyFile = keyFile + sep + priv.attributes["filename"].nodeValue
+ else:
+ keyFile = priv.attributes["filename"].nodeValue
+ if len(certFile) > 0:
+ result = result + prefix + "CertFile=" + certFile + "\n"
+ if len(keyFile) > 0:
+ result = result + prefix + "KeyFile=" + keyFile + "\n"
+
+ for child in basecerts.childNodes:
+ if child.localName == "dhparams":
+ keysize = child.attributes["keysize"].nodeValue
+ if child.attributes.has_key("encoding"):
+ if child.attributes["encoding"].nodeValue != "PEM":
+ result = result + "# NOTE: Only PEM encoding is supported for DH parameters!\n"
+ filename = child.attributes["filename"].nodeValue
+ result = result + prefix + "DH." + keysize + "=" + filename + "\n"
return result
@@ -171,10 +171,10 @@ for x in sys.argv[1:]:
usage()
sys.exit(1)
else:
- if xmlfile:
- usage()
- sys.exit(1)
- xmlfile = x
+ if xmlfile:
+ usage()
+ sys.exit(1)
+ xmlfile = x
if not xmlfile:
usage()
diff --git a/cpp/config/findSliceFiles.py b/cpp/config/findSliceFiles.py
index 5b3b283a4e6..cffe292cb59 100644
--- a/cpp/config/findSliceFiles.py
+++ b/cpp/config/findSliceFiles.py
@@ -32,13 +32,13 @@ print >> out, "SLICEFILES =",
first = True
for root, dirs, files in os.walk(sys.argv[1]):
for name in files:
- if not name.startswith(".") and name.endswith(".ice"):
- if not first:
- print >> out, "\\"
- print >> out, " ",
- else:
- first = False
- print >> out, os.path.join(root, name),
+ if not name.startswith(".") and name.endswith(".ice"):
+ if not first:
+ print >> out, "\\"
+ print >> out, " ",
+ else:
+ first = False
+ print >> out, os.path.join(root, name),
print >> out, "\n"
sys.exit(0)
diff --git a/cpp/config/makeprops.py b/cpp/config/makeprops.py
index 3c448a025ba..aec33ea0a39 100644
--- a/cpp/config/makeprops.py
+++ b/cpp/config/makeprops.py
@@ -33,12 +33,12 @@ def progError(msg):
def removeOutputFiles():
global outputFiles
for entry in outputFiles:
- try:
- if os.path.exists(entry[0]):
- os.remove(entry[0])
- except EnvironmentError, ex:
- progError("warning: could not unlink `" + entry[0] + "': " + ex.strerror + \
- " -- generated file contains errors");
+ try:
+ if os.path.exists(entry[0]):
+ os.remove(entry[0])
+ except EnvironmentError, ex:
+ progError("warning: could not unlink `" + entry[0] + "': " + ex.strerror + \
+ " -- generated file contains errors");
def handler(signum, frame):
removeOutputFiles()
@@ -48,11 +48,11 @@ def openOutputFile(filename):
global outputFiles
try:
outfile = file(filename, 'w')
- outputFiles.append([filename, outfile])
+ outputFiles.append([filename, outfile])
except IOError, ex:
progError("cannot open `" + filename + "' for writing: " + ex.strerror)
- removeOutputFiles()
- sys.exit(1)
+ removeOutputFiles()
+ sys.exit(1)
def writePreamble(lang):
global progname
@@ -61,117 +61,117 @@ def writePreamble(lang):
global classname
for entry in outputFiles:
- file = entry[1]
- file.write("// **********************************************************************\n")
- file.write("//\n")
- file.write("// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.\n")
- file.write("//\n")
- file.write("// This copy of Ice is licensed to you under the terms described in the\n")
- file.write("// ICE_LICENSE file included in this distribution.\n")
- file.write("//\n")
- file.write("// **********************************************************************\n")
- file.write("\n")
- file.write("// Generated by " + progname + " from file `" + infile + "', " + time.ctime() + "\n")
- file.write("\n")
- file.write("// IMPORTANT: Do not edit this file -- any edits made here will be lost!\n");
- if lang == "cpp":
- continue
- if lang == "java":
- file.write("\n");
- file.write("package IceInternal;\n")
- file.write("\n")
- file.write("public final class " + classname + '\n');
- file.write("{\n")
- continue
- if lang == "cs":
- file.write("\n");
- file.write("namespace IceInternal\n")
- file.write("{\n")
- file.write(" public sealed class " + classname + '\n')
- file.write(" {\n");
- continue
- progError("Internal error: impossible language: `" + lang + "'")
- sys.exit(1)
+ file = entry[1]
+ file.write("// **********************************************************************\n")
+ file.write("//\n")
+ file.write("// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.\n")
+ file.write("//\n")
+ file.write("// This copy of Ice is licensed to you under the terms described in the\n")
+ file.write("// ICE_LICENSE file included in this distribution.\n")
+ file.write("//\n")
+ file.write("// **********************************************************************\n")
+ file.write("\n")
+ file.write("// Generated by " + progname + " from file `" + infile + "', " + time.ctime() + "\n")
+ file.write("\n")
+ file.write("// IMPORTANT: Do not edit this file -- any edits made here will be lost!\n");
+ if lang == "cpp":
+ continue
+ if lang == "java":
+ file.write("\n");
+ file.write("package IceInternal;\n")
+ file.write("\n")
+ file.write("public final class " + classname + '\n');
+ file.write("{\n")
+ continue
+ if lang == "cs":
+ file.write("\n");
+ file.write("namespace IceInternal\n")
+ file.write("{\n")
+ file.write(" public sealed class " + classname + '\n')
+ file.write(" {\n");
+ continue
+ progError("Internal error: impossible language: `" + lang + "'")
+ sys.exit(1)
if lang == "cpp":
header = outputFiles[1][1]
- header.write("\n");
- header.write("#ifndef ICE_INTERNAL_" + classname + "_H\n");
- header.write("#define ICE_INTERNAL_" + classname + "_H\n");
- header.write("\n")
- header.write("#include <Ice/Config.h>")
- header.write("\n")
- header.write("namespace IceInternal\n")
- header.write("{\n")
- header.write("\n")
- header.write("class " + classname + '\n')
- header.write("{\n")
- header.write("public:\n")
- header.write("\n")
- file = outputFiles[0][1]
- file.write("\n");
- file.write("#include <Ice/" + classname + ".h>\n")
+ header.write("\n");
+ header.write("#ifndef ICE_INTERNAL_" + classname + "_H\n");
+ header.write("#define ICE_INTERNAL_" + classname + "_H\n");
+ header.write("\n")
+ header.write("#include <Ice/Config.h>")
+ header.write("\n")
+ header.write("namespace IceInternal\n")
+ header.write("{\n")
+ header.write("\n")
+ header.write("class " + classname + '\n')
+ header.write("{\n")
+ header.write("public:\n")
+ header.write("\n")
+ file = outputFiles[0][1]
+ file.write("\n");
+ file.write("#include <Ice/" + classname + ".h>\n")
def writePostamble(lang, labels, commandLineLabels):
file = outputFiles[0][1]
if lang == "cpp":
header = outputFiles[1][1]
- header.write("\n")
+ header.write("\n")
- header.write(" static const char* const* validProps[];\n")
- file.write("\n");
+ header.write(" static const char* const* validProps[];\n")
+ file.write("\n");
file.write("const char* const* IceInternal::" + classname + "::validProps[] =\n")
- file.write("{\n")
- for label, line in labels.iteritems():
- file.write(" " + label + "Props,\n")
- file.write(" 0\n");
- file.write("};\n")
-
- header.write(" static const char* clPropNames[];\n")
- file.write("\n");
+ file.write("{\n")
+ for label, line in labels.iteritems():
+ file.write(" " + label + "Props,\n")
+ file.write(" 0\n");
+ file.write("};\n")
+
+ header.write(" static const char* clPropNames[];\n")
+ file.write("\n");
file.write("const char* IceInternal::" + classname + "::clPropNames[] =\n")
- file.write("{\n")
- for label in commandLineLabels:
- file.write(" \"" + label + "\",\n")
- file.write(" 0\n");
- file.write("};\n")
-
- header.write("};\n")
- header.write("\n")
- header.write("}\n")
- header.write("\n")
- header.write("#endif\n");
- return
+ file.write("{\n")
+ for label in commandLineLabels:
+ file.write(" \"" + label + "\",\n")
+ file.write(" 0\n");
+ file.write("};\n")
+
+ header.write("};\n")
+ header.write("\n")
+ header.write("}\n")
+ header.write("\n")
+ header.write("#endif\n");
+ return
if lang == "java":
file.write(" public static final String[] validProps[] =\n")
- file.write(" {\n")
- for label, line in labels.iteritems():
- file.write(" " + label + "Props,\n")
- file.write(" null\n")
- file.write(" };\n\n");
+ file.write(" {\n")
+ for label, line in labels.iteritems():
+ file.write(" " + label + "Props,\n")
+ file.write(" null\n")
+ file.write(" };\n\n");
file.write(" public static final String clPropNames[] =\n")
- file.write(" {\n")
- for label in commandLineLabels:
- file.write(" \"" + label + "\",\n")
- file.write(" null\n")
- file.write(" };\n");
+ file.write(" {\n")
+ for label in commandLineLabels:
+ file.write(" \"" + label + "\",\n")
+ file.write(" null\n")
+ file.write(" };\n");
file.write("}\n");
return
if lang == "cs":
file.write(" public static string[][] validProps =\n")
- file.write(" {\n")
- for label, line in labels.iteritems():
- file.write(" " + label + "Props,\n")
- file.write(" null\n")
- file.write(" };\n\n");
+ file.write(" {\n")
+ for label, line in labels.iteritems():
+ file.write(" " + label + "Props,\n")
+ file.write(" null\n")
+ file.write(" };\n\n");
file.write(" public static string[] clPropNames =\n")
- file.write(" {\n")
- for label in commandLineLabels:
- file.write(" \"" + label + "\",\n")
- file.write(" null\n")
- file.write(" };\n");
+ file.write(" {\n")
+ for label in commandLineLabels:
+ file.write(" \"" + label + "\",\n")
+ file.write(" null\n")
+ file.write(" };\n");
file.write(" }\n");
file.write("}\n");
return
@@ -179,21 +179,21 @@ def writePostamble(lang, labels, commandLineLabels):
def startSection(lang, label):
if lang == "cpp":
header = outputFiles[1][1]
- header.write(" static const char* " + label + "Props[];\n")
+ header.write(" static const char* " + label + "Props[];\n")
file = outputFiles[0][1]
if lang == "cpp":
- file.write("\n");
+ file.write("\n");
file.write("const char* IceInternal::" + classname + "::" + label + "Props[] =\n")
file.write("{\n");
- return
+ return
if lang == "java":
file.write(" public static final String " + label + "Props[] =\n");
- file.write(" {\n")
- return
+ file.write(" {\n")
+ return
if lang == "cs":
file.write(" public static string[] " + label + "Props =\n");
- file.write(" {\n")
+ file.write(" {\n")
return
def endSection(lang):
@@ -201,32 +201,32 @@ def endSection(lang):
if lang == "cpp":
file.write(" 0\n");
file.write("};\n");
- return
+ return
if lang == "java":
- file.write(" null\n");
- file.write(" };\n");
+ file.write(" null\n");
+ file.write(" };\n");
file.write("\n")
- return
+ return
if lang == "cs":
- file.write(" null\n");
- file.write(" };\n");
+ file.write(" null\n");
+ file.write(" };\n");
file.write("\n")
- return
+ return
wildcard = re.compile(".*<any>.*")
def writeEntry(lang, label, entry):
file = outputFiles[0][1]
if lang == "cpp":
- file.write(" \"" + label + '.' + string.replace(entry, "<any>", "*") + "\",\n")
+ file.write(" \"" + label + '.' + string.replace(entry, "<any>", "*") + "\",\n")
elif lang == "java":
- pattern = string.replace(entry, ".", "\\\\.")
- pattern = string.replace(pattern, "<any>", "[^\\\\s]+")
- file.write(" " + "\"^" + label + "\\\\." + pattern + "$\",\n")
+ pattern = string.replace(entry, ".", "\\\\.")
+ pattern = string.replace(pattern, "<any>", "[^\\\\s]+")
+ file.write(" " + "\"^" + label + "\\\\." + pattern + "$\",\n")
elif lang == "cs":
- pattern = string.replace(entry, ".", "\\.")
- pattern = string.replace(pattern, "<any>", "[^\\s]+")
- file.write(" " + "@\"^" + label + "\\." + pattern + "$\",\n")
+ pattern = string.replace(entry, ".", "\\.")
+ pattern = string.replace(pattern, "<any>", "[^\\s]+")
+ file.write(" " + "@\"^" + label + "\\." + pattern + "$\",\n")
def processFile(lang):
@@ -235,17 +235,17 @@ def processFile(lang):
#
global infile
try:
- f = file(infile, 'r')
+ f = file(infile, 'r')
except IOError, ex:
- progError("cannot open `" + infile + "': " + ex.strerror)
- sys.exit(1)
+ progError("cannot open `" + infile + "': " + ex.strerror)
+ sys.exit(1)
#
# Set up regular expressions for empty and comment lines, section headings, and entry lines.
#
- ignore = re.compile("^\s*(?:#.*)?$") # Empty line or comment line
+ ignore = re.compile("^\s*(?:#.*)?$") # Empty line or comment line
section = re.compile("^\s*([a-zA-Z_]\w*)\s*:\s*([a-zA-Z]\w*)?\s*$") # Section heading
- entry = re.compile("^\s*([^ \t\n\r\f\v#]+)(?:\s*#.*)?$") # Any non-whitespace character sequence, except for #
+ entry = re.compile("^\s*([^ \t\n\r\f\v#]+)(?:\s*#.*)?$") # Any non-whitespace character sequence, except for #
#
# Install signal handler so we can remove the output files if we are interrupted.
@@ -261,14 +261,14 @@ def processFile(lang):
classname, ext = os.path.splitext(os.path.basename(infile))
openOutputFile(classname + '.' + lang)
if(lang == "cpp"):
- openOutputFile(classname + ".h")
+ openOutputFile(classname + ".h")
- labels = {} # Records the line number on which each label is defined
+ labels = {} # Records the line number on which each label is defined
commandLineLabels = [] # The set of labels which are command line processing is enabled
- atSectionStart = 0 # True for the line on which a label is defined
- seenSection = 0 # Set to true (and the remains as true) once the first label is defined
- numEntries = 0 # Number of entries within a section
- errors = 0 # Number of syntax errors in the input file
+ atSectionStart = 0 # True for the line on which a label is defined
+ seenSection = 0 # Set to true (and the remains as true) once the first label is defined
+ numEntries = 0 # Number of entries within a section
+ errors = 0 # Number of syntax errors in the input file
#
# Write preamble.
@@ -281,57 +281,57 @@ def processFile(lang):
global lineNum
lines = f.readlines()
for l in lines:
- lineNum += 1
-
- #
- # Ignore empty lines and comments.
- #
- if ignore.match(l) != None:
- continue
-
- #
- # Start of section.
- #
- labelMatch = section.match(l)
- if labelMatch != None:
- if atSectionStart:
- fileError("section `" + label + "' must have at least one entry")
- label = labelMatch.group(1)
- try:
- badLine = labels[label]
- fileError("duplicate section heading: `" + label + "': previously defined on line " + badLine)
- except KeyError:
- pass
- if label == "validProps":
- fileError("`validProps' is reserved and cannot be used as a section heading")
+ lineNum += 1
+
+ #
+ # Ignore empty lines and comments.
+ #
+ if ignore.match(l) != None:
+ continue
+
+ #
+ # Start of section.
+ #
+ labelMatch = section.match(l)
+ if labelMatch != None:
+ if atSectionStart:
+ fileError("section `" + label + "' must have at least one entry")
+ label = labelMatch.group(1)
+ try:
+ badLine = labels[label]
+ fileError("duplicate section heading: `" + label + "': previously defined on line " + badLine)
+ except KeyError:
+ pass
+ if label == "validProps":
+ fileError("`validProps' is reserved and cannot be used as a section heading")
if labelMatch.group(2) != "false":
commandLineLabels.append(label)
- labels[label] = lineNum
- if seenSection:
- endSection(lang)
- numEntries = 0
- startSection(lang, label)
- seenSection = 1
- atSectionStart = 1
- continue
-
- entryMatch = entry.match(l)
- if entryMatch != None:
- writeEntry(lang, label, entryMatch.group(1))
- atSectionStart = 0
- numEntries += 1
- continue
-
- fileError("syntax error")
+ labels[label] = lineNum
+ if seenSection:
+ endSection(lang)
+ numEntries = 0
+ startSection(lang, label)
+ seenSection = 1
+ atSectionStart = 1
+ continue
+
+ entryMatch = entry.match(l)
+ if entryMatch != None:
+ writeEntry(lang, label, entryMatch.group(1))
+ atSectionStart = 0
+ numEntries += 1
+ continue
+
+ fileError("syntax error")
if len(labels) == 0:
- fileError("input must define at least one section");
+ fileError("input must define at least one section");
#
# End the final section.
#
if numEntries == 0:
- fileError("section `" + label + "' must have at least one entry")
+ fileError("section `" + label + "' must have at least one entry")
endSection(lang)
#
@@ -347,8 +347,8 @@ def processFile(lang):
# Remove the output files if anything went wrong, so we don't leave partically written files behind.
#
if errors != 0:
- removeOutputFiles()
- sys.exit(1)
+ removeOutputFiles()
+ sys.exit(1)
outputFiles = []
#
@@ -364,12 +364,12 @@ if len(sys.argv) == 1:
# Find where the root of the tree is.
#
for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
- toplevel = os.path.normpath(toplevel)
- if os.path.exists(os.path.join(toplevel, "config", "makeprops.py")):
- break
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "config", "makeprops.py")):
+ break
else:
- progError("cannot find top-level directory")
- sys.exit(1)
+ progError("cannot find top-level directory")
+ sys.exit(1)
infile = os.path.join(toplevel, "config", "PropertyNames.def")
lang = "all"
@@ -377,17 +377,17 @@ if len(sys.argv) == 1:
else:
option = sys.argv[1]
if option == "--cpp":
- lang = "cpp"
+ lang = "cpp"
elif option == "--java":
- lang = "java"
+ lang = "java"
elif option == "--cs":
- lang = "cs"
+ lang = "cs"
elif option == "-h" or option == "--help" or option == "-?":
- usage()
- sys.exit(0)
+ usage()
+ sys.exit(0)
else:
- usage()
- sys.exit(1)
+ usage()
+ sys.exit(1)
infile = sys.argv[2]
if lang == "all":
diff --git a/cpp/config/upgradeicegrid.py b/cpp/config/upgradeicegrid.py
index 143b0535680..4fcaeb53c9a 100755
--- a/cpp/config/upgradeicegrid.py
+++ b/cpp/config/upgradeicegrid.py
@@ -51,7 +51,7 @@ def printOutputFromPipe(pipe):
if not line:
break
if line.find("warning") == -1:
- os.write(1, line)
+ os.write(1, line)
def error(message):
print "error: " + message
@@ -92,7 +92,7 @@ for x in sys.argv[1:]:
usage()
sys.exit(0)
elif x == "-o":
- iceVersion = "3.1"
+ iceVersion = "3.1"
elif x.startswith("-"):
print sys.argv[0] + ": unknown option `" + x + "'"
print
@@ -138,7 +138,7 @@ desc = \
'<transformdb>' + \
' ' + \
' <database name="applications" key="string" value="::IceGrid::ApplicationDescriptor,::IceGrid::ApplicationInfo">' + \
-' <record>' + \
+' <record>' + \
' <set target="newvalue.revision" value="1"/>' + \
' <set target="newvalue.uuid" value="generateUUID()"/>' + \
' <set target="newvalue.createUser" value="\'IceGrid Registry (database upgrade)\'"/>' + \
diff --git a/cpp/config/upgradeicestorm.py b/cpp/config/upgradeicestorm.py
index 84a7152b763..56ee149626a 100755
--- a/cpp/config/upgradeicestorm.py
+++ b/cpp/config/upgradeicestorm.py
@@ -44,7 +44,7 @@ def printOutputFromPipe(pipe):
if not line:
break
if line.find("warning") == -1:
- os.write(1, line)
+ os.write(1, line)
def error(message):
print "error: " + message
@@ -66,7 +66,7 @@ def transformdb(db, desc, oldSlice, newSlice):
os.close(temp)
transformdb = os.path.join(bindir, "transformdb") + " -i --old " + oldSliceFile + " --new " + newSliceFile + \
- " -f " + descFile + " " + olddbenv + " " + db + " " + newdbenv + " 2>&1"
+ " -f " + descFile + " " + olddbenv + " " + db + " " + newdbenv + " 2>&1"
pipe = os.popen(transformdb)
printOutputFromPipe(pipe)
diff --git a/cpp/demo/Database/Oracle/occi/Client.cpp b/cpp/demo/Database/Oracle/occi/Client.cpp
index 2260decdd0b..569fdf620fc 100644
--- a/cpp/demo/Database/Oracle/occi/Client.cpp
+++ b/cpp/demo/Database/Oracle/occi/Client.cpp
@@ -63,32 +63,32 @@ HRClient::HRClient() :
_currentMenu(rootMenu)
{
_commonCommands =
- "dept <number>: set department <number> as the current department\n"
- "emp <number>: set employee <number> as the current employee\n"
- "exit or quit: exit client\n"
- "help: print this list of commands\n"
- "root: go back to the root menu\n";
+ "dept <number>: set department <number> as the current department\n"
+ "emp <number>: set employee <number> as the current employee\n"
+ "exit or quit: exit client\n"
+ "help: print this list of commands\n"
+ "root: go back to the root menu\n";
_rootCommands =
- "create: create a new department\n"
- "find <name>: find the department(s) with the given name\n"
- "list: list all departments\n";
+ "create: create a new department\n"
+ "find <name>: find the department(s) with the given name\n"
+ "list: list all departments\n";
-
+
_deptCommands =
- "create: create a new employee in this department\n"
- "find <name>: find employee(s) named <name> in this department\n"
- "list: list all employees in this department\n"
- "ping: ping this department\n"
- "remove: remove this department\n"
- "show: describe this department\n"
- "update <dname|loc> <new value>: update this department\n";
+ "create: create a new employee in this department\n"
+ "find <name>: find employee(s) named <name> in this department\n"
+ "list: list all employees in this department\n"
+ "ping: ping this department\n"
+ "remove: remove this department\n"
+ "show: describe this department\n"
+ "update <dname|loc> <new value>: update this department\n";
_empCommands =
- "ping: ping this employee\n"
- "remove: remove this employee\n"
- "show: describe this employee\n"
- "update <ename|job|mgr|hiredate|sal|comm|dept> <new-value>: update this employee\n";
+ "ping: ping this employee\n"
+ "remove: remove this employee\n"
+ "show: describe this employee\n"
+ "update <ename|job|mgr|hiredate|sal|comm|dept> <new-value>: update this employee\n";
}
void
@@ -96,13 +96,13 @@ HRClient::checkEof(const string& command) const
{
if(!cin.eof())
{
- string extra;
- getline(cin, extra);
- if(extra.size() > 0)
- {
- cout << "Warning: ignoring extra args '" << extra
- << "' for '" << command << "'" << endl;
- }
+ string extra;
+ getline(cin, extra);
+ if(extra.size() > 0)
+ {
+ cout << "Warning: ignoring extra args '" << extra
+ << "' for '" << command << "'" << endl;
+ }
}
}
@@ -111,10 +111,10 @@ HRClient::checkCin(const string& command) const
{
if(!cin)
{
- cout << "Error: failed to read arguments for '" << command << "'" << endl;
- cin.clear();
- cin.ignore(numeric_limits<streamsize>::max(), '\n');
- return false;
+ cout << "Error: failed to read arguments for '" << command << "'" << endl;
+ cin.clear();
+ cin.ignore(numeric_limits<streamsize>::max(), '\n');
+ return false;
}
checkEof(command);
return true;
@@ -124,7 +124,7 @@ void
HRClient::invalidCommand(const string& command) const
{
cout << "Invalid command '" << command << "'. "
- "Type 'help' for help." << endl;
+ "Type 'help' for help." << endl;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
@@ -136,21 +136,21 @@ HRClient::help() const
switch(_currentMenu)
{
- case rootMenu:
- {
- cout << _rootCommands;
- break;
- }
- case deptMenu:
- {
- cout << _deptCommands;
- break;
- }
- case empMenu:
- {
- cout << _empCommands;
- break;
- }
+ case rootMenu:
+ {
+ cout << _rootCommands;
+ break;
+ }
+ case deptMenu:
+ {
+ cout << _deptCommands;
+ break;
+ }
+ case empMenu:
+ {
+ cout << _empCommands;
+ break;
+ }
}
cout << "--- Common to all menus ---\n";
cout << _commonCommands << endl;
@@ -163,8 +163,8 @@ HRClient::run(int argc, char* argv[])
_factory = DeptFactoryPrx::checkedCast(base);
if(_factory == 0)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
Ice::EndpointSeq endpoints = _factory->ice_getEndpoints();
@@ -178,102 +178,102 @@ HRClient::run(int argc, char* argv[])
do
{
- cout << "==> ";
- cin >> command;
-
- if(!cin)
- {
- break;
- }
-
- try
- {
-
- //
- // Common commands
- //
- if(command == "dept")
- {
- int deptno;
- cin >> deptno;
- if(checkCin(command))
- {
- _currentDept = DeptPrx::uncheckedCast(_factory->findDeptByNo(deptno));
- if(_currentDept != 0)
- {
- _currentMenu = deptMenu;
- }
- else
- {
- cout << "There is no department with deptno " << deptno << endl;
- }
- }
- }
- else if(command == "emp")
- {
- int empno;
- cin >> empno;
- if(checkCin(command))
- {
- _currentEmp = EmpPrx::uncheckedCast(_factory->findEmpByNo(empno));
- if(_currentEmp != 0)
- {
- _currentMenu = empMenu;
- }
- else
- {
- cout << "There is no employee with empno " << empno << endl;
- }
- }
- }
- else if(command == "exit" || command == "quit")
- {
- checkEof(command);
- break;
- }
- else if(command == "help")
- {
- checkEof(command);
- help();
- }
- else if(command == "root")
- {
- checkEof(command);
- _currentMenu = rootMenu;
- }
- else if(_currentMenu == rootMenu)
- {
- doRootMenu(command);
- }
- else if(_currentMenu == deptMenu)
- {
- doDeptMenu(command);
- }
- else if(_currentMenu == empMenu)
- {
- doEmpMenu(command);
- }
- else
- {
- assert(0);
- }
- }
- catch(const SqlException& e)
- {
- cout << "Caught a SqlException: " << e.reason << endl;
- }
- catch(const IceUtil::Exception& e)
- {
- cout << "Caught an Ice exception: " << e << endl;
- }
- catch(const std::exception& e)
- {
- cout << "Caught a std::exception: " << e.what() << endl;
- }
- catch(...)
- {
- cout << "Caught an unknown exception" << endl;
- }
+ cout << "==> ";
+ cin >> command;
+
+ if(!cin)
+ {
+ break;
+ }
+
+ try
+ {
+
+ //
+ // Common commands
+ //
+ if(command == "dept")
+ {
+ int deptno;
+ cin >> deptno;
+ if(checkCin(command))
+ {
+ _currentDept = DeptPrx::uncheckedCast(_factory->findDeptByNo(deptno));
+ if(_currentDept != 0)
+ {
+ _currentMenu = deptMenu;
+ }
+ else
+ {
+ cout << "There is no department with deptno " << deptno << endl;
+ }
+ }
+ }
+ else if(command == "emp")
+ {
+ int empno;
+ cin >> empno;
+ if(checkCin(command))
+ {
+ _currentEmp = EmpPrx::uncheckedCast(_factory->findEmpByNo(empno));
+ if(_currentEmp != 0)
+ {
+ _currentMenu = empMenu;
+ }
+ else
+ {
+ cout << "There is no employee with empno " << empno << endl;
+ }
+ }
+ }
+ else if(command == "exit" || command == "quit")
+ {
+ checkEof(command);
+ break;
+ }
+ else if(command == "help")
+ {
+ checkEof(command);
+ help();
+ }
+ else if(command == "root")
+ {
+ checkEof(command);
+ _currentMenu = rootMenu;
+ }
+ else if(_currentMenu == rootMenu)
+ {
+ doRootMenu(command);
+ }
+ else if(_currentMenu == deptMenu)
+ {
+ doDeptMenu(command);
+ }
+ else if(_currentMenu == empMenu)
+ {
+ doEmpMenu(command);
+ }
+ else
+ {
+ assert(0);
+ }
+ }
+ catch(const SqlException& e)
+ {
+ cout << "Caught a SqlException: " << e.reason << endl;
+ }
+ catch(const IceUtil::Exception& e)
+ {
+ cout << "Caught an Ice exception: " << e << endl;
+ }
+ catch(const std::exception& e)
+ {
+ cout << "Caught a std::exception: " << e.what() << endl;
+ }
+ catch(...)
+ {
+ cout << "Caught an unknown exception" << endl;
+ }
}
while(cin.good());
@@ -285,38 +285,38 @@ HRClient::doRootMenu(const string& command) const
{
if(command == "create")
{
- checkEof(command);
- cout << "Please enter: deptno dname loc ==> ";
- int deptno;
- DeptDesc desc;
- cin >> deptno >> desc.dname >> desc.loc;
-
- desc.dname = unquote(desc.dname);
- desc.loc = unquote(desc.loc);
-
- if(checkCin("create parameters"))
- {
- _factory->createDept(deptno, desc);
- cout << "Created new department number " << deptno << endl;
- }
+ checkEof(command);
+ cout << "Please enter: deptno dname loc ==> ";
+ int deptno;
+ DeptDesc desc;
+ cin >> deptno >> desc.dname >> desc.loc;
+
+ desc.dname = unquote(desc.dname);
+ desc.loc = unquote(desc.loc);
+
+ if(checkCin("create parameters"))
+ {
+ _factory->createDept(deptno, desc);
+ cout << "Created new department number " << deptno << endl;
+ }
}
else if(command == "find")
{
- string name;
- cin >> name;
- if(checkCin(command))
- {
- printDepts(_factory->findByName(name));
- }
+ string name;
+ cin >> name;
+ if(checkCin(command))
+ {
+ printDepts(_factory->findByName(name));
+ }
}
else if(command == "list")
{
- checkEof(command);
- printDepts(_factory->findAll());
+ checkEof(command);
+ printDepts(_factory->findAll());
}
else
{
- invalidCommand(command);
+ invalidCommand(command);
}
}
@@ -325,84 +325,84 @@ HRClient::doDeptMenu(const string& command) const
{
if(command == "create")
{
- checkEof(command);
- cout << "Please enter: empno ename job mgr(empno) hiredate sal comm ==> ";
- int empno;
- int mgrEmpno;
- EmpDesc desc;
- cin >> empno >> desc.ename >> desc.job >> mgrEmpno >> desc.hiredate >> desc.sal >> desc.comm;
-
- desc.ename = unquote(desc.ename);
- desc.job = unquote(desc.job);
-
- if(mgrEmpno != 0)
- {
- desc.mgr = _factory->findEmpByNo(mgrEmpno);
- if(desc.mgr == 0)
- {
- cout << "Manager #" << mgrEmpno << " does not exist: clearing manager" << endl;
- }
- }
- desc.hiredate = unquote(desc.hiredate);
- desc.sal = unquote(desc.sal);
- desc.comm = unquote(desc.comm);
-
- desc.edept = _currentDept;
-
- if(checkCin("create parameters"))
- {
- _currentDept->createEmp(empno, desc);
- cout << "Created new employee number " << empno << endl;
- }
+ checkEof(command);
+ cout << "Please enter: empno ename job mgr(empno) hiredate sal comm ==> ";
+ int empno;
+ int mgrEmpno;
+ EmpDesc desc;
+ cin >> empno >> desc.ename >> desc.job >> mgrEmpno >> desc.hiredate >> desc.sal >> desc.comm;
+
+ desc.ename = unquote(desc.ename);
+ desc.job = unquote(desc.job);
+
+ if(mgrEmpno != 0)
+ {
+ desc.mgr = _factory->findEmpByNo(mgrEmpno);
+ if(desc.mgr == 0)
+ {
+ cout << "Manager #" << mgrEmpno << " does not exist: clearing manager" << endl;
+ }
+ }
+ desc.hiredate = unquote(desc.hiredate);
+ desc.sal = unquote(desc.sal);
+ desc.comm = unquote(desc.comm);
+
+ desc.edept = _currentDept;
+
+ if(checkCin("create parameters"))
+ {
+ _currentDept->createEmp(empno, desc);
+ cout << "Created new employee number " << empno << endl;
+ }
}
else if(command == "find")
{
- string name;
- cin >> name;
- if(checkCin(command))
- {
- printEmps(_currentDept->findByName(name));
- }
+ string name;
+ cin >> name;
+ if(checkCin(command))
+ {
+ printEmps(_currentDept->findByName(name));
+ }
}
else if(command == "list")
{
- checkEof(command);
- printEmps(_currentDept->findAll());
+ checkEof(command);
+ printEmps(_currentDept->findAll());
}
else if(command == "ping")
{
- checkEof(command);
- _currentDept->ice_ping();
- cout << "ice_ping: success!" << endl;
+ checkEof(command);
+ _currentDept->ice_ping();
+ cout << "ice_ping: success!" << endl;
}
else if(command == "remove")
{
- checkEof(command);
- _currentDept->remove();
+ checkEof(command);
+ _currentDept->remove();
}
else if(command == "show")
{
- checkEof(command);
- DeptDesc desc = _currentDept->getDesc();
- cout << "deptno: " << desc.deptno << endl;
- cout << "dname: " << quote(desc.dname) << endl;
- cout << "loc: " << quote(desc.loc) << endl;
+ checkEof(command);
+ DeptDesc desc = _currentDept->getDesc();
+ cout << "deptno: " << desc.deptno << endl;
+ cout << "dname: " << quote(desc.dname) << endl;
+ cout << "loc: " << quote(desc.loc) << endl;
}
else if(command == "update")
{
- string field;
- string newValue;
- cin >> field >> newValue;
- newValue = unquote(newValue);
-
- if(checkCin("update " + field))
- {
- _currentDept->updateField(field, newValue);
- }
+ string field;
+ string newValue;
+ cin >> field >> newValue;
+ newValue = unquote(newValue);
+
+ if(checkCin("update " + field))
+ {
+ _currentDept->updateField(field, newValue);
+ }
}
else
{
- invalidCommand(command);
+ invalidCommand(command);
}
}
@@ -411,80 +411,80 @@ HRClient::doEmpMenu(const string& command) const
{
if(command == "ping")
{
- checkEof(command);
- _currentEmp->ice_ping();
- cout << "ice_ping: success!" << endl;
+ checkEof(command);
+ _currentEmp->ice_ping();
+ cout << "ice_ping: success!" << endl;
}
else if(command == "remove")
{
- checkEof(command);
- _currentEmp->remove();
+ checkEof(command);
+ _currentEmp->remove();
}
else if(command == "show")
{
- checkEof(command);
- EmpDesc desc = _currentEmp->getDesc();
- cout << "empno: " << desc.empno << endl;
- cout << "ename: " << quote(desc.ename) << endl;
- cout << "job: " << quote(desc.job) << endl;
- cout << "mgr: ";
- if(desc.mgr == 0)
- {
- cout << "<null>" << endl;
- }
- else
- {
- cout << desc.mgr->getDesc().empno << endl;
- }
- cout << "hiredate: " << quote(desc.hiredate) << endl;
- cout << "sal: " << quote(desc.sal) << endl;
- cout << "comm: " << quote(desc.comm) << endl;
- cout << "dept: ";
- if(desc.edept == 0)
- {
- cout << "<null>" << endl;
- }
- else
- {
- cout << desc.edept->getDesc().deptno << endl;
- }
+ checkEof(command);
+ EmpDesc desc = _currentEmp->getDesc();
+ cout << "empno: " << desc.empno << endl;
+ cout << "ename: " << quote(desc.ename) << endl;
+ cout << "job: " << quote(desc.job) << endl;
+ cout << "mgr: ";
+ if(desc.mgr == 0)
+ {
+ cout << "<null>" << endl;
+ }
+ else
+ {
+ cout << desc.mgr->getDesc().empno << endl;
+ }
+ cout << "hiredate: " << quote(desc.hiredate) << endl;
+ cout << "sal: " << quote(desc.sal) << endl;
+ cout << "comm: " << quote(desc.comm) << endl;
+ cout << "dept: ";
+ if(desc.edept == 0)
+ {
+ cout << "<null>" << endl;
+ }
+ else
+ {
+ cout << desc.edept->getDesc().deptno << endl;
+ }
}
else if(command == "update")
{
- string field;
- cin >> field;
- if(field == "mgr")
- {
- int mgr;
- cin >> mgr;
- if(checkCin("update mgr"))
- {
- _currentEmp->updateMgr(mgr);
- }
- }
- else if(field == "dept")
- {
- int deptno;
- cin >> deptno;
- if(checkCin("update dept"))
- {
- _currentEmp->updateDept(deptno);
- }
- }
- else
- {
- string newValue;
- cin >> newValue;
- newValue = unquote(newValue);
- if(checkCin("update " + field))
- {
- _currentEmp->updateField(field, newValue);
- }
- }
+ string field;
+ cin >> field;
+ if(field == "mgr")
+ {
+ int mgr;
+ cin >> mgr;
+ if(checkCin("update mgr"))
+ {
+ _currentEmp->updateMgr(mgr);
+ }
+ }
+ else if(field == "dept")
+ {
+ int deptno;
+ cin >> deptno;
+ if(checkCin("update dept"))
+ {
+ _currentEmp->updateDept(deptno);
+ }
+ }
+ else
+ {
+ string newValue;
+ cin >> newValue;
+ newValue = unquote(newValue);
+ if(checkCin("update " + field))
+ {
+ _currentEmp->updateField(field, newValue);
+ }
+ }
}
else
{
- invalidCommand(command);
+ invalidCommand(command);
}
}
@@ -494,15 +494,15 @@ HRClient::printDepts(const DeptPrxSeq& depts) const
cout << "Deptno\t Dname\t Loc" << endl;
if(depts.size() == 0)
{
- cout << "<None found>" << endl;
+ cout << "<None found>" << endl;
}
else
{
- for(DeptPrxSeq::const_iterator p = depts.begin(); p != depts.end(); ++p)
- {
- HR::DeptDesc desc = (*p)->getDesc();
- cout << desc.deptno << "\t " << desc.dname << "\t " << desc.loc << endl;
- }
+ for(DeptPrxSeq::const_iterator p = depts.begin(); p != depts.end(); ++p)
+ {
+ HR::DeptDesc desc = (*p)->getDesc();
+ cout << desc.deptno << "\t " << desc.dname << "\t " << desc.loc << endl;
+ }
}
}
@@ -512,15 +512,15 @@ HRClient::printEmps(const EmpPrxSeq& emps) const
cout << "Empno\t Ename" << endl;
if(emps.size() == 0)
{
- cout << "<None found>" << endl;
+ cout << "<None found>" << endl;
}
else
{
- for(EmpPrxSeq::const_iterator p = emps.begin(); p != emps.end(); ++p)
- {
- HR::EmpDesc desc = (*p)->getDesc();
- cout << desc.empno << "\t " << desc.ename << endl;
- }
+ for(EmpPrxSeq::const_iterator p = emps.begin(); p != emps.end(); ++p)
+ {
+ HR::EmpDesc desc = (*p)->getDesc();
+ cout << desc.empno << "\t " << desc.ename << endl;
+ }
}
}
@@ -530,11 +530,11 @@ HRClient::quote(const string& str)
{
if(str == "")
{
- return "''";
+ return "''";
}
else
{
- return str;
+ return str;
}
}
@@ -544,10 +544,10 @@ HRClient::unquote(const string& str)
{
if(str == "''")
{
- return "";
+ return "";
}
else
{
- return str;
+ return str;
}
}
diff --git a/cpp/demo/Database/Oracle/occi/DeptFactoryI.cpp b/cpp/demo/Database/Oracle/occi/DeptFactoryI.cpp
index 03a9d7538b7..336d4dc6a1b 100644
--- a/cpp/demo/Database/Oracle/occi/DeptFactoryI.cpp
+++ b/cpp/demo/Database/Oracle/occi/DeptFactoryI.cpp
@@ -23,7 +23,7 @@ using namespace std;
using namespace oracle::occi;
DeptFactoryI::DeptFactoryI(Environment* env, StatelessConnectionPool* pool,
- const string& category) :
+ const string& category) :
_env(env),
_pool(pool),
_category(category)
@@ -58,18 +58,18 @@ DeptFactoryI::findAll(const Ice::Current& current)
ConnectionHolderPtr conh = new ConnectionHolder(_pool);
{
- StatementHolder stmth(conh);
+ StatementHolder stmth(conh);
- auto_ptr<ResultSet> rs(stmth.statement()->executeQuery("SELECT REF(d) FROM DEPT_VIEW d"));
-
- while(rs->next() != ResultSet::END_OF_FETCH)
- {
- Ice::Identity deptId;
- deptId.category = _category;
- deptId.name = encodeRef(rs->getRef(1), _env);
-
- result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
- }
+ auto_ptr<ResultSet> rs(stmth.statement()->executeQuery("SELECT REF(d) FROM DEPT_VIEW d"));
+
+ while(rs->next() != ResultSet::END_OF_FETCH)
+ {
+ Ice::Identity deptId;
+ deptId.category = _category;
+ deptId.name = encodeRef(rs->getRef(1), _env);
+
+ result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
+ }
}
conh->commit();
return result;
@@ -82,20 +82,20 @@ DeptFactoryI::findByName(const string& name, const Ice::Current& current)
HR::DeptPrxSeq result;
ConnectionHolderPtr conh = new ConnectionHolder(_pool);
{
- StatementHolder stmth(conh);
- stmth.statement()->setSQL("SELECT REF(d) FROM DEPT_VIEW d WHERE DNAME = :1");
- stmth.statement()->setString(1, name);
-
- auto_ptr<ResultSet> rs(stmth.statement()->executeQuery());
-
- while(rs->next() != ResultSet::END_OF_FETCH)
- {
- Ice::Identity deptId;
- deptId.category = _category;
- deptId.name = encodeRef(rs->getRef(1), _env);
-
- result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
- }
+ StatementHolder stmth(conh);
+ stmth.statement()->setSQL("SELECT REF(d) FROM DEPT_VIEW d WHERE DNAME = :1");
+ stmth.statement()->setString(1, name);
+
+ auto_ptr<ResultSet> rs(stmth.statement()->executeQuery());
+
+ while(rs->next() != ResultSet::END_OF_FETCH)
+ {
+ Ice::Identity deptId;
+ deptId.category = _category;
+ deptId.name = encodeRef(rs->getRef(1), _env);
+
+ result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
+ }
}
conh->commit();
return result;
@@ -111,10 +111,10 @@ DeptFactoryI::findDeptByNo(int deptno, const Ice::Current& current)
if(!ref.isNull())
{
- Ice::Identity deptId;
- deptId.category = _category;
- deptId.name = encodeRef(ref, _env);
- result = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId));
+ Ice::Identity deptId;
+ deptId.category = _category;
+ deptId.name = encodeRef(ref, _env);
+ result = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId));
}
conh->commit();
return result;
@@ -129,10 +129,10 @@ DeptFactoryI::findEmpByNo(int empno, const Ice::Current& current)
if(!ref.isNull())
{
- Ice::Identity empId;
- empId.category = _category;
- empId.name = encodeRef(ref, _env);
- result = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId));
+ Ice::Identity empId;
+ empId.category = _category;
+ empId.name = encodeRef(ref, _env);
+ result = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId));
}
conh->commit();
return result;
@@ -148,7 +148,7 @@ DeptFactoryI::findDeptRefByNo(int deptno, Connection* con) const
if(rs->next() == ResultSet::END_OF_FETCH)
{
- return Ref<DEPT_T>();
+ return Ref<DEPT_T>();
}
return rs->getRef(1);
}
@@ -163,7 +163,7 @@ DeptFactoryI::findEmpRefByNo(int empno, Connection* con) const
if(rs->next() == ResultSet::END_OF_FETCH)
{
- return Ref<EMP_T>();
+ return Ref<EMP_T>();
}
return rs->getRef(1);
}
diff --git a/cpp/demo/Database/Oracle/occi/DeptFactoryI.h b/cpp/demo/Database/Oracle/occi/DeptFactoryI.h
index 13cf0402fc6..96ff67d28cc 100644
--- a/cpp/demo/Database/Oracle/occi/DeptFactoryI.h
+++ b/cpp/demo/Database/Oracle/occi/DeptFactoryI.h
@@ -19,7 +19,7 @@ class DeptFactoryI : public HR::DeptFactory
public:
DeptFactoryI(oracle::occi::Environment* env, oracle::occi::StatelessConnectionPool*,
- const std::string&);
+ const std::string&);
virtual HR::DeptPrx createDept(int, const HR::DeptDesc&, const Ice::Current&);
@@ -34,17 +34,17 @@ public:
oracle::occi::Environment* getEnv() const
{
- return _env;
+ return _env;
}
oracle::occi::StatelessConnectionPool* getConnectionPool() const
{
- return _pool;
+ return _pool;
}
const std::string& getCategory() const
{
- return _category;
+ return _category;
}
private:
diff --git a/cpp/demo/Database/Oracle/occi/DeptI.cpp b/cpp/demo/Database/Oracle/occi/DeptI.cpp
index 0703cfb9fac..d74f7ccf7cc 100644
--- a/cpp/demo/Database/Oracle/occi/DeptI.cpp
+++ b/cpp/demo/Database/Oracle/occi/DeptI.cpp
@@ -34,36 +34,36 @@ DeptI::createEmp(int empno, const HR::EmpDesc& desc, const Ice::Current& current
// Inserted into the OCCI cache
//
EMP_T* emp = new(_conh->connection(), "EMP_VIEW")EMP_T;
-
+
emp->setEmpno(empno);
emp->setEname(desc.ename);
emp->setJob(desc.job);
if(desc.mgr != 0)
{
- Ref<EMP_T> mgrRef = decodeRef(desc.mgr->ice_getIdentity().name, env, _conh->connection());
-
- emp->setMgrref(mgrRef);
+ Ref<EMP_T> mgrRef = decodeRef(desc.mgr->ice_getIdentity().name, env, _conh->connection());
+
+ emp->setMgrref(mgrRef);
}
if(desc.hiredate != "")
{
- Date hiredate(env);
- hiredate.fromText(desc.hiredate);
- emp->setHiredate(hiredate);
+ Date hiredate(env);
+ hiredate.fromText(desc.hiredate);
+ emp->setHiredate(hiredate);
}
if(desc.sal != "")
{
- Number sal(0);
- sal.fromText(env, desc.sal, "99999.99");
- emp->setSal(sal);
+ Number sal(0);
+ sal.fromText(env, desc.sal, "99999.99");
+ emp->setSal(sal);
}
if(desc.comm != "")
{
- Number comm(0);
- comm.fromText(env, desc.comm, "0.999");
- emp->setComm(comm);
+ Number comm(0);
+ comm.fromText(env, desc.comm, "0.999");
+ emp->setComm(comm);
}
emp->setDeptref(_ref);
@@ -93,18 +93,18 @@ void
DeptI::updateField(const string& field, const string& newValue, const Ice::Current& current)
{
Ref<DEPT_T> deptRef = decodeRef(current.id.name, _factory->getEnv(), _conh->connection());
-
+
if(field == "dname")
{
- deptRef->setDname(newValue);
+ deptRef->setDname(newValue);
}
else if(field == "loc")
{
- deptRef->setLoc(newValue);
+ deptRef->setLoc(newValue);
}
else
{
- throw HR::SqlException("There is no field " + field + " in object DEPT_T");
+ throw HR::SqlException("There is no field " + field + " in object DEPT_T");
}
deptRef->markModified();
_conh->commit();
@@ -123,21 +123,21 @@ DeptI::findAll(const Ice::Current& current)
{
HR::EmpPrxSeq result;
{
- Ref<DEPT_T> deptRef = decodeRef(current.id.name, _factory->getEnv(), _conh->connection());
+ Ref<DEPT_T> deptRef = decodeRef(current.id.name, _factory->getEnv(), _conh->connection());
- StatementHolder stmth(_conh);
- stmth.statement()->setSQL("SELECT REF(e) FROM EMP_VIEW e WHERE DEPTREF = :1");
- stmth.statement()->setRef(1, deptRef);
- auto_ptr<ResultSet> rs(stmth.statement()->executeQuery());
-
- while(rs->next() != ResultSet::END_OF_FETCH)
- {
- Ice::Identity empId;
- empId.category = _factory->getCategory();
- empId.name = encodeRef(rs->getRef(1), _factory->getEnv());
-
- result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
- }
+ StatementHolder stmth(_conh);
+ stmth.statement()->setSQL("SELECT REF(e) FROM EMP_VIEW e WHERE DEPTREF = :1");
+ stmth.statement()->setRef(1, deptRef);
+ auto_ptr<ResultSet> rs(stmth.statement()->executeQuery());
+
+ while(rs->next() != ResultSet::END_OF_FETCH)
+ {
+ Ice::Identity empId;
+ empId.category = _factory->getCategory();
+ empId.name = encodeRef(rs->getRef(1), _factory->getEnv());
+
+ result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
+ }
}
_conh->commit();
return result;
@@ -148,22 +148,22 @@ DeptI::findByName(const string& name, const Ice::Current& current)
{
HR::EmpPrxSeq result;
{
- Ref<DEPT_T> deptRef = decodeRef(current.id.name, _factory->getEnv(), _conh->connection());
+ Ref<DEPT_T> deptRef = decodeRef(current.id.name, _factory->getEnv(), _conh->connection());
- StatementHolder stmth(_conh);
- stmth.statement()->setSQL("SELECT REF(e) FROM EMP_VIEW e WHERE DEPTREF = :1 AND ENAME = :2");
- stmth.statement()->setRef(1, deptRef);
- stmth.statement()->setString(2, name);
- auto_ptr<ResultSet> rs(stmth.statement()->executeQuery());
-
- while(rs->next() != ResultSet::END_OF_FETCH)
- {
- Ice::Identity empId;
- empId.category = _factory->getCategory();
- empId.name = encodeRef(rs->getRef(1), _factory->getEnv());
-
- result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
- }
+ StatementHolder stmth(_conh);
+ stmth.statement()->setSQL("SELECT REF(e) FROM EMP_VIEW e WHERE DEPTREF = :1 AND ENAME = :2");
+ stmth.statement()->setRef(1, deptRef);
+ stmth.statement()->setString(2, name);
+ auto_ptr<ResultSet> rs(stmth.statement()->executeQuery());
+
+ while(rs->next() != ResultSet::END_OF_FETCH)
+ {
+ Ice::Identity empId;
+ empId.category = _factory->getCategory();
+ empId.name = encodeRef(rs->getRef(1), _factory->getEnv());
+
+ result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
+ }
}
_conh->commit();
return result;
diff --git a/cpp/demo/Database/Oracle/occi/EmpI.cpp b/cpp/demo/Database/Oracle/occi/EmpI.cpp
index d591542cafe..7ae0bd39461 100644
--- a/cpp/demo/Database/Oracle/occi/EmpI.cpp
+++ b/cpp/demo/Database/Oracle/occi/EmpI.cpp
@@ -32,31 +32,31 @@ EmpI::getDesc(const Ice::Current& current)
Ref<EMP_T> mgrRef = empRef->getMgrref();
if(!mgrRef.isNull())
{
- Ice::Identity mgrId;
- mgrId.name = encodeRef(mgrRef, env);
- mgrId.category = _factory->getCategory();
- result.mgr = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(mgrId));
+ Ice::Identity mgrId;
+ mgrId.name = encodeRef(mgrRef, env);
+ mgrId.category = _factory->getCategory();
+ result.mgr = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(mgrId));
}
result.hiredate = empRef->getHiredate().toText();
if(!empRef->getSal().isNull())
{
- result.sal = empRef->getSal().toText(env, "99999.99");
+ result.sal = empRef->getSal().toText(env, "99999.99");
}
if(!empRef->getComm().isNull())
{
- result.comm = empRef->getComm().toText(env, "0.999");
+ result.comm = empRef->getComm().toText(env, "0.999");
}
Ref<DEPT_T> deptRef = empRef->getDeptref();
if(!deptRef.isNull())
{
- Ice::Identity deptId;
- deptId.name = encodeRef(deptRef, env);
- deptId.category = _factory->getCategory();
- result.edept = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId));
+ Ice::Identity deptId;
+ deptId.name = encodeRef(deptRef, env);
+ deptId.category = _factory->getCategory();
+ result.edept = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId));
}
_conh->commit();
return result;
@@ -69,55 +69,55 @@ EmpI::updateField(const string& field, const string& newValue, const Ice::Curren
if(field == "ename")
{
- empRef->setEname(newValue);
+ empRef->setEname(newValue);
}
else if(field == "job")
{
- empRef->setJob(newValue);
+ empRef->setJob(newValue);
}
else if(field == "hiredate")
{
- if(newValue == "")
- {
- empRef->setHiredate(Date());
- }
- else
- {
- Date hiredate(_factory->getEnv());
- hiredate.fromText(newValue);
- empRef->setHiredate(hiredate);
- }
+ if(newValue == "")
+ {
+ empRef->setHiredate(Date());
+ }
+ else
+ {
+ Date hiredate(_factory->getEnv());
+ hiredate.fromText(newValue);
+ empRef->setHiredate(hiredate);
+ }
}
else if(field == "sal")
{
- if(newValue == "")
- {
- empRef->setSal(Number());
- }
- else
- {
- Number sal(0);
- sal.fromText(_factory->getEnv(), newValue, "99999.99");
- empRef->setSal(sal);
- }
+ if(newValue == "")
+ {
+ empRef->setSal(Number());
+ }
+ else
+ {
+ Number sal(0);
+ sal.fromText(_factory->getEnv(), newValue, "99999.99");
+ empRef->setSal(sal);
+ }
}
else if(field == "comm")
{
- if(newValue == "")
- {
- empRef->setComm(Number());
- }
- else
- {
- Number comm(0);
- comm.fromText(_factory->getEnv(), newValue, "0.999");
- empRef->setComm(comm);
- }
+ if(newValue == "")
+ {
+ empRef->setComm(Number());
+ }
+ else
+ {
+ Number comm(0);
+ comm.fromText(_factory->getEnv(), newValue, "0.999");
+ empRef->setComm(comm);
+ }
}
else
{
- throw HR::SqlException("There is no field " + field + " in type EMP_T");
- }
+ throw HR::SqlException("There is no field " + field + " in type EMP_T");
+ }
empRef->markModified();
_conh->commit();
}
@@ -129,17 +129,17 @@ EmpI::updateMgr(int newMgr, const Ice::Current& current)
if(newMgr == 0)
{
- empRef->setMgrref(Ref<EMP_T>());
+ empRef->setMgrref(Ref<EMP_T>());
}
else
{
- Ref<EMP_T> mgrRef = _factory->findEmpRefByNo(newMgr, _conh->connection());
-
- if(mgrRef.isNull())
- {
- throw HR::SqlException("There is no employee with this empno");
- }
- empRef->setMgrref(mgrRef);
+ Ref<EMP_T> mgrRef = _factory->findEmpRefByNo(newMgr, _conh->connection());
+
+ if(mgrRef.isNull())
+ {
+ throw HR::SqlException("There is no employee with this empno");
+ }
+ empRef->setMgrref(mgrRef);
}
empRef->markModified();
_conh->commit();
@@ -152,17 +152,17 @@ EmpI::updateDept(int newDept, const Ice::Current& current)
if(newDept == 0)
{
- empRef->setDeptref(Ref<DEPT_T>());
+ empRef->setDeptref(Ref<DEPT_T>());
}
else
{
- Ref<DEPT_T> deptRef = _factory->findDeptRefByNo(newDept, _conh->connection());
-
- if(deptRef.isNull())
- {
- throw HR::SqlException("There is no department with this deptno");
- }
- empRef->setDeptref(deptRef);
+ Ref<DEPT_T> deptRef = _factory->findDeptRefByNo(newDept, _conh->connection());
+
+ if(deptRef.isNull())
+ {
+ throw HR::SqlException("There is no department with this deptno");
+ }
+ empRef->setDeptref(deptRef);
}
empRef->markModified();
_conh->commit();
diff --git a/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp b/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp
index 4236c9dc542..6d8b0ba8449 100755
--- a/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp
+++ b/cpp/demo/Database/Oracle/occi/OCCIServantLocator.cpp
@@ -30,37 +30,37 @@ OCCIServantLocator::locate(const Ice::Current& current, Ice::LocalObjectPtr& coo
try
{
- //
- // Extract SQL type from target object
- //
- string sqlType = Ref<PObject>(ref)->getSQLTypeName();
+ //
+ // Extract SQL type from target object
+ //
+ string sqlType = Ref<PObject>(ref)->getSQLTypeName();
- //
- // Create and return the servant, used only for this one operation
- //
- if(sqlType.find("EMP_T") != string::npos)
- {
- return new EmpI(ref, con, _factory);
- }
- else if(sqlType.find("DEPT_T") != string::npos)
- {
- return new DeptI(ref, con, _factory);
- }
- else
- {
- return 0;
- }
+ //
+ // Create and return the servant, used only for this one operation
+ //
+ if(sqlType.find("EMP_T") != string::npos)
+ {
+ return new EmpI(ref, con, _factory);
+ }
+ else if(sqlType.find("DEPT_T") != string::npos)
+ {
+ return new DeptI(ref, con, _factory);
+ }
+ else
+ {
+ return 0;
+ }
}
catch(const SQLException& sqle)
{
- if(sqle.getErrorCode() == 21700)
- {
- return 0;
- }
- else
- {
- throw;
- }
+ if(sqle.getErrorCode() == 21700)
+ {
+ return 0;
+ }
+ else
+ {
+ throw;
+ }
}
}
diff --git a/cpp/demo/Database/Oracle/occi/Server.cpp b/cpp/demo/Database/Oracle/occi/Server.cpp
index aff2f171ea3..8df9dceb43f 100644
--- a/cpp/demo/Database/Oracle/occi/Server.cpp
+++ b/cpp/demo/Database/Oracle/occi/Server.cpp
@@ -47,42 +47,42 @@ HRServer::run(int argc, char* argv[])
try
{
- env = Environment::createEnvironment(Environment::Mode(Environment::THREADED_MUTEXED | Environment::OBJECT));
- DbTypesMap(env);
-
- pool = env->createStatelessConnectionPool(username, password, connectString, 5, 2, 1,
- StatelessConnectionPool::HOMOGENEOUS);
+ env = Environment::createEnvironment(Environment::Mode(Environment::THREADED_MUTEXED | Environment::OBJECT));
+ DbTypesMap(env);
+
+ pool = env->createStatelessConnectionPool(username, password, connectString, 5, 2, 1,
+ StatelessConnectionPool::HOMOGENEOUS);
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("HR");
-
- DeptFactoryIPtr factory = new DeptFactoryI(env, pool, category);
- adapter->addServantLocator(new OCCIServantLocator(factory), category);
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("HR");
+
+ DeptFactoryIPtr factory = new DeptFactoryI(env, pool, category);
+ adapter->addServantLocator(new OCCIServantLocator(factory), category);
- adapter->add(factory, communicator()->stringToIdentity("DeptFactory"));
-
- adapter->activate();
- communicator()->waitForShutdown();
+ adapter->add(factory, communicator()->stringToIdentity("DeptFactory"));
+
+ adapter->activate();
+ communicator()->waitForShutdown();
}
catch(...)
{
- if(pool != 0)
- {
- env->terminateStatelessConnectionPool(pool);
- }
- if(env != 0)
- {
- Environment::terminateEnvironment(env);
- }
- throw;
+ if(pool != 0)
+ {
+ env->terminateStatelessConnectionPool(pool);
+ }
+ if(env != 0)
+ {
+ Environment::terminateEnvironment(env);
+ }
+ throw;
}
if(pool != 0)
{
- env->terminateStatelessConnectionPool(pool);
+ env->terminateStatelessConnectionPool(pool);
}
if(env != 0)
{
- Environment::terminateEnvironment(env);
+ Environment::terminateEnvironment(env);
}
return EXIT_SUCCESS;
}
diff --git a/cpp/demo/Database/Oracle/occi/Util.cpp b/cpp/demo/Database/Oracle/occi/Util.cpp
index 44c6dda8912..7b6a109e494 100644
--- a/cpp/demo/Database/Oracle/occi/Util.cpp
+++ b/cpp/demo/Database/Oracle/occi/Util.cpp
@@ -28,11 +28,11 @@ ConnectionHolder::commit()
_txDone = true;
try
{
- _con->commit();
+ _con->commit();
}
catch(const SQLException& e)
{
- throw HR::SqlException(e.what());
+ throw HR::SqlException(e.what());
}
}
@@ -42,11 +42,11 @@ ConnectionHolder::rollback()
_txDone = true;
try
{
- _con->rollback();
+ _con->rollback();
}
catch(const SQLException& e)
{
- throw HR::SqlException(e.what());
+ throw HR::SqlException(e.what());
}
}
@@ -54,19 +54,19 @@ ConnectionHolder::~ConnectionHolder()
{
if(!_txDone)
{
- _txDone = true;
- try
- {
- _con->rollback();
- }
- catch(const std::exception&)
- {
- }
+ _txDone = true;
+ try
+ {
+ _con->rollback();
+ }
+ catch(const std::exception&)
+ {
+ }
}
try
{
- _pool->releaseConnection(_con);
+ _pool->releaseConnection(_con);
}
catch(const std::exception&)
{
@@ -104,15 +104,15 @@ encodeRef(const RefAny& ref, Environment* env)
if(status == OCI_SUCCESS)
{
- result.assign(reinterpret_cast<char*>(buffer), length);
+ result.assign(reinterpret_cast<char*>(buffer), length);
}
else
{
- cerr << "encodeRef failed: ";
- sb4 errcode = 0;
- OraText buf[512];
- OCIErrorGet(error, 1, 0, &errcode, buf, 512, OCI_HTYPE_ERROR);
- cerr << reinterpret_cast<char*>(buf) << endl;
+ cerr << "encodeRef failed: ";
+ sb4 errcode = 0;
+ OraText buf[512];
+ OCIErrorGet(error, 1, 0, &errcode, buf, 512, OCI_HTYPE_ERROR);
+ cerr << reinterpret_cast<char*>(buf) << endl;
}
OCIHandleFree(error, OCI_HTYPE_ERROR);
@@ -128,26 +128,26 @@ decodeRef(const string& str, Environment* env, Connection* con)
OCIHandleAlloc(env->getOCIEnvironment(), reinterpret_cast<void**>(&error), OCI_HTYPE_ERROR, 0, 0);
sword status = OCIRefFromHex(env->getOCIEnvironment(), error,
- con->getOCIServiceContext(),
- reinterpret_cast<const OraText*>(str.c_str()), str.length(),
- &ref);
+ con->getOCIServiceContext(),
+ reinterpret_cast<const OraText*>(str.c_str()), str.length(),
+ &ref);
if(status == OCI_SUCCESS)
- {
- OCIHandleFree(error, OCI_HTYPE_ERROR);
- return RefAny(con, ref);
+ {
+ OCIHandleFree(error, OCI_HTYPE_ERROR);
+ return RefAny(con, ref);
}
else
{
- cerr << "decodeRef failed: ";
- sb4 errcode = 0;
- OraText buf[512];
- OCIErrorGet(error, 1, 0, &errcode, buf, 512, OCI_HTYPE_ERROR);
- cerr << reinterpret_cast<char*>(buf) << endl;
-
- OCIHandleFree(error, OCI_HTYPE_ERROR);
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ cerr << "decodeRef failed: ";
+ sb4 errcode = 0;
+ OraText buf[512];
+ OCIErrorGet(error, 1, 0, &errcode, buf, 512, OCI_HTYPE_ERROR);
+ cerr << reinterpret_cast<char*>(buf) << endl;
+
+ OCIHandleFree(error, OCI_HTYPE_ERROR);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
}
diff --git a/cpp/demo/Database/Oracle/occi/Util.h b/cpp/demo/Database/Oracle/occi/Util.h
index dbe44d6b9c3..2655b2281ec 100644
--- a/cpp/demo/Database/Oracle/occi/Util.h
+++ b/cpp/demo/Database/Oracle/occi/Util.h
@@ -25,7 +25,7 @@ public:
oracle::occi::Connection* connection() const
{
- return _con;
+ return _con;
}
void commit();
@@ -55,7 +55,7 @@ public:
oracle::occi::Statement* statement() const
{
- return _stmt;
+ return _stmt;
}
private:
diff --git a/cpp/demo/Database/Oracle/proc/Client.cpp b/cpp/demo/Database/Oracle/proc/Client.cpp
index 2260decdd0b..569fdf620fc 100644
--- a/cpp/demo/Database/Oracle/proc/Client.cpp
+++ b/cpp/demo/Database/Oracle/proc/Client.cpp
@@ -63,32 +63,32 @@ HRClient::HRClient() :
_currentMenu(rootMenu)
{
_commonCommands =
- "dept <number>: set department <number> as the current department\n"
- "emp <number>: set employee <number> as the current employee\n"
- "exit or quit: exit client\n"
- "help: print this list of commands\n"
- "root: go back to the root menu\n";
+ "dept <number>: set department <number> as the current department\n"
+ "emp <number>: set employee <number> as the current employee\n"
+ "exit or quit: exit client\n"
+ "help: print this list of commands\n"
+ "root: go back to the root menu\n";
_rootCommands =
- "create: create a new department\n"
- "find <name>: find the department(s) with the given name\n"
- "list: list all departments\n";
+ "create: create a new department\n"
+ "find <name>: find the department(s) with the given name\n"
+ "list: list all departments\n";
-
+
_deptCommands =
- "create: create a new employee in this department\n"
- "find <name>: find employee(s) named <name> in this department\n"
- "list: list all employees in this department\n"
- "ping: ping this department\n"
- "remove: remove this department\n"
- "show: describe this department\n"
- "update <dname|loc> <new value>: update this department\n";
+ "create: create a new employee in this department\n"
+ "find <name>: find employee(s) named <name> in this department\n"
+ "list: list all employees in this department\n"
+ "ping: ping this department\n"
+ "remove: remove this department\n"
+ "show: describe this department\n"
+ "update <dname|loc> <new value>: update this department\n";
_empCommands =
- "ping: ping this employee\n"
- "remove: remove this employee\n"
- "show: describe this employee\n"
- "update <ename|job|mgr|hiredate|sal|comm|dept> <new-value>: update this employee\n";
+ "ping: ping this employee\n"
+ "remove: remove this employee\n"
+ "show: describe this employee\n"
+ "update <ename|job|mgr|hiredate|sal|comm|dept> <new-value>: update this employee\n";
}
void
@@ -96,13 +96,13 @@ HRClient::checkEof(const string& command) const
{
if(!cin.eof())
{
- string extra;
- getline(cin, extra);
- if(extra.size() > 0)
- {
- cout << "Warning: ignoring extra args '" << extra
- << "' for '" << command << "'" << endl;
- }
+ string extra;
+ getline(cin, extra);
+ if(extra.size() > 0)
+ {
+ cout << "Warning: ignoring extra args '" << extra
+ << "' for '" << command << "'" << endl;
+ }
}
}
@@ -111,10 +111,10 @@ HRClient::checkCin(const string& command) const
{
if(!cin)
{
- cout << "Error: failed to read arguments for '" << command << "'" << endl;
- cin.clear();
- cin.ignore(numeric_limits<streamsize>::max(), '\n');
- return false;
+ cout << "Error: failed to read arguments for '" << command << "'" << endl;
+ cin.clear();
+ cin.ignore(numeric_limits<streamsize>::max(), '\n');
+ return false;
}
checkEof(command);
return true;
@@ -124,7 +124,7 @@ void
HRClient::invalidCommand(const string& command) const
{
cout << "Invalid command '" << command << "'. "
- "Type 'help' for help." << endl;
+ "Type 'help' for help." << endl;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
@@ -136,21 +136,21 @@ HRClient::help() const
switch(_currentMenu)
{
- case rootMenu:
- {
- cout << _rootCommands;
- break;
- }
- case deptMenu:
- {
- cout << _deptCommands;
- break;
- }
- case empMenu:
- {
- cout << _empCommands;
- break;
- }
+ case rootMenu:
+ {
+ cout << _rootCommands;
+ break;
+ }
+ case deptMenu:
+ {
+ cout << _deptCommands;
+ break;
+ }
+ case empMenu:
+ {
+ cout << _empCommands;
+ break;
+ }
}
cout << "--- Common to all menus ---\n";
cout << _commonCommands << endl;
@@ -163,8 +163,8 @@ HRClient::run(int argc, char* argv[])
_factory = DeptFactoryPrx::checkedCast(base);
if(_factory == 0)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
Ice::EndpointSeq endpoints = _factory->ice_getEndpoints();
@@ -178,102 +178,102 @@ HRClient::run(int argc, char* argv[])
do
{
- cout << "==> ";
- cin >> command;
-
- if(!cin)
- {
- break;
- }
-
- try
- {
-
- //
- // Common commands
- //
- if(command == "dept")
- {
- int deptno;
- cin >> deptno;
- if(checkCin(command))
- {
- _currentDept = DeptPrx::uncheckedCast(_factory->findDeptByNo(deptno));
- if(_currentDept != 0)
- {
- _currentMenu = deptMenu;
- }
- else
- {
- cout << "There is no department with deptno " << deptno << endl;
- }
- }
- }
- else if(command == "emp")
- {
- int empno;
- cin >> empno;
- if(checkCin(command))
- {
- _currentEmp = EmpPrx::uncheckedCast(_factory->findEmpByNo(empno));
- if(_currentEmp != 0)
- {
- _currentMenu = empMenu;
- }
- else
- {
- cout << "There is no employee with empno " << empno << endl;
- }
- }
- }
- else if(command == "exit" || command == "quit")
- {
- checkEof(command);
- break;
- }
- else if(command == "help")
- {
- checkEof(command);
- help();
- }
- else if(command == "root")
- {
- checkEof(command);
- _currentMenu = rootMenu;
- }
- else if(_currentMenu == rootMenu)
- {
- doRootMenu(command);
- }
- else if(_currentMenu == deptMenu)
- {
- doDeptMenu(command);
- }
- else if(_currentMenu == empMenu)
- {
- doEmpMenu(command);
- }
- else
- {
- assert(0);
- }
- }
- catch(const SqlException& e)
- {
- cout << "Caught a SqlException: " << e.reason << endl;
- }
- catch(const IceUtil::Exception& e)
- {
- cout << "Caught an Ice exception: " << e << endl;
- }
- catch(const std::exception& e)
- {
- cout << "Caught a std::exception: " << e.what() << endl;
- }
- catch(...)
- {
- cout << "Caught an unknown exception" << endl;
- }
+ cout << "==> ";
+ cin >> command;
+
+ if(!cin)
+ {
+ break;
+ }
+
+ try
+ {
+
+ //
+ // Common commands
+ //
+ if(command == "dept")
+ {
+ int deptno;
+ cin >> deptno;
+ if(checkCin(command))
+ {
+ _currentDept = DeptPrx::uncheckedCast(_factory->findDeptByNo(deptno));
+ if(_currentDept != 0)
+ {
+ _currentMenu = deptMenu;
+ }
+ else
+ {
+ cout << "There is no department with deptno " << deptno << endl;
+ }
+ }
+ }
+ else if(command == "emp")
+ {
+ int empno;
+ cin >> empno;
+ if(checkCin(command))
+ {
+ _currentEmp = EmpPrx::uncheckedCast(_factory->findEmpByNo(empno));
+ if(_currentEmp != 0)
+ {
+ _currentMenu = empMenu;
+ }
+ else
+ {
+ cout << "There is no employee with empno " << empno << endl;
+ }
+ }
+ }
+ else if(command == "exit" || command == "quit")
+ {
+ checkEof(command);
+ break;
+ }
+ else if(command == "help")
+ {
+ checkEof(command);
+ help();
+ }
+ else if(command == "root")
+ {
+ checkEof(command);
+ _currentMenu = rootMenu;
+ }
+ else if(_currentMenu == rootMenu)
+ {
+ doRootMenu(command);
+ }
+ else if(_currentMenu == deptMenu)
+ {
+ doDeptMenu(command);
+ }
+ else if(_currentMenu == empMenu)
+ {
+ doEmpMenu(command);
+ }
+ else
+ {
+ assert(0);
+ }
+ }
+ catch(const SqlException& e)
+ {
+ cout << "Caught a SqlException: " << e.reason << endl;
+ }
+ catch(const IceUtil::Exception& e)
+ {
+ cout << "Caught an Ice exception: " << e << endl;
+ }
+ catch(const std::exception& e)
+ {
+ cout << "Caught a std::exception: " << e.what() << endl;
+ }
+ catch(...)
+ {
+ cout << "Caught an unknown exception" << endl;
+ }
}
while(cin.good());
@@ -285,38 +285,38 @@ HRClient::doRootMenu(const string& command) const
{
if(command == "create")
{
- checkEof(command);
- cout << "Please enter: deptno dname loc ==> ";
- int deptno;
- DeptDesc desc;
- cin >> deptno >> desc.dname >> desc.loc;
-
- desc.dname = unquote(desc.dname);
- desc.loc = unquote(desc.loc);
-
- if(checkCin("create parameters"))
- {
- _factory->createDept(deptno, desc);
- cout << "Created new department number " << deptno << endl;
- }
+ checkEof(command);
+ cout << "Please enter: deptno dname loc ==> ";
+ int deptno;
+ DeptDesc desc;
+ cin >> deptno >> desc.dname >> desc.loc;
+
+ desc.dname = unquote(desc.dname);
+ desc.loc = unquote(desc.loc);
+
+ if(checkCin("create parameters"))
+ {
+ _factory->createDept(deptno, desc);
+ cout << "Created new department number " << deptno << endl;
+ }
}
else if(command == "find")
{
- string name;
- cin >> name;
- if(checkCin(command))
- {
- printDepts(_factory->findByName(name));
- }
+ string name;
+ cin >> name;
+ if(checkCin(command))
+ {
+ printDepts(_factory->findByName(name));
+ }
}
else if(command == "list")
{
- checkEof(command);
- printDepts(_factory->findAll());
+ checkEof(command);
+ printDepts(_factory->findAll());
}
else
{
- invalidCommand(command);
+ invalidCommand(command);
}
}
@@ -325,84 +325,84 @@ HRClient::doDeptMenu(const string& command) const
{
if(command == "create")
{
- checkEof(command);
- cout << "Please enter: empno ename job mgr(empno) hiredate sal comm ==> ";
- int empno;
- int mgrEmpno;
- EmpDesc desc;
- cin >> empno >> desc.ename >> desc.job >> mgrEmpno >> desc.hiredate >> desc.sal >> desc.comm;
-
- desc.ename = unquote(desc.ename);
- desc.job = unquote(desc.job);
-
- if(mgrEmpno != 0)
- {
- desc.mgr = _factory->findEmpByNo(mgrEmpno);
- if(desc.mgr == 0)
- {
- cout << "Manager #" << mgrEmpno << " does not exist: clearing manager" << endl;
- }
- }
- desc.hiredate = unquote(desc.hiredate);
- desc.sal = unquote(desc.sal);
- desc.comm = unquote(desc.comm);
-
- desc.edept = _currentDept;
-
- if(checkCin("create parameters"))
- {
- _currentDept->createEmp(empno, desc);
- cout << "Created new employee number " << empno << endl;
- }
+ checkEof(command);
+ cout << "Please enter: empno ename job mgr(empno) hiredate sal comm ==> ";
+ int empno;
+ int mgrEmpno;
+ EmpDesc desc;
+ cin >> empno >> desc.ename >> desc.job >> mgrEmpno >> desc.hiredate >> desc.sal >> desc.comm;
+
+ desc.ename = unquote(desc.ename);
+ desc.job = unquote(desc.job);
+
+ if(mgrEmpno != 0)
+ {
+ desc.mgr = _factory->findEmpByNo(mgrEmpno);
+ if(desc.mgr == 0)
+ {
+ cout << "Manager #" << mgrEmpno << " does not exist: clearing manager" << endl;
+ }
+ }
+ desc.hiredate = unquote(desc.hiredate);
+ desc.sal = unquote(desc.sal);
+ desc.comm = unquote(desc.comm);
+
+ desc.edept = _currentDept;
+
+ if(checkCin("create parameters"))
+ {
+ _currentDept->createEmp(empno, desc);
+ cout << "Created new employee number " << empno << endl;
+ }
}
else if(command == "find")
{
- string name;
- cin >> name;
- if(checkCin(command))
- {
- printEmps(_currentDept->findByName(name));
- }
+ string name;
+ cin >> name;
+ if(checkCin(command))
+ {
+ printEmps(_currentDept->findByName(name));
+ }
}
else if(command == "list")
{
- checkEof(command);
- printEmps(_currentDept->findAll());
+ checkEof(command);
+ printEmps(_currentDept->findAll());
}
else if(command == "ping")
{
- checkEof(command);
- _currentDept->ice_ping();
- cout << "ice_ping: success!" << endl;
+ checkEof(command);
+ _currentDept->ice_ping();
+ cout << "ice_ping: success!" << endl;
}
else if(command == "remove")
{
- checkEof(command);
- _currentDept->remove();
+ checkEof(command);
+ _currentDept->remove();
}
else if(command == "show")
{
- checkEof(command);
- DeptDesc desc = _currentDept->getDesc();
- cout << "deptno: " << desc.deptno << endl;
- cout << "dname: " << quote(desc.dname) << endl;
- cout << "loc: " << quote(desc.loc) << endl;
+ checkEof(command);
+ DeptDesc desc = _currentDept->getDesc();
+ cout << "deptno: " << desc.deptno << endl;
+ cout << "dname: " << quote(desc.dname) << endl;
+ cout << "loc: " << quote(desc.loc) << endl;
}
else if(command == "update")
{
- string field;
- string newValue;
- cin >> field >> newValue;
- newValue = unquote(newValue);
-
- if(checkCin("update " + field))
- {
- _currentDept->updateField(field, newValue);
- }
+ string field;
+ string newValue;
+ cin >> field >> newValue;
+ newValue = unquote(newValue);
+
+ if(checkCin("update " + field))
+ {
+ _currentDept->updateField(field, newValue);
+ }
}
else
{
- invalidCommand(command);
+ invalidCommand(command);
}
}
@@ -411,80 +411,80 @@ HRClient::doEmpMenu(const string& command) const
{
if(command == "ping")
{
- checkEof(command);
- _currentEmp->ice_ping();
- cout << "ice_ping: success!" << endl;
+ checkEof(command);
+ _currentEmp->ice_ping();
+ cout << "ice_ping: success!" << endl;
}
else if(command == "remove")
{
- checkEof(command);
- _currentEmp->remove();
+ checkEof(command);
+ _currentEmp->remove();
}
else if(command == "show")
{
- checkEof(command);
- EmpDesc desc = _currentEmp->getDesc();
- cout << "empno: " << desc.empno << endl;
- cout << "ename: " << quote(desc.ename) << endl;
- cout << "job: " << quote(desc.job) << endl;
- cout << "mgr: ";
- if(desc.mgr == 0)
- {
- cout << "<null>" << endl;
- }
- else
- {
- cout << desc.mgr->getDesc().empno << endl;
- }
- cout << "hiredate: " << quote(desc.hiredate) << endl;
- cout << "sal: " << quote(desc.sal) << endl;
- cout << "comm: " << quote(desc.comm) << endl;
- cout << "dept: ";
- if(desc.edept == 0)
- {
- cout << "<null>" << endl;
- }
- else
- {
- cout << desc.edept->getDesc().deptno << endl;
- }
+ checkEof(command);
+ EmpDesc desc = _currentEmp->getDesc();
+ cout << "empno: " << desc.empno << endl;
+ cout << "ename: " << quote(desc.ename) << endl;
+ cout << "job: " << quote(desc.job) << endl;
+ cout << "mgr: ";
+ if(desc.mgr == 0)
+ {
+ cout << "<null>" << endl;
+ }
+ else
+ {
+ cout << desc.mgr->getDesc().empno << endl;
+ }
+ cout << "hiredate: " << quote(desc.hiredate) << endl;
+ cout << "sal: " << quote(desc.sal) << endl;
+ cout << "comm: " << quote(desc.comm) << endl;
+ cout << "dept: ";
+ if(desc.edept == 0)
+ {
+ cout << "<null>" << endl;
+ }
+ else
+ {
+ cout << desc.edept->getDesc().deptno << endl;
+ }
}
else if(command == "update")
{
- string field;
- cin >> field;
- if(field == "mgr")
- {
- int mgr;
- cin >> mgr;
- if(checkCin("update mgr"))
- {
- _currentEmp->updateMgr(mgr);
- }
- }
- else if(field == "dept")
- {
- int deptno;
- cin >> deptno;
- if(checkCin("update dept"))
- {
- _currentEmp->updateDept(deptno);
- }
- }
- else
- {
- string newValue;
- cin >> newValue;
- newValue = unquote(newValue);
- if(checkCin("update " + field))
- {
- _currentEmp->updateField(field, newValue);
- }
- }
+ string field;
+ cin >> field;
+ if(field == "mgr")
+ {
+ int mgr;
+ cin >> mgr;
+ if(checkCin("update mgr"))
+ {
+ _currentEmp->updateMgr(mgr);
+ }
+ }
+ else if(field == "dept")
+ {
+ int deptno;
+ cin >> deptno;
+ if(checkCin("update dept"))
+ {
+ _currentEmp->updateDept(deptno);
+ }
+ }
+ else
+ {
+ string newValue;
+ cin >> newValue;
+ newValue = unquote(newValue);
+ if(checkCin("update " + field))
+ {
+ _currentEmp->updateField(field, newValue);
+ }
+ }
}
else
{
- invalidCommand(command);
+ invalidCommand(command);
}
}
@@ -494,15 +494,15 @@ HRClient::printDepts(const DeptPrxSeq& depts) const
cout << "Deptno\t Dname\t Loc" << endl;
if(depts.size() == 0)
{
- cout << "<None found>" << endl;
+ cout << "<None found>" << endl;
}
else
{
- for(DeptPrxSeq::const_iterator p = depts.begin(); p != depts.end(); ++p)
- {
- HR::DeptDesc desc = (*p)->getDesc();
- cout << desc.deptno << "\t " << desc.dname << "\t " << desc.loc << endl;
- }
+ for(DeptPrxSeq::const_iterator p = depts.begin(); p != depts.end(); ++p)
+ {
+ HR::DeptDesc desc = (*p)->getDesc();
+ cout << desc.deptno << "\t " << desc.dname << "\t " << desc.loc << endl;
+ }
}
}
@@ -512,15 +512,15 @@ HRClient::printEmps(const EmpPrxSeq& emps) const
cout << "Empno\t Ename" << endl;
if(emps.size() == 0)
{
- cout << "<None found>" << endl;
+ cout << "<None found>" << endl;
}
else
{
- for(EmpPrxSeq::const_iterator p = emps.begin(); p != emps.end(); ++p)
- {
- HR::EmpDesc desc = (*p)->getDesc();
- cout << desc.empno << "\t " << desc.ename << endl;
- }
+ for(EmpPrxSeq::const_iterator p = emps.begin(); p != emps.end(); ++p)
+ {
+ HR::EmpDesc desc = (*p)->getDesc();
+ cout << desc.empno << "\t " << desc.ename << endl;
+ }
}
}
@@ -530,11 +530,11 @@ HRClient::quote(const string& str)
{
if(str == "")
{
- return "''";
+ return "''";
}
else
{
- return str;
+ return str;
}
}
@@ -544,10 +544,10 @@ HRClient::unquote(const string& str)
{
if(str == "''")
{
- return "";
+ return "";
}
else
{
- return str;
+ return str;
}
}
diff --git a/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc b/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc
index 862196b8718..35e27fc3749 100644
--- a/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc
+++ b/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc
@@ -38,7 +38,7 @@ class Notification : public Ice::ThreadNotification
public:
Notification(size_t index) :
- _index(index)
+ _index(index)
{
}
@@ -48,35 +48,35 @@ public:
virtual void stop()
{
- if(_current != 0 && _index < _current->size())
- {
+ if(_current != 0 && _index < _current->size())
+ {
#ifdef TRACE
- cerr << "Disconnecting from Oracle in thread " << IceUtil::ThreadControl().id() << endl;
+ cerr << "Disconnecting from Oracle in thread " << IceUtil::ThreadControl().id() << endl;
#endif
- EXEC SQL BEGIN DECLARE SECTION;
- sql_context ctx = (*_current)[_index];
- EXEC SQL END DECLARE SECTION;
-
- if(ctx != 0)
- {
- (*_current)[_index] = 0;
- EXEC SQL CONTEXT USE :ctx;
-
- sqlca sqlca;
- EXEC SQL ROLLBACK RELEASE;
- EXEC SQL CONTEXT FREE :ctx;
- }
-
- if(find_if(_current->begin(), _current->end(), bind2nd(not_equal_to<sql_context>(), static_cast<void*>(0)))
- == _current->end())
- {
+ EXEC SQL BEGIN DECLARE SECTION;
+ sql_context ctx = (*_current)[_index];
+ EXEC SQL END DECLARE SECTION;
+
+ if(ctx != 0)
+ {
+ (*_current)[_index] = 0;
+ EXEC SQL CONTEXT USE :ctx;
+
+ sqlca sqlca;
+ EXEC SQL ROLLBACK RELEASE;
+ EXEC SQL CONTEXT FREE :ctx;
+ }
+
+ if(find_if(_current->begin(), _current->end(), bind2nd(not_equal_to<sql_context>(), static_cast<void*>(0)))
+ == _current->end())
+ {
#ifdef TRACE
- cerr << "Deleting _current in thread " << IceUtil::ThreadControl().id() << endl;
+ cerr << "Deleting _current in thread " << IceUtil::ThreadControl().id() << endl;
#endif
- delete _current;
- _current = 0;
- }
- }
+ delete _current;
+ _current = 0;
+ }
+ }
}
private:
@@ -90,8 +90,8 @@ CurrentSqlContext::CurrentSqlContext(const string& connectInfo) :
_connectInfo(connectInfo)
{
{
- IceUtil::StaticMutex::Lock lock(IceUtil::globalMutex);
- _index = _currentIndex++;
+ IceUtil::StaticMutex::Lock lock(IceUtil::globalMutex);
+ _index = _currentIndex++;
}
_hook = new Notification(_index);
}
@@ -106,11 +106,11 @@ CurrentSqlContext::operator sql_context() const
{
if(_current == 0)
{
- _current = new std::vector<sql_context>(_index + 1);
+ _current = new std::vector<sql_context>(_index + 1);
}
if(_index >= _current->size())
{
- _current->resize(_index + 1);
+ _current->resize(_index + 1);
}
EXEC SQL BEGIN DECLARE SECTION;
@@ -123,18 +123,18 @@ CurrentSqlContext::operator sql_context() const
if(ctx == 0)
{
#ifdef TRACE
- cerr << "Connecting to Oracle in thread " << IceUtil::ThreadControl().id() << endl;
+ cerr << "Connecting to Oracle in thread " << IceUtil::ThreadControl().id() << endl;
#endif
- //
- // Allocate and connect
- //
- sqlca sqlca;
-
- EXEC SQL CONTEXT ALLOCATE :ctx;
- EXEC SQL CONTEXT USE :ctx;
- EXEC SQL CONNECT :connectInfo;
-
- (*_current)[_index] = ctx;
+ //
+ // Allocate and connect
+ //
+ sqlca sqlca;
+
+ EXEC SQL CONTEXT ALLOCATE :ctx;
+ EXEC SQL CONTEXT USE :ctx;
+ EXEC SQL CONNECT :connectInfo;
+
+ (*_current)[_index] = ctx;
}
return ctx;
diff --git a/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc b/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc
index 1d72b58d0db..e6bcdd56145 100644
--- a/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc
+++ b/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc
@@ -62,13 +62,13 @@ DeptFactoryI::findAll(const Ice::Current& current)
for(;;)
{
- EXEC SQL FETCH depCursor1 INTO :deptno;
+ EXEC SQL FETCH depCursor1 INTO :deptno;
- Ice::Identity deptId;
- deptId.category = _deptCategory;
- deptId.name = encodeName(deptno);
+ Ice::Identity deptId;
+ deptId.category = _deptCategory;
+ deptId.name = encodeName(deptno);
- result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
+ result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
}
EXEC SQL CLOSE depCursor1;
@@ -94,13 +94,13 @@ DeptFactoryI::findByName(const string& name, const Ice::Current& current)
for(;;)
{
- EXEC SQL FETCH depCursor2 INTO :deptno;
+ EXEC SQL FETCH depCursor2 INTO :deptno;
- Ice::Identity deptId;
- deptId.category = _deptCategory;
- deptId.name = encodeName(deptno);
+ Ice::Identity deptId;
+ deptId.category = _deptCategory;
+ deptId.name = encodeName(deptno);
- result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
+ result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)));
}
EXEC SQL CLOSE depCursor2;
@@ -121,11 +121,11 @@ DeptFactoryI::findDeptByNo(int deptno, const Ice::Current& current)
//
try
{
- prx->ice_ping();
+ prx->ice_ping();
}
catch(const Ice::ObjectNotExistException&)
{
- return 0;
+ return 0;
}
return HR::DeptPrx::uncheckedCast(prx);
@@ -144,11 +144,11 @@ DeptFactoryI::findEmpByNo(int empno, const Ice::Current& current)
//
try
{
- prx->ice_ping();
+ prx->ice_ping();
}
catch(const Ice::ObjectNotExistException&)
{
- return 0;
+ return 0;
}
return HR::EmpPrx::uncheckedCast(prx);
diff --git a/cpp/demo/Database/Oracle/proc/DeptI.pc b/cpp/demo/Database/Oracle/proc/DeptI.pc
index 7a9d2c63f1c..203ab110a5a 100644
--- a/cpp/demo/Database/Oracle/proc/DeptI.pc
+++ b/cpp/demo/Database/Oracle/proc/DeptI.pc
@@ -38,7 +38,7 @@ DeptI::ice_ping(const Ice::Current& current) const
if(count == 0)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
}
@@ -64,19 +64,19 @@ DeptI::createEmp(int key, const HR::EmpDesc& desc, const Ice::Current& current)
if(desc.mgr == 0)
{
- //
- // mgr is NULL
- //
- mgrInd = -1;
+ //
+ // mgr is NULL
+ //
+ mgrInd = -1;
}
else
{
- mgr = decodeName(desc.mgr->ice_getIdentity().name);
+ mgr = decodeName(desc.mgr->ice_getIdentity().name);
}
EXEC SQL CONTEXT USE :ctx;
EXEC SQL INSERT INTO EMP(empno, ename, job, mgr, hiredate, sal, comm, deptno)
- VALUES(:empno, :ename, :job, :mgr:mgrInd, :hiredate, :sal, :comm, :deptno);
+ VALUES(:empno, :ename, :job, :mgr:mgrInd, :hiredate, :sal, :comm, :deptno);
EXEC SQL COMMIT;
Ice::Identity empId;
@@ -107,10 +107,10 @@ DeptI::getDesc(const Ice::Current& current)
if(dnameInd >= 0)
{
- //
- // Should log a warning if > 0!
- //
- result.dname = dname;
+ //
+ // Should log a warning if > 0!
+ //
+ result.dname = dname;
}
//
// else null
@@ -118,10 +118,10 @@ DeptI::getDesc(const Ice::Current& current)
if(locInd >= 0)
{
- //
- // Should log a warning if > 0!
- //
- result.loc = loc;
+ //
+ // Should log a warning if > 0!
+ //
+ result.loc = loc;
}
//
// else null
@@ -134,7 +134,7 @@ void
DeptI::updateField(const string& field, const string& newValue, const Ice::Current& current)
{
const string updateDeptStr =
- "UPDATE DEPT SET " + field + " = '" + newValue + "' WHERE DEPTNO = " + current.id.name;
+ "UPDATE DEPT SET " + field + " = '" + newValue + "' WHERE DEPTNO = " + current.id.name;
sqlca sqlca;
EXEC SQL BEGIN DECLARE SECTION;
@@ -185,13 +185,13 @@ DeptI::findAll(const Ice::Current& current)
for(;;)
{
- EXEC SQL FETCH empCursor1 INTO :empno;
+ EXEC SQL FETCH empCursor1 INTO :empno;
- Ice::Identity empId;
- empId.category = _empCategory;
- empId.name = encodeName(empno);
+ Ice::Identity empId;
+ empId.category = _empCategory;
+ empId.name = encodeName(empno);
- result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
+ result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
}
EXEC SQL CLOSE empCursor1;
@@ -218,13 +218,13 @@ DeptI::findByName(const string& name, const Ice::Current& current)
for(;;)
{
- EXEC SQL FETCH empCursor2 INTO :empno;
+ EXEC SQL FETCH empCursor2 INTO :empno;
- Ice::Identity empId;
- empId.category = _empCategory;
- empId.name = encodeName(empno);
+ Ice::Identity empId;
+ empId.category = _empCategory;
+ empId.name = encodeName(empno);
- result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
+ result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId)));
}
EXEC SQL CLOSE empCursor2;
diff --git a/cpp/demo/Database/Oracle/proc/EmpI.pc b/cpp/demo/Database/Oracle/proc/EmpI.pc
index e74887a939d..5506d0d0d84 100644
--- a/cpp/demo/Database/Oracle/proc/EmpI.pc
+++ b/cpp/demo/Database/Oracle/proc/EmpI.pc
@@ -17,7 +17,7 @@ EXEC SQL WHENEVER NOT FOUND DO handleNotFound(current, ctx);
using namespace std;
EmpI::EmpI(const CurrentSqlContext& currentCtx,
- const string& empCategory, const string& deptCategory) :
+ const string& empCategory, const string& deptCategory) :
_currentCtx(currentCtx),
_empCategory(empCategory),
_deptCategory(deptCategory)
@@ -40,7 +40,7 @@ EmpI::ice_ping(const Ice::Current& current) const
if(count == 0)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
}
@@ -69,7 +69,7 @@ EmpI::getDesc(const Ice::Current& current)
EXEC SQL CONTEXT USE :ctx;
EXEC SQL SELECT ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO
- INTO :ename:enameInd, :job:jobInd, :mgr:mgrInd, :hiredate:hiredateInd, :sal:salInd, :comm:commInd,
+ INTO :ename:enameInd, :job:jobInd, :mgr:mgrInd, :hiredate:hiredateInd, :sal:salInd, :comm:commInd,
:deptno:deptnoInd
FROM EMP WHERE EMPNO = :empno;
EXEC SQL COMMIT;
@@ -79,37 +79,37 @@ EmpI::getDesc(const Ice::Current& current)
if(enameInd >= 0)
{
- result.ename = ename;
+ result.ename = ename;
}
if(jobInd >= 0)
{
- result.job = job;
+ result.job = job;
}
if(mgrInd >= 0)
{
- Ice::Identity mgrId;
- mgrId.name = encodeName(mgr);
- mgrId.category = _empCategory;
- result.mgr = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(mgrId));
+ Ice::Identity mgrId;
+ mgrId.name = encodeName(mgr);
+ mgrId.category = _empCategory;
+ result.mgr = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(mgrId));
}
if(hiredateInd >= 0)
{
- result.hiredate = hiredate;
+ result.hiredate = hiredate;
}
if(salInd >= 0)
{
- result.sal = sal;
+ result.sal = sal;
}
if(commInd >= 0)
{
- result.comm = comm;
+ result.comm = comm;
}
if(deptnoInd >= 0)
{
- Ice::Identity deptId;
- deptId.name = encodeName(deptno);
- deptId.category = _deptCategory;
- result.edept = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId));
+ Ice::Identity deptId;
+ deptId.name = encodeName(deptno);
+ deptId.category = _deptCategory;
+ result.edept = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId));
}
return result;
}
@@ -118,7 +118,7 @@ void
EmpI::updateField(const string& field, const string& newValue, const Ice::Current& current)
{
const string updateEmpStr =
- "UPDATE EMP SET " + field + " = '" + newValue + "' WHERE EMPNO = " + current.id.name;
+ "UPDATE EMP SET " + field + " = '" + newValue + "' WHERE EMPNO = " + current.id.name;
sqlca sqlca;
EXEC SQL BEGIN DECLARE SECTION;
diff --git a/cpp/demo/Database/Oracle/proc/Server.pc b/cpp/demo/Database/Oracle/proc/Server.pc
index a0a0d80e083..bc325649259 100644
--- a/cpp/demo/Database/Oracle/proc/Server.pc
+++ b/cpp/demo/Database/Oracle/proc/Server.pc
@@ -34,18 +34,18 @@ class DefaultServantLocator : public Ice::ServantLocator
public:
DefaultServantLocator(const Ice::ObjectPtr& servant) :
- _servant(servant)
+ _servant(servant)
{
}
virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&)
{
- return _servant;
+ return _servant;
}
virtual void finished(const Ice::Current& curr,
- const Ice::ObjectPtr& servant,
- const Ice::LocalObjectPtr& cookie)
+ const Ice::ObjectPtr& servant,
+ const Ice::LocalObjectPtr& cookie)
{
}
@@ -70,7 +70,7 @@ main(int argc, char* argv[])
initData.properties->load("config.server");
const string connectInfo = initData.properties
- ->getPropertyWithDefault("Oracle.ConnectInfo", "scott/tiger");
+ ->getPropertyWithDefault("Oracle.ConnectInfo", "scott/tiger");
CurrentSqlContext currentCtx(connectInfo);
initData.threadHook = currentCtx.getHook();
@@ -92,12 +92,12 @@ HRServer::run(int argc, char* argv[])
const string deptCategory = "Dept";
adapter->addServantLocator(new DefaultServantLocator(new EmpI(_currentCtx, empCategory, deptCategory)),
- empCategory);
+ empCategory);
adapter->addServantLocator(new DefaultServantLocator(new DeptI(_currentCtx, empCategory)), deptCategory);
adapter->add(new DeptFactoryI(_currentCtx, deptCategory, empCategory),
- communicator()->stringToIdentity("DeptFactory"));
+ communicator()->stringToIdentity("DeptFactory"));
adapter->activate();
communicator()->waitForShutdown();
diff --git a/cpp/demo/Database/Oracle/proc/Util.pc b/cpp/demo/Database/Oracle/proc/Util.pc
index 9e96d81d88a..6a3ab69c03d 100644
--- a/cpp/demo/Database/Oracle/proc/Util.pc
+++ b/cpp/demo/Database/Oracle/proc/Util.pc
@@ -57,8 +57,8 @@ decodeName(const string& name)
is >> result;
if(!is || !is.eof())
{
- cerr << "Unable to decode " << name << endl;
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ cerr << "Unable to decode " << name << endl;
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
return result;
}
diff --git a/cpp/demo/Freeze/backup/Client.cpp b/cpp/demo/Freeze/backup/Client.cpp
index 89008fa26b2..4630a15858f 100644
--- a/cpp/demo/Freeze/backup/Client.cpp
+++ b/cpp/demo/Freeze/backup/Client.cpp
@@ -38,51 +38,51 @@ main(int argc, char* argv[])
const int size = 10000;
if(m.size() == 0)
- {
- cout << "********* Creating new map ***********" << endl;
- Freeze::TransactionHolder txHolder(connection);
-
- IceUtil::Time time = IceUtil::Time::now();
- IceUtil::Int64 ms = time.toMilliSeconds();
-
- for(int i = 0; i < size; ++i)
- {
- m.insert(IntLongMap::value_type(i, ms));
- }
- txHolder.commit();
+ {
+ cout << "********* Creating new map ***********" << endl;
+ Freeze::TransactionHolder txHolder(connection);
+
+ IceUtil::Time time = IceUtil::Time::now();
+ IceUtil::Int64 ms = time.toMilliSeconds();
+
+ for(int i = 0; i < size; ++i)
+ {
+ m.insert(IntLongMap::value_type(i, ms));
+ }
+ txHolder.commit();
}
cout << "Updating map" << endl;
for(;;)
{
- int count = 0;
-
- Freeze::TransactionHolder txHolder(connection);
- IceUtil::Time time = IceUtil::Time::now();
- IceUtil::Int64 ms = time.toMilliSeconds();
-
- IntLongMap::iterator p = m.begin();
- IceUtil::Int64 oldMs = p->second;
- do
- {
- if(p->second != oldMs)
- {
- cerr << "old time (ms) == " << oldMs << endl;
- cerr << "current current (ms) == " << p->second << endl;
- }
-
- test(p->second == oldMs);
- p.set(ms);
- count++;
- } while(++p != m.end());
-
- cout << "Read " << IceUtil::Time::milliSeconds(oldMs).toDateTime() << " in all records;"
- << " updating with " << time.toDateTime() << " ... " << flush;
-
- txHolder.commit();
- cout << "done" << endl;
- test(count == size);
+ int count = 0;
+
+ Freeze::TransactionHolder txHolder(connection);
+ IceUtil::Time time = IceUtil::Time::now();
+ IceUtil::Int64 ms = time.toMilliSeconds();
+
+ IntLongMap::iterator p = m.begin();
+ IceUtil::Int64 oldMs = p->second;
+ do
+ {
+ if(p->second != oldMs)
+ {
+ cerr << "old time (ms) == " << oldMs << endl;
+ cerr << "current current (ms) == " << p->second << endl;
+ }
+
+ test(p->second == oldMs);
+ p.set(ms);
+ count++;
+ } while(++p != m.end());
+
+ cout << "Read " << IceUtil::Time::milliSeconds(oldMs).toDateTime() << " in all records;"
+ << " updating with " << time.toDateTime() << " ... " << flush;
+
+ txHolder.commit();
+ cout << "done" << endl;
+ test(count == size);
}
connection->close();
diff --git a/cpp/demo/Freeze/bench/Client.cpp b/cpp/demo/Freeze/bench/Client.cpp
index 07b95e14f38..67f71de2a2e 100644
--- a/cpp/demo/Freeze/bench/Client.cpp
+++ b/cpp/demo/Freeze/bench/Client.cpp
@@ -36,20 +36,20 @@ public:
void
start()
{
- _stopped = false;
- _start = IceUtil::Time::now();
+ _stopped = false;
+ _start = IceUtil::Time::now();
}
IceUtil::Time
stop()
{
- if(!_stopped)
- {
- _stopped = true;
- _stop = IceUtil::Time::now();
- }
+ if(!_stopped)
+ {
+ _stopped = true;
+ _stop = IceUtil::Time::now();
+ }
- return _stop - _start;
+ return _stop - _start;
}
private:
@@ -75,23 +75,23 @@ class RandomGenerator : public Generator
public:
RandomGenerator(int seed, int max) :
- _max(max)
+ _max(max)
{
- srand(seed);
+ srand(seed);
}
virtual int
next()
{
- return rand() % _max;
+ return rand() % _max;
}
virtual string
toString()
{
- ostringstream os;
- os << "random(" << _max << ")";
- return os.str();
+ ostringstream os;
+ os << "random(" << _max << ")";
+ return os.str();
}
private:
@@ -104,30 +104,30 @@ class SequentialGenerator : public Generator
public:
SequentialGenerator(int min, int max) :
- _min(min),
- _max(max),
- _current(0)
+ _min(min),
+ _max(max),
+ _current(0)
{
}
virtual int
next()
{
- int n = _current;
- ++_current;
- if(_current > _max)
- {
- _current = _min;
- }
- return n;
+ int n = _current;
+ ++_current;
+ if(_current > _max)
+ {
+ _current = _min;
+ }
+ return n;
}
virtual string
toString()
{
- ostringstream os;
- os << ((_max - _min)+1);
- return os.str();
+ ostringstream os;
+ os << ((_max - _min)+1);
+ return os.str();
}
private:
@@ -157,68 +157,68 @@ private:
void IntIntMapIndexTest(IndexedIntIntMap&);
template<class T> void IntIntMapTest(const string& mapName, T* = 0)
{
- T m(_connection, mapName);
- //
- // Populate the database.
- //
- int i;
- _watch.start();
- {
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
+ T m(_connection, mapName);
+ //
+ // Populate the database.
+ //
+ int i;
+ _watch.start();
+ {
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
#if defined(__BCPLUSPLUS__) || (defined(_MSC_VER) && (_MSC_VER < 1310))
- m.put(T::value_type(i, i));
+ m.put(T::value_type(i, i));
#else
- m.put(typename T::value_type(i, i));
+ m.put(typename T::value_type(i, i));
#endif
- }
- txHolder.commit();
- }
- IceUtil::Time total = _watch.stop();
- IceUtil::Time perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
-
- //
- // Read each record.
- //
- _watch.start();
- for(i = 0; i < _repetitions; ++i)
- {
- typename T::iterator p = m.find(i);
- test(p != m.end());
- test(p->second == i);
- }
- total = _watch.stop();
- perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl;
- cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
-
- //
- // Optional index sub-test
- //
- IntIntMapIndexTest(m);
-
- //
- // Remove each record.
- //
- _watch.start();
- {
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
- m.erase(i);
- }
- txHolder.commit();
- }
- total = _watch.stop();
- perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
+ }
+ txHolder.commit();
+ }
+ IceUtil::Time total = _watch.stop();
+ IceUtil::Time perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
+
+ //
+ // Read each record.
+ //
+ _watch.start();
+ for(i = 0; i < _repetitions; ++i)
+ {
+ typename T::iterator p = m.find(i);
+ test(p != m.end());
+ test(p->second == i);
+ }
+ total = _watch.stop();
+ perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
+
+ //
+ // Optional index sub-test
+ //
+ IntIntMapIndexTest(m);
+
+ //
+ // Remove each record.
+ //
+ _watch.start();
+ {
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
+ m.erase(i);
+ }
+ txHolder.commit();
+ }
+ total = _watch.stop();
+ perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
}
@@ -227,22 +227,22 @@ private:
void generatedReadWithIndex(IndexedIntIntMap&, int, const GeneratorPtr&);
template<class T> void generatedRead(T& m, int reads , const GeneratorPtr& gen)
{
- _watch.start();
- for(int i = 0; i < reads; ++i)
- {
- int key = gen->next();
- typename T::iterator p = m.find(key);
- test(p != m.end());
- test(p->second == key);
- }
- IceUtil::Time total = _watch.stop();
- IceUtil::Time perRecord = total / reads;
-
- cout << "\ttime for " << reads << " reads of " << gen->toString() << " records: " << total * 1000 << "ms"
- << endl;
- cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
-
- generatedReadWithIndex(m, reads, gen);
+ _watch.start();
+ for(int i = 0; i < reads; ++i)
+ {
+ int key = gen->next();
+ typename T::iterator p = m.find(key);
+ test(p != m.end());
+ test(p->second == key);
+ }
+ IceUtil::Time total = _watch.stop();
+ IceUtil::Time perRecord = total / reads;
+
+ cout << "\ttime for " << reads << " reads of " << gen->toString() << " records: " << total * 1000 << "ms"
+ << endl;
+ cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
+
+ generatedReadWithIndex(m, reads, gen);
}
@@ -251,81 +251,81 @@ private:
void Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map&);
template<class T> void Struct1Struct2MapTest(const string& mapName, T* = 0)
{
- T m(_connection, mapName);
-
- //
- // Populate the database.
- //
- Struct1 s1;
- Struct2 s2;
- int i;
- _watch.start();
- {
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- ostringstream os;
- os << i;
- s2.s = os.str();
- s2.s1 = s1;
+ T m(_connection, mapName);
+
+ //
+ // Populate the database.
+ //
+ Struct1 s1;
+ Struct2 s2;
+ int i;
+ _watch.start();
+ {
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ ostringstream os;
+ os << i;
+ s2.s = os.str();
+ s2.s1 = s1;
#if defined(__BCPLUSPLUS__) || (defined(_MSC_VER) && (_MSC_VER < 1310))
- m.put(T::value_type(s1, s2));
+ m.put(T::value_type(s1, s2));
#else
- m.put(typename T::value_type(s1, s2));
+ m.put(typename T::value_type(s1, s2));
#endif
- }
- txHolder.commit();
- }
- IceUtil::Time total = _watch.stop();
- IceUtil::Time perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
-
- //
- // Read each record.
- //
- _watch.start();
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- typename T::iterator p = m.find(s1);
- test(p != m.end());
- ostringstream os;
- os << i;
- test(p->second.s == os.str());
- }
- total = _watch.stop();
- perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl;
- cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
-
- //
- // Optional index test
- //
- Struct1Struct2MapIndexTest(m);
-
- //
- // Remove each record.
- //
- _watch.start();
- {
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- m.erase(s1);
- }
- txHolder.commit();
- }
- total = _watch.stop();
- perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
+ }
+ txHolder.commit();
+ }
+ IceUtil::Time total = _watch.stop();
+ IceUtil::Time perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
+
+ //
+ // Read each record.
+ //
+ _watch.start();
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ typename T::iterator p = m.find(s1);
+ test(p != m.end());
+ ostringstream os;
+ os << i;
+ test(p->second.s == os.str());
+ }
+ total = _watch.stop();
+ perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
+
+ //
+ // Optional index test
+ //
+ Struct1Struct2MapIndexTest(m);
+
+ //
+ // Remove each record.
+ //
+ _watch.start();
+ {
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ m.erase(s1);
+ }
+ txHolder.commit();
+ }
+ total = _watch.stop();
+ perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
}
@@ -334,80 +334,80 @@ private:
void Struct1Class1MapIndexTest(IndexedStruct1Class1Map&);
template<class T> void Struct1Class1MapTest(const string& mapName, T* = 0)
{
- T m(_connection, mapName);
-
- //
- // Populate the database.
- //
- Struct1 s1;
- Class1Ptr c1 = new Class1();
- int i;
- _watch.start();
- {
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- ostringstream os;
- os << i;
- c1->s = os.str();
+ T m(_connection, mapName);
+
+ //
+ // Populate the database.
+ //
+ Struct1 s1;
+ Class1Ptr c1 = new Class1();
+ int i;
+ _watch.start();
+ {
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ ostringstream os;
+ os << i;
+ c1->s = os.str();
#if defined(__BCPLUSPLUS__) || (defined(_MSC_VER) && (_MSC_VER < 1310))
- m.put(T::value_type(s1, c1));
+ m.put(T::value_type(s1, c1));
#else
- m.put(typename T::value_type(s1, c1));
+ m.put(typename T::value_type(s1, c1));
#endif
- }
- txHolder.commit();
- }
- IceUtil::Time total = _watch.stop();
- IceUtil::Time perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
-
- //
- // Read each record.
- //
- _watch.start();
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- typename T::iterator p = m.find(s1);
- test(p != m.end());
- ostringstream os;
- os << i;
- test(p->second->s == os.str());
- }
- total = _watch.stop();
- perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl;
- cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
-
- //
- // Optional index test
- //
-
- Struct1Class1MapIndexTest(m);
-
- //
- // Remove each record.
- //
- _watch.start();
- {
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- m.erase(s1);
- }
- txHolder.commit();
- }
- total = _watch.stop();
- perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
+ }
+ txHolder.commit();
+ }
+ IceUtil::Time total = _watch.stop();
+ IceUtil::Time perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
+
+ //
+ // Read each record.
+ //
+ _watch.start();
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ typename T::iterator p = m.find(s1);
+ test(p != m.end());
+ ostringstream os;
+ os << i;
+ test(p->second->s == os.str());
+ }
+ total = _watch.stop();
+ perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl;
+
+ //
+ // Optional index test
+ //
+
+ Struct1Class1MapIndexTest(m);
+
+ //
+ // Remove each record.
+ //
+ _watch.start();
+ {
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ m.erase(s1);
+ }
+ txHolder.commit();
+ }
+ total = _watch.stop();
+ perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
}
void IntIntMapReadIndexTest(IntIntMap&)
@@ -415,62 +415,62 @@ private:
void IntIntMapReadIndexTest(IndexedIntIntMap&);
template<class T> void IntIntMapReadTest(const string& mapName, T* = 0)
{
- T m(_connection, mapName);
-
- //
- // Populate the database.
- //
- int i;
- _watch.start();
- {
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
+ T m(_connection, mapName);
+
+ //
+ // Populate the database.
+ //
+ int i;
+ _watch.start();
+ {
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
#if defined(__BCPLUSPLUS__) || (defined(_MSC_VER) && (_MSC_VER < 1310))
- m.put(T::value_type(i, i));
+ m.put(T::value_type(i, i));
#else
- m.put(typename T::value_type(i, i));
+ m.put(typename T::value_type(i, i));
#endif
- }
- txHolder.commit();
- }
- IceUtil::Time total = _watch.stop();
- IceUtil::Time perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
-
- //
- // Do some read tests.
- //
- generatedRead(m, _repetitions, new SequentialGenerator(1000, 1000));
- generatedRead(m, _repetitions, new SequentialGenerator(2000, 2009));
- generatedRead(m, _repetitions, new SequentialGenerator(3000, 3099));
- generatedRead(m, _repetitions, new SequentialGenerator(4000, 4999));
-
- //
- // Do a random read test.
- //
- generatedRead(m, _repetitions, new RandomGenerator(0, 10000));
-
- //
- // Remove each record.
- //
- /*
- * For this test I don't want to remove the records because I
- * want to examine the cache stats for the database.
- *
- _watch.start();
- for(i = 0; i < _repetitions; ++i)
- {
- m.erase(i);
- }
- total = _watch.stop();
- perRecord = total / _repetitions;
-
- cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
- cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
- */
+ }
+ txHolder.commit();
+ }
+ IceUtil::Time total = _watch.stop();
+ IceUtil::Time perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl;
+
+ //
+ // Do some read tests.
+ //
+ generatedRead(m, _repetitions, new SequentialGenerator(1000, 1000));
+ generatedRead(m, _repetitions, new SequentialGenerator(2000, 2009));
+ generatedRead(m, _repetitions, new SequentialGenerator(3000, 3099));
+ generatedRead(m, _repetitions, new SequentialGenerator(4000, 4999));
+
+ //
+ // Do a random read test.
+ //
+ generatedRead(m, _repetitions, new RandomGenerator(0, 10000));
+
+ //
+ // Remove each record.
+ //
+ /*
+ * For this test I don't want to remove the records because I
+ * want to examine the cache stats for the database.
+ *
+ _watch.start();
+ for(i = 0; i < _repetitions; ++i)
+ {
+ m.erase(i);
+ }
+ total = _watch.stop();
+ perRecord = total / _repetitions;
+
+ cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl;
+ cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl;
+ */
}
@@ -497,15 +497,15 @@ TestApp::IntIntMapIndexTest(IndexedIntIntMap& m)
_watch.start();
for(int i = 0; i < _repetitions; ++i)
{
- IndexedIntIntMap::iterator p = m.findByValue(i);
- test(p != m.end());
- test(p->second == i);
+ IndexedIntIntMap::iterator p = m.findByValue(i);
+ test(p != m.end());
+ test(p->second == i);
}
IceUtil::Time total = _watch.stop();
IceUtil::Time perRecord = total / _repetitions;
cout << "\ttime for " << _repetitions << " reverse (indexed) reads: " << total * 1000 << "ms"
- << endl;
+ << endl;
cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl;
}
@@ -515,16 +515,16 @@ TestApp::generatedReadWithIndex(IndexedIntIntMap& m, int reads, const GeneratorP
_watch.start();
for(int i = 0; i < reads; ++i)
{
- int value = gen->next();
- IndexedIntIntMap::iterator p = m.findByValue(value);
- test(p != m.end());
- test(p->second == value);
+ int value = gen->next();
+ IndexedIntIntMap::iterator p = m.findByValue(value);
+ test(p != m.end());
+ test(p->second == value);
}
IceUtil::Time total = _watch.stop();
IceUtil::Time perRecord = total / reads;
cout << "\ttime for " << reads << " reverse (indexed) reads of " << gen->toString() << " records: "
- << total * 1000 << "ms" << endl;
+ << total * 1000 << "ms" << endl;
cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl;
}
@@ -536,23 +536,23 @@ TestApp::Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map& m)
_watch.start();
for(i = 0; i < _repetitions; ++i)
{
- ostringstream os;
- os << i;
+ ostringstream os;
+ os << i;
- IndexedStruct1Struct2Map::iterator p = m.findByS(os.str());
- test(p != m.end());
- test(p->first.l == i);
- test(p->second.s1.l == i);
+ IndexedStruct1Struct2Map::iterator p = m.findByS(os.str());
+ test(p != m.end());
+ test(p->first.l == i);
+ test(p->second.s1.l == i);
}
for(i = 0; i < _repetitions; ++i)
{
- Struct1 s1;
- s1.l = i;
- IndexedStruct1Struct2Map::iterator p = m.findByS1(s1);
- test(p != m.end());
- test(p->first.l == i);
- test(p->second.s1.l == i);
+ Struct1 s1;
+ s1.l = i;
+ IndexedStruct1Struct2Map::iterator p = m.findByS1(s1);
+ test(p != m.end());
+ test(p->first.l == i);
+ test(p->second.s1.l == i);
}
IceUtil::Time total = _watch.stop();
@@ -571,12 +571,12 @@ TestApp::Struct1Class1MapIndexTest(IndexedStruct1Class1Map& m)
_watch.start();
for(int i = 0; i < _repetitions; ++i)
{
- ostringstream os;
- os << i;
+ ostringstream os;
+ os << i;
- IndexedStruct1Class1Map::iterator p = m.findByS(os.str());
- test(p != m.end());
- test(p->first.l == i);
+ IndexedStruct1Class1Map::iterator p = m.findByS(os.str());
+ test(p != m.end());
+ test(p->first.l == i);
}
IceUtil::Time total = _watch.stop();
IceUtil::Time perRecord = total / _repetitions;
@@ -603,25 +603,25 @@ TestApp::Struct1ObjectMapTest()
int i;
_watch.start();
{
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- Ice::ObjectPtr o;
- if((i % 2) == 0)
- {
- o = c2;
- }
- else
- {
- o = c1;
- }
- ostringstream os;
- os << i;
- c1->s = os.str();
- m.put(Struct1ObjectMap::value_type(s1, o));
- }
- txHolder.commit();
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ Ice::ObjectPtr o;
+ if((i % 2) == 0)
+ {
+ o = c2;
+ }
+ else
+ {
+ o = c1;
+ }
+ ostringstream os;
+ os << i;
+ c1->s = os.str();
+ m.put(Struct1ObjectMap::value_type(s1, o));
+ }
+ txHolder.commit();
}
IceUtil::Time total = _watch.stop();
IceUtil::Time perRecord = total / _repetitions;
@@ -635,27 +635,27 @@ TestApp::Struct1ObjectMapTest()
_watch.start();
for(i = 0; i < _repetitions; ++i)
{
- s1.l = i;
- Struct1ObjectMap::iterator p = m.find(s1);
- test(p != m.end());
- Ice::ObjectPtr o = p->second;
- Class1Ptr nc1;
- if((i % 2) == 0)
- {
- Class2Ptr nc2 = Class2Ptr::dynamicCast(o);
- test(nc2);
-
- test(nc2->rec == nc2);
- nc1 = Class1Ptr::dynamicCast(nc2->obj);
- }
- else
- {
- nc1 = Class1Ptr::dynamicCast(o);
- }
- test(nc1);
- ostringstream os;
- os << i;
- test(nc1->s == os.str());
+ s1.l = i;
+ Struct1ObjectMap::iterator p = m.find(s1);
+ test(p != m.end());
+ Ice::ObjectPtr o = p->second;
+ Class1Ptr nc1;
+ if((i % 2) == 0)
+ {
+ Class2Ptr nc2 = Class2Ptr::dynamicCast(o);
+ test(nc2);
+
+ test(nc2->rec == nc2);
+ nc1 = Class1Ptr::dynamicCast(nc2->obj);
+ }
+ else
+ {
+ nc1 = Class1Ptr::dynamicCast(o);
+ }
+ test(nc1);
+ ostringstream os;
+ os << i;
+ test(nc1->s == os.str());
}
total = _watch.stop();
perRecord = total / _repetitions;
@@ -668,13 +668,13 @@ TestApp::Struct1ObjectMapTest()
//
_watch.start();
{
- Freeze::TransactionHolder txHolder(_connection);
- for(i = 0; i < _repetitions; ++i)
- {
- s1.l = i;
- m.erase(s1);
- }
- txHolder.commit();
+ Freeze::TransactionHolder txHolder(_connection);
+ for(i = 0; i < _repetitions; ++i)
+ {
+ s1.l = i;
+ m.erase(s1);
+ }
+ txHolder.commit();
}
total = _watch.stop();
perRecord = total / _repetitions;
@@ -690,15 +690,15 @@ public:
Ice::ObjectPtr
create(const string& type)
{
- if(type == "::Class1")
- {
- return new Class1();
- }
- else if(type == "::Class2")
- {
- return new Class2();
- }
- return 0;
+ if(type == "::Class1")
+ {
+ return new Class1();
+ }
+ else if(type == "::Class2")
+ {
+ return new Class2();
+ }
+ return 0;
}
void
@@ -709,8 +709,8 @@ public:
void
install(const Ice::CommunicatorPtr& communicator)
{
- communicator->addObjectFactory(this, "::Class1");
- communicator->addObjectFactory(this, "::Class2");
+ communicator->addObjectFactory(this, "::Class1");
+ communicator->addObjectFactory(this, "::Class2");
}
};
typedef IceUtil::Handle<MyFactory> MyFactoryPtr;
@@ -729,8 +729,8 @@ TestApp::run(int argc, char* argv[])
cout << "IntIntMap" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- IntIntMap* dummy = 0;
- IntIntMapTest("IntIntMap", dummy);
+ IntIntMap* dummy = 0;
+ IntIntMapTest("IntIntMap", dummy);
}
#else
IntIntMapTest<IntIntMap>("IntIntMap");
@@ -739,8 +739,8 @@ TestApp::run(int argc, char* argv[])
cout << "IntIntMap with index" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- IndexedIntIntMap* dummy = 0;
- IntIntMapTest("IndexedIntIntMap", dummy);
+ IndexedIntIntMap* dummy = 0;
+ IntIntMapTest("IndexedIntIntMap", dummy);
}
#else
IntIntMapTest<IndexedIntIntMap>("IndexedIntIntMap");
@@ -749,8 +749,8 @@ TestApp::run(int argc, char* argv[])
cout <<"Struct1Struct2Map" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- Struct1Struct2Map* dummy = 0;
- Struct1Struct2MapTest("Struct1Struct2Map", dummy);
+ Struct1Struct2Map* dummy = 0;
+ Struct1Struct2MapTest("Struct1Struct2Map", dummy);
}
#else
Struct1Struct2MapTest<Struct1Struct2Map>("Struct1Struct2Map");
@@ -759,8 +759,8 @@ TestApp::run(int argc, char* argv[])
cout <<"Struct1Struct2Map with index" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- IndexedStruct1Struct2Map* dummy = 0;
- Struct1Struct2MapTest("IndexedStruct1Struct2Map", dummy);
+ IndexedStruct1Struct2Map* dummy = 0;
+ Struct1Struct2MapTest("IndexedStruct1Struct2Map", dummy);
}
#else
Struct1Struct2MapTest<IndexedStruct1Struct2Map>("IndexedStruct1Struct2Map");
@@ -769,8 +769,8 @@ TestApp::run(int argc, char* argv[])
cout <<"Struct1Class1Map" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- Struct1Class1Map* dummy = 0;
- Struct1Class1MapTest("Struct1Class1Map", dummy);
+ Struct1Class1Map* dummy = 0;
+ Struct1Class1MapTest("Struct1Class1Map", dummy);
}
#else
Struct1Class1MapTest<Struct1Class1Map>("Struct1Class1Map");
@@ -779,8 +779,8 @@ TestApp::run(int argc, char* argv[])
cout <<"Struct1Class1Map with index" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- IndexedStruct1Class1Map* dummy = 0;
- Struct1Class1MapTest("IndexedStruct1Class1Map", dummy);
+ IndexedStruct1Class1Map* dummy = 0;
+ Struct1Class1MapTest("IndexedStruct1Class1Map", dummy);
}
#else
Struct1Class1MapTest<IndexedStruct1Class1Map>("IndexedStruct1Class1Map");
@@ -795,8 +795,8 @@ TestApp::run(int argc, char* argv[])
cout <<"IntIntMap (read test)" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- IntIntMap* dummy = 0;
- IntIntMapReadTest("IntIntMap", dummy);
+ IntIntMap* dummy = 0;
+ IntIntMapReadTest("IntIntMap", dummy);
}
#else
IntIntMapReadTest<IntIntMap>("IntIntMap");
@@ -805,8 +805,8 @@ TestApp::run(int argc, char* argv[])
cout <<"IntIntMap with index(read test)" << endl;
#if defined(_MSC_VER) && (_MSC_VER < 1310)
{
- IndexedIntIntMap* dummy = 0;
- IntIntMapReadTest("IndexedIntIntMap", dummy);
+ IndexedIntIntMap* dummy = 0;
+ IntIntMapReadTest("IndexedIntIntMap", dummy);
}
#else
IntIntMapReadTest<IndexedIntIntMap>("IndexedIntIntMap");
diff --git a/cpp/demo/Freeze/library/Client.cpp b/cpp/demo/Freeze/library/Client.cpp
index 2cd23ba1bf8..4c13a512683 100644
--- a/cpp/demo/Freeze/library/Client.cpp
+++ b/cpp/demo/Freeze/library/Client.cpp
@@ -43,15 +43,15 @@ LibraryClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/Freeze/library/Collocated.cpp b/cpp/demo/Freeze/library/Collocated.cpp
index 5c7ed0261d3..a3457c081dc 100644
--- a/cpp/demo/Freeze/library/Collocated.cpp
+++ b/cpp/demo/Freeze/library/Collocated.cpp
@@ -19,7 +19,7 @@ class LibraryCollocated : public Ice::Application
public:
LibraryCollocated(const string& envName) :
- _envName(envName)
+ _envName(envName)
{
}
@@ -61,7 +61,7 @@ LibraryCollocated::run(int argc, char* argv[])
Ice::Int evictorSize = properties->getPropertyAsInt("Library.EvictorSize");
if(evictorSize > 0)
{
- evictor->setSize(evictorSize);
+ evictor->setSize(evictorSize);
}
//
@@ -96,15 +96,15 @@ LibraryCollocated::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/Freeze/library/Library.ice b/cpp/demo/Freeze/library/Library.ice
index 7111b0f1eac..87663189286 100644
--- a/cpp/demo/Freeze/library/Library.ice
+++ b/cpp/demo/Freeze/library/Library.ice
@@ -92,7 +92,7 @@ class Book
*
**/
["freeze:write"] void destroy()
- throws DatabaseException;
+ throws DatabaseException;
/**
*
@@ -105,7 +105,7 @@ class Book
*
**/
["freeze:write"] void rentBook(string name)
- throws BookRentedException;
+ throws BookRentedException;
/**
*
@@ -118,7 +118,7 @@ class Book
*
**/
["cpp:const"] idempotent string getRenterName()
- throws BookNotRentedException;
+ throws BookNotRentedException;
/**
*
@@ -129,7 +129,7 @@ class Book
*
**/
["freeze:write"] void returnBook()
- throws BookNotRentedException;
+ throws BookNotRentedException;
/**
*
@@ -177,7 +177,7 @@ interface Library
*
**/
Book* createBook(BookDescription description)
- throws DatabaseException, BookExistsException;
+ throws DatabaseException, BookExistsException;
/**
*
@@ -192,7 +192,7 @@ interface Library
*
**/
["cpp:const"] idempotent Book* findByIsbn(string isbn)
- throws DatabaseException;
+ throws DatabaseException;
/**
*
@@ -207,7 +207,7 @@ interface Library
*
**/
["cpp:const"] idempotent BookPrxSeq findByAuthors(string authors)
- throws DatabaseException;
+ throws DatabaseException;
/**
*
@@ -220,7 +220,7 @@ interface Library
*
**/
idempotent void setEvictorSize(int size)
- throws DatabaseException;
+ throws DatabaseException;
/**
*
diff --git a/cpp/demo/Freeze/library/LibraryI.cpp b/cpp/demo/Freeze/library/LibraryI.cpp
index 450420c6f55..8a950d3b95c 100644
--- a/cpp/demo/Freeze/library/LibraryI.cpp
+++ b/cpp/demo/Freeze/library/LibraryI.cpp
@@ -24,19 +24,19 @@ BookI::destroy(const Ice::Current&)
IceUtil::Mutex::Lock lock(*this);
if(_destroyed)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
_destroyed = true;
try
{
- _library->remove(description);
+ _library->remove(description);
}
catch(const Freeze::DatabaseException& ex)
{
- DatabaseException e;
- e.message = ex.message;
- throw e;
+ DatabaseException e;
+ e.message = ex.message;
+ throw e;
}
}
@@ -68,7 +68,7 @@ BookI::getRenterName(const Ice::Current&) const
if(rentalCustomerName.empty())
{
- throw BookNotRentedException();
+ throw BookNotRentedException();
}
return rentalCustomerName;
}
@@ -85,7 +85,7 @@ BookI::rentBook(const string& name, const Ice::Current&)
if(!rentalCustomerName.empty())
{
- throw BookRentedException();
+ throw BookRentedException();
}
rentalCustomerName = name;
}
@@ -102,7 +102,7 @@ BookI::returnBook(const Ice::Current&)
if(rentalCustomerName.empty())
{
- throw BookNotRentedException();
+ throw BookNotRentedException();
}
rentalCustomerName.clear();;
}
@@ -128,14 +128,14 @@ class IsbnToBook
public:
IsbnToBook(const Ice::ObjectAdapterPtr& adapter) :
- _adapter(adapter)
+ _adapter(adapter)
{
}
BookPrx
operator()(const string& isbn)
{
- return BookPrx::uncheckedCast(_adapter->createProxy(createBookIdentity(isbn)));
+ return BookPrx::uncheckedCast(_adapter->createProxy(createBookIdentity(isbn)));
}
private:
@@ -144,8 +144,8 @@ private:
};
LibraryI::LibraryI(const Ice::CommunicatorPtr& communicator,
- const string& envName, const string& dbName,
- const Freeze::EvictorPtr& evictor) :
+ const string& envName, const string& dbName,
+ const Freeze::EvictorPtr& evictor) :
_evictor(evictor),
_connection(Freeze::createConnection(communicator, envName)),
_authors(_connection, dbName)
@@ -163,25 +163,25 @@ LibraryI::createBook(const Demo::BookDescription& description, const Ice::Curren
//
BookPrx book;
{
- book = IsbnToBook(c.adapter)(description.isbn);
+ book = IsbnToBook(c.adapter)(description.isbn);
}
#else
BookPrx book = IsbnToBook(c.adapter)(description.isbn);
#endif
try
{
- book->ice_ping();
+ book->ice_ping();
- //
- // The book already exists.
- //
- throw BookExistsException();
+ //
+ // The book already exists.
+ //
+ throw BookExistsException();
}
catch(const Ice::ObjectNotExistException&)
{
- //
- // Book doesn't exist, ignore the exception.
- //
+ //
+ // Book doesn't exist, ignore the exception.
+ //
}
BookPtr bookI = new BookI(this);
@@ -205,7 +205,7 @@ LibraryI::createBook(const Demo::BookDescription& description, const Ice::Curren
StringIsbnSeqDict::iterator p = _authors.find(description.authors);
if(p != _authors.end())
{
- isbnSeq = p->second;
+ isbnSeq = p->second;
}
isbnSeq.push_back(description.isbn);
@@ -224,16 +224,16 @@ LibraryI::findByIsbn(const string& isbn, const Ice::Current& c) const
try
{
- BookPrx book = IsbnToBook(c.adapter)(isbn);
- book->ice_ping();
- return book;
+ BookPrx book = IsbnToBook(c.adapter)(isbn);
+ book->ice_ping();
+ return book;
}
catch(const Ice::ObjectNotExistException&)
{
- //
- // Book doesn't exist, return a null proxy.
- //
- return 0;
+ //
+ // Book doesn't exist, return a null proxy.
+ //
+ return 0;
}
}
@@ -252,8 +252,8 @@ LibraryI::findByAuthors(const string& authors, const Ice::Current& c) const
if(p != _authors.end())
{
- books.reserve(p->second.size());
- transform(p->second.begin(), p->second.end(), back_inserter(books), IsbnToBook(c.adapter));
+ books.reserve(p->second.size());
+ transform(p->second.begin(), p->second.end(), back_inserter(books), IsbnToBook(c.adapter));
}
return books;
@@ -286,43 +286,43 @@ LibraryI::remove(const BookDescription& description)
try
{
- StringIsbnSeqDict::iterator p = _authors.find(description.authors);
-
- assert(p != _authors.end());
-
- //
- // Remove the isbn number from the sequence.
- //
- Ice::StringSeq isbnSeq = p->second;
- isbnSeq.erase(remove_if(isbnSeq.begin(), isbnSeq.end(), bind2nd(equal_to<string>(), description.isbn)),
- isbnSeq.end());
-
- if(isbnSeq.empty())
- {
- //
- // If there are no further associated isbn numbers then remove
- // the record.
- //
- _authors.erase(p);
- }
- else
- {
- //
- // Otherwise, write back the new record.
- //
- p.set(isbnSeq);
- }
-
- //
- // This can throw EvictorDeactivatedException (which indicates
- // an internal error). The exception is currently ignored.
- //
- _evictor->remove(createBookIdentity(description.isbn));
+ StringIsbnSeqDict::iterator p = _authors.find(description.authors);
+
+ assert(p != _authors.end());
+
+ //
+ // Remove the isbn number from the sequence.
+ //
+ Ice::StringSeq isbnSeq = p->second;
+ isbnSeq.erase(remove_if(isbnSeq.begin(), isbnSeq.end(), bind2nd(equal_to<string>(), description.isbn)),
+ isbnSeq.end());
+
+ if(isbnSeq.empty())
+ {
+ //
+ // If there are no further associated isbn numbers then remove
+ // the record.
+ //
+ _authors.erase(p);
+ }
+ else
+ {
+ //
+ // Otherwise, write back the new record.
+ //
+ p.set(isbnSeq);
+ }
+
+ //
+ // This can throw EvictorDeactivatedException (which indicates
+ // an internal error). The exception is currently ignored.
+ //
+ _evictor->remove(createBookIdentity(description.isbn));
}
catch(const Freeze::DatabaseException& ex)
{
- DatabaseException e;
- e.message = ex.message;
- throw e;
+ DatabaseException e;
+ e.message = ex.message;
+ throw e;
}
}
diff --git a/cpp/demo/Freeze/library/LibraryI.h b/cpp/demo/Freeze/library/LibraryI.h
index 6733f6e3f35..aba7775842d 100644
--- a/cpp/demo/Freeze/library/LibraryI.h
+++ b/cpp/demo/Freeze/library/LibraryI.h
@@ -21,8 +21,8 @@ class LibraryI : public Demo::Library, public IceUtil::Mutex
public:
LibraryI(const Ice::CommunicatorPtr& communicator,
- const std::string& envName, const std::string& dbName,
- const Freeze::EvictorPtr& evictor);
+ const std::string& envName, const std::string& dbName,
+ const Freeze::EvictorPtr& evictor);
virtual Demo::BookPrx createBook(const Demo::BookDescription&, const Ice::Current&);
virtual Demo::BookPrx findByIsbn(const std::string&, const Ice::Current&) const;
diff --git a/cpp/demo/Freeze/library/Parser.cpp b/cpp/demo/Freeze/library/Parser.cpp
index eeb8046327d..c884b42fd6e 100644
--- a/cpp/demo/Freeze/library/Parser.cpp
+++ b/cpp/demo/Freeze/library/Parser.cpp
@@ -51,37 +51,37 @@ Parser::addBook(const list<string>& _args)
{
if(_args.size() != 3)
{
- error("`add' requires at exactly three arguments (type `help' for more info)");
- return;
+ error("`add' requires at exactly three arguments (type `help' for more info)");
+ return;
}
try
{
- list<string> args = _args;
+ list<string> args = _args;
- BookDescription desc;
- desc.isbn = args.front();
- args.pop_front();
- desc.title = args.front();
- args.pop_front();
- desc.authors = args.front();
+ BookDescription desc;
+ desc.isbn = args.front();
+ args.pop_front();
+ desc.title = args.front();
+ args.pop_front();
+ desc.authors = args.front();
- BookPrx book = _library->createBook(desc);
- cout << "added new book with isbn " << desc.isbn << endl;
+ BookPrx book = _library->createBook(desc);
+ cout << "added new book with isbn " << desc.isbn << endl;
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const BookExistsException&)
{
- error("the book already exists.");
+ error("the book already exists.");
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -90,36 +90,36 @@ Parser::findIsbn(const list<string>& args)
{
if(args.size() != 1)
{
- error("`isbn' requires exactly one argument (type `help' for more info)");
- return;
+ error("`isbn' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- _foundBooks.clear();
- _current = _foundBooks.begin();
-
- BookPrx book = _library->findByIsbn(args.front());
- if(!book)
- {
- cout << "no book with that ISBN number exists." << endl;
- }
- else
- {
- _foundBooks.push_back(book);
- _current = _foundBooks.begin();
- printCurrent();
- }
+ _foundBooks.clear();
+ _current = _foundBooks.begin();
+
+ BookPrx book = _library->findByIsbn(args.front());
+ if(!book)
+ {
+ cout << "no book with that ISBN number exists." << endl;
+ }
+ else
+ {
+ _foundBooks.push_back(book);
+ _current = _foundBooks.begin();
+ printCurrent();
+ }
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -128,26 +128,26 @@ Parser::findAuthors(const list<string>& args)
{
if(args.size() != 1)
{
- error("`authors' requires exactly one argument (type `help' for more info)");
- return;
+ error("`authors' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- _foundBooks = _library->findByAuthors(args.front());
- _current = _foundBooks.begin();
- cout << "number of books found: " << _foundBooks.size() << endl;
- printCurrent();
+ _foundBooks = _library->findByAuthors(args.front());
+ _current = _foundBooks.begin();
+ cout << "number of books found: " << _foundBooks.size() << endl;
+ printCurrent();
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -156,7 +156,7 @@ Parser::nextFoundBook()
{
if(_current != _foundBooks.end())
{
- ++_current;
+ ++_current;
}
printCurrent();
}
@@ -166,31 +166,31 @@ Parser::printCurrent()
{
try
{
- if(_current != _foundBooks.end())
- {
- BookDescription desc = (*_current)->getBookDescription();
- string renter;
- try
- {
- renter = (*_current)->getRenterName();
- }
- catch(const BookNotRentedException&)
- {
- }
-
- cout << "current book is:" << endl;
- cout << "isbn: " << desc.isbn << endl;
- cout << "title: " << desc.title << endl;
- cout << "authors: " << desc.authors << endl;
- if(!renter.empty())
- {
- cout << "rented: " << renter << endl;
- }
- }
- else
- {
- cout << "no current book" << endl;
- }
+ if(_current != _foundBooks.end())
+ {
+ BookDescription desc = (*_current)->getBookDescription();
+ string renter;
+ try
+ {
+ renter = (*_current)->getRenterName();
+ }
+ catch(const BookNotRentedException&)
+ {
+ }
+
+ cout << "current book is:" << endl;
+ cout << "isbn: " << desc.isbn << endl;
+ cout << "title: " << desc.title << endl;
+ cout << "authors: " << desc.authors << endl;
+ if(!renter.empty())
+ {
+ cout << "rented: " << renter << endl;
+ }
+ }
+ else
+ {
+ cout << "no current book" << endl;
+ }
}
catch(const Ice::ObjectNotExistException&)
{
@@ -198,9 +198,9 @@ Parser::printCurrent()
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -209,25 +209,25 @@ Parser::rentCurrent(const list<string>& args)
{
if(args.size() != 1)
{
- error("`rent' requires exactly one argument (type `help' for more info)");
- return;
+ error("`rent' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- if(_current != _foundBooks.end())
- {
- (*_current)->rentBook(args.front());
- cout << "the book is now rented by `" << args.front() << "'" << endl;
- }
- else
- {
- cout << "no current book" << endl;
- }
+ if(_current != _foundBooks.end())
+ {
+ (*_current)->rentBook(args.front());
+ cout << "the book is now rented by `" << args.front() << "'" << endl;
+ }
+ else
+ {
+ cout << "no current book" << endl;
+ }
}
catch(const BookRentedException&)
{
- cout << "the book has already been rented." << endl;
+ cout << "the book has already been rented." << endl;
}
catch(const Ice::ObjectNotExistException&)
{
@@ -235,13 +235,13 @@ Parser::rentCurrent(const list<string>& args)
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -250,19 +250,19 @@ Parser::returnCurrent()
{
try
{
- if(_current != _foundBooks.end())
- {
- (*_current)->returnBook();
- cout << "the book has been returned." << endl;
- }
- else
- {
- cout << "no current book" << endl;
- }
+ if(_current != _foundBooks.end())
+ {
+ (*_current)->returnBook();
+ cout << "the book has been returned." << endl;
+ }
+ else
+ {
+ cout << "no current book" << endl;
+ }
}
catch(const BookNotRentedException&)
{
- cout << "the book is not currently rented." << endl;
+ cout << "the book is not currently rented." << endl;
}
catch(const Ice::ObjectNotExistException&)
{
@@ -270,13 +270,13 @@ Parser::returnCurrent()
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -285,15 +285,15 @@ Parser::removeCurrent()
{
try
{
- if(_current != _foundBooks.end())
- {
- (*_current)->destroy();
- cout << "removed current book" << endl;
- }
- else
- {
- cout << "no current book" << endl;
- }
+ if(_current != _foundBooks.end())
+ {
+ (*_current)->destroy();
+ cout << "removed current book" << endl;
+ }
+ else
+ {
+ cout << "no current book" << endl;
+ }
}
catch(const Ice::ObjectNotExistException&)
{
@@ -301,13 +301,13 @@ Parser::removeCurrent()
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -316,23 +316,23 @@ Parser::setEvictorSize(const list<string>& args)
{
if(args.size() != 1)
{
- error("`size' requires exactly one argument (type `help' for more info)");
- return;
+ error("`size' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- _library->setEvictorSize(atoi(args.front().c_str()));
+ _library->setEvictorSize(atoi(args.front().c_str()));
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -341,13 +341,13 @@ Parser::shutdown()
{
try
{
- _library->shutdown();
+ _library->shutdown();
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -356,105 +356,105 @@ Parser::getInput(char* buf, int& result, int maxSize)
{
if(!_commands.empty())
{
- if(_commands == ";")
- {
- result = 0;
- }
- else
- {
+ if(_commands == ";")
+ {
+ result = 0;
+ }
+ else
+ {
#if defined(_MSC_VER) && !defined(_STLP_MSVC)
- // COMPILERBUG: Stupid Visual C++ defines min and max as macros
- result = _MIN(maxSize, static_cast<int>(_commands.length()));
+ // COMPILERBUG: Stupid Visual C++ defines min and max as macros
+ result = _MIN(maxSize, static_cast<int>(_commands.length()));
#else
- result = min(maxSize, static_cast<int>(_commands.length()));
+ result = min(maxSize, static_cast<int>(_commands.length()));
#endif
- strncpy(buf, _commands.c_str(), result);
- _commands.erase(0, result);
- if(_commands.empty())
- {
- _commands = ";";
- }
- }
+ strncpy(buf, _commands.c_str(), result);
+ _commands.erase(0, result);
+ if(_commands.empty())
+ {
+ _commands = ";";
+ }
+ }
}
else if(isatty(fileno(yyin)))
{
#ifdef HAVE_READLINE
const char* prompt = parser->getPrompt();
- char* line = readline(const_cast<char*>(prompt));
- if(!line)
- {
- result = 0;
- }
- else
- {
- if(*line)
- {
- add_history(line);
- }
-
- result = strlen(line) + 1;
- if(result > maxSize)
- {
- free(line);
- error("input line too long");
- result = 0;
- }
- else
- {
- strcpy(buf, line);
- strcat(buf, "\n");
- free(line);
- }
- }
+ char* line = readline(const_cast<char*>(prompt));
+ if(!line)
+ {
+ result = 0;
+ }
+ else
+ {
+ if(*line)
+ {
+ add_history(line);
+ }
+
+ result = strlen(line) + 1;
+ if(result > maxSize)
+ {
+ free(line);
+ error("input line too long");
+ result = 0;
+ }
+ else
+ {
+ strcpy(buf, line);
+ strcat(buf, "\n");
+ free(line);
+ }
+ }
#else
- cout << parser->getPrompt() << flush;
-
- string line;
- while(true)
- {
- char c = static_cast<char>(getc(yyin));
- if(c == EOF)
- {
- if(line.size())
- {
- line += '\n';
- }
- break;
- }
-
- line += c;
-
- if(c == '\n')
- {
- break;
- }
- }
-
- result = static_cast<int>(line.length());
- if(result > maxSize)
- {
- error("input line too long");
- buf[0] = EOF;
- result = 1;
- }
- else
- {
- strcpy(buf, line.c_str());
- }
+ cout << parser->getPrompt() << flush;
+
+ string line;
+ while(true)
+ {
+ char c = static_cast<char>(getc(yyin));
+ if(c == EOF)
+ {
+ if(line.size())
+ {
+ line += '\n';
+ }
+ break;
+ }
+
+ line += c;
+
+ if(c == '\n')
+ {
+ break;
+ }
+ }
+
+ result = static_cast<int>(line.length());
+ if(result > maxSize)
+ {
+ error("input line too long");
+ buf[0] = EOF;
+ result = 1;
+ }
+ else
+ {
+ strcpy(buf, line.c_str());
+ }
#endif
}
else
{
- if(((result = static_cast<int>(fread(buf, 1, maxSize, yyin))) == 0) && ferror(yyin))
- {
- error("input in flex scanner failed");
- buf[0] = EOF;
- result = 1;
- }
+ if(((result = static_cast<int>(fread(buf, 1, maxSize, yyin))) == 0) && ferror(yyin))
+ {
+ error("input in flex scanner failed");
+ buf[0] = EOF;
+ result = 1;
+ }
}
}
@@ -477,12 +477,12 @@ Parser::getPrompt()
if(_continue)
{
- _continue = false;
- return "(cont) ";
+ _continue = false;
+ return "(cont) ";
}
else
{
- return ">>> ";
+ return ">>> ";
}
}
@@ -491,11 +491,11 @@ Parser::error(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
}
else
{
- cerr << "error: " << s << endl;
+ cerr << "error: " << s << endl;
}
_errors++;
}
@@ -511,11 +511,11 @@ Parser::warning(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
}
else
{
- cerr << "warning: " << s << endl;
+ cerr << "warning: " << s << endl;
}
}
@@ -550,7 +550,7 @@ Parser::parse(FILE* file, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
@@ -582,7 +582,7 @@ Parser::parse(const string& commands, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
diff --git a/cpp/demo/Freeze/library/RunParser.cpp b/cpp/demo/Freeze/library/RunParser.cpp
index 87500d3a6f3..f1a79c08d5f 100644
--- a/cpp/demo/Freeze/library/RunParser.cpp
+++ b/cpp/demo/Freeze/library/RunParser.cpp
@@ -17,13 +17,13 @@ void
usage(const char* appName)
{
cerr << "Usage: " << appName << " [options] [file...]\n";
- cerr <<
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.\n"
- "-e COMMANDS Execute COMMANDS.\n"
- "-d, --debug Print debug messages.\n"
- ;
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-e COMMANDS Execute COMMANDS.\n"
+ "-d, --debug Print debug messages.\n"
+ ;
}
int
@@ -35,67 +35,67 @@ runParser(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
int idx = 1;
while(idx < argc)
{
- if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
- {
- usage(argv[0]);
- return EXIT_SUCCESS;
- }
- else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
- {
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
- }
- else if(strcmp(argv[idx], "-e") == 0)
- {
- if(idx + 1 >= argc)
+ if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[idx], "-e") == 0)
+ {
+ if(idx + 1 >= argc)
{
- cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
-
- commands += argv[idx + 1];
- commands += ';';
+
+ commands += argv[idx + 1];
+ commands += ';';
- for(int i = idx ; i + 2 < argc ; ++i)
- {
- argv[i] = argv[i + 2];
- }
- argc -= 2;
- }
- else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
- {
- debug = true;
- for(int i = idx ; i + 1 < argc ; ++i)
- {
- argv[i] = argv[i + 1];
- }
- --argc;
- }
- else if(argv[idx][0] == '-')
- {
- cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- else
- {
- ++idx;
- }
+ for(int i = idx ; i + 2 < argc ; ++i)
+ {
+ argv[i] = argv[i + 2];
+ }
+ argc -= 2;
+ }
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ {
+ debug = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if(argv[idx][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ ++idx;
+ }
}
if(argc >= 2 && !commands.empty())
{
- cerr << argv[0] << ": `-e' option cannot be used if input files are given" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `-e' option cannot be used if input files are given" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
LibraryPrx phoneBook = LibraryPrx::checkedCast(communicator->propertyToProxy("Library.Proxy"));
if(!phoneBook)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
ParserPtr p = Parser::createParser(phoneBook);
@@ -103,43 +103,43 @@ runParser(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
if(argc < 2) // No files given
{
- if(!commands.empty()) // Commands were given
- {
- int parseStatus = p->parse(commands, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
- else // No commands, let's use standard input
- {
- int parseStatus = p->parse(stdin, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
+ if(!commands.empty()) // Commands were given
+ {
+ int parseStatus = p->parse(commands, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ else // No commands, let's use standard input
+ {
+ int parseStatus = p->parse(stdin, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
}
else // Process files given on the command line
{
- for(idx = 1 ; idx < argc ; ++idx)
- {
- FILE* file = fopen(argv[idx], "r");
- if(file == NULL)
- {
- cerr << argv[0] << ": can't open file `" << argv[idx] << "': " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
-
- int parseStatus = p->parse(file, debug);
+ for(idx = 1 ; idx < argc ; ++idx)
+ {
+ FILE* file = fopen(argv[idx], "r");
+ if(file == NULL)
+ {
+ cerr << argv[0] << ": can't open file `" << argv[idx] << "': " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+
+ int parseStatus = p->parse(file, debug);
- fclose(file);
+ fclose(file);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
}
return status;
diff --git a/cpp/demo/Freeze/library/Server.cpp b/cpp/demo/Freeze/library/Server.cpp
index a819e74ee1b..fda90db0811 100644
--- a/cpp/demo/Freeze/library/Server.cpp
+++ b/cpp/demo/Freeze/library/Server.cpp
@@ -18,7 +18,7 @@ class LibraryServer : public Ice::Application
public:
LibraryServer(const string& envName) :
- _envName(envName)
+ _envName(envName)
{
}
@@ -53,7 +53,7 @@ LibraryServer::run(int argc, char* argv[])
Ice::Int evictorSize = properties->getPropertyAsInt("Library.EvictorSize");
if(evictorSize > 0)
{
- evictor->setSize(evictorSize);
+ evictor->setSize(evictorSize);
}
//
diff --git a/cpp/demo/Freeze/phonebook/Client.cpp b/cpp/demo/Freeze/phonebook/Client.cpp
index 5f7c3c032a2..d027ae411a0 100644
--- a/cpp/demo/Freeze/phonebook/Client.cpp
+++ b/cpp/demo/Freeze/phonebook/Client.cpp
@@ -43,15 +43,15 @@ PhoneBookClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/Freeze/phonebook/Collocated.cpp b/cpp/demo/Freeze/phonebook/Collocated.cpp
index 6b1efc3c75f..692f33e425e 100644
--- a/cpp/demo/Freeze/phonebook/Collocated.cpp
+++ b/cpp/demo/Freeze/phonebook/Collocated.cpp
@@ -19,7 +19,7 @@ class PhoneBookCollocated : public Ice::Application
public:
PhoneBookCollocated(const string& envName) :
- _envName(envName)
+ _envName(envName)
{
}
@@ -82,7 +82,7 @@ PhoneBookCollocated::run(int argc, char* argv[])
Ice::Int evictorSize = properties->getPropertyAsInt("PhoneBook.EvictorSize");
if(evictorSize > 0)
{
- evictor->setSize(evictorSize);
+ evictor->setSize(evictorSize);
}
//
@@ -113,15 +113,15 @@ PhoneBookCollocated::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/Freeze/phonebook/Parser.cpp b/cpp/demo/Freeze/phonebook/Parser.cpp
index a09f663ceec..a93bab7648d 100644
--- a/cpp/demo/Freeze/phonebook/Parser.cpp
+++ b/cpp/demo/Freeze/phonebook/Parser.cpp
@@ -52,28 +52,28 @@ Parser::addContacts(const list<string>& args)
{
if(args.empty())
{
- error("`add' requires at least one argument (type `help' for more info)");
- return;
+ error("`add' requires at least one argument (type `help' for more info)");
+ return;
}
try
{
- for(list<string>::const_iterator p = args.begin(); p != args.end(); ++p)
- {
- ContactPrx contact = _phoneBook->createContact();
- contact->setName(*p);
- cout << "added new contact for `" << *p << "'" << endl;
- }
+ for(list<string>::const_iterator p = args.begin(); p != args.end(); ++p)
+ {
+ ContactPrx contact = _phoneBook->createContact();
+ contact->setName(*p);
+ cout << "added new contact for `" << *p << "'" << endl;
+ }
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -82,26 +82,26 @@ Parser::findContacts(const list<string>& args)
{
if(args.size() != 1)
{
- error("`find' requires exactly one argument (type `help' for more info)");
- return;
+ error("`find' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- _foundContacts = _phoneBook->findContacts(args.front());
- _current = _foundContacts.begin();
- cout << "number of contacts found: " << _foundContacts.size() << endl;
- printCurrent();
+ _foundContacts = _phoneBook->findContacts(args.front());
+ _current = _foundContacts.begin();
+ cout << "number of contacts found: " << _foundContacts.size() << endl;
+ printCurrent();
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -110,7 +110,7 @@ Parser::nextFoundContact()
{
if(_current != _foundContacts.end())
{
- ++_current;
+ ++_current;
}
printCurrent();
}
@@ -120,17 +120,17 @@ Parser::printCurrent()
{
try
{
- if(_current != _foundContacts.end())
- {
- cout << "current contact is:" << endl;
- cout << "name: " << (*_current)->getName() << endl;
- cout << "address: " << (*_current)->getAddress() << endl;
- cout << "phone: " << (*_current)->getPhone() << endl;
- }
- else
- {
- cout << "no current contact" << endl;
- }
+ if(_current != _foundContacts.end())
+ {
+ cout << "current contact is:" << endl;
+ cout << "name: " << (*_current)->getName() << endl;
+ cout << "address: " << (*_current)->getAddress() << endl;
+ cout << "phone: " << (*_current)->getPhone() << endl;
+ }
+ else
+ {
+ cout << "no current contact" << endl;
+ }
}
catch(const Ice::ObjectNotExistException&)
{
@@ -138,13 +138,13 @@ Parser::printCurrent()
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -153,21 +153,21 @@ Parser::setCurrentName(const list<string>& args)
{
if(args.size() != 1)
{
- error("`name' requires exactly one argument (type `help' for more info)");
- return;
+ error("`name' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- if(_current != _foundContacts.end())
- {
- (*_current)->setName(args.front());
- cout << "changed name to `" << args.front() << "'" << endl;
- }
- else
- {
- cout << "no current contact" << endl;
- }
+ if(_current != _foundContacts.end())
+ {
+ (*_current)->setName(args.front());
+ cout << "changed name to `" << args.front() << "'" << endl;
+ }
+ else
+ {
+ cout << "no current contact" << endl;
+ }
}
catch(const Ice::ObjectNotExistException&)
{
@@ -175,13 +175,13 @@ Parser::setCurrentName(const list<string>& args)
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -190,21 +190,21 @@ Parser::setCurrentAddress(const list<string>& args)
{
if(args.size() != 1)
{
- error("`address' requires exactly one argument (type `help' for more info)");
- return;
+ error("`address' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- if(_current != _foundContacts.end())
- {
- (*_current)->setAddress(args.front());
- cout << "changed address to `" << args.front() << "'" << endl;
- }
- else
- {
- cout << "no current contact" << endl;
- }
+ if(_current != _foundContacts.end())
+ {
+ (*_current)->setAddress(args.front());
+ cout << "changed address to `" << args.front() << "'" << endl;
+ }
+ else
+ {
+ cout << "no current contact" << endl;
+ }
}
catch(const Ice::ObjectNotExistException&)
{
@@ -212,13 +212,13 @@ Parser::setCurrentAddress(const list<string>& args)
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -227,21 +227,21 @@ Parser::setCurrentPhone(const list<string>& args)
{
if(args.size() != 1)
{
- error("`phone' requires exactly one argument (type `help' for more info)");
- return;
+ error("`phone' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- if(_current != _foundContacts.end())
- {
- (*_current)->setPhone(args.front());
- cout << "changed phone number to `" << args.front() << "'" << endl;
- }
- else
- {
- cout << "no current contact" << endl;
- }
+ if(_current != _foundContacts.end())
+ {
+ (*_current)->setPhone(args.front());
+ cout << "changed phone number to `" << args.front() << "'" << endl;
+ }
+ else
+ {
+ cout << "no current contact" << endl;
+ }
}
catch(const Ice::ObjectNotExistException&)
{
@@ -249,13 +249,13 @@ Parser::setCurrentPhone(const list<string>& args)
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -264,15 +264,15 @@ Parser::removeCurrent()
{
try
{
- if(_current != _foundContacts.end())
- {
- (*_current)->destroy();
- cout << "removed current contact" << endl;
- }
- else
- {
- cout << "no current contact" << endl;
- }
+ if(_current != _foundContacts.end())
+ {
+ (*_current)->destroy();
+ cout << "removed current contact" << endl;
+ }
+ else
+ {
+ cout << "no current contact" << endl;
+ }
}
catch(const Ice::ObjectNotExistException&)
{
@@ -280,13 +280,13 @@ Parser::removeCurrent()
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -295,23 +295,23 @@ Parser::setEvictorSize(const list<string>& args)
{
if(args.size() != 1)
{
- error("`size' requires exactly one argument (type `help' for more info)");
- return;
+ error("`size' requires exactly one argument (type `help' for more info)");
+ return;
}
try
{
- _phoneBook->setEvictorSize(atoi(args.front().c_str()));
+ _phoneBook->setEvictorSize(atoi(args.front().c_str()));
}
catch(const DatabaseException& ex)
{
- error(ex.message);
+ error(ex.message);
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -320,13 +320,13 @@ Parser::shutdown()
{
try
{
- _phoneBook->shutdown();
+ _phoneBook->shutdown();
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -335,105 +335,105 @@ Parser::getInput(char* buf, int& result, int maxSize)
{
if(!_commands.empty())
{
- if(_commands == ";")
- {
- result = 0;
- }
- else
- {
+ if(_commands == ";")
+ {
+ result = 0;
+ }
+ else
+ {
#if defined(_MSC_VER) && !defined(_STLP_MSVC)
- // COMPILERBUG: Stupid Visual C++ defines min and max as macros
- result = _MIN(maxSize, static_cast<int>(_commands.length()));
+ // COMPILERBUG: Stupid Visual C++ defines min and max as macros
+ result = _MIN(maxSize, static_cast<int>(_commands.length()));
#else
- result = min(maxSize, static_cast<int>(_commands.length()));
+ result = min(maxSize, static_cast<int>(_commands.length()));
#endif
- strncpy(buf, _commands.c_str(), result);
- _commands.erase(0, result);
- if(_commands.empty())
- {
- _commands = ";";
- }
- }
+ strncpy(buf, _commands.c_str(), result);
+ _commands.erase(0, result);
+ if(_commands.empty())
+ {
+ _commands = ";";
+ }
+ }
}
else if(isatty(fileno(yyin)))
{
#ifdef HAVE_READLINE
const char* prompt = parser->getPrompt();
- char* line = readline(const_cast<char*>(prompt));
- if(!line)
- {
- result = 0;
- }
- else
- {
- if(*line)
- {
- add_history(line);
- }
-
- result = strlen(line) + 1;
- if(result > maxSize)
- {
- free(line);
- error("input line too long");
- result = 0;
- }
- else
- {
- strcpy(buf, line);
- strcat(buf, "\n");
- free(line);
- }
- }
+ char* line = readline(const_cast<char*>(prompt));
+ if(!line)
+ {
+ result = 0;
+ }
+ else
+ {
+ if(*line)
+ {
+ add_history(line);
+ }
+
+ result = strlen(line) + 1;
+ if(result > maxSize)
+ {
+ free(line);
+ error("input line too long");
+ result = 0;
+ }
+ else
+ {
+ strcpy(buf, line);
+ strcat(buf, "\n");
+ free(line);
+ }
+ }
#else
- cout << parser->getPrompt() << flush;
-
- string line;
- while(true)
- {
- char c = static_cast<char>(getc(yyin));
- if(c == EOF)
- {
- if(line.size())
- {
- line += '\n';
- }
- break;
- }
-
- line += c;
-
- if(c == '\n')
- {
- break;
- }
- }
-
- result = static_cast<int>(line.length());
- if(result > maxSize)
- {
- error("input line too long");
- buf[0] = EOF;
- result = 1;
- }
- else
- {
- strcpy(buf, line.c_str());
- }
+ cout << parser->getPrompt() << flush;
+
+ string line;
+ while(true)
+ {
+ char c = static_cast<char>(getc(yyin));
+ if(c == EOF)
+ {
+ if(line.size())
+ {
+ line += '\n';
+ }
+ break;
+ }
+
+ line += c;
+
+ if(c == '\n')
+ {
+ break;
+ }
+ }
+
+ result = static_cast<int>(line.length());
+ if(result > maxSize)
+ {
+ error("input line too long");
+ buf[0] = EOF;
+ result = 1;
+ }
+ else
+ {
+ strcpy(buf, line.c_str());
+ }
#endif
}
else
{
- if(((result = static_cast<int>(fread(buf, 1, maxSize, yyin))) == 0) && ferror(yyin))
- {
- error("input in flex scanner failed");
- buf[0] = EOF;
- result = 1;
- }
+ if(((result = static_cast<int>(fread(buf, 1, maxSize, yyin))) == 0) && ferror(yyin))
+ {
+ error("input in flex scanner failed");
+ buf[0] = EOF;
+ result = 1;
+ }
}
}
@@ -456,12 +456,12 @@ Parser::getPrompt()
if(_continue)
{
- _continue = false;
- return "(cont) ";
+ _continue = false;
+ return "(cont) ";
}
else
{
- return ">>> ";
+ return ">>> ";
}
}
@@ -470,11 +470,11 @@ Parser::error(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
}
else
{
- cerr << "error: " << s << endl;
+ cerr << "error: " << s << endl;
}
_errors++;
}
@@ -490,11 +490,11 @@ Parser::warning(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
}
else
{
- cerr << "warning: " << s << endl;
+ cerr << "warning: " << s << endl;
}
}
@@ -529,7 +529,7 @@ Parser::parse(FILE* file, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
@@ -561,7 +561,7 @@ Parser::parse(const string& commands, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp
index b58fa5adedb..208eac42620 100644
--- a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp
+++ b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp
@@ -65,18 +65,18 @@ ContactI::destroy(const Ice::Current& c)
{
try
{
- _factory->getEvictor()->remove(c.id);
+ _factory->getEvictor()->remove(c.id);
}
catch(const Freeze::DatabaseException& ex)
{
- DatabaseException e;
- e.message = ex.message;
- throw e;
+ DatabaseException e;
+ e.message = ex.message;
+ throw e;
}
}
PhoneBookI::PhoneBookI(const Freeze::EvictorPtr& evictor, const ContactFactoryPtr& contactFactory,
- const NameIndexPtr& index) :
+ const NameIndexPtr& index) :
_evictor(evictor),
_contactFactory(contactFactory),
_index(index)
@@ -88,13 +88,13 @@ class IdentityToContact
public:
IdentityToContact(const Ice::ObjectAdapterPtr& adapter) :
- _adapter(adapter)
+ _adapter(adapter)
{
}
- ContactPrx operator()(const Ice::Identity& ident)
+ ContactPrx operator()(const Ice::Identity& ident)
{
- return ContactPrx::uncheckedCast(_adapter->createProxy(ident));
+ return ContactPrx::uncheckedCast(_adapter->createProxy(ident));
}
private:
@@ -136,19 +136,19 @@ PhoneBookI::findContacts(const string& name, const Ice::Current& c) const
{
try
{
- vector<Ice::Identity> identities = _index->find(name);
-
- Contacts contacts;
- contacts.reserve(identities.size());
- transform(identities.begin(), identities.end(), back_inserter(contacts), IdentityToContact(c.adapter));
+ vector<Ice::Identity> identities = _index->find(name);
+
+ Contacts contacts;
+ contacts.reserve(identities.size());
+ transform(identities.begin(), identities.end(), back_inserter(contacts), IdentityToContact(c.adapter));
- return contacts;
+ return contacts;
}
catch(const Freeze::DatabaseException& ex)
{
- DatabaseException e;
- e.message = ex.message;
- throw e;
+ DatabaseException e;
+ e.message = ex.message;
+ throw e;
}
}
diff --git a/cpp/demo/Freeze/phonebook/RunParser.cpp b/cpp/demo/Freeze/phonebook/RunParser.cpp
index eac469e60e1..6fce1244c50 100644
--- a/cpp/demo/Freeze/phonebook/RunParser.cpp
+++ b/cpp/demo/Freeze/phonebook/RunParser.cpp
@@ -17,13 +17,13 @@ void
usage(const char* appName)
{
cerr << "Usage: " << appName << " [options] [file...]\n";
- cerr <<
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.\n"
- "-e COMMANDS Execute COMMANDS.\n"
- "-d, --debug Print debug messages.\n"
- ;
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-e COMMANDS Execute COMMANDS.\n"
+ "-d, --debug Print debug messages.\n"
+ ;
}
int
@@ -35,67 +35,67 @@ runParser(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
int idx = 1;
while(idx < argc)
{
- if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
- {
- usage(argv[0]);
- return EXIT_SUCCESS;
- }
- else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
- {
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
- }
- else if(strcmp(argv[idx], "-e") == 0)
- {
- if(idx + 1 >= argc)
+ if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else if(strcmp(argv[idx], "-e") == 0)
+ {
+ if(idx + 1 >= argc)
{
- cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
-
- commands += argv[idx + 1];
- commands += ';';
+
+ commands += argv[idx + 1];
+ commands += ';';
- for(int i = idx ; i + 2 < argc ; ++i)
- {
- argv[i] = argv[i + 2];
- }
- argc -= 2;
- }
- else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
- {
- debug = true;
- for(int i = idx ; i + 1 < argc ; ++i)
- {
- argv[i] = argv[i + 1];
- }
- --argc;
- }
- else if(argv[idx][0] == '-')
- {
- cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- else
- {
- ++idx;
- }
+ for(int i = idx ; i + 2 < argc ; ++i)
+ {
+ argv[i] = argv[i + 2];
+ }
+ argc -= 2;
+ }
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ {
+ debug = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if(argv[idx][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ ++idx;
+ }
}
if(argc >= 2 && !commands.empty())
{
- cerr << argv[0] << ": `-e' option cannot be used if input files are given" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `-e' option cannot be used if input files are given" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
PhoneBookPrx phoneBook = PhoneBookPrx::checkedCast(communicator->propertyToProxy("PhoneBook.Proxy"));
if(!phoneBook)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
ParserPtr p = Parser::createParser(phoneBook);
@@ -103,43 +103,43 @@ runParser(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
if(argc < 2) // No files given
{
- if(!commands.empty()) // Commands were given
- {
- int parseStatus = p->parse(commands, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
- else // No commands, let's use standard input
- {
- int parseStatus = p->parse(stdin, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
+ if(!commands.empty()) // Commands were given
+ {
+ int parseStatus = p->parse(commands, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ else // No commands, let's use standard input
+ {
+ int parseStatus = p->parse(stdin, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
}
else // Process files given on the command line
{
- for(idx = 1 ; idx < argc ; ++idx)
- {
- FILE* file = fopen(argv[idx], "r");
- if(file == NULL)
- {
- cerr << argv[0] << ": can't open file `" << argv[idx] << "': " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
-
- int parseStatus = p->parse(file, debug);
+ for(idx = 1 ; idx < argc ; ++idx)
+ {
+ FILE* file = fopen(argv[idx], "r");
+ if(file == NULL)
+ {
+ cerr << argv[0] << ": can't open file `" << argv[idx] << "': " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+
+ int parseStatus = p->parse(file, debug);
- fclose(file);
+ fclose(file);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
}
return status;
diff --git a/cpp/demo/Freeze/phonebook/Server.cpp b/cpp/demo/Freeze/phonebook/Server.cpp
index e21d25b485d..13f49990880 100644
--- a/cpp/demo/Freeze/phonebook/Server.cpp
+++ b/cpp/demo/Freeze/phonebook/Server.cpp
@@ -20,7 +20,7 @@ class PhoneBookServer : public Ice::Application
public:
PhoneBookServer(const string& envName) :
- _envName(envName)
+ _envName(envName)
{
}
@@ -74,7 +74,7 @@ PhoneBookServer::run(int argc, char* argv[])
Ice::Int evictorSize = properties->getPropertyAsInt("PhoneBook.EvictorSize");
if(evictorSize > 0)
{
- evictor->setSize(evictorSize);
+ evictor->setSize(evictorSize);
}
//
diff --git a/cpp/demo/Glacier2/callback/CallbackI.cpp b/cpp/demo/Glacier2/callback/CallbackI.cpp
index fb9ff794970..24389d5541a 100644
--- a/cpp/demo/Glacier2/callback/CallbackI.cpp
+++ b/cpp/demo/Glacier2/callback/CallbackI.cpp
@@ -18,14 +18,14 @@ CallbackReceiverI::callback(const Ice::Current&)
{
#ifdef __xlC__
- //
- // The xlC compiler synchronizes cin and cout; to see the messages
- // while accepting input through cin, we have to print the messages
- // with printf
- //
+ //
+ // The xlC compiler synchronizes cin and cout; to see the messages
+ // while accepting input through cin, we have to print the messages
+ // with printf
+ //
- printf("received callback\n");
- fflush(0);
+ printf("received callback\n");
+ fflush(0);
#else
cout << "received callback" << endl;
#endif
@@ -37,11 +37,11 @@ CallbackI::initiateCallback(const CallbackReceiverPrx& proxy, const Ice::Current
cout << "initiating callback to: " << current.adapter->getCommunicator()->proxyToString(proxy) << endl;
try
{
- proxy->callback(current.ctx);
+ proxy->callback(current.ctx);
}
catch(const Ice::Exception& ex)
{
- cout << ex << endl;
+ cout << ex << endl;
}
}
@@ -51,10 +51,10 @@ CallbackI::shutdown(const Ice::Current& c)
cout << "shutting down..." << endl;
try
{
- c.adapter->getCommunicator()->shutdown();
+ c.adapter->getCommunicator()->shutdown();
}
catch(const Ice::Exception& ex)
{
- cout << ex << endl;
+ cout << ex << endl;
}
}
diff --git a/cpp/demo/Glacier2/callback/Client.cpp b/cpp/demo/Glacier2/callback/Client.cpp
index 063ea984470..c8623250faf 100644
--- a/cpp/demo/Glacier2/callback/Client.cpp
+++ b/cpp/demo/Glacier2/callback/Client.cpp
@@ -33,16 +33,16 @@ void
menu()
{
cout <<
- "usage:\n"
- "t: invoke callback as twoway\n"
- "o: invoke callback as oneway\n"
- "O: invoke callback as batch oneway\n"
- "f: flush all batch requests\n"
- "v: set/reset override context field\n"
- "F: set/reset fake category\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: invoke callback as twoway\n"
+ "o: invoke callback as oneway\n"
+ "O: invoke callback as batch oneway\n"
+ "f: flush all batch requests\n"
+ "v: set/reset override context field\n"
+ "F: set/reset fake category\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
int
@@ -57,38 +57,38 @@ CallbackClient::run(int argc, char* argv[])
Ice::RouterPrx defaultRouter = communicator()->getDefaultRouter();
if(!defaultRouter)
{
- cerr << argv[0] << ": no default router set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no default router set" << endl;
+ return EXIT_FAILURE;
}
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(defaultRouter);
if(!router)
{
- cerr << argv[0] << ": configured router is not a Glacier2 router" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": configured router is not a Glacier2 router" << endl;
+ return EXIT_FAILURE;
}
while(true)
{
- cout << "This demo accepts any user-id / password combination.\n";
+ cout << "This demo accepts any user-id / password combination.\n";
- string id;
- cout << "user id: " << flush;
- cin >> id;
+ string id;
+ cout << "user id: " << flush;
+ cin >> id;
- string pw;
- cout << "password: " << flush;
- cin >> pw;
+ string pw;
+ cout << "password: " << flush;
+ cin >> pw;
- try
- {
- router->createSession(id, pw);
- break;
- }
- catch(const Glacier2::PermissionDeniedException& ex)
- {
- cout << "permission denied:\n" << ex.reason << endl;
- }
+ try
+ {
+ router->createSession(id, pw);
+ break;
+ }
+ catch(const Glacier2::PermissionDeniedException& ex)
+ {
+ cout << "permission denied:\n" << ex.reason << endl;
+ }
}
Ice::Identity callbackReceiverIdent;
@@ -119,97 +119,97 @@ CallbackClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- Ice::Context context;
- context["_fwd"] = "t";
- if(!override.empty())
- {
- context["_ovrd"] = override;
- }
- twoway->initiateCallback(twowayR, context);
- }
- else if(c == 'o')
- {
- Ice::Context context;
- context["_fwd"] = "o";
- if(!override.empty())
- {
- context["_ovrd"] = override;
- }
- oneway->initiateCallback(onewayR, context);
- }
- else if(c == 'O')
- {
- Ice::Context context;
- context["_fwd"] = "O";
- if(!override.empty())
- {
- context["_ovrd"] = override;
- }
- batchOneway->initiateCallback(onewayR, context);
- }
- else if(c == 'f')
- {
- communicator()->flushBatchRequests();
- }
- else if(c == 'v')
- {
- if(override.empty())
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ Ice::Context context;
+ context["_fwd"] = "t";
+ if(!override.empty())
{
- override = "some_value";
- cout << "override context field is now `" << override << "'" << endl;
- }
- else
- {
- override.clear();
- cout << "override context field is empty" << endl;
- }
- }
- else if(c == 'F')
- {
- fake = !fake;
-
- if(fake)
- {
- twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_identity(callbackReceiverFakeIdent));
- onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_identity(callbackReceiverFakeIdent));
- }
- else
- {
- twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_identity(callbackReceiverIdent));
- onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_identity(callbackReceiverIdent));
- }
-
- cout << "callback receiver identity: " << communicator()->identityToString(twowayR->ice_getIdentity())
- << endl;
- }
- else if(c == 's')
- {
- twoway->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ context["_ovrd"] = override;
+ }
+ twoway->initiateCallback(twowayR, context);
+ }
+ else if(c == 'o')
+ {
+ Ice::Context context;
+ context["_fwd"] = "o";
+ if(!override.empty())
+ {
+ context["_ovrd"] = override;
+ }
+ oneway->initiateCallback(onewayR, context);
+ }
+ else if(c == 'O')
+ {
+ Ice::Context context;
+ context["_fwd"] = "O";
+ if(!override.empty())
+ {
+ context["_ovrd"] = override;
+ }
+ batchOneway->initiateCallback(onewayR, context);
+ }
+ else if(c == 'f')
+ {
+ communicator()->flushBatchRequests();
+ }
+ else if(c == 'v')
+ {
+ if(override.empty())
+ {
+ override = "some_value";
+ cout << "override context field is now `" << override << "'" << endl;
+ }
+ else
+ {
+ override.clear();
+ cout << "override context field is empty" << endl;
+ }
+ }
+ else if(c == 'F')
+ {
+ fake = !fake;
+
+ if(fake)
+ {
+ twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_identity(callbackReceiverFakeIdent));
+ onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_identity(callbackReceiverFakeIdent));
+ }
+ else
+ {
+ twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_identity(callbackReceiverIdent));
+ onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_identity(callbackReceiverIdent));
+ }
+
+ cout << "callback receiver identity: " << communicator()->identityToString(twowayR->ice_getIdentity())
+ << endl;
+ }
+ else if(c == 's')
+ {
+ twoway->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -221,15 +221,15 @@ CallbackClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/Glacier2/callback/SessionI.cpp b/cpp/demo/Glacier2/callback/SessionI.cpp
index 7169270aac9..8bd4a13e769 100644
--- a/cpp/demo/Glacier2/callback/SessionI.cpp
+++ b/cpp/demo/Glacier2/callback/SessionI.cpp
@@ -14,7 +14,7 @@ using namespace std;
bool
DummyPermissionsVerifierI::checkPermissions(const string& userId, const string& password, string&,
- const Ice::Current&) const
+ const Ice::Current&) const
{
cout << "verified user `" << userId << "' with password `" << password << "'" << endl;
return true;
diff --git a/cpp/demo/Glacier2/chat/ChatSessionI.cpp b/cpp/demo/Glacier2/chat/ChatSessionI.cpp
index 33cfe63ad35..21e5c3c5e7e 100755
--- a/cpp/demo/Glacier2/chat/ChatSessionI.cpp
+++ b/cpp/demo/Glacier2/chat/ChatSessionI.cpp
@@ -44,7 +44,7 @@ ChatRoom::instance()
IceUtil::StaticMutex::Lock sync(_instanceMutex);
if(!_instance)
{
- _instance = new ChatRoom;
+ _instance = new ChatRoom;
}
return _instance;
@@ -64,10 +64,10 @@ ChatRoom::leave(const ChatCallbackPrx& callback)
list<ChatCallbackPrx>::iterator p;
for(p = _members.begin(); p != _members.end(); ++p)
{
- if(Ice::proxyIdentityEqual(callback, *p))
- {
- break;
- }
+ if(Ice::proxyIdentityEqual(callback, *p))
+ {
+ break;
+ }
}
assert(p != _members.end());
@@ -80,13 +80,13 @@ ChatRoom::message(const string& data) const
Lock sync(*this);
for(list<ChatCallbackPrx>::const_iterator p = _members.begin(); p != _members.end(); ++p)
{
- try
- {
- (*p)->message(data);
- }
- catch(const Ice::LocalException&)
- {
- }
+ try
+ {
+ (*p)->message(data);
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
}
}
@@ -101,10 +101,10 @@ ChatSessionI::setCallback(const ChatCallbackPrx& callback, const Ice::Current& c
Lock sync(*this);
if(!_callback)
{
- _callback = callback;
- ChatRoomPtr chatRoom = ChatRoom::instance();
- chatRoom->message(_userId + " has entered the chat room.");
- chatRoom->enter(callback);
+ _callback = callback;
+ ChatRoomPtr chatRoom = ChatRoom::instance();
+ chatRoom->message(_userId + " has entered the chat room.");
+ chatRoom->enter(callback);
}
}
@@ -120,10 +120,10 @@ ChatSessionI::destroy(const Ice::Current& current)
Lock sync(*this);
if(_callback)
{
- ChatRoomPtr chatRoom = ChatRoom::instance();
- chatRoom->leave(_callback);
- _callback = 0;
- chatRoom->message(_userId + " has left the chat room.");
+ ChatRoomPtr chatRoom = ChatRoom::instance();
+ chatRoom->leave(_callback);
+ _callback = 0;
+ chatRoom->message(_userId + " has left the chat room.");
}
current.adapter->remove(current.id);
}
diff --git a/cpp/demo/Glacier2/chat/Client.cpp b/cpp/demo/Glacier2/chat/Client.cpp
index 4aadf845f5c..d6c9c46da19 100755
--- a/cpp/demo/Glacier2/chat/Client.cpp
+++ b/cpp/demo/Glacier2/chat/Client.cpp
@@ -73,16 +73,16 @@ public:
{
#ifdef __xlC__
- //
- // The xlC compiler synchronizes cin and cout; to see the messages
- // while accepting input through cin, we have to print the messages
- // with printf
- //
-
- printf("%s\n", data.c_str());
- fflush(0);
+ //
+ // The xlC compiler synchronizes cin and cout; to see the messages
+ // while accepting input through cin, we have to print the messages
+ // with printf
+ //
+
+ printf("%s\n", data.c_str());
+ fflush(0);
#else
- cout << data << endl;
+ cout << data << endl;
#endif
}
};
@@ -94,128 +94,128 @@ public:
virtual int
run(int argc, char* argv[])
{
- //
- // Since this is an interactive demo we want the custom interrupt
- // callback to be called when the process is interrupted.
- //
- callbackOnInterrupt();
-
- {
- IceUtil::Mutex::Lock sync(_mutex);
- Ice::RouterPrx defaultRouter = communicator()->getDefaultRouter();
- if(!defaultRouter)
- {
- cerr << argv[0] << ": no default router set" << endl;
- return EXIT_FAILURE;
- }
-
- _router = Glacier2::RouterPrx::checkedCast(defaultRouter);
- if(!_router)
- {
- cerr << argv[0] << ": configured router is not a Glacier2 router" << endl;
- return EXIT_FAILURE;
- }
- }
-
- ChatSessionPrx session;
- while(true)
- {
- cout << "This demo accepts any user-id / password combination.\n";
-
- string id;
- cout << "user id: " << flush;
- getline(cin, id);
- id = trim(id);
-
- string pw;
- cout << "password: " << flush;
- getline(cin, pw);
- pw = trim(pw);
-
- try
- {
- session = ChatSessionPrx::uncheckedCast(_router->createSession(id, pw));
- break;
- }
- catch(const Glacier2::PermissionDeniedException& ex)
- {
- cout << "permission denied:\n" << ex.reason << endl;
- }
- }
-
- {
- IceUtil::Mutex::Lock sync(_mutex);
- _ping = new SessionPingThread(session, (long)_router->getSessionTimeout() / 2);
- _ping->start();
- }
-
- Ice::Identity callbackReceiverIdent;
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = _router->getCategoryForClient();
-
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Chat.Client");
- ChatCallbackPrx callback = ChatCallbackPrx::uncheckedCast(
- adapter->add(new ChatCallbackI, callbackReceiverIdent));
- adapter->activate();
-
- session->setCallback(callback);
-
- menu();
-
- try
- {
- do
- {
- string s;
- cout << "==> ";
- getline(cin, s);
- s = trim(s);
- if(!s.empty())
- {
- if(s[0] == '/')
- {
- if(s == "/quit")
- {
- break;
- }
- menu();
- }
- else
- {
- session->say(s);
- }
- }
- }
- while(cin.good());
-
- cleanup();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- cleanup();
-
- return EXIT_FAILURE;
- }
- return EXIT_SUCCESS;
+ //
+ // Since this is an interactive demo we want the custom interrupt
+ // callback to be called when the process is interrupted.
+ //
+ callbackOnInterrupt();
+
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ Ice::RouterPrx defaultRouter = communicator()->getDefaultRouter();
+ if(!defaultRouter)
+ {
+ cerr << argv[0] << ": no default router set" << endl;
+ return EXIT_FAILURE;
+ }
+
+ _router = Glacier2::RouterPrx::checkedCast(defaultRouter);
+ if(!_router)
+ {
+ cerr << argv[0] << ": configured router is not a Glacier2 router" << endl;
+ return EXIT_FAILURE;
+ }
+ }
+
+ ChatSessionPrx session;
+ while(true)
+ {
+ cout << "This demo accepts any user-id / password combination.\n";
+
+ string id;
+ cout << "user id: " << flush;
+ getline(cin, id);
+ id = trim(id);
+
+ string pw;
+ cout << "password: " << flush;
+ getline(cin, pw);
+ pw = trim(pw);
+
+ try
+ {
+ session = ChatSessionPrx::uncheckedCast(_router->createSession(id, pw));
+ break;
+ }
+ catch(const Glacier2::PermissionDeniedException& ex)
+ {
+ cout << "permission denied:\n" << ex.reason << endl;
+ }
+ }
+
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ _ping = new SessionPingThread(session, (long)_router->getSessionTimeout() / 2);
+ _ping->start();
+ }
+
+ Ice::Identity callbackReceiverIdent;
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = _router->getCategoryForClient();
+
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Chat.Client");
+ ChatCallbackPrx callback = ChatCallbackPrx::uncheckedCast(
+ adapter->add(new ChatCallbackI, callbackReceiverIdent));
+ adapter->activate();
+
+ session->setCallback(callback);
+
+ menu();
+
+ try
+ {
+ do
+ {
+ string s;
+ cout << "==> ";
+ getline(cin, s);
+ s = trim(s);
+ if(!s.empty())
+ {
+ if(s[0] == '/')
+ {
+ if(s == "/quit")
+ {
+ break;
+ }
+ menu();
+ }
+ else
+ {
+ session->say(s);
+ }
+ }
+ }
+ while(cin.good());
+
+ cleanup();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ cleanup();
+
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
}
virtual void
interruptCallback(int)
{
- try
- {
- communicator()->destroy();
- }
- catch(const IceUtil::Exception& ex)
- {
- cerr << appName() << ": " << ex << endl;
- }
- catch(...)
- {
- cerr << appName() << ": unknown exception" << endl;
- }
- exit(EXIT_SUCCESS);
+ try
+ {
+ communicator()->destroy();
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ cerr << appName() << ": " << ex << endl;
+ }
+ catch(...)
+ {
+ cerr << appName() << ": unknown exception" << endl;
+ }
+ exit(EXIT_SUCCESS);
}
private:
@@ -223,45 +223,45 @@ private:
void
cleanup()
{
- IceUtil::Mutex::Lock sync(_mutex);
- if(_router)
- {
- try
- {
- _router->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- //
- // Expected: the router closed the connection.
- //
- }
- _router = 0;
- }
- if(_ping)
- {
- _ping->destroy();
- _ping->getThreadControl().join();
- _ping = 0;
- }
+ IceUtil::Mutex::Lock sync(_mutex);
+ if(_router)
+ {
+ try
+ {
+ _router->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ //
+ // Expected: the router closed the connection.
+ //
+ }
+ _router = 0;
+ }
+ if(_ping)
+ {
+ _ping->destroy();
+ _ping->getThreadControl().join();
+ _ping = 0;
+ }
}
void
menu()
{
- cout << "enter /quit to exit." << endl;
+ cout << "enter /quit to exit." << endl;
}
string
trim(const string& s)
{
- static const string delims = "\t\r\n ";
- string::size_type last = s.find_last_not_of(delims);
- if(last != string::npos)
- {
- return s.substr(s.find_first_not_of(delims), last+1);
- }
- return s;
+ static const string delims = "\t\r\n ";
+ string::size_type last = s.find_last_not_of(delims);
+ if(last != string::npos)
+ {
+ return s.substr(s.find_first_not_of(delims), last+1);
+ }
+ return s;
}
IceUtil::Mutex _mutex;
diff --git a/cpp/demo/Glacier2/chat/Server.cpp b/cpp/demo/Glacier2/chat/Server.cpp
index e2a26e34c21..53c811a3b64 100755
--- a/cpp/demo/Glacier2/chat/Server.cpp
+++ b/cpp/demo/Glacier2/chat/Server.cpp
@@ -21,7 +21,7 @@ public:
virtual Glacier2::SessionPrx
create(const string& userId, const Glacier2::SessionControlPrx&, const Ice::Current& current)
{
- return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(new ChatSessionI(userId)));
+ return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(new ChatSessionI(userId)));
}
};
@@ -32,13 +32,13 @@ public:
virtual int
run(int, char*[])
{
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("ChatServer");
-
- adapter->add(new ChatSessionManagerI, communicator()->stringToIdentity("ChatSessionManager"));
- adapter->activate();
- communicator()->waitForShutdown();
-
- return EXIT_SUCCESS;
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("ChatServer");
+
+ adapter->add(new ChatSessionManagerI, communicator()->stringToIdentity("ChatSessionManager"));
+ adapter->activate();
+ communicator()->waitForShutdown();
+
+ return EXIT_SUCCESS;
}
};
diff --git a/cpp/demo/Ice/MFC/client/HelloClient.cpp b/cpp/demo/Ice/MFC/client/HelloClient.cpp
index 73d4a30e6f5..cc97e071f20 100644
--- a/cpp/demo/Ice/MFC/client/HelloClient.cpp
+++ b/cpp/demo/Ice/MFC/client/HelloClient.cpp
@@ -48,9 +48,9 @@ CHelloClientApp::InitInstance()
try
{
int argc = 0;
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+ initData.properties->load("config");
communicator = Ice::initialize(argc, 0, initData);
}
catch(const IceUtil::Exception& ex)
diff --git a/cpp/demo/Ice/MFC/client/stdafx.h b/cpp/demo/Ice/MFC/client/stdafx.h
index 81d5a220522..6ad764438f9 100644
--- a/cpp/demo/Ice/MFC/client/stdafx.h
+++ b/cpp/demo/Ice/MFC/client/stdafx.h
@@ -22,30 +22,30 @@
#endif
#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
-#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
-#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
#if 0
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
-#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#endif
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS
@@ -53,9 +53,9 @@
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
+#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <Ice/Ice.h>
diff --git a/cpp/demo/Ice/MFC/server/HelloServer.cpp b/cpp/demo/Ice/MFC/server/HelloServer.cpp
index 064b6e4e0cf..6d60db6f561 100644
--- a/cpp/demo/Ice/MFC/server/HelloServer.cpp
+++ b/cpp/demo/Ice/MFC/server/HelloServer.cpp
@@ -51,11 +51,11 @@ BOOL CHelloServerApp::InitInstance()
try
{
int argc = 0;
- Ice::InitializationData initData;
+ Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- initData.properties->load("config");
+ initData.properties->load("config");
log = new LogI;
- initData.logger = log;
+ initData.logger = log;
communicator = Ice::initialize(argc, 0, initData);
adapter = communicator->createObjectAdapter("Hello");
}
diff --git a/cpp/demo/Ice/MFC/server/LogI.cpp b/cpp/demo/Ice/MFC/server/LogI.cpp
index a8c18c4e2f5..2e153f952f7 100644
--- a/cpp/demo/Ice/MFC/server/LogI.cpp
+++ b/cpp/demo/Ice/MFC/server/LogI.cpp
@@ -66,7 +66,7 @@ LogI::message(const string& msg)
string line = msg + "\r\n";
if(_hwnd)
{
- post(line);
+ post(line);
}
else
{
@@ -80,7 +80,7 @@ LogI::setHandle(HWND hwnd)
_hwnd = hwnd;
if(_hwnd != 0 && !_buffer.empty())
{
- post(_buffer);
+ post(_buffer);
_buffer.clear();
}
}
diff --git a/cpp/demo/Ice/MFC/server/stdafx.h b/cpp/demo/Ice/MFC/server/stdafx.h
index 81d5a220522..6ad764438f9 100644
--- a/cpp/demo/Ice/MFC/server/stdafx.h
+++ b/cpp/demo/Ice/MFC/server/stdafx.h
@@ -22,30 +22,30 @@
#endif
#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
-#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
-#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
#if 0
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
-#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#endif
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS
@@ -53,9 +53,9 @@
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
+#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <Ice/Ice.h>
diff --git a/cpp/demo/Ice/async/Client.cpp b/cpp/demo/Ice/async/Client.cpp
index cb3e7e862c0..e164fb18cc3 100644
--- a/cpp/demo/Ice/async/Client.cpp
+++ b/cpp/demo/Ice/async/Client.cpp
@@ -54,8 +54,8 @@ AsyncClient::run(int argc, char* argv[])
HelloPrx hello = HelloPrx::checkedCast(communicator()->propertyToProxy("Hello.Proxy"));
if(!hello)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
menu();
@@ -63,40 +63,40 @@ AsyncClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 'i')
- {
- hello->sayHello(0);
- }
- else if(c == 'd')
- {
- hello->sayHello_async(new AMI_Hello_sayHelloI, 5000);
- }
- else if(c == 's')
- {
- hello->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 'i')
+ {
+ hello->sayHello(0);
+ }
+ else if(c == 'd')
+ {
+ hello->sayHello_async(new AMI_Hello_sayHelloI, 5000);
+ }
+ else if(c == 's')
+ {
+ hello->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -125,10 +125,10 @@ void
AsyncClient::menu()
{
cout <<
- "usage:\n"
- "i: send immediate greeting\n"
- "d: send delayed greeting\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "i: send immediate greeting\n"
+ "d: send delayed greeting\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
diff --git a/cpp/demo/Ice/async/WorkQueue.cpp b/cpp/demo/Ice/async/WorkQueue.cpp
index 0493b8087ab..fc506938210 100644
--- a/cpp/demo/Ice/async/WorkQueue.cpp
+++ b/cpp/demo/Ice/async/WorkQueue.cpp
@@ -25,34 +25,34 @@ WorkQueue::run()
while(!_done)
{
if(_callbacks.size() == 0)
- {
- _monitor.wait();
- }
+ {
+ _monitor.wait();
+ }
- if(_callbacks.size() != 0)
- {
- //
- // Get next work item.
- //
- CallbackEntry entry = _callbacks.front();
+ if(_callbacks.size() != 0)
+ {
+ //
+ // Get next work item.
+ //
+ CallbackEntry entry = _callbacks.front();
- //
- // Wait for the amount of time indicated in delay to
- // emulate a process that takes a significant period of
- // time to complete.
- //
- _monitor.timedWait(IceUtil::Time::milliSeconds(entry.delay));
+ //
+ // Wait for the amount of time indicated in delay to
+ // emulate a process that takes a significant period of
+ // time to complete.
+ //
+ _monitor.timedWait(IceUtil::Time::milliSeconds(entry.delay));
- if(!_done)
- {
- //
- // Print greeting and send response.
- //
- _callbacks.pop_front();
- cout << "Belated Hello World!" << endl;
- entry.cb->ice_response();
- }
- }
+ if(!_done)
+ {
+ //
+ // Print greeting and send response.
+ //
+ _callbacks.pop_front();
+ cout << "Belated Hello World!" << endl;
+ entry.cb->ice_response();
+ }
+ }
}
//
@@ -79,17 +79,17 @@ WorkQueue::add(const Demo::AMD_Hello_sayHelloPtr& cb, int delay)
entry.cb = cb;
entry.delay = delay;
- if(_callbacks.size() == 0)
- {
+ if(_callbacks.size() == 0)
+ {
_monitor.notify();
- }
+ }
_callbacks.push_back(entry);
}
else
{
//
- // Destroyed, throw exception.
- //
+ // Destroyed, throw exception.
+ //
cb->ice_exception(Demo::RequestCanceledException());
}
}
diff --git a/cpp/demo/Ice/async/WorkQueue.h b/cpp/demo/Ice/async/WorkQueue.h
index 9147b2f615d..47c3ebf04da 100644
--- a/cpp/demo/Ice/async/WorkQueue.h
+++ b/cpp/demo/Ice/async/WorkQueue.h
@@ -33,7 +33,7 @@ private:
struct CallbackEntry
{
Demo::AMD_Hello_sayHelloPtr cb;
- int delay;
+ int delay;
};
IceUtil::Monitor<IceUtil::Mutex> _monitor;
diff --git a/cpp/demo/Ice/bidir/CallbackI.cpp b/cpp/demo/Ice/bidir/CallbackI.cpp
index 05c6e288d82..d24888c0dd3 100644
--- a/cpp/demo/Ice/bidir/CallbackI.cpp
+++ b/cpp/demo/Ice/bidir/CallbackI.cpp
@@ -28,15 +28,15 @@ CallbackSenderI::destroy()
IceUtil::ThreadPtr callbackSenderThread;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- cout << "destroying callback sender" << endl;
- _destroy = true;
-
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ cout << "destroying callback sender" << endl;
+ _destroy = true;
+
+ notify();
- callbackSenderThread = _callbackSenderThread;
- _callbackSenderThread = 0; // Resolve cyclic dependency.
+ callbackSenderThread = _callbackSenderThread;
+ _callbackSenderThread = 0; // Resolve cyclic dependency.
}
callbackSenderThread->getThreadControl().join();
@@ -66,27 +66,27 @@ CallbackSenderI::run()
while(!_destroy)
{
- timedWait(IceUtil::Time::seconds(2));
+ timedWait(IceUtil::Time::seconds(2));
- if(!_destroy && !_clients.empty())
- {
- ++_num;
-
- set<CallbackReceiverPrx>::iterator p = _clients.begin();
- while(p != _clients.end())
- {
- try
- {
- (*p)->callback(_num);
- ++p;
- }
- catch(const Exception& ex)
- {
- cerr << "removing client `" << _communicator->identityToString((*p)->ice_getIdentity()) << "':\n"
- << ex << endl;
- _clients.erase(p++);
- }
- }
- }
+ if(!_destroy && !_clients.empty())
+ {
+ ++_num;
+
+ set<CallbackReceiverPrx>::iterator p = _clients.begin();
+ while(p != _clients.end())
+ {
+ try
+ {
+ (*p)->callback(_num);
+ ++p;
+ }
+ catch(const Exception& ex)
+ {
+ cerr << "removing client `" << _communicator->identityToString((*p)->ice_getIdentity()) << "':\n"
+ << ex << endl;
+ _clients.erase(p++);
+ }
+ }
+ }
}
}
diff --git a/cpp/demo/Ice/bidir/CallbackI.h b/cpp/demo/Ice/bidir/CallbackI.h
index 2af7a28bce7..e99789bfa31 100644
--- a/cpp/demo/Ice/bidir/CallbackI.h
+++ b/cpp/demo/Ice/bidir/CallbackI.h
@@ -48,19 +48,19 @@ private:
{
public:
- CallbackSenderThread(const CallbackSenderIPtr& callbackSender) :
- _callbackSender(callbackSender)
- {
- }
+ CallbackSenderThread(const CallbackSenderIPtr& callbackSender) :
+ _callbackSender(callbackSender)
+ {
+ }
- virtual void run()
- {
- _callbackSender->run();
- }
+ virtual void run()
+ {
+ _callbackSender->run();
+ }
private:
- const CallbackSenderIPtr _callbackSender;
+ const CallbackSenderIPtr _callbackSender;
};
IceUtil::ThreadPtr _callbackSenderThread;
diff --git a/cpp/demo/Ice/bidir/Client.cpp b/cpp/demo/Ice/bidir/Client.cpp
index a7e8198ab45..9dbd44ab388 100644
--- a/cpp/demo/Ice/bidir/Client.cpp
+++ b/cpp/demo/Ice/bidir/Client.cpp
@@ -21,7 +21,7 @@ public:
virtual void
callback(Ice::Int num, const Ice::Current&)
{
- cout << "received callback #" << num << endl;
+ cout << "received callback #" << num << endl;
}
};
@@ -46,8 +46,8 @@ CallbackClient::run(int argc, char* argv[])
CallbackSenderPrx::checkedCast(communicator()->propertyToProxy("Callback.Client.CallbackServer"));
if(!server)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("");
diff --git a/cpp/demo/Ice/bidir/Server.cpp b/cpp/demo/Ice/bidir/Server.cpp
index a311635864c..170d12ad77d 100644
--- a/cpp/demo/Ice/bidir/Server.cpp
+++ b/cpp/demo/Ice/bidir/Server.cpp
@@ -38,12 +38,12 @@ CallbackServer::run(int argc, char* argv[])
sender->start();
try
{
- communicator()->waitForShutdown();
+ communicator()->waitForShutdown();
}
catch(...)
{
- sender->destroy();
- throw;
+ sender->destroy();
+ throw;
}
sender->destroy();
diff --git a/cpp/demo/Ice/callback/CallbackSenderI.cpp b/cpp/demo/Ice/callback/CallbackSenderI.cpp
index 302dbecdba4..f50c47e7a32 100644
--- a/cpp/demo/Ice/callback/CallbackSenderI.cpp
+++ b/cpp/demo/Ice/callback/CallbackSenderI.cpp
@@ -20,11 +20,11 @@ CallbackSenderI::initiateCallback(const CallbackReceiverPrx& proxy, const Curren
cout << "initiating callback" << endl;
try
{
- proxy->callback(current.ctx);
+ proxy->callback(current.ctx);
}
catch(const Exception& ex)
{
- cout << ex << endl;
+ cout << ex << endl;
}
}
@@ -34,10 +34,10 @@ CallbackSenderI::shutdown(const Current& c)
cout << "shutting down..." << endl;
try
{
- c.adapter->getCommunicator()->shutdown();
+ c.adapter->getCommunicator()->shutdown();
}
catch(const Exception& ex)
{
- cout << ex << endl;
+ cout << ex << endl;
}
}
diff --git a/cpp/demo/Ice/callback/Client.cpp b/cpp/demo/Ice/callback/Client.cpp
index 83959a1e5fe..a68bed47b99 100644
--- a/cpp/demo/Ice/callback/Client.cpp
+++ b/cpp/demo/Ice/callback/Client.cpp
@@ -20,15 +20,15 @@ public:
virtual void callback(const Ice::Current&)
{
#ifdef __xlC__
- //
- // The xlC compiler synchronizes cin and cout; to see the messages
- // while accepting input through cin, we have to print the messages
- // with printf
- //
- printf("received callback\n");
- fflush(0);
+ //
+ // The xlC compiler synchronizes cin and cout; to see the messages
+ // while accepting input through cin, we have to print the messages
+ // with printf
+ //
+ printf("received callback\n");
+ fflush(0);
#else
- cout << "received callback" << endl;
+ cout << "received callback" << endl;
#endif
}
};
@@ -62,12 +62,12 @@ CallbackClient::run(int argc, char* argv[])
callbackOnInterrupt();
CallbackSenderPrx twoway = CallbackSenderPrx::checkedCast(
- communicator()->propertyToProxy("Callback.Client.CallbackServer")->
- ice_twoway()->ice_timeout(-1)->ice_secure(false));
+ communicator()->propertyToProxy("Callback.Client.CallbackServer")->
+ ice_twoway()->ice_timeout(-1)->ice_secure(false));
if(!twoway)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
CallbackSenderPrx oneway = CallbackSenderPrx::uncheckedCast(twoway->ice_oneway());
CallbackSenderPrx batchOneway = CallbackSenderPrx::uncheckedCast(twoway->ice_batchOneway());
@@ -79,7 +79,7 @@ CallbackClient::run(int argc, char* argv[])
adapter->activate();
CallbackReceiverPrx twowayR = CallbackReceiverPrx::uncheckedCast(
- adapter->createProxy(communicator()->stringToIdentity("callbackReceiver")));
+ adapter->createProxy(communicator()->stringToIdentity("callbackReceiver")));
CallbackReceiverPrx onewayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_oneway());
CallbackReceiverPrx datagramR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_datagram());
@@ -91,24 +91,24 @@ CallbackClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- twoway->initiateCallback(twowayR);
- }
- else if(c == 'o')
- {
- oneway->initiateCallback(onewayR);
- }
- else if(c == 'O')
- {
- batchOneway->initiateCallback(onewayR);
- }
- else if(c == 'd')
- {
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ twoway->initiateCallback(twowayR);
+ }
+ else if(c == 'o')
+ {
+ oneway->initiateCallback(onewayR);
+ }
+ else if(c == 'O')
+ {
+ batchOneway->initiateCallback(onewayR);
+ }
+ else if(c == 'd')
+ {
if(secure)
{
cout << "secure datagrams are not supported" << endl;
@@ -117,9 +117,9 @@ CallbackClient::run(int argc, char* argv[])
{
datagram->initiateCallback(datagramR);
}
- }
- else if(c == 'D')
- {
+ }
+ else if(c == 'D')
+ {
if(secure)
{
cout << "secure datagrams are not supported" << endl;
@@ -128,57 +128,57 @@ CallbackClient::run(int argc, char* argv[])
{
batchDatagram->initiateCallback(datagramR);
}
- }
- else if(c == 'f')
- {
- communicator()->flushBatchRequests();
- }
- else if(c == 'S')
- {
- secure = !secure;
- secureStr = secure ? "s" : "";
-
- twoway = CallbackSenderPrx::uncheckedCast(twoway->ice_secure(secure));
- oneway = CallbackSenderPrx::uncheckedCast(oneway->ice_secure(secure));
- batchOneway = CallbackSenderPrx::uncheckedCast(batchOneway->ice_secure(secure));
- datagram = CallbackSenderPrx::uncheckedCast(datagram->ice_secure(secure));
- batchDatagram = CallbackSenderPrx::uncheckedCast(batchDatagram->ice_secure(secure));
-
- twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_secure(secure));
- onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_secure(secure));
- datagramR = CallbackReceiverPrx::uncheckedCast(datagramR->ice_secure(secure));
-
- if(secure)
- {
- cout << "secure mode is now on" << endl;
- }
- else
- {
- cout << "secure mode is now off" << endl;
- }
- }
- else if(c == 's')
- {
- twoway->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ }
+ else if(c == 'f')
+ {
+ communicator()->flushBatchRequests();
+ }
+ else if(c == 'S')
+ {
+ secure = !secure;
+ secureStr = secure ? "s" : "";
+
+ twoway = CallbackSenderPrx::uncheckedCast(twoway->ice_secure(secure));
+ oneway = CallbackSenderPrx::uncheckedCast(oneway->ice_secure(secure));
+ batchOneway = CallbackSenderPrx::uncheckedCast(batchOneway->ice_secure(secure));
+ datagram = CallbackSenderPrx::uncheckedCast(datagram->ice_secure(secure));
+ batchDatagram = CallbackSenderPrx::uncheckedCast(batchDatagram->ice_secure(secure));
+
+ twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_secure(secure));
+ onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_secure(secure));
+ datagramR = CallbackReceiverPrx::uncheckedCast(datagramR->ice_secure(secure));
+
+ if(secure)
+ {
+ cout << "secure mode is now on" << endl;
+ }
+ else
+ {
+ cout << "secure mode is now off" << endl;
+ }
+ }
+ else if(c == 's')
+ {
+ twoway->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -190,15 +190,15 @@ CallbackClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
@@ -207,15 +207,15 @@ void
CallbackClient::menu()
{
cout <<
- "usage:\n"
- "t: send callback as twoway\n"
- "o: send callback as oneway\n"
- "O: send callback as batch oneway\n"
- "d: send callback as datagram\n"
- "D: send callback as batch datagram\n"
- "f: flush all batch requests\n"
- "S: switch secure mode on/off\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: send callback as twoway\n"
+ "o: send callback as oneway\n"
+ "O: send callback as batch oneway\n"
+ "d: send callback as datagram\n"
+ "D: send callback as batch datagram\n"
+ "f: flush all batch requests\n"
+ "S: switch secure mode on/off\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
diff --git a/cpp/demo/Ice/converter/Client.cpp b/cpp/demo/Ice/converter/Client.cpp
index 123ad49dc52..3db03370c4f 100644
--- a/cpp/demo/Ice/converter/Client.cpp
+++ b/cpp/demo/Ice/converter/Client.cpp
@@ -19,12 +19,12 @@ void
menu()
{
cout <<
- "usage:\n"
- "t: send greeting with conversion\n"
- "u: send greeting without conversion\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: send greeting with conversion\n"
+ "u: send greeting without conversion\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
int
@@ -34,15 +34,15 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator1, const Ice
EchoPrx echo1 = EchoPrx::checkedCast(communicator1->propertyToProxy(proxyProperty));
if(!echo1)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
EchoPrx echo2 = EchoPrx::checkedCast(communicator2->propertyToProxy(proxyProperty));
if(!echo2)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
menu();
@@ -52,42 +52,42 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator1, const Ice
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- string ret = echo1->echoString(greeting);
- cout << "Received (LATIN-1): \"" << IceUtil::escapeString(ret, "") << '\"' << endl;
- }
- else if(c == 'u')
- {
- string ret = echo2->echoString(greeting);
- cout << "Received (LATIN-1): \"" << IceUtil::escapeString(ret, "") << '\"' << endl;
- }
- else if(c == 's')
- {
- echo1->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ string ret = echo1->echoString(greeting);
+ cout << "Received (LATIN-1): \"" << IceUtil::escapeString(ret, "") << '\"' << endl;
+ }
+ else if(c == 'u')
+ {
+ string ret = echo2->echoString(greeting);
+ cout << "Received (LATIN-1): \"" << IceUtil::escapeString(ret, "") << '\"' << endl;
+ }
+ else if(c == 's')
+ {
+ echo1->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -104,18 +104,18 @@ main(int argc, char* argv[])
try
{
//
- // Create two communicators, one with string converter configured
- // and one without.
- //
+ // Create two communicators, one with string converter configured
+ // and one without.
+ //
Ice::InitializationData initData;
initData.stringConverter = new StringConverterI();
- initData.properties = Ice::createProperties(initData.stringConverter);
- initData.properties->load("config.client");
+ initData.properties = Ice::createProperties(initData.stringConverter);
+ initData.properties->load("config.client");
communicator1 = Ice::initialize(argc, argv, initData);
Ice::InitializationData initData2;
- initData2.properties = Ice::createProperties();
- initData2.properties->load("config.client");
+ initData2.properties = Ice::createProperties();
+ initData2.properties->load("config.client");
communicator2 = Ice::initialize(argc, argv, initData2);
status = run(argc, argv, communicator1, communicator2);
diff --git a/cpp/demo/Ice/converter/StringConverterI.cpp b/cpp/demo/Ice/converter/StringConverterI.cpp
index 0f6a7f3bd64..0da9ee6cdbb 100644
--- a/cpp/demo/Ice/converter/StringConverterI.cpp
+++ b/cpp/demo/Ice/converter/StringConverterI.cpp
@@ -34,32 +34,32 @@ Demo::StringConverterI::toUTF8(const char* sourceStart, const char* sourceEnd, I
{
unsigned char byte = sourceStart[i];
if(byte <= 0x7F)
- {
- if(outputBytesLeft == 0)
- {
- targetStart = buffer.getMoreBytes(chunkSize, targetStart + chunkSize);
- offset = 0;
- }
+ {
+ if(outputBytesLeft == 0)
+ {
+ targetStart = buffer.getMoreBytes(chunkSize, targetStart + chunkSize);
+ offset = 0;
+ }
- targetStart[offset] = byte;
+ targetStart[offset] = byte;
- ++offset;
- --outputBytesLeft;
- }
- else
- {
- if(outputBytesLeft <= 1)
- {
- targetStart = buffer.getMoreBytes(chunkSize, targetStart + chunkSize - outputBytesLeft);
- offset = 0;
- }
+ ++offset;
+ --outputBytesLeft;
+ }
+ else
+ {
+ if(outputBytesLeft <= 1)
+ {
+ targetStart = buffer.getMoreBytes(chunkSize, targetStart + chunkSize - outputBytesLeft);
+ offset = 0;
+ }
- targetStart[offset] = 0xC0 | ((byte & 0xC0) >> 6);
- targetStart[offset + 1] = 0x80 | (byte & 0x3F);
+ targetStart[offset] = 0xC0 | ((byte & 0xC0) >> 6);
+ targetStart[offset + 1] = 0x80 | (byte & 0x3F);
- offset += 2;
- outputBytesLeft -= 2;
- }
+ offset += 2;
+ outputBytesLeft -= 2;
+ }
}
return targetStart + offset;
@@ -67,7 +67,7 @@ Demo::StringConverterI::toUTF8(const char* sourceStart, const char* sourceEnd, I
void
Demo::StringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- string& target) const
+ string& target) const
{
size_t inSize = static_cast<size_t>(sourceEnd - sourceStart);
target.resize(inSize);
@@ -77,21 +77,21 @@ Demo::StringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte*
while(i < inSize)
{
if((sourceStart[i] & 0xC0) == 0xC0)
- {
- if(i + 1 >= inSize)
- {
- throw Ice::StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
- }
- target[targetIndex] = (sourceStart[i] & 0x03) << 6;
- target[targetIndex] = target[targetIndex] | (sourceStart[i + 1] & 0x3F);
- i += 2;
- }
- else
- {
- target[targetIndex] = sourceStart[i];
- ++i;
- }
- ++targetIndex;
+ {
+ if(i + 1 >= inSize)
+ {
+ throw Ice::StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
+ }
+ target[targetIndex] = (sourceStart[i] & 0x03) << 6;
+ target[targetIndex] = target[targetIndex] | (sourceStart[i + 1] & 0x3F);
+ i += 2;
+ }
+ else
+ {
+ target[targetIndex] = sourceStart[i];
+ ++i;
+ }
+ ++targetIndex;
}
target.resize(targetIndex);
diff --git a/cpp/demo/Ice/hello/Client.cpp b/cpp/demo/Ice/hello/Client.cpp
index 801a8ebc337..50269cca8af 100644
--- a/cpp/demo/Ice/hello/Client.cpp
+++ b/cpp/demo/Ice/hello/Client.cpp
@@ -42,11 +42,11 @@ HelloClient::run(int argc, char* argv[])
callbackOnInterrupt();
HelloPrx twoway = HelloPrx::checkedCast(
- communicator()->propertyToProxy("Hello.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false));
+ communicator()->propertyToProxy("Hello.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false));
if(!twoway)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway());
HelloPrx batchOneway = HelloPrx::uncheckedCast(twoway->ice_batchOneway());
@@ -62,133 +62,133 @@ HelloClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- twoway->sayHello(delay);
- }
- else if(c == 'o')
- {
- oneway->sayHello(delay);
- }
- else if(c == 'O')
- {
- batchOneway->sayHello(delay);
- }
- else if(c == 'd')
- {
- if(secure)
- {
- cout << "secure datagrams are not supported" << endl;
- }
- else
- {
- datagram->sayHello(delay);
- }
- }
- else if(c == 'D')
- {
- if(secure)
- {
- cout << "secure datagrams are not supported" << endl;
- }
- else
- {
- batchDatagram->sayHello(delay);
- }
- }
- else if(c == 'f')
- {
- communicator()->flushBatchRequests();
- }
- else if(c == 'T')
- {
- if(timeout == -1)
- {
- timeout = 2000;
- }
- else
- {
- timeout = -1;
- }
-
- twoway = HelloPrx::uncheckedCast(twoway->ice_timeout(timeout));
- oneway = HelloPrx::uncheckedCast(oneway->ice_timeout(timeout));
- batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_timeout(timeout));
-
- if(timeout == -1)
- {
- cout << "timeout is now switched off" << endl;
- }
- else
- {
- cout << "timeout is now set to 2000ms" << endl;
- }
- }
- else if(c == 'P')
- {
- if(delay == 0)
- {
- delay = 2500;
- }
- else
- {
- delay = 0;
- }
-
- if(delay == 0)
- {
- cout << "server delay is now disabled" << endl;
- }
- else
- {
- cout << "server delay is now set to 2500ms" << endl;
- }
- }
- else if(c == 'S')
- {
- secure = !secure;
-
- twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure));
- oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure));
- batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure));
- datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure));
- batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure));
-
- if(secure)
- {
- cout << "secure mode is now on" << endl;
- }
- else
- {
- cout << "secure mode is now off" << endl;
- }
- }
- else if(c == 's')
- {
- twoway->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ twoway->sayHello(delay);
+ }
+ else if(c == 'o')
+ {
+ oneway->sayHello(delay);
+ }
+ else if(c == 'O')
+ {
+ batchOneway->sayHello(delay);
+ }
+ else if(c == 'd')
+ {
+ if(secure)
+ {
+ cout << "secure datagrams are not supported" << endl;
+ }
+ else
+ {
+ datagram->sayHello(delay);
+ }
+ }
+ else if(c == 'D')
+ {
+ if(secure)
+ {
+ cout << "secure datagrams are not supported" << endl;
+ }
+ else
+ {
+ batchDatagram->sayHello(delay);
+ }
+ }
+ else if(c == 'f')
+ {
+ communicator()->flushBatchRequests();
+ }
+ else if(c == 'T')
+ {
+ if(timeout == -1)
+ {
+ timeout = 2000;
+ }
+ else
+ {
+ timeout = -1;
+ }
+
+ twoway = HelloPrx::uncheckedCast(twoway->ice_timeout(timeout));
+ oneway = HelloPrx::uncheckedCast(oneway->ice_timeout(timeout));
+ batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_timeout(timeout));
+
+ if(timeout == -1)
+ {
+ cout << "timeout is now switched off" << endl;
+ }
+ else
+ {
+ cout << "timeout is now set to 2000ms" << endl;
+ }
+ }
+ else if(c == 'P')
+ {
+ if(delay == 0)
+ {
+ delay = 2500;
+ }
+ else
+ {
+ delay = 0;
+ }
+
+ if(delay == 0)
+ {
+ cout << "server delay is now disabled" << endl;
+ }
+ else
+ {
+ cout << "server delay is now set to 2500ms" << endl;
+ }
+ }
+ else if(c == 'S')
+ {
+ secure = !secure;
+
+ twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure));
+ oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure));
+ batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure));
+ datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure));
+ batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure));
+
+ if(secure)
+ {
+ cout << "secure mode is now on" << endl;
+ }
+ else
+ {
+ cout << "secure mode is now off" << endl;
+ }
+ }
+ else if(c == 's')
+ {
+ twoway->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -200,15 +200,15 @@ HelloClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
@@ -217,17 +217,17 @@ void
HelloClient::menu()
{
cout <<
- "usage:\n"
- "t: send greeting as twoway\n"
- "o: send greeting as oneway\n"
- "O: send greeting as batch oneway\n"
- "d: send greeting as datagram\n"
- "D: send greeting as batch datagram\n"
- "f: flush all batch requests\n"
- "T: set a timeout\n"
- "P: set server delay\n"
- "S: switch secure mode on/off\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: send greeting as twoway\n"
+ "o: send greeting as oneway\n"
+ "O: send greeting as batch oneway\n"
+ "d: send greeting as datagram\n"
+ "D: send greeting as batch datagram\n"
+ "f: flush all batch requests\n"
+ "T: set a timeout\n"
+ "P: set server delay\n"
+ "S: switch secure mode on/off\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
diff --git a/cpp/demo/Ice/invoke/Client.cpp b/cpp/demo/Ice/invoke/Client.cpp
index 3c0bb5bf8c6..e36fb965f31 100644
--- a/cpp/demo/Ice/invoke/Client.cpp
+++ b/cpp/demo/Ice/invoke/Client.cpp
@@ -304,15 +304,15 @@ InvokeClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/Ice/latency/Client.cpp b/cpp/demo/Ice/latency/Client.cpp
index 27347c49dd0..5f59ff10b17 100644
--- a/cpp/demo/Ice/latency/Client.cpp
+++ b/cpp/demo/Ice/latency/Client.cpp
@@ -34,8 +34,8 @@ LatencyClient::run(int argc, char* argv[])
PingPrx ping = PingPrx::checkedCast(base);
if(!ping)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
// Initial ping to setup the connection.
@@ -47,7 +47,7 @@ LatencyClient::run(int argc, char* argv[])
cout << "pinging server " << repetitions << " times (this may take a while)" << endl;
for(int i = 0; i < repetitions; ++i)
{
- ping->ice_ping();
+ ping->ice_ping();
}
tm = IceUtil::Time::now() - tm;
diff --git a/cpp/demo/Ice/minimal/Client.cpp b/cpp/demo/Ice/minimal/Client.cpp
index 7009383bef6..583379642ef 100644
--- a/cpp/demo/Ice/minimal/Client.cpp
+++ b/cpp/demo/Ice/minimal/Client.cpp
@@ -21,35 +21,35 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000"));
- if(!hello)
- {
- cerr << argv[0] << ": invalid proxy" << endl;
- status = EXIT_FAILURE;
- }
- else
- {
- hello->sayHello();
- }
+ communicator = Ice::initialize(argc, argv);
+ HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000"));
+ if(!hello)
+ {
+ cerr << argv[0] << ": invalid proxy" << endl;
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ hello->sayHello();
+ }
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/demo/Ice/minimal/Server.cpp b/cpp/demo/Ice/minimal/Server.cpp
index dc243ba9e49..6b2e4874689 100644
--- a/cpp/demo/Ice/minimal/Server.cpp
+++ b/cpp/demo/Ice/minimal/Server.cpp
@@ -20,29 +20,29 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("Hello", "tcp -p 10000");
- adapter->add(new HelloI, communicator->stringToIdentity("hello"));
- adapter->activate();
- communicator->waitForShutdown();
+ communicator = Ice::initialize(argc, argv);
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("Hello", "tcp -p 10000");
+ adapter->add(new HelloI, communicator->stringToIdentity("hello"));
+ adapter->activate();
+ communicator->waitForShutdown();
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/demo/Ice/nested/Client.cpp b/cpp/demo/Ice/nested/Client.cpp
index 12235c1d0ea..30c6edc42f2 100644
--- a/cpp/demo/Ice/nested/Client.cpp
+++ b/cpp/demo/Ice/nested/Client.cpp
@@ -41,8 +41,8 @@ NestedClient::run(int argc, char* argv[])
NestedPrx nested = NestedPrx::checkedCast(communicator()->propertyToProxy("Nested.Client.NestedServer"));
if(!nested)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Nested.Client");
@@ -51,28 +51,28 @@ NestedClient::run(int argc, char* argv[])
adapter->activate();
cout << "Note: The maximum nesting level is sz * 2, with sz being\n"
- << "the maximum number of threads in the server thread pool. if\n"
- << "you specify a value higher than that, the application will\n"
- << "block or timeout.\n"
- << endl;
+ << "the maximum number of threads in the server thread pool. if\n"
+ << "you specify a value higher than that, the application will\n"
+ << "block or timeout.\n"
+ << endl;
string s;
do
{
- try
- {
- cout << "enter nesting level or 'x' for exit: ";
- cin >> s;
- int level = atoi(s.c_str());
- if(level > 0)
- {
- nested->nestedCall(level, self);
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "enter nesting level or 'x' for exit: ";
+ cin >> s;
+ int level = atoi(s.c_str());
+ if(level > 0)
+ {
+ nested->nestedCall(level, self);
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && s != "x");
@@ -89,15 +89,15 @@ NestedClient::interruptCallback(int)
*
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
*/
exit(EXIT_SUCCESS);
diff --git a/cpp/demo/Ice/nested/NestedI.cpp b/cpp/demo/Ice/nested/NestedI.cpp
index 133e34b896a..bb129b6dcdf 100644
--- a/cpp/demo/Ice/nested/NestedI.cpp
+++ b/cpp/demo/Ice/nested/NestedI.cpp
@@ -25,6 +25,6 @@ NestedI::nestedCall(Int level, const NestedPrx& proxy, const Ice::Current& curre
cout << level << endl;
if(--level > 0)
{
- proxy->nestedCall(level, _self, current.ctx);
+ proxy->nestedCall(level, _self, current.ctx);
}
}
diff --git a/cpp/demo/Ice/session/Client.cpp b/cpp/demo/Ice/session/Client.cpp
index 28a0393a1bd..89b05b09c1d 100755
--- a/cpp/demo/Ice/session/Client.cpp
+++ b/cpp/demo/Ice/session/Client.cpp
@@ -19,42 +19,42 @@ class SessionRefreshThread : public IceUtil::Thread, public IceUtil::Monitor<Ice
public:
SessionRefreshThread(const Ice::LoggerPtr& logger, const IceUtil::Time& timeout, const SessionPrx& session) :
- _logger(logger),
- _session(session),
- _timeout(timeout),
- _terminated(false)
+ _logger(logger),
+ _session(session),
+ _timeout(timeout),
+ _terminated(false)
{
}
virtual void
run()
{
- Lock sync(*this);
- while(!_terminated)
- {
- timedWait(_timeout);
- if(!_terminated)
- {
- try
- {
- _session->refresh();
- }
- catch(const Ice::Exception& ex)
- {
- Ice::Warning warn(_logger);
- warn << "SessionRefreshThread: " << ex;
- _terminated = true;
- }
- }
- }
+ Lock sync(*this);
+ while(!_terminated)
+ {
+ timedWait(_timeout);
+ if(!_terminated)
+ {
+ try
+ {
+ _session->refresh();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ Ice::Warning warn(_logger);
+ warn << "SessionRefreshThread: " << ex;
+ _terminated = true;
+ }
+ }
+ }
}
void
terminate()
{
- Lock sync(*this);
- _terminated = true;
- notify();
+ Lock sync(*this);
+ _terminated = true;
+ notify();
}
private:
@@ -109,24 +109,24 @@ SessionClient::run(int argc, char* argv[])
cin >> name;
if(!cin.good())
{
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
Ice::ObjectPrx base = communicator()->propertyToProxy("SessionFactory.Proxy");
SessionFactoryPrx factory = SessionFactoryPrx::checkedCast(base);
if(!factory)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
{
- IceUtil::Mutex::Lock sync(_mutex);
- _session = factory->create(name);
-
- _refresh = new SessionRefreshThread(
- communicator()->getLogger(), IceUtil::Time::seconds(5), _session);
- _refresh->start();
+ IceUtil::Mutex::Lock sync(_mutex);
+ _session = factory->create(name);
+
+ _refresh = new SessionRefreshThread(
+ communicator()->getLogger(), IceUtil::Time::seconds(5), _session);
+ _refresh->start();
}
vector<HelloPrx> hellos;
@@ -135,85 +135,85 @@ SessionClient::run(int argc, char* argv[])
try
{
- bool destroy = true;
- bool shutdown = false;
- while(true)
- {
- cout << "==> ";
- char c;
- cin >> c;
- if(!cin.good())
- {
- break;
- }
- if(isdigit(c))
- {
- string s;
- s += c;
- vector<HelloPrx>::size_type index = atoi(s.c_str());
- if(index < hellos.size())
- {
- hellos[index]->sayHello();
- }
- else
- {
- cout << "Index is too high. " << hellos.size() << " hello objects exist so far.\n"
- << "Use `c' to create a new hello object." << endl;
- }
- }
- else if(c == 'c')
- {
- hellos.push_back(_session->createHello());
- cout << "Created hello object " << hellos.size() - 1 << endl;
- }
- else if(c == 's')
- {
- destroy = false;
- shutdown = true;
- break;
- }
- else if(c == 'x')
- {
- break;
- }
- else if(c == 't')
- {
- destroy = false;
- break;
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "Unknown command `" << c << "'." << endl;
- menu();
- }
- }
+ bool destroy = true;
+ bool shutdown = false;
+ while(true)
+ {
+ cout << "==> ";
+ char c;
+ cin >> c;
+ if(!cin.good())
+ {
+ break;
+ }
+ if(isdigit(c))
+ {
+ string s;
+ s += c;
+ vector<HelloPrx>::size_type index = atoi(s.c_str());
+ if(index < hellos.size())
+ {
+ hellos[index]->sayHello();
+ }
+ else
+ {
+ cout << "Index is too high. " << hellos.size() << " hello objects exist so far.\n"
+ << "Use `c' to create a new hello object." << endl;
+ }
+ }
+ else if(c == 'c')
+ {
+ hellos.push_back(_session->createHello());
+ cout << "Created hello object " << hellos.size() - 1 << endl;
+ }
+ else if(c == 's')
+ {
+ destroy = false;
+ shutdown = true;
+ break;
+ }
+ else if(c == 'x')
+ {
+ break;
+ }
+ else if(c == 't')
+ {
+ destroy = false;
+ break;
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "Unknown command `" << c << "'." << endl;
+ menu();
+ }
+ }
- //
- // The refresher thread must be terminated before destroy is
- // called, otherwise it might get ObjectNotExistException. refresh
- // is set to 0 so that if session->destroy() raises an exception
- // the thread will not be re-terminated and re-joined.
- //
- cleanup(destroy);
- if(shutdown)
- {
- factory->shutdown();
- }
+ //
+ // The refresher thread must be terminated before destroy is
+ // called, otherwise it might get ObjectNotExistException. refresh
+ // is set to 0 so that if session->destroy() raises an exception
+ // the thread will not be re-terminated and re-joined.
+ //
+ cleanup(destroy);
+ if(shutdown)
+ {
+ factory->shutdown();
+ }
}
catch(...)
{
- try
- {
- cleanup(true);
- }
- catch(...)
- {
- }
- throw;
+ try
+ {
+ cleanup(true);
+ }
+ catch(...)
+ {
+ }
+ throw;
}
return EXIT_SUCCESS;
@@ -232,15 +232,15 @@ SessionClient::interruptCallback(int)
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
@@ -251,15 +251,15 @@ SessionClient::cleanup(bool destroy)
IceUtil::Mutex::Lock sync(_mutex);
if(_refresh)
{
- _refresh->terminate();
- _refresh->getThreadControl().join();
- _refresh = 0;
+ _refresh->terminate();
+ _refresh->getThreadControl().join();
+ _refresh = 0;
}
if(destroy && _session)
{
- _session->destroy();
- _session = 0;
+ _session->destroy();
+ _session = 0;
}
}
@@ -267,11 +267,11 @@ void
SessionClient::menu()
{
cout <<
- "usage:\n"
- "c: create a new per-client hello object\n"
- "0-9: send a greeting to a hello object\n"
- "s: shutdown the server and exit\n"
- "x: exit\n"
- "t: exit without destroying the session\n"
- "?: help\n";
+ "usage:\n"
+ "c: create a new per-client hello object\n"
+ "0-9: send a greeting to a hello object\n"
+ "s: shutdown the server and exit\n"
+ "x: exit\n"
+ "t: exit without destroying the session\n"
+ "?: help\n";
}
diff --git a/cpp/demo/Ice/session/ReapThread.cpp b/cpp/demo/Ice/session/ReapThread.cpp
index 26d25ff506a..7257bd0994c 100755
--- a/cpp/demo/Ice/session/ReapThread.cpp
+++ b/cpp/demo/Ice/session/ReapThread.cpp
@@ -25,38 +25,38 @@ ReapThread::run()
while(!_terminated)
{
- timedWait(_timeout);
+ timedWait(_timeout);
- if(!_terminated)
- {
- list<SessionProxyPair>::iterator p = _sessions.begin();
- while(p != _sessions.end())
- {
- try
- {
- //
- // Session destruction may take time in a
- // real-world example. Therefore the current time
- // is computed for each iteration.
- //
- if((IceUtil::Time::now() - p->session->timestamp()) > _timeout)
- {
- string name = p->proxy->getName();
- p->proxy->destroy();
- cout << "The session " << name << " has timed out." << endl;
- p = _sessions.erase(p);
- }
- else
- {
- ++p;
- }
- }
- catch(const Ice::ObjectNotExistException&)
- {
- p = _sessions.erase(p);
- }
- }
- }
+ if(!_terminated)
+ {
+ list<SessionProxyPair>::iterator p = _sessions.begin();
+ while(p != _sessions.end())
+ {
+ try
+ {
+ //
+ // Session destruction may take time in a
+ // real-world example. Therefore the current time
+ // is computed for each iteration.
+ //
+ if((IceUtil::Time::now() - p->session->timestamp()) > _timeout)
+ {
+ string name = p->proxy->getName();
+ p->proxy->destroy();
+ cout << "The session " << name << " has timed out." << endl;
+ p = _sessions.erase(p);
+ }
+ else
+ {
+ ++p;
+ }
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ p = _sessions.erase(p);
+ }
+ }
+ }
}
}
diff --git a/cpp/demo/Ice/session/ReapThread.h b/cpp/demo/Ice/session/ReapThread.h
index b7fc1434cf0..f96cf25036a 100755
--- a/cpp/demo/Ice/session/ReapThread.h
+++ b/cpp/demo/Ice/session/ReapThread.h
@@ -30,10 +30,10 @@ private:
bool _terminated;
struct SessionProxyPair
{
- SessionProxyPair(const Demo::SessionPrx& p, const SessionIPtr& s) :
- proxy(p), session(s) { }
- const Demo::SessionPrx proxy;
- const SessionIPtr session;
+ SessionProxyPair(const Demo::SessionPrx& p, const SessionIPtr& s) :
+ proxy(p), session(s) { }
+ const Demo::SessionPrx proxy;
+ const SessionIPtr session;
};
std::list<SessionProxyPair> _sessions;
};
diff --git a/cpp/demo/Ice/session/SessionI.cpp b/cpp/demo/Ice/session/SessionI.cpp
index d458b4117e4..a0e70e24168 100755
--- a/cpp/demo/Ice/session/SessionI.cpp
+++ b/cpp/demo/Ice/session/SessionI.cpp
@@ -17,21 +17,21 @@ class HelloI : public Hello
public:
HelloI(const string& name, int id) :
- _name(name),
- _id(id)
+ _name(name),
+ _id(id)
{
}
virtual ~HelloI()
{
- cout << "Hello object #" << _id << " for session `" << _name << "' destroyed" << endl;
+ cout << "Hello object #" << _id << " for session `" << _name << "' destroyed" << endl;
}
void
sayHello(const Ice::Current&) const
{
- cout << "Hello object #" << _id << " for session `" << _name << "' says:\n"
- << "Hello " << _name << "!" << endl;
+ cout << "Hello object #" << _id << " for session `" << _name << "' says:\n"
+ << "Hello " << _name << "!" << endl;
}
private:
@@ -55,7 +55,7 @@ SessionI::createHello(const Ice::Current& c)
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
HelloPrx hello = HelloPrx::uncheckedCast(c.adapter->addWithUUID(new HelloI(_name, _nextId++)));
@@ -69,7 +69,7 @@ SessionI::refresh(const Ice::Current& c)
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
_timestamp = IceUtil::Time::now();
@@ -81,7 +81,7 @@ SessionI::getName(const Ice::Current&) const
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
return _name;
@@ -93,7 +93,7 @@ SessionI::destroy(const Ice::Current& c)
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
_destroy = true;
@@ -101,16 +101,16 @@ SessionI::destroy(const Ice::Current& c)
cout << "The session " << _name << " is now destroyed." << endl;
try
{
- c.adapter->remove(c.id);
- for(list<HelloPrx>::const_iterator p = _objs.begin(); p != _objs.end(); ++p)
- {
- c.adapter->remove((*p)->ice_getIdentity());
- }
+ c.adapter->remove(c.id);
+ for(list<HelloPrx>::const_iterator p = _objs.begin(); p != _objs.end(); ++p)
+ {
+ c.adapter->remove((*p)->ice_getIdentity());
+ }
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
- // This method is called on shutdown of the server, in which
- // case this exception is expected.
+ // This method is called on shutdown of the server, in which
+ // case this exception is expected.
}
_objs.clear();
@@ -122,7 +122,7 @@ SessionI::timestamp() const
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
return _timestamp;
}
diff --git a/cpp/demo/Ice/throughput/Client.cpp b/cpp/demo/Ice/throughput/Client.cpp
index d019e951a19..112eb317177 100644
--- a/cpp/demo/Ice/throughput/Client.cpp
+++ b/cpp/demo/Ice/throughput/Client.cpp
@@ -47,8 +47,8 @@ ThroughputClient::run(int argc, char* argv[])
ThroughputPrx throughput = ThroughputPrx::checkedCast(base);
if(!throughput)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
ThroughputPrx throughputOneway = ThroughputPrx::uncheckedCast(throughput->ice_oneway());
@@ -64,7 +64,7 @@ ThroughputClient::run(int argc, char* argv[])
for(i = 0; i < StringDoubleSeqSize; ++i)
{
structSeq[i].s = "hello";
- structSeq[i].d = 3.14;
+ structSeq[i].d = 3.14;
}
FixedSeq fixedSeq(FixedSeqSize);
@@ -88,296 +88,296 @@ ThroughputClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
-
- IceUtil::Time tm = IceUtil::Time::now();
- const int repetitions = 1000;
-
- if(c == '1' || c == '2' || c == '3' || c == '4')
- {
- currentType = c;
- switch(c)
- {
- case '1':
- {
- cout << "using byte sequences" << endl;
- seqSize = ByteSeqSize;
- break;
- }
-
- case '2':
- {
- cout << "using string sequences" << endl;
- seqSize = StringSeqSize;
- break;
- }
-
- case '3':
- {
- cout << "using variable-length struct sequences" << endl;
- seqSize = StringDoubleSeqSize;
- break;
- }
-
- case '4':
- {
- cout << "using fixed-length struct sequences" << endl;
- seqSize = FixedSeqSize;
- break;
- }
- }
- }
- else if(c == 't' || c == 'o' || c == 'r' || c == 'e')
- {
- switch(c)
- {
- case 't':
- case 'o':
- {
- cout << "sending";
- break;
- }
-
- case 'r':
- {
- cout << "receiving";
- break;
- }
-
- case 'e':
- {
- cout << "sending and receiving";
- break;
- }
- }
-
- cout << ' ' << repetitions;
- switch(currentType)
- {
- case '1':
- {
- cout << " byte";
- break;
- }
-
- case '2':
- {
- cout << " string";
- break;
- }
-
- case '3':
- {
- cout << " variable-length struct";
- break;
- }
-
- case '4':
- {
- cout << " fixed-length struct";
- break;
- }
- }
- cout << " sequences of size " << seqSize;
-
-
- if(c == 'o')
- {
- cout << " as oneway";
- }
-
- cout << "..." << endl;
-
- for(int i = 0; i < repetitions; ++i)
- {
- switch(currentType)
- {
- case '1':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendByteSeq(byteArr);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendByteSeq(byteArr);
- break;
- }
-
- case 'r':
- {
- throughput->recvByteSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoByteSeq(byteSeq);
- break;
- }
- }
- break;
- }
-
- case '2':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendStringSeq(stringSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendStringSeq(stringSeq);
- break;
- }
-
- case 'r':
- {
- throughput->recvStringSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoStringSeq(stringSeq);
- break;
- }
- }
- break;
- }
-
- case '3':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendStructSeq(structSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendStructSeq(structSeq);
- break;
- }
-
- case 'r':
- {
- throughput->recvStructSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoStructSeq(structSeq);
- break;
- }
- }
- break;
- }
-
- case '4':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'r':
- {
- throughput->recvFixedSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoFixedSeq(fixedSeq);
- break;
- }
- }
- break;
- }
- }
- }
-
- tm = IceUtil::Time::now() - tm;
- cout << "time for " << repetitions << " sequences: " << tm * 1000 << "ms" << endl;
- cout << "time per sequence: " << tm * 1000 / repetitions << "ms" << endl;
- int wireSize = 0;
- switch(currentType)
- {
- case '1':
- {
- wireSize = 1;
- break;
- }
- case '2':
- {
- wireSize = static_cast<int>(stringSeq[0].size());
- break;
- }
- case '3':
- {
- wireSize = static_cast<int>(structSeq[0].s.size());
- wireSize += 8; // Size of double on the wire.
- break;
- }
- case '4':
- {
- wireSize = 16; // Size of two ints and a double on the wire.
- break;
- }
- }
- double mbit = repetitions * seqSize * wireSize * 8.0 / tm.toMicroSeconds();
- if(c == 'e')
- {
- mbit *= 2;
- }
- cout << "throughput: " << setprecision(5) << mbit << "Mbps" << endl;
- }
- else if(c == 's')
- {
- throughput->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+
+ IceUtil::Time tm = IceUtil::Time::now();
+ const int repetitions = 1000;
+
+ if(c == '1' || c == '2' || c == '3' || c == '4')
+ {
+ currentType = c;
+ switch(c)
+ {
+ case '1':
+ {
+ cout << "using byte sequences" << endl;
+ seqSize = ByteSeqSize;
+ break;
+ }
+
+ case '2':
+ {
+ cout << "using string sequences" << endl;
+ seqSize = StringSeqSize;
+ break;
+ }
+
+ case '3':
+ {
+ cout << "using variable-length struct sequences" << endl;
+ seqSize = StringDoubleSeqSize;
+ break;
+ }
+
+ case '4':
+ {
+ cout << "using fixed-length struct sequences" << endl;
+ seqSize = FixedSeqSize;
+ break;
+ }
+ }
+ }
+ else if(c == 't' || c == 'o' || c == 'r' || c == 'e')
+ {
+ switch(c)
+ {
+ case 't':
+ case 'o':
+ {
+ cout << "sending";
+ break;
+ }
+
+ case 'r':
+ {
+ cout << "receiving";
+ break;
+ }
+
+ case 'e':
+ {
+ cout << "sending and receiving";
+ break;
+ }
+ }
+
+ cout << ' ' << repetitions;
+ switch(currentType)
+ {
+ case '1':
+ {
+ cout << " byte";
+ break;
+ }
+
+ case '2':
+ {
+ cout << " string";
+ break;
+ }
+
+ case '3':
+ {
+ cout << " variable-length struct";
+ break;
+ }
+
+ case '4':
+ {
+ cout << " fixed-length struct";
+ break;
+ }
+ }
+ cout << " sequences of size " << seqSize;
+
+
+ if(c == 'o')
+ {
+ cout << " as oneway";
+ }
+
+ cout << "..." << endl;
+
+ for(int i = 0; i < repetitions; ++i)
+ {
+ switch(currentType)
+ {
+ case '1':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendByteSeq(byteArr);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendByteSeq(byteArr);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvByteSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoByteSeq(byteSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '2':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvStringSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoStringSeq(stringSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '3':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvStructSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoStructSeq(structSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '4':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvFixedSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoFixedSeq(fixedSeq);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ tm = IceUtil::Time::now() - tm;
+ cout << "time for " << repetitions << " sequences: " << tm * 1000 << "ms" << endl;
+ cout << "time per sequence: " << tm * 1000 / repetitions << "ms" << endl;
+ int wireSize = 0;
+ switch(currentType)
+ {
+ case '1':
+ {
+ wireSize = 1;
+ break;
+ }
+ case '2':
+ {
+ wireSize = static_cast<int>(stringSeq[0].size());
+ break;
+ }
+ case '3':
+ {
+ wireSize = static_cast<int>(structSeq[0].s.size());
+ wireSize += 8; // Size of double on the wire.
+ break;
+ }
+ case '4':
+ {
+ wireSize = 16; // Size of two ints and a double on the wire.
+ break;
+ }
+ }
+ double mbit = repetitions * seqSize * wireSize * 8.0 / tm.toMicroSeconds();
+ if(c == 'e')
+ {
+ mbit *= 2;
+ }
+ cout << "throughput: " << setprecision(5) << mbit << "Mbps" << endl;
+ }
+ else if(c == 's')
+ {
+ throughput->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -389,15 +389,15 @@ ThroughputClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
@@ -406,22 +406,22 @@ void
ThroughputClient::menu()
{
cout <<
- "usage:\n"
- "\n"
- "toggle type of data to send:\n"
- "1: sequence of bytes (default)\n"
- "2: sequence of strings (\"hello\")\n"
- "3: sequence of structs with a string (\"hello\") and a double\n"
- "4: sequence of structs with two ints and a double\n"
- "\n"
- "select test to run:\n"
- "t: Send sequence as twoway\n"
- "o: Send sequence as oneway\n"
- "r: Receive sequence\n"
- "e: Echo (send and receive) sequence\n"
- "\n"
- "other commands:\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "\n"
+ "toggle type of data to send:\n"
+ "1: sequence of bytes (default)\n"
+ "2: sequence of strings (\"hello\")\n"
+ "3: sequence of structs with a string (\"hello\") and a double\n"
+ "4: sequence of structs with two ints and a double\n"
+ "\n"
+ "select test to run:\n"
+ "t: Send sequence as twoway\n"
+ "o: Send sequence as oneway\n"
+ "r: Receive sequence\n"
+ "e: Echo (send and receive) sequence\n"
+ "\n"
+ "other commands:\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
diff --git a/cpp/demo/Ice/throughput/ThroughputI.cpp b/cpp/demo/Ice/throughput/ThroughputI.cpp
index 68114a2b7bf..beb61966b0b 100644
--- a/cpp/demo/Ice/throughput/ThroughputI.cpp
+++ b/cpp/demo/Ice/throughput/ThroughputI.cpp
@@ -20,14 +20,14 @@ ThroughputI::ThroughputI() :
int i;
for(i = 0; i < Demo::StringDoubleSeqSize; ++i)
{
- _structSeq[i].s = "hello";
- _structSeq[i].d = 3.14;
+ _structSeq[i].s = "hello";
+ _structSeq[i].d = 3.14;
}
for(i = 0; i < Demo::FixedSeqSize; ++i)
{
- _fixedSeq[i].i = 0;
- _fixedSeq[i].j = 0;
- _fixedSeq[i].d = 0;
+ _fixedSeq[i].i = 0;
+ _fixedSeq[i].j = 0;
+ _fixedSeq[i].d = 0;
}
}
diff --git a/cpp/demo/Ice/value/Client.cpp b/cpp/demo/Ice/value/Client.cpp
index b072355b87f..e37a48aa349 100644
--- a/cpp/demo/Ice/value/Client.cpp
+++ b/cpp/demo/Ice/value/Client.cpp
@@ -42,47 +42,47 @@ ValueClient::run(int argc, char* argv[])
InitialPrx initial = InitialPrx::checkedCast(base);
if(!initial)
{
- cerr << argv[0] << ": invalid object reference" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid object reference" << endl;
+ return EXIT_FAILURE;
}
char c[2];
cout << '\n'
- << "Let's first transfer a simple object, for a class without\n"
- << "operations, and print its contents. No factory is required\n"
- << "for this.\n"
- << "[press enter]\n";
+ << "Let's first transfer a simple object, for a class without\n"
+ << "operations, and print its contents. No factory is required\n"
+ << "for this.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
SimplePtr simple = initial->getSimple();
cout << "==> " << simple->message << endl;
cout << '\n'
- << "Yes, this worked. Now let's try to transfer an object for a class\n"
- << "with operations as type ::Demo::Printer, without installing a factory first.\n"
- << "This should give us a `no factory' exception.\n"
- << "[press enter]\n";
+ << "Yes, this worked. Now let's try to transfer an object for a class\n"
+ << "with operations as type ::Demo::Printer, without installing a factory first.\n"
+ << "This should give us a `no factory' exception.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
PrinterPtr printer;
PrinterPrx printerProxy;
try
{
- initial->getPrinter(printer, printerProxy);
- cerr << argv[0] << "Did not get the expected NoObjectFactoryException!" << endl;
- exit(EXIT_FAILURE);
+ initial->getPrinter(printer, printerProxy);
+ cerr << argv[0] << "Did not get the expected NoObjectFactoryException!" << endl;
+ exit(EXIT_FAILURE);
}
catch(const Ice::NoObjectFactoryException& ex)
{
- cout << "==> " << ex << endl;
+ cout << "==> " << ex << endl;
}
cout << '\n'
- << "Yep, that's what we expected. Now let's try again, but with\n"
- << "installing an appropriate factory first. If successful, we print\n"
- << "the object's content.\n"
- << "[press enter]\n";
+ << "Yep, that's what we expected. Now let's try again, but with\n"
+ << "installing an appropriate factory first. If successful, we print\n"
+ << "the object's content.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
Ice::ObjectFactoryPtr factory = new ObjectFactory;
@@ -92,28 +92,28 @@ ValueClient::run(int argc, char* argv[])
cout << "==> " << printer->message << endl;
cout << '\n'
- << "Cool, it worked! Let's try calling the printBackwards() method\n"
- << "on the object we just received locally.\n"
- << "[press enter]\n";
+ << "Cool, it worked! Let's try calling the printBackwards() method\n"
+ << "on the object we just received locally.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
cout << "==> ";
printer->printBackwards();
cout << '\n'
- << "Now we call the same method, but on the remote object. Watch the\n"
- << "server's output.\n"
- << "[press enter]\n";
+ << "Now we call the same method, but on the remote object. Watch the\n"
+ << "server's output.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
printerProxy->printBackwards();
cout << '\n'
- << "Next, we transfer a derived object from the server as a base\n"
- << "object. Since we haven't yet installed a factory for the derived\n"
- << "class, the derived class (::Demo::DerivedPrinter) is sliced\n"
- << "to its base class (::Demo::Printer).\n"
- << "[press enter]\n";
+ << "Next, we transfer a derived object from the server as a base\n"
+ << "object. Since we haven't yet installed a factory for the derived\n"
+ << "class, the derived class (::Demo::DerivedPrinter) is sliced\n"
+ << "to its base class (::Demo::Printer).\n"
+ << "[press enter]\n";
cin.getline(c, 2);
PrinterPtr derivedAsBase;
@@ -122,10 +122,10 @@ ValueClient::run(int argc, char* argv[])
assert(derivedAsBase->ice_id() == "::Demo::Printer");
cout << '\n'
- << "Now we install a factory for the derived class, and try again.\n"
- << "Because we receive the derived object as a base object, we\n"
- << "we need to do a dynamic_cast<> to get from the base to the derived object.\n"
- << "[press enter]\n";
+ << "Now we install a factory for the derived class, and try again.\n"
+ << "Because we receive the derived object as a base object, we\n"
+ << "we need to do a dynamic_cast<> to get from the base to the derived object.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
communicator()->addObjectFactory(factory, "::Demo::DerivedPrinter");
@@ -137,10 +137,10 @@ ValueClient::run(int argc, char* argv[])
cout << "==> The type ID of the received object is \"" << derived->ice_id() << "\"" << endl;
cout << '\n'
- << "Let's print the message contained in the derived object, and\n"
- << "call the operation printUppercase() on the derived object\n"
- << "locally.\n"
- << "[press enter]\n";
+ << "Let's print the message contained in the derived object, and\n"
+ << "call the operation printUppercase() on the derived object\n"
+ << "locally.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
cout << "==> " << derived->derivedMessage << endl;
@@ -148,26 +148,26 @@ ValueClient::run(int argc, char* argv[])
derived->printUppercase();
cout << '\n'
- << "Finally, we try the same again, but instead of returning the\n"
- << "derived object, we throw an exception containing the derived\n"
- << "object.\n"
- << "[press enter]\n";
+ << "Finally, we try the same again, but instead of returning the\n"
+ << "derived object, we throw an exception containing the derived\n"
+ << "object.\n"
+ << "[press enter]\n";
cin.getline(c, 2);
try
{
- initial->throwDerivedPrinter();
- cerr << argv[0] << ": Did not get the expected DerivedPrinterException!" << endl;
- exit(EXIT_FAILURE);
+ initial->throwDerivedPrinter();
+ cerr << argv[0] << ": Did not get the expected DerivedPrinterException!" << endl;
+ exit(EXIT_FAILURE);
}
catch(const DerivedPrinterException& ex)
{
- derived = ex.derived;
- if(!derived)
- {
- cerr << argv[0] << "Unexpected null pointer for `derived'" << endl;
- exit(EXIT_FAILURE);
- }
+ derived = ex.derived;
+ if(!derived)
+ {
+ cerr << argv[0] << "Unexpected null pointer for `derived'" << endl;
+ exit(EXIT_FAILURE);
+ }
}
cout << "==> " << derived->derivedMessage << endl;
@@ -175,7 +175,7 @@ ValueClient::run(int argc, char* argv[])
derived->printUppercase();
cout << '\n'
- << "That's it for this demo. Have fun with Ice!\n";
+ << "That's it for this demo. Have fun with Ice!\n";
initial->shutdown();
@@ -187,15 +187,15 @@ ValueClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/Ice/value/ObjectFactory.cpp b/cpp/demo/Ice/value/ObjectFactory.cpp
index 2156f97448f..8c1ae1a5868 100644
--- a/cpp/demo/Ice/value/ObjectFactory.cpp
+++ b/cpp/demo/Ice/value/ObjectFactory.cpp
@@ -18,12 +18,12 @@ ObjectFactory::create(const string& type)
{
if(type == "::Demo::Printer")
{
- return new PrinterI;
+ return new PrinterI;
}
if(type == "::Demo::DerivedPrinter")
{
- return new DerivedPrinterI;
+ return new DerivedPrinterI;
}
assert(false);
diff --git a/cpp/demo/IceBox/hello/Client.cpp b/cpp/demo/IceBox/hello/Client.cpp
index 279fd041c47..70fc21e6389 100644
--- a/cpp/demo/IceBox/hello/Client.cpp
+++ b/cpp/demo/IceBox/hello/Client.cpp
@@ -36,16 +36,16 @@ void
HelloClient::menu()
{
cout <<
- "usage:\n"
- "t: send greeting as twoway\n"
- "o: send greeting as oneway\n"
- "O: send greeting as batch oneway\n"
- "d: send greeting as datagram\n"
- "D: send greeting as batch datagram\n"
- "f: flush all batch requests\n"
- "S: switch secure mode on/off\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: send greeting as twoway\n"
+ "o: send greeting as oneway\n"
+ "O: send greeting as batch oneway\n"
+ "d: send greeting as datagram\n"
+ "D: send greeting as batch datagram\n"
+ "f: flush all batch requests\n"
+ "S: switch secure mode on/off\n"
+ "x: exit\n"
+ "?: help\n";
}
int
@@ -58,11 +58,11 @@ HelloClient::run(int argc, char* argv[])
callbackOnInterrupt();
HelloPrx twoway = HelloPrx::checkedCast(
- communicator()->propertyToProxy("Hello.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false));
+ communicator()->propertyToProxy("Hello.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false));
if(!twoway)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway());
HelloPrx batchOneway = HelloPrx::uncheckedCast(twoway->ice_batchOneway());
@@ -76,85 +76,85 @@ HelloClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- twoway->sayHello();
- }
- else if(c == 'o')
- {
- oneway->sayHello();
- }
- else if(c == 'O')
- {
- batchOneway->sayHello();
- }
- else if(c == 'd')
- {
- if(secure)
- {
- cout << "secure datagrams are not supported" << endl;
- }
- else
- {
- datagram->sayHello();
- }
- }
- else if(c == 'D')
- {
- if(secure)
- {
- cout << "secure datagrams are not supported" << endl;
- }
- else
- {
- batchDatagram->sayHello();
- }
- }
- else if(c == 'f')
- {
- communicator()->flushBatchRequests();
- }
- else if(c == 'S')
- {
- secure = !secure;
-
- twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure));
- oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure));
- batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure));
- datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure));
- batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure));
-
- if(secure)
- {
- cout << "secure mode is now on" << endl;
- }
- else
- {
- cout << "secure mode is now off" << endl;
- }
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ twoway->sayHello();
+ }
+ else if(c == 'o')
+ {
+ oneway->sayHello();
+ }
+ else if(c == 'O')
+ {
+ batchOneway->sayHello();
+ }
+ else if(c == 'd')
+ {
+ if(secure)
+ {
+ cout << "secure datagrams are not supported" << endl;
+ }
+ else
+ {
+ datagram->sayHello();
+ }
+ }
+ else if(c == 'D')
+ {
+ if(secure)
+ {
+ cout << "secure datagrams are not supported" << endl;
+ }
+ else
+ {
+ batchDatagram->sayHello();
+ }
+ }
+ else if(c == 'f')
+ {
+ communicator()->flushBatchRequests();
+ }
+ else if(c == 'S')
+ {
+ secure = !secure;
+
+ twoway = HelloPrx::uncheckedCast(twoway->ice_secure(secure));
+ oneway = HelloPrx::uncheckedCast(oneway->ice_secure(secure));
+ batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_secure(secure));
+ datagram = HelloPrx::uncheckedCast(datagram->ice_secure(secure));
+ batchDatagram = HelloPrx::uncheckedCast(batchDatagram->ice_secure(secure));
+
+ if(secure)
+ {
+ cout << "secure mode is now on" << endl;
+ }
+ else
+ {
+ cout << "secure mode is now off" << endl;
+ }
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -166,15 +166,15 @@ HelloClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/IceBox/hello/HelloServiceI.h b/cpp/demo/IceBox/hello/HelloServiceI.h
index 15e95fe4b43..50aaaa24584 100644
--- a/cpp/demo/IceBox/hello/HelloServiceI.h
+++ b/cpp/demo/IceBox/hello/HelloServiceI.h
@@ -24,8 +24,8 @@ public:
virtual ~HelloServiceI();
virtual void start(const ::std::string&,
- const ::Ice::CommunicatorPtr&,
- const ::Ice::StringSeq&);
+ const ::Ice::CommunicatorPtr&,
+ const ::Ice::StringSeq&);
virtual void stop();
diff --git a/cpp/demo/IceGrid/allocate/Client.cpp b/cpp/demo/IceGrid/allocate/Client.cpp
index 16774c94252..7dce0c6a6ae 100644
--- a/cpp/demo/IceGrid/allocate/Client.cpp
+++ b/cpp/demo/IceGrid/allocate/Client.cpp
@@ -20,7 +20,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::SessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -35,15 +35,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -102,7 +102,7 @@ HelloClient::run(int argc, char* argv[])
callbackOnInterrupt();
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
- communicator()->stringToProxy("DemoIceGrid/Registry"));
+ communicator()->stringToProxy("DemoIceGrid/Registry"));
if(!registry)
{
cerr << argv[0] << ": could not contact registry" << endl;
@@ -111,101 +111,101 @@ HelloClient::run(int argc, char* argv[])
while(true)
{
- cout << "This demo accepts any user-id / password combination.\n";
+ cout << "This demo accepts any user-id / password combination.\n";
- string id;
- cout << "user id: " << flush;
- getline(cin, id);
- id = trim(id);
+ string id;
+ cout << "user id: " << flush;
+ getline(cin, id);
+ id = trim(id);
- string password;
- cout << "password: " << flush;
- getline(cin, password);
- password = trim(password);
+ string password;
+ cout << "password: " << flush;
+ getline(cin, password);
+ password = trim(password);
- try
- {
- IceUtil::Mutex::Lock sync(_mutex);
- _session = registry->createSession(id, password);
- break;
- }
- catch(const IceGrid::PermissionDeniedException& ex)
- {
- cout << "permission denied:\n" << ex.reason << endl;
- }
+ try
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ _session = registry->createSession(id, password);
+ break;
+ }
+ catch(const IceGrid::PermissionDeniedException& ex)
+ {
+ cout << "permission denied:\n" << ex.reason << endl;
+ }
}
{
- IceUtil::Mutex::Lock sync(_mutex);
- _keepAlive = new SessionKeepAliveThread(_session, registry->getSessionTimeout() / 2);
- _keepAlive->start();
+ IceUtil::Mutex::Lock sync(_mutex);
+ _keepAlive = new SessionKeepAliveThread(_session, registry->getSessionTimeout() / 2);
+ _keepAlive->start();
}
try
{
- //
- // First try to retrieve object by identity, which will work
- // if the application-single.xml descriptor is used. Otherwise
- // we retrieve object by type, which will succeed if the
- // application-multiple.xml descriptor is used.
- //
- HelloPrx hello;
- try
- {
- hello = HelloPrx::checkedCast(_session->allocateObjectById(communicator()->stringToIdentity("hello")));
- }
- catch(const IceGrid::ObjectNotRegisteredException&)
- {
- hello = HelloPrx::checkedCast(_session->allocateObjectByType("::Demo::Hello"));
- }
-
- menu();
-
- char c;
- do
- {
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- hello->sayHello();
- }
- else if(c == 's')
- {
- hello->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
- }
- while(cin.good() && c != 'x');
+ //
+ // First try to retrieve object by identity, which will work
+ // if the application-single.xml descriptor is used. Otherwise
+ // we retrieve object by type, which will succeed if the
+ // application-multiple.xml descriptor is used.
+ //
+ HelloPrx hello;
+ try
+ {
+ hello = HelloPrx::checkedCast(_session->allocateObjectById(communicator()->stringToIdentity("hello")));
+ }
+ catch(const IceGrid::ObjectNotRegisteredException&)
+ {
+ hello = HelloPrx::checkedCast(_session->allocateObjectByType("::Demo::Hello"));
+ }
+
+ menu();
+
+ char c;
+ do
+ {
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ hello->sayHello();
+ }
+ else if(c == 's')
+ {
+ hello->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
+ }
+ while(cin.good() && c != 'x');
}
catch(const IceGrid::AllocationException& ex)
{
- cerr << argv[0] << ": could not allocate object: " << ex.reason << endl;
- status = EXIT_FAILURE;
+ cerr << argv[0] << ": could not allocate object: " << ex.reason << endl;
+ status = EXIT_FAILURE;
}
catch(...)
{
- cerr << "unexpected exception" << endl;
- status = EXIT_FAILURE;
+ cerr << "unexpected exception" << endl;
+ status = EXIT_FAILURE;
}
cleanup();
@@ -219,15 +219,15 @@ HelloClient::interruptCallback(int)
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
@@ -243,14 +243,14 @@ HelloClient::cleanup()
//
if(_keepAlive)
{
- _keepAlive->destroy();
- _keepAlive->getThreadControl().join();
- _keepAlive = 0;
+ _keepAlive->destroy();
+ _keepAlive->getThreadControl().join();
+ _keepAlive = 0;
}
if(_session)
{
- _session->destroy();
- _session = 0;
+ _session->destroy();
+ _session = 0;
}
}
@@ -258,11 +258,11 @@ void
HelloClient::menu()
{
cout <<
- "usage:\n"
- "t: send greeting\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: send greeting\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
string
diff --git a/cpp/demo/IceGrid/replication/Client.cpp b/cpp/demo/IceGrid/replication/Client.cpp
index 1fc5d816c5d..baabc33bef7 100644
--- a/cpp/demo/IceGrid/replication/Client.cpp
+++ b/cpp/demo/IceGrid/replication/Client.cpp
@@ -58,8 +58,8 @@ HelloClient::run(int argc, char* argv[])
HelloPrx hello = HelloPrx::checkedCast(obj);
if(!hello)
{
- cerr << argv[0] << ": couldn't find a `::Demo::Hello' object." << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": couldn't find a `::Demo::Hello' object." << endl;
+ return EXIT_FAILURE;
}
string s;
@@ -92,15 +92,15 @@ HelloClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/IceGrid/sessionActivation/Client.cpp b/cpp/demo/IceGrid/sessionActivation/Client.cpp
index f01015892c8..8a120aef9ba 100644
--- a/cpp/demo/IceGrid/sessionActivation/Client.cpp
+++ b/cpp/demo/IceGrid/sessionActivation/Client.cpp
@@ -20,7 +20,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::SessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -35,15 +35,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -102,7 +102,7 @@ HelloClient::run(int argc, char* argv[])
callbackOnInterrupt();
IceGrid::RegistryPrx registry =
- IceGrid::RegistryPrx::checkedCast(communicator()->stringToProxy("DemoIceGrid/Registry"));
+ IceGrid::RegistryPrx::checkedCast(communicator()->stringToProxy("DemoIceGrid/Registry"));
if(!registry)
{
cerr << argv[0] << ": could not contact registry" << endl;
@@ -111,93 +111,93 @@ HelloClient::run(int argc, char* argv[])
while(true)
{
- cout << "This demo accepts any user-id / password combination.\n";
-
- string id;
- cout << "user id: " << flush;
- getline(cin, id);
- id = trim(id);
-
- string password;
- cout << "password: " << flush;
- getline(cin, password);
- password = trim(password);
-
- try
- {
- IceUtil::Mutex::Lock sync(_mutex);
- _session = registry->createSession(id, password);
- break;
- }
- catch(const IceGrid::PermissionDeniedException& ex)
- {
- cout << "permission denied:\n" << ex.reason << endl;
- }
+ cout << "This demo accepts any user-id / password combination.\n";
+
+ string id;
+ cout << "user id: " << flush;
+ getline(cin, id);
+ id = trim(id);
+
+ string password;
+ cout << "password: " << flush;
+ getline(cin, password);
+ password = trim(password);
+
+ try
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ _session = registry->createSession(id, password);
+ break;
+ }
+ catch(const IceGrid::PermissionDeniedException& ex)
+ {
+ cout << "permission denied:\n" << ex.reason << endl;
+ }
}
{
- IceUtil::Mutex::Lock sync(_mutex);
- _keepAlive = new SessionKeepAliveThread(_session, registry->getSessionTimeout() / 2);
- _keepAlive->start();
+ IceUtil::Mutex::Lock sync(_mutex);
+ _keepAlive = new SessionKeepAliveThread(_session, registry->getSessionTimeout() / 2);
+ _keepAlive->start();
}
try
{
- HelloPrx hello = HelloPrx::checkedCast(_session->allocateObjectById(communicator()->stringToIdentity("hello")));
-
- menu();
-
- char c;
- do
- {
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- hello->sayHello();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
- }
- while(cin.good() && c != 'x');
+ HelloPrx hello = HelloPrx::checkedCast(_session->allocateObjectById(communicator()->stringToIdentity("hello")));
+
+ menu();
+
+ char c;
+ do
+ {
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ hello->sayHello();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
+ }
+ while(cin.good() && c != 'x');
}
catch(const IceGrid::AllocationException& ex)
{
- cerr << argv[0] << ": could not allocate object: " << ex.reason << endl;
- status = EXIT_FAILURE;
+ cerr << argv[0] << ": could not allocate object: " << ex.reason << endl;
+ status = EXIT_FAILURE;
}
catch(const IceGrid::ObjectNotRegisteredException&)
{
- cerr << argv[0] << ": object not registered with registry" << endl;
- status = EXIT_FAILURE;
+ cerr << argv[0] << ": object not registered with registry" << endl;
+ status = EXIT_FAILURE;
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
catch(...)
{
- cerr << "unexpected exception" << endl;
- status = EXIT_FAILURE;
+ cerr << "unexpected exception" << endl;
+ status = EXIT_FAILURE;
}
cleanup();
@@ -212,15 +212,15 @@ HelloClient::interruptCallback(int)
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
@@ -236,14 +236,14 @@ HelloClient::cleanup()
//
if(_keepAlive)
{
- _keepAlive->destroy();
- _keepAlive->getThreadControl().join();
- _keepAlive = 0;
+ _keepAlive->destroy();
+ _keepAlive->getThreadControl().join();
+ _keepAlive = 0;
}
if(_session)
{
- _session->destroy();
- _session = 0;
+ _session->destroy();
+ _session = 0;
}
}
@@ -251,10 +251,10 @@ void
HelloClient::menu()
{
cout <<
- "usage:\n"
- "t: send greeting\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: send greeting\n"
+ "x: exit\n"
+ "?: help\n";
}
string
diff --git a/cpp/demo/IceGrid/simple/Client.cpp b/cpp/demo/IceGrid/simple/Client.cpp
index 8f8d24029f8..5528bdad6b7 100644
--- a/cpp/demo/IceGrid/simple/Client.cpp
+++ b/cpp/demo/IceGrid/simple/Client.cpp
@@ -37,11 +37,11 @@ void
HelloClient::menu()
{
cout <<
- "usage:\n"
- "t: send greeting\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "t: send greeting\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
int
@@ -61,17 +61,17 @@ HelloClient::run(int argc, char* argv[])
HelloPrx hello;
try
{
- hello = HelloPrx::checkedCast(communicator()->stringToProxy("hello"));
+ hello = HelloPrx::checkedCast(communicator()->stringToProxy("hello"));
}
catch(const Ice::NotRegisteredException&)
{
- IceGrid::QueryPrx query = IceGrid::QueryPrx::checkedCast(communicator()->stringToProxy("DemoIceGrid/Query"));
- hello = HelloPrx::checkedCast(query->findObjectByType("::Demo::Hello"));
+ IceGrid::QueryPrx query = IceGrid::QueryPrx::checkedCast(communicator()->stringToProxy("DemoIceGrid/Query"));
+ hello = HelloPrx::checkedCast(query->findObjectByType("::Demo::Hello"));
}
if(!hello)
{
- cerr << argv[0] << ": couldn't find a `::Demo::Hello' object." << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": couldn't find a `::Demo::Hello' object." << endl;
+ return EXIT_FAILURE;
}
menu();
@@ -79,36 +79,36 @@ HelloClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 't')
- {
- hello->sayHello();
- }
- else if(c == 's')
- {
- hello->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ hello->sayHello();
+ }
+ else if(c == 's')
+ {
+ hello->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -120,15 +120,15 @@ HelloClient::interruptCallback(int)
{
try
{
- communicator()->destroy();
+ communicator()->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << appName() << ": " << ex << endl;
+ cerr << appName() << ": " << ex << endl;
}
catch(...)
{
- cerr << appName() << ": unknown exception" << endl;
+ cerr << appName() << ": unknown exception" << endl;
}
exit(EXIT_SUCCESS);
}
diff --git a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp
index 5aaca0ee731..5f8d6f61acf 100755
--- a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp
+++ b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp
@@ -25,77 +25,77 @@ class DialogPatcherFeedback : public IcePatch2::PatcherFeedback
public:
DialogPatcherFeedback(CPatchDlg* dialog) :
- _dialog(dialog),
+ _dialog(dialog),
_filesPatched(0)
{
- assert(_dialog);
+ assert(_dialog);
}
virtual bool
noFileSummary(const string& reason)
{
- return IDYES == AfxMessageBox(L"Cannot load file summary. Perform a thorough patch?", MB_YESNO|MB_ICONSTOP);
+ return IDYES == AfxMessageBox(L"Cannot load file summary. Perform a thorough patch?", MB_YESNO|MB_ICONSTOP);
}
virtual bool
checksumStart()
{
- return _dialog->checksumStart();
+ return _dialog->checksumStart();
}
virtual bool
checksumProgress(const string& path)
{
- return _dialog->checksumProgress(path);
+ return _dialog->checksumProgress(path);
}
virtual bool
checksumEnd()
{
- return _dialog->checksumEnd();
+ return _dialog->checksumEnd();
}
virtual bool
fileListStart()
{
- return _dialog->fileListStart();
+ return _dialog->fileListStart();
}
virtual bool
fileListProgress(Ice::Int percent)
{
- return _dialog->fileListProgress(percent);
+ return _dialog->fileListProgress(percent);
}
virtual bool
fileListEnd()
{
- return _dialog->fileListEnd();
+ return _dialog->fileListEnd();
}
virtual bool
patchStart(const string& path, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize)
{
- return _dialog->patchStart(path, size, totalProgress, totalSize);
+ return _dialog->patchStart(path, size, totalProgress, totalSize);
}
virtual bool
patchProgress(Ice::Long progress, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize)
{
- return _dialog->patchProgress(progress, size, totalProgress, totalSize);
+ return _dialog->patchProgress(progress, size, totalProgress, totalSize);
}
virtual bool
patchEnd()
{
- ++_filesPatched;
- return _dialog->patchEnd();
+ ++_filesPatched;
+ return _dialog->patchEnd();
}
virtual int
filesPatched() const
{
- return _filesPatched;
+ return _filesPatched;
}
private:
@@ -181,10 +181,10 @@ CPatchDlg::patchStart(const string& path, Ice::Long size, Ice::Long totalProgres
{
if(!_isPatch)
{
- _startTime = IceUtil::Time::now();
- _status->SetWindowText(CString(L" Patching..."));
- _speed->SetWindowText(CString(L" 0.0 KB/s"));
- _isPatch = true;
+ _startTime = IceUtil::Time::now();
+ _status->SetWindowText(CString(L" Patching..."));
+ _speed->SetWindowText(CString(L" 0.0 KB/s"));
+ _isPatch = true;
}
CString file;
@@ -200,15 +200,15 @@ CPatchDlg::patchProgress(Ice::Long, Ice::Long, Ice::Long totalProgress, Ice::Lon
IceUtil::Time elapsed = IceUtil::Time::now() - _startTime;
if(elapsed.toSeconds() > 0)
{
- CString speed;
- speed.Format(L" %s/s", convertSize(totalProgress / elapsed.toSeconds()));
- _speed->SetWindowText(speed);
+ CString speed;
+ speed.Format(L" %s/s", convertSize(totalProgress / elapsed.toSeconds()));
+ _speed->SetWindowText(speed);
}
int pcnt = 100;
if(totalSize > 0)
{
- pcnt = static_cast<int>(totalProgress * 100 / totalSize);
+ pcnt = static_cast<int>(totalProgress * 100 / totalSize);
}
CString percent;
percent.Format(L"%d%%", pcnt);
@@ -339,18 +339,18 @@ CPatchDlg::OnSelectDir()
LPITEMIDLIST pidl = SHBrowseForFolder(&info);
if(pidl != 0)
{
- //
+ //
// Get the name of the selected folder.
- //
+ //
TCHAR path[MAX_PATH];
if(SHGetPathFromIDList(pidl, path))
{
- _path->SetWindowText(path);
+ _path->SetWindowText(path);
}
- //
+ //
// Free up memory used.
- //
+ //
IMalloc * imalloc = 0;
if(SUCCEEDED(SHGetMalloc(&imalloc)))
{
@@ -365,61 +365,61 @@ CPatchDlg::OnStartPatch()
{
try
{
- Ice::PropertiesPtr properties = _communicator->getProperties();
-
- //
- // Set the patch directory.
- //
- CString path;
- _path->GetWindowText(path);
- if(path.IsEmpty())
- {
- AfxMessageBox(CString(L"Please select a patch directory."), MB_OK|MB_ICONEXCLAMATION);
- return;
- }
- properties->setProperty("IcePatch2.Directory", IceUtil::wstringToString(wstring(path)));
-
- //
- // Set the thorough patch flag.
- //
- string thorough = _thorough->GetCheck() == BST_CHECKED ? "1" : "0";
- properties->setProperty("IcePatch2.Thorough", thorough);
-
- //
- // Set the remove orphan flag.
- //
- string remove = _remove->GetCheck() == BST_CHECKED ? "1" : "0";
- properties->setProperty("IcePatch2.Remove", remove);
+ Ice::PropertiesPtr properties = _communicator->getProperties();
+
+ //
+ // Set the patch directory.
+ //
+ CString path;
+ _path->GetWindowText(path);
+ if(path.IsEmpty())
+ {
+ AfxMessageBox(CString(L"Please select a patch directory."), MB_OK|MB_ICONEXCLAMATION);
+ return;
+ }
+ properties->setProperty("IcePatch2.Directory", IceUtil::wstringToString(wstring(path)));
+
+ //
+ // Set the thorough patch flag.
+ //
+ string thorough = _thorough->GetCheck() == BST_CHECKED ? "1" : "0";
+ properties->setProperty("IcePatch2.Thorough", thorough);
+
+ //
+ // Set the remove orphan flag.
+ //
+ string remove = _remove->GetCheck() == BST_CHECKED ? "1" : "0";
+ properties->setProperty("IcePatch2.Remove", remove);
DialogPatcherFeedbackPtr feedback = new DialogPatcherFeedback(this);
- IcePatch2::PatcherPtr patcher = new IcePatch2::Patcher(_communicator, feedback);
-
- //
- // Disable a few controls during the patch process.
- //
- _path->EnableWindow(false);
- _select->EnableWindow(false);
- _thorough->EnableWindow(false);
- _remove->EnableWindow(false);
- _start->EnableWindow(false);
-
- //
- // Patch
- //
- bool aborted = !patcher->prepare();
- if(!aborted)
- {
- aborted = !patcher->patch("");
- }
- if(!aborted)
- {
- patcher->finish();
- }
-
- //
- // Reset and indicate the completion status.
- //
- reset(aborted ? L" Aborted" : L" Completed");
+ IcePatch2::PatcherPtr patcher = new IcePatch2::Patcher(_communicator, feedback);
+
+ //
+ // Disable a few controls during the patch process.
+ //
+ _path->EnableWindow(false);
+ _select->EnableWindow(false);
+ _thorough->EnableWindow(false);
+ _remove->EnableWindow(false);
+ _start->EnableWindow(false);
+
+ //
+ // Patch
+ //
+ bool aborted = !patcher->prepare();
+ if(!aborted)
+ {
+ aborted = !patcher->patch("");
+ }
+ if(!aborted)
+ {
+ patcher->finish();
+ }
+
+ //
+ // Reset and indicate the completion status.
+ //
+ reset(aborted ? L" Aborted" : L" Completed");
}
catch(const IceUtil::Exception& ex)
{
@@ -500,24 +500,24 @@ CPatchDlg::convertSize(Ice::Long size) const
}
else
{
- final = start / megabyte;
- if(final >= 1)
- {
- units = L"MB";
- }
- else
- {
- final = start / kilobyte;
- if(final >= 1)
- {
- units = L"KB";
- }
- else
- {
- final = start;
- units = L"B";
- }
- }
+ final = start / megabyte;
+ if(final >= 1)
+ {
+ units = L"MB";
+ }
+ else
+ {
+ final = start / kilobyte;
+ if(final >= 1)
+ {
+ units = L"KB";
+ }
+ else
+ {
+ final = start;
+ units = L"B";
+ }
+ }
}
CString convert;
diff --git a/cpp/demo/IcePatch2/MFC/stdafx.h b/cpp/demo/IcePatch2/MFC/stdafx.h
index ea41685f994..b9072540cc6 100755
--- a/cpp/demo/IcePatch2/MFC/stdafx.h
+++ b/cpp/demo/IcePatch2/MFC/stdafx.h
@@ -21,30 +21,30 @@
#endif
#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
-#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
-#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
#if 0
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
-#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#endif
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS
@@ -52,9 +52,9 @@
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
+#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <Ice/Ice.h>
diff --git a/cpp/demo/IceStorm/clock/Publisher.cpp b/cpp/demo/IceStorm/clock/Publisher.cpp
index c779a97e0c7..166a2c8c3fa 100644
--- a/cpp/demo/IceStorm/clock/Publisher.cpp
+++ b/cpp/demo/IceStorm/clock/Publisher.cpp
@@ -52,22 +52,22 @@ Publisher::run(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
- communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
+ communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
if(!manager)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
string topicName = "time";
if(!remaining.empty())
{
- topicName = remaining.front();
+ topicName = remaining.front();
}
//
@@ -76,19 +76,19 @@ Publisher::run(int argc, char* argv[])
IceStorm::TopicPrx topic;
try
{
- topic = manager->retrieve(topicName);
+ topic = manager->retrieve(topicName);
}
catch(const IceStorm::NoSuchTopic&)
{
- try
- {
- topic = manager->create(topicName);
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": temporary failure. try again." << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ topic = manager->create(topicName);
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": temporary failure. try again." << endl;
+ return EXIT_FAILURE;
+ }
}
//
@@ -99,38 +99,38 @@ Publisher::run(int argc, char* argv[])
int optsSet = 0;
if(opts.isSet("datagram"))
{
- publisher = publisher->ice_datagram();
- ++optsSet;
+ publisher = publisher->ice_datagram();
+ ++optsSet;
}
else if(opts.isSet("twoway"))
{
- // Do nothing.
- ++optsSet;
+ // Do nothing.
+ ++optsSet;
}
else if(opts.isSet("oneway") || optsSet == 0)
{
- publisher = publisher->ice_oneway();
- ++optsSet;
+ publisher = publisher->ice_oneway();
+ ++optsSet;
}
if(optsSet != 1)
{
- usage(appName());
- return EXIT_FAILURE;
+ usage(appName());
+ return EXIT_FAILURE;
}
ClockPrx clock = ClockPrx::uncheckedCast(publisher);
cout << "publishing tick events. Press ^C to terminate the application." << endl;
try
{
- while(true)
- {
- clock->tick(IceUtil::Time::now().toDateTime());
+ while(true)
+ {
+ clock->tick(IceUtil::Time::now().toDateTime());
IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
- }
+ }
}
catch(const Ice::CommunicatorDestroyedException&)
{
- // Ignore
+ // Ignore
}
return EXIT_SUCCESS;
diff --git a/cpp/demo/IceStorm/clock/Subscriber.cpp b/cpp/demo/IceStorm/clock/Subscriber.cpp
index f6082fef192..abc593c8b0b 100644
--- a/cpp/demo/IceStorm/clock/Subscriber.cpp
+++ b/cpp/demo/IceStorm/clock/Subscriber.cpp
@@ -25,7 +25,7 @@ public:
virtual void
tick(const string& time, const Ice::Current&)
{
- cout << time << endl;
+ cout << time << endl;
}
};
@@ -66,41 +66,41 @@ Subscriber::run(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(appName());
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(appName());
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
- communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
+ communicator()->propertyToProxy("IceStorm.TopicManager.Proxy"));
if(!manager)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
string topicName = "time";
if(!remaining.empty())
{
- topicName = remaining.front();
+ topicName = remaining.front();
}
IceStorm::TopicPrx topic;
try
{
- topic = manager->retrieve(topicName);
+ topic = manager->retrieve(topicName);
}
catch(const IceStorm::NoSuchTopic&)
{
- try
- {
- topic = manager->create(topicName);
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": temporary failure. try again." << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ topic = manager->create(topicName);
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": temporary failure. try again." << endl;
+ return EXIT_FAILURE;
+ }
}
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Clock.Subscriber");
@@ -116,47 +116,47 @@ Subscriber::run(int argc, char* argv[])
int optsSet = 0;
if(opts.isSet("datagram"))
{
- subscriber = subscriber->ice_datagram();
- ++optsSet;
+ subscriber = subscriber->ice_datagram();
+ ++optsSet;
}
if(opts.isSet("twoway"))
{
- // Do nothing to the subscriber proxy. Its already twoway.
- ++optsSet;
+ // Do nothing to the subscriber proxy. Its already twoway.
+ ++optsSet;
}
if(opts.isSet("ordered"))
{
- qos["reliability"] = "ordered";
- // Do nothing to the subscriber proxy. Its already twoway.
- ++optsSet;
+ qos["reliability"] = "ordered";
+ // Do nothing to the subscriber proxy. Its already twoway.
+ ++optsSet;
}
if(opts.isSet("oneway") || optsSet == 0)
{
- subscriber = subscriber->ice_oneway();
- ++optsSet;
+ subscriber = subscriber->ice_oneway();
+ ++optsSet;
}
if(optsSet != 1)
{
- usage(appName());
- return EXIT_FAILURE;
+ usage(appName());
+ return EXIT_FAILURE;
}
if(opts.isSet("batch"))
{
- if(opts.isSet("twoway") || opts.isSet("ordered"))
- {
- cerr << appName() << ": batch can only be set with oneway or datagram" << endl;
- return EXIT_FAILURE;
- }
- if(opts.isSet("datagram"))
- {
- subscriber = subscriber->ice_batchDatagram();
- }
- else
- {
- subscriber = subscriber->ice_batchOneway();
- }
+ if(opts.isSet("twoway") || opts.isSet("ordered"))
+ {
+ cerr << appName() << ": batch can only be set with oneway or datagram" << endl;
+ return EXIT_FAILURE;
+ }
+ if(opts.isSet("datagram"))
+ {
+ subscriber = subscriber->ice_batchDatagram();
+ }
+ else
+ {
+ subscriber = subscriber->ice_batchOneway();
+ }
}
topic->subscribeAndGetPublisher(qos, subscriber);
diff --git a/cpp/demo/IceStorm/counter/Client.cpp b/cpp/demo/IceStorm/counter/Client.cpp
index 82fa66270c0..863b90f9bcd 100644
--- a/cpp/demo/IceStorm/counter/Client.cpp
+++ b/cpp/demo/IceStorm/counter/Client.cpp
@@ -40,15 +40,15 @@ Client::run(int argc, char* argv[])
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
+ return EXIT_FAILURE;
}
CounterPrx counter = CounterPrx::uncheckedCast(communicator()->stringToProxy(proxy));
if(!counter)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
MTPrinterPtr printer = new MTPrinter();
@@ -65,36 +65,36 @@ Client::run(int argc, char* argv[])
char c;
do
{
- try
- {
- printer->print("==> ");
- cin >> c;
- if(c == 'i')
- {
- counter->inc(1);
- }
- else if(c == 'd')
- {
- counter->inc(-1);
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu(printer);
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu(printer);
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ printer->print("==> ");
+ cin >> c;
+ if(c == 'i')
+ {
+ counter->inc(1);
+ }
+ else if(c == 'd')
+ {
+ counter->inc(-1);
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu(printer);
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu(printer);
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -107,9 +107,9 @@ void
Client::menu(const MTPrinterPtr& printer)
{
printer->print(
- "usage:\n"
- "i: increment the counter\n"
- "d: decrement the counter\n"
- "x: exit\n"
- "?: help\n");
+ "usage:\n"
+ "i: increment the counter\n"
+ "d: decrement the counter\n"
+ "x: exit\n"
+ "?: help\n");
}
diff --git a/cpp/demo/IceStorm/counter/CounterI.cpp b/cpp/demo/IceStorm/counter/CounterI.cpp
index 9391cec441f..ff9fad3d1f2 100644
--- a/cpp/demo/IceStorm/counter/CounterI.cpp
+++ b/cpp/demo/IceStorm/counter/CounterI.cpp
@@ -32,7 +32,7 @@ CounterI::subscribe(const CounterObserverPrx& observer, const Ice::Current&)
// the given subscriber.
//
CounterObserverPrx o = CounterObserverPrx::uncheckedCast(
- _topic->subscribeAndGetPublisher(IceStorm::QoS(), observer));
+ _topic->subscribeAndGetPublisher(IceStorm::QoS(), observer));
o->init(_value);
}
diff --git a/cpp/demo/IceStorm/counter/Server.cpp b/cpp/demo/IceStorm/counter/Server.cpp
index 33bbcb4c8aa..838b7d11efa 100644
--- a/cpp/demo/IceStorm/counter/Server.cpp
+++ b/cpp/demo/IceStorm/counter/Server.cpp
@@ -40,33 +40,33 @@ Server::run(int argc, char* argv[])
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(communicator()->stringToProxy(proxy));
if(!manager)
{
- cerr << appName() << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << appName() << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicPrx topic;
try
{
- topic = manager->retrieve("counter");
+ topic = manager->retrieve("counter");
}
catch(const IceStorm::NoSuchTopic&)
{
- try
- {
- topic = manager->create("counter");
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": topic exists, please try again." << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ topic = manager->create("counter");
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": topic exists, please try again." << endl;
+ return EXIT_FAILURE;
+ }
}
//
diff --git a/cpp/demo/IceStorm/replicated/Publisher.cpp b/cpp/demo/IceStorm/replicated/Publisher.cpp
index c1d1d1ec52b..cf432841e02 100644
--- a/cpp/demo/IceStorm/replicated/Publisher.cpp
+++ b/cpp/demo/IceStorm/replicated/Publisher.cpp
@@ -54,7 +54,7 @@ Publisher::run(int argc, char* argv[])
catch(const IceStorm::NoSuchTopic&)
{
cerr << appName() << ": topics not created yet, run subscriber." << endl;
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
//
diff --git a/cpp/demo/IceStorm/replicated/Subscriber.cpp b/cpp/demo/IceStorm/replicated/Subscriber.cpp
index 8755650cf9f..a6fbc11e35d 100644
--- a/cpp/demo/IceStorm/replicated/Subscriber.cpp
+++ b/cpp/demo/IceStorm/replicated/Subscriber.cpp
@@ -72,34 +72,34 @@ Subscriber::run(int argc, char* argv[])
Ice::ObjectProxySeq::const_iterator p;
for(p = managers.begin(); p != managers.end(); ++p)
{
- //
- // Add a Servant for the Ice Object.
- //
- IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(*p);
+ //
+ // Add a Servant for the Ice Object.
+ //
+ IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(*p);
- try
- {
+ try
+ {
topic = manager->retrieve(topicName);
- }
- catch(const IceStorm::NoSuchTopic&)
- {
- try
- {
- topic = manager->create(topicName);
- }
- catch(const IceStorm::TopicExists&)
- {
- cerr << appName() << ": temporary failure. try again." << endl;
- return EXIT_FAILURE;
- }
- }
+ }
+ catch(const IceStorm::NoSuchTopic&)
+ {
+ try
+ {
+ topic = manager->create(topicName);
+ }
+ catch(const IceStorm::TopicExists&)
+ {
+ cerr << appName() << ": temporary failure. try again." << endl;
+ return EXIT_FAILURE;
+ }
+ }
}
Ice::ObjectProxySeq topics = query->findAllReplicas(topic);
for(p = topics.begin(); p != topics.end(); ++p)
{
topic = IceStorm::TopicPrx::uncheckedCast(*p);
- topic->subscribeAndGetPublisher(IceStorm::QoS(), clock);
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), clock);
}
adapter->activate();
diff --git a/cpp/demo/IceUtil/workqueue/WorkQueue.cpp b/cpp/demo/IceUtil/workqueue/WorkQueue.cpp
index 2b7c081e1da..3e006040fae 100644
--- a/cpp/demo/IceUtil/workqueue/WorkQueue.cpp
+++ b/cpp/demo/IceUtil/workqueue/WorkQueue.cpp
@@ -36,28 +36,28 @@ public:
virtual void
run()
{
- while(1)
- {
- string item = nextItem();
- if(item == "destroy")
- {
- break;
- }
-
- mtprint("work item: " + item + "\n");
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
- }
+ while(1)
+ {
+ string item = nextItem();
+ if(item == "destroy")
+ {
+ break;
+ }
+
+ mtprint("work item: " + item + "\n");
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
+ }
}
void
add(const string& item)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
- if(_queue.empty())
- {
- _monitor.notify();
- }
- _queue.push_back(item);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
+ if(_queue.empty())
+ {
+ _monitor.notify();
+ }
+ _queue.push_back(item);
}
private:
@@ -65,15 +65,15 @@ private:
string
nextItem()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
- while(_queue.empty())
- {
- _monitor.wait();
- }
-
- string item = _queue.front();
- _queue.pop_front();
- return item;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
+ while(_queue.empty())
+ {
+ _monitor.wait();
+ }
+
+ string item = _queue.front();
+ _queue.pop_front();
+ return item;
}
@@ -88,31 +88,31 @@ main()
{
try
{
- WorkQueuePtr h = new WorkQueue();
- IceUtil::ThreadControl control = h->start();
- mtprint("Pushing work items");
- mtprint(".");
- h->add("item1");
- mtprint(".");
- h->add("item2");
- mtprint(".");
- h->add("item3");
- mtprint(".");
- h->add("item4");
- mtprint(".");
- h->add("item5");
- mtprint(".");
- h->add("destroy");
- mtprint("ok\n");
- mtprint("Waiting for WorkQueue to terminate\n");
- control.join();
+ WorkQueuePtr h = new WorkQueue();
+ IceUtil::ThreadControl control = h->start();
+ mtprint("Pushing work items");
+ mtprint(".");
+ h->add("item1");
+ mtprint(".");
+ h->add("item2");
+ mtprint(".");
+ h->add("item3");
+ mtprint(".");
+ h->add("item4");
+ mtprint(".");
+ h->add("item5");
+ mtprint(".");
+ h->add("destroy");
+ mtprint("ok\n");
+ mtprint("Waiting for WorkQueue to terminate\n");
+ control.join();
}
catch(const IceUtil::Exception& ex)
{
- ostringstream os;
- os << ex << "\n";
- mtprint(os.str());
- return EXIT_FAILURE;
+ ostringstream os;
+ os << ex << "\n";
+ mtprint(os.str());
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
diff --git a/cpp/demo/book/evictor/EvictorBase.cpp b/cpp/demo/book/evictor/EvictorBase.cpp
index 49edb2a3366..fbea9580212 100644
--- a/cpp/demo/book/evictor/EvictorBase.cpp
+++ b/cpp/demo/book/evictor/EvictorBase.cpp
@@ -28,26 +28,26 @@ EvictorBase::locate(const Ice::Current& c, Ice::LocalObjectPtr& cookie)
bool newEntry = i == _map.end();
if(!newEntry)
{
- //
- // Got an entry already, dequeue the entry from its current position.
- //
- ec->entry = i->second;
- _queue.erase(ec->entry->pos);
+ //
+ // Got an entry already, dequeue the entry from its current position.
+ //
+ ec->entry = i->second;
+ _queue.erase(ec->entry->pos);
}
else
{
- //
- // We do not have an entry. Ask the derived class to
- // instantiate a servant and add a new entry to the map.
- //
- ec->entry = new EvictorEntry;
- ec->entry->servant = add(c, ec->entry->userCookie); // Down-call
- if(!ec->entry->servant)
- {
- return 0;
- }
- ec->entry->useCount = 0;
- i = _map.insert(std::make_pair(c.id, ec->entry)).first;
+ //
+ // We do not have an entry. Ask the derived class to
+ // instantiate a servant and add a new entry to the map.
+ //
+ ec->entry = new EvictorEntry;
+ ec->entry->servant = add(c, ec->entry->userCookie); // Down-call
+ if(!ec->entry->servant)
+ {
+ return 0;
+ }
+ ec->entry->useCount = 0;
+ i = _map.insert(std::make_pair(c.id, ec->entry)).first;
}
//
@@ -93,13 +93,13 @@ EvictorBase::evictServants()
//
for(int i = static_cast<int>(_map.size() - _size); i > 0; --i)
{
- EvictorQueue::reverse_iterator p = _queue.rbegin();
- if((*p)->second->useCount == 0)
- {
- evict((*p)->second->servant, (*p)->second->userCookie); // Down-call
- EvictorMap::iterator pos = *p;
- _queue.erase((*p)->second->pos);
- _map.erase(pos);
- }
+ EvictorQueue::reverse_iterator p = _queue.rbegin();
+ if((*p)->second->useCount == 0)
+ {
+ evict((*p)->second->servant, (*p)->second->userCookie); // Down-call
+ EvictorMap::iterator pos = *p;
+ _queue.erase((*p)->second->pos);
+ _map.erase(pos);
+ }
}
}
diff --git a/cpp/demo/book/evictor/EvictorBase.h b/cpp/demo/book/evictor/EvictorBase.h
index 3677bffe4b6..030f3318394 100644
--- a/cpp/demo/book/evictor/EvictorBase.h
+++ b/cpp/demo/book/evictor/EvictorBase.h
@@ -30,15 +30,15 @@ private:
struct EvictorEntry : public Ice::LocalObject
{
- Ice::ObjectPtr servant;
- Ice::LocalObjectPtr userCookie;
- EvictorQueue::iterator pos;
- int useCount;
+ Ice::ObjectPtr servant;
+ Ice::LocalObjectPtr userCookie;
+ EvictorQueue::iterator pos;
+ int useCount;
};
struct EvictorCookie : public Ice::LocalObject
{
- EvictorEntryPtr entry;
+ EvictorEntryPtr entry;
};
typedef IceUtil::Handle<EvictorCookie> EvictorCookiePtr;
diff --git a/cpp/demo/book/printer/Client.cpp b/cpp/demo/book/printer/Client.cpp
index 71f6bb711b2..4928da9a903 100755
--- a/cpp/demo/book/printer/Client.cpp
+++ b/cpp/demo/book/printer/Client.cpp
@@ -19,28 +19,28 @@ main(int argc, char * argv[])
int status = 0;
Ice::CommunicatorPtr ic;
try {
- ic = Ice::initialize(argc, argv);
- Ice::ObjectPrx base = ic->stringToProxy(
- "SimplePrinter:default -p 10000");
- PrinterPrx printer = PrinterPrx::checkedCast(base);
- if (!printer)
- throw "Invalid proxy";
+ ic = Ice::initialize(argc, argv);
+ Ice::ObjectPrx base = ic->stringToProxy(
+ "SimplePrinter:default -p 10000");
+ PrinterPrx printer = PrinterPrx::checkedCast(base);
+ if (!printer)
+ throw "Invalid proxy";
- printer->printString("Hello World!");
+ printer->printString("Hello World!");
} catch (const Ice::Exception & ex) {
- cerr << ex << endl;
- status = 1;
+ cerr << ex << endl;
+ status = 1;
} catch (const char * msg) {
- cerr << msg << endl;
- status = 1;
+ cerr << msg << endl;
+ status = 1;
}
if (ic) {
- try {
- ic->destroy();
- } catch (const Ice::Exception & ex) {
- cerr << ex << endl;
- status = 1;
- }
+ try {
+ ic->destroy();
+ } catch (const Ice::Exception & ex) {
+ cerr << ex << endl;
+ status = 1;
+ }
}
return status;
}
diff --git a/cpp/demo/book/printer/Printer.ice b/cpp/demo/book/printer/Printer.ice
index 20e46cdf549..01a4d213aa0 100755
--- a/cpp/demo/book/printer/Printer.ice
+++ b/cpp/demo/book/printer/Printer.ice
@@ -15,7 +15,7 @@ module Demo
interface Printer
{
- void printString(string s);
+ void printString(string s);
};
};
diff --git a/cpp/demo/book/printer/Server.cpp b/cpp/demo/book/printer/Server.cpp
index 2c9d22d4beb..1e619d76b16 100755
--- a/cpp/demo/book/printer/Server.cpp
+++ b/cpp/demo/book/printer/Server.cpp
@@ -16,7 +16,7 @@ using namespace Demo;
class PrinterI : public Printer {
public:
virtual void printString(const string & s,
- const Ice::Current &);
+ const Ice::Current &);
};
void
@@ -32,29 +32,29 @@ main(int argc, char* argv[])
int status = 0;
Ice::CommunicatorPtr ic;
try {
- ic = Ice::initialize(argc, argv);
- Ice::ObjectAdapterPtr adapter
- = ic->createObjectAdapterWithEndpoints(
- "SimplePrinterAdapter", "default -p 10000");
- Ice::ObjectPtr object = new PrinterI;
- adapter->add(object,
- ic->stringToIdentity("SimplePrinter"));
- adapter->activate();
- ic->waitForShutdown();
+ ic = Ice::initialize(argc, argv);
+ Ice::ObjectAdapterPtr adapter
+ = ic->createObjectAdapterWithEndpoints(
+ "SimplePrinterAdapter", "default -p 10000");
+ Ice::ObjectPtr object = new PrinterI;
+ adapter->add(object,
+ ic->stringToIdentity("SimplePrinter"));
+ adapter->activate();
+ ic->waitForShutdown();
} catch (const Ice::Exception & e) {
- cerr << e << endl;
- status = 1;
+ cerr << e << endl;
+ status = 1;
} catch (const char * msg) {
- cerr << msg << endl;
- status = 1;
+ cerr << msg << endl;
+ status = 1;
}
if (ic) {
try {
- ic->destroy();
- } catch (const Ice::Exception & e) {
- cerr << e << endl;
- status = 1;
- }
+ ic->destroy();
+ } catch (const Ice::Exception & e) {
+ cerr << e << endl;
+ status = 1;
+ }
}
return status;
}
diff --git a/cpp/demo/book/simple_filesystem/Client.cpp b/cpp/demo/book/simple_filesystem/Client.cpp
index 870b879e0d9..00cbc8a425e 100755
--- a/cpp/demo/book/simple_filesystem/Client.cpp
+++ b/cpp/demo/book/simple_filesystem/Client.cpp
@@ -27,16 +27,16 @@ listRecursive(const DirectoryPrx & dir, int depth = 0)
NodeSeq contents = dir->list();
for (NodeSeq::const_iterator i = contents.begin(); i != contents.end(); ++i) {
- DirectoryPrx dir = DirectoryPrx::checkedCast(*i);
- FilePrx file = FilePrx::uncheckedCast(*i);
- cout << indent << (*i)->name() << (dir ? " (directory):" : " (file):") << endl;
- if (dir) {
- listRecursive(dir, depth);
- } else {
- Lines text = file->read();
- for (Lines::const_iterator j = text.begin(); j != text.end(); ++j)
- cout << indent << "\t" << *j << endl;
- }
+ DirectoryPrx dir = DirectoryPrx::checkedCast(*i);
+ FilePrx file = FilePrx::uncheckedCast(*i);
+ cout << indent << (*i)->name() << (dir ? " (directory):" : " (file):") << endl;
+ if (dir) {
+ listRecursive(dir, depth);
+ } else {
+ Lines text = file->read();
+ for (Lines::const_iterator j = text.begin(); j != text.end(); ++j)
+ cout << indent << "\t" << *j << endl;
+ }
}
}
@@ -46,38 +46,38 @@ main(int argc, char * argv[])
int status = 0;
Ice::CommunicatorPtr ic;
try {
- // Create a communicator
- //
- ic = Ice::initialize(argc, argv);
+ // Create a communicator
+ //
+ ic = Ice::initialize(argc, argv);
- // Create a proxy for the root directory
- //
- Ice::ObjectPrx base = ic->stringToProxy("RootDir:default -p 10000");
- if (!base)
- throw "Could not create proxy";
+ // Create a proxy for the root directory
+ //
+ Ice::ObjectPrx base = ic->stringToProxy("RootDir:default -p 10000");
+ if (!base)
+ throw "Could not create proxy";
- // Down-cast the proxy to a Directory proxy
- //
- DirectoryPrx rootDir = DirectoryPrx::checkedCast(base);
- if (!rootDir)
- throw "Invalid proxy";
+ // Down-cast the proxy to a Directory proxy
+ //
+ DirectoryPrx rootDir = DirectoryPrx::checkedCast(base);
+ if (!rootDir)
+ throw "Invalid proxy";
- // Recursively list the contents of the root directory
- //
- cout << "Contents of root directory:" << endl;
- listRecursive(rootDir);
+ // Recursively list the contents of the root directory
+ //
+ cout << "Contents of root directory:" << endl;
+ listRecursive(rootDir);
} catch (const Ice::Exception & ex) {
- cerr << ex << endl;
- status = 1;
+ cerr << ex << endl;
+ status = 1;
} catch (const char * msg) {
- cerr << msg << endl;
- status = 1;
+ cerr << msg << endl;
+ status = 1;
}
// Clean up
//
if (ic)
- ic->destroy();
+ ic->destroy();
return status;
}
diff --git a/cpp/demo/book/simple_filesystem/Filesystem.ice b/cpp/demo/book/simple_filesystem/Filesystem.ice
index 8592c68381e..de701e15cee 100755
--- a/cpp/demo/book/simple_filesystem/Filesystem.ice
+++ b/cpp/demo/book/simple_filesystem/Filesystem.ice
@@ -9,23 +9,23 @@
module Filesystem {
exception GenericError {
- string reason;
+ string reason;
};
interface Node {
- ["cpp:const"] idempotent string name();
+ ["cpp:const"] idempotent string name();
};
sequence<string> Lines;
interface File extends Node {
- ["cpp:const"] idempotent Lines read();
- idempotent void write(Lines text) throws GenericError;
+ ["cpp:const"] idempotent Lines read();
+ idempotent void write(Lines text) throws GenericError;
};
sequence<Node*> NodeSeq;
interface Directory extends Node {
- ["cpp:const"] idempotent NodeSeq list();
+ ["cpp:const"] idempotent NodeSeq list();
};
};
diff --git a/cpp/demo/book/simple_filesystem/FilesystemI.cpp b/cpp/demo/book/simple_filesystem/FilesystemI.cpp
index 8560075d36c..7367e89e3e8 100755
--- a/cpp/demo/book/simple_filesystem/FilesystemI.cpp
+++ b/cpp/demo/book/simple_filesystem/FilesystemI.cpp
@@ -12,7 +12,7 @@
using namespace std;
-Ice::ObjectAdapterPtr Filesystem::NodeI::_adapter; // static member
+Ice::ObjectAdapterPtr Filesystem::NodeI::_adapter; // static member
// Slice Node::name() operation
@@ -39,15 +39,15 @@ Filesystem::NodeI::NodeI(const Ice::CommunicatorPtr & ic, const string & name, c
//
Ice::Identity myID;
if (parent)
- myID = ic->stringToIdentity(IceUtil::generateUUID());
+ myID = ic->stringToIdentity(IceUtil::generateUUID());
else
- myID = ic->stringToIdentity("RootDir");
+ myID = ic->stringToIdentity("RootDir");
// Create a proxy for the new node and add it as a child to the parent
//
NodePrx thisNode = NodePrx::uncheckedCast(_adapter->createProxy(myID));
if (parent)
- parent->addChild(thisNode);
+ parent->addChild(thisNode);
// Activate the servant
//
@@ -66,7 +66,7 @@ Filesystem::FileI::read(const Ice::Current &) const
void
Filesystem::FileI::write(const Filesystem::Lines & text,
- const Ice::Current &)
+ const Ice::Current &)
{
_lines = text;
}
diff --git a/cpp/demo/book/simple_filesystem/FilesystemI.h b/cpp/demo/book/simple_filesystem/FilesystemI.h
index fde910b3ac0..c627ce35116 100755
--- a/cpp/demo/book/simple_filesystem/FilesystemI.h
+++ b/cpp/demo/book/simple_filesystem/FilesystemI.h
@@ -19,33 +19,33 @@ namespace Filesystem {
class NodeI : virtual public Node {
public:
- virtual std::string name(const Ice::Current &) const;
- NodeI(const Ice::CommunicatorPtr &, const std::string &, const DirectoryIPtr & parent);
- static Ice::ObjectAdapterPtr _adapter;
+ virtual std::string name(const Ice::Current &) const;
+ NodeI(const Ice::CommunicatorPtr &, const std::string &, const DirectoryIPtr & parent);
+ static Ice::ObjectAdapterPtr _adapter;
private:
- const std::string _name;
- DirectoryIPtr _parent;
+ const std::string _name;
+ DirectoryIPtr _parent;
};
class FileI : virtual public File,
- virtual public NodeI {
+ virtual public NodeI {
public:
- virtual Lines read(const Ice::Current &) const;
- virtual void write(const Lines &,
- const Ice::Current &);
- FileI(const Ice::CommunicatorPtr &, const std::string &, const DirectoryIPtr &);
+ virtual Lines read(const Ice::Current &) const;
+ virtual void write(const Lines &,
+ const Ice::Current &);
+ FileI(const Ice::CommunicatorPtr &, const std::string &, const DirectoryIPtr &);
private:
- Lines _lines;
+ Lines _lines;
};
class DirectoryI : virtual public Directory,
- virtual public NodeI {
+ virtual public NodeI {
public:
- virtual NodeSeq list(const Ice::Current &) const;
+ virtual NodeSeq list(const Ice::Current &) const;
DirectoryI(const Ice::CommunicatorPtr &, const std::string &, const DirectoryIPtr &);
- void addChild(NodePrx child);
+ void addChild(NodePrx child);
private:
- NodeSeq _contents;
+ NodeSeq _contents;
};
}
diff --git a/cpp/demo/book/simple_filesystem/Server.cpp b/cpp/demo/book/simple_filesystem/Server.cpp
index 84cd4fadbdd..59aa1f61e83 100755
--- a/cpp/demo/book/simple_filesystem/Server.cpp
+++ b/cpp/demo/book/simple_filesystem/Server.cpp
@@ -17,57 +17,57 @@ class FilesystemApp : virtual public Ice::Application {
public:
virtual int run(int, char * []) {
// Terminate cleanly on receipt of a signal
- //
- shutdownOnInterrupt();
+ //
+ shutdownOnInterrupt();
- // Create an object adapter (stored in the NodeI::_adapter
- // static member)
- //
- NodeI::_adapter =
- communicator()->createObjectAdapterWithEndpoints(
- "SimpleFilesystem", "default -p 10000");
+ // Create an object adapter (stored in the NodeI::_adapter
+ // static member)
+ //
+ NodeI::_adapter =
+ communicator()->createObjectAdapterWithEndpoints(
+ "SimpleFilesystem", "default -p 10000");
- // Create the root directory (with name "/" and no parent)
- //
- DirectoryIPtr root = new DirectoryI(communicator(), "/", 0);
+ // Create the root directory (with name "/" and no parent)
+ //
+ DirectoryIPtr root = new DirectoryI(communicator(), "/", 0);
- // Create a file called "README" in the root directory
- //
- FilePtr file = new FileI(communicator(), "README", root);
- Lines text;
- text.push_back("This file system contains a collection of poetry.");
- file->write(text);
+ // Create a file called "README" in the root directory
+ //
+ FilePtr file = new FileI(communicator(), "README", root);
+ Lines text;
+ text.push_back("This file system contains a collection of poetry.");
+ file->write(text);
- // Create a directory called "Coleridge" in the root directory
- //
- DirectoryIPtr coleridge = new DirectoryI(communicator(), "Coleridge", root);
+ // Create a directory called "Coleridge" in the root directory
+ //
+ DirectoryIPtr coleridge = new DirectoryI(communicator(), "Coleridge", root);
- // Create a file called "Kubla_Khan" in the Coleridge directory
- //
- file = new FileI(communicator(), "Kubla_Khan", coleridge);
- text.erase(text.begin(), text.end());
- text.push_back("In Xanadu did Kubla Khan");
- text.push_back("A stately pleasure-dome decree:");
- text.push_back("Where Alph, the sacred river, ran");
- text.push_back("Through caverns measureless to man");
- text.push_back("Down to a sunless sea.");
- file->write(text);
+ // Create a file called "Kubla_Khan" in the Coleridge directory
+ //
+ file = new FileI(communicator(), "Kubla_Khan", coleridge);
+ text.erase(text.begin(), text.end());
+ text.push_back("In Xanadu did Kubla Khan");
+ text.push_back("A stately pleasure-dome decree:");
+ text.push_back("Where Alph, the sacred river, ran");
+ text.push_back("Through caverns measureless to man");
+ text.push_back("Down to a sunless sea.");
+ file->write(text);
- // All objects are created, allow client requests now
- //
- NodeI::_adapter->activate();
+ // All objects are created, allow client requests now
+ //
+ NodeI::_adapter->activate();
- // Wait until we are done
- //
- communicator()->waitForShutdown();
+ // Wait until we are done
+ //
+ communicator()->waitForShutdown();
if (interrupted()) {
cerr << appName()
- << ": received signal, shutting down" << endl;
- }
+ << ": received signal, shutting down" << endl;
+ }
- NodeI::_adapter = 0;
+ NodeI::_adapter = 0;
- return 0;
+ return 0;
};
};
diff --git a/cpp/fixCopyright.py b/cpp/fixCopyright.py
index 5edbbdf7c0a..4feb798c8a4 100755
--- a/cpp/fixCopyright.py
+++ b/cpp/fixCopyright.py
@@ -123,7 +123,7 @@ def replaceCopyright(file, commentMark, commentBegin, commentEnd, newCopyrightLi
# Hack to keep the .err files
#
if fnmatch.fnmatch(file, "*test/Slice/errorDetection/*.ice") > 0:
- newFile.write("\n")
+ newFile.write("\n")
newFile.writelines(newLines)
newFile.close()
@@ -215,7 +215,7 @@ for x in sys.argv[1:]:
sys.exit(0)
elif x == "-e":
patchIceE = True
- path = "../icee"
+ path = "../icee"
elif x.startswith("-"):
print sys.argv[0] + ": unknown option `" + x + "'"
print
diff --git a/cpp/fixVersion.py b/cpp/fixVersion.py
index 4c7db0352f1..3e5577ad118 100755
--- a/cpp/fixVersion.py
+++ b/cpp/fixVersion.py
@@ -164,13 +164,13 @@ def fileMatchAllAndReplace(filename, matchAndReplaceExps):
#
updated = False
for line in oldFile.readlines():
- for (regexp, replace) in regexps:
- match = regexp.search(line)
- if match != None:
- oldLine = line
- line = oldLine.replace(match.group(1), replace)
- updated = True
- newFile.write(line)
+ for (regexp, replace) in regexps:
+ match = regexp.search(line)
+ if match != None:
+ oldLine = line
+ line = oldLine.replace(match.group(1), replace)
+ updated = True
+ newFile.write(line)
newFile.close()
oldFile.close()
@@ -196,7 +196,7 @@ except getopt.GetoptError:
for o, a in opts:
if o in ("-h", "--help"):
usage()
- sys.exit(0)
+ sys.exit(0)
if o in ("-e"):
patchIceE = True
if len(args) != 1:
@@ -217,87 +217,87 @@ if not patchIceE:
#
ice_home = findSourceTree("ice", os.path.join("include", "IceUtil", "Config.h"))
if ice_home:
- fileMatchAndReplace(os.path.join(ice_home, "include", "IceUtil", "Config.h"),
- [("ICE_STRING_VERSION \"" + vpatMatch + "\"", version), \
+ fileMatchAndReplace(os.path.join(ice_home, "include", "IceUtil", "Config.h"),
+ [("ICE_STRING_VERSION \"" + vpatMatch + "\"", version), \
("ICE_INT_VERSION ([0-9]*)", intVersion(version))])
- fileMatchAndReplace(os.path.join(ice_home, "config", "Make.rules"),
- [("VERSION_MAJOR[\t\s]*= ([0-9]*)", majorVersion(version)),
+ fileMatchAndReplace(os.path.join(ice_home, "config", "Make.rules"),
+ [("VERSION_MAJOR[\t\s]*= ([0-9]*)", majorVersion(version)),
("VERSION_MINOR[\t\s]*= ([0-9]*)", minorVersion(version)),
("VERSION[\t\s]*= " + vpatMatch, version),
("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
- fileMatchAndReplace(os.path.join(ice_home, "config", "Make.rules.mak"),
- [("VERSION[\t\s]*= " + vpatMatch, version),
- ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(ice_home, "config", "Make.rules.mak"),
+ [("VERSION[\t\s]*= " + vpatMatch, version),
+ ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
- fileMatchAndReplace(os.path.join(ice_home, "src", "ca", "iceca"),
- [("Ice-" + vpatMatch, version)])
+ fileMatchAndReplace(os.path.join(ice_home, "src", "ca", "iceca"),
+ [("Ice-" + vpatMatch, version)])
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", soVersion(version))])
- fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "counter", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(ice_home, "demo", "IceStorm", "counter", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", soVersion(version))])
fileMatchAndReplace(os.path.join(ice_home, "config", "templates.xml"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
+ [("IceStormService,([0-9]+b?)", soVersion(version))])
#
# Fix version in IceJ sources
#
icej_home = findSourceTree("icej", os.path.join("src", "IceUtil", "Version.java"))
if icej_home:
- fileMatchAndReplace(os.path.join(icej_home, "src", "IceUtil", "Version.java"),
- [("ICE_STRING_VERSION = \"" + vpatMatch +"\"", version), \
- ("ICE_INT_VERSION = ([0-9]*)", intVersion(version))])
+ fileMatchAndReplace(os.path.join(icej_home, "src", "IceUtil", "Version.java"),
+ [("ICE_STRING_VERSION = \"" + vpatMatch +"\"", version), \
+ ("ICE_INT_VERSION = ([0-9]*)", intVersion(version))])
- fileMatchAndReplace(os.path.join(icej_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(icej_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", soVersion(version))])
#
# Fix version in IceCS sources
#
icecs_home = findSourceTree("icecs", os.path.join("src", "Ice", "AssemblyInfo.cs"))
if icecs_home:
- for f in find(icecs_home, "AssemblyInfo.cs"):
- if f.find("generate") < 0 and f.find("ConsoleApplication") < 0:
- fileMatchAndReplace(f, [("AssemblyVersion\(\"" + vpatMatch + "\"",
+ for f in find(icecs_home, "AssemblyInfo.cs"):
+ if f.find("generate") < 0 and f.find("ConsoleApplication") < 0:
+ fileMatchAndReplace(f, [("AssemblyVersion\(\"" + vpatMatch + "\"",
majorVersion(version) + "." + minorVersion(version) + "." + patchVersion(version))])
- fileMatchAndReplace(os.path.join(icecs_home, "config", "Make.rules.cs"),
- [("VERSION[\t\s]*= " + vpatMatch, version)])
+ fileMatchAndReplace(os.path.join(icecs_home, "config", "Make.rules.cs"),
+ [("VERSION[\t\s]*= " + vpatMatch, version)])
- fileMatchAndReplace(os.path.join(icecs_home, "config", "Make.rules.mak"),
- [("VERSION[\t\s]*= " + vpatMatch, version)])
+ fileMatchAndReplace(os.path.join(icecs_home, "config", "Make.rules.mak"),
+ [("VERSION[\t\s]*= " + vpatMatch, version)])
- fileMatchAndReplace(os.path.join(icecs_home, "config", "makeconfig.py"),
- [("version=*\"([0-9]*\.[0-9]*\.[0-9]*).0\"",
+ fileMatchAndReplace(os.path.join(icecs_home, "config", "makeconfig.py"),
+ [("version=*\"([0-9]*\.[0-9]*\.[0-9]*).0\"",
majorVersion(version) + "." + minorVersion(version) + "." + patchVersion(version))])
- cmd = "chmod 770 " + os.path.join(icecs_home, "config", "makeconfig.py")
- os.system(cmd)
+ cmd = "chmod 770 " + os.path.join(icecs_home, "config", "makeconfig.py")
+ os.system(cmd)
- fileMatchAndReplace(os.path.join(icecs_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(icecs_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", soVersion(version))])
- for f in find(icecs_home, "*.pc"):
- fileMatchAndReplace(f, [("[\t\s]*version[\t\s]*=[\t\s]*" + vpatMatch, version)])
+ for f in find(icecs_home, "*.pc"):
+ fileMatchAndReplace(f, [("[\t\s]*version[\t\s]*=[\t\s]*" + vpatMatch, version)])
#
# Fix version in IceVB sources
#
icevb_home = findSourceTree("icevb", os.path.join("generate", "Generate.vb"))
if icevb_home:
- fileMatchAndReplace(os.path.join(icevb_home, "config", "Make.rules.mak"),
- [("VERSION[\t\s]*= " + vpatMatch, version)])
+ fileMatchAndReplace(os.path.join(icevb_home, "config", "Make.rules.mak"),
+ [("VERSION[\t\s]*= " + vpatMatch, version)])
- fileMatchAndReplace(os.path.join(icevb_home, "config", "makeconfig.py"),
- [("codeBase version=\"" + vpatMatch + "\.0\"",
- majorVersion(version) + "." + minorVersion(version) + "." + patchVersion(version))])
+ fileMatchAndReplace(os.path.join(icevb_home, "config", "makeconfig.py"),
+ [("codeBase version=\"" + vpatMatch + "\.0\"",
+ majorVersion(version) + "." + minorVersion(version) + "." + patchVersion(version))])
- fileMatchAndReplace(os.path.join(icevb_home, "demo", "IceStorm", "clock", "config.icebox"),
- [("IceStormService,([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(icevb_home, "demo", "IceStorm", "clock", "config.icebox"),
+ [("IceStormService,([0-9]+b?)", soVersion(version))])
#
# Fix version in IcePHP
@@ -310,39 +310,39 @@ if not patchIceE:
("VERSION[\t\s]*= " + vpatMatch, version),
("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
- fileMatchAndReplace(os.path.join(icephp_home, "config", "Make.rules.mak"),
- [("VERSION[\t\s]*= " + vpatMatch, version),
- ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(icephp_home, "config", "Make.rules.mak"),
+ [("VERSION[\t\s]*= " + vpatMatch, version),
+ ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
print "Please update icephp/src/IcePHP/Profile.cpp: too difficult to parse!"
-
+
#
# Fix version in IcePy
#
icepy_home = findSourceTree("icepy", os.path.join("modules", "IcePy", "Config.h"))
if icepy_home:
fileMatchAndReplace(os.path.join(icepy_home, "config", "Make.rules"),
- [("VERSION_MAJOR[\t\s]*= ([0-9]*)", majorVersion(version)),
+ [("VERSION_MAJOR[\t\s]*= ([0-9]*)", majorVersion(version)),
("VERSION_MINOR[\t\s]*= ([0-9]*)", minorVersion(version)),
("VERSION[\t\s]*= " + vpatMatch, version),
("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
fileMatchAndReplace(os.path.join(icepy_home, "config", "Make.rules.mak"),
- [("VERSION[\t\s]*= " + vpatMatch, version),
- ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
+ [("VERSION[\t\s]*= " + vpatMatch, version),
+ ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
#
# Fix version in IceRuby
#
icerb_home = findSourceTree("icerb", os.path.join("src", "IceRuby", "Config.h"))
if icerb_home:
- fileMatchAndReplace(os.path.join(icerb_home, "config", "Make.rules"),
- [("VERSION[\t\s]*= " + vpatMatch, version),
- ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
+ fileMatchAndReplace(os.path.join(icerb_home, "config", "Make.rules"),
+ [("VERSION[\t\s]*= " + vpatMatch, version),
+ ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
fileMatchAndReplace(os.path.join(icerb_home, "config", "Make.rules.mak"),
- [("VERSION[\t\s]*= " + vpatMatch, version),
- ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
+ [("VERSION[\t\s]*= " + vpatMatch, version),
+ ("SOVERSION[\t\s]*= ([0-9]+b?)", soVersion(version))])
print "Running 'make config' in IceCS"
os.chdir(icecs_home)
diff --git a/cpp/iceemakedist.py b/cpp/iceemakedist.py
index 86ee099c13b..ae528b029da 100755
--- a/cpp/iceemakedist.py
+++ b/cpp/iceemakedist.py
@@ -226,24 +226,24 @@ if verbose:
else:
quiet = "-Q"
os.system("cvs " + quiet + " -d cvs.zeroc.com:/home/cvsroot export -l " + tag + " " +
- "ice " +
- "ice/bin " +
- "ice/config " +
- "ice/include " +
- "ice/include/IceUtil " +
- "ice/include/Slice " +
- "ice/install " +
- "ice/install/icee " +
- "ice/lib " +
- "ice/src " +
- "ice/src/icecpp " +
- "ice/src/IceUtil " +
- "ice/src/Slice " +
- "ice/src/Slice/dummyinclude " +
- "ice/src/slice2cppe " +
- "ice/src/slice2javae " +
- "icee/include/IceE/Config.h "
- )
+ "ice " +
+ "ice/bin " +
+ "ice/config " +
+ "ice/include " +
+ "ice/include/IceUtil " +
+ "ice/include/Slice " +
+ "ice/install " +
+ "ice/install/icee " +
+ "ice/lib " +
+ "ice/src " +
+ "ice/src/icecpp " +
+ "ice/src/IceUtil " +
+ "ice/src/Slice " +
+ "ice/src/Slice/dummyinclude " +
+ "ice/src/slice2cppe " +
+ "ice/src/slice2javae " +
+ "icee/include/IceE/Config.h "
+ )
#
# Copy Ice-E specific install files.
@@ -372,11 +372,11 @@ lines = makeRules.readlines()
makeRules.close()
for i in range(len(lines)):
if lines[i].find("#STATICLIBS") == 0:
- lines[i] = lines[i].replace("#STATICLIBS", "STATICLIBS")
+ lines[i] = lines[i].replace("#STATICLIBS", "STATICLIBS")
if lines[i].find("#OPTIMIZE") == 0:
- lines[i] = lines[i].replace("#OPTIMIZE", "OPTIMIZE")
+ lines[i] = lines[i].replace("#OPTIMIZE", "OPTIMIZE")
if lines[i].find("prefix") == 0:
- lines[i] = lines[i].replace("Ice-$(VERSION)", "IceE-" + version)
+ lines[i] = lines[i].replace("Ice-$(VERSION)", "IceE-" + version)
makeRules = open(makeRulesName, "w")
makeRules.writelines(lines)
makeRules.close()
@@ -390,9 +390,9 @@ lines = makeFile.readlines()
makeFile.close()
for i in range(len(lines)):
if lines[i].find("SUBDIRS") == 0:
- lines[i] = "SUBDIRS = src\n"
+ lines[i] = "SUBDIRS = src\n"
if lines[i].find("INSTALL_SUBDIRS") == 0:
- lines[i] = "INSTALL_SUBDIRS = $(install_bindir) $(install_libdir)\n"
+ lines[i] = "INSTALL_SUBDIRS = $(install_bindir) $(install_libdir)\n"
makeFile = open(makeFileName, "w")
makeFile.writelines(lines)
makeFile.close()
@@ -401,14 +401,14 @@ makeFile.close()
# Disable install targets for libIceUtil, libSlice.
#
for makeFileName in [os.path.join("ice", "src", "IceUtil", "Makefile"), \
- os.path.join("ice", "src", "Slice", "Makefile")]:
+ os.path.join("ice", "src", "Slice", "Makefile")]:
makeFile = open(makeFileName, "r")
lines = makeFile.readlines()
makeFile.close()
for i in range(len(lines)):
- if lines[i].find("install::") == 0:
- lines[i + 1] = "#" + lines[i + 1]
- break
+ if lines[i].find("install::") == 0:
+ lines[i + 1] = "#" + lines[i + 1]
+ break
makeFile = open(makeFileName, "w")
makeFile.writelines(lines)
makeFile.close()
diff --git a/cpp/include/Freeze/Initialize.h b/cpp/include/Freeze/Initialize.h
index de656d2be30..87684264415 100644
--- a/cpp/include/Freeze/Initialize.h
+++ b/cpp/include/Freeze/Initialize.h
@@ -26,27 +26,27 @@ namespace Freeze
{
FREEZE_API EvictorPtr createEvictor(const Ice::ObjectAdapterPtr& adapter,
- const std::string& envName,
- const std::string& filename,
- const ServantInitializerPtr& initializer = 0,
- const std::vector<Freeze::IndexPtr>& indices = std::vector<Freeze::IndexPtr>(),
- bool createDb = true);
+ const std::string& envName,
+ const std::string& filename,
+ const ServantInitializerPtr& initializer = 0,
+ const std::vector<Freeze::IndexPtr>& indices = std::vector<Freeze::IndexPtr>(),
+ bool createDb = true);
FREEZE_API EvictorPtr createEvictor(const Ice::ObjectAdapterPtr& adapter,
- const std::string& envName,
- DbEnv& dbEnv,
- const std::string& filename,
- const ServantInitializerPtr& initializer = 0,
- const std::vector<Freeze::IndexPtr>& indices = std::vector<Freeze::IndexPtr>(),
- bool createDb = true);
+ const std::string& envName,
+ DbEnv& dbEnv,
+ const std::string& filename,
+ const ServantInitializerPtr& initializer = 0,
+ const std::vector<Freeze::IndexPtr>& indices = std::vector<Freeze::IndexPtr>(),
+ bool createDb = true);
FREEZE_API ConnectionPtr createConnection(const Ice::CommunicatorPtr& communicator,
- const std::string& envName);
+ const std::string& envName);
FREEZE_API ConnectionPtr createConnection(const Ice::CommunicatorPtr& communicator,
- const std::string& envName,
- DbEnv& dbEnv);
+ const std::string& envName,
+ DbEnv& dbEnv);
FREEZE_API const std::string& catalogName();
diff --git a/cpp/include/Freeze/Map.h b/cpp/include/Freeze/Map.h
index 2f26699caec..1c7e61c2add 100644
--- a/cpp/include/Freeze/Map.h
+++ b/cpp/include/Freeze/Map.h
@@ -89,12 +89,12 @@ public:
static MapHelper*
create(const Freeze::ConnectionPtr& connection,
- const std::string& dbName,
- const std::string& key,
- const std::string& value,
- const KeyCompareBasePtr&,
- const std::vector<MapIndexBasePtr>&,
- bool createDb);
+ const std::string& dbName,
+ const std::string& key,
+ const std::string& value,
+ const KeyCompareBasePtr&,
+ const std::vector<MapIndexBasePtr>&,
+ bool createDb);
virtual ~MapHelper() = 0;
@@ -167,10 +167,10 @@ public:
// Forward declaration
//
template <typename key_type, typename mapped_type,
- typename KeyCodec, typename ValueCodec, typename Compare>
+ typename KeyCodec, typename ValueCodec, typename Compare>
class Map;
template <typename key_type, typename mapped_type,
- typename KeyCodec, typename ValueCodec, typename Compare>
+ typename KeyCodec, typename ValueCodec, typename Compare>
class ConstIterator;
//
@@ -193,7 +193,7 @@ struct IteratorBase
// necessary.
//
template<typename key_type, typename mapped_type,
- typename KeyCodec, typename ValueCodec, typename Compare>
+ typename KeyCodec, typename ValueCodec, typename Compare>
class Iterator : public IteratorBase
{
public:
@@ -207,16 +207,16 @@ public:
typedef value_type& reference;
Iterator(MapHelper& mapHelper, const Ice::CommunicatorPtr& communicator) :
- _helper(IteratorHelper::create(mapHelper, false)),
- _communicator(communicator),
- _refValid(false)
+ _helper(IteratorHelper::create(mapHelper, false)),
+ _communicator(communicator),
+ _refValid(false)
{
}
Iterator(IteratorHelper* helper, const Ice::CommunicatorPtr& communicator) :
- _helper(helper),
- _communicator(communicator),
- _refValid(false)
+ _helper(helper),
+ _communicator(communicator),
+ _refValid(false)
{
}
@@ -226,32 +226,32 @@ public:
}
Iterator(const Iterator& rhs) :
- _communicator(rhs._communicator),
+ _communicator(rhs._communicator),
_refValid(false)
{
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
+ if(rhs._helper.get() != 0)
+ {
+ _helper.reset(rhs._helper->clone());
+ }
}
Iterator& operator=(const Iterator& rhs)
{
- if(this != &rhs)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- else
- {
- _helper.reset();
- }
- _communicator = rhs._communicator;
- _refValid = false;
- }
+ if(this != &rhs)
+ {
+ if(rhs._helper.get() != 0)
+ {
+ _helper.reset(rhs._helper->clone());
+ }
+ else
+ {
+ _helper.reset();
+ }
+ _communicator = rhs._communicator;
+ _refValid = false;
+ }
- return *this;
+ return *this;
}
~Iterator()
@@ -260,40 +260,40 @@ public:
bool operator==(const Iterator& rhs) const
{
- if(_helper.get() == rhs._helper.get())
- {
- return true;
- }
-
- if(_helper.get() != 0 && rhs._helper.get() != 0)
- {
- const Key* lhsKey = _helper->get();
- const Key* rhsKey = rhs._helper->get();
-
- if(lhsKey != 0 && rhsKey != 0)
- {
- return *lhsKey == *rhsKey;
- }
- }
- return false;
+ if(_helper.get() == rhs._helper.get())
+ {
+ return true;
+ }
+
+ if(_helper.get() != 0 && rhs._helper.get() != 0)
+ {
+ const Key* lhsKey = _helper->get();
+ const Key* rhsKey = rhs._helper->get();
+
+ if(lhsKey != 0 && rhsKey != 0)
+ {
+ return *lhsKey == *rhsKey;
+ }
+ }
+ return false;
}
bool operator!=(const Iterator& rhs) const
{
- return !(*this == rhs);
+ return !(*this == rhs);
}
Iterator& operator++()
{
- incr();
- return *this;
+ incr();
+ return *this;
}
Iterator operator++(int)
{
- Iterator tmp = *this;
- incr();
- return tmp;
+ Iterator tmp = *this;
+ incr();
+ return tmp;
}
//
@@ -321,7 +321,7 @@ public:
_refValid = true;
}
- return _ref;
+ return _ref;
}
value_type* operator->() { return &(operator*()); }
@@ -331,11 +331,11 @@ public:
//
void set(const mapped_type& value)
{
- assert(_helper.get());
+ assert(_helper.get());
- Value v;
- ValueCodec::write(value, v, _communicator);
- _helper->set(v);
+ Value v;
+ ValueCodec::write(value, v, _communicator);
+ _helper->set(v);
_refValid = false;
}
@@ -343,36 +343,36 @@ private:
void incr()
{
- assert(_helper.get() != 0);
- if(!_helper->next())
- {
- //
- // The iterator has been moved past the end, and is now
- // invalid.
- //
- _helper.reset();
- }
+ assert(_helper.get() != 0);
+ if(!_helper->next())
+ {
+ //
+ // The iterator has been moved past the end, and is now
+ // invalid.
+ //
+ _helper.reset();
+ }
_refValid = false;
}
void getCurrentValue(key_type& key, mapped_type& value) const
{
- assert(_helper.get() != 0);
+ assert(_helper.get() != 0);
- const Key* k = 0;
- const Value* v = 0;
- _helper->get(k, v);
- assert(k != 0);
- assert(v != 0);
+ const Key* k = 0;
+ const Value* v = 0;
+ _helper->get(k, v);
+ assert(k != 0);
+ assert(v != 0);
- KeyCodec::read(key, *k, _communicator);
- ValueCodec::read(value, *v, _communicator);
+ KeyCodec::read(key, *k, _communicator);
+ ValueCodec::read(value, *v, _communicator);
}
friend class ConstIterator<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare>;
+ KeyCodec, ValueCodec, Compare>;
friend class Map<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare>;
+ KeyCodec, ValueCodec, Compare>;
std::auto_ptr<IteratorHelper> _helper;
Ice::CommunicatorPtr _communicator;
@@ -395,7 +395,7 @@ private:
// See Iterator comments for design notes
//
template <typename key_type, typename mapped_type,
- typename KeyCodec, typename ValueCodec, typename Compare>
+ typename KeyCodec, typename ValueCodec, typename Compare>
class ConstIterator : public IteratorBase
{
public:
@@ -409,16 +409,16 @@ public:
typedef value_type& reference;
ConstIterator(MapHelper& mapHelper, const Ice::CommunicatorPtr& communicator) :
- _helper(IteratorHelper::create(mapHelper, true)),
- _communicator(_communicator),
- _refValid(false)
+ _helper(IteratorHelper::create(mapHelper, true)),
+ _communicator(_communicator),
+ _refValid(false)
{
}
ConstIterator(IteratorHelper* helper, const Ice::CommunicatorPtr& communicator) :
- _helper(helper),
- _communicator(communicator),
- _refValid(false)
+ _helper(helper),
+ _communicator(communicator),
+ _refValid(false)
{
}
@@ -428,13 +428,13 @@ public:
}
ConstIterator(const ConstIterator& rhs) :
- _communicator(rhs._communicator),
+ _communicator(rhs._communicator),
_refValid(false)
{
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
+ if(rhs._helper.get() != 0)
+ {
+ _helper.reset(rhs._helper->clone());
+ }
}
//
@@ -442,53 +442,53 @@ public:
// vice versa) - same for operator=.
//
ConstIterator(const Iterator<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare>& rhs) :
+ KeyCodec, ValueCodec, Compare>& rhs) :
_refValid(false)
{
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- _communicator = rhs._communicator;
+ if(rhs._helper.get() != 0)
+ {
+ _helper.reset(rhs._helper->clone());
+ }
+ _communicator = rhs._communicator;
}
ConstIterator& operator=(const ConstIterator& rhs)
{
- if(this != &rhs)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- else
- {
- _helper.reset();
- }
- _communicator = rhs._communicator;
- _refValid = false;
- }
+ if(this != &rhs)
+ {
+ if(rhs._helper.get() != 0)
+ {
+ _helper.reset(rhs._helper->clone());
+ }
+ else
+ {
+ _helper.reset();
+ }
+ _communicator = rhs._communicator;
+ _refValid = false;
+ }
- return *this;
+ return *this;
}
//
// Create const_iterator from iterator.
//
ConstIterator& operator=(const Iterator<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare>& rhs)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- else
- {
- _helper.reset();
- }
- _communicator = rhs._communicator;
+ KeyCodec, ValueCodec, Compare>& rhs)
+ {
+ if(rhs._helper.get() != 0)
+ {
+ _helper.reset(rhs._helper->clone());
+ }
+ else
+ {
+ _helper.reset();
+ }
+ _communicator = rhs._communicator;
_refValid = false;
- return *this;
+ return *this;
}
~ConstIterator()
@@ -497,40 +497,40 @@ public:
bool operator==(const ConstIterator& rhs)
{
- if(_helper.get() == rhs._helper.get())
- {
- return true;
- }
-
- if(_helper.get() != 0 && rhs._helper.get() != 0)
- {
- const Key* lhsKey = _helper->get();
- const Key* rhsKey = rhs._helper->get();
-
- if(lhsKey != 0 && rhsKey != 0)
- {
- return *lhsKey == *rhsKey;
- }
- }
- return false;
+ if(_helper.get() == rhs._helper.get())
+ {
+ return true;
+ }
+
+ if(_helper.get() != 0 && rhs._helper.get() != 0)
+ {
+ const Key* lhsKey = _helper->get();
+ const Key* rhsKey = rhs._helper->get();
+
+ if(lhsKey != 0 && rhsKey != 0)
+ {
+ return *lhsKey == *rhsKey;
+ }
+ }
+ return false;
}
bool operator!=(const ConstIterator& rhs)
{
- return !(*this == rhs);
+ return !(*this == rhs);
}
ConstIterator& operator++()
{
- incr();
- return *this;
+ incr();
+ return *this;
}
ConstIterator operator++(int)
{
- ConstIterator tmp = *this;
- incr();
- return tmp;
+ ConstIterator tmp = *this;
+ incr();
+ return tmp;
}
//
@@ -558,7 +558,7 @@ public:
_refValid = true;
}
- return _ref;
+ return _ref;
}
pointer operator->() const { return &(operator*()); }
@@ -567,34 +567,34 @@ private:
void incr()
{
- assert(_helper.get() != 0);
- if(!_helper->next())
- {
- //
- // The iterator has been moved past the end, and is now
- // invalid.
- //
- _helper.reset();
- }
+ assert(_helper.get() != 0);
+ if(!_helper->next())
+ {
+ //
+ // The iterator has been moved past the end, and is now
+ // invalid.
+ //
+ _helper.reset();
+ }
_refValid = false;
}
void getCurrentValue(key_type& key, mapped_type& value) const
{
- assert(_helper.get() != 0);
+ assert(_helper.get() != 0);
- const Key* k = 0;
- const Value* v = 0;
- _helper->get(k, v);
- assert(k != 0);
- assert(v != 0);
+ const Key* k = 0;
+ const Value* v = 0;
+ _helper->get(k, v);
+ assert(k != 0);
+ assert(v != 0);
- KeyCodec::read(key, *k, _communicator);
- ValueCodec::read(value, *v, _communicator);
+ KeyCodec::read(key, *k, _communicator);
+ ValueCodec::read(value, *v, _communicator);
}
friend class Map<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare>;
+ KeyCodec, ValueCodec, Compare>;
std::auto_ptr<IteratorHelper> _helper;
Ice::CommunicatorPtr _communicator;
@@ -622,7 +622,7 @@ struct IceEncodingCompare
{
bool operator()(...)
{
- return false;
+ return false;
}
};
@@ -648,35 +648,35 @@ class KeyCompare : public KeyCompareBase
{
public:
KeyCompare(const Compare& compare,
- const Ice::CommunicatorPtr& communicator) :
+ const Ice::CommunicatorPtr& communicator) :
#if defined(_MSC_VER) && (_MSC_VER <= 1300)
- KeyCompareBase(enableKeyCompare(compare)),
+ KeyCompareBase(enableKeyCompare(compare)),
#else
- KeyCompareBase(true),
+ KeyCompareBase(true),
#endif
- _compare(compare),
- _communicator(communicator)
+ _compare(compare),
+ _communicator(communicator)
{}
virtual int compare(const Key& dbKey1, const Key& dbKey2)
{
- key_type key1;
- KeyCodec::read(key1, dbKey1, _communicator);
- key_type key2;
- KeyCodec::read(key2, dbKey2, _communicator);
-
- if(_compare(key1, key2))
- {
- return -1;
- }
- else if(_compare(key2, key1))
- {
- return 1;
- }
- else
- {
- return 0;
- }
+ key_type key1;
+ KeyCodec::read(key1, dbKey1, _communicator);
+ key_type key2;
+ KeyCodec::read(key2, dbKey2, _communicator);
+
+ if(_compare(key1, key2))
+ {
+ return -1;
+ }
+ else if(_compare(key2, key1))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
}
private:
Compare _compare;
@@ -693,13 +693,13 @@ class KeyCompare<key_type, KeyCodec, IceEncodingCompare> : public KeyCompareBase
{
public:
KeyCompare(const IceEncodingCompare&, const Ice::CommunicatorPtr&):
- KeyCompareBase(false)
+ KeyCompareBase(false)
{}
virtual int compare(const Key& dbKey1, const Key& dbKey2)
{
- assert(0);
- return 0;
+ assert(0);
+ return 0;
}
};
#endif
@@ -714,33 +714,33 @@ class MapIndex : public MapIndexBase
public:
virtual int compare(const Key& dbKey1, const Key& dbKey2)
{
- key_type key1;
- KeyCodec::read(key1, dbKey1, _communicator);
- key_type key2;
- KeyCodec::read(key2, dbKey2, _communicator);
-
- if(_compare(key1, key2))
- {
- return -1;
- }
- else if(_compare(key2, key1))
- {
- return 1;
- }
- else
- {
- return 0;
- }
+ key_type key1;
+ KeyCodec::read(key1, dbKey1, _communicator);
+ key_type key2;
+ KeyCodec::read(key2, dbKey2, _communicator);
+
+ if(_compare(key1, key2))
+ {
+ return -1;
+ }
+ else if(_compare(key2, key1))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
}
protected:
MapIndex(const std::string& name, const Compare& compare) :
#if defined(_MSC_VER) && (_MSC_VER <= 1300)
- MapIndexBase(name, enableKeyCompare(compare)),
+ MapIndexBase(name, enableKeyCompare(compare)),
#else
- MapIndexBase(name, true),
+ MapIndexBase(name, true),
#endif
- _compare(compare)
+ _compare(compare)
{}
private:
@@ -758,13 +758,13 @@ class MapIndex<key_type, KeyCodec, IceEncodingCompare> : public MapIndexBase
public:
virtual int compare(const Key& dbKey1, const Key& dbKey2)
{
- assert(0);
- return 0;
+ assert(0);
+ return 0;
}
protected:
MapIndex(const std::string& name, const IceEncodingCompare&):
- MapIndexBase(name, false)
+ MapIndexBase(name, false)
{}
};
#endif
@@ -777,8 +777,8 @@ protected:
// TODO: implement bidirectional iterators.
//
template<typename key_type, typename mapped_type,
- typename KeyCodec, typename ValueCodec,
- typename Compare = IceEncodingCompare>
+ typename KeyCodec, typename ValueCodec,
+ typename Compare = IceEncodingCompare>
class Map
{
public:
@@ -786,9 +786,9 @@ public:
typedef std::pair<const key_type, const mapped_type> value_type;
typedef Iterator<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare> iterator;
+ KeyCodec, ValueCodec, Compare> iterator;
typedef ConstIterator<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare> const_iterator;
+ KeyCodec, ValueCodec, Compare> const_iterator;
//
// No definition for reference, const_reference, pointer or
@@ -807,41 +807,41 @@ public:
// Constructors
//
Map(const Freeze::ConnectionPtr& connection,
- const std::string& dbName,
- bool createDb = true,
- const Compare& compare = Compare()) :
- _communicator(connection->getCommunicator())
- {
- KeyCompareBasePtr keyCompare =
- new KeyCompare<key_type, KeyCodec, Compare>(compare, _communicator);
- std::vector<MapIndexBasePtr> indices;
+ const std::string& dbName,
+ bool createDb = true,
+ const Compare& compare = Compare()) :
+ _communicator(connection->getCommunicator())
+ {
+ KeyCompareBasePtr keyCompare =
+ new KeyCompare<key_type, KeyCodec, Compare>(compare, _communicator);
+ std::vector<MapIndexBasePtr> indices;
- _helper.reset(MapHelper::create(connection, dbName,
- KeyCodec::typeId(), ValueCodec::typeId(),
- keyCompare, indices, createDb));
+ _helper.reset(MapHelper::create(connection, dbName,
+ KeyCodec::typeId(), ValueCodec::typeId(),
+ keyCompare, indices, createDb));
}
template<class _InputIterator>
Map(const Freeze::ConnectionPtr& connection,
- const std::string& dbName,
- bool createDb,
- _InputIterator first, _InputIterator last,
- const Compare& compare = Compare()) :
- _communicator(connection->getCommunicator())
+ const std::string& dbName,
+ bool createDb,
+ _InputIterator first, _InputIterator last,
+ const Compare& compare = Compare()) :
+ _communicator(connection->getCommunicator())
{
- KeyCompareBasePtr keyCompare =
- new KeyCompare<key_type, KeyCodec, Compare>(compare, _communicator);
+ KeyCompareBasePtr keyCompare =
+ new KeyCompare<key_type, KeyCodec, Compare>(compare, _communicator);
- std::vector<MapIndexBasePtr> indices;
+ std::vector<MapIndexBasePtr> indices;
- _helper.reset(MapHelper::create(connection, dbName,
- KeyCodec::typeId(), ValueCodec::typeId(),
- keyCompare, indices, createDb));
- while(first != last)
- {
- put(*first);
- ++first;
- }
+ _helper.reset(MapHelper::create(connection, dbName,
+ KeyCodec::typeId(), ValueCodec::typeId(),
+ keyCompare, indices, createDb));
+ while(first != last)
+ {
+ put(*first);
+ ++first;
+ }
}
~Map()
@@ -850,94 +850,94 @@ public:
bool operator==(const Map& rhs) const
{
- //
- // This does a memberwise equality for the entire contents of
- // the database. While slow this is always correct. Database
- // equality is not necessarily correct in the context of a
- // transaction.
- //
- if(count() != rhs.count())
- {
- return false;
- }
-
- for(const_iterator p = rhs.begin() ; p != rhs.end() ; ++p)
- {
- const_iterator q = rhs.find(p->first);
- if(q == rhs.end())
- {
- return false;
- }
- if(p->second != q->second)
- {
- return false;
- }
- }
- return true;
+ //
+ // This does a memberwise equality for the entire contents of
+ // the database. While slow this is always correct. Database
+ // equality is not necessarily correct in the context of a
+ // transaction.
+ //
+ if(count() != rhs.count())
+ {
+ return false;
+ }
+
+ for(const_iterator p = rhs.begin() ; p != rhs.end() ; ++p)
+ {
+ const_iterator q = rhs.find(p->first);
+ if(q == rhs.end())
+ {
+ return false;
+ }
+ if(p->second != q->second)
+ {
+ return false;
+ }
+ }
+ return true;
}
bool operator!=(const Map& rhs) const
{
- return !(*this == rhs);
+ return !(*this == rhs);
}
void swap(Map& rhs)
{
- MapHelper* tmp = _helper.release();
- _helper.reset(rhs._helper.release());
- rhs._helper.reset(tmp);
-
- Ice::CommunicatorPtr tmpCom = _communicator;
- _communicator = rhs._communicator;
- rhs._communicator = tmpCom;
+ MapHelper* tmp = _helper.release();
+ _helper.reset(rhs._helper.release());
+ rhs._helper.reset(tmp);
+
+ Ice::CommunicatorPtr tmpCom = _communicator;
+ _communicator = rhs._communicator;
+ rhs._communicator = tmpCom;
}
iterator begin()
{
- try
- {
- return iterator(IteratorHelper::create(*_helper.get(), false), _communicator);
- }
- catch(const NotFoundException&)
- {
- return iterator();
- }
+ try
+ {
+ return iterator(IteratorHelper::create(*_helper.get(), false), _communicator);
+ }
+ catch(const NotFoundException&)
+ {
+ return iterator();
+ }
}
const_iterator begin() const
{
- try
- {
- return const_iterator(IteratorHelper::create(*_helper.get(), true), _communicator);
- }
- catch(const NotFoundException&)
- {
- return const_iterator();
- }
+ try
+ {
+ return const_iterator(IteratorHelper::create(*_helper.get(), true), _communicator);
+ }
+ catch(const NotFoundException&)
+ {
+ return const_iterator();
+ }
}
iterator end()
{
- return iterator();
+ return iterator();
}
const_iterator end() const
{
- return const_iterator();
+ return const_iterator();
}
bool empty() const
{
- return size() == 0;
+ return size() == 0;
}
size_type size() const
{
- return _helper->size();
+ return _helper->size();
}
size_type max_size() const
{
- return 0xffffffff; // TODO: is this the max?
+ return 0xffffffff; // TODO: is this the max?
}
//
@@ -962,106 +962,106 @@ public:
iterator insert(iterator /*position*/, const value_type& key)
{
- //
- // position is ignored.
- //
- Key k;
- KeyCodec::write(key.first, k, _communicator);
-
- iterator r = iterator(_helper->find(k, false), _communicator);
+ //
+ // position is ignored.
+ //
+ Key k;
+ KeyCodec::write(key.first, k, _communicator);
+
+ iterator r = iterator(_helper->find(k, false), _communicator);
- if(r == end())
- {
- Value v;
- ValueCodec::write(key.second, v, _communicator);
-
- _helper->put(k, v);
- r = iterator(_helper->find(k, false), _communicator);
- }
+ if(r == end())
+ {
+ Value v;
+ ValueCodec::write(key.second, v, _communicator);
+
+ _helper->put(k, v);
+ r = iterator(_helper->find(k, false), _communicator);
+ }
- return r;
+ return r;
}
std::pair<iterator, bool> insert(const value_type& key)
{
- Key k;
- KeyCodec::write(key.first, k, _communicator);
+ Key k;
+ KeyCodec::write(key.first, k, _communicator);
- iterator r = iterator(_helper->find(k, false), _communicator);
- bool inserted = false;
+ iterator r = iterator(_helper->find(k, false), _communicator);
+ bool inserted = false;
- if(r == end())
- {
- Value v;
- ValueCodec::write(key.second, v, _communicator);
-
- _helper->put(k, v);
- inserted = true;
- r = iterator(_helper->find(k, false), _communicator);
- }
+ if(r == end())
+ {
+ Value v;
+ ValueCodec::write(key.second, v, _communicator);
+
+ _helper->put(k, v);
+ inserted = true;
+ r = iterator(_helper->find(k, false), _communicator);
+ }
- return std::pair<iterator, bool>(r, inserted);
+ return std::pair<iterator, bool>(r, inserted);
}
template <typename InputIterator>
void insert(InputIterator first, InputIterator last)
{
- while(first != last)
- {
- insert(*first);
- ++first;
- }
+ while(first != last)
+ {
+ insert(*first);
+ ++first;
+ }
}
void put(const value_type& key)
{
- //
- // insert or replace
- //
- Key k;
- Value v;
- KeyCodec::write(key.first, k, _communicator);
- ValueCodec::write(key.second, v, _communicator);
+ //
+ // insert or replace
+ //
+ Key k;
+ Value v;
+ KeyCodec::write(key.first, k, _communicator);
+ ValueCodec::write(key.second, v, _communicator);
- _helper->put(k, v);
+ _helper->put(k, v);
}
template <typename InputIterator>
void put(InputIterator first, InputIterator last)
{
- while(first != last)
- {
- put(*first);
- ++first;
- }
+ while(first != last)
+ {
+ put(*first);
+ ++first;
+ }
}
void erase(iterator position)
{
- assert(position._helper.get() != 0);
- position._helper->erase();
+ assert(position._helper.get() != 0);
+ position._helper->erase();
}
size_type erase(const key_type& key)
{
- Key k;
- KeyCodec::write(key, k, _communicator);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
- return _helper->erase(k);
+ return _helper->erase(k);
}
void erase(iterator first, iterator last)
{
- while(first != last)
- {
- first._helper->erase();
- ++first;
- }
+ while(first != last)
+ {
+ first._helper->erase();
+ ++first;
+ }
}
void clear()
{
- _helper->clear();
+ _helper->clear();
}
@@ -1070,87 +1070,87 @@ public:
//
void destroy()
{
- _helper->destroy();
+ _helper->destroy();
}
iterator find(const key_type& key)
{
- Key k;
- KeyCodec::write(key, k, _communicator);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
- return iterator(_helper->find(k, false), _communicator);
+ return iterator(_helper->find(k, false), _communicator);
}
const_iterator find(const key_type& key) const
{
- Key k;
- KeyCodec::write(key, k, _communicator);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
- return const_iterator(_helper->find(k, true), _communicator);
+ return const_iterator(_helper->find(k, true), _communicator);
}
size_type count(const key_type& key) const
{
- Key k;
- KeyCodec::write(key, k, _communicator);
-
- return _helper->count(k);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
+
+ return _helper->count(k);
}
iterator lower_bound(const key_type& key)
{
- Key k;
- KeyCodec::write(key, k, _communicator);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
- return iterator(_helper->lowerBound(k, false), _communicator);
+ return iterator(_helper->lowerBound(k, false), _communicator);
}
const_iterator lower_bound(const key_type& key) const
{
- Key k;
- KeyCodec::write(key, k, _communicator);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
- return iterator(_helper->lowerBound(k, true), _communicator);
+ return iterator(_helper->lowerBound(k, true), _communicator);
}
iterator upper_bound(const key_type& key)
{
- Key k;
- KeyCodec::write(key, k, _communicator);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
- return iterator(_helper->upperBound(k, false), _communicator);
+ return iterator(_helper->upperBound(k, false), _communicator);
}
const_iterator upper_bound(const key_type& key) const
{
- Key k;
- KeyCodec::write(key, k, _communicator);
+ Key k;
+ KeyCodec::write(key, k, _communicator);
- return iterator(_helper->upperBound(k, true), _communicator);
+ return iterator(_helper->upperBound(k, true), _communicator);
}
std::pair<iterator, iterator> equal_range(const key_type& key)
{
- return std::make_pair(lower_bound(key), upper_bound(key));
+ return std::make_pair(lower_bound(key), upper_bound(key));
}
std::pair<const_iterator, const_iterator>
equal_range(const key_type& key) const
{
- return std::make_pair(lower_bound(key), upper_bound(key));
+ return std::make_pair(lower_bound(key), upper_bound(key));
}
const Ice::CommunicatorPtr&
communicator() const
{
- return _communicator();
+ return _communicator();
}
protected:
Map(const Ice::CommunicatorPtr& communicator) :
- _communicator(communicator)
+ _communicator(communicator)
{
}
@@ -1170,19 +1170,19 @@ namespace std
// TODO: update.
template <class key_type, class mapped_type,
- class KeyCodec, class ValueCodec, class Compare>
+ class KeyCodec, class ValueCodec, class Compare>
inline pair<const key_type, const mapped_type>*
value_type(const Freeze::Iterator<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare>&)
+ KeyCodec, ValueCodec, Compare>&)
{
return (pair<const key_type, const mapped_type>*)0;
}
template <class key_type, class mapped_type,
- class KeyCodec, class ValueCodec, class Compare>
+ class KeyCodec, class ValueCodec, class Compare>
inline pair<const key_type, const mapped_type>*
value_type(const Freeze::ConstIterator<key_type, mapped_type,
- KeyCodec, ValueCodec, Compare>&)
+ KeyCodec, ValueCodec, Compare>&)
{
return (pair<const key_type, const mapped_type>*)0;
}
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h
index 671c46f49d6..7cab7da51ef 100644
--- a/cpp/include/Ice/BasicStream.h
+++ b/cpp/include/Ice/BasicStream.h
@@ -38,14 +38,14 @@ public:
public:
StreamUTF8BufferI(BasicStream& stream) :
- _stream(stream)
- {
- }
+ _stream(stream)
+ {
+ }
Ice::Byte*
getMoreBytes(size_t howMany, Ice::Byte* firstUnused)
{
- assert(howMany > 0);
+ assert(howMany > 0);
if(firstUnused != 0)
{
@@ -71,7 +71,7 @@ public:
private:
- BasicStream& _stream;
+ BasicStream& _stream;
};
typedef void (*PatchFunc)(void*, Ice::ObjectPtr&);
@@ -102,14 +102,14 @@ public:
void resize(Container::size_type sz)
{
//
- // Check memory limit if stream is not unlimited.
- //
- if(!_unlimited && sz > _messageSizeMax)
- {
- throwMemoryLimitException(__FILE__, __LINE__);
- }
-
- b.resize(sz);
+ // Check memory limit if stream is not unlimited.
+ //
+ if(!_unlimited && sz > _messageSizeMax)
+ {
+ throwMemoryLimitException(__FILE__, __LINE__);
+ }
+
+ b.resize(sz);
}
void startSeq(int, int);
@@ -142,8 +142,8 @@ public:
void checkFixedSeq(int, int); // For sequences of fixed-size types.
void endElement()
{
- assert(_seqDataStack);
- --_seqDataStack->numElements;
+ assert(_seqDataStack);
+ --_seqDataStack->numElements;
}
void endSeq(int);
@@ -364,32 +364,32 @@ public:
void write(Ice::Byte v)
{
- b.push_back(v);
+ b.push_back(v);
}
void write(const Ice::Byte*, const Ice::Byte*);
void read(Ice::Byte& v)
{
- if(i >= b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = *i++;
+ if(i >= b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = *i++;
}
void read(std::pair<const Ice::Byte*, const Ice::Byte*>&);
void write(bool v)
{
- b.push_back(static_cast<Ice::Byte>(v));
+ b.push_back(static_cast<Ice::Byte>(v));
}
void write(const std::vector<bool>&);
void write(const bool*, const bool*);
void read(bool& v)
{
- if(i >= b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = *i++;
+ if(i >= b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = *i++;
}
void read(std::vector<bool>&);
bool* read(std::pair<const bool*, const bool*>&);
@@ -479,11 +479,11 @@ public:
{
Ice::Int sz = static_cast<Ice::Int>(v.size());
if(convert && sz > 0 && _stringConverter != 0)
- {
- writeConverted(v);
- }
- else
- {
+ {
+ writeConverted(v);
+ }
+ else
+ {
writeSize(sz);
if(sz > 0)
{
@@ -491,7 +491,7 @@ public:
resize(pos + sz);
memcpy(&b[pos], v.data(), sz);
}
- }
+ }
}
void write(const std::string*, const std::string*, bool = true);
void read(std::string& v, bool convert = true)
@@ -505,14 +505,14 @@ public:
{
throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
- if(convert && _stringConverter != 0)
- {
- _stringConverter->fromUTF8(i, i + sz, v);
- }
- else
- {
+ if(convert && _stringConverter != 0)
+ {
+ _stringConverter->fromUTF8(i, i + sz, v);
+ }
+ else
+ {
std::string(reinterpret_cast<const char*>(&*i), reinterpret_cast<const char*>(&*i) + sz).swap(v);
- }
+ }
i += sz;
}
else
@@ -535,7 +535,7 @@ public:
throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
- _wstringConverter->fromUTF8(i, i + sz, v);
+ _wstringConverter->fromUTF8(i, i + sz, v);
i += sz;
}
else
@@ -561,8 +561,8 @@ public:
struct PatchEntry
{
- PatchFunc patchFunc;
- void* patchAddr;
+ PatchFunc patchFunc;
+ void* patchAddr;
};
typedef std::vector<PatchEntry> PatchList;
@@ -598,20 +598,20 @@ private:
{
public:
- ReadEncaps() : patchMap(0), unmarshaledMap(0), typeIdMap(0), typeIdIndex(0), previous(0)
- {
- // Inlined for performance reasons.
- }
- ~ReadEncaps()
- {
- // Inlined for performance reasons.
+ ReadEncaps() : patchMap(0), unmarshaledMap(0), typeIdMap(0), typeIdIndex(0), previous(0)
+ {
+ // Inlined for performance reasons.
+ }
+ ~ReadEncaps()
+ {
+ // Inlined for performance reasons.
delete patchMap;
delete unmarshaledMap;
delete typeIdMap;
- }
- void reset()
+ }
+ void reset()
{
- // Inlined for performance reasons.
+ // Inlined for performance reasons.
delete patchMap;
delete unmarshaledMap;
delete typeIdMap;
@@ -622,40 +622,40 @@ private:
typeIdIndex = 0;
previous = 0;
}
- void swap(ReadEncaps&);
+ void swap(ReadEncaps&);
- Container::size_type start;
- Ice::Int sz;
+ Container::size_type start;
+ Ice::Int sz;
- Ice::Byte encodingMajor;
- Ice::Byte encodingMinor;
+ Ice::Byte encodingMajor;
+ Ice::Byte encodingMinor;
- PatchMap* patchMap;
- IndexToPtrMap* unmarshaledMap;
- TypeIdReadMap* typeIdMap;
- Ice::Int typeIdIndex;
+ PatchMap* patchMap;
+ IndexToPtrMap* unmarshaledMap;
+ TypeIdReadMap* typeIdMap;
+ Ice::Int typeIdIndex;
- ReadEncaps* previous;
+ ReadEncaps* previous;
};
class ICE_API WriteEncaps : private ::IceUtil::noncopyable
{
public:
- WriteEncaps() : writeIndex(0), toBeMarshaledMap(0), marshaledMap(0), typeIdMap(0), typeIdIndex(0), previous(0)
- {
- // Inlined for performance reasons.
- }
- ~WriteEncaps()
+ WriteEncaps() : writeIndex(0), toBeMarshaledMap(0), marshaledMap(0), typeIdMap(0), typeIdIndex(0), previous(0)
+ {
+ // Inlined for performance reasons.
+ }
+ ~WriteEncaps()
{
- // Inlined for performance reasons.
+ // Inlined for performance reasons.
delete toBeMarshaledMap;
delete marshaledMap;
delete typeIdMap;
}
- void reset()
+ void reset()
{
- // Inlined for performance reasons.
+ // Inlined for performance reasons.
delete toBeMarshaledMap;
delete marshaledMap;
delete typeIdMap;
@@ -667,17 +667,17 @@ private:
typeIdIndex = 0;
previous = 0;
}
- void swap(WriteEncaps&);
+ void swap(WriteEncaps&);
- Container::size_type start;
+ Container::size_type start;
- Ice::Int writeIndex;
- PtrToIndexMap* toBeMarshaledMap;
- PtrToIndexMap* marshaledMap;
- TypeIdWriteMap* typeIdMap;
- Ice::Int typeIdIndex;
+ Ice::Int writeIndex;
+ PtrToIndexMap* toBeMarshaledMap;
+ PtrToIndexMap* marshaledMap;
+ TypeIdWriteMap* typeIdMap;
+ Ice::Int typeIdIndex;
- WriteEncaps* previous;
+ WriteEncaps* previous;
};
ReadEncaps* _currentReadEncaps;
@@ -705,10 +705,10 @@ private:
struct SeqData
{
- SeqData(int, int);
- int numElements;
- int minSize;
- SeqData* previous;
+ SeqData(int, int);
+ int numElements;
+ int minSize;
+ SeqData* previous;
};
SeqData* _seqDataStack;
diff --git a/cpp/include/Ice/Buffer.h b/cpp/include/Ice/Buffer.h
index a15b9184b53..b780d84d2fa 100644
--- a/cpp/include/Ice/Buffer.h
+++ b/cpp/include/Ice/Buffer.h
@@ -28,122 +28,122 @@ public:
{
public:
- //
- // Standard vector-like operations.
- //
-
- typedef Ice::Byte value_type;
- typedef Ice::Byte* iterator;
- typedef const Ice::Byte* const_iterator;
- typedef Ice::Byte& reference;
- typedef const Ice::Byte& const_reference;
- typedef Ice::Byte* pointer;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
-
- Container(size_type maxCapacity);
-
- ~Container();
-
- iterator begin()
- {
- return _buf;
- }
-
- const_iterator begin() const
- {
- return _buf;
- }
-
- iterator end()
- {
- return _buf + _size;
- }
-
- const_iterator end() const
- {
- return _buf + _size;
- }
-
- size_type size() const
- {
- return _size;
- }
-
- bool empty() const
- {
- return !_size;
- }
-
- void swap(Container&);
-
- void clear();
-
- void resize(size_type n) // Inlined for performance reasons.
+ //
+ // Standard vector-like operations.
+ //
+
+ typedef Ice::Byte value_type;
+ typedef Ice::Byte* iterator;
+ typedef const Ice::Byte* const_iterator;
+ typedef Ice::Byte& reference;
+ typedef const Ice::Byte& const_reference;
+ typedef Ice::Byte* pointer;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
+ Container(size_type maxCapacity);
+
+ ~Container();
+
+ iterator begin()
+ {
+ return _buf;
+ }
+
+ const_iterator begin() const
+ {
+ return _buf;
+ }
+
+ iterator end()
+ {
+ return _buf + _size;
+ }
+
+ const_iterator end() const
+ {
+ return _buf + _size;
+ }
+
+ size_type size() const
+ {
+ return _size;
+ }
+
+ bool empty() const
+ {
+ return !_size;
+ }
+
+ void swap(Container&);
+
+ void clear();
+
+ void resize(size_type n) // Inlined for performance reasons.
+ {
+ if(n == 0)
+ {
+ clear();
+ }
+ else if(n > _capacity)
+ {
+ reserve(n);
+ }
+ _size = n;
+ }
+
+ void reset()
+ {
+ if(_size > 0 && _size * 2 < _capacity)
+ {
+ //
+ // If the current buffer size is smaller than the
+ // buffer capacity, we shrink the buffer memory to the
+ // current size. This is to avoid holding on too much
+ // memory if it's not needed anymore.
+ //
+ if(++_shrinkCounter > 2)
+ {
+ reserve(_size);
+ _shrinkCounter = 0;
+ }
+ }
+ else
+ {
+ _shrinkCounter = 0;
+ }
+ _size = 0;
+ }
+
+ void push_back(value_type v)
+ {
+ resize(_size + 1);
+ _buf[_size - 1] = v;
+ }
+
+ reference operator[](size_type n)
+ {
+ assert(n < _size);
+ return _buf[n];
+ }
+
+ const_reference operator[](size_type n) const
{
- if(n == 0)
- {
- clear();
- }
- else if(n > _capacity)
- {
- reserve(n);
- }
- _size = n;
- }
-
- void reset()
- {
- if(_size > 0 && _size * 2 < _capacity)
- {
- //
- // If the current buffer size is smaller than the
- // buffer capacity, we shrink the buffer memory to the
- // current size. This is to avoid holding on too much
- // memory if it's not needed anymore.
- //
- if(++_shrinkCounter > 2)
- {
- reserve(_size);
- _shrinkCounter = 0;
- }
- }
- else
- {
- _shrinkCounter = 0;
- }
- _size = 0;
- }
-
- void push_back(value_type v)
- {
- resize(_size + 1);
- _buf[_size - 1] = v;
- }
-
- reference operator[](size_type n)
- {
- assert(n < _size);
- return _buf[n];
- }
-
- const_reference operator[](size_type n) const
- {
- assert(n < _size);
- return _buf[n];
- }
-
+ assert(n < _size);
+ return _buf[n];
+ }
+
private:
- Container(const Container&);
- void operator=(const Container&);
- void reserve(size_type);
+ Container(const Container&);
+ void operator=(const Container&);
+ void reserve(size_type);
- pointer _buf;
- size_type _size;
- size_type _capacity;
- size_type _maxCapacity;
- int _shrinkCounter;
+ pointer _buf;
+ size_type _size;
+ size_type _capacity;
+ size_type _maxCapacity;
+ int _shrinkCounter;
};
Container b;
diff --git a/cpp/include/Ice/FactoryTable.h b/cpp/include/Ice/FactoryTable.h
index 81e15a485c0..8a534ab252d 100644
--- a/cpp/include/Ice/FactoryTable.h
+++ b/cpp/include/Ice/FactoryTable.h
@@ -23,7 +23,7 @@ public:
~FactoryTable();
};
-static FactoryTable factoryTableInitializer; // Dummy variable to force initialization of factoryTable
+static FactoryTable factoryTableInitializer; // Dummy variable to force initialization of factoryTable
extern ICE_API FactoryTableDef* factoryTable;
diff --git a/cpp/include/Ice/GCShared.h b/cpp/include/Ice/GCShared.h
index 2812a1b4702..df5dd94262e 100755
--- a/cpp/include/Ice/GCShared.h
+++ b/cpp/include/Ice/GCShared.h
@@ -44,12 +44,12 @@ public:
int __getRefUnsafe() const
{
- return _ref;
+ return _ref;
}
void __decRefUnsafe()
{
- --_ref;
+ --_ref;
}
protected:
diff --git a/cpp/include/Ice/Handle.h b/cpp/include/Ice/Handle.h
index 0fc6212cb93..c224ceace4e 100644
--- a/cpp/include/Ice/Handle.h
+++ b/cpp/include/Ice/Handle.h
@@ -44,143 +44,143 @@ public:
Handle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
template<typename Y>
Handle(const Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
template<typename Y>
Handle(const ::IceUtil::Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
Handle(const Handle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
~Handle()
{
- if(this->_ptr)
- {
- decRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ decRef(this->_ptr);
+ }
}
Handle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- incRef(p);
- }
-
- T* ptr = this->_ptr;
- this->_ptr = p;
-
- if(ptr)
- {
- decRef(ptr);
- }
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ incRef(p);
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = p;
+
+ if(ptr)
+ {
+ decRef(ptr);
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- incRef(r._ptr);
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- decRef(ptr);
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ incRef(r._ptr);
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ decRef(ptr);
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const ::IceUtil::Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- incRef(r._ptr);
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- decRef(ptr);
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ incRef(r._ptr);
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ decRef(ptr);
+ }
+ }
+ return *this;
}
Handle& operator=(const Handle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- incRef(r._ptr);
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- decRef(ptr);
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ incRef(r._ptr);
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ decRef(ptr);
+ }
+ }
+ return *this;
}
template<class Y>
static Handle dynamicCast(const ::IceUtil::HandleBase<Y>& r)
{
#ifdef __BCPLUSPLUS__
- return Handle<T>(dynamic_cast<T*>(r._ptr));
+ return Handle<T>(dynamic_cast<T*>(r._ptr));
#else
- return Handle(dynamic_cast<T*>(r._ptr));
+ return Handle(dynamic_cast<T*>(r._ptr));
#endif
}
@@ -188,15 +188,15 @@ public:
static Handle dynamicCast(Y* p)
{
#ifdef __BCPLUSPLUS__
- return Handle<T>(dynamic_cast<T*>(p));
+ return Handle<T>(dynamic_cast<T*>(p));
#else
- return Handle(dynamic_cast<T*>(p));
+ return Handle(dynamic_cast<T*>(p));
#endif
}
void __clearHandleUnsafe()
{
- this->_ptr = 0;
+ this->_ptr = 0;
}
};
diff --git a/cpp/include/Ice/IncomingAsync.h b/cpp/include/Ice/IncomingAsync.h
index dc6af5ed78a..e7c5ba20ece 100644
--- a/cpp/include/Ice/IncomingAsync.h
+++ b/cpp/include/Ice/IncomingAsync.h
@@ -99,7 +99,7 @@ public:
};
class ICE_API AMD_Array_Object_ice_invoke : public ::Ice::AMD_Array_Object_ice_invoke,
- public IceInternal::IncomingAsync
+ public IceInternal::IncomingAsync
{
public:
diff --git a/cpp/include/Ice/Initialize.h b/cpp/include/Ice/Initialize.h
index 78cd1dbd104..77c8df84026 100644
--- a/cpp/include/Ice/Initialize.h
+++ b/cpp/include/Ice/Initialize.h
@@ -65,22 +65,22 @@ struct InitializationData
};
ICE_API CommunicatorPtr initialize(int&, char*[], const InitializationData& = InitializationData(),
- Int = ICE_INT_VERSION);
+ Int = ICE_INT_VERSION);
ICE_API CommunicatorPtr initialize(Ice::StringSeq&, const InitializationData& = InitializationData(),
- Int = ICE_INT_VERSION);
+ Int = ICE_INT_VERSION);
ICE_API CommunicatorPtr initialize(const InitializationData& = InitializationData(),
- Int = ICE_INT_VERSION);
+ Int = ICE_INT_VERSION);
ICE_API ICE_DEPRECATED_API CommunicatorPtr initializeWithProperties(int&, char*[], const PropertiesPtr&,
- Int = ICE_INT_VERSION);
+ Int = ICE_INT_VERSION);
ICE_API ICE_DEPRECATED_API CommunicatorPtr initializeWithLogger(int&, char*[], const Ice::LoggerPtr&,
- Int = ICE_INT_VERSION);
+ Int = ICE_INT_VERSION);
ICE_API ICE_DEPRECATED_API CommunicatorPtr initializeWithPropertiesAndLogger(int&, char*[], const PropertiesPtr&,
- const Ice::LoggerPtr&,
- Int = ICE_INT_VERSION);
+ const Ice::LoggerPtr&,
+ Int = ICE_INT_VERSION);
ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&);
ICE_API OutputStreamPtr createOutputStream(const CommunicatorPtr&);
diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h
index e740d25a69d..2fe85ed8508 100644
--- a/cpp/include/Ice/Object.h
+++ b/cpp/include/Ice/Object.h
@@ -133,7 +133,7 @@ public:
// Returns true if ok, false if user exception.
virtual void ice_invoke_async(const AMD_Array_Object_ice_invokePtr&, const std::pair<const Byte*, const Byte*>&,
- const Current&) = 0;
+ const Current&) = 0;
virtual IceInternal::DispatchStatus __dispatch(IceInternal::Incoming&, const Current&);
};
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index 30e8f0c4d43..2ce534c3466 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -85,11 +85,11 @@ private:
enum
{
- StateUnsent,
- StateInProgress,
- StateOK,
- StateUserException,
- StateLocalException
+ StateUnsent,
+ StateInProgress,
+ StateOK,
+ StateUserException,
+ StateLocalException
} _state;
BasicStream _is;
diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h
index 768846e619c..21a3796b156 100644
--- a/cpp/include/Ice/OutgoingAsync.h
+++ b/cpp/include/Ice/OutgoingAsync.h
@@ -77,7 +77,7 @@ public:
virtual void ice_exception(const Ice::Exception&) = 0;
void __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode,
- const std::vector<Ice::Byte>&, const Context*);
+ const std::vector<Ice::Byte>&, const Context*);
protected:
@@ -92,7 +92,7 @@ public:
virtual void ice_exception(const Ice::Exception&) = 0;
void __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode,
- const std::pair<const Byte*, const Byte*>&, const Context*);
+ const std::pair<const Byte*, const Byte*>&, const Context*);
protected:
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h
index 3c7d1b3912a..9a70a3a65c0 100644
--- a/cpp/include/Ice/Proxy.h
+++ b/cpp/include/Ice/Proxy.h
@@ -93,82 +93,82 @@ public:
bool ice_isA(const ::std::string& typeId)
{
- return ice_isA(typeId, 0);
+ return ice_isA(typeId, 0);
}
bool ice_isA(const ::std::string& typeId, const ::Ice::Context& context)
{
- return ice_isA(typeId, &context);
+ return ice_isA(typeId, &context);
}
void ice_ping()
{
- ice_ping(0);
+ ice_ping(0);
}
void ice_ping(const ::Ice::Context& context)
{
- ice_ping(&context);
+ ice_ping(&context);
}
::std::vector< ::std::string> ice_ids()
{
- return ice_ids(0);
+ return ice_ids(0);
}
::std::vector< ::std::string> ice_ids(const ::Ice::Context& context)
{
- return ice_ids(&context);
+ return ice_ids(&context);
}
::std::string ice_id()
{
- return ice_id(0);
+ return ice_id(0);
}
::std::string ice_id(const ::Ice::Context& context)
{
- return ice_id(&context);
+ return ice_id(&context);
}
// Returns true if ok, false if user exception.
bool ice_invoke(const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::vector< ::Ice::Byte>& inParams,
- ::std::vector< ::Ice::Byte>& outParams)
+ ::Ice::OperationMode mode,
+ const ::std::vector< ::Ice::Byte>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams)
{
- const ::Ice::Context* context = 0;
- return ice_invoke(operation, mode, inParams, outParams, context);
+ const ::Ice::Context* context = 0;
+ return ice_invoke(operation, mode, inParams, outParams, context);
}
bool ice_invoke(const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::vector< ::Ice::Byte>& inParams,
- ::std::vector< ::Ice::Byte>& outParams,
- const ::Ice::Context& context)
+ ::Ice::OperationMode mode,
+ const ::std::vector< ::Ice::Byte>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams,
+ const ::Ice::Context& context)
{
- return ice_invoke(operation, mode, inParams, outParams, &context);
+ return ice_invoke(operation, mode, inParams, outParams, &context);
}
bool ice_invoke(const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- ::std::vector< ::Ice::Byte>& outParams)
+ ::Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams)
{
- const ::Ice::Context* context = 0;
- return ice_invoke(operation, mode, inParams, outParams, context);
+ const ::Ice::Context* context = 0;
+ return ice_invoke(operation, mode, inParams, outParams, context);
}
bool ice_invoke(const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- ::std::vector< ::Ice::Byte>& outParams,
- const ::Ice::Context& context)
+ ::Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
+ ::std::vector< ::Ice::Byte>& outParams,
+ const ::Ice::Context& context)
{
- return ice_invoke(operation, mode, inParams, outParams, &context);
+ return ice_invoke(operation, mode, inParams, outParams, &context);
}
void ice_invoke_async(const ::Ice::AMI_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode,
- const ::std::vector< ::Ice::Byte>&);
+ const ::std::vector< ::Ice::Byte>&);
void ice_invoke_async(const ::Ice::AMI_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode,
- const ::std::vector< ::Ice::Byte>&, const ::Ice::Context&);
+ const ::std::vector< ::Ice::Byte>&, const ::Ice::Context&);
void ice_invoke_async(const ::Ice::AMI_Array_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&);
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&);
void ice_invoke_async(const ::Ice::AMI_Array_Object_ice_invokePtr&, const ::std::string&, ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&, const ::Ice::Context&);
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&, const ::Ice::Context&);
::Ice::Identity ice_getIdentity() const;
ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newIdentity(const ::Ice::Identity&) const;
@@ -241,11 +241,11 @@ public:
::IceInternal::ReferencePtr __reference() const;
void __copyFrom(const ::Ice::ObjectPrx&);
void __handleException(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&,
- const ::Ice::LocalException&, int&);
+ const ::Ice::LocalException&, int&);
void __handleExceptionWrapper(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&,
- const ::IceInternal::LocalExceptionWrapper&);
+ const ::IceInternal::LocalExceptionWrapper&);
void __handleExceptionWrapperRelaxed(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>&,
- const ::IceInternal::LocalExceptionWrapper&, int&);
+ const ::IceInternal::LocalExceptionWrapper&, int&);
void __checkTwowayOnly(const char*) const;
void __checkTwowayOnly(const ::std::string&) const;
@@ -265,15 +265,15 @@ private:
bool ice_invoke(const ::std::string&,
- ::Ice::OperationMode,
- const ::std::vector< ::Ice::Byte>&,
- ::std::vector< ::Ice::Byte>&,
- const ::Ice::Context*);
+ ::Ice::OperationMode,
+ const ::std::vector< ::Ice::Byte>&,
+ ::std::vector< ::Ice::Byte>&,
+ const ::Ice::Context*);
bool ice_invoke(const ::std::string&,
- ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&,
- const ::Ice::Context*);
+ ::Ice::OperationMode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
+ ::std::vector< ::Ice::Byte>&,
+ const ::Ice::Context*);
void setup(const ::IceInternal::ReferencePtr&);
friend class ::IceInternal::ProxyFactory;
@@ -298,8 +298,8 @@ public:
virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*) = 0;
virtual ::std::string ice_id(const ::Ice::Context*) = 0;
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&, const ::Ice::Context*) = 0;
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
+ ::std::vector< ::Ice::Byte>&, const ::Ice::Context*) = 0;
virtual ::Ice::ConnectionIPtr __getConnection(bool&) const = 0;
};
@@ -320,8 +320,8 @@ public:
virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*);
virtual ::std::string ice_id(const ::Ice::Context*);
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
+ ::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
virtual ::Ice::ConnectionIPtr __getConnection(bool&) const;
@@ -353,8 +353,8 @@ public:
virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Context*);
virtual ::std::string ice_id(const ::Ice::Context*);
virtual bool ice_invoke(const ::std::string&, ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
+ ::std::vector< ::Ice::Byte>&, const ::Ice::Context*);
virtual ::Ice::ConnectionIPtr __getConnection(bool&) const;
@@ -388,7 +388,7 @@ struct ProxyIdentityLess : std::binary_function<bool, ObjectPrx&, ObjectPrx&>
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityLess(lhs, rhs);
+ return proxyIdentityLess(lhs, rhs);
}
};
@@ -396,7 +396,7 @@ struct ProxyIdentityEqual : std::binary_function<bool, ObjectPrx&, ObjectPrx&>
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityEqual(lhs, rhs);
+ return proxyIdentityEqual(lhs, rhs);
}
};
@@ -404,7 +404,7 @@ struct ProxyIdentityAndFacetLess : std::binary_function<bool, ObjectPrx&, Object
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityAndFacetLess(lhs, rhs);
+ return proxyIdentityAndFacetLess(lhs, rhs);
}
};
@@ -412,7 +412,7 @@ struct ProxyIdentityAndFacetEqual : std::binary_function<bool, ObjectPrx&, Objec
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityAndFacetEqual(lhs, rhs);
+ return proxyIdentityAndFacetEqual(lhs, rhs);
}
};
@@ -430,16 +430,16 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context* context)
P d = 0;
if(b.get())
{
- typedef typename P::element_type T;
-
- d = dynamic_cast<T*>(b.get());
- if(!d && (context == 0 ?
- b->ice_isA(T::ice_staticId()) :
- b->ice_isA(T::ice_staticId(), *context)))
- {
- d = new T;
- d->__copyFrom(b);
- }
+ typedef typename P::element_type T;
+
+ d = dynamic_cast<T*>(b.get());
+ if(!d && (context == 0 ?
+ b->ice_isA(T::ice_staticId()) :
+ b->ice_isA(T::ice_staticId(), *context)))
+ {
+ d = new T;
+ d->__copyFrom(b);
+ }
}
return d;
}
@@ -450,14 +450,14 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b)
P d = 0;
if(b)
{
- typedef typename P::element_type T;
-
- d = dynamic_cast<T*>(b.get());
- if(!d)
- {
- d = new T;
- d->__copyFrom(b);
- }
+ typedef typename P::element_type T;
+
+ d = dynamic_cast<T*>(b.get());
+ if(!d)
+ {
+ d = new T;
+ d->__copyFrom(b);
+ }
}
return d;
}
@@ -489,7 +489,7 @@ uncheckedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::strin
::Ice::ObjectPrx d = 0;
if(b)
{
- d = b->ice_facet(f);
+ d = b->ice_facet(f);
}
return d;
}
@@ -504,8 +504,8 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Co
if(bb)
{
- d = new T;
- d->__copyFrom(bb);
+ d = new T;
+ d->__copyFrom(bb);
}
return d;
}
@@ -516,11 +516,11 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f)
P d = 0;
if(b)
{
- typedef typename P::element_type T;
+ typedef typename P::element_type T;
- ::Ice::ObjectPrx bb = b->ice_facet(f);
- d = new T;
- d->__copyFrom(bb);
+ ::Ice::ObjectPrx bb = b->ice_facet(f);
+ d = new T;
+ d->__copyFrom(bb);
}
return d;
}
diff --git a/cpp/include/Ice/ProxyHandle.h b/cpp/include/Ice/ProxyHandle.h
index 6c06e30647b..7229b428bdc 100644
--- a/cpp/include/Ice/ProxyHandle.h
+++ b/cpp/include/Ice/ProxyHandle.h
@@ -110,171 +110,171 @@ public:
ProxyHandle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
template<typename Y>
ProxyHandle(const ProxyHandle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
template<typename Y>
ProxyHandle(const ::IceUtil::Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
ProxyHandle(const ProxyHandle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- incRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ incRef(this->_ptr);
+ }
}
~ProxyHandle()
{
- if(this->_ptr)
- {
- decRef(this->_ptr);
- }
+ if(this->_ptr)
+ {
+ decRef(this->_ptr);
+ }
}
ProxyHandle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- incRef(p);
- }
-
- if(this->_ptr)
- {
- decRef(this->_ptr);
- }
-
- this->_ptr = p;
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ incRef(p);
+ }
+
+ if(this->_ptr)
+ {
+ decRef(this->_ptr);
+ }
+
+ this->_ptr = p;
+ }
+ return *this;
}
template<typename Y>
ProxyHandle& operator=(const ProxyHandle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- incRef(r._ptr);
- }
-
- if(this->_ptr)
- {
- decRef(this->_ptr);
- }
-
- this->_ptr = r._ptr;
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ incRef(r._ptr);
+ }
+
+ if(this->_ptr)
+ {
+ decRef(this->_ptr);
+ }
+
+ this->_ptr = r._ptr;
+ }
+ return *this;
}
template<typename Y>
ProxyHandle& operator=(const ::IceUtil::Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- incRef(r._ptr);
- }
-
- if(this->_ptr)
- {
- decRef(this->_ptr);
- }
-
- this->_ptr = r._ptr;
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ incRef(r._ptr);
+ }
+
+ if(this->_ptr)
+ {
+ decRef(this->_ptr);
+ }
+
+ this->_ptr = r._ptr;
+ }
+ return *this;
}
ProxyHandle& operator=(const ProxyHandle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- incRef(r._ptr);
- }
-
- if(this->_ptr)
- {
- decRef(this->_ptr);
- }
-
- this->_ptr = r._ptr;
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ incRef(r._ptr);
+ }
+
+ if(this->_ptr)
+ {
+ decRef(this->_ptr);
+ }
+
+ this->_ptr = r._ptr;
+ }
+ return *this;
}
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r)
{
- Y* tag = 0;
- Ice::Context* ctx = 0;
- return ::IceInternal::checkedCastHelper<T>(r, tag, ctx);
+ Y* tag = 0;
+ Ice::Context* ctx = 0;
+ return ::IceInternal::checkedCastHelper<T>(r, tag, ctx);
}
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f)
{
- Ice::Context* ctx = 0;
- return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f, ctx);
+ Ice::Context* ctx = 0;
+ return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f, ctx);
}
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const ::Ice::Context& ctx)
{
- Y* tag = 0;
- return ::IceInternal::checkedCastHelper<T>(r, tag, &ctx);
+ Y* tag = 0;
+ return ::IceInternal::checkedCastHelper<T>(r, tag, &ctx);
}
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f, const ::Ice::Context& ctx)
{
- return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f, &ctx);
+ return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f, &ctx);
}
template<class Y>
static ProxyHandle uncheckedCast(const ProxyHandle<Y>& r)
{
- Y* tag = 0;
- return::IceInternal::uncheckedCastHelper<T>(r, tag);
+ Y* tag = 0;
+ return::IceInternal::uncheckedCastHelper<T>(r, tag);
}
template<class Y>
static ProxyHandle uncheckedCast(const ProxyHandle<Y>& r, const std::string& f)
{
- return ::IceInternal::uncheckedCastImpl<ProxyHandle>(r, f);
+ return ::IceInternal::uncheckedCastImpl<ProxyHandle>(r, f);
}
};
diff --git a/cpp/include/Ice/StringConverter.h b/cpp/include/Ice/StringConverter.h
index 634b328c1e3..d2aa1dffa7a 100755
--- a/cpp/include/Ice/StringConverter.h
+++ b/cpp/include/Ice/StringConverter.h
@@ -47,13 +47,13 @@ public:
// past the last byte returned by getMoreBytes).
//
virtual Byte* toUTF8(const charT* sourceStart, const charT* sourceEnd,
- UTF8Buffer&) const = 0;
+ UTF8Buffer&) const = 0;
//
// Unmarshals a UTF-8 sequence into a basic_string
//
virtual void fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
- std::basic_string<charT>& target) const = 0;
+ std::basic_string<charT>& target) const = 0;
};
typedef BasicStringConverter<char> StringConverter;
@@ -71,10 +71,10 @@ class ICE_API UnicodeWstringConverter : public WstringConverter
public:
virtual Byte* toUTF8(const wchar_t* sourceStart, const wchar_t* sourceEnd,
- UTF8Buffer&) const;
+ UTF8Buffer&) const;
virtual void fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
- std::wstring& target) const;
+ std::wstring& target) const;
};
}
#endif
diff --git a/cpp/include/IcePatch2/Util.h b/cpp/include/IcePatch2/Util.h
index 4467e911d21..fb7a1836277 100644
--- a/cpp/include/IcePatch2/Util.h
+++ b/cpp/include/IcePatch2/Util.h
@@ -56,30 +56,30 @@ struct FileInfoEqual: public std::binary_function<const FileInfo&, const FileInf
bool
operator()(const FileInfo& lhs, const FileInfo& rhs)
{
- if(lhs.path != rhs.path)
- {
- return false;
- }
-
- //
- // For the size portion of the comparison, we only distinquish
- // between file (size >= 0) and directory (size == -1). We do
- // not take the actual size into account, as it might be set
- // to 0 if no compressed file is available.
- //
- Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size;
- Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size;
- if(lsz != rsz)
- {
- return false;
- }
-
- if(lhs.executable != rhs.executable)
- {
- return false;
- }
-
- return lhs.checksum == rhs.checksum;
+ if(lhs.path != rhs.path)
+ {
+ return false;
+ }
+
+ //
+ // For the size portion of the comparison, we only distinquish
+ // between file (size >= 0) and directory (size == -1). We do
+ // not take the actual size into account, as it might be set
+ // to 0 if no compressed file is available.
+ //
+ Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size;
+ Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size;
+ if(lsz != rsz)
+ {
+ return false;
+ }
+
+ if(lhs.executable != rhs.executable)
+ {
+ return false;
+ }
+
+ return lhs.checksum == rhs.checksum;
}
};
@@ -88,48 +88,48 @@ struct FileInfoWithoutFlagsLess: public std::binary_function<const FileInfo&, co
bool
operator()(const FileInfo& lhs, const FileInfo& rhs)
{
- return compareWithoutFlags(lhs, rhs) < 0;
+ return compareWithoutFlags(lhs, rhs) < 0;
}
int
compareWithoutFlags(const FileInfo& lhs, const FileInfo& rhs)
{
- if(lhs.path < rhs.path)
- {
- return -1;
- }
- else if(rhs.path < lhs.path)
- {
- return 1;
- }
-
- //
- // For the size portion of the comparison, we only distinquish
- // between file (size >= 0) and directory (size == -1). We do
- // not take the actual size into account, as it might be set
- // to 0 if no compressed file is available.
- //
- Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size;
- Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size;
- if(lsz < rsz)
- {
- return -1;
- }
- else if(rsz < lsz)
- {
- return 1;
- }
-
- if(lhs.checksum < rhs.checksum)
- {
- return -1;
- }
- else if(rhs.checksum < lhs.checksum)
- {
- return 1;
- }
-
- return 0;
+ if(lhs.path < rhs.path)
+ {
+ return -1;
+ }
+ else if(rhs.path < lhs.path)
+ {
+ return 1;
+ }
+
+ //
+ // For the size portion of the comparison, we only distinquish
+ // between file (size >= 0) and directory (size == -1). We do
+ // not take the actual size into account, as it might be set
+ // to 0 if no compressed file is available.
+ //
+ Ice::Int lsz = lhs.size > 0 ? 0 : lhs.size;
+ Ice::Int rsz = rhs.size > 0 ? 0 : rhs.size;
+ if(lsz < rsz)
+ {
+ return -1;
+ }
+ else if(rsz < lsz)
+ {
+ return 1;
+ }
+
+ if(lhs.checksum < rhs.checksum)
+ {
+ return -1;
+ }
+ else if(rhs.checksum < lhs.checksum)
+ {
+ return 1;
+ }
+
+ return 0;
}
};
@@ -138,17 +138,17 @@ struct FileInfoLess : public FileInfoWithoutFlagsLess
bool
operator()(const FileInfo& lhs, const FileInfo& rhs)
{
- int rc = compareWithoutFlags(lhs, rhs);
- if(rc < 0)
- {
- return true;
- }
- else if(rc > 0)
- {
- return false;
- }
-
- return lhs.executable < rhs.executable;
+ int rc = compareWithoutFlags(lhs, rhs);
+ if(rc < 0)
+ {
+ return true;
+ }
+ else if(rc > 0)
+ {
+ return false;
+ }
+
+ return lhs.executable < rhs.executable;
}
};
diff --git a/cpp/include/IceStorm/Service.h b/cpp/include/IceStorm/Service.h
index 55083fc5faa..ed64dcc45bc 100644
--- a/cpp/include/IceStorm/Service.h
+++ b/cpp/include/IceStorm/Service.h
@@ -32,11 +32,11 @@ class ICE_STORM_API Service : public ::IceBox::Service
public:
static ServicePtr create(const Ice::CommunicatorPtr&,
- const Ice::ObjectAdapterPtr&,
- const Ice::ObjectAdapterPtr&,
- const std::string&,
- const Ice::Identity&,
- const std::string&);
+ const Ice::ObjectAdapterPtr&,
+ const Ice::ObjectAdapterPtr&,
+ const std::string&,
+ const Ice::Identity&,
+ const std::string&);
virtual void start(const std::string&, const Ice::CommunicatorPtr&, const Ice::StringSeq&) = 0;
diff --git a/cpp/include/IceUtil/AbstractMutex.h b/cpp/include/IceUtil/AbstractMutex.h
index b2756a71821..1e8b2e0ed3b 100644
--- a/cpp/include/IceUtil/AbstractMutex.h
+++ b/cpp/include/IceUtil/AbstractMutex.h
@@ -43,17 +43,17 @@ public:
virtual void lock() const
{
- T::lock();
+ T::lock();
}
virtual void unlock() const
{
- T::unlock();
+ T::unlock();
}
virtual bool tryLock() const
{
- return T::tryLock();
+ return T::tryLock();
}
virtual ~AbstractMutexI()
@@ -72,17 +72,17 @@ public:
virtual void lock() const
{
- T::readLock();
+ T::readLock();
}
virtual void unlock() const
{
- T::unlock();
+ T::unlock();
}
virtual bool tryLock() const
{
- return T::tryReadLock();
+ return T::tryReadLock();
}
virtual ~AbstractMutexReadI()
@@ -101,17 +101,17 @@ public:
virtual void lock() const
{
- T::writeLock();
+ T::writeLock();
}
virtual void unlock() const
{
- T::unlock();
+ T::unlock();
}
virtual bool tryLock() const
{
- return T::tryWriteLock();
+ return T::tryWriteLock();
}
virtual ~AbstractMutexWriteI()
diff --git a/cpp/include/IceUtil/Cache.h b/cpp/include/IceUtil/Cache.h
index f03afafdbd6..a4d1532a969 100644
--- a/cpp/include/IceUtil/Cache.h
+++ b/cpp/include/IceUtil/Cache.h
@@ -35,24 +35,24 @@ public:
struct Latch : public CountDownLatch
{
- Latch() :
- CountDownLatch(1),
- useCount(0)
- {
- }
- int useCount;
+ Latch() :
+ CountDownLatch(1),
+ useCount(0)
+ {
+ }
+ int useCount;
};
struct CacheValue
{
- CacheValue(const Handle<Value>& o) :
- obj(o),
- latch(0)
- {
- }
-
- Handle<Value> obj;
- Latch* latch;
+ CacheValue(const Handle<Value>& o) :
+ obj(o),
+ latch(0)
+ {
+ }
+
+ Handle<Value> obj;
+ Latch* latch;
};
typedef typename std::map<Key, CacheValue>::iterator Position;
@@ -101,11 +101,11 @@ Cache<Key, Value>::getIfPinned(const Key& key) const
typename CacheMap::const_iterator p = _map.find(key);
if(p != _map.end())
{
- return (*p).second.obj;
+ return (*p).second.obj;
}
else
{
- return 0;
+ return 0;
}
}
@@ -156,7 +156,7 @@ Cache<Key, Value>::pin(const Key& key, const Handle<Value>& obj)
if(ir.second)
{
- pinned(obj, ir.first);
+ pinned(obj, ir.first);
}
return ir.second;
}
@@ -181,145 +181,145 @@ Cache<Key, Value>::pinImpl(const Key& key, const Handle<Value>& newObj)
for(;;)
{
- {
- Mutex::Lock sync(_mutex);
-
- //
- // Clean up latch from previous loop
- //
- if(latch != 0)
- {
- if(--latch->useCount == 0)
- {
- delete latch;
- }
- latch = 0;
- }
+ {
+ Mutex::Lock sync(_mutex);
+
+ //
+ // Clean up latch from previous loop
+ //
+ if(latch != 0)
+ {
+ if(--latch->useCount == 0)
+ {
+ delete latch;
+ }
+ latch = 0;
+ }
#if defined(_MSC_VER) && (_MSC_VER < 1300)
- std::pair<CacheMap::iterator, bool> ir =
+ std::pair<CacheMap::iterator, bool> ir =
#else
- std::pair<typename CacheMap::iterator, bool> ir =
-#endif
-
+ std::pair<typename CacheMap::iterator, bool> ir =
+#endif
+
#if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
- _map.insert(CacheMap::value_type(key, CacheValue(0)));
+ _map.insert(CacheMap::value_type(key, CacheValue(0)));
#else
- _map.insert(typename CacheMap::value_type(key, CacheValue(0)));
+ _map.insert(typename CacheMap::value_type(key, CacheValue(0)));
#endif
- if(ir.second == false)
- {
- CacheValue& val = ir.first->second;
- if(val.obj != 0)
- {
- return val.obj;
- }
-
- //
- // Otherwise wait
- //
- if(val.latch == 0)
- {
- //
- // The first queued thread creates the latch
- //
- val.latch = new Latch;
- }
- latch = val.latch;
- latch->useCount++;
- }
-
- p = ir.first;
- }
-
- if(latch != 0)
- {
- latch->await();
-
- //
- // p could be stale now, e.g. some other thread pinned and unpinned the
- // object while we were waiting.
- // So start over.
- //
- continue;
- }
- else
- {
- Handle<Value> obj;
- try
- {
- obj = load(key);
- }
- catch(...)
- {
- {
- Mutex::Lock sync(_mutex);
- latch = p->second.latch;
- p->second.latch = 0;
- _map.erase(p);
- }
- if(latch != 0)
- {
- assert(latch->getCount() == 1);
- latch->countDown();
- }
- throw;
- }
-
- {
- Mutex::Lock sync(_mutex);
-
- latch = p->second.latch;
- p->second.latch = 0;
-
- try
- {
- if(obj != 0)
- {
- p->second.obj = obj;
- pinned(obj, p);
- }
- else
- {
- if(newObj == 0)
- {
- //
- // pin() did not find the object
- //
-
- //
- // The waiting threads will have to call load() to see by themselves.
- //
- _map.erase(p);
- }
- else
- {
- //
- // putIfAbsent() inserts key/newObj
- //
- p->second.obj = newObj;
- pinned(newObj, p);
- }
- }
- }
- catch(...)
- {
- if(latch != 0)
- {
- assert(latch->getCount() == 1);
- latch->countDown();
- }
- throw;
- }
- }
- if(latch != 0)
- {
- assert(latch->getCount() == 1);
- latch->countDown();
- }
- return obj;
- }
+ if(ir.second == false)
+ {
+ CacheValue& val = ir.first->second;
+ if(val.obj != 0)
+ {
+ return val.obj;
+ }
+
+ //
+ // Otherwise wait
+ //
+ if(val.latch == 0)
+ {
+ //
+ // The first queued thread creates the latch
+ //
+ val.latch = new Latch;
+ }
+ latch = val.latch;
+ latch->useCount++;
+ }
+
+ p = ir.first;
+ }
+
+ if(latch != 0)
+ {
+ latch->await();
+
+ //
+ // p could be stale now, e.g. some other thread pinned and unpinned the
+ // object while we were waiting.
+ // So start over.
+ //
+ continue;
+ }
+ else
+ {
+ Handle<Value> obj;
+ try
+ {
+ obj = load(key);
+ }
+ catch(...)
+ {
+ {
+ Mutex::Lock sync(_mutex);
+ latch = p->second.latch;
+ p->second.latch = 0;
+ _map.erase(p);
+ }
+ if(latch != 0)
+ {
+ assert(latch->getCount() == 1);
+ latch->countDown();
+ }
+ throw;
+ }
+
+ {
+ Mutex::Lock sync(_mutex);
+
+ latch = p->second.latch;
+ p->second.latch = 0;
+
+ try
+ {
+ if(obj != 0)
+ {
+ p->second.obj = obj;
+ pinned(obj, p);
+ }
+ else
+ {
+ if(newObj == 0)
+ {
+ //
+ // pin() did not find the object
+ //
+
+ //
+ // The waiting threads will have to call load() to see by themselves.
+ //
+ _map.erase(p);
+ }
+ else
+ {
+ //
+ // putIfAbsent() inserts key/newObj
+ //
+ p->second.obj = newObj;
+ pinned(newObj, p);
+ }
+ }
+ }
+ catch(...)
+ {
+ if(latch != 0)
+ {
+ assert(latch->getCount() == 1);
+ latch->countDown();
+ }
+ throw;
+ }
+ }
+ if(latch != 0)
+ {
+ assert(latch->getCount() == 1);
+ latch->countDown();
+ }
+ return obj;
+ }
}
}
diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h
index 2aedc67952c..ae47c4f6456 100644
--- a/cpp/include/IceUtil/Cond.h
+++ b/cpp/include/IceUtil/Cond.h
@@ -88,11 +88,11 @@ public:
template <typename Lock> inline void
wait(const Lock& lock) const
{
- if(!lock.acquired())
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- waitImpl(lock._mutex);
+ if(!lock.acquired())
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ waitImpl(lock._mutex);
}
//
@@ -105,11 +105,11 @@ public:
template <typename Lock> inline bool
timedWait(const Lock& lock, const Time& timeout) const
{
- if(!lock.acquired())
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- return timedWaitImpl(lock._mutex, timeout);
+ if(!lock.acquired())
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ return timedWaitImpl(lock._mutex, timeout);
}
private:
@@ -205,7 +205,7 @@ Cond::waitImpl(const M& mutex) const
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -226,15 +226,15 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const
if(rc != 0)
{
- //
- // pthread_cond_timedwait returns ETIMEOUT in the event of a
- // timeout.
- //
- if(rc != ETIMEDOUT)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- return false;
+ //
+ // pthread_cond_timedwait returns ETIMEOUT in the event of a
+ // timeout.
+ //
+ if(rc != ETIMEDOUT)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ return false;
}
return true;
}
diff --git a/cpp/include/IceUtil/DisableWarnings.h b/cpp/include/IceUtil/DisableWarnings.h
index 1803a0bdc19..ff68c2e0e4b 100644
--- a/cpp/include/IceUtil/DisableWarnings.h
+++ b/cpp/include/IceUtil/DisableWarnings.h
@@ -21,11 +21,11 @@
//
#if defined(_MSC_VER) && _MSC_VER >= 1400
-# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated/
+# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated/
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1300
-# pragma warning( 4 : 4996 ) // C4996 'std::<function>' was declared deprecated
+# pragma warning( 4 : 4996 ) // C4996 'std::<function>' was declared deprecated
#endif
#endif
diff --git a/cpp/include/IceUtil/Functional.h b/cpp/include/IceUtil/Functional.h
index c0a7bf25623..29effa43b9a 100644
--- a/cpp/include/IceUtil/Functional.h
+++ b/cpp/include/IceUtil/Functional.h
@@ -32,7 +32,7 @@ public:
explicit MemFun(MemberFN p) : _mfn(p) { }
R operator()(H handle) const
{
- return (handle.get() ->* _mfn)();
+ return (handle.get() ->* _mfn)();
}
};
@@ -47,7 +47,7 @@ public:
explicit MemFun1(MemberFN p) : _mfn(p) { }
R operator()(H handle, A arg) const
{
- return (handle.get() ->* _mfn)(arg);
+ return (handle.get() ->* _mfn)(arg);
}
};
@@ -62,7 +62,7 @@ public:
explicit VoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(H handle) const
{
- (handle.get() ->* _mfn)();
+ (handle.get() ->* _mfn)();
}
};
@@ -77,7 +77,7 @@ public:
explicit VoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(H handle, A arg) const
{
- (handle.get() ->* _mfn)(arg);
+ (handle.get() ->* _mfn)(arg);
}
};
@@ -92,7 +92,7 @@ public:
explicit SecondMemFun(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair) const
{
- return (pair.second.get() ->* _mfn)();
+ return (pair.second.get() ->* _mfn)();
}
};
@@ -107,7 +107,7 @@ public:
explicit SecondMemFun1(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair, A arg) const
{
- return (pair.second.get() ->* _mfn)(arg);
+ return (pair.second.get() ->* _mfn)(arg);
}
};
@@ -122,7 +122,7 @@ public:
explicit SecondVoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair) const
{
- (pair.second.get() ->* _mfn)();
+ (pair.second.get() ->* _mfn)();
}
};
@@ -137,7 +137,7 @@ public:
explicit SecondVoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair, A arg) const
{
- (pair.second.get() ->* _mfn)(arg);
+ (pair.second.get() ->* _mfn)(arg);
}
};
@@ -152,7 +152,7 @@ public:
explicit ConstMemFun(MemberFN p) : _mfn(p) { }
R operator()(H handle) const
{
- return (handle.get() ->* _mfn)();
+ return (handle.get() ->* _mfn)();
}
};
@@ -167,7 +167,7 @@ public:
explicit ConstMemFun1(MemberFN p) : _mfn(p) { }
R operator()(H handle, A arg) const
{
- return (handle.get() ->* _mfn)(arg);
+ return (handle.get() ->* _mfn)(arg);
}
};
@@ -182,7 +182,7 @@ public:
explicit ConstVoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(H handle) const
{
- (handle.get() ->* _mfn)();
+ (handle.get() ->* _mfn)();
}
};
@@ -197,7 +197,7 @@ public:
explicit ConstVoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(H handle, A arg) const
{
- (handle.get() ->* _mfn)(arg);
+ (handle.get() ->* _mfn)(arg);
}
};
@@ -212,7 +212,7 @@ public:
explicit SecondConstMemFun(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair) const
{
- return (pair.second.get() ->* _mfn)();
+ return (pair.second.get() ->* _mfn)();
}
};
@@ -227,7 +227,7 @@ public:
explicit SecondConstMemFun1(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair, A arg) const
{
- return (pair.second.get() ->* _mfn)(arg);
+ return (pair.second.get() ->* _mfn)(arg);
}
};
@@ -242,7 +242,7 @@ public:
explicit SecondConstVoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair) const
{
- (pair.second.get() ->* _mfn)();
+ (pair.second.get() ->* _mfn)();
}
};
@@ -257,7 +257,7 @@ public:
explicit SecondConstVoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair, A arg) const
{
- (pair.second.get() ->* _mfn)(arg);
+ (pair.second.get() ->* _mfn)(arg);
}
};
diff --git a/cpp/include/IceUtil/Handle.h b/cpp/include/IceUtil/Handle.h
index c20616ec21f..0f48e2ee71b 100644
--- a/cpp/include/IceUtil/Handle.h
+++ b/cpp/include/IceUtil/Handle.h
@@ -29,13 +29,13 @@ public:
T* get() const
{
- return _ptr;
+ return _ptr;
}
T* operator->() const
{
- if(!_ptr)
- {
+ if(!_ptr)
+ {
//
// We don't throw directly NullHandleException here to
// keep the code size of this method to a minimun (the
@@ -43,16 +43,16 @@ public:
// than just a function call). This maximises the chances
// of inlining by compiler optimization.
//
- throwNullHandleException(__FILE__, __LINE__);
- }
+ throwNullHandleException(__FILE__, __LINE__);
+ }
- return _ptr;
+ return _ptr;
}
T& operator*() const
{
- if(!_ptr)
- {
+ if(!_ptr)
+ {
//
// We don't throw directly NullHandleException here to
// keep the code size of this method to a minimun (the
@@ -60,20 +60,20 @@ public:
// than just a function call). This maximises the chances
// of inlining by compiler optimization.
//
- throwNullHandleException(__FILE__, __LINE__);
- }
+ throwNullHandleException(__FILE__, __LINE__);
+ }
- return *_ptr;
+ return *_ptr;
}
operator bool() const
{
- return _ptr ? true : false;
+ return _ptr ? true : false;
}
void swap(HandleBase& other)
{
- std::swap(_ptr, other._ptr);
+ std::swap(_ptr, other._ptr);
}
T* _ptr;
@@ -96,12 +96,12 @@ inline bool operator==(const HandleBase<T>& lhs, const HandleBase<U>& rhs)
U* r = rhs.get();
if(l && r)
{
- return *l == *r;
+ return *l == *r;
}
else
{
- return !l && !r;
- }
+ return !l && !r;
+ }
}
template<typename T, typename U>
@@ -111,12 +111,12 @@ inline bool operator!=(const HandleBase<T>& lhs, const HandleBase<U>& rhs)
U* r = rhs.get();
if(l && r)
{
- return *l != *r;
+ return *l != *r;
}
else
{
- return l || r;
- }
+ return l || r;
+ }
}
template<typename T, typename U>
@@ -126,11 +126,11 @@ inline bool operator<(const HandleBase<T>& lhs, const HandleBase<U>& rhs)
U* r = rhs.get();
if(l && r)
{
- return *l < *r;
+ return *l < *r;
}
else
{
- return !l && r;
+ return !l && r;
}
}
@@ -141,111 +141,111 @@ public:
Handle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
template<typename Y>
Handle(const Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
Handle(const Handle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
~Handle()
{
- if(this->_ptr)
- {
- this->_ptr->__decRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__decRef();
+ }
}
Handle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- p->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = p;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ p->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = p;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- r._ptr->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ r._ptr->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
Handle& operator=(const Handle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- r._ptr->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ r._ptr->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
template<class Y>
static Handle dynamicCast(const HandleBase<Y>& r)
{
#ifdef __BCPLUSPLUS__
- return Handle<T>(dynamic_cast<T*>(r._ptr));
+ return Handle<T>(dynamic_cast<T*>(r._ptr));
#else
- return Handle(dynamic_cast<T*>(r._ptr));
+ return Handle(dynamic_cast<T*>(r._ptr));
#endif
}
@@ -253,9 +253,9 @@ public:
static Handle dynamicCast(Y* p)
{
#ifdef __BCPLUSPLUS__
- return Handle<T>(dynamic_cast<T*>(p));
+ return Handle<T>(dynamic_cast<T*>(p));
#else
- return Handle(dynamic_cast<T*>(p));
+ return Handle(dynamic_cast<T*>(p));
#endif
}
};
diff --git a/cpp/include/IceUtil/InputUtil.h b/cpp/include/IceUtil/InputUtil.h
index 89ce9990373..480147bffdd 100644
--- a/cpp/include/IceUtil/InputUtil.h
+++ b/cpp/include/IceUtil/InputUtil.h
@@ -37,8 +37,8 @@ ICE_UTIL_API Int64 strToInt64(const char*, char**, int);
//
// - return value == true indicates a successful conversion and result contains the converted value
// - return value == false indicates an unsuccessful conversion:
-// - result == 0 indicates that no digits were available for conversion
-// - result == "Int64 Min" or result == "Int64 Max" indicate underflow or overflow.
+// - result == 0 indicates that no digits were available for conversion
+// - result == "Int64 Min" or result == "Int64 Max" indicate underflow or overflow.
//
ICE_UTIL_API bool stringToInt64(const std::string&, Int64&);
diff --git a/cpp/include/IceUtil/Lock.h b/cpp/include/IceUtil/Lock.h
index 9aaf24bcf56..5fdfbddcdd8 100644
--- a/cpp/include/IceUtil/Lock.h
+++ b/cpp/include/IceUtil/Lock.h
@@ -44,63 +44,63 @@ class LockT
public:
LockT(const T& mutex) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _mutex.lock();
- _acquired = true;
+ _mutex.lock();
+ _acquired = true;
}
~LockT()
{
- if (_acquired)
- {
- _mutex.unlock();
- }
+ if (_acquired)
+ {
+ _mutex.unlock();
+ }
}
void acquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.lock();
- _acquired = true;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.lock();
+ _acquired = true;
}
bool tryAcquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _acquired = _mutex.tryLock();
- return _acquired;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _acquired = _mutex.tryLock();
+ return _acquired;
}
void release() const
{
- if (!_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.unlock();
- _acquired = false;
+ if (!_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.unlock();
+ _acquired = false;
}
bool acquired() const
{
- return _acquired;
+ return _acquired;
}
protected:
// TryLockT's contructor
LockT(const T& mutex, bool) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _acquired = _mutex.tryLock();
+ _acquired = _mutex.tryLock();
}
private:
@@ -126,7 +126,7 @@ class TryLockT : public LockT<T>
public:
TryLockT(const T& mutex) :
- LockT<T>(mutex, true)
+ LockT<T>(mutex, true)
{}
};
diff --git a/cpp/include/IceUtil/Monitor.h b/cpp/include/IceUtil/Monitor.h
index 2e9fd0e456f..e64830e0979 100644
--- a/cpp/include/IceUtil/Monitor.h
+++ b/cpp/include/IceUtil/Monitor.h
@@ -89,11 +89,11 @@ IceUtil::Monitor<T>::lock() const
_mutex.lock();
if(_mutex.willUnlock())
{
- //
- // On the first mutex acquisition reset the number pending
- // notifications.
- //
- _nnotify = 0;
+ //
+ // On the first mutex acquisition reset the number pending
+ // notifications.
+ //
+ _nnotify = 0;
}
}
@@ -102,10 +102,10 @@ IceUtil::Monitor<T>::unlock() const
{
if(_mutex.willUnlock())
{
- //
- // Perform any pending notifications.
- //
- notifyImpl(_nnotify);
+ //
+ // Perform any pending notifications.
+ //
+ notifyImpl(_nnotify);
}
_mutex.unlock();
@@ -113,10 +113,10 @@ IceUtil::Monitor<T>::unlock() const
int nnotify = _nnotify;
if(_mutex.unlock())
{
- //
- // Perform any pending notifications.
- //
- notifyImpl(nnotify);
+ //
+ // Perform any pending notifications.
+ //
+ notifyImpl(nnotify);
}
*/
}
@@ -127,11 +127,11 @@ IceUtil::Monitor<T>::tryLock() const
bool result = _mutex.tryLock();
if(result && _mutex.willUnlock())
{
- //
- // On the first mutex acquisition reset the number pending
- // notifications.
- //
- _nnotify = 0;
+ //
+ // On the first mutex acquisition reset the number pending
+ // notifications.
+ //
+ _nnotify = 0;
}
return result;
}
@@ -149,15 +149,15 @@ IceUtil::Monitor<T>::wait() const
//
try
{
- _cond.waitImpl(_mutex);
- //
- // Reset the nnotify count once wait() returns.
- //
+ _cond.waitImpl(_mutex);
+ //
+ // Reset the nnotify count once wait() returns.
+ //
}
catch(...)
{
- _nnotify = 0;
- throw;
+ _nnotify = 0;
+ throw;
}
_nnotify = 0;
@@ -177,16 +177,16 @@ IceUtil::Monitor<T>::timedWait(const Time& timeout) const
//
try
{
- rc = _cond.timedWaitImpl(_mutex, timeout);
+ rc = _cond.timedWaitImpl(_mutex, timeout);
- //
- // Reset the nnotify count once wait() returns.
- //
+ //
+ // Reset the nnotify count once wait() returns.
+ //
}
catch(...)
{
- _nnotify = 0;
- throw;
+ _nnotify = 0;
+ throw;
}
_nnotify = 0;
@@ -202,7 +202,7 @@ IceUtil::Monitor<T>::notify()
//
if(_nnotify != -1)
{
- ++_nnotify;
+ ++_nnotify;
}
}
@@ -224,25 +224,25 @@ IceUtil::Monitor<T>::notifyImpl(int nnotify) const
//
if(nnotify != 0)
{
- //
- // -1 means notifyAll.
- //
- if(nnotify == -1)
- {
- _cond.broadcast();
- return;
- }
- else
- {
- //
- // Otherwise notify n times.
- //
- while(nnotify > 0)
- {
- _cond.signal();
- --nnotify;
- }
- }
+ //
+ // -1 means notifyAll.
+ //
+ if(nnotify == -1)
+ {
+ _cond.broadcast();
+ return;
+ }
+ else
+ {
+ //
+ // Otherwise notify n times.
+ //
+ while(nnotify > 0)
+ {
+ _cond.signal();
+ --nnotify;
+ }
+ }
}
}
diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h
index da2c36b9bca..ca08324d28b 100644
--- a/cpp/include/IceUtil/Mutex.h
+++ b/cpp/include/IceUtil/Mutex.h
@@ -87,7 +87,7 @@ private:
#else
struct LockState
{
- pthread_mutex_t* mutex;
+ pthread_mutex_t* mutex;
};
#endif
@@ -140,12 +140,12 @@ Mutex::tryLock() const
{
if(!TryEnterCriticalSection(&_mutex))
{
- return false;
+ return false;
}
if(_mutex.RecursionCount > 1)
{
- LeaveCriticalSection(&_mutex);
- throw ThreadLockedException(__FILE__, __LINE__);
+ LeaveCriticalSection(&_mutex);
+ throw ThreadLockedException(__FILE__, __LINE__);
}
return true;
}
@@ -178,7 +178,7 @@ Mutex::Mutex() :
_mutex = CreateMutex(0, false, 0);
if(_mutex == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -188,7 +188,7 @@ Mutex::~Mutex()
BOOL rc = CloseHandle(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -198,14 +198,14 @@ Mutex::lock() const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
_recursionCount++;
}
@@ -216,18 +216,18 @@ Mutex::tryLock() const
DWORD rc = WaitForSingleObject(_mutex, 0);
if(rc != WAIT_OBJECT_0)
{
- return false;
+ return false;
}
else if(_recursionCount == 1)
{
- _recursionCount++;
- unlock();
- throw ThreadLockedException(__FILE__, __LINE__);
+ _recursionCount++;
+ unlock();
+ throw ThreadLockedException(__FILE__, __LINE__);
}
else
{
- _recursionCount++;
- return true;
+ _recursionCount++;
+ return true;
}
}
@@ -238,7 +238,7 @@ Mutex::unlock() const
BOOL rc = ReleaseMutex(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -287,7 +287,7 @@ Mutex::Mutex()
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -306,13 +306,13 @@ Mutex::lock() const
if(rc != 0)
{
if(rc == EDEADLK)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
}
@@ -323,13 +323,13 @@ Mutex::tryLock() const
if(rc != 0 && rc != EBUSY)
{
if(rc == EDEADLK)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
return (rc == 0);
}
@@ -340,7 +340,7 @@ Mutex::unlock() const
int rc = pthread_mutex_unlock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cpp/include/IceUtil/Options.h b/cpp/include/IceUtil/Options.h
index f7af12c47a5..ef14133eb7e 100755
--- a/cpp/include/IceUtil/Options.h
+++ b/cpp/include/IceUtil/Options.h
@@ -87,10 +87,10 @@ private:
struct OptionDetails : public IceUtil::Shared
{
- LengthType length;
- ArgType arg;
+ LengthType length;
+ ArgType arg;
RepeatType repeat;
- bool hasDefault;
+ bool hasDefault;
};
typedef IceUtil::Handle<OptionDetails> ODPtr;
diff --git a/cpp/include/IceUtil/OutputUtil.h b/cpp/include/IceUtil/OutputUtil.h
index c6b6c021f89..ec86158f1d1 100644
--- a/cpp/include/IceUtil/OutputUtil.h
+++ b/cpp/include/IceUtil/OutputUtil.h
@@ -127,7 +127,7 @@ operator<<(Output& out, const std::vector<T>& val)
{
for(typename std::vector<T>::const_iterator p = val.begin(); p != val.end(); ++p)
{
- out << *p;
+ out << *p;
}
return out;
}
@@ -145,7 +145,7 @@ operator<<(Output& out, std::vector<T>& val)
{
for(typename std::vector<T>::const_iterator p = val.begin(); p != val.end(); ++p)
{
- out << *p;
+ out << *p;
}
return out;
}
diff --git a/cpp/include/IceUtil/RWRecMutex.h b/cpp/include/IceUtil/RWRecMutex.h
index bdcefeb676d..396aae37cf3 100644
--- a/cpp/include/IceUtil/RWRecMutex.h
+++ b/cpp/include/IceUtil/RWRecMutex.h
@@ -37,83 +37,83 @@ class RLockT
public:
RLockT(const T& mutex) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _mutex.readLock();
- _acquired = true;
+ _mutex.readLock();
+ _acquired = true;
}
~RLockT()
{
- if (_acquired)
- {
- _mutex.unlock();
- }
+ if (_acquired)
+ {
+ _mutex.unlock();
+ }
}
void acquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.readLock();
- _acquired = true;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.readLock();
+ _acquired = true;
}
bool tryAcquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _acquired = _mutex.tryReadLock();
- return _acquired;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _acquired = _mutex.tryReadLock();
+ return _acquired;
}
bool timedAcquire(const Time& timeout) const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _acquired = _mutex.timedReadLock(timeout);
- return _acquired;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _acquired = _mutex.timedReadLock(timeout);
+ return _acquired;
}
void release() const
{
- if (!_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.unlock();
- _acquired = false;
+ if (!_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.unlock();
+ _acquired = false;
}
bool acquired() const
{
- return _acquired;
+ return _acquired;
}
void
upgrade() const
{
- _mutex.upgrade();
+ _mutex.upgrade();
}
bool
timedUpgrade(const Time& timeout) const
{
- return _mutex.timedUpgrade(timeout);
+ return _mutex.timedUpgrade(timeout);
}
void
downgrade() const
{
- _mutex.downgrade();
+ _mutex.downgrade();
}
protected:
@@ -121,16 +121,16 @@ protected:
// TryRLockT's constructors
RLockT(const T& mutex, bool) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _acquired = _mutex.tryReadLock();
+ _acquired = _mutex.tryReadLock();
}
RLockT(const T& mutex, const Time& timeout) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _acquired = _mutex.timedReadLock(timeout);
+ _acquired = _mutex.timedReadLock(timeout);
}
@@ -151,12 +151,12 @@ class TryRLockT : public RLockT<T>
public:
TryRLockT(const T& mutex) :
- RLockT<T>(mutex, true)
+ RLockT<T>(mutex, true)
{
}
TryRLockT(const T& mutex, const Time& timeout) :
- RLockT<T>(mutex, timeout)
+ RLockT<T>(mutex, timeout)
{
}
};
@@ -167,63 +167,63 @@ class WLockT
public:
WLockT(const T& mutex) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _mutex.writeLock();
- _acquired = true;
+ _mutex.writeLock();
+ _acquired = true;
}
~WLockT()
{
- if (_acquired)
- {
- _mutex.unlock();
- }
+ if (_acquired)
+ {
+ _mutex.unlock();
+ }
}
void acquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.writeLock();
- _acquired = true;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.writeLock();
+ _acquired = true;
}
bool tryAcquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _acquired = _mutex.tryWriteLock();
- return _acquired;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _acquired = _mutex.tryWriteLock();
+ return _acquired;
}
bool timedAcquire(const Time& timeout) const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _acquired = _mutex.timedWriteLock(timeout);
- return _acquired;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _acquired = _mutex.timedWriteLock(timeout);
+ return _acquired;
}
void release() const
{
- if (!_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.unlock();
- _acquired = false;
+ if (!_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.unlock();
+ _acquired = false;
}
bool acquired() const
{
- return _acquired;
+ return _acquired;
}
protected:
@@ -231,15 +231,15 @@ protected:
// TryWLockT's constructor
WLockT(const T& mutex, bool) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _acquired = _mutex.tryWriteLock();
+ _acquired = _mutex.tryWriteLock();
}
WLockT(const T& mutex, const Time& timeout) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _acquired = _mutex.timedWriteLock(timeout);
+ _acquired = _mutex.timedWriteLock(timeout);
}
private:
@@ -259,12 +259,12 @@ class TryWLockT : public WLockT<T>
public:
TryWLockT(const T& mutex) :
- WLockT<T>(mutex, true)
+ WLockT<T>(mutex, true)
{
}
TryWLockT(const T& mutex, const Time& timeout) :
- WLockT<T>(mutex, timeout)
+ WLockT<T>(mutex, timeout)
{
}
};
diff --git a/cpp/include/IceUtil/RecMutex.h b/cpp/include/IceUtil/RecMutex.h
index 898123834c4..5c89feb21b2 100644
--- a/cpp/include/IceUtil/RecMutex.h
+++ b/cpp/include/IceUtil/RecMutex.h
@@ -78,13 +78,13 @@ private:
#ifdef _WIN32
struct LockState
{
- int count;
+ int count;
};
#else
struct LockState
{
- pthread_mutex_t* mutex;
- int count;
+ pthread_mutex_t* mutex;
+ int count;
};
#endif
diff --git a/cpp/include/IceUtil/ScopedArray.h b/cpp/include/IceUtil/ScopedArray.h
index edc033f0c8c..52be7c0ae12 100644
--- a/cpp/include/IceUtil/ScopedArray.h
+++ b/cpp/include/IceUtil/ScopedArray.h
@@ -28,25 +28,25 @@ public:
~ScopedArray()
{
if(_ptr != 0)
- {
- delete[] _ptr;
- }
+ {
+ delete[] _ptr;
+ }
}
void reset(T* ptr = 0)
{
- assert(ptr == 0 || ptr != _ptr);
+ assert(ptr == 0 || ptr != _ptr);
if(_ptr != 0)
- {
- delete[] _ptr;
- }
- _ptr = ptr;
+ {
+ delete[] _ptr;
+ }
+ _ptr = ptr;
}
T& operator[](size_t i) const
{
- assert(_ptr != 0);
- assert(i >= 0);
+ assert(_ptr != 0);
+ assert(i >= 0);
return _ptr[i];
}
@@ -58,8 +58,8 @@ public:
void swap(ScopedArray& a)
{
T* tmp = a._ptr;
- a._ptr = _ptr;
- _ptr = tmp;
+ a._ptr = _ptr;
+ _ptr = tmp;
}
private:
diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h
index 8abb33f0c34..c80b6b35c5b 100644
--- a/cpp/include/IceUtil/Shared.h
+++ b/cpp/include/IceUtil/Shared.h
@@ -62,9 +62,9 @@ inline void ice_atomic_set(ice_atomic_t* v, int i)
inline void ice_atomic_inc(ice_atomic_t *v)
{
__asm__ __volatile__(
- "lock ; incl %0"
- :"=m" (v->counter)
- :"m" (v->counter));
+ "lock ; incl %0"
+ :"=m" (v->counter)
+ :"m" (v->counter));
}
/**
@@ -81,9 +81,9 @@ inline int ice_atomic_dec_and_test(ice_atomic_t *v)
{
unsigned char c;
__asm__ __volatile__(
- "lock ; decl %0; sete %1"
- :"=m" (v->counter), "=qm" (c)
- :"m" (v->counter) : "memory");
+ "lock ; decl %0; sete %1"
+ :"=m" (v->counter), "=qm" (c)
+ :"m" (v->counter) : "memory");
return c != 0;
}
@@ -98,10 +98,10 @@ inline int ice_atomic_exchange_add(int i, ice_atomic_t* v)
{
int tmp = i;
__asm__ __volatile__(
- "lock ; xadd %0,(%2)"
- :"+r"(tmp), "=m"(v->counter)
- :"r"(v), "m"(v->counter)
- : "memory");
+ "lock ; xadd %0,(%2)"
+ :"+r"(tmp), "=m"(v->counter)
+ :"r"(v), "m"(v->counter)
+ : "memory");
return tmp + i;
}
@@ -148,31 +148,31 @@ public:
void __incRef()
{
- assert(_ref >= 0);
- ++_ref;
+ assert(_ref >= 0);
+ ++_ref;
}
void __decRef()
{
- assert(_ref > 0);
- if(--_ref == 0)
- {
- if(!_noDelete)
- {
- _noDelete = true;
- delete this;
- }
- }
+ assert(_ref > 0);
+ if(--_ref == 0)
+ {
+ if(!_noDelete)
+ {
+ _noDelete = true;
+ delete this;
+ }
+ }
}
int __getRef() const
{
- return _ref;
+ return _ref;
}
void __setNoDelete(bool b)
{
- _noDelete = b;
+ _noDelete = b;
}
private:
@@ -200,49 +200,49 @@ public:
void __incRef()
{
#if defined(_WIN32)
- assert(InterlockedExchangeAdd(&_ref, 0) >= 0);
- InterlockedIncrement(&_ref);
+ assert(InterlockedExchangeAdd(&_ref, 0) >= 0);
+ InterlockedIncrement(&_ref);
#elif defined(ICE_HAS_ATOMIC_FUNCTIONS)
- assert(ice_atomic_exchange_add(0, &_ref) >= 0);
- ice_atomic_inc(&_ref);
+ assert(ice_atomic_exchange_add(0, &_ref) >= 0);
+ ice_atomic_inc(&_ref);
#else
- _mutex.lock();
- assert(_ref >= 0);
- ++_ref;
- _mutex.unlock();
+ _mutex.lock();
+ assert(_ref >= 0);
+ ++_ref;
+ _mutex.unlock();
#endif
}
void __decRef()
{
#if defined(_WIN32)
- assert(InterlockedExchangeAdd(&_ref, 0) > 0);
- if(InterlockedDecrement(&_ref) == 0 && !_noDelete)
- {
- _noDelete = true;
- delete this;
- }
+ assert(InterlockedExchangeAdd(&_ref, 0) > 0);
+ if(InterlockedDecrement(&_ref) == 0 && !_noDelete)
+ {
+ _noDelete = true;
+ delete this;
+ }
#elif defined(ICE_HAS_ATOMIC_FUNCTIONS)
- assert(ice_atomic_exchange_add(0, &_ref) > 0);
- if(ice_atomic_dec_and_test(&_ref) && !_noDelete)
- {
- _noDelete = true;
- delete this;
- }
+ assert(ice_atomic_exchange_add(0, &_ref) > 0);
+ if(ice_atomic_dec_and_test(&_ref) && !_noDelete)
+ {
+ _noDelete = true;
+ delete this;
+ }
#else
- _mutex.lock();
- bool doDelete = false;
- assert(_ref > 0);
- if(--_ref == 0)
- {
- doDelete = !_noDelete;
- _noDelete = true;
- }
- _mutex.unlock();
- if(doDelete)
- {
- delete this;
- }
+ _mutex.lock();
+ bool doDelete = false;
+ assert(_ref > 0);
+ if(--_ref == 0)
+ {
+ doDelete = !_noDelete;
+ _noDelete = true;
+ }
+ _mutex.unlock();
+ if(doDelete)
+ {
+ delete this;
+ }
#endif
}
diff --git a/cpp/include/IceUtil/StaticMutex.h b/cpp/include/IceUtil/StaticMutex.h
index bf67e79635e..4bf6ccf2fad 100644
--- a/cpp/include/IceUtil/StaticMutex.h
+++ b/cpp/include/IceUtil/StaticMutex.h
@@ -95,7 +95,7 @@ private:
#else
struct LockState
{
- pthread_mutex_t* mutex;
+ pthread_mutex_t* mutex;
};
#endif
@@ -149,7 +149,7 @@ StaticMutex::lock() const
{
if(!initialized())
{
- initialize();
+ initialize();
}
EnterCriticalSection(_mutex);
assert(_mutex->RecursionCount == 1);
@@ -160,16 +160,16 @@ StaticMutex::tryLock() const
{
if(!initialized())
{
- initialize();
+ initialize();
}
if(!TryEnterCriticalSection(_mutex))
{
- return false;
+ return false;
}
if(_mutex->RecursionCount > 1)
{
- LeaveCriticalSection(_mutex);
- throw ThreadLockedException(__FILE__, __LINE__);
+ LeaveCriticalSection(_mutex);
+ throw ThreadLockedException(__FILE__, __LINE__);
}
return true;
}
@@ -195,7 +195,7 @@ StaticMutex::lock(LockState&) const
{
if(!initialized())
{
- initialize();
+ initialize();
}
EnterCriticalSection(_mutex);
}
@@ -207,20 +207,20 @@ StaticMutex::lock() const
{
if(!initialized())
{
- initialize();
+ initialize();
}
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
_recursionCount++;
assert(_recursionCount == 1);
@@ -231,24 +231,24 @@ StaticMutex::tryLock() const
{
if(!initialized())
{
- initialize();
+ initialize();
}
DWORD rc = WaitForSingleObject(_mutex, 0);
if(rc != WAIT_OBJECT_0)
{
- return false;
+ return false;
}
else if(_recursionCount == 1)
{
- _recursionCount++;
- unlock();
- throw ThreadLockedException(__FILE__, __LINE__);
+ _recursionCount++;
+ unlock();
+ throw ThreadLockedException(__FILE__, __LINE__);
}
else
{
- _recursionCount++;
- return true;
+ _recursionCount++;
+ return true;
}
}
@@ -259,7 +259,7 @@ StaticMutex::unlock() const
BOOL rc = ReleaseMutex(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -286,13 +286,13 @@ StaticMutex::lock() const
if(rc != 0)
{
if(rc == EDEADLK)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
}
@@ -303,13 +303,13 @@ StaticMutex::tryLock() const
if(rc != 0 && rc != EBUSY)
{
if(rc == EDEADLK)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
return (rc == 0);
}
@@ -320,7 +320,7 @@ StaticMutex::unlock() const
int rc = pthread_mutex_unlock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cpp/include/IceUtil/Thread.h b/cpp/include/IceUtil/Thread.h
index ce70f933336..f46182b2476 100644
--- a/cpp/include/IceUtil/Thread.h
+++ b/cpp/include/IceUtil/Thread.h
@@ -140,8 +140,8 @@ protected:
#endif
private:
- Thread(const Thread&); // Copying is forbidden
- void operator=(const Thread&); // Assignment is forbidden
+ Thread(const Thread&); // Copying is forbidden
+ void operator=(const Thread&); // Assignment is forbidden
};
typedef Handle<Thread> ThreadPtr;
diff --git a/cpp/include/IceUtil/Time.h b/cpp/include/IceUtil/Time.h
index 857c9a680d0..b2b5981776a 100644
--- a/cpp/include/IceUtil/Time.h
+++ b/cpp/include/IceUtil/Time.h
@@ -51,142 +51,142 @@ public:
Time operator-() const
{
- return Time(-_usec);
+ return Time(-_usec);
}
Time operator-(const Time& rhs) const
{
- return Time(_usec - rhs._usec);
+ return Time(_usec - rhs._usec);
}
Time operator+(const Time& rhs) const
{
- return Time(_usec + rhs._usec);
+ return Time(_usec + rhs._usec);
}
Time& operator+=(const Time& rhs)
{
- _usec += rhs._usec;
- return *this;
+ _usec += rhs._usec;
+ return *this;
}
Time& operator-=(const Time& rhs)
{
- _usec -= rhs._usec;
- return *this;
+ _usec -= rhs._usec;
+ return *this;
}
bool operator<(const Time& rhs) const
{
- return _usec < rhs._usec;
+ return _usec < rhs._usec;
}
bool operator<=(const Time& rhs) const
{
- return _usec <= rhs._usec;
+ return _usec <= rhs._usec;
}
bool operator>(const Time& rhs) const
{
- return _usec > rhs._usec;
+ return _usec > rhs._usec;
}
bool operator>=(const Time& rhs) const
{
- return _usec >= rhs._usec;
+ return _usec >= rhs._usec;
}
bool operator==(const Time& rhs) const
{
- return _usec == rhs._usec;
+ return _usec == rhs._usec;
}
bool operator!=(const Time& rhs) const
{
- return _usec != rhs._usec;
+ return _usec != rhs._usec;
}
double operator/(const Time& rhs) const
{
- return (double)_usec / (double)rhs._usec;
+ return (double)_usec / (double)rhs._usec;
}
Time& operator*=(int rhs)
{
- _usec *= rhs;
- return *this;
+ _usec *= rhs;
+ return *this;
}
Time operator*(int rhs) const
{
- Time t;
- t._usec = _usec * rhs;
- return t;
+ Time t;
+ t._usec = _usec * rhs;
+ return t;
}
Time& operator/=(int rhs)
{
- _usec /= rhs;
- return *this;
+ _usec /= rhs;
+ return *this;
}
Time operator/(int rhs) const
{
- Time t;
- t._usec = _usec / rhs;
- return t;
+ Time t;
+ t._usec = _usec / rhs;
+ return t;
}
Time& operator*=(Int64 rhs)
{
- _usec *= rhs;
- return *this;
+ _usec *= rhs;
+ return *this;
}
Time operator*(Int64 rhs) const
{
- Time t;
- t._usec = _usec * rhs;
- return t;
+ Time t;
+ t._usec = _usec * rhs;
+ return t;
}
Time& operator/=(Int64 rhs)
{
- _usec /= rhs;
- return *this;
+ _usec /= rhs;
+ return *this;
}
Time operator/(Int64 rhs) const
{
- Time t;
- t._usec = _usec / rhs;
- return t;
+ Time t;
+ t._usec = _usec / rhs;
+ return t;
}
Time& operator*=(double rhs)
{
- _usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
- return *this;
+ _usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
+ return *this;
}
Time operator*(double rhs) const
{
- Time t;
- t._usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
- return t;
+ Time t;
+ t._usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
+ return t;
}
Time& operator/=(double rhs)
{
- _usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
- return *this;
+ _usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
+ return *this;
}
Time operator/(double rhs) const
{
- Time t;
- t._usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
- return t;
+ Time t;
+ t._usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
+ return t;
}
private:
diff --git a/cpp/include/IceUtil/Unicode.h b/cpp/include/IceUtil/Unicode.h
index caebf5b2a5d..03c95a3fa56 100644
--- a/cpp/include/IceUtil/Unicode.h
+++ b/cpp/include/IceUtil/Unicode.h
@@ -97,10 +97,10 @@ ICE_UTIL_API std::wstring stringToWstring(const std::string&);
enum ConversionResult
{
- conversionOK, /* conversion successful */
- sourceExhausted, /* partial character in source, but hit end */
- targetExhausted, /* insuff. room in target for conversion */
- sourceIllegal /* source sequence is illegal/malformed */
+ conversionOK, /* conversion successful */
+ sourceExhausted, /* partial character in source, but hit end */
+ targetExhausted, /* insuff. room in target for conversion */
+ sourceIllegal /* source sequence is illegal/malformed */
};
@@ -117,15 +117,15 @@ isLegalUTF8Sequence(const Byte* source, const Byte* end);
ICE_UTIL_API ConversionResult
convertUTFWstringToUTF8(const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
ICE_UTIL_API ConversionResult
convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
ICE_UTIL_API ConversionResult
convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd,
- std::wstring& target, ConversionFlags flags);
+ std::wstring& target, ConversionFlags flags);
diff --git a/cpp/include/Slice/CPlusPlusUtil.h b/cpp/include/Slice/CPlusPlusUtil.h
index ae4af4cae89..7fb3f900a4c 100644
--- a/cpp/include/Slice/CPlusPlusUtil.h
+++ b/cpp/include/Slice/CPlusPlusUtil.h
@@ -36,14 +36,14 @@ SLICE_API std::string operationModeToString(Operation::Mode);
SLICE_API std::string fixKwd(const std::string&);
SLICE_API void writeMarshalUnmarshalCode(::IceUtil::Output&, const TypePtr&, const std::string&, bool,
- const std::string& = "", bool = true, const StringList& = StringList(),
- bool = false);
+ const std::string& = "", bool = true, const StringList& = StringList(),
+ bool = false);
SLICE_API void writeMarshalCode(::IceUtil::Output&, const ParamDeclList&, const TypePtr&,
- const StringList&, bool = false);
+ const StringList&, bool = false);
SLICE_API void writeUnmarshalCode(::IceUtil::Output&, const ParamDeclList&, const TypePtr&,
- const StringList&, bool = false);
+ const StringList&, bool = false);
SLICE_API void writeAllocateCode(::IceUtil::Output&, const ParamDeclList&, const TypePtr&,
- const StringList&, bool = false, bool = false);
+ const StringList&, bool = false, bool = false);
SLICE_API void writeStreamMarshalUnmarshalCode(::IceUtil::Output&, const TypePtr&, const std::string&, bool,
const std::string& = "", bool = false, const StringList& = StringList());
SLICE_API std::string findMetaData(const StringList&, bool);
diff --git a/cpp/include/Slice/CsUtil.h b/cpp/include/Slice/CsUtil.h
index 90a53540d51..28c8b577c87 100644
--- a/cpp/include/Slice/CsUtil.h
+++ b/cpp/include/Slice/CsUtil.h
@@ -74,7 +74,7 @@ private:
void validate(const ContainedPtr&);
StringSet _history;
- bool _globalMetaDataDone;
+ bool _globalMetaDataDone;
};
};
diff --git a/cpp/include/Slice/JavaUtil.h b/cpp/include/Slice/JavaUtil.h
index decc474943b..75bc163a1f1 100644
--- a/cpp/include/Slice/JavaUtil.h
+++ b/cpp/include/Slice/JavaUtil.h
@@ -115,14 +115,14 @@ protected:
// to typeToString.
//
std::string typeToObjectString(const TypePtr&, TypeMode, const std::string& = std::string(),
- const StringList& = StringList(), bool = true) const;
+ const StringList& = StringList(), bool = true) const;
//
// Generate code to marshal or unmarshal a type.
//
void writeMarshalUnmarshalCode(::IceUtil::Output&, const std::string&, const TypePtr&, const std::string&,
bool, int&, bool = false, const StringList& = StringList(),
- const std::string& patchParams = "");
+ const std::string& patchParams = "");
//
// Generate code to marshal or unmarshal a dictionary type.
@@ -143,7 +143,7 @@ protected:
//
void writeStreamMarshalUnmarshalCode(::IceUtil::Output&, const std::string&, const TypePtr&, const std::string&,
bool, int&, bool = false, const StringList& = StringList(),
- const std::string& patchParams = "");
+ const std::string& patchParams = "");
//
// Generate code to marshal or unmarshal a dictionary type using the public stream API.
@@ -179,9 +179,9 @@ protected:
// the default mapping was used.
//
bool getDictionaryTypes(const DictionaryPtr&, const std::string&, const StringList&,
- std::string&, std::string&) const;
+ std::string&, std::string&) const;
bool getSequenceTypes(const SequencePtr&, const std::string&, const StringList&,
- std::string&, std::string&) const;
+ std::string&, std::string&) const;
virtual JavaOutput* createOutput();
@@ -212,8 +212,8 @@ private:
private:
StringList getMetaData(const ContainedPtr&);
- void validateType(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
- void validateGetSet(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
+ void validateType(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
+ void validateGetSet(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
StringSet _history;
};
diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h
index d13965b46ad..d903cae03b0 100644
--- a/cpp/include/Slice/Parser.h
+++ b/cpp/include/Slice/Parser.h
@@ -283,17 +283,17 @@ public:
enum Kind
{
- KindByte,
- KindBool,
- KindShort,
- KindInt,
- KindLong,
- KindFloat,
- KindDouble,
- KindString,
- KindObject,
- KindObjectProxy,
- KindLocalObject
+ KindByte,
+ KindBool,
+ KindShort,
+ KindInt,
+ KindLong,
+ KindFloat,
+ KindDouble,
+ KindString,
+ KindObject,
+ KindObjectProxy,
+ KindLocalObject
};
virtual bool isLocal() const;
@@ -343,18 +343,18 @@ public:
enum ContainedType
{
- ContainedTypeSequence,
- ContainedTypeDictionary,
- ContainedTypeEnum,
- ContainedTypeEnumerator,
- ContainedTypeModule,
- ContainedTypeClass,
- ContainedTypeException,
- ContainedTypeStruct,
- ContainedTypeOperation,
- ContainedTypeParamDecl,
- ContainedTypeDataMember,
- ContainedTypeConstant
+ ContainedTypeSequence,
+ ContainedTypeDictionary,
+ ContainedTypeEnum,
+ ContainedTypeEnumerator,
+ ContainedTypeModule,
+ ContainedTypeClass,
+ ContainedTypeException,
+ ContainedTypeStruct,
+ ContainedTypeOperation,
+ ContainedTypeParamDecl,
+ ContainedTypeDataMember,
+ ContainedTypeConstant
};
virtual ContainedType containedType() const = 0;
@@ -396,11 +396,11 @@ public:
StructPtr createStruct(const std::string&, bool);
SequencePtr createSequence(const std::string&, const TypePtr&, const StringList&, bool);
DictionaryPtr createDictionary(const std::string&, const TypePtr&, const StringList&, const TypePtr&,
- const StringList&, bool);
+ const StringList&, bool);
EnumPtr createEnum(const std::string&, bool);
EnumeratorPtr createEnumerator(const std::string&);
ConstPtr createConst(const std::string, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&,
- const std::string&);
+ const std::string&);
TypeList lookupType(const std::string&, bool = true);
TypeList lookupTypeNoBuiltin(const std::string&, bool = true);
ContainedList lookupContained(const std::string&, bool = true);
@@ -543,9 +543,9 @@ public:
//
enum Mode
{
- Normal,
- Nonmutating,
- Idempotent
+ Normal,
+ Nonmutating,
+ Idempotent
};
TypePtr returnType() const;
@@ -762,7 +762,7 @@ public:
protected:
Dictionary(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const TypePtr&,
- const StringList&, bool);
+ const StringList&, bool);
friend class Container;
TypePtr _keyType;
@@ -839,7 +839,7 @@ public:
static bool isLegalType(const std::string&, const TypePtr&, const UnitPtr&);
static bool typesAreCompatible(const std::string&, const TypePtr&,
- const SyntaxTreeBasePtr&, const std::string&, const UnitPtr&);
+ const SyntaxTreeBasePtr&, const std::string&, const UnitPtr&);
static bool isInRange(const std::string&, const TypePtr&, const std::string&, const UnitPtr&);
protected:
diff --git a/cpp/include/Slice/VbUtil.h b/cpp/include/Slice/VbUtil.h
index 704caf8c743..62939d78b23 100644
--- a/cpp/include/Slice/VbUtil.h
+++ b/cpp/include/Slice/VbUtil.h
@@ -72,7 +72,7 @@ private:
void validate(const ContainedPtr&);
StringSet _history;
- bool _globalMetaDataDone;
+ bool _globalMetaDataDone;
};
};
diff --git a/cpp/install/common/components.py b/cpp/install/common/components.py
index 7f2561ce008..63bd8dbaa10 100755
--- a/cpp/install/common/components.py
+++ b/cpp/install/common/components.py
@@ -9,350 +9,350 @@ def listFileLists():
cfg = ConfigParser.SafeConfigParser()
cfg.read("./components/components.ini")
for f in cfg.sections():
- try:
- if cfg.getint(f, "active") == 1:
- for item, value in cfg.items(f):
- if item.startswith("filelist"):
- print value
- except ConfigParser.NoOptionError:
- continue
+ try:
+ if cfg.getint(f, "active") == 1:
+ for item, value in cfg.items(f):
+ if item.startswith("filelist"):
+ print value
+ except ConfigParser.NoOptionError:
+ continue
class StageFileError:
"""Thrown when there is a problem with the stage configuration file."""
def __init__(self, msg = None):
- self.msg = msg
+ self.msg = msg
def __str__(self):
- return repr(self.msg)
+ return repr(self.msg)
class ComponentDefError:
"""Indicates a component definition file has an error that provides
proper interpretation"""
def __init__(self, msg = None):
- self.msg = msg
+ self.msg = msg
def __str__(self):
- return repr(self.msg)
+ return repr(self.msg)
class FileSpecError(ComponentDefError):
"""Indicates a filespec component definition file has a syntactical
error"""
def __init__(self, msg = None):
- ComponentDefError.__init__(self, msg)
+ ComponentDefError.__init__(self, msg)
def recursiveListing(path):
"""Provides a recursive directory listing based in path"""
result = []
files = os.listdir(path)
for x in files:
- fullpath = os.path.join(path, x);
- if os.path.isdir(fullpath) and not os.path.islink(fullpath):
- result.extend(recursiveListing(fullpath))
- else:
- result.append(fullpath)
+ fullpath = os.path.join(path, x);
+ if os.path.isdir(fullpath) and not os.path.islink(fullpath):
+ result.extend(recursiveListing(fullpath))
+ else:
+ result.append(fullpath)
return result
class FileSpecWorker:
def __init__(self, source, dest):
- self.source = source
- self.dest = dest
- self.include = []
- self.exclude = []
- self.explicit = []
-
+ self.source = source
+ self.dest = dest
+ self.include = []
+ self.exclude = []
+ self.explicit = []
+
def add(self, filename):
- parts = filename.split("=")
- if len(parts) < 2:
- #
- # This line doesn"t have a separator and so assume its an
- # explicit listing
- #
- self.explicit.append(filename)
- return
-
- if parts[0].startswith("include"):
- self.include.append(parts[1].strip())
- elif parts[0].startswith("exclude"):
- self.exclude.append(parts[1].strip())
- elif parts[0].startswith("expect"):
- pass
- else:
- raise FileSpecError("Line \'%s\' does not match filespec schema." % filename)
+ parts = filename.split("=")
+ if len(parts) < 2:
+ #
+ # This line doesn"t have a separator and so assume its an
+ # explicit listing
+ #
+ self.explicit.append(filename)
+ return
+
+ if parts[0].startswith("include"):
+ self.include.append(parts[1].strip())
+ elif parts[0].startswith("exclude"):
+ self.exclude.append(parts[1].strip())
+ elif parts[0].startswith("expect"):
+ pass
+ else:
+ raise FileSpecError("Line \'%s\' does not match filespec schema." % filename)
def execute(self, defaults, fake = False):
- """Copy all of the specified files."""
- recursiveIncludes = []
- recursiveExcludes = []
-
- midmatchIncludes = []
- midmatchExcludes = []
-
- localIncludes = []
- localExcludes = []
-
- for f in self.include:
- if f.startswith("**/"):
- if f.endswith("/**"):
- midmatchIncludes.append(".*%s.*" %f[3:len(f) -3].replace('/', '.'))
- else:
- recursiveIncludes.append(f[3:])
- else:
- if f.endswith("/**"):
- midmatchIncludes.append("%s.*" %f[0:len(f) -3].replace('/', '.'))
- else:
- localIncludes.append(f)
-
- for f in self.exclude:
- if f.startswith("**/"):
- if f.endswith("/**"):
- midmatchExcludes.append(".*%s.*" % f[3:len(f) -3].replace('/', '.'))
- else:
- recursiveExcludes.append(f[3:])
- else:
- if f.endswith("/**"):
- midmatchExcludes.append("%s.*" %f[0:len(f) -3].replace('/', '.'))
- else:
- localExcludes.append(f)
-
- logging.debug('localIncludes: ' + str(localIncludes))
- logging.debug('localExcludes: ' + str(localExcludes))
- logging.debug('recursiveIncludes: ' + str(recursiveIncludes))
- logging.debug('recursiveExcludes: ' + str(recursiveExcludes))
- logging.debug('midmatchIncludes: ' + str(midmatchIncludes))
- logging.debug('midmatchExcludes: ' + str(midmatchExcludes))
-
- fullListing = []
- result = []
- files = os.listdir(self.source)
-
- for f in files:
- fullpath = os.path.join(self.source, f);
- if os.path.isdir(fullpath) and not os.path.islink(fullpath):
- fullListing.extend(recursiveListing(fullpath))
- continue
-
- for p in localIncludes + recursiveIncludes:
- if fnmatch.fnmatch(f, p):
- found = False
- for x in localExcludes + recursiveExcludes:
- if fnmatch.fnmatch(f, x):
- found = True
- break
- if not found: result.append(f)
-
- inmatches = []
- for p in recursiveIncludes:
- inmatches.extend(fnmatch.filter(fullListing, p))
-
- inSet = set(inmatches)
-
- for p in midmatchIncludes:
- r = re.compile(p)
- inmatches = []
- for f in fullListing(f):
- rel = f[len(self.source):].strip('\\/')
- if not r.match(rel) == None:
- inmatches.append(f)
- inSet = inSet.union(set(inmatches))
-
- outmatches = []
- for x in recursiveExcludes:
- outmatches.extend(fnmatch.filter(fullListing, x))
-
- outSet = set(outmatches)
-
- for x in midmatchExcludes:
- r = re.compile(x)
- outmatches = []
- for f in fullListing:
- rel = f[len(self.source):].strip('\\/')
- if not r.match(rel) == None:
- outmatches.append(f)
- outSet = outSet.union(set(outmatches))
-
-
- #
- # Using sets is the "easiest" way to do this. If Python"s set
- # implementation is/gets buggy then this needs to be written
- # "longhand".
- #
- diff = inSet - outSet
- result.extend(list(diff))
-
- for i in range(0, len(result)):
- if result[i].startswith(self.source):
- result[i] = result[i][len(self.source):].strip('\\/')
-
- result.sort()
- result.extend(self.explicit)
-
- if fake:
- for f in result:
- print "Copying %s from %s to %s" % (f, self.source, self.dest)
- return
-
- if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
- logging.debug("Files to be copied:")
- for f in result:
- logging.debug(f)
-
- #
- # Scan filename to see if matches one of our designated
- # 'convert to dos file format' name patterns. (These are
- # regex patterns, not patterns for filename globbing).
- #
- textFiles = [".*README.*", ".*Makefile.mak", ".*LICENSE.*"]
+ """Copy all of the specified files."""
+ recursiveIncludes = []
+ recursiveExcludes = []
+
+ midmatchIncludes = []
+ midmatchExcludes = []
+
+ localIncludes = []
+ localExcludes = []
+
+ for f in self.include:
+ if f.startswith("**/"):
+ if f.endswith("/**"):
+ midmatchIncludes.append(".*%s.*" %f[3:len(f) -3].replace('/', '.'))
+ else:
+ recursiveIncludes.append(f[3:])
+ else:
+ if f.endswith("/**"):
+ midmatchIncludes.append("%s.*" %f[0:len(f) -3].replace('/', '.'))
+ else:
+ localIncludes.append(f)
+
+ for f in self.exclude:
+ if f.startswith("**/"):
+ if f.endswith("/**"):
+ midmatchExcludes.append(".*%s.*" % f[3:len(f) -3].replace('/', '.'))
+ else:
+ recursiveExcludes.append(f[3:])
+ else:
+ if f.endswith("/**"):
+ midmatchExcludes.append("%s.*" %f[0:len(f) -3].replace('/', '.'))
+ else:
+ localExcludes.append(f)
+
+ logging.debug('localIncludes: ' + str(localIncludes))
+ logging.debug('localExcludes: ' + str(localExcludes))
+ logging.debug('recursiveIncludes: ' + str(recursiveIncludes))
+ logging.debug('recursiveExcludes: ' + str(recursiveExcludes))
+ logging.debug('midmatchIncludes: ' + str(midmatchIncludes))
+ logging.debug('midmatchExcludes: ' + str(midmatchExcludes))
+
+ fullListing = []
+ result = []
+ files = os.listdir(self.source)
+
+ for f in files:
+ fullpath = os.path.join(self.source, f);
+ if os.path.isdir(fullpath) and not os.path.islink(fullpath):
+ fullListing.extend(recursiveListing(fullpath))
+ continue
+
+ for p in localIncludes + recursiveIncludes:
+ if fnmatch.fnmatch(f, p):
+ found = False
+ for x in localExcludes + recursiveExcludes:
+ if fnmatch.fnmatch(f, x):
+ found = True
+ break
+ if not found: result.append(f)
+
+ inmatches = []
+ for p in recursiveIncludes:
+ inmatches.extend(fnmatch.filter(fullListing, p))
+
+ inSet = set(inmatches)
+
+ for p in midmatchIncludes:
+ r = re.compile(p)
+ inmatches = []
+ for f in fullListing(f):
+ rel = f[len(self.source):].strip('\\/')
+ if not r.match(rel) == None:
+ inmatches.append(f)
+ inSet = inSet.union(set(inmatches))
+
+ outmatches = []
+ for x in recursiveExcludes:
+ outmatches.extend(fnmatch.filter(fullListing, x))
+
+ outSet = set(outmatches)
+
+ for x in midmatchExcludes:
+ r = re.compile(x)
+ outmatches = []
+ for f in fullListing:
+ rel = f[len(self.source):].strip('\\/')
+ if not r.match(rel) == None:
+ outmatches.append(f)
+ outSet = outSet.union(set(outmatches))
+
+
+ #
+ # Using sets is the "easiest" way to do this. If Python"s set
+ # implementation is/gets buggy then this needs to be written
+ # "longhand".
+ #
+ diff = inSet - outSet
+ result.extend(list(diff))
+
+ for i in range(0, len(result)):
+ if result[i].startswith(self.source):
+ result[i] = result[i][len(self.source):].strip('\\/')
+
+ result.sort()
+ result.extend(self.explicit)
+
+ if fake:
+ for f in result:
+ print "Copying %s from %s to %s" % (f, self.source, self.dest)
+ return
+
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
+ logging.debug("Files to be copied:")
+ for f in result:
+ logging.debug(f)
+
+ #
+ # Scan filename to see if matches one of our designated
+ # 'convert to dos file format' name patterns. (These are
+ # regex patterns, not patterns for filename globbing).
+ #
+ textFiles = [".*README.*", ".*Makefile.mak", ".*LICENSE.*"]
textFileScanner = None
- expression = ""
- for p in textFiles:
- if expression != "":
- expression = expression + "|"
- expression = expression + p
- textFileScanner = re.compile(expression)
-
- for f in result:
- #
- # an f, prefix means flatten.
- #
- flatten = False
- current = f
-
- if f.startswith('f,'):
- flatten = True
- current = current[2:]
- current = current % defaults
-
- targetDirectory = self.dest
- targetFile = os.path.basename(current)
- if not flatten:
- targetDirectory = os.path.join(self.dest, os.path.dirname(current))
-
- if not os.path.exists(targetDirectory):
- os.makedirs(targetDirectory)
-
- s = os.path.join(self.source, current)
- d = os.path.join(targetDirectory, targetFile)
- try:
- if os.path.isdir(s):
- os.mkdir(d)
- else:
- shutil.copy2(s, d)
- isTextFile = (textFileScanner.search(d) != None)
- if isTextFile:
- # So how do I do the conversion.
- tmp = open(d + ".bak", "w")
- tmp.write(open(d, "rU").read())
- tmp.close()
- shutil.copy2(d + ".bak", d)
- os.remove(d + ".bak")
-
-
- except IOError, e:
- logging.info('Copying %s to %s failed: %s' % (s, d, str(e)))
- raise
+ expression = ""
+ for p in textFiles:
+ if expression != "":
+ expression = expression + "|"
+ expression = expression + p
+ textFileScanner = re.compile(expression)
+
+ for f in result:
+ #
+ # an f, prefix means flatten.
+ #
+ flatten = False
+ current = f
+
+ if f.startswith('f,'):
+ flatten = True
+ current = current[2:]
+ current = current % defaults
+
+ targetDirectory = self.dest
+ targetFile = os.path.basename(current)
+ if not flatten:
+ targetDirectory = os.path.join(self.dest, os.path.dirname(current))
+
+ if not os.path.exists(targetDirectory):
+ os.makedirs(targetDirectory)
+
+ s = os.path.join(self.source, current)
+ d = os.path.join(targetDirectory, targetFile)
+ try:
+ if os.path.isdir(s):
+ os.mkdir(d)
+ else:
+ shutil.copy2(s, d)
+ isTextFile = (textFileScanner.search(d) != None)
+ if isTextFile:
+ # So how do I do the conversion.
+ tmp = open(d + ".bak", "w")
+ tmp.write(open(d, "rU").read())
+ tmp.close()
+ shutil.copy2(d + ".bak", d)
+ os.remove(d + ".bak")
+
+
+ except IOError, e:
+ logging.info('Copying %s to %s failed: %s' % (s, d, str(e)))
+ raise
def stage(filename, componentdir, stageDirectory, group, defaults):
cfg = ConfigParser.SafeConfigParser()
cfg.read(filename)
if not cfg.has_section(group):
- raise StageFileError("Section %s is missing from component list file." % group)
+ raise StageFileError("Section %s is missing from component list file." % group)
sections = []
for entry in cfg.options(group):
- section = cfg.get(group, entry)
- if not cfg.has_section(section):
- raise StageFileError("Section %s is missing from component list file." % section)
- sections.append((entry, section))
+ section = cfg.get(group, entry)
+ if not cfg.has_section(section):
+ raise StageFileError("Section %s is missing from component list file." % section)
+ sections.append((entry, section))
for stageLoc, section in sections:
- try:
- currentBase = stageDirectory
- for f in stageLoc.split('-'):
- currentBase = os.path.join(currentBase, f)
-
- if not os.path.exists(currentBase):
- os.makedirs(currentBase)
-
- elementCount = cfg.getint(section, "elements")
- if elementCount < 0:
- raise StageFileError("Section %s elements field is negative value" % section)
-
- for i in range(1, elementCount + 1):
- try:
- if cfg.has_option(section, "targets"):
- target = cfg.get(section, "targets", False, defaults).strip()
-
- if "~" + defaults["target"] in target:
- continue
- elif not defaults["target"] in target:
- continue
-
- source = cfg.get(section, "source%d" % i, False, defaults)
- filelist = cfg.get(section, "filelist%d" % i, False, defaults)
- dest = cfg.get(section, "dest%d" % i, False, defaults)
- #
- # Most configurations won"t have file templates. These are usually only used so that file lists can
- # be reused but need to be slightly modified for each use case.
- #
- template = None
- mapping = None
- if cfg.has_option(section, "filetemplate%d" % i):
- #
- # We need to get the raw value!
- #
- template = cfg.get(section, "filetemplate%d" %i, True)
- mapping = defaults
-
- filename = os.path.join(componentdir, filelist)
- if not (os.path.exists(filename) and os.path.isfile(filename)):
- raise StageFileError("Component file %s does not exist or is not a file" % filename)
-
- componentFile = file(filename, "r")
- try:
- worker = FileSpecWorker(source, os.path.join(currentBase, dest))
- for line in componentFile:
- current = line.strip()
- if line.startswith('#'):
- continue
-
- if len(current) == 0:
- continue
- if not template == None:
- mapping['name'] = current
- try:
- computedName = template % mapping
- except:
- print "Mapping exception occurred with " + template + " and " + current
- raise
-
- logging.log(logging.DEBUG, 'Adding templatized name %s' % computedName)
- worker.add(computedName)
- else:
- try:
- worker.add(current % defaults)
- except Exception, e:
- print str(e) + ": occured while adding %s to worker in element %d in %s" % \
- (current, i, section)
-
- if worker == None:
- msg = "Component file %s is empty." % filename
- logging.warning(msg)
- else:
- #
- # XXX- fake is set to true while we are
- # debugging.
- #
- worker.execute(defaults, False)
-
- finally:
- componentFile.close()
-
- except ConfigParser.NoOptionError:
- raise StageFileError("Section %s has invalid value for element %d" % (section, i))
-
- except ConfigParser.NoOptionError:
- raise StageFileError("Section %s has invalid or missing elements field" % section)
+ try:
+ currentBase = stageDirectory
+ for f in stageLoc.split('-'):
+ currentBase = os.path.join(currentBase, f)
+
+ if not os.path.exists(currentBase):
+ os.makedirs(currentBase)
+
+ elementCount = cfg.getint(section, "elements")
+ if elementCount < 0:
+ raise StageFileError("Section %s elements field is negative value" % section)
+
+ for i in range(1, elementCount + 1):
+ try:
+ if cfg.has_option(section, "targets"):
+ target = cfg.get(section, "targets", False, defaults).strip()
+
+ if "~" + defaults["target"] in target:
+ continue
+ elif not defaults["target"] in target:
+ continue
+
+ source = cfg.get(section, "source%d" % i, False, defaults)
+ filelist = cfg.get(section, "filelist%d" % i, False, defaults)
+ dest = cfg.get(section, "dest%d" % i, False, defaults)
+ #
+ # Most configurations won"t have file templates. These are usually only used so that file lists can
+ # be reused but need to be slightly modified for each use case.
+ #
+ template = None
+ mapping = None
+ if cfg.has_option(section, "filetemplate%d" % i):
+ #
+ # We need to get the raw value!
+ #
+ template = cfg.get(section, "filetemplate%d" %i, True)
+ mapping = defaults
+
+ filename = os.path.join(componentdir, filelist)
+ if not (os.path.exists(filename) and os.path.isfile(filename)):
+ raise StageFileError("Component file %s does not exist or is not a file" % filename)
+
+ componentFile = file(filename, "r")
+ try:
+ worker = FileSpecWorker(source, os.path.join(currentBase, dest))
+ for line in componentFile:
+ current = line.strip()
+ if line.startswith('#'):
+ continue
+
+ if len(current) == 0:
+ continue
+ if not template == None:
+ mapping['name'] = current
+ try:
+ computedName = template % mapping
+ except:
+ print "Mapping exception occurred with " + template + " and " + current
+ raise
+
+ logging.log(logging.DEBUG, 'Adding templatized name %s' % computedName)
+ worker.add(computedName)
+ else:
+ try:
+ worker.add(current % defaults)
+ except Exception, e:
+ print str(e) + ": occured while adding %s to worker in element %d in %s" % \
+ (current, i, section)
+
+ if worker == None:
+ msg = "Component file %s is empty." % filename
+ logging.warning(msg)
+ else:
+ #
+ # XXX- fake is set to true while we are
+ # debugging.
+ #
+ worker.execute(defaults, False)
+
+ finally:
+ componentFile.close()
+
+ except ConfigParser.NoOptionError:
+ raise StageFileError("Section %s has invalid value for element %d" % (section, i))
+
+ except ConfigParser.NoOptionError:
+ raise StageFileError("Section %s has invalid or missing elements field" % section)
if __name__ == "__main__":
print 'components'
diff --git a/cpp/install/common/makewindist.py b/cpp/install/common/makewindist.py
index c37757baa7d..b711d68d45d 100755
--- a/cpp/install/common/makewindist.py
+++ b/cpp/install/common/makewindist.py
@@ -23,21 +23,21 @@ ExpatVer = '2.0.0'
DBVer = '4.5.20'
DistPrefixes = ["Ice-%s", "IceJ-%s-java2", "IceJ-%s-java5", "IceCS-%s", "IcePy-%s", "IcePHP-%s", "IceVB-%s",
- "IceRuby-%s"]
+ "IceRuby-%s"]
class DistEnvironmentError:
def __init__(self, msg = None):
- self.msg = msg
+ self.msg = msg
def __str__(self):
- return repr(self.msg)
+ return repr(self.msg)
class ExtProgramError:
def __init__(self, msg):
- self.msg = msg
+ self.msg = msg
def __str__(self):
- return repr(self.msg)
+ return repr(self.msg)
def prependEnvPath(name, path):
"""Prepend a path to an existing environment variable."""
@@ -47,17 +47,17 @@ def prependEnvPath(name, path):
def prependEnvPathList(name, list):
"""Prepend a list of paths to an existing environment variable."""
for path in list:
- prependEnvPath(name, path)
+ prependEnvPath(name, path)
def runprog(command, haltOnError = True):
logging.debug('Running external command: %s' % command)
result = os.system(command)
if not result == 0:
- msg = 'Command %s failed with error code %d' % (command, result)
- if haltOnError:
- raise ExtProgramError('Command %s failed with error code %d' % (command, result))
- else:
- logging.error(msg)
+ msg = 'Command %s failed with error code %d' % (command, result)
+ if haltOnError:
+ raise ExtProgramError('Command %s failed with error code %d' % (command, result))
+ else:
+ logging.error(msg)
def usage():
"""Print usage/help information"""
@@ -68,57 +68,57 @@ def usage():
print " --skip-build Do not build any sources."
print " --clean Clean compiled or staged files."
print " --skip-installer Do not build any installers or merge modules."
- print "-i, --info Log information messages"
- print "-d, --debug Log debug messages"
- print "-l, --logfile Specify the destination log file"
+ print "-i, --info Log information messages"
+ print "-d, --debug Log debug messages"
+ print "-l, --logfile Specify the destination log file"
def environmentCheck(target):
"""Warning: uses global environment."""
required = ["SOURCES", "BUILD_DIR", "DB_HOME", "BZIP2_HOME", "EXPAT_HOME", "OPENSSL_HOME"]
if target == "vc60":
- required.append("STLPORT_HOME")
+ required.append("STLPORT_HOME")
elif target == "vc80":
- required.extend(["PHP_BIN_HOME", "PHP_SRC_HOME", "PYTHON_HOME"])
+ required.extend(["PHP_BIN_HOME", "PHP_SRC_HOME", "PYTHON_HOME"])
fail = False
for f in required:
- if not os.environ.has_key(f):
- logging.error("Environment variable %s is missing" % f)
- fail = True
- continue
+ if not os.environ.has_key(f):
+ logging.error("Environment variable %s is missing" % f)
+ fail = True
+ continue
- if not os.path.isdir(os.environ[f]):
- logging.error("Value %s for env var %s is not a valid directory." % (os.environ[f], f))
- fail = True
- continue
+ if not os.path.isdir(os.environ[f]):
+ logging.error("Value %s for env var %s is not a valid directory." % (os.environ[f], f))
+ fail = True
+ continue
if fail:
- logging.error("Invalid environment. Please consult error log and repair environment/command line settings.")
- sys.exit(2)
+ logging.error("Invalid environment. Please consult error log and repair environment/command line settings.")
+ sys.exit(2)
def maxVersion(a, b):
"""Compares to version strings. The version strings should be trimmed of leading and trailing whitespace."""
if a == b:
- return a
+ return a
avalues = a.split('.')
bvalues = b.split('.')
diff = len(avalues) - len(bvalues)
if not diff == 0:
- if diff < 0:
- for f in range(0, abs(diff)):
- avalues.append('0')
- else:
- for f in range(0, abs(diff)):
- bvalues.append('0')
+ if diff < 0:
+ for f in range(0, abs(diff)):
+ avalues.append('0')
+ else:
+ for f in range(0, abs(diff)):
+ bvalues.append('0')
for i in range(0, len(avalues)):
- if int(avalues[i]) > int(bvalues[i]):
- return a
- elif int(avalues[i]) < int(bvalues[i]):
- return b
+ if int(avalues[i]) > int(bvalues[i]):
+ return a
+ elif int(avalues[i]) < int(bvalues[i]):
+ return b
return a
@@ -127,10 +127,10 @@ def testMaxVersion():
cases = [ ("1.0", "1.0.0", "1.0"), ("0.0", "0.1", "0.1"), ("2.1.0", "2.0.1", "2.1.0"),
("2.1", "2.0.1", "2.1"), ("2.1.9", "2.1.12", "2.1.12")]
for a, b, expected in cases:
- result = maxVersion(a, b)
- if not expected == result:
- print "Expected %s from %s and %s, got %s" % (expected, a, b, result)
- assert(False)
+ result = maxVersion(a, b)
+ if not expected == result:
+ print "Expected %s from %s and %s, got %s" % (expected, a, b, result)
+ assert(False)
print "testMaxVersion() succeeded"
def checkSources(sourceDir):
@@ -138,29 +138,29 @@ def checkSources(sourceDir):
icezip = glob.glob(os.path.join(sourceDir, "Ice-*.zip"))
if len(icezip) == 0:
- msg = "Source directory %s does not contain a zip archive for any version of Ice for C++" % sourceDir
- logging.error(msg)
- raise DistEnvironmentError(msg)
+ msg = "Source directory %s does not contain a zip archive for any version of Ice for C++" % sourceDir
+ logging.error(msg)
+ raise DistEnvironmentError(msg)
keyVersion = '0.0.0'
exp = re.compile("Ice-([0-9.]*).*.zip")
current = None
for d in icezip:
- m = exp.match(os.path.split(d)[1])
- if m == None:
- print icezip
- current = m.group(1)
- keyVersion = maxVersion(keyVersion, current)
+ m = exp.match(os.path.split(d)[1])
+ if m == None:
+ print icezip
+ current = m.group(1)
+ keyVersion = maxVersion(keyVersion, current)
print keyVersion
prefixes = list(DistPrefixes)
prefixes.remove("Ice-%s")
for prefix in prefixes:
- pkg = prefix % keyVersion + ".zip"
- if not os.path.exists(os.path.join(sourceDir, pkg)):
- msg = "Source directory %s does not contain archive for %s." % (sourceDir, pkg)
- logging.error(msg)
- raise DistEnvironmentError(msg)
+ pkg = prefix % keyVersion + ".zip"
+ if not os.path.exists(os.path.join(sourceDir, pkg)):
+ msg = "Source directory %s does not contain archive for %s." % (sourceDir, pkg)
+ logging.error(msg)
+ raise DistEnvironmentError(msg)
return keyVersion
@@ -168,14 +168,14 @@ def setMakefileOption(filename, optionName, value):
optre = re.compile("^\#?\s*?%s\s*?=.*" % optionName)
optionString = "no"
if value:
- optionString = "yes"
+ optionString = "yes"
f = fileinput.input(filename, True)
for line in f:
- l = line.rstrip('\n')
- if optre.search(l):
+ l = line.rstrip('\n')
+ if optre.search(l):
print "%s = %s" % (optionName, optionString)
- else:
- print l
+ else:
+ print l
f.close()
def setOptimize(filename, optimizeOn):
@@ -192,35 +192,35 @@ def buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion):
# building Ice for C++.
#
path = [
- os.path.join(stageDir, "berkeley", "dev", "bin"),
- os.path.join(stageDir, "berkeley", "runtime", "bin"),
- os.path.join(stageDir, "berkeley", "java", "bin"),
- os.path.join(stageDir, "expat", "runtime", "bin"),
- os.path.join(stageDir, "openssl", "runtime", "bin")
+ os.path.join(stageDir, "berkeley", "dev", "bin"),
+ os.path.join(stageDir, "berkeley", "runtime", "bin"),
+ os.path.join(stageDir, "berkeley", "java", "bin"),
+ os.path.join(stageDir, "expat", "runtime", "bin"),
+ os.path.join(stageDir, "openssl", "runtime", "bin")
]
if installVersion == "vc60":
- path.append(os.path.join(stageDir, "stlport", "dev", "bin"))
- path.append(os.path.join(stageDir, "stlport", "runtime", "bin"))
+ path.append(os.path.join(stageDir, "stlport", "dev", "bin"))
+ path.append(os.path.join(stageDir, "stlport", "runtime", "bin"))
prependEnvPathList('PATH', path)
lib = [
- os.path.join(stageDir, "berkeley", "dev", "lib"),
- os.path.join(stageDir, "bzip2", "dev", "lib"),
- os.path.join(stageDir, "expat", "dev", "lib"),
- os.path.join(stageDir, "openssl", "dev", "lib"),
+ os.path.join(stageDir, "berkeley", "dev", "lib"),
+ os.path.join(stageDir, "bzip2", "dev", "lib"),
+ os.path.join(stageDir, "expat", "dev", "lib"),
+ os.path.join(stageDir, "openssl", "dev", "lib"),
]
if installVersion == "vc60":
- lib.append(os.path.join(stageDir, "stlport", "dev", "lib"))
+ lib.append(os.path.join(stageDir, "stlport", "dev", "lib"))
prependEnvPathList('LIB', lib)
include = [
- os.path.join(stageDir, "berkeley", "dev", "include"),
- os.path.join(stageDir, "bzip2", "dev", "include"),
- os.path.join(stageDir, "expat", "dev", "include"),
- os.path.join(stageDir, "openssl", "dev", "include"),
+ os.path.join(stageDir, "berkeley", "dev", "include"),
+ os.path.join(stageDir, "bzip2", "dev", "include"),
+ os.path.join(stageDir, "expat", "dev", "include"),
+ os.path.join(stageDir, "openssl", "dev", "include"),
]
if installVersion == "vc60":
- include.append(os.path.join(stageDir, "stlport", "dev", "include", "stlport"))
+ include.append(os.path.join(stageDir, "stlport", "dev", "include", "stlport"))
prependEnvPathList('INCLUDE', include)
#
@@ -244,60 +244,60 @@ def buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion):
runprog("nmake /f Makefile.mak")
if installVersion in ["vc80"]:
- #
- # Ice for C#
- #
- os.chdir(os.path.join(sourcesDir, "debug", "IceCS-" + sourcesVersion))
- print "Building in " + os.getcwd() + "..."
+ #
+ # Ice for C#
+ #
+ os.chdir(os.path.join(sourcesDir, "debug", "IceCS-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), False)
setDebug(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- runprog("nmake /f Makefile.mak")
+ runprog("nmake /f Makefile.mak")
- #
- # Ice for Visual Basic
- #
- os.chdir(os.path.join(sourcesDir, "debug", "IceVB-" + sourcesVersion))
- print "Building in " + os.getcwd() + "..."
+ #
+ # Ice for Visual Basic
+ #
+ os.chdir(os.path.join(sourcesDir, "debug", "IceVB-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), False)
- f = fileinput.input(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- for l in f:
- i = l.find("icecs")
- if i <> -1:
- print l.rstrip('\n').replace("icecs", "IceCS-%s" % sourcesVersion)
- else:
- print l.rstrip('\n')
-
- f.close()
-
- runprog("nmake /f Makefile.mak")
-
- #
- # Ice for C#
- #
- os.chdir(os.path.join(sourcesDir, "release", "IceCS-" + sourcesVersion))
- print "Building in " + os.getcwd() + "..."
+ f = fileinput.input(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
+ for l in f:
+ i = l.find("icecs")
+ if i <> -1:
+ print l.rstrip('\n').replace("icecs", "IceCS-%s" % sourcesVersion)
+ else:
+ print l.rstrip('\n')
+
+ f.close()
+
+ runprog("nmake /f Makefile.mak")
+
+ #
+ # Ice for C#
+ #
+ os.chdir(os.path.join(sourcesDir, "release", "IceCS-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
setDebug(os.path.join(os.getcwd(), "config", "Make.rules.mak"), False)
- runprog("nmake /f Makefile.mak")
+ runprog("nmake /f Makefile.mak")
- #
- # Ice for Visual Basic
- #
- os.chdir(os.path.join(sourcesDir, "release", "IceVB-" + sourcesVersion))
- print "Building in " + os.getcwd() + "..."
+ #
+ # Ice for Visual Basic
+ #
+ os.chdir(os.path.join(sourcesDir, "release", "IceVB-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- f = fileinput.input(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- for l in f:
- i = l.find("icecs")
- if i <> -1:
- print l.rstrip('\n').replace("icecs", "IceCS-%s" % sourcesVersion)
- else:
- print l.rstrip('\n')
+ f = fileinput.input(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
+ for l in f:
+ i = l.find("icecs")
+ if i <> -1:
+ print l.rstrip('\n').replace("icecs", "IceCS-%s" % sourcesVersion)
+ else:
+ print l.rstrip('\n')
- f.close()
+ f.close()
- runprog("nmake /f Makefile.mak")
+ runprog("nmake /f Makefile.mak")
#
@@ -318,61 +318,61 @@ def buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion):
runprog("nmake /f Makefile.mak")
if installVersion == "vc71":
- #
- # Ice for Python
- #
- pythonHome = os.environ['PYTHON_HOME']
- prependEnvPath('LIB', os.path.join(pythonHome, "libs"))
- prependEnvPath('INCLUDE', os.path.join(pythonHome, "include"))
-
- os.chdir(os.path.join(sourcesDir, "release", "IcePy-" + sourcesVersion))
- print "Building in " + os.getcwd() + "..."
+ #
+ # Ice for Python
+ #
+ pythonHome = os.environ['PYTHON_HOME']
+ prependEnvPath('LIB', os.path.join(pythonHome, "libs"))
+ prependEnvPath('INCLUDE', os.path.join(pythonHome, "include"))
+
+ os.chdir(os.path.join(sourcesDir, "release", "IcePy-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- runprog("nmake /f Makefile.mak")
+ runprog("nmake /f Makefile.mak")
if installVersion == "vc60":
- #
- # Ice for C++
- #
- os.chdir(os.path.join(sourcesDir, "release", "Ice-" + sourcesVersion))
+ #
+ # Ice for C++
+ #
+ os.chdir(os.path.join(sourcesDir, "release", "Ice-" + sourcesVersion))
setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- print "Building in " + os.getcwd() + "..."
- runprog("nmake /f Makefile.mak")
- #
- # Ice for PHP
- #
- phpBinHome = os.environ['PHP_BIN_HOME']
- phpLib = [
- os.path.join(phpBinHome, "lib"),
- os.path.join(phpBinHome, "dev")
- ]
- prependEnvPathList('LIB', phpLib)
-
- phpSrcHome = os.environ['PHP_SRC_HOME']
- phpInc = [
- phpSrcHome,
- os.path.join(phpSrcHome, "main"),
- os.path.join(phpSrcHome, "Zend"),
- os.path.join(phpSrcHome, "TSRM")
- ]
- prependEnvPathList('INCLUDE', phpInc)
-
- os.chdir(os.path.join(sourcesDir, "release", "IcePHP-" + sourcesVersion))
- print "Building in " + os.getcwd() + "..."
+ print "Building in " + os.getcwd() + "..."
+ runprog("nmake /f Makefile.mak")
+ #
+ # Ice for PHP
+ #
+ phpBinHome = os.environ['PHP_BIN_HOME']
+ phpLib = [
+ os.path.join(phpBinHome, "lib"),
+ os.path.join(phpBinHome, "dev")
+ ]
+ prependEnvPathList('LIB', phpLib)
+
+ phpSrcHome = os.environ['PHP_SRC_HOME']
+ phpInc = [
+ phpSrcHome,
+ os.path.join(phpSrcHome, "main"),
+ os.path.join(phpSrcHome, "Zend"),
+ os.path.join(phpSrcHome, "TSRM")
+ ]
+ prependEnvPathList('INCLUDE', phpInc)
+
+ os.chdir(os.path.join(sourcesDir, "release", "IcePHP-" + sourcesVersion))
+ print "Building in " + os.getcwd() + "..."
setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- runprog("nmake /f Makefile.mak")
- os.chdir(os.path.join(sourcesDir, "release", "IceRuby-%s" % sourcesVersion))
- setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
- print "Building in " + os.getcwd() + "..."
- runprog("nmake /f Makefile.mak")
+ runprog("nmake /f Makefile.mak")
+ os.chdir(os.path.join(sourcesDir, "release", "IceRuby-%s" % sourcesVersion))
+ setOptimize(os.path.join(os.getcwd(), "config", "Make.rules.mak"), True)
+ print "Building in " + os.getcwd() + "..."
+ runprog("nmake /f Makefile.mak")
def list2english(l):
if len(l) == 1:
- return l[0]
+ return l[0]
elif len(l) == 2:
- return l[0] + " and " + list2english(l[1:])
+ return l[0] + " and " + list2english(l[1:])
else:
- return l[0] + ", " + list2english(l[1:])
+ return l[0] + ", " + list2english(l[1:])
def convertLicensesToRTF(toolDir, installTarget):
openssl = (os.path.join(os.environ["OPENSSL_HOME"], "LICENSE"), "OpenSSL", "OPENSSL_LICENSE.rtf")
@@ -392,15 +392,15 @@ def convertLicensesToRTF(toolDir, installTarget):
collection = core
jgoodies =[(os.path.join(os.environ["JGOODIES_FORMS"], "license.txt"), "JGoodies Forms",
- "JGOODIES_FORMS_LICENSE.rtf"),
- (os.path.join(os.environ["JGOODIES_LOOKS"], "license.txt"), "JGoodies Looks",
- "JGOODIES_LOOKS_LICENSE.rtf")]
+ "JGOODIES_FORMS_LICENSE.rtf"),
+ (os.path.join(os.environ["JGOODIES_LOOKS"], "license.txt"), "JGoodies Looks",
+ "JGOODIES_LOOKS_LICENSE.rtf")]
if installTarget == "vc60":
- collection.append((os.path.join(os.environ["STLPORT_HOME"], "doc", "license.html"),
- "STLport", "STLPORT_LICENSE.rtf"))
- collection.extend(jgoodies)
+ collection.append((os.path.join(os.environ["STLPORT_HOME"], "doc", "license.html"),
+ "STLport", "STLPORT_LICENSE.rtf"))
+ collection.extend(jgoodies)
elif installTarget in ["vc71", "vc80", "vc80_x64"]:
- collection.extend(jgoodies)
+ collection.extend(jgoodies)
third_party_sources_file_hdr = """Source Code
-----------
@@ -408,12 +408,12 @@ def convertLicensesToRTF(toolDir, installTarget):
"""
if not os.path.exists(os.path.join(toolDir, "docs")):
- os.mkdir(os.path.join(toolDir, "docs"))
+ os.mkdir(os.path.join(toolDir, "docs"))
if not os.path.exists(os.path.join(toolDir, "docs", installTarget)):
- os.mkdir(os.path.join(toolDir, "docs", installTarget))
+ os.mkdir(os.path.join(toolDir, "docs", installTarget))
names = []
for e in collection:
- names.append(e[1])
+ names.append(e[1])
text = "The source distributions of " + list2english(names)
text = text + " used to build this distribution can be downloaded at no cost from http://www.zeroc.com/download.html."
@@ -432,41 +432,41 @@ def convertLicensesToRTF(toolDir, installTarget):
# SOURCES is used by the third party installer.
#
shutil.copy(os.path.join(toolDir, "docs", installTarget, "THIRD_PARTY_SOURCES"),
- os.path.join(toolDir, "docs", installTarget, "SOURCES"))
+ os.path.join(toolDir, "docs", installTarget, "SOURCES"))
licensefile = file(os.path.join(toolDir, "docs", installTarget, "LICENSE"), "w")
for f in collection:
- contents = None
- if f[0].endswith(".html"):
- #
- # Here's me wishing the Python standard library had a class
- # for converting HTML to plain text. In the meantime, we'll
- # have to leverage 'links' in cygwin.
- #
- pipe_stdin, pipe_stdout = os.popen2("cygpath %s" % f[0])
- lines = pipe_stdout.readlines()
- pipe_stdin.close()
- pipe_stdout.close()
- cygname = lines[0].strip()
- pipe_stdin, pipe_stdout = os.popen2("links -dump %s" % cygname)
- lines = pipe_stdout.readlines()
- contents = lines[2:]
- else:
- contents = file(f[0]).readlines()
- hdr = section_header % f[1]
-
- licensefile.write(hdr)
- licensefile.write(line_string[:len(hdr)] + "\n\n")
- licensefile.writelines(contents)
- licensefile.write("\n\n")
- rtffile = file(os.path.join(toolDir, "docs", installTarget, os.path.basename(f[2])), "w")
- rtffile.writelines(rtfhdr)
- rtffile.write(hdr + "\\par")
- rtffile.write(line_string[:len(hdr)] + "\\par\n")
- for l in contents:
- rtffile.write(l.rstrip("\n") + "\\par\n")
- rtffile.writelines(rtfftr)
- rtffile.close()
+ contents = None
+ if f[0].endswith(".html"):
+ #
+ # Here's me wishing the Python standard library had a class
+ # for converting HTML to plain text. In the meantime, we'll
+ # have to leverage 'links' in cygwin.
+ #
+ pipe_stdin, pipe_stdout = os.popen2("cygpath %s" % f[0])
+ lines = pipe_stdout.readlines()
+ pipe_stdin.close()
+ pipe_stdout.close()
+ cygname = lines[0].strip()
+ pipe_stdin, pipe_stdout = os.popen2("links -dump %s" % cygname)
+ lines = pipe_stdout.readlines()
+ contents = lines[2:]
+ else:
+ contents = file(f[0]).readlines()
+ hdr = section_header % f[1]
+
+ licensefile.write(hdr)
+ licensefile.write(line_string[:len(hdr)] + "\n\n")
+ licensefile.writelines(contents)
+ licensefile.write("\n\n")
+ rtffile = file(os.path.join(toolDir, "docs", installTarget, os.path.basename(f[2])), "w")
+ rtffile.writelines(rtfhdr)
+ rtffile.write(hdr + "\\par")
+ rtffile.write(line_string[:len(hdr)] + "\\par\n")
+ for l in contents:
+ rtffile.write(l.rstrip("\n") + "\\par\n")
+ rtffile.writelines(rtfftr)
+ rtffile.close()
#
# Technically, the JGoodies stuff isn't part of the Ice 6.0.0 target
@@ -474,58 +474,58 @@ def convertLicensesToRTF(toolDir, installTarget):
# IceJ builders.
#
if installTarget == "vc60":
- for f in jgoodies:
- contents = file(f[0]).readlines()
- hdr = section_header % f[1]
- rtffile = file(os.path.join(toolDir, "docs", installTarget, os.path.basename(f[2])), "w")
- rtffile.writelines(rtfhdr)
- rtffile.write(hdr + "\\par")
- rtffile.write(line_string[:len(hdr)] + "\\par\n")
- for l in contents:
- rtffile.write(l.rstrip("\n") + "\\par\n")
- rtffile.writelines(rtfftr)
- rtffile.close()
+ for f in jgoodies:
+ contents = file(f[0]).readlines()
+ hdr = section_header % f[1]
+ rtffile = file(os.path.join(toolDir, "docs", installTarget, os.path.basename(f[2])), "w")
+ rtffile.writelines(rtfhdr)
+ rtffile.write(hdr + "\\par")
+ rtffile.write(line_string[:len(hdr)] + "\\par\n")
+ for l in contents:
+ rtffile.write(l.rstrip("\n") + "\\par\n")
+ rtffile.writelines(rtfftr)
+ rtffile.close()
licensefile.close()
shutil.copyfile(os.path.join(toolDir, "docs", installTarget, "LICENSE"), \
- os.path.join(toolDir, "docs", installTarget, "THIRD_PARTY_LICENSE"))
+ os.path.join(toolDir, "docs", installTarget, "THIRD_PARTY_LICENSE"))
lines = file(os.path.join(toolDir, "docs", installTarget, "LICENSE")).readlines()
rtflicense = file(os.path.join(toolDir, "docs", installTarget, "LICENSE.rtf"), "w")
rtflicense.writelines(rtfhdr)
for l in lines:
- rtflicense.write(l.rstrip("\n") + "\\par\n")
+ rtflicense.write(l.rstrip("\n") + "\\par\n")
rtflicense.writelines(rtfftr)
rtflicense.close()
def buildMergeModules(startDir, stageDir, sourcesVersion, installVersion):
"""Build third party merge modules."""
modules = [
- ("BerkeleyDBDevKit", "BERKELEYDB_DEV_KIT"),
- ("BerkeleyDBRuntime", "BERKELEYDB_RUNTIME"),
- ("BZip2DevKit", "BZIP2_DEV_KIT"),
- ("BZip2Runtime", "BZIP2_RUNTIME"),
- ("ExpatDevKit", "EXPAT_DEV_KIT"),
- ("ExpatRuntime", "EXPAT_RUNTIME"),
- ("OpenSSLDevKit", "OPENSSL_DEV_KIT"),
- ("OpenSSLRuntime", "OPENSSL_RUNTIME"),
- ("JGoodies", "JGOODIES_RUNTIME"),
- ("BerkeleyDBJava", "BERKELEYDB_JAVA")
+ ("BerkeleyDBDevKit", "BERKELEYDB_DEV_KIT"),
+ ("BerkeleyDBRuntime", "BERKELEYDB_RUNTIME"),
+ ("BZip2DevKit", "BZIP2_DEV_KIT"),
+ ("BZip2Runtime", "BZIP2_RUNTIME"),
+ ("ExpatDevKit", "EXPAT_DEV_KIT"),
+ ("ExpatRuntime", "EXPAT_RUNTIME"),
+ ("OpenSSLDevKit", "OPENSSL_DEV_KIT"),
+ ("OpenSSLRuntime", "OPENSSL_RUNTIME"),
+ ("JGoodies", "JGOODIES_RUNTIME"),
+ ("BerkeleyDBJava", "BERKELEYDB_JAVA")
]
if installVersion == "vc60":
- extras = [ ("STLPortDevKit", "STLPORT_DEV_KIT"), ("STLPortRuntime", "STLPORT_RUNTIME") ]
- modules.extend(extras)
+ extras = [ ("STLPortDevKit", "STLPORT_DEV_KIT"), ("STLPortRuntime", "STLPORT_RUNTIME") ]
+ modules.extend(extras)
#
# Build modules.
#
os.chdir(startDir)
for project, release in modules:
- #
- # The -w -x flags indicate that the build should stop on any
- # warning or error. This is preferable since it catches staging
- # errors and forces us to keep our projects clean.
- #
- runprog(os.environ['INSTALLSHIELD_HOME'] + "\IsCmdBld -x -w -c COMP -a ZEROC -p " + project + ".ism -r " + release)
+ #
+ # The -w -x flags indicate that the build should stop on any
+ # warning or error. This is preferable since it catches staging
+ # errors and forces us to keep our projects clean.
+ #
+ runprog(os.environ['INSTALLSHIELD_HOME'] + "\IsCmdBld -x -w -c COMP -a ZEROC -p " + project + ".ism -r " + release)
#
# Archive modules in the stage directory root.
@@ -539,38 +539,38 @@ def buildMergeModules(startDir, stageDir, sourcesVersion, installVersion):
zipPath = "ThirdPartyMergeModules-" + sourcesVersion + "-" + installVersion.upper() + ".zip"
zip = zipfile.ZipFile(os.path.join(stageDir, zipPath), 'w')
for project, release in modules:
- msm = project + "." + installVersion.upper() + ".msm"
- msmPath = os.path.join(os.getcwd(), project, "ZEROC", release, "DiskImages/DISK1", msm)
- zip.write(msmPath, os.path.basename(msmPath))
+ msm = project + "." + installVersion.upper() + ".msm"
+ msmPath = os.path.join(os.getcwd(), project, "ZEROC", release, "DiskImages/DISK1", msm)
+ zip.write(msmPath, os.path.basename(msmPath))
zip.close()
def buildInstallers(startDir, stageDir, sourcesVersion, installVersion, installers):
if installVersion == "vc80_x64":
- installVersion = "VC80-x64"
+ installVersion = "VC80-x64"
else:
- installVersion = installVersion.upper()
+ installVersion = installVersion.upper()
#
# Build and copy to the stage directory root.
#
os.chdir(startDir)
for project, release in installers:
- runprog(os.environ['INSTALLSHIELD_HOME'] + "\ISCmdBld -x -w -c COMP -a ZEROC -p " + project + ".ism -r " + release)
- msi = project + "-" + sourcesVersion + "-" + installVersion + ".msi"
- msiPath = os.path.join(os.getcwd(), project, "ZEROC", release, "DiskImages/DISK1", msi)
- shutil.copy(msiPath, stageDir)
+ runprog(os.environ['INSTALLSHIELD_HOME'] + "\ISCmdBld -x -w -c COMP -a ZEROC -p " + project + ".ism -r " + release)
+ msi = project + "-" + sourcesVersion + "-" + installVersion + ".msi"
+ msiPath = os.path.join(os.getcwd(), project, "ZEROC", release, "DiskImages/DISK1", msi)
+ shutil.copy(msiPath, stageDir)
def environToString(tbl):
'''Convert an environment hashtable to the typical k=v format'''
ofile = cStringIO.StringIO()
result = ''
try:
- for k, v in tbl.iteritems():
- ofile.write('%s=%s\n' % (k, v))
- result = ofile.getvalue()
- finally:
- ofile.close()
+ for k, v in tbl.iteritems():
+ ofile.write('%s=%s\n' % (k, v))
+ result = ofile.getvalue()
+ finally:
+ ofile.close()
return result
def main():
@@ -590,207 +590,207 @@ def main():
os.environ['INSTALL_TOOLS'] = installDir
try:
- #
- # Process args.
- #
- try:
- optionList, args = getopt.getopt(
- sys.argv[1:], "dhil:", [ "help", "clean", "skip-build", "skip-installer", "info", "debug",
- "logfile", "vc60", "vc71", "vc80", "vc80_x64", "sslhome=", "expathome=", "dbhome=", "stlporthome=",
- "bzip2home=", "thirdparty="])
- except getopt.GetoptError:
- usage()
- sys.exit(2)
-
- #
- # Set a few defaults.
- #
- clean = False
- build = True
- installer = True
- debugLevel = logging.NOTSET
- logFile = None
- target = None
-
- for o, a in optionList:
- if o in ("-h", "--help"):
- usage()
- sys.exit()
- elif o == "--clean":
- clean = True
- elif o == "--skip-build":
- build = False
- elif o == "--skip-installer":
- installer = False
- elif o in ('-l', '--logfile'):
- logFile = a
- elif o in ('-d', '--debug'):
- debugLevel = logging.DEBUG
- elif o in ('-', '--info'):
- debugLevel = logging.INFO
- elif o == '--vc60':
- target = 'vc60'
- elif o == '--vc71':
- target = 'vc71'
- elif o == '--vc80':
- target = 'vc80'
- elif o == '--vc80_x64':
- target = 'vc80_x64'
- elif o == '--sources':
- os.environ['SOURCES'] = a
- elif o == '--buildDir':
- os.environ['BUILD_DIR'] = a
- elif o == '--sslhome':
- os.environ['OPENSSL_HOME'] = a
- elif o == '--expathome':
- os.environ['EXPAT_HOME'] = a
- elif o == '--dbhome':
- os.environ['DB_HOME'] = a
- elif o == '--stlporthome':
- os.environ['STLPORT_HOME'] = a
- elif o == '--bzip2home':
- os.environ['BZIP2_HOME'] = a
- elif o == '--thirdparty':
- os.environ['OPENSSL_HOME'] = os.path.join(a, 'openssl-%s' % OpenSSLVer)
- os.environ['BZIP2_HOME'] = os.path.join(a, 'bzip2-%s' % Bzip2Ver)
- os.environ['EXPAT_HOME'] = os.path.join(a, 'expat-%s' % ExpatVer)
- os.environ['DB_HOME'] = os.path.join(a, 'db-%s' % DBVer)
- os.environ['STLPORT_HOME'] = os.path.join(a, 'STLPort-%s' % STLPortVer)
-
- if debugLevel != logging.NOTSET:
- if a != None:
- logging.basicConfig(level = debugLevel, format='%(asctime)s %(levelname)s %(message)s', filename = a)
- else:
- logging.basicConfig(level = debugLevel, format='%(asctime)s %(levelname)s %(message)s')
-
- if target == None:
- print 'The development target must be specified'
- sys.exit(2)
-
- os.environ['target'] = target
-
- #
- # Where all the files will be staged so that the install projects
- # can find them.
- #
- targetDir = os.path.join(installDir, target)
- stageDir = os.path.join(targetDir, "install")
-
- logging.info("Install Tool: " + installDir)
- logging.info("Target Directory: " + targetDir)
- logging.info("Stage Directory: " + stageDir)
-
- if clean:
- print('You have indicated you want to ''clean'' files, starting from scratch.')
- confirm = ''
- while not confirm in ['y', 'n']:
- confirm = raw_input('Are you sure? [y/N]')
- if confirm == '':
- confirm = 'n'
- if confirm == 'n':
- sys.exit()
- else:
- logging.info('Deleting intermediate files and rebuilding from scratch!')
-
- logging.info('Starting windows installer creation.')
-
- environmentCheck(target)
-
- buildDir = os.environ['BUILD_DIR']
-
- logging.debug(environToString(os.environ))
-
- sourcesVersion = checkSources(os.environ['SOURCES'])
-
- defaults = os.environ
- defaults['dbver'] = '45'
- defaults['version'] = sourcesVersion
- defaults['dllversion'] = sourcesVersion.replace('.', '')[:2]
-
- if target == "vc80_x64":
- defaults['OutDir'] = "x64/"
- else:
- defaults['OutDir'] = ''
-
- if os.path.exists(stageDir):
- try:
- shutil.rmtree(stageDir)
- except IOError:
- print """
+ #
+ # Process args.
+ #
+ try:
+ optionList, args = getopt.getopt(
+ sys.argv[1:], "dhil:", [ "help", "clean", "skip-build", "skip-installer", "info", "debug",
+ "logfile", "vc60", "vc71", "vc80", "vc80_x64", "sslhome=", "expathome=", "dbhome=", "stlporthome=",
+ "bzip2home=", "thirdparty="])
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
+
+ #
+ # Set a few defaults.
+ #
+ clean = False
+ build = True
+ installer = True
+ debugLevel = logging.NOTSET
+ logFile = None
+ target = None
+
+ for o, a in optionList:
+ if o in ("-h", "--help"):
+ usage()
+ sys.exit()
+ elif o == "--clean":
+ clean = True
+ elif o == "--skip-build":
+ build = False
+ elif o == "--skip-installer":
+ installer = False
+ elif o in ('-l', '--logfile'):
+ logFile = a
+ elif o in ('-d', '--debug'):
+ debugLevel = logging.DEBUG
+ elif o in ('-', '--info'):
+ debugLevel = logging.INFO
+ elif o == '--vc60':
+ target = 'vc60'
+ elif o == '--vc71':
+ target = 'vc71'
+ elif o == '--vc80':
+ target = 'vc80'
+ elif o == '--vc80_x64':
+ target = 'vc80_x64'
+ elif o == '--sources':
+ os.environ['SOURCES'] = a
+ elif o == '--buildDir':
+ os.environ['BUILD_DIR'] = a
+ elif o == '--sslhome':
+ os.environ['OPENSSL_HOME'] = a
+ elif o == '--expathome':
+ os.environ['EXPAT_HOME'] = a
+ elif o == '--dbhome':
+ os.environ['DB_HOME'] = a
+ elif o == '--stlporthome':
+ os.environ['STLPORT_HOME'] = a
+ elif o == '--bzip2home':
+ os.environ['BZIP2_HOME'] = a
+ elif o == '--thirdparty':
+ os.environ['OPENSSL_HOME'] = os.path.join(a, 'openssl-%s' % OpenSSLVer)
+ os.environ['BZIP2_HOME'] = os.path.join(a, 'bzip2-%s' % Bzip2Ver)
+ os.environ['EXPAT_HOME'] = os.path.join(a, 'expat-%s' % ExpatVer)
+ os.environ['DB_HOME'] = os.path.join(a, 'db-%s' % DBVer)
+ os.environ['STLPORT_HOME'] = os.path.join(a, 'STLPort-%s' % STLPortVer)
+
+ if debugLevel != logging.NOTSET:
+ if a != None:
+ logging.basicConfig(level = debugLevel, format='%(asctime)s %(levelname)s %(message)s', filename = a)
+ else:
+ logging.basicConfig(level = debugLevel, format='%(asctime)s %(levelname)s %(message)s')
+
+ if target == None:
+ print 'The development target must be specified'
+ sys.exit(2)
+
+ os.environ['target'] = target
+
+ #
+ # Where all the files will be staged so that the install projects
+ # can find them.
+ #
+ targetDir = os.path.join(installDir, target)
+ stageDir = os.path.join(targetDir, "install")
+
+ logging.info("Install Tool: " + installDir)
+ logging.info("Target Directory: " + targetDir)
+ logging.info("Stage Directory: " + stageDir)
+
+ if clean:
+ print('You have indicated you want to ''clean'' files, starting from scratch.')
+ confirm = ''
+ while not confirm in ['y', 'n']:
+ confirm = raw_input('Are you sure? [y/N]')
+ if confirm == '':
+ confirm = 'n'
+ if confirm == 'n':
+ sys.exit()
+ else:
+ logging.info('Deleting intermediate files and rebuilding from scratch!')
+
+ logging.info('Starting windows installer creation.')
+
+ environmentCheck(target)
+
+ buildDir = os.environ['BUILD_DIR']
+
+ logging.debug(environToString(os.environ))
+
+ sourcesVersion = checkSources(os.environ['SOURCES'])
+
+ defaults = os.environ
+ defaults['dbver'] = '45'
+ defaults['version'] = sourcesVersion
+ defaults['dllversion'] = sourcesVersion.replace('.', '')[:2]
+
+ if target == "vc80_x64":
+ defaults['OutDir'] = "x64/"
+ else:
+ defaults['OutDir'] = ''
+
+ if os.path.exists(stageDir):
+ try:
+ shutil.rmtree(stageDir)
+ except IOError:
+ print """
If you are getting a permission error here, try running 'attrib -r /s'
on both the stage directory and the source location for the third party
libraries."""
- raise
- os.mkdir(stageDir)
-
- #
- # Gather and generate license files.
- #
- convertLicensesToRTF(os.path.dirname(__file__), target)
-
- #
- # The third party packages need to be staged before building the
- # distributions. This ordering is important because it adds an
- # additional check that the third party packages that are
- # included in the installer are suitable for use with Ice.
- #
- components.stage(os.path.join(os.path.dirname(components.__file__), "components", "components.ini"),
- os.path.join(os.path.dirname(components.__file__), "components"), stageDir, "packages", defaults)
-
- #
- # Build the merge module projects.
- #
- if installer:
- buildMergeModules(targetDir, stageDir, sourcesVersion, target)
- buildInstallers(targetDir, stageDir, sourcesVersion, target, [("ThirdParty", "THIRD_PARTY_MSI")])
-
- #
- # Screw clean rules, run the ultimate clean!
- #
- if clean:
- shutil.rmtree(buildDir)
-
- if not os.path.exists(buildDir):
- os.mkdir(buildDir)
- if not os.path.exists(os.path.join(buildDir, "debug")):
- os.mkdir(os.path.join(buildDir, "debug"))
- if not os.path.exists(os.path.join(buildDir, "release")):
- os.mkdir(os.path.join(buildDir, "release"))
-
- for z in DistPrefixes:
+ raise
+ os.mkdir(stageDir)
+
+ #
+ # Gather and generate license files.
+ #
+ convertLicensesToRTF(os.path.dirname(__file__), target)
+
+ #
+ # The third party packages need to be staged before building the
+ # distributions. This ordering is important because it adds an
+ # additional check that the third party packages that are
+ # included in the installer are suitable for use with Ice.
+ #
+ components.stage(os.path.join(os.path.dirname(components.__file__), "components", "components.ini"),
+ os.path.join(os.path.dirname(components.__file__), "components"), stageDir, "packages", defaults)
+
+ #
+ # Build the merge module projects.
+ #
+ if installer:
+ buildMergeModules(targetDir, stageDir, sourcesVersion, target)
+ buildInstallers(targetDir, stageDir, sourcesVersion, target, [("ThirdParty", "THIRD_PARTY_MSI")])
+
+ #
+ # Screw clean rules, run the ultimate clean!
+ #
+ if clean:
+ shutil.rmtree(buildDir)
+
+ if not os.path.exists(buildDir):
+ os.mkdir(buildDir)
+ if not os.path.exists(os.path.join(buildDir, "debug")):
+ os.mkdir(os.path.join(buildDir, "debug"))
+ if not os.path.exists(os.path.join(buildDir, "release")):
+ os.mkdir(os.path.join(buildDir, "release"))
+
+ for z in DistPrefixes:
+ #
+ # TODO: See if this can be replaced by ZipFile and native
+ # Python code somehow.
#
- # TODO: See if this can be replaced by ZipFile and native
- # Python code somehow.
- #
- filename = os.path.join(os.environ['SOURCES'], z % sourcesVersion + ".zip")
- if not os.path.exists(os.path.join(buildDir, "debug", z % sourcesVersion)):
- runprog("unzip -o -q %s -d %s" % (filename, os.path.join(buildDir, "debug")))
- if not os.path.exists(os.path.join(buildDir, "release", z % sourcesVersion)):
- runprog("unzip -o -q %s -d %s" % (filename, os.path.join(buildDir, "release")))
-
- #
- # Build the Ice distributions.
- #
- if build:
- buildIceDists(stageDir, buildDir, sourcesVersion, target)
-
- #
- # Stage Ice!
- #
- components.stage(os.path.join(os.path.dirname(components.__file__), "components", "components.ini"),
- os.path.join(os.path.dirname(components.__file__), "components"), stageDir, "ice", defaults)
-
- #
- # Build the installer projects.
- #
- if installer:
- buildInstallers(targetDir, stageDir, sourcesVersion, target, [("Ice", "ICE_MSI")])
+ filename = os.path.join(os.environ['SOURCES'], z % sourcesVersion + ".zip")
+ if not os.path.exists(os.path.join(buildDir, "debug", z % sourcesVersion)):
+ runprog("unzip -o -q %s -d %s" % (filename, os.path.join(buildDir, "debug")))
+ if not os.path.exists(os.path.join(buildDir, "release", z % sourcesVersion)):
+ runprog("unzip -o -q %s -d %s" % (filename, os.path.join(buildDir, "release")))
+
+ #
+ # Build the Ice distributions.
+ #
+ if build:
+ buildIceDists(stageDir, buildDir, sourcesVersion, target)
+
+ #
+ # Stage Ice!
+ #
+ components.stage(os.path.join(os.path.dirname(components.__file__), "components", "components.ini"),
+ os.path.join(os.path.dirname(components.__file__), "components"), stageDir, "ice", defaults)
+
+ #
+ # Build the installer projects.
+ #
+ if installer:
+ buildInstallers(targetDir, stageDir, sourcesVersion, target, [("Ice", "ICE_MSI")])
finally:
- #
- # Return the user to where they started.
- #
- os.chdir(startDir)
+ #
+ # Return the user to where they started.
+ #
+ os.chdir(startDir)
if __name__ == "__main__":
main()
diff --git a/cpp/install/rpm/makeSRPMs.py b/cpp/install/rpm/makeSRPMs.py
index a252696be3b..3e8531647f1 100755
--- a/cpp/install/rpm/makeSRPMs.py
+++ b/cpp/install/rpm/makeSRPMs.py
@@ -28,19 +28,19 @@ def main():
sourceLocation = None
try:
- optionList, args = getopt.getopt(sys.argv[1:], "hs:t:", ["sources=", "target-host=", "help"])
+ optionList, args = getopt.getopt(sys.argv[1:], "hs:t:", ["sources=", "target-host=", "help"])
except getopt.GetoptError:
- usage()
- sys.exit(2)
+ usage()
+ sys.exit(2)
for o, a in optionList:
- if o in ["-h", "--help"]:
- pass
- if o in ["-s", "--sources"]:
- pass
- if o in ["-t", "--target-host"]:
- pass
+ if o in ["-h", "--help"]:
+ pass
+ if o in ["-s", "--sources"]:
+ pass
+ if o in ["-t", "--target-host"]:
+ pass
f = open("./test.spec", "w+b")
RPMTools.createFullSpecFile(f, "", "3.2.0", 32, "suse")
diff --git a/cpp/makebindist.py b/cpp/makebindist.py
index e7f2a5dd303..6fbe3cd77aa 100755
--- a/cpp/makebindist.py
+++ b/cpp/makebindist.py
@@ -46,27 +46,27 @@ def initDirectory(d):
class ExtProgramError:
def __init__(self, error = None):
- self.msg = error
-
+ self.msg = error
+
def __str__(self):
- return repr(self.msg)
+ return repr(self.msg)
def runprog(commandstring, haltOnError = True):
#commandtuple = commandstring.split()
#result = os.spawnvpe(os.P_WAIT, commandtuple[0], commandtuple, os.environ)
result = os.system(commandstring)
if result != 0:
- msg = 'Command %s returned error code %d' % (commandstring, result)
- if haltOnError:
- raise ExtProgramError(msg)
+ msg = 'Command %s returned error code %d' % (commandstring, result)
+ if haltOnError:
+ raise ExtProgramError(msg)
def copyfiles(srcDir, destDir):
'''Copy the contents of one directory to another (non-recursive)'''
for f in os.listdir(srcDir):
- src = os.path.join(srcDir, f)
- dest = os.path.join(destDir, f)
- if not os.path.isdir(src) and not os.path.islink(src):
- shutil.copy(src, dest)
+ src = os.path.join(srcDir, f)
+ dest = os.path.join(destDir, f)
+ if not os.path.isdir(src) and not os.path.islink(src):
+ shutil.copy(src, dest)
def getIceVersion(file):
"""Extract the ICE version string from a file."""
@@ -91,10 +91,10 @@ def getPlatform():
if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
return 'win32'
elif sys.platform.startswith('linux'):
- if readcommand('uname -p') == 'x86_64':
- return 'linux64'
- else:
- return 'linux'
+ if readcommand('uname -p') == 'x86_64':
+ return 'linux64'
+ else:
+ return 'linux'
elif sys.platform.startswith('sunos'):
return 'solaris'
elif sys.platform.startswith('hp'):
@@ -131,8 +131,8 @@ def getVersion(cvsTag, buildDir):
runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/include/IceUtil/Config.h')
result = [ getIceVersion('ice/include/IceUtil/Config.h'), \
- getIceSoVersion('ice/include/IceUtil/Config.h'), \
- getIceMMVersion('ice/include/IceUtil/Config.h') ]
+ getIceSoVersion('ice/include/IceUtil/Config.h'), \
+ getIceMMVersion('ice/include/IceUtil/Config.h') ]
os.remove('ice/include/IceUtil/Config.h')
os.removedirs('ice/include/IceUtil')
@@ -142,28 +142,28 @@ def getVersion(cvsTag, buildDir):
def fixVersion(filename, version, mmVersion):
f = fileinput.input(filename, True)
for line in f:
- l = line.rstrip('\n')
- l = l.replace('@ver@', version)
- l = l.replace('@mmver@', mmVersion)
- print l
+ l = line.rstrip('\n')
+ l = l.replace('@ver@', version)
+ l = l.replace('@mmver@', mmVersion)
+ print l
f.close()
def getInstallFiles(cvsTag, buildDir, version, mmVersion):
"""Gets the install sources for this revision"""
cwd = os.getcwd()
try:
- os.chdir(buildDir)
- runprog('rm -rf ' + buildDir + '/ice/install')
- runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/unix')
- runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/common')
- runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/rpm')
- runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/thirdparty')
- snapshot = os.walk('./ice/install/unix')
- for dirInfo in snapshot:
- for f in dirInfo[2]:
- fixVersion(os.path.join(dirInfo[0], f), version, mmVersion)
+ os.chdir(buildDir)
+ runprog('rm -rf ' + buildDir + '/ice/install')
+ runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/unix')
+ runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/common')
+ runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/rpm')
+ runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/thirdparty')
+ snapshot = os.walk('./ice/install/unix')
+ for dirInfo in snapshot:
+ for f in dirInfo[2]:
+ fixVersion(os.path.join(dirInfo[0], f), version, mmVersion)
finally:
- os.chdir(cwd)
+ os.chdir(cwd)
return buildDir + '/ice/install'
def getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion):
@@ -172,20 +172,20 @@ def getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion):
continue working!'''
cwd = os.getcwd()
try:
- os.chdir(buildDir)
- target = os.path.join(buildDir, 'ice', 'install')
- if os.path.exists(target):
- shutil.rmtree(target)
- iceloc = os.path.abspath(os.path.join(os.environ['ICE_HOME'],'install'))
- os.makedirs(target)
- for f in ['unix', 'common', 'rpm', 'thirdparty']:
- shutil.copytree(os.path.join(iceloc, f), os.path.join(target, f))
- snapshot = os.walk('./ice/install/unix')
- for dirInfo in snapshot:
- for f in dirInfo[2]:
- fixVersion(os.path.join(dirInfo[0], f), version, mmVersion)
+ os.chdir(buildDir)
+ target = os.path.join(buildDir, 'ice', 'install')
+ if os.path.exists(target):
+ shutil.rmtree(target)
+ iceloc = os.path.abspath(os.path.join(os.environ['ICE_HOME'],'install'))
+ os.makedirs(target)
+ for f in ['unix', 'common', 'rpm', 'thirdparty']:
+ shutil.copytree(os.path.join(iceloc, f), os.path.join(target, f))
+ snapshot = os.walk('./ice/install/unix')
+ for dirInfo in snapshot:
+ for f in dirInfo[2]:
+ fixVersion(os.path.join(dirInfo[0], f), version, mmVersion)
finally:
- os.chdir(cwd)
+ os.chdir(cwd)
return buildDir + '/ice/install'
def readcommand(cmd):
@@ -204,7 +204,7 @@ def collectSourceDistributions(tag, sourceDir, cvsdir, distro):
cwd = os.getcwd()
os.chdir(cwd + "/../" + cvsdir)
if len(tag) > 0:
- print 'Making disribution ' + cvsdir + ' with tag ' + tag
+ print 'Making disribution ' + cvsdir + ' with tag ' + tag
#
# The sources collected by the makebindist.py script are *NOT*
@@ -214,7 +214,7 @@ def collectSourceDistributions(tag, sourceDir, cvsdir, distro):
runprog("./makedist.py " + tag)
else:
runprog("./makedist.py -d " + tag)
-
+
shutil.copy("dist/" + distro + ".tar.gz", sourceDir)
os.chdir(cwd)
@@ -226,12 +226,12 @@ def editMakeRulesCS(filename, version):
reIceLocation = re.compile('^[a-z]*dir.*=\s*\$\(top_srcdir\)')
makefile = fileinput.input(filename, True)
for line in makefile:
- if reIceLocation.search(line) <> None:
- print line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10)
- elif line.startswith('prefix'):
- print 'prefix = $(ICE_DIR)'
- else:
- print line.rstrip('\n')
+ if reIceLocation.search(line) <> None:
+ print line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10)
+ elif line.startswith('prefix'):
+ print 'prefix = $(ICE_DIR)'
+ else:
+ print line.rstrip('\n')
makefile.close()
def editMakeRules(filename, version):
@@ -245,66 +245,66 @@ def editMakeRules(filename, version):
makefile = fileinput.input(filename, True)
for line in makefile:
- if line.startswith('slicedir'):
- print """
+ if line.startswith('slicedir'):
+ print """
ifeq ($(ICE_DIR),/usr)
slicedir = $(ICE_DIR)/share/slice
else
slicedir = $(ICE_DIR)/slice
endif
"""
- elif line.startswith('embedded_runpath_prefix'):
- state = 'untilblank'
- print """
+ elif line.startswith('embedded_runpath_prefix'):
+ state = 'untilblank'
+ print """
ifneq ($(ICE_DIR),/usr)
embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
endif
"""
- elif line.startswith('embedded_runpath_prefix'):
- #
- # embedded_runpath_prefix is moved down to after the version
- # information is set.
- #
- pass
- elif reIceLocation.search(line) <> None:
- output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10)
- if line.startswith('libdir'):
- print 'ifeq ($(LP64),yes)'
- print ' ' + output + '$(lp64suffix)'
- print 'else'
- print ' ' + output
- print 'endif'
- elif line.startswith('bindir'):
- print output
- #
- # NOTE!!! Magic occurs...
- # It simplifies building the demos for the user if
- # we try to detect whether the executables are 64
- # bit and, if so, set LP64=yes automagically.
- #
- print ''
- print '#'
- print '# If LP64 is unset, sample an Ice executable to see if it is 64 bit'
- print '# and set automatically. This avoids having to set LP64 if there is'
- print '# Ice installation in a well-known location.'
- print '#'
- print 'ifeq ($(LP64),)'
- print ' ifneq ($(shell file $(bindir)/slice2cpp | grep 64-bit),)'
- print ' LP64=yes'
- print ' endif'
- print 'endif'
- print ''
- else:
- print output
-
- elif line.startswith('install_'):
- #
- # Do nothing.
- #
- pass
- elif line.startswith('SOVERSION'):
- print line.rstrip('\n')
- print """
+ elif line.startswith('embedded_runpath_prefix'):
+ #
+ # embedded_runpath_prefix is moved down to after the version
+ # information is set.
+ #
+ pass
+ elif reIceLocation.search(line) <> None:
+ output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10)
+ if line.startswith('libdir'):
+ print 'ifeq ($(LP64),yes)'
+ print ' ' + output + '$(lp64suffix)'
+ print 'else'
+ print ' ' + output
+ print 'endif'
+ elif line.startswith('bindir'):
+ print output
+ #
+ # NOTE!!! Magic occurs...
+ # It simplifies building the demos for the user if
+ # we try to detect whether the executables are 64
+ # bit and, if so, set LP64=yes automagically.
+ #
+ print ''
+ print '#'
+ print '# If LP64 is unset, sample an Ice executable to see if it is 64 bit'
+ print '# and set automatically. This avoids having to set LP64 if there is'
+ print '# Ice installation in a well-known location.'
+ print '#'
+ print 'ifeq ($(LP64),)'
+ print ' ifneq ($(shell file $(bindir)/slice2cpp | grep 64-bit),)'
+ print ' LP64=yes'
+ print ' endif'
+ print 'endif'
+ print ''
+ else:
+ print output
+
+ elif line.startswith('install_'):
+ #
+ # Do nothing.
+ #
+ pass
+ elif line.startswith('SOVERSION'):
+ print line.rstrip('\n')
+ print """
#
# Checks for ICE_HOME environment variable. If it isn't present,
@@ -314,17 +314,17 @@ endif
ifeq ($(ICE_HOME),)
ICE_DIR = /usr
ifneq ($(shell test -f $(ICE_DIR)/bin/icestormadmin && echo 0),0)
- NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
- ifneq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0)
+ NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
+ ifneq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0)
$(error Unable to locate Ice distribution, please set ICE_HOME!)
- else
- ICE_DIR = $(NEXTDIR)
- endif
+ else
+ ICE_DIR = $(NEXTDIR)
+ endif
else
- NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
- ifeq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0)
+ NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
+ ifeq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0)
$(warning Ice distribution found in /usr and $(NEXTDIR)! Installation in "/usr" will be used by default. Use ICE_HOME to specify alternate Ice installation.)
- endif
+ endif
endif
else
ICE_DIR = $(ICE_HOME)
@@ -340,15 +340,15 @@ endif
prefix = $(ICE_DIR)
"""
- elif line.startswith('prefix'):
- #
- # Delete the prefix line. It will be set later on after
- # SOVERSION.
- #
- print "# 'prefix' is automatically defined later on in this file using default"
- print "# locations or ICE_HOME"
- else:
- print line.rstrip('\n')
+ elif line.startswith('prefix'):
+ #
+ # Delete the prefix line. It will be set later on after
+ # SOVERSION.
+ #
+ print "# 'prefix' is automatically defined later on in this file using default"
+ print "# locations or ICE_HOME"
+ else:
+ print line.rstrip('\n')
#
# Dependency files are all going to be bogus since they contain relative
@@ -373,30 +373,30 @@ def editMakeRulesMak(filename, version):
makefile = fileinput.input(filename, True)
for line in makefile:
- if state == 'done':
- if reIceLocation.search(line) <> None:
- output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10)
- print output
- elif line.startswith('install_'):
- #
- # Do nothing.
- #
- pass
- elif line.startswith('THIRDPARTY_HOME'):
- #
- # Do nothing.
- #
- pass
- else:
- print line.rstrip('\n')
- elif state == 'header':
- #
- # Reading header.
- #
- print line.rstrip('\n')
- if line.strip() == "":
- state = 'untilprefix'
- print """
+ if state == 'done':
+ if reIceLocation.search(line) <> None:
+ output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10)
+ print output
+ elif line.startswith('install_'):
+ #
+ # Do nothing.
+ #
+ pass
+ elif line.startswith('THIRDPARTY_HOME'):
+ #
+ # Do nothing.
+ #
+ pass
+ else:
+ print line.rstrip('\n')
+ elif state == 'header':
+ #
+ # Reading header.
+ #
+ print line.rstrip('\n')
+ if line.strip() == "":
+ state = 'untilprefix'
+ print """
#
# Checks for ICE_HOME environment variable.
#
@@ -417,9 +417,9 @@ ICE_DIR = $(ICE_HOME)
prefix = $(ICE_DIR)
"""
- elif state == 'untilprefix':
- if line.startswith('prefix'):
- state = 'done'
+ elif state == 'untilprefix':
+ if line.startswith('prefix'):
+ state = 'done'
#
# Dependency files are all going to be bogus since they contain relative
# paths to Ice headers. We need to adjust this.
@@ -435,16 +435,16 @@ def updateIceVersion(filename, version):
print 'Updating ice version in ' + filename + ' to ' + version
f = fileinput.input(filename, True)
for line in f:
- print line.rstrip('\n').replace('ICE_VERSION', version)
+ print line.rstrip('\n').replace('ICE_VERSION', version)
f.close()
def obliterate(files):
for f in files:
- if os.path.exists(f):
- if os.path.isdir(f):
- shutil.rmtree(f)
- else:
- os.remove(f)
+ if os.path.exists(f):
+ if os.path.isdir(f):
+ shutil.rmtree(f)
+ else:
+ os.remove(f)
def extractDemos(sources, buildDir, version, distro, demoDir):
"""Pulls the demo directory out of a distribution and massages its
@@ -460,42 +460,42 @@ def extractDemos(sources, buildDir, version, distro, demoDir):
#
toExtract = "%s/demo " % distro
if demoDir == '':
- toExtract = toExtract + " %s/ICE_LICENSE" % distro
+ toExtract = toExtract + " %s/ICE_LICENSE" % distro
if not demoDir == 'php':
- toExtract = toExtract + " %s/certs %s/config" % (distro, distro)
-
+ toExtract = toExtract + " %s/certs %s/config" % (distro, distro)
+
runprog("gzip -dc " + os.path.join(sources, distro) + ".tar.gz | tar xf - " + toExtract, False)
-
+
shutil.move(os.path.join(distro, "demo"), os.path.join(buildDir, "Ice-" + version + "-demos", "demo" + demoDir))
if os.path.exists(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE")):
- shutil.move(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE"), \
- os.path.join(buildDir, "Ice-%s-demos" % version, "ICE_LICENSE"))
+ shutil.move(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE"), \
+ os.path.join(buildDir, "Ice-%s-demos" % version, "ICE_LICENSE"))
#
# 'System' copying of files here because its just easier! We don't
# need any configuration out of the Python tree.
#
if not os.path.exists(buildDir + "/Ice-" + version + "-demos/certs"):
- os.mkdir(buildDir + "/Ice-" + version + "-demos/certs")
-
+ os.mkdir(buildDir + "/Ice-" + version + "-demos/certs")
+
if not os.path.exists(buildDir + "/Ice-" + version + "-demos/config"):
- os.mkdir(buildDir + "/Ice-" + version + "-demos/config")
+ os.mkdir(buildDir + "/Ice-" + version + "-demos/config")
if os.path.exists('%s/certs' % distro):
- runprog("cp -pR " + distro + "/certs " + buildDir + "/Ice-" + version + "-demos")
+ runprog("cp -pR " + distro + "/certs " + buildDir + "/Ice-" + version + "-demos")
srcConfigDir = '%s/%s/config' % (os.getcwd(), distro)
destConfigDir = '%s/Ice-%s-demos/config' % (buildDir, version)
if not demoDir in ['py', 'vb'] and os.path.exists(srcConfigDir):
- for f in os.listdir(srcConfigDir):
- src = os.path.join(srcConfigDir, f)
- dest = os.path.join(destConfigDir, f)
- if not os.path.isdir(src) and not os.path.islink(src):
- shutil.copy(src, dest)
+ for f in os.listdir(srcConfigDir):
+ src = os.path.join(srcConfigDir, f)
+ dest = os.path.join(destConfigDir, f)
+ if not os.path.isdir(src) and not os.path.islink(src):
+ shutil.copy(src, dest)
if demoDir == 'j':
- updateIceVersion(os.path.join(destConfigDir, 'common.xml'), version)
+ updateIceVersion(os.path.join(destConfigDir, 'common.xml'), version)
#
# Collect files to remove from the demo distribution.
@@ -504,24 +504,24 @@ def extractDemos(sources, buildDir, version, distro, demoDir):
basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'certs')
for f in ['openssl', 'makecerts']:
- fullpath = os.path.join(basepath, f)
+ fullpath = os.path.join(basepath, f)
if os.path.exists(fullpath):
- remove.append(fullpath)
+ remove.append(fullpath)
if len(demoDir) == 0:
- basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'demo')
- for f in ['IcePatch2', os.path.join('Ice', 'MFC')]:
- fullpath = os.path.join(basepath, f)
+ basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'demo')
+ for f in ['IcePatch2', os.path.join('Ice', 'MFC')]:
+ fullpath = os.path.join(basepath, f)
if os.path.exists(fullpath):
- remove.append(fullpath)
+ remove.append(fullpath)
basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'config')
if distro.startswith('Ice-'):
- editMakeRules(os.path.join(basepath, 'Make.rules'), version)
- editMakeRulesMak(os.path.join(basepath, 'Make.rules.mak'), version)
+ editMakeRules(os.path.join(basepath, 'Make.rules'), version)
+ editMakeRulesMak(os.path.join(basepath, 'Make.rules.mak'), version)
elif distro.startswith('IceCS-'):
- editMakeRulesCS(os.path.join(basepath, 'Make.rules.cs'), version)
+ editMakeRulesCS(os.path.join(basepath, 'Make.rules.cs'), version)
#
# Remove collected files.
@@ -535,8 +535,8 @@ def archiveDemoTree(buildDir, version, installFiles):
cwd = os.getcwd()
os.chdir(os.path.join(buildDir, 'Ice-%s-demos' % version))
filesToRemove = ['certs/makecerts.py', 'certs/ImportKey.java', 'certs/ImportKey.class', 'certs/seed.dat',
- 'config/convertssl.py', 'config/upgradeicegrid.py', 'config/icegrid-slice.3.1.ice.gz', 'config/PropertyNames.def', 'config/makeprops.py',
- 'config/TestUtil.py', 'config/IceGridAdmin.py', 'config/ice_ca.cnf', 'config/icegridgui.pro']
+ 'config/convertssl.py', 'config/upgradeicegrid.py', 'config/icegrid-slice.3.1.ice.gz', 'config/PropertyNames.def', 'config/makeprops.py',
+ 'config/TestUtil.py', 'config/IceGridAdmin.py', 'config/ice_ca.cnf', 'config/icegridgui.pro']
obliterate(filesToRemove)
os.chdir(buildDir)
@@ -571,9 +571,9 @@ def makeInstall(sources, buildDir, installDir, distro, clean, version, mmVersion
shutil.rmtree(distro, True)
if not os.path.exists(distro):
- filename = sources + '/' + distro + '.tar'
+ filename = sources + '/' + distro + '.tar'
runprog('gzip -d %s.gz' % filename)
- runprog('tar xf %s' % filename)
+ runprog('tar xf %s' % filename)
runprog('gzip -9 %s' % filename)
os.chdir(distro)
@@ -585,18 +585,18 @@ def makeInstall(sources, buildDir, installDir, distro, clean, version, mmVersion
if distro.startswith('IceJ'):
initDirectory(installDir)
initDirectory(os.path.join(installDir, 'lib'))
- shutil.copy(buildDir + '/' + distro + '/lib/Ice.jar', installDir + '/lib')
- shutil.copy(buildDir + '/' + distro + '/lib/IceGridGUI.jar', installDir + '/lib')
- #
- # We really just want to copy the files, not move them.
- # Shelling out to a copy is easier (and more likely to always
- # work) than shutil.copytree().
- #
- runprog('cp -pR ' + buildDir + '/' + distro + '/ant ' + installDir)
- runprog('find ' + installDir + '/ant -name "*.java" | xargs rm')
- destDir = os.path.join(installDir, 'config')
- if not os.path.exists(destDir):
- os.mkdir(destDir)
+ shutil.copy(buildDir + '/' + distro + '/lib/Ice.jar', installDir + '/lib')
+ shutil.copy(buildDir + '/' + distro + '/lib/IceGridGUI.jar', installDir + '/lib')
+ #
+ # We really just want to copy the files, not move them.
+ # Shelling out to a copy is easier (and more likely to always
+ # work) than shutil.copytree().
+ #
+ runprog('cp -pR ' + buildDir + '/' + distro + '/ant ' + installDir)
+ runprog('find ' + installDir + '/ant -name "*.java" | xargs rm')
+ destDir = os.path.join(installDir, 'config')
+ if not os.path.exists(destDir):
+ os.mkdir(destDir)
shutil.copy(os.path.join('config', 'build.properties'), destDir)
os.chdir(cwd)
return
@@ -610,32 +610,32 @@ def makeInstall(sources, buildDir, installDir, distro, clean, version, mmVersion
if pyHome == None or pyHome == '':
logging.info('PYTHON_HOME is not set, figuring it out and trying that')
pyHome = sys.exec_prefix
- os.environ['PYTHON_HOME'] = pyHome
+ os.environ['PYTHON_HOME'] = pyHome
#
# XXX- Optimizations need to be turned on for the release.
#
try:
- runprog('gmake NOGAC=yes OPTIMIZE=yes prefix=%s embedded_runpath_prefix=/opt/Ice-%s install' % (installDir, mmVersion))
+ runprog('gmake NOGAC=yes OPTIMIZE=yes prefix=%s embedded_runpath_prefix=/opt/Ice-%s install' % (installDir, mmVersion))
except ExtProgramError:
- print "gmake failed for makeInstall(%s, %s, %s, %s, %s, %s, %s)" % (sources, buildDir, installDir, distro, str(clean), version, mmVersion)
- raise
+ print "gmake failed for makeInstall(%s, %s, %s, %s, %s, %s, %s)" % (sources, buildDir, installDir, distro, str(clean), version, mmVersion)
+ raise
runprog('rm -rf /opt/Ice-%s' % (mmVersion), False)
if distro.startswith('IceCS'):
- assemblies = ["glacier2cs", "iceboxcs", "icecs", "icegridcs", "icepatch2cs", "icestormcs"]
+ assemblies = ["glacier2cs", "iceboxcs", "icecs", "icegridcs", "icepatch2cs", "icestormcs"]
- #
- # We are relying on pkgconfig to deal with some mono library
- # configuration, so we need to copy these files into place.
- #
- if not os.path.exists("%s/lib/pkgconfig" % installDir):
- os.makedirs("%s/lib/pkgconfig" % installDir)
+ #
+ # We are relying on pkgconfig to deal with some mono library
+ # configuration, so we need to copy these files into place.
+ #
+ if not os.path.exists("%s/lib/pkgconfig" % installDir):
+ os.makedirs("%s/lib/pkgconfig" % installDir)
- for a in assemblies:
- shutil.copy("bin/%s.dll" % a, "%s/bin/%s.dll" % (installDir, a))
- shutil.copy("lib/pkgconfig/%s.pc" % a, "%s/lib/pkgconfig" % installDir)
+ for a in assemblies:
+ shutil.copy("bin/%s.dll" % a, "%s/bin/%s.dll" % (installDir, a))
+ shutil.copy("lib/pkgconfig/%s.pc" % a, "%s/lib/pkgconfig" % installDir)
os.chdir(cwd)
@@ -653,11 +653,11 @@ def shlibExtensions(versionString, versionInt):
def getPlatformLibExtension():
platform = getPlatform()
if platform == 'hpux':
- return '.sl'
+ return '.sl'
elif platform == 'macosx':
- return '.dylib'
+ return '.dylib'
else:
- return '.so'
+ return '.so'
def getDBfiles(dbLocation):
cwd = os.getcwd()
@@ -672,18 +672,18 @@ def getDBfiles(dbLocation):
findCmd = ''
if getPlatform() == 'solaris':
- findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1'
+ findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1'
elif getPlatform() == 'macosx':
- findCmd = 'find lib \( -name "*' + getPlatformLibExtension() + '" -or -name "*jnilib" \) -type f '
+ findCmd = 'find lib \( -name "*' + getPlatformLibExtension() + '" -or -name "*jnilib" \) -type f '
else:
- findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f'
+ findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f'
pipe_stdin, pipe_stdout = os.popen2(findCmd)
lines = pipe_stdout.readlines()
pipe_stdin.close()
pipe_stdout.close()
fileList.extend(lines)
if getPlatform() == 'aix':
- fileList.append('lib/libdb_cxx.so')
+ fileList.append('lib/libdb_cxx.so')
os.chdir(cwd)
return fileList
@@ -695,9 +695,9 @@ def copyExpatFiles(expatLocation, version):
fileList = []
findCmd = ''
if getPlatform() == 'solaris':
- findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1'
+ findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1'
else:
- findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f'
+ findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f'
pipe_stdin, pipe_stdout = os.popen2(findCmd)
lines = pipe_stdout.readlines()
pipe_stdin.close()
@@ -707,9 +707,9 @@ def copyExpatFiles(expatLocation, version):
linkList = []
findCmd = ''
if getPlatform() == 'solaris':
- findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l -maxdepth 1'
+ findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l -maxdepth 1'
else:
- findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l'
+ findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l'
pipe_stdin, pipe_stdout = os.popen2(findCmd)
lines = pipe_stdout.readlines()
pipe_stdin.close()
@@ -717,14 +717,14 @@ def copyExpatFiles(expatLocation, version):
fileList.extend(lines)
for i in lines:
- if i != 'libexpat.' + getPlatformLibExtension():
- linkList.append(i)
+ if i != 'libexpat.' + getPlatformLibExtension():
+ linkList.append(i)
os.chdir(cwd)
if not os.path.exists('Ice-' + version + '/' + fileList[0].strip()):
- shutil.copy(expatLocation + '/' + fileList[0].strip(), 'Ice-' + version + '/' + fileList[0].strip())
- os.symlink(os.path.basename(fileList[0].strip()), 'Ice-' + version + '/' + linkList[0].strip())
+ shutil.copy(expatLocation + '/' + fileList[0].strip(), 'Ice-' + version + '/' + fileList[0].strip())
+ os.symlink(os.path.basename(fileList[0].strip()), 'Ice-' + version + '/' + linkList[0].strip())
def usage():
"""Print usage/help information"""
@@ -742,7 +742,7 @@ def usage():
print ' If this is omitted makebindist will traverse'
print ' ../icej ../icepy ../icecs, etc and make the'
print ' distributions for you.'
- print ' (Note: makedist.py seems to only work on Linux.'
+ print ' (Note: makedist.py seems to only work on Linux.'
print ' To use makebindist.py on other UNIX platforms,'
print ' you must copy pre-made source distributions onto'
print ' the host and use this option to reference their'
@@ -753,7 +753,7 @@ def usage():
print ' applicable (some bits will still be cleaned.'
print '--nobuild Run through the process but don\'t build'
print ' anything new.'
- print '--usecvs Use contents of existing CVS directories'
+ print '--usecvs Use contents of existing CVS directories'
print ' to create binary package.'
print
print 'The following options set the locations for third party libraries'
@@ -777,7 +777,7 @@ def usage():
print ' (default=/opt/db).'
print '--sslhome=[path] Specify location of OpenSSL'
print ' (default=/opt/openssl).'
- print '--expathome=[path] Specify location of expat libraries '
+ print '--expathome=[path] Specify location of expat libraries '
print ' (default=/opt/expat).'
print '--readlinehome=[path] Specify readline library and location '
print ' (defaults to /opt/readline if set).'
@@ -808,8 +808,8 @@ def main():
optionList, args = getopt.getopt(sys.argv[1:], 'hvt:',
[ 'build-dir=', 'install-dir=', 'install-root=', 'sources=',
'verbose', 'tag=', 'noclean', 'nobuild',
- 'stlporthome=', 'bzip2home=', 'dbhome=', 'sslhome=',
- 'expathome=', 'readlinehome=', 'usecvs', 'offline', 'debug'])
+ 'stlporthome=', 'bzip2home=', 'dbhome=', 'sslhome=',
+ 'expathome=', 'readlinehome=', 'usecvs', 'offline', 'debug'])
except getopt.GetoptError:
usage()
@@ -835,51 +835,51 @@ def main():
clean = False
elif o == '--nobuild':
build = False
- elif o == '--stlporthome':
- buildEnvironment['STLPORT_HOME'] = a
- elif o == '--bzip2home':
- buildEnvironment['BZIP2_HOME'] = a
- elif o == '--dbhome':
- buildEnvironment['DB_HOME'] = a
- elif o == '--sslhome':
- buildEnvironment['OPENSSL_HOME'] = a
- elif o == '--expathome':
- buildEnvironment['EXPAT_HOME'] = a
- elif o == '--readlinehome':
- buildEnvironment['READLINE_HOME'] = a
- elif o == '--offline':
- offline = True
- elif o == '--usecvs':
- cvsMode = True
+ elif o == '--stlporthome':
+ buildEnvironment['STLPORT_HOME'] = a
+ elif o == '--bzip2home':
+ buildEnvironment['BZIP2_HOME'] = a
+ elif o == '--dbhome':
+ buildEnvironment['DB_HOME'] = a
+ elif o == '--sslhome':
+ buildEnvironment['OPENSSL_HOME'] = a
+ elif o == '--expathome':
+ buildEnvironment['EXPAT_HOME'] = a
+ elif o == '--readlinehome':
+ buildEnvironment['READLINE_HOME'] = a
+ elif o == '--offline':
+ offline = True
+ elif o == '--usecvs':
+ cvsMode = True
if verbose:
- logging.getLogger().setLevel(logging.DEBUG)
+ logging.getLogger().setLevel(logging.DEBUG)
if offline and sources == None:
- logging.error("You must specify a location for the sources if running in offline mode")
- sys.exit(1)
+ logging.error("You must specify a location for the sources if running in offline mode")
+ sys.exit(1)
#
# Configure environment.
#
if getPlatform() == 'aix':
- dylibEnvironmentVar = 'LIBPATH'
+ dylibEnvironmentVar = 'LIBPATH'
elif getPlatform() == 'hpux':
- dylibEnvironmentVar = 'SHLIB_PATH'
+ dylibEnvironmentVar = 'SHLIB_PATH'
else:
- dylibEnvironmentVar = 'LD_LIBRARY_PATH'
+ dylibEnvironmentVar = 'LD_LIBRARY_PATH'
for k, v in buildEnvironment.iteritems():
- os.environ[k] = v
- if os.environ.has_key(dylibEnvironmentVar):
- os.environ[dylibEnvironmentVar] = v + '/lib:' + os.environ[dylibEnvironmentVar]
+ os.environ[k] = v
+ if os.environ.has_key(dylibEnvironmentVar):
+ os.environ[dylibEnvironmentVar] = v + '/lib:' + os.environ[dylibEnvironmentVar]
if buildDir == None:
print 'No build directory specified, defaulting to $HOME/tmp/icebuild'
buildDir = os.environ.get('HOME') + '/tmp/icebuild'
if cvsMode:
- print 'Using CVS mode'
+ print 'Using CVS mode'
if installDir == None:
print 'No install directory specified, default to $HOME/tmp/iceinstall'
@@ -899,9 +899,9 @@ def main():
# the build sources.
#
if cvsMode:
- directories = []
+ directories = []
else:
- directories = [buildDir, buildDir + '/sources', buildDir + '/demotree']
+ directories = [buildDir, buildDir + '/sources', buildDir + '/demotree']
directories.append(installDir)
@@ -913,18 +913,18 @@ def main():
#
installFiles = None
if cvsMode:
- version = getIceVersion('include/IceUtil/Config.h')
- soVersion = getIceSoVersion('include/IceUtil/Config.h')
+ version = getIceVersion('include/IceUtil/Config.h')
+ soVersion = getIceSoVersion('include/IceUtil/Config.h')
mmVersion = getIceMMVersion('include/IceUtil/Config.h')
- installFiles = 'install'
+ installFiles = 'install'
elif offline:
- version = getIceVersion('include/IceUtil/Config.h')
- soVersion = getIceSoVersion('include/IceUtil/Config.h')
- mmVersion = getIceMMVersion('include/IceUtil/Config.h')
- installFiles = getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion)
+ version = getIceVersion('include/IceUtil/Config.h')
+ soVersion = getIceSoVersion('include/IceUtil/Config.h')
+ mmVersion = getIceMMVersion('include/IceUtil/Config.h')
+ installFiles = getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion)
else:
- version, soVersion, mmVersion = getVersion(cvsTag, buildDir)
- installFiles = getInstallFiles(cvsTag, buildDir, version, mmVersion)
+ version, soVersion, mmVersion = getVersion(cvsTag, buildDir)
+ installFiles = getInstallFiles(cvsTag, buildDir, version, mmVersion)
if verbose:
print 'Building binary distributions for Ice-' + version + ' on ' + getPlatform()
@@ -934,20 +934,20 @@ def main():
if not cvsMode:
- #
- # These last build directories will have to wait until we've got
- # the version number for the distribution.
- #
- shutil.rmtree(buildDir + '/Ice-' + version + '-demos', True)
- initDirectory(buildDir + '/Ice-' + version + '-demos/config')
+ #
+ # These last build directories will have to wait until we've got
+ # the version number for the distribution.
+ #
+ shutil.rmtree(buildDir + '/Ice-' + version + '-demos', True)
+ initDirectory(buildDir + '/Ice-' + version + '-demos/config')
if build and not cvsMode:
collectSources = False
if sources == None:
- if not getPlatform().startswith("linux"):
- print "makedist.py is not supported on non-Linux platforms. Create the source"
- print "distributions on a Linux box, copy them to a location on this host and"
- print "specify their location with the --sources argument"
+ if not getPlatform().startswith("linux"):
+ print "makedist.py is not supported on non-Linux platforms. Create the source"
+ print "distributions on a Linux box, copy them to a location on this host and"
+ print "specify their location with the --sources argument"
sources = buildDir + '/sources'
collectSources = clean
@@ -955,15 +955,15 @@ def main():
# Ice must be first or building the other source distributions will fail.
#
sourceTarBalls = [ ('ice', 'Ice-%s' % version, ''),
- ('icephp','IcePHP-%s' % version, 'php'),
+ ('icephp','IcePHP-%s' % version, 'php'),
('icej','IceJ-%s-java2' % version, 'j'),
- ('icerb', 'IceRuby-%s' % version, 'rb')]
+ ('icerb', 'IceRuby-%s' % version, 'rb')]
- if not getPlatform() in ['aix', 'solaris', 'hpux']:
- sourceTarBalls.append(('icepy','IcePy-' + version, 'py'))
+ if not getPlatform() in ['aix', 'solaris', 'hpux']:
+ sourceTarBalls.append(('icepy','IcePy-' + version, 'py'))
- if getPlatform().startswith("linux"):
- sourceTarBalls.append(('icecs','IceCS-' + version, 'cs'))
+ if getPlatform().startswith("linux"):
+ sourceTarBalls.append(('icecs','IceCS-' + version, 'cs'))
os.environ['ICE_HOME'] = installDir + '/Ice-' + version
currentLibraryPath = None
@@ -978,63 +978,63 @@ def main():
os.environ[dylibEnvironmentVar] = installDir + '/Ice-' + version + '/lib64:' + installDir + '/Ice-' + version + '/lib:' + currentLibraryPath
os.environ['PATH'] = installDir + '/Ice-' + version + '/bin:' + os.environ['PATH']
- #
- # Collect all of the distributions first. This prevents having
- # to go through costly builds before finding out that one of the
- # distributions doesn't build.
- #
- if collectSources:
- toCollect = list(sourceTarBalls)
- toCollect.append(('icevb', 'IceVB-' + version, 'vb'))
- for cvs, tarball, demoDir in toCollect:
+ #
+ # Collect all of the distributions first. This prevents having
+ # to go through costly builds before finding out that one of the
+ # distributions doesn't build.
+ #
+ if collectSources:
+ toCollect = list(sourceTarBalls)
+ toCollect.append(('icevb', 'IceVB-' + version, 'vb'))
+ for cvs, tarball, demoDir in toCollect:
collectSourceDistributions(cvsTag, sources, cvs, tarball)
- print '''
+ print '''
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>> <<
>> Sources have been collected! <<
>> <<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'''
- #
- # Package up demo distribution.
- #
- toCollect = list(sourceTarBalls)
- for cvs, tarball, demoDir in toCollect:
- extractDemos(sources, buildDir, version, tarball, demoDir)
- shutil.copy("%s/unix/README.DEMOS" % installFiles, "%s/Ice-%s-demos/README.DEMOS" % (buildDir, version))
- archiveDemoTree(buildDir, version, installFiles)
- shutil.move("%s/Ice-%s-demos.tar.gz" % (buildDir, version), "%s/Ice-%s-demos.tar.gz" % (installDir, version))
+ #
+ # Package up demo distribution.
+ #
+ toCollect = list(sourceTarBalls)
+ for cvs, tarball, demoDir in toCollect:
+ extractDemos(sources, buildDir, version, tarball, demoDir)
+ shutil.copy("%s/unix/README.DEMOS" % installFiles, "%s/Ice-%s-demos/README.DEMOS" % (buildDir, version))
+ archiveDemoTree(buildDir, version, installFiles)
+ shutil.move("%s/Ice-%s-demos.tar.gz" % (buildDir, version), "%s/Ice-%s-demos.tar.gz" % (installDir, version))
shutil.move("%s/Ice-%s-demos.zip" % (buildDir, version), "%s/Ice-%s-demos.zip" % (installDir, version))
- #
- # Everything should be set for building stuff up now.
- #
+ #
+ # Everything should be set for building stuff up now.
+ #
for cvs, tarball, demoDir in sourceTarBalls:
- makeInstall(sources, buildDir, "%s/Ice-%s" % (installDir, version), tarball, clean, version, mmVersion)
-
- #
- # XXX- put java5 Ice.jar in place!
- #
- prevDir = os.getcwd()
- os.chdir("%s/Ice-%s/lib" % (installDir, version))
- os.mkdir("java5")
- os.chdir("java5")
- os.system("gzip -dc %s/IceJ-%s-java5.tar.gz | tar xf - IceJ-%s-java5/lib/Ice.jar" % (sources, version, version))
- shutil.move("IceJ-%s-java5/lib/Ice.jar" % version, "Ice.jar")
- shutil.rmtree("IceJ-%s-java5" % version)
- os.chdir(prevDir)
+ makeInstall(sources, buildDir, "%s/Ice-%s" % (installDir, version), tarball, clean, version, mmVersion)
+
+ #
+ # XXX- put java5 Ice.jar in place!
+ #
+ prevDir = os.getcwd()
+ os.chdir("%s/Ice-%s/lib" % (installDir, version))
+ os.mkdir("java5")
+ os.chdir("java5")
+ os.system("gzip -dc %s/IceJ-%s-java5.tar.gz | tar xf - IceJ-%s-java5/lib/Ice.jar" % (sources, version, version))
+ shutil.move("IceJ-%s-java5/lib/Ice.jar" % version, "Ice.jar")
+ shutil.rmtree("IceJ-%s-java5" % version)
+ os.chdir(prevDir)
elif cvsMode:
- collectSources = False
+ collectSources = False
- #
- # TODO: Sanity check to make sure that the script is being run
- # from a location that it expects.
- #
- cvsDirs = [ 'ice', 'icej', 'icephp' ]
- if getPlatform() == 'linux':
- cvsDirs.append('icecs', 'icepy', 'icerb')
+ #
+ # TODO: Sanity check to make sure that the script is being run
+ # from a location that it expects.
+ #
+ cvsDirs = [ 'ice', 'icej', 'icephp' ]
+ if getPlatform() == 'linux':
+ cvsDirs.append('icecs', 'icepy', 'icerb')
os.environ['ICE_HOME'] = os.getcwd()
currentLibraryPath = None
@@ -1046,18 +1046,18 @@ def main():
os.environ[dylibEnvironmentVar] = installDir + '/Ice-' + version + '/lib:' + currentLibraryPath
os.environ['PATH'] = installDir + '/Ice-' + version + '/bin:' + os.environ['PATH']
- for d in cvsDirs:
- currentDir = os.getcwd()
- os.chdir('../' + d)
- print 'Going to directory ' + d
- if d == 'icej':
- shutil.copy('lib/Ice.jar', installDir +'/Ice-' + version + '/lib')
- shutil.copy('lib/IceGridGUI.jar', installDir +'/Ice-' + version + '/lib')
- runprog('cp -pR ant ' + installDir + '/Ice-' + version)
- runprog('find ' + installDir + '/Ice-' + version + ' -name "*.java" | xargs rm')
- else:
- runprog('gmake prefix=' + installDir + '/Ice-' + version + ' install')
- os.chdir(currentDir)
+ for d in cvsDirs:
+ currentDir = os.getcwd()
+ os.chdir('../' + d)
+ print 'Going to directory ' + d
+ if d == 'icej':
+ shutil.copy('lib/Ice.jar', installDir +'/Ice-' + version + '/lib')
+ shutil.copy('lib/IceGridGUI.jar', installDir +'/Ice-' + version + '/lib')
+ runprog('cp -pR ant ' + installDir + '/Ice-' + version)
+ runprog('find ' + installDir + '/Ice-' + version + ' -name "*.java" | xargs rm')
+ else:
+ runprog('gmake prefix=' + installDir + '/Ice-' + version + ' install')
+ os.chdir(currentDir)
#
# Sources should have already been built and installed. We
@@ -1069,34 +1069,34 @@ def main():
os.chdir(installDir)
if not getPlatform().startswith('linux'):
- #
- # Get third party libraries.
- #
- dbLocation = os.environ['DB_HOME']
- dbFiles = getDBfiles(dbLocation)
- for f in dbFiles:
+ #
+ # Get third party libraries.
+ #
+ dbLocation = os.environ['DB_HOME']
+ dbFiles = getDBfiles(dbLocation)
+ for f in dbFiles:
if not os.path.exists('Ice-' + version + '/' + f.strip()):
shutil.copy(dbLocation + '/' + f.strip(), 'Ice-' + version + '/' + f.strip())
if getPlatform() == 'macosx':
- copyExpatFiles(os.environ['EXPAT_HOME'], version)
+ copyExpatFiles(os.environ['EXPAT_HOME'], version)
if getPlatform() == 'hpux':
- ssl = os.environ['OPENSSL_HOME']
- shutil.copy('%s/bin/openssl' % ssl, 'Ice-%s/bin' % version)
-# runprog('cp -R ' + ssl + '/include Ice-' + version)
- runprog('cp ' + ssl + '/lib/lib*.sl.* Ice-' + version + '/lib')
- runprog('rm -rf Ice-' + version + '/lib/libfips*')
+ ssl = os.environ['OPENSSL_HOME']
+ shutil.copy('%s/bin/openssl' % ssl, 'Ice-%s/bin' % version)
+# runprog('cp -R ' + ssl + '/include Ice-' + version)
+ runprog('cp ' + ssl + '/lib/lib*.sl.* Ice-' + version + '/lib')
+ runprog('rm -rf Ice-' + version + '/lib/libfips*')
runprog('rm -rf Ice-' + version + '/lib/engines')
- runprog('rm -rf Ice-' + version + '/lib/pkgconfig')
- runprog('rm -f Ice-' + version + '/lib/*.a')
+ runprog('rm -rf Ice-' + version + '/lib/pkgconfig')
+ runprog('rm -f Ice-' + version + '/lib/*.a')
uname = readcommand('uname')
platformSpecificFiles = [ 'README', 'SOURCES', 'THIRD_PARTY_LICENSE' ]
for psf in platformSpecificFiles:
- cf = os.path.join(installFiles, 'unix', psf + '.' + uname)
- if os.path.exists(cf):
- shutil.copy(cf, os.path.join('Ice-' + version, psf))
+ cf = os.path.join(installFiles, 'unix', psf + '.' + uname)
+ if os.path.exists(cf):
+ shutil.copy(cf, os.path.join('Ice-' + version, psf))
#
# Remove build files from binary distribution.
diff --git a/cpp/makedist.py b/cpp/makedist.py
index 32993c47217..b0e635c2780 100755
--- a/cpp/makedist.py
+++ b/cpp/makedist.py
@@ -185,9 +185,9 @@ def fixVersion(files, version, mmversion):
os.rename(file, origfile)
oldFile = open(origfile, "r")
newFile = open(file, "w")
- line = oldFile.read();
- line = re.sub("@ver@", version, line)
- line = re.sub("@mmver@", mmversion, line)
+ line = oldFile.read();
+ line = re.sub("@ver@", version, line)
+ line = re.sub("@mmver@", mmversion, line)
newFile.write(line)
newFile.close()
oldFile.close()
diff --git a/cpp/slice/Glacier2/Router.ice b/cpp/slice/Glacier2/Router.ice
index 05a5e87b8c5..dc94a93a216 100644
--- a/cpp/slice/Glacier2/Router.ice
+++ b/cpp/slice/Glacier2/Router.ice
@@ -108,7 +108,7 @@ interface Router extends Ice::Router
*
**/
Session* createSession(string userId, string password)
- throws PermissionDeniedException, CannotCreateSessionException;
+ throws PermissionDeniedException, CannotCreateSessionException;
/**
*
@@ -140,7 +140,7 @@ interface Router extends Ice::Router
*
**/
Session* createSessionFromSecureConnection()
- throws PermissionDeniedException, CannotCreateSessionException;
+ throws PermissionDeniedException, CannotCreateSessionException;
/**
*
@@ -151,7 +151,7 @@ interface Router extends Ice::Router
*
**/
void destroySession()
- throws SessionNotExistException;
+ throws SessionNotExistException;
/**
*
diff --git a/cpp/slice/Glacier2/Session.ice b/cpp/slice/Glacier2/Session.ice
index f32bb1103a4..d8c725a99e4 100644
--- a/cpp/slice/Glacier2/Session.ice
+++ b/cpp/slice/Glacier2/Session.ice
@@ -229,7 +229,7 @@ interface SessionManager
*
**/
Session* create(string userId, SessionControl* control)
- throws CannotCreateSessionException;
+ throws CannotCreateSessionException;
};
/**
@@ -261,7 +261,7 @@ interface SSLSessionManager
*
**/
Session* create(SSLInfo info, SessionControl* control)
- throws CannotCreateSessionException;
+ throws CannotCreateSessionException;
};
};
diff --git a/cpp/slice/Ice/Locator.ice b/cpp/slice/Ice/Locator.ice
index b5f786b272d..7c724c55d8d 100644
--- a/cpp/slice/Ice/Locator.ice
+++ b/cpp/slice/Ice/Locator.ice
@@ -92,7 +92,7 @@ interface Locator
*
**/
["amd", "nonmutating", "cpp:const"] idempotent Object* findObjectById(Ice::Identity id)
- throws ObjectNotFoundException;
+ throws ObjectNotFoundException;
/**
*
@@ -108,7 +108,7 @@ interface Locator
*
**/
["amd", "nonmutating", "cpp:const"] idempotent Object* findAdapterById(string id)
- throws AdapterNotFoundException;
+ throws AdapterNotFoundException;
/**
*
@@ -153,7 +153,7 @@ interface LocatorRegistry
*
**/
["amd", "ami"] idempotent void setAdapterDirectProxy(string id, Object* proxy)
- throws AdapterNotFoundException, AdapterAlreadyActiveException;
+ throws AdapterNotFoundException, AdapterAlreadyActiveException;
/**
*
@@ -181,7 +181,7 @@ interface LocatorRegistry
*
**/
["amd", "ami"] idempotent void setReplicatedAdapterDirectProxy(string adapterId, string replicaGroupId, Object* p)
- throws AdapterNotFoundException, AdapterAlreadyActiveException, InvalidReplicaGroupIdException;
+ throws AdapterNotFoundException, AdapterAlreadyActiveException, InvalidReplicaGroupIdException;
/**
*
@@ -196,7 +196,7 @@ interface LocatorRegistry
*
**/
["amd"] idempotent void setServerProcessProxy(string id, Process* proxy)
- throws ServerNotFoundException;
+ throws ServerNotFoundException;
};
};
diff --git a/cpp/slice/IceGrid/Admin.ice b/cpp/slice/IceGrid/Admin.ice
index 126af90baf0..f682430d39a 100644
--- a/cpp/slice/IceGrid/Admin.ice
+++ b/cpp/slice/IceGrid/Admin.ice
@@ -397,7 +397,7 @@ interface Admin
*
**/
["ami"] void addApplication(ApplicationDescriptor descriptor)
- throws AccessDeniedException, DeploymentException;
+ throws AccessDeniedException, DeploymentException;
/**
*
@@ -419,7 +419,7 @@ interface Admin
*
**/
["ami"] void syncApplication(ApplicationDescriptor descriptor)
- throws AccessDeniedException, DeploymentException, ApplicationNotExistException;
+ throws AccessDeniedException, DeploymentException, ApplicationNotExistException;
/**
*
@@ -440,7 +440,7 @@ interface Admin
*
**/
["ami"] void updateApplication(ApplicationUpdateDescriptor descriptor)
- throws AccessDeniedException, DeploymentException, ApplicationNotExistException;
+ throws AccessDeniedException, DeploymentException, ApplicationNotExistException;
/**
*
@@ -457,7 +457,7 @@ interface Admin
*
**/
["ami"] void removeApplication(string name)
- throws AccessDeniedException, DeploymentException, ApplicationNotExistException;
+ throws AccessDeniedException, DeploymentException, ApplicationNotExistException;
/**
*
@@ -483,7 +483,7 @@ interface Admin
*
**/
void instantiateServer(string application, string node, ServerInstanceDescriptor desc)
- throws AccessDeniedException, ApplicationNotExistException, DeploymentException;
+ throws AccessDeniedException, ApplicationNotExistException, DeploymentException;
/**
*
@@ -501,7 +501,7 @@ interface Admin
*
**/
["ami", "amd"] void patchApplication(string name, bool shutdown)
- throws ApplicationNotExistException, PatchException;
+ throws ApplicationNotExistException, PatchException;
/**
*
@@ -516,7 +516,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent ApplicationInfo getApplicationInfo(string name)
- throws ApplicationNotExistException;
+ throws ApplicationNotExistException;
/**
*
@@ -527,7 +527,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent ApplicationDescriptor getDefaultApplicationDescriptor()
- throws DeploymentException;
+ throws DeploymentException;
/**
*
@@ -550,7 +550,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent ServerInfo getServerInfo(string id)
- throws ServerNotExistException;
+ throws ServerNotExistException;
/**
*
@@ -570,7 +570,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent ServerState getServerState(string id)
- throws ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -591,7 +591,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent int getServerPid(string id)
- throws ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -614,7 +614,7 @@ interface Admin
*
**/
["ami"] idempotent void enableServer(string id, bool enabled)
- throws ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -633,7 +633,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent bool isServerEnabled(string id)
- throws ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -658,7 +658,7 @@ interface Admin
*
**/
["ami"] void startServer(string id)
- throws ServerNotExistException, ServerStartException, NodeUnreachableException, DeploymentException;
+ throws ServerNotExistException, ServerStartException, NodeUnreachableException, DeploymentException;
/**
*
@@ -680,7 +680,7 @@ interface Admin
*
**/
["ami"] void stopServer(string id)
- throws ServerNotExistException, ServerStopException, NodeUnreachableException, DeploymentException;
+ throws ServerNotExistException, ServerStopException, NodeUnreachableException, DeploymentException;
/**
*
@@ -704,7 +704,7 @@ interface Admin
*
**/
["ami", "amd"] void patchServer(string id, bool shutdown)
- throws ServerNotExistException, NodeUnreachableException, DeploymentException, PatchException;
+ throws ServerNotExistException, NodeUnreachableException, DeploymentException, PatchException;
/**
*
@@ -728,7 +728,7 @@ interface Admin
*
**/
["ami"] void sendSignal(string id, string signal)
- throws ServerNotExistException, NodeUnreachableException, DeploymentException, BadSignalException;
+ throws ServerNotExistException, NodeUnreachableException, DeploymentException, BadSignalException;
/**
*
@@ -751,7 +751,7 @@ interface Admin
*
**/
["ami"] void writeMessage(string id, string message, int fd)
- throws ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -780,7 +780,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent AdapterInfoSeq getAdapterInfo(string id)
- throws AdapterNotExistException;
+ throws AdapterNotExistException;
/**
*
@@ -791,7 +791,7 @@ interface Admin
*
**/
["ami"] void removeAdapter(string adapterId)
- throws AdapterNotExistException, DeploymentException;
+ throws AdapterNotExistException, DeploymentException;
/**
*
@@ -819,7 +819,7 @@ interface Admin
*
**/
["ami"] void addObject(Object* obj)
- throws ObjectExistsException, DeploymentException;
+ throws ObjectExistsException, DeploymentException;
/**
*
@@ -839,7 +839,7 @@ interface Admin
*
**/
void updateObject(Object* obj)
- throws ObjectNotRegisteredException, DeploymentException;
+ throws ObjectNotRegisteredException, DeploymentException;
/**
*
@@ -855,7 +855,7 @@ interface Admin
*
**/
["ami"] void addObjectWithType(Object* obj, string type)
- throws ObjectExistsException, DeploymentException;
+ throws ObjectExistsException, DeploymentException;
/**
*
@@ -876,7 +876,7 @@ interface Admin
*
**/
["ami"] void removeObject(Ice::Identity id)
- throws ObjectNotRegisteredException, DeploymentException;
+ throws ObjectNotRegisteredException, DeploymentException;
/**
*
@@ -891,7 +891,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent ObjectInfo getObjectInfo(Ice::Identity id)
- throws ObjectNotRegisteredException;
+ throws ObjectNotRegisteredException;
/**
*
@@ -932,7 +932,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent bool pingNode(string name)
- throws NodeNotExistException;
+ throws NodeNotExistException;
/**
*
@@ -949,7 +949,7 @@ interface Admin
*
**/
["ami", "nonmutating", "cpp:const"] idempotent LoadInfo getNodeLoad(string name)
- throws NodeNotExistException, NodeUnreachableException;
+ throws NodeNotExistException, NodeUnreachableException;
/**
*
@@ -966,7 +966,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent NodeInfo getNodeInfo(string name)
- throws NodeNotExistException, NodeUnreachableException;
+ throws NodeNotExistException, NodeUnreachableException;
/**
*
@@ -981,7 +981,7 @@ interface Admin
*
**/
["ami"] void shutdownNode(string name)
- throws NodeNotExistException, NodeUnreachableException;
+ throws NodeNotExistException, NodeUnreachableException;
/**
*
@@ -998,7 +998,7 @@ interface Admin
*
**/
["nonmutating", "cpp:const"] idempotent string getNodeHostname(string name)
- throws NodeNotExistException, NodeUnreachableException;
+ throws NodeNotExistException, NodeUnreachableException;
/**
*
@@ -1021,7 +1021,7 @@ interface Admin
*
**/
["cpp:const"] idempotent bool pingRegistry(string name)
- throws RegistryNotExistException;
+ throws RegistryNotExistException;
/**
*
@@ -1038,7 +1038,7 @@ interface Admin
*
**/
["cpp:const"] idempotent RegistryInfo getRegistryInfo(string name)
- throws RegistryNotExistException, RegistryUnreachableException;
+ throws RegistryNotExistException, RegistryUnreachableException;
/**
*
@@ -1053,7 +1053,7 @@ interface Admin
*
**/
["ami"] idempotent void shutdownRegistry(string name)
- throws RegistryNotExistException, RegistryUnreachableException;
+ throws RegistryNotExistException, RegistryUnreachableException;
/**
*
@@ -1109,7 +1109,7 @@ interface FileIterator
*
**/
bool read(int size, out Ice::StringSeq lines)
- throws FileNotAvailableException;
+ throws FileNotAvailableException;
/**
*
@@ -1179,8 +1179,8 @@ interface AdminSession extends Glacier2::Session
*
**/
idempotent void setObservers(RegistryObserver* registryObs, NodeObserver* nodeObs, ApplicationObserver* appObs,
- AdapterObserver* adptObs, ObjectObserver* objObs)
- throws ObserverAlreadyRegisteredException;
+ AdapterObserver* adptObs, ObjectObserver* objObs)
+ throws ObserverAlreadyRegisteredException;
/**
*
@@ -1205,8 +1205,8 @@ interface AdminSession extends Glacier2::Session
*
**/
idempotent void setObserversByIdentity(Ice::Identity registryObs, Ice::Identity nodeObs, Ice::Identity appObs,
- Ice::Identity adptObs, Ice::Identity objObs)
- throws ObserverAlreadyRegisteredException;
+ Ice::Identity adptObs, Ice::Identity objObs)
+ throws ObserverAlreadyRegisteredException;
/**
*
@@ -1220,7 +1220,7 @@ interface AdminSession extends Glacier2::Session
*
**/
int startUpdate()
- throws AccessDeniedException;
+ throws AccessDeniedException;
/**
*
@@ -1231,7 +1231,7 @@ interface AdminSession extends Glacier2::Session
*
**/
void finishUpdate()
- throws AccessDeniedException;
+ throws AccessDeniedException;
/**
*
@@ -1273,7 +1273,7 @@ interface AdminSession extends Glacier2::Session
*
**/
FileIterator* openServerLog(string id, string path, int count)
- throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -1302,7 +1302,7 @@ interface AdminSession extends Glacier2::Session
*
**/
FileIterator* openServerStdErr(string id, int count)
- throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -1331,7 +1331,7 @@ interface AdminSession extends Glacier2::Session
*
**/
FileIterator* openServerStdOut(string id, int count)
- throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException, DeploymentException;
+ throws FileNotAvailableException, ServerNotExistException, NodeUnreachableException, DeploymentException;
/**
*
@@ -1356,7 +1356,7 @@ interface AdminSession extends Glacier2::Session
*
**/
FileIterator* openNodeStdErr(string name, int count)
- throws FileNotAvailableException, NodeNotExistException, NodeUnreachableException;
+ throws FileNotAvailableException, NodeNotExistException, NodeUnreachableException;
/**
*
@@ -1381,7 +1381,7 @@ interface AdminSession extends Glacier2::Session
*
**/
FileIterator* openNodeStdOut(string name, int count)
- throws FileNotAvailableException, NodeNotExistException, NodeUnreachableException;
+ throws FileNotAvailableException, NodeNotExistException, NodeUnreachableException;
/**
*
@@ -1407,7 +1407,7 @@ interface AdminSession extends Glacier2::Session
*
**/
FileIterator* openRegistryStdErr(string name, int count)
- throws FileNotAvailableException, RegistryNotExistException, RegistryUnreachableException;
+ throws FileNotAvailableException, RegistryNotExistException, RegistryUnreachableException;
/**
*
@@ -1433,7 +1433,7 @@ interface AdminSession extends Glacier2::Session
*
**/
FileIterator * openRegistryStdOut(string name, int count)
- throws FileNotAvailableException, RegistryNotExistException, RegistryUnreachableException;
+ throws FileNotAvailableException, RegistryNotExistException, RegistryUnreachableException;
};
};
diff --git a/cpp/slice/IceGrid/FileParser.ice b/cpp/slice/IceGrid/FileParser.ice
index 82c21166952..b7c87ac5be3 100755
--- a/cpp/slice/IceGrid/FileParser.ice
+++ b/cpp/slice/IceGrid/FileParser.ice
@@ -52,7 +52,7 @@ interface FileParser
**/
idempotent ApplicationDescriptor parse(string xmlFile, Admin* adminProxy)
- throws ParseException;
+ throws ParseException;
};
};
diff --git a/cpp/slice/IceGrid/Registry.ice b/cpp/slice/IceGrid/Registry.ice
index 4e33a8dbb1a..3fbb6d9ef5c 100644
--- a/cpp/slice/IceGrid/Registry.ice
+++ b/cpp/slice/IceGrid/Registry.ice
@@ -47,7 +47,7 @@ interface Registry
*
**/
Session* createSession(string userId, string password)
- throws PermissionDeniedException;
+ throws PermissionDeniedException;
/**
*
@@ -68,7 +68,7 @@ interface Registry
*
**/
AdminSession* createAdminSession(string userId, string password)
- throws PermissionDeniedException;
+ throws PermissionDeniedException;
/**
*
@@ -89,7 +89,7 @@ interface Registry
*
**/
Session* createSessionFromSecureConnection()
- throws PermissionDeniedException;
+ throws PermissionDeniedException;
/**
*
@@ -106,7 +106,7 @@ interface Registry
*
**/
AdminSession* createAdminSessionFromSecureConnection()
- throws PermissionDeniedException;
+ throws PermissionDeniedException;
/**
*
diff --git a/cpp/slice/IceGrid/Session.ice b/cpp/slice/IceGrid/Session.ice
index bd840cc674f..66e364cc1d8 100644
--- a/cpp/slice/IceGrid/Session.ice
+++ b/cpp/slice/IceGrid/Session.ice
@@ -60,7 +60,7 @@ interface Session extends Glacier2::Session
*
**/
["ami", "amd"] Object* allocateObjectById(Ice::Identity id)
- throws ObjectNotRegisteredException, AllocationException;
+ throws ObjectNotRegisteredException, AllocationException;
/**
*
@@ -81,7 +81,7 @@ interface Session extends Glacier2::Session
*
**/
["ami", "amd"] Object* allocateObjectByType(string type)
- throws AllocationException;
+ throws AllocationException;
/**
*
@@ -101,7 +101,7 @@ interface Session extends Glacier2::Session
*
**/
void releaseObject(Ice::Identity id)
- throws ObjectNotRegisteredException, AllocationException;
+ throws ObjectNotRegisteredException, AllocationException;
/**
*
diff --git a/cpp/slice/IceGrid/UserAccountMapper.ice b/cpp/slice/IceGrid/UserAccountMapper.ice
index 049b9e96c8c..01492f78772 100644
--- a/cpp/slice/IceGrid/UserAccountMapper.ice
+++ b/cpp/slice/IceGrid/UserAccountMapper.ice
@@ -49,7 +49,7 @@ interface UserAccountMapper
*
**/
string getUserAccount(string user)
- throws UserAccountNotFoundException;
+ throws UserAccountNotFoundException;
};
};
diff --git a/cpp/slice/IcePatch2/FileServer.ice b/cpp/slice/IcePatch2/FileServer.ice
index 099f7c2948c..de1c74b3ca2 100644
--- a/cpp/slice/IcePatch2/FileServer.ice
+++ b/cpp/slice/IcePatch2/FileServer.ice
@@ -76,7 +76,7 @@ interface FileServer
*
**/
["ami", "nonmutating", "cpp:const"] idempotent FileInfoSeq getFileInfoSeq(int partition)
- throws PartitionOutOfRangeException;
+ throws PartitionOutOfRangeException;
/**
*
@@ -120,7 +120,7 @@ interface FileServer
**/
["ami", "amd", "nonmutating", "cpp:const", "cpp:array"]
idempotent Ice::ByteSeq getFileCompressed(string path, int pos, int num)
- throws FileAccessException;
+ throws FileAccessException;
};
/**
diff --git a/cpp/slice/IceStorm/IceStorm.ice b/cpp/slice/IceStorm/IceStorm.ice
index f9a543f770a..f816b6d58ec 100644
--- a/cpp/slice/IceStorm/IceStorm.ice
+++ b/cpp/slice/IceStorm/IceStorm.ice
@@ -207,7 +207,7 @@ interface Topic
*
**/
Object* subscribeAndGetPublisher(QoS theQoS, Object* subscriber)
- throws AlreadySubscribed, BadQoS;
+ throws AlreadySubscribed, BadQoS;
/**
*
diff --git a/cpp/src/Freeze/ConnectionI.cpp b/cpp/src/Freeze/ConnectionI.cpp
index 8b823a613ad..3f93a4eebaa 100644
--- a/cpp/src/Freeze/ConnectionI.cpp
+++ b/cpp/src/Freeze/ConnectionI.cpp
@@ -21,7 +21,7 @@ Freeze::ConnectionI::beginTransaction()
{
if(_transaction != 0)
{
- throw TransactionAlreadyInProgressException(__FILE__, __LINE__);
+ throw TransactionAlreadyInProgressException(__FILE__, __LINE__);
}
closeAllIterators();
_transaction = new TransactionI(this);
@@ -39,21 +39,21 @@ Freeze::ConnectionI::close()
{
if(_transaction != 0)
{
- try
- {
- _transaction->rollback();
- }
- catch(const DatabaseException&)
- {
- //
- // Ignored
- //
- }
+ try
+ {
+ _transaction->rollback();
+ }
+ catch(const DatabaseException&)
+ {
+ //
+ // Ignored
+ //
+ }
}
while(!_mapList.empty())
{
- (*_mapList.begin())->close();
+ (*_mapList.begin())->close();
}
_dbEnv = 0;
@@ -79,7 +79,7 @@ Freeze::ConnectionI::~ConnectionI()
}
Freeze::ConnectionI::ConnectionI(const CommunicatorPtr& communicator,
- const string& envName, DbEnv* dbEnv) :
+ const string& envName, DbEnv* dbEnv) :
_communicator(communicator),
_dbEnv(SharedDbEnv::get(communicator, envName, dbEnv)),
_envName(envName),
@@ -93,9 +93,9 @@ void
Freeze::ConnectionI::closeAllIterators()
{
for(list<MapHelperI*>::iterator p = _mapList.begin(); p != _mapList.end();
- ++p)
+ ++p)
{
- (*p)->closeAllIterators();
+ (*p)->closeAllIterators();
}
}
@@ -113,7 +113,7 @@ Freeze::ConnectionI::unregisterMap(MapHelperI* m)
Freeze::ConnectionPtr
Freeze::createConnection(const CommunicatorPtr& communicator,
- const string& envName)
+ const string& envName)
{
return new ConnectionI(communicator, envName, 0);
@@ -121,8 +121,8 @@ Freeze::createConnection(const CommunicatorPtr& communicator,
Freeze::ConnectionPtr
Freeze::createConnection(const CommunicatorPtr& communicator,
- const string& envName,
- DbEnv& dbEnv)
+ const string& envName,
+ DbEnv& dbEnv)
{
return new ConnectionI(communicator, envName, &dbEnv);
}
diff --git a/cpp/src/Freeze/ConnectionI.h b/cpp/src/Freeze/ConnectionI.h
index 7ee5a59390e..987077b1adf 100644
--- a/cpp/src/Freeze/ConnectionI.h
+++ b/cpp/src/Freeze/ConnectionI.h
@@ -43,7 +43,7 @@ public:
virtual ~ConnectionI();
ConnectionI(const Ice::CommunicatorPtr& communicator,
- const std::string& envName, DbEnv*);
+ const std::string& envName, DbEnv*);
void
closeAllIterators();
@@ -101,11 +101,11 @@ ConnectionI::dbTxn() const
{
if(_transaction == 0)
{
- return 0;
+ return 0;
}
else
{
- return _transaction->dbTxn();
+ return _transaction->dbTxn();
}
}
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp
index 75e1722c004..a3bffc1a2bc 100644
--- a/cpp/src/Freeze/EvictorI.cpp
+++ b/cpp/src/Freeze/EvictorI.cpp
@@ -36,23 +36,23 @@ string Freeze::EvictorI::indexPrefix = "$index:";
Freeze::EvictorPtr
Freeze::createEvictor(const ObjectAdapterPtr& adapter,
- const string& envName,
- const string& filename,
- const ServantInitializerPtr& initializer,
- const vector<IndexPtr>& indices,
- bool createDb)
+ const string& envName,
+ const string& filename,
+ const ServantInitializerPtr& initializer,
+ const vector<IndexPtr>& indices,
+ bool createDb)
{
return new EvictorI(adapter, envName, 0, filename, initializer, indices, createDb);
}
Freeze::EvictorPtr
Freeze::createEvictor(const ObjectAdapterPtr& adapter,
- const string& envName,
- DbEnv& dbEnv,
- const string& filename,
- const ServantInitializerPtr& initializer,
- const vector<IndexPtr>& indices,
- bool createDb)
+ const string& envName,
+ DbEnv& dbEnv,
+ const string& filename,
+ const ServantInitializerPtr& initializer,
+ const vector<IndexPtr>& indices,
+ bool createDb)
{
return new EvictorI(adapter, envName, &dbEnv, filename, initializer, indices, createDb);
}
@@ -78,11 +78,11 @@ handleFatalError(const Freeze::EvictorPtr& evictor, const Ice::CommunicatorPtr&
IceUtil::StaticMutex::Lock lock(fatalErrorCallbackMutex);
if(fatalErrorCallback != 0)
{
- fatalErrorCallback(evictor, communicator);
+ fatalErrorCallback(evictor, communicator);
}
else
{
- ::abort();
+ ::abort();
}
}
@@ -112,7 +112,7 @@ Freeze::DeactivateController::Guard::Guard(DeactivateController& controller) :
Lock sync(controller);
if(controller._deactivated || _controller._deactivating)
{
- throw EvictorDeactivatedException(__FILE__, __LINE__);
+ throw EvictorDeactivatedException(__FILE__, __LINE__);
}
controller._guardCount++;
}
@@ -123,11 +123,11 @@ Freeze::DeactivateController::Guard::~Guard()
_controller._guardCount--;
if(_controller._deactivating && _controller._guardCount == 0)
{
- //
- // Notify all the threads -- although we only want to
- // reach the thread doing the deactivation.
- //
- _controller.notifyAll();
+ //
+ // Notify all the threads -- although we only want to
+ // reach the thread doing the deactivation.
+ //
+ _controller.notifyAll();
}
}
@@ -153,40 +153,40 @@ Freeze::DeactivateController::deactivate()
if(_deactivated)
{
- return false;
+ return false;
}
if(_deactivating)
{
- //
- // Wait for deactivated
- //
- while(!_deactivated)
- {
- wait();
- }
- return false;
+ //
+ // Wait for deactivated
+ //
+ while(!_deactivated)
+ {
+ wait();
+ }
+ return false;
}
else
{
- _deactivating = true;
- while(_guardCount > 0)
- {
- if(_evictor->trace() >= 1)
- {
- Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor");
- out << "*** Waiting for " << _guardCount << " threads to complete before starting deactivation.";
- }
-
- wait();
- }
-
- if(_evictor->trace() >= 1)
- {
- Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor");
- out << "Starting deactivation.";
- }
- return true;
+ _deactivating = true;
+ while(_guardCount > 0)
+ {
+ if(_evictor->trace() >= 1)
+ {
+ Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor");
+ out << "*** Waiting for " << _guardCount << " threads to complete before starting deactivation.";
+ }
+
+ wait();
+ }
+
+ if(_evictor->trace() >= 1)
+ {
+ Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor");
+ out << "Starting deactivation.";
+ }
+ return true;
}
}
@@ -195,8 +195,8 @@ Freeze::DeactivateController::deactivationComplete()
{
if(_evictor->trace() >= 1)
{
- Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor");
- out << "Deactivation complete.";
+ Trace out(_evictor->communicator()->getLogger(), "Freeze.Evictor");
+ out << "Deactivation complete.";
}
Lock sync(*this);
@@ -225,20 +225,20 @@ Freeze::WatchDogThread::run()
while(!_done)
{
- if(_active)
- {
- if(timedWait(_timeout) == false && _active && !_done)
- {
- Error out(_evictor.communicator()->getLogger());
- out << "Fatal error: streaming watch dog thread timed out.";
- out.flush();
- handleFatalError(&_evictor, _evictor.communicator());
- }
- }
- else
- {
- wait();
- }
+ if(_active)
+ {
+ if(timedWait(_timeout) == false && _active && !_done)
+ {
+ Error out(_evictor.communicator()->getLogger());
+ out << "Fatal error: streaming watch dog thread timed out.";
+ out.flush();
+ handleFatalError(&_evictor, _evictor.communicator());
+ }
+ }
+ else
+ {
+ wait();
+ }
}
}
@@ -270,12 +270,12 @@ Freeze::WatchDogThread::terminate()
//
Freeze::EvictorI::EvictorI(const ObjectAdapterPtr& adapter,
- const string& envName,
- DbEnv* dbEnv,
- const string& filename,
- const ServantInitializerPtr& initializer,
- const vector<IndexPtr>& indices,
- bool createDb) :
+ const string& envName,
+ DbEnv* dbEnv,
+ const string& filename,
+ const ServantInitializerPtr& initializer,
+ const vector<IndexPtr>& indices,
+ bool createDb) :
_evictorSize(10),
_currentEvictorSize(0),
@@ -304,10 +304,10 @@ Freeze::EvictorI::EvictorI(const ObjectAdapterPtr& adapter,
//
_saveSizeTrigger = _communicator->getProperties()->
- getPropertyAsIntWithDefault(propertyPrefix + ".SaveSizeTrigger", 10);
+ getPropertyAsIntWithDefault(propertyPrefix + ".SaveSizeTrigger", 10);
Int savePeriod = _communicator->getProperties()->
- getPropertyAsIntWithDefault(propertyPrefix + ".SavePeriod", 60 * 1000);
+ getPropertyAsIntWithDefault(propertyPrefix + ".SavePeriod", 60 * 1000);
_savePeriod = IceUtil::Time::milliSeconds(savePeriod);
@@ -315,17 +315,17 @@ Freeze::EvictorI::EvictorI(const ObjectAdapterPtr& adapter,
// By default, we save at most 10 * SaveSizeTrigger objects per transaction
//
_maxTxSize = _communicator->getProperties()->
- getPropertyAsIntWithDefault(propertyPrefix + ".MaxTxSize", 10 * _saveSizeTrigger);
+ getPropertyAsIntWithDefault(propertyPrefix + ".MaxTxSize", 10 * _saveSizeTrigger);
if(_maxTxSize <= 0)
{
- _maxTxSize = 100;
- }
+ _maxTxSize = 100;
+ }
bool populateEmptyIndices =
- (_communicator->getProperties()->
- getPropertyAsIntWithDefault(propertyPrefix + ".PopulateEmptyIndices", 0) != 0);
-
+ (_communicator->getProperties()->
+ getPropertyAsIntWithDefault(propertyPrefix + ".PopulateEmptyIndices", 0) != 0);
+
//
// Instantiate all Dbs in 2 steps:
// (1) iterate over the indices and create ObjectStore with indices
@@ -342,57 +342,57 @@ Freeze::EvictorI::EvictorI(const ObjectAdapterPtr& adapter,
for(vector<IndexPtr>::const_iterator i = indices.begin(); i != indices.end(); ++i)
{
- string facet = (*i)->facet();
+ string facet = (*i)->facet();
- StoreMap::iterator q = _storeMap.find(facet);
- if(q == _storeMap.end())
- {
- //
- // New db
- //
+ StoreMap::iterator q = _storeMap.find(facet);
+ if(q == _storeMap.end())
+ {
+ //
+ // New db
+ //
- vector<IndexPtr> storeIndices;
+ vector<IndexPtr> storeIndices;
- for(vector<IndexPtr>::const_iterator r = i; r != indices.end(); ++r)
- {
- if((*r)->facet() == facet)
- {
- storeIndices.push_back(*r);
- }
- }
- ObjectStore* store = new ObjectStore(facet, _createDb, this, storeIndices, populateEmptyIndices);
- _storeMap.insert(StoreMap::value_type(facet, store));
- }
+ for(vector<IndexPtr>::const_iterator r = i; r != indices.end(); ++r)
+ {
+ if((*r)->facet() == facet)
+ {
+ storeIndices.push_back(*r);
+ }
+ }
+ ObjectStore* store = new ObjectStore(facet, _createDb, this, storeIndices, populateEmptyIndices);
+ _storeMap.insert(StoreMap::value_type(facet, store));
+ }
}
for(vector<string>::iterator p = dbs.begin(); p != dbs.end(); ++p)
{
- string facet = *p;
- if(facet == defaultDb)
- {
- facet = "";
- }
-
- pair<StoreMap::iterator, bool> ir =
- _storeMap.insert(StoreMap::value_type(facet, 0));
-
- if(ir.second)
- {
- ir.first->second = new ObjectStore(facet, _createDb, this);
- }
+ string facet = *p;
+ if(facet == defaultDb)
+ {
+ facet = "";
+ }
+
+ pair<StoreMap::iterator, bool> ir =
+ _storeMap.insert(StoreMap::value_type(facet, 0));
+
+ if(ir.second)
+ {
+ ir.first->second = new ObjectStore(facet, _createDb, this);
+ }
}
//
// By default, no stream timeout
//
long streamTimeout = _communicator->getProperties()->
- getPropertyAsIntWithDefault(propertyPrefix+ ".StreamTimeout", 0) * 1000;
+ getPropertyAsIntWithDefault(propertyPrefix+ ".StreamTimeout", 0) * 1000;
if(streamTimeout > 0)
{
- _watchDogThread = new WatchDogThread(streamTimeout, *this);
- _watchDogThread->start();
+ _watchDogThread = new WatchDogThread(streamTimeout, *this);
+ _watchDogThread->start();
}
//
@@ -405,13 +405,13 @@ Freeze::EvictorI::~EvictorI()
{
if(!_deactivateController.deactivated())
{
- Warning out(_communicator->getLogger());
- out << "evictor has not been deactivated";
+ Warning out(_communicator->getLogger());
+ out << "evictor has not been deactivated";
- //
- // Need to deactivate to save objects and join saving thread
- //
- deactivate("");
+ //
+ // Need to deactivate to save objects and join saving thread
+ //
+ deactivate("");
}
//
@@ -419,7 +419,7 @@ Freeze::EvictorI::~EvictorI()
//
for(StoreMap::iterator p = _storeMap.begin(); p != _storeMap.end(); ++p)
{
- delete (*p).second;
+ delete (*p).second;
}
}
@@ -435,7 +435,7 @@ Freeze::EvictorI::setSize(Int evictorSize)
//
if(evictorSize < 0)
{
- return;
+ return;
}
//
@@ -473,35 +473,35 @@ Freeze::EvictorI::addFacet(const ObjectPtr& servant, const Identity& ident, cons
for(;;)
{
- {
- Lock sync(*this);
-
- StoreMap::iterator p = _storeMap.find(facet);
- if(p == _storeMap.end())
- {
- if(store != 0)
- {
- _storeMap.insert(StoreMap::value_type(facet, store));
- }
- }
- else
- {
- delete store;
- store = (*p).second;
- assert(store != 0);
- }
- }
-
- if(store == 0)
- {
- assert(facet != "");
- store = new ObjectStore(facet, _createDb, this);
- // loop
- }
- else
- {
- break; // for(;;)
- }
+ {
+ Lock sync(*this);
+
+ StoreMap::iterator p = _storeMap.find(facet);
+ if(p == _storeMap.end())
+ {
+ if(store != 0)
+ {
+ _storeMap.insert(StoreMap::value_type(facet, store));
+ }
+ }
+ else
+ {
+ delete store;
+ store = (*p).second;
+ assert(store != 0);
+ }
+ }
+
+ if(store == 0)
+ {
+ assert(facet != "");
+ store = new ObjectStore(facet, _createDb, this);
+ // loop
+ }
+ else
+ {
+ break; // for(;;)
+ }
}
assert(store != 0);
@@ -509,103 +509,103 @@ Freeze::EvictorI::addFacet(const ObjectPtr& servant, const Identity& ident, cons
for(;;)
{
- //
- // Create a new entry
- //
-
- EvictorElementPtr element = new EvictorElement(*store);
- element->status = EvictorElement::dead;
- EvictorElementPtr oldElt = store->putIfAbsent(ident, element);
+ //
+ // Create a new entry
+ //
+
+ EvictorElementPtr element = new EvictorElement(*store);
+ element->status = EvictorElement::dead;
+ EvictorElementPtr oldElt = store->putIfAbsent(ident, element);
- if(oldElt != 0)
- {
- element = oldElt;
- }
-
- {
- Lock sync(*this);
-
- if(element->stale)
- {
- //
- // Try again
- //
- continue;
- }
- fixEvictPosition(element);
-
- IceUtil::Mutex::Lock lock(element->mutex);
-
- switch(element->status)
- {
- case EvictorElement::clean:
- case EvictorElement::created:
- case EvictorElement::modified:
- {
- alreadyThere = true;
- break;
- }
- case EvictorElement::destroyed:
- {
- element->status = EvictorElement::modified;
- element->rec.servant = servant;
-
- //
- // No need to push it on the modified queue, as a destroyed object
- // is either already on the queue or about to be saved. When saved,
- // it becomes dead.
- //
- break;
- }
- case EvictorElement::dead:
- {
- element->status = EvictorElement::created;
- ObjectRecord& rec = element->rec;
-
- rec.servant = servant;
- rec.stats.creationTime = IceUtil::Time::now().toMilliSeconds();
- rec.stats.lastSaveTime = 0;
- rec.stats.avgSaveTime = 0;
-
- addToModifiedQueue(element);
- break;
- }
- default:
- {
- assert(0);
- break;
- }
- }
- }
- break; // for(;;)
+ if(oldElt != 0)
+ {
+ element = oldElt;
+ }
+
+ {
+ Lock sync(*this);
+
+ if(element->stale)
+ {
+ //
+ // Try again
+ //
+ continue;
+ }
+ fixEvictPosition(element);
+
+ IceUtil::Mutex::Lock lock(element->mutex);
+
+ switch(element->status)
+ {
+ case EvictorElement::clean:
+ case EvictorElement::created:
+ case EvictorElement::modified:
+ {
+ alreadyThere = true;
+ break;
+ }
+ case EvictorElement::destroyed:
+ {
+ element->status = EvictorElement::modified;
+ element->rec.servant = servant;
+
+ //
+ // No need to push it on the modified queue, as a destroyed object
+ // is either already on the queue or about to be saved. When saved,
+ // it becomes dead.
+ //
+ break;
+ }
+ case EvictorElement::dead:
+ {
+ element->status = EvictorElement::created;
+ ObjectRecord& rec = element->rec;
+
+ rec.servant = servant;
+ rec.stats.creationTime = IceUtil::Time::now().toMilliSeconds();
+ rec.stats.lastSaveTime = 0;
+ rec.stats.avgSaveTime = 0;
+
+ addToModifiedQueue(element);
+ break;
+ }
+ default:
+ {
+ assert(0);
+ break;
+ }
+ }
+ }
+ break; // for(;;)
}
if(alreadyThere)
{
- AlreadyRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _communicator->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
+ AlreadyRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _communicator->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
}
if(_trace >= 1)
{
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "added object \"" << _communicator->identityToString(ident) << "\"";
- if(!facet.empty())
- {
- out << " with facet \"" << facet << "\"";
- }
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "added object \"" << _communicator->identityToString(ident) << "\"";
+ if(!facet.empty())
+ {
+ out << " with facet \"" << facet << "\"";
+ }
}
ObjectPrx obj = _adapter->createProxy(ident);
if(!facet.empty())
{
- obj = obj->ice_facet(facet);
+ obj = obj->ice_facet(facet);
}
return obj;
}
@@ -627,108 +627,108 @@ Freeze::EvictorI::removeFacet(const Identity& ident, const string& facet)
if(store != 0)
{
- for(;;)
- {
- //
- // Retrieve object
- //
-
- EvictorElementPtr element = store->pin(ident);
- if(element != 0)
- {
- Lock sync(*this);
- if(element->stale)
- {
- //
- // Try again
- //
- continue;
- }
-
- fixEvictPosition(element);
- {
- IceUtil::Mutex::Lock lock(element->mutex);
-
- switch(element->status)
- {
- case EvictorElement::clean:
- {
- servant = element->rec.servant;
- element->status = EvictorElement::destroyed;
- element->rec.servant = 0;
- addToModifiedQueue(element);
- break;
- }
- case EvictorElement::created:
- {
- servant = element->rec.servant;
- element->status = EvictorElement::dead;
- element->rec.servant = 0;
- break;
- }
- case EvictorElement::modified:
- {
- servant = element->rec.servant;
- element->status = EvictorElement::destroyed;
- element->rec.servant = 0;
- //
- // Not necessary to push it on the modified queue, as a modified
- // element is either on the queue already or about to be saved
- // (at which point it becomes clean)
- //
- break;
- }
- case EvictorElement::destroyed:
- case EvictorElement::dead:
- {
- break;
- }
- default:
- {
- assert(0);
- break;
- }
- }
- }
- if(element->keepCount > 0)
- {
- assert(servant != 0);
-
- element->keepCount = 0;
- //
- // Add to front of evictor queue
- //
- // Note that save evicts dead objects
- //
- _evictorList.push_front(element);
- _currentEvictorSize++;
- element->evictPosition = _evictorList.begin();
- }
- }
- break; // for(;;)
- }
+ for(;;)
+ {
+ //
+ // Retrieve object
+ //
+
+ EvictorElementPtr element = store->pin(ident);
+ if(element != 0)
+ {
+ Lock sync(*this);
+ if(element->stale)
+ {
+ //
+ // Try again
+ //
+ continue;
+ }
+
+ fixEvictPosition(element);
+ {
+ IceUtil::Mutex::Lock lock(element->mutex);
+
+ switch(element->status)
+ {
+ case EvictorElement::clean:
+ {
+ servant = element->rec.servant;
+ element->status = EvictorElement::destroyed;
+ element->rec.servant = 0;
+ addToModifiedQueue(element);
+ break;
+ }
+ case EvictorElement::created:
+ {
+ servant = element->rec.servant;
+ element->status = EvictorElement::dead;
+ element->rec.servant = 0;
+ break;
+ }
+ case EvictorElement::modified:
+ {
+ servant = element->rec.servant;
+ element->status = EvictorElement::destroyed;
+ element->rec.servant = 0;
+ //
+ // Not necessary to push it on the modified queue, as a modified
+ // element is either on the queue already or about to be saved
+ // (at which point it becomes clean)
+ //
+ break;
+ }
+ case EvictorElement::destroyed:
+ case EvictorElement::dead:
+ {
+ break;
+ }
+ default:
+ {
+ assert(0);
+ break;
+ }
+ }
+ }
+ if(element->keepCount > 0)
+ {
+ assert(servant != 0);
+
+ element->keepCount = 0;
+ //
+ // Add to front of evictor queue
+ //
+ // Note that save evicts dead objects
+ //
+ _evictorList.push_front(element);
+ _currentEvictorSize++;
+ element->evictPosition = _evictorList.begin();
+ }
+ }
+ break; // for(;;)
+ }
}
if(servant == 0)
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _communicator->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _communicator->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
}
if(_trace >= 1)
{
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "removed object \"" << _communicator->identityToString(ident) << "\"";
- if(!facet.empty())
- {
- out << " with facet \"" << facet << "\"";
- }
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "removed object \"" << _communicator->identityToString(ident) << "\"";
+ if(!facet.empty())
+ {
+ out << " with facet \"" << facet << "\"";
+ }
}
return servant;
}
@@ -750,77 +750,77 @@ Freeze::EvictorI::keepFacet(const Identity& ident, const string& facet)
ObjectStore* store = findStore(facet);
if(store == 0)
{
- notThere = true;
+ notThere = true;
}
else
{
- for(;;)
- {
- EvictorElementPtr element = store->pin(ident);
- if(element == 0)
- {
- notThere = true;
- break;
- }
-
- Lock sync(*this);
-
- if(element->stale)
- {
- //
- // try again
- //
- continue;
- }
-
-
- {
- IceUtil::Mutex::Lock lockElement(element->mutex);
- if(element->status == EvictorElement::destroyed || element->status == EvictorElement::dead)
- {
- notThere = true;
- break;
- }
- }
-
- //
- // Found!
- //
-
- if(element->keepCount == 0)
- {
- if(element->usageCount < 0)
- {
- //
- // New object
- //
- element->usageCount = 0;
- }
- else
- {
- _evictorList.erase(element->evictPosition);
- _currentEvictorSize--;
- }
- element->keepCount = 1;
- }
- else
- {
- element->keepCount++;
- }
- break;
- }
+ for(;;)
+ {
+ EvictorElementPtr element = store->pin(ident);
+ if(element == 0)
+ {
+ notThere = true;
+ break;
+ }
+
+ Lock sync(*this);
+
+ if(element->stale)
+ {
+ //
+ // try again
+ //
+ continue;
+ }
+
+
+ {
+ IceUtil::Mutex::Lock lockElement(element->mutex);
+ if(element->status == EvictorElement::destroyed || element->status == EvictorElement::dead)
+ {
+ notThere = true;
+ break;
+ }
+ }
+
+ //
+ // Found!
+ //
+
+ if(element->keepCount == 0)
+ {
+ if(element->usageCount < 0)
+ {
+ //
+ // New object
+ //
+ element->usageCount = 0;
+ }
+ else
+ {
+ _evictorList.erase(element->evictPosition);
+ _currentEvictorSize--;
+ }
+ element->keepCount = 1;
+ }
+ else
+ {
+ element->keepCount++;
+ }
+ break;
+ }
}
if(notThere)
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _communicator->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _communicator->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
}
}
@@ -837,38 +837,38 @@ Freeze::EvictorI::releaseFacet(const Identity& ident, const string& facet)
DeactivateController::Guard deactivateGuard(_deactivateController);
{
- Lock sync(*this);
-
- StoreMap::iterator p = _storeMap.find(facet);
- if(p != _storeMap.end())
- {
- ObjectStore* store = (*p).second;
-
- EvictorElementPtr element = store->getIfPinned(ident);
- if(element != 0)
- {
- assert(!element->stale);
- if(element->keepCount > 0)
- {
- if(--element->keepCount == 0)
- {
- //
- // Add to front of evictor queue
- //
- // Note that the element cannot be destroyed or dead since
- // its keepCount was > 0.
- //
- _evictorList.push_front(element);
- _currentEvictorSize++;
- element->evictPosition = _evictorList.begin();
- }
- //
- // Success
- //
- return;
- }
- }
- }
+ Lock sync(*this);
+
+ StoreMap::iterator p = _storeMap.find(facet);
+ if(p != _storeMap.end())
+ {
+ ObjectStore* store = (*p).second;
+
+ EvictorElementPtr element = store->getIfPinned(ident);
+ if(element != 0)
+ {
+ assert(!element->stale);
+ if(element->keepCount > 0)
+ {
+ if(--element->keepCount == 0)
+ {
+ //
+ // Add to front of evictor queue
+ //
+ // Note that the element cannot be destroyed or dead since
+ // its keepCount was > 0.
+ //
+ _evictorList.push_front(element);
+ _currentEvictorSize++;
+ element->evictPosition = _evictorList.begin();
+ }
+ //
+ // Success
+ //
+ return;
+ }
+ }
+ }
}
NotRegisteredException ex(__FILE__, __LINE__);
@@ -876,7 +876,7 @@ Freeze::EvictorI::releaseFacet(const Identity& ident, const string& facet)
ex.id = _communicator->identityToString(ident);
if(!facet.empty())
{
- ex.id += " -f " + IceUtil::escapeString(facet, "");
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
}
throw ex;
}
@@ -888,14 +888,14 @@ Freeze::EvictorI::getIterator(const string& facet, Int batchSize)
ObjectStore* store = 0;
{
- Lock sync(*this);
-
- StoreMap::iterator p = _storeMap.find(facet);
- if(p != _storeMap.end())
- {
- store = (*p).second;
- saveNowNoSync();
- }
+ Lock sync(*this);
+
+ StoreMap::iterator p = _storeMap.find(facet);
+ if(p != _storeMap.end())
+ {
+ store = (*p).second;
+ saveNowNoSync();
+ }
}
return new EvictorIteratorI(store, batchSize);
}
@@ -924,25 +924,25 @@ Freeze::EvictorI::hasFacetImpl(const Identity& ident, const string& facet)
ObjectStore* store = 0;
{
- Lock sync(*this);
+ Lock sync(*this);
- StoreMap::iterator p = _storeMap.find(facet);
- if(p == _storeMap.end())
- {
- return false;
- }
-
- store = (*p).second;
-
- EvictorElementPtr element = store->getIfPinned(ident);
- if(element != 0)
- {
- assert(!element->stale);
-
- IceUtil::Mutex::Lock lock(element->mutex);
- return element->status != EvictorElement::dead &&
- element->status != EvictorElement::destroyed;
- }
+ StoreMap::iterator p = _storeMap.find(facet);
+ if(p == _storeMap.end())
+ {
+ return false;
+ }
+
+ store = (*p).second;
+
+ EvictorElementPtr element = store->getIfPinned(ident);
+ if(element != 0)
+ {
+ assert(!element->stale);
+
+ IceUtil::Mutex::Lock lock(element->mutex);
+ return element->status != EvictorElement::dead &&
+ element->status != EvictorElement::destroyed;
+ }
}
return store->dbHasObject(ident);
}
@@ -960,45 +960,45 @@ Freeze::EvictorI::hasAnotherFacet(const Identity& ident, const string& facet)
//
StoreMap storeMapCopy;
{
- Lock sync(*this);
- storeMapCopy = _storeMap;
- }
-
+ Lock sync(*this);
+ storeMapCopy = _storeMap;
+ }
+
for(StoreMap::iterator p = storeMapCopy.begin(); p != storeMapCopy.end(); ++p)
{
- //
- // Do not check again the given facet
- //
- if((*p).first != facet)
- {
- ObjectStore* store = (*p).second;
-
- bool inCache = false;
- {
- Lock sync(*this);
-
- EvictorElementPtr element = store->getIfPinned(ident);
- if(element != 0)
- {
- inCache = true;
- assert(!element->stale);
-
- IceUtil::Mutex::Lock lock(element->mutex);
- if(element->status != EvictorElement::dead &&
- element->status != EvictorElement::destroyed)
- {
- return true;
- }
- }
- }
- if(!inCache)
- {
- if(store->dbHasObject(ident))
- {
- return true;
- }
- }
- }
+ //
+ // Do not check again the given facet
+ //
+ if((*p).first != facet)
+ {
+ ObjectStore* store = (*p).second;
+
+ bool inCache = false;
+ {
+ Lock sync(*this);
+
+ EvictorElementPtr element = store->getIfPinned(ident);
+ if(element != 0)
+ {
+ inCache = true;
+ assert(!element->stale);
+
+ IceUtil::Mutex::Lock lock(element->mutex);
+ if(element->status != EvictorElement::dead &&
+ element->status != EvictorElement::destroyed)
+ {
+ return true;
+ }
+ }
+ }
+ if(!inCache)
+ {
+ if(store->dbHasObject(ident))
+ {
+ return true;
+ }
+ }
+ }
}
return false;
}
@@ -1018,48 +1018,48 @@ Freeze::EvictorI::locate(const Current& current, LocalObjectPtr& cookie)
//
if(current.operation == "ice_ping")
{
- if(hasFacetImpl(current.id, current.facet))
- {
- if(_trace >= 3)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "ice_ping found \"" << _communicator->identityToString(current.id)
- << "\" with facet \"" << current.facet + "\"";
- }
-
- cookie = 0;
- return _pingObject;
- }
- else if(hasAnotherFacet(current.id, current.facet))
- {
- if(_trace >= 3)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "ice_ping raises FacetNotExistException for \"" << _communicator->identityToString(current.id)
- << "\" with facet \"" << current.facet + "\"";
- }
- throw FacetNotExistException(__FILE__, __LINE__);
- }
- else
- {
- if(_trace >= 3)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "ice_ping will raise ObjectNotExistException for \""
- << _communicator->identityToString(current.id) << "\" with facet \"" << current.facet + "\"";
- }
- return 0;
- }
+ if(hasFacetImpl(current.id, current.facet))
+ {
+ if(_trace >= 3)
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "ice_ping found \"" << _communicator->identityToString(current.id)
+ << "\" with facet \"" << current.facet + "\"";
+ }
+
+ cookie = 0;
+ return _pingObject;
+ }
+ else if(hasAnotherFacet(current.id, current.facet))
+ {
+ if(_trace >= 3)
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "ice_ping raises FacetNotExistException for \"" << _communicator->identityToString(current.id)
+ << "\" with facet \"" << current.facet + "\"";
+ }
+ throw FacetNotExistException(__FILE__, __LINE__);
+ }
+ else
+ {
+ if(_trace >= 3)
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "ice_ping will raise ObjectNotExistException for \""
+ << _communicator->identityToString(current.id) << "\" with facet \"" << current.facet + "\"";
+ }
+ return 0;
+ }
}
ObjectPtr result = locateImpl(current, cookie);
if(result == 0)
{
- if(hasAnotherFacet(current.id, current.facet))
- {
- throw FacetNotExistException(__FILE__, __LINE__);
- }
+ if(hasAnotherFacet(current.id, current.facet))
+ {
+ throw FacetNotExistException(__FILE__, __LINE__);
+ }
}
return result;
}
@@ -1074,65 +1074,65 @@ Freeze::EvictorI::locateImpl(const Current& current, LocalObjectPtr& cookie)
if(store == 0)
{
if(_trace >= 2)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "locate could not find a database for facet \"" << current.facet << "\"";
- }
- return 0;
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "locate could not find a database for facet \"" << current.facet << "\"";
+ }
+ return 0;
}
for(;;)
{
- EvictorElementPtr element = store->pin(current.id);
- if(element == 0)
- {
+ EvictorElementPtr element = store->pin(current.id);
+ if(element == 0)
+ {
if(_trace >= 2)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "locate could not find \"" << _communicator->identityToString(current.id) << "\" in database \""
- << current.facet << "\"";
- }
- return 0;
- }
-
- Lock sync(*this);
-
- if(element->stale)
- {
- //
- // try again
- //
- continue;
- }
-
-
- IceUtil::Mutex::Lock lockElement(element->mutex);
- if(element->status == EvictorElement::destroyed || element->status == EvictorElement::dead)
- {
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "locate could not find \"" << _communicator->identityToString(current.id) << "\" in database \""
+ << current.facet << "\"";
+ }
+ return 0;
+ }
+
+ Lock sync(*this);
+
+ if(element->stale)
+ {
+ //
+ // try again
+ //
+ continue;
+ }
+
+
+ IceUtil::Mutex::Lock lockElement(element->mutex);
+ if(element->status == EvictorElement::destroyed || element->status == EvictorElement::dead)
+ {
if(_trace >= 2)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "locate found \"" << _communicator->identityToString(current.id)
- << "\" in the cache for database \"" << current.facet << "\" but it was dead or destroyed";
- }
- return 0;
- }
-
- //
- // It's a good one!
- //
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "locate found \"" << _communicator->identityToString(current.id)
+ << "\" in the cache for database \"" << current.facet << "\" but it was dead or destroyed";
+ }
+ return 0;
+ }
+
+ //
+ // It's a good one!
+ //
if(_trace >= 2)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "locate found \"" << _communicator->identityToString(current.id) << "\" in database \""
- << current.facet << "\"";
- }
-
- fixEvictPosition(element);
- element->usageCount++;
- cookie = element;
- assert(element->rec.servant != 0);
- return element->rec.servant;
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "locate found \"" << _communicator->identityToString(current.id) << "\" in database \""
+ << current.facet << "\"";
+ }
+
+ fixEvictPosition(element);
+ element->usageCount++;
+ cookie = element;
+ assert(element->rec.servant != 0);
+ return element->rec.servant;
}
}
@@ -1148,51 +1148,51 @@ Freeze::EvictorI::finished(const Current& current, const ObjectPtr& servant, con
if(cookie != 0)
{
- EvictorElementPtr element = EvictorElementPtr::dynamicCast(cookie);
- assert(element);
+ EvictorElementPtr element = EvictorElementPtr::dynamicCast(cookie);
+ assert(element);
- bool enqueue = false;
-
- if((_useNonmutating && current.mode != Nonmutating) ||
- (servant->ice_operationAttributes(current.operation) & 0x1) != 0)
- {
- IceUtil::Mutex::Lock lock(element->mutex);
-
- if(element->status == EvictorElement::clean)
- {
- //
- // Assume this operation updated the object
- //
- element->status = EvictorElement::modified;
- enqueue = true;
- }
- }
-
- Lock sync(*this);
-
- //
- // Only elements with a usageCount == 0 can become stale and we own
- // one count!
- //
- assert(!element->stale);
- assert(element->usageCount >= 1);
-
- //
- // Decrease the usage count of the evictor queue element.
- //
- element->usageCount--;
-
- if(enqueue)
- {
- addToModifiedQueue(element);
- }
- else if(element->usageCount == 0 && element->keepCount == 0)
- {
- //
- // Evict as many elements as necessary.
- //
- evict();
- }
+ bool enqueue = false;
+
+ if((_useNonmutating && current.mode != Nonmutating) ||
+ (servant->ice_operationAttributes(current.operation) & 0x1) != 0)
+ {
+ IceUtil::Mutex::Lock lock(element->mutex);
+
+ if(element->status == EvictorElement::clean)
+ {
+ //
+ // Assume this operation updated the object
+ //
+ element->status = EvictorElement::modified;
+ enqueue = true;
+ }
+ }
+
+ Lock sync(*this);
+
+ //
+ // Only elements with a usageCount == 0 can become stale and we own
+ // one count!
+ //
+ assert(!element->stale);
+ assert(element->usageCount >= 1);
+
+ //
+ // Decrease the usage count of the evictor queue element.
+ //
+ element->usageCount--;
+
+ if(enqueue)
+ {
+ addToModifiedQueue(element);
+ }
+ else if(element->usageCount == 0 && element->keepCount == 0)
+ {
+ //
+ // Evict as many elements as necessary.
+ //
+ evict();
+ }
}
}
@@ -1201,44 +1201,44 @@ Freeze::EvictorI::deactivate(const string&)
{
if(_deactivateController.deactivate())
{
- try
- {
- Lock sync(*this);
-
- saveNowNoSync();
-
- //
- // Set the evictor size to zero, meaning that we will evict
- // everything possible.
- //
- _evictorSize = 0;
- evict();
-
- _savingThreadDone = true;
- notifyAll();
- sync.release();
- getThreadControl().join();
-
- if(_watchDogThread != 0)
- {
- _watchDogThread->terminate();
- _watchDogThread->getThreadControl().join();
- }
-
- for(StoreMap::iterator p = _storeMap.begin(); p != _storeMap.end(); ++p)
- {
- (*p).second->close();
- }
-
- _dbEnv = 0;
- _initializer = 0;
- }
- catch(...)
- {
- _deactivateController.deactivationComplete();
- throw;
- }
- _deactivateController.deactivationComplete();
+ try
+ {
+ Lock sync(*this);
+
+ saveNowNoSync();
+
+ //
+ // Set the evictor size to zero, meaning that we will evict
+ // everything possible.
+ //
+ _evictorSize = 0;
+ evict();
+
+ _savingThreadDone = true;
+ notifyAll();
+ sync.release();
+ getThreadControl().join();
+
+ if(_watchDogThread != 0)
+ {
+ _watchDogThread->terminate();
+ _watchDogThread->getThreadControl().join();
+ }
+
+ for(StoreMap::iterator p = _storeMap.begin(); p != _storeMap.end(); ++p)
+ {
+ (*p).second->close();
+ }
+
+ _dbEnv = 0;
+ _initializer = 0;
+ }
+ catch(...)
+ {
+ _deactivateController.deactivationComplete();
+ throw;
+ }
+ _deactivateController.deactivationComplete();
}
}
@@ -1248,7 +1248,7 @@ Freeze::EvictorI::initialize(const Identity& ident, const string& facet, const O
{
if(_initializer != 0)
{
- _initializer->initialize(_adapter, ident, facet, servant);
+ _initializer->initialize(_adapter, ident, facet, servant);
}
}
@@ -1258,387 +1258,387 @@ Freeze::EvictorI::run()
{
try
{
- for(;;)
- {
- deque<EvictorElementPtr> allObjects;
- deque<EvictorElementPtr> deadObjects;
-
- size_t saveNowThreadsSize = 0;
-
- {
- Lock sync(*this);
-
- while(!_savingThreadDone &&
- (_saveNowThreads.size() == 0) &&
- (_saveSizeTrigger < 0 || static_cast<Int>(_modifiedQueue.size()) < _saveSizeTrigger))
- {
- if(_savePeriod == IceUtil::Time::milliSeconds(0))
- {
- wait();
- }
- else if(timedWait(_savePeriod) == false)
- {
- //
- // Timeout, so let's save
- //
- break; // while
- }
- }
-
- saveNowThreadsSize = _saveNowThreads.size();
-
- if(_savingThreadDone)
- {
- assert(_modifiedQueue.size() == 0);
- assert(saveNowThreadsSize == 0);
- break; // for(;;)
- }
-
- //
- // Check first if there is something to do!
- //
- if(_modifiedQueue.size() == 0)
- {
- if(saveNowThreadsSize > 0)
- {
- _saveNowThreads.clear();
- notifyAll();
- }
- continue; // for(;;)
- }
-
- _modifiedQueue.swap(allObjects);
- }
-
- const size_t size = allObjects.size();
-
- deque<StreamedObject> streamedObjectQueue;
-
- Long streamStart = IceUtil::Time::now().toMilliSeconds();
-
- //
- // Stream each element
- //
- for(size_t i = 0; i < size; i++)
- {
- EvictorElementPtr& element = allObjects[i];
-
- bool tryAgain;
- do
- {
- tryAgain = false;
- ObjectPtr servant = 0;
-
- //
- // These elements can't be stale as only elements with
- // usageCount == 0 can become stale, and the modifiedQueue
- // (us now) owns one count.
- //
-
- IceUtil::Mutex::Lock lockElement(element->mutex);
- Byte status = element->status;
-
- switch(status)
- {
- case EvictorElement::created:
- case EvictorElement::modified:
- {
- servant = element->rec.servant;
- break;
- }
- case EvictorElement::destroyed:
- {
- size_t index = streamedObjectQueue.size();
- streamedObjectQueue.resize(index + 1);
- StreamedObject& obj = streamedObjectQueue[index];
- stream(element, streamStart, obj);
-
- element->status = EvictorElement::dead;
- deadObjects.push_back(element);
-
- break;
- }
- case EvictorElement::dead:
- {
- deadObjects.push_back(element);
- break;
- }
- default:
- {
- //
- // Nothing to do (could be a duplicate)
- //
- break;
- }
- }
- if(servant == 0)
- {
- lockElement.release();
- }
- else
- {
- IceUtil::AbstractMutex* mutex = dynamic_cast<IceUtil::AbstractMutex*>(servant.get());
- if(mutex != 0)
- {
- //
- // Lock servant and then element so that user can safely lock
- // servant and call various Evictor operations
- //
-
- IceUtil::AbstractMutex::TryLock lockServant(*mutex);
- if(!lockServant.acquired())
- {
- lockElement.release();
-
- if(_watchDogThread != 0)
- {
- _watchDogThread->activate();
- }
- lockServant.acquire();
- if(_watchDogThread != 0)
- {
- _watchDogThread->deactivate();
- }
-
- lockElement.acquire();
- status = element->status;
- }
+ for(;;)
+ {
+ deque<EvictorElementPtr> allObjects;
+ deque<EvictorElementPtr> deadObjects;
+
+ size_t saveNowThreadsSize = 0;
+
+ {
+ Lock sync(*this);
+
+ while(!_savingThreadDone &&
+ (_saveNowThreads.size() == 0) &&
+ (_saveSizeTrigger < 0 || static_cast<Int>(_modifiedQueue.size()) < _saveSizeTrigger))
+ {
+ if(_savePeriod == IceUtil::Time::milliSeconds(0))
+ {
+ wait();
+ }
+ else if(timedWait(_savePeriod) == false)
+ {
+ //
+ // Timeout, so let's save
+ //
+ break; // while
+ }
+ }
+
+ saveNowThreadsSize = _saveNowThreads.size();
+
+ if(_savingThreadDone)
+ {
+ assert(_modifiedQueue.size() == 0);
+ assert(saveNowThreadsSize == 0);
+ break; // for(;;)
+ }
+
+ //
+ // Check first if there is something to do!
+ //
+ if(_modifiedQueue.size() == 0)
+ {
+ if(saveNowThreadsSize > 0)
+ {
+ _saveNowThreads.clear();
+ notifyAll();
+ }
+ continue; // for(;;)
+ }
+
+ _modifiedQueue.swap(allObjects);
+ }
+
+ const size_t size = allObjects.size();
+
+ deque<StreamedObject> streamedObjectQueue;
+
+ Long streamStart = IceUtil::Time::now().toMilliSeconds();
+
+ //
+ // Stream each element
+ //
+ for(size_t i = 0; i < size; i++)
+ {
+ EvictorElementPtr& element = allObjects[i];
+
+ bool tryAgain;
+ do
+ {
+ tryAgain = false;
+ ObjectPtr servant = 0;
+
+ //
+ // These elements can't be stale as only elements with
+ // usageCount == 0 can become stale, and the modifiedQueue
+ // (us now) owns one count.
+ //
+
+ IceUtil::Mutex::Lock lockElement(element->mutex);
+ Byte status = element->status;
+
+ switch(status)
+ {
+ case EvictorElement::created:
+ case EvictorElement::modified:
+ {
+ servant = element->rec.servant;
+ break;
+ }
+ case EvictorElement::destroyed:
+ {
+ size_t index = streamedObjectQueue.size();
+ streamedObjectQueue.resize(index + 1);
+ StreamedObject& obj = streamedObjectQueue[index];
+ stream(element, streamStart, obj);
+
+ element->status = EvictorElement::dead;
+ deadObjects.push_back(element);
+
+ break;
+ }
+ case EvictorElement::dead:
+ {
+ deadObjects.push_back(element);
+ break;
+ }
+ default:
+ {
+ //
+ // Nothing to do (could be a duplicate)
+ //
+ break;
+ }
+ }
+ if(servant == 0)
+ {
+ lockElement.release();
+ }
+ else
+ {
+ IceUtil::AbstractMutex* mutex = dynamic_cast<IceUtil::AbstractMutex*>(servant.get());
+ if(mutex != 0)
+ {
+ //
+ // Lock servant and then element so that user can safely lock
+ // servant and call various Evictor operations
+ //
+
+ IceUtil::AbstractMutex::TryLock lockServant(*mutex);
+ if(!lockServant.acquired())
+ {
+ lockElement.release();
+
+ if(_watchDogThread != 0)
+ {
+ _watchDogThread->activate();
+ }
+ lockServant.acquire();
+ if(_watchDogThread != 0)
+ {
+ _watchDogThread->deactivate();
+ }
+
+ lockElement.acquire();
+ status = element->status;
+ }
- switch(status)
- {
- case EvictorElement::created:
- case EvictorElement::modified:
- {
- if(servant == element->rec.servant)
- {
- size_t index = streamedObjectQueue.size();
- streamedObjectQueue.resize(index + 1);
- StreamedObject& obj = streamedObjectQueue[index];
- stream(element, streamStart, obj);
-
- element->status = EvictorElement::clean;
- }
- else
- {
- tryAgain = true;
- }
- break;
- }
- case EvictorElement::destroyed:
- {
- lockServant.release();
-
- size_t index = streamedObjectQueue.size();
- streamedObjectQueue.resize(index + 1);
- StreamedObject& obj = streamedObjectQueue[index];
- stream(element, streamStart, obj);
-
- element->status = EvictorElement::dead;
- deadObjects.push_back(element);
- break;
- }
- case EvictorElement::dead:
- {
- deadObjects.push_back(element);
- break;
- }
- default:
- {
- //
- // Nothing to do (could be a duplicate)
- //
- break;
- }
- }
- }
- else
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = string(typeid(*element->rec.servant).name())
- + " does not implement IceUtil::AbstractMutex";
- throw ex;
- }
- }
- } while(tryAgain);
- }
-
- if(_trace >= 1)
- {
- Long now = IceUtil::Time::now().toMilliSeconds();
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "streamed " << streamedObjectQueue.size() << " objects in "
- << static_cast<Int>(now - streamStart) << " ms";
- }
-
- //
- // Now let's save all these streamed objects to disk using a transaction
- //
-
- //
- // Each time we get a deadlock, we reduce the number of objects to save
- // per transaction
- //
- size_t txSize = streamedObjectQueue.size();
- if(txSize > static_cast<size_t>(_maxTxSize))
- {
- txSize = static_cast<size_t>(_maxTxSize);
- }
- bool tryAgain;
-
- do
- {
- tryAgain = false;
-
- while(streamedObjectQueue.size() > 0)
- {
- if(txSize > streamedObjectQueue.size())
- {
- txSize = streamedObjectQueue.size();
- }
-
- Long saveStart = IceUtil::Time::now().toMilliSeconds();
- try
- {
- DbTxn* tx = 0;
- _dbEnv->getEnv()->txn_begin(0, &tx, 0);
-
- long txnId = 0;
- if(_txTrace >= 1)
- {
- txnId = (tx->id() & 0x7FFFFFFF) + 0x80000000L;
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "started transaction " << hex << txnId << dec << " in saving thread";
- }
-
- try
- {
- for(size_t i = 0; i < txSize; i++)
- {
- StreamedObject& obj = streamedObjectQueue[i];
- obj.store->save(obj.key, obj.value, obj.status, tx);
- }
- }
- catch(...)
- {
- tx->abort();
- if(_txTrace >= 1)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "rolled back transaction " << hex << txnId << dec;
- }
- throw;
- }
- tx->commit(0);
-
- if(_txTrace >= 1)
- {
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "committed transaction " << hex << txnId << dec;
- }
-
- streamedObjectQueue.erase
- (streamedObjectQueue.begin(),
- streamedObjectQueue.begin() + txSize);
-
- if(_trace >= 1)
- {
- Long now = IceUtil::Time::now().toMilliSeconds();
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "saved " << txSize << " objects in "
- << static_cast<Int>(now - saveStart) << " ms";
- }
- }
- catch(const DbDeadlockException&)
- {
- if(_deadlockWarning)
- {
- Warning out(_communicator->getLogger());
- out << "Deadlock in Freeze::EvictorI::run while writing into Db \"" + _filename
- + "\"; retrying ...";
- }
-
- tryAgain = true;
- txSize = (txSize + 1)/2;
- }
- catch(const DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- }
- }
- while(tryAgain);
-
- {
- Lock sync(*this);
-
- //
- // Release usage count
- //
- for(deque<EvictorElementPtr>::iterator p = allObjects.begin();
- p != allObjects.end(); p++)
- {
- EvictorElementPtr& element = *p;
- element->usageCount--;
- }
- allObjects.clear();
-
- for(deque<EvictorElementPtr>::iterator q = deadObjects.begin();
- q != deadObjects.end(); q++)
- {
- EvictorElementPtr& element = *q;
- if(!element->stale)
- {
- //
- // Can be stale when there are duplicate elements on the
- // deadObjecst queue
- //
-
- if(!element->stale && element->usageCount == 0 && element->keepCount == 0)
- {
- //
- // Get rid of unused dead elements
- //
- IceUtil::Mutex::Lock lockElement(element->mutex);
- if(element->status == EvictorElement::dead)
- {
- evict(element);
- }
- }
- }
- }
- deadObjects.clear();
- evict();
-
- if(saveNowThreadsSize > 0)
- {
- _saveNowThreads.erase(_saveNowThreads.begin(), _saveNowThreads.begin() + saveNowThreadsSize);
- notifyAll();
- }
- }
- }
+ switch(status)
+ {
+ case EvictorElement::created:
+ case EvictorElement::modified:
+ {
+ if(servant == element->rec.servant)
+ {
+ size_t index = streamedObjectQueue.size();
+ streamedObjectQueue.resize(index + 1);
+ StreamedObject& obj = streamedObjectQueue[index];
+ stream(element, streamStart, obj);
+
+ element->status = EvictorElement::clean;
+ }
+ else
+ {
+ tryAgain = true;
+ }
+ break;
+ }
+ case EvictorElement::destroyed:
+ {
+ lockServant.release();
+
+ size_t index = streamedObjectQueue.size();
+ streamedObjectQueue.resize(index + 1);
+ StreamedObject& obj = streamedObjectQueue[index];
+ stream(element, streamStart, obj);
+
+ element->status = EvictorElement::dead;
+ deadObjects.push_back(element);
+ break;
+ }
+ case EvictorElement::dead:
+ {
+ deadObjects.push_back(element);
+ break;
+ }
+ default:
+ {
+ //
+ // Nothing to do (could be a duplicate)
+ //
+ break;
+ }
+ }
+ }
+ else
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = string(typeid(*element->rec.servant).name())
+ + " does not implement IceUtil::AbstractMutex";
+ throw ex;
+ }
+ }
+ } while(tryAgain);
+ }
+
+ if(_trace >= 1)
+ {
+ Long now = IceUtil::Time::now().toMilliSeconds();
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "streamed " << streamedObjectQueue.size() << " objects in "
+ << static_cast<Int>(now - streamStart) << " ms";
+ }
+
+ //
+ // Now let's save all these streamed objects to disk using a transaction
+ //
+
+ //
+ // Each time we get a deadlock, we reduce the number of objects to save
+ // per transaction
+ //
+ size_t txSize = streamedObjectQueue.size();
+ if(txSize > static_cast<size_t>(_maxTxSize))
+ {
+ txSize = static_cast<size_t>(_maxTxSize);
+ }
+ bool tryAgain;
+
+ do
+ {
+ tryAgain = false;
+
+ while(streamedObjectQueue.size() > 0)
+ {
+ if(txSize > streamedObjectQueue.size())
+ {
+ txSize = streamedObjectQueue.size();
+ }
+
+ Long saveStart = IceUtil::Time::now().toMilliSeconds();
+ try
+ {
+ DbTxn* tx = 0;
+ _dbEnv->getEnv()->txn_begin(0, &tx, 0);
+
+ long txnId = 0;
+ if(_txTrace >= 1)
+ {
+ txnId = (tx->id() & 0x7FFFFFFF) + 0x80000000L;
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "started transaction " << hex << txnId << dec << " in saving thread";
+ }
+
+ try
+ {
+ for(size_t i = 0; i < txSize; i++)
+ {
+ StreamedObject& obj = streamedObjectQueue[i];
+ obj.store->save(obj.key, obj.value, obj.status, tx);
+ }
+ }
+ catch(...)
+ {
+ tx->abort();
+ if(_txTrace >= 1)
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "rolled back transaction " << hex << txnId << dec;
+ }
+ throw;
+ }
+ tx->commit(0);
+
+ if(_txTrace >= 1)
+ {
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "committed transaction " << hex << txnId << dec;
+ }
+
+ streamedObjectQueue.erase
+ (streamedObjectQueue.begin(),
+ streamedObjectQueue.begin() + txSize);
+
+ if(_trace >= 1)
+ {
+ Long now = IceUtil::Time::now().toMilliSeconds();
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "saved " << txSize << " objects in "
+ << static_cast<Int>(now - saveStart) << " ms";
+ }
+ }
+ catch(const DbDeadlockException&)
+ {
+ if(_deadlockWarning)
+ {
+ Warning out(_communicator->getLogger());
+ out << "Deadlock in Freeze::EvictorI::run while writing into Db \"" + _filename
+ + "\"; retrying ...";
+ }
+
+ tryAgain = true;
+ txSize = (txSize + 1)/2;
+ }
+ catch(const DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ }
+ }
+ while(tryAgain);
+
+ {
+ Lock sync(*this);
+
+ //
+ // Release usage count
+ //
+ for(deque<EvictorElementPtr>::iterator p = allObjects.begin();
+ p != allObjects.end(); p++)
+ {
+ EvictorElementPtr& element = *p;
+ element->usageCount--;
+ }
+ allObjects.clear();
+
+ for(deque<EvictorElementPtr>::iterator q = deadObjects.begin();
+ q != deadObjects.end(); q++)
+ {
+ EvictorElementPtr& element = *q;
+ if(!element->stale)
+ {
+ //
+ // Can be stale when there are duplicate elements on the
+ // deadObjecst queue
+ //
+
+ if(!element->stale && element->usageCount == 0 && element->keepCount == 0)
+ {
+ //
+ // Get rid of unused dead elements
+ //
+ IceUtil::Mutex::Lock lockElement(element->mutex);
+ if(element->status == EvictorElement::dead)
+ {
+ evict(element);
+ }
+ }
+ }
+ }
+ deadObjects.clear();
+ evict();
+
+ if(saveNowThreadsSize > 0)
+ {
+ _saveNowThreads.erase(_saveNowThreads.begin(), _saveNowThreads.begin() + saveNowThreadsSize);
+ notifyAll();
+ }
+ }
+ }
}
catch(const IceUtil::Exception& ex)
{
- Error out(_communicator->getLogger());
- out << "Saving thread killed by exception: " << ex;
- out.flush();
- handleFatalError(this, _communicator);
+ Error out(_communicator->getLogger());
+ out << "Saving thread killed by exception: " << ex;
+ out.flush();
+ handleFatalError(this, _communicator);
}
catch(const std::exception& ex)
{
- Error out(_communicator->getLogger());
- out << "Saving thread killed by std::exception: " << ex.what();
- out.flush();
- handleFatalError(this, _communicator);
+ Error out(_communicator->getLogger());
+ out << "Saving thread killed by std::exception: " << ex.what();
+ out.flush();
+ handleFatalError(this, _communicator);
}
catch(...)
{
- Error out(_communicator->getLogger());
- out << "Saving thread killed by unknown exception";
- out.flush();
- handleFatalError(this, _communicator);
+ Error out(_communicator->getLogger());
+ out << "Saving thread killed by unknown exception";
+ out.flush();
+ handleFatalError(this, _communicator);
}
}
@@ -1665,7 +1665,7 @@ Freeze::EvictorI::saveNowNoSync()
notifyAll();
do
{
- wait();
+ wait();
}
while(find(_saveNowThreads.begin(), _saveNowThreads.end(), myself) != _saveNowThreads.end());
}
@@ -1683,50 +1683,50 @@ Freeze::EvictorI::evict()
while(_currentEvictorSize > _evictorSize)
{
- //
- // Get the last unused element from the evictor queue.
- //
- while(p != _evictorList.rend())
- {
- if((*p)->usageCount == 0)
- {
- break; // Fine, servant is not in use (and not in the modifiedQueue)
- }
- ++p;
- }
- if(p == _evictorList.rend())
- {
- //
- // All servants are active, can't evict any further.
- //
- break;
- }
-
- EvictorElementPtr& element = *p;
- assert(!element->stale);
- assert(element->keepCount == 0);
-
- if(_trace >= 2 || (_trace >= 1 && _evictorList.size() % 50 == 0))
- {
- string facet = element->store.facet();
-
- Trace out(_communicator->getLogger(), "Freeze.Evictor");
- out << "evicting \"" << _communicator->identityToString(element->cachePosition->first) << "\" ";
- if(facet != "")
- {
- out << "-f \"" << facet << "\" ";
- }
- out << "from the queue\n"
- << "number of elements in the queue: " << _currentEvictorSize;
- }
-
- //
- // Remove last unused element from the evictor queue.
- //
- element->stale = true;
- element->store.unpin(element->cachePosition);
- p = list<EvictorElementPtr>::reverse_iterator(_evictorList.erase(element->evictPosition));
- _currentEvictorSize--;
+ //
+ // Get the last unused element from the evictor queue.
+ //
+ while(p != _evictorList.rend())
+ {
+ if((*p)->usageCount == 0)
+ {
+ break; // Fine, servant is not in use (and not in the modifiedQueue)
+ }
+ ++p;
+ }
+ if(p == _evictorList.rend())
+ {
+ //
+ // All servants are active, can't evict any further.
+ //
+ break;
+ }
+
+ EvictorElementPtr& element = *p;
+ assert(!element->stale);
+ assert(element->keepCount == 0);
+
+ if(_trace >= 2 || (_trace >= 1 && _evictorList.size() % 50 == 0))
+ {
+ string facet = element->store.facet();
+
+ Trace out(_communicator->getLogger(), "Freeze.Evictor");
+ out << "evicting \"" << _communicator->identityToString(element->cachePosition->first) << "\" ";
+ if(facet != "")
+ {
+ out << "-f \"" << facet << "\" ";
+ }
+ out << "from the queue\n"
+ << "number of elements in the queue: " << _currentEvictorSize;
+ }
+
+ //
+ // Remove last unused element from the evictor queue.
+ //
+ element->stale = true;
+ element->store.unpin(element->cachePosition);
+ p = list<EvictorElementPtr>::reverse_iterator(_evictorList.erase(element->evictPosition));
+ _currentEvictorSize--;
}
}
@@ -1737,20 +1737,20 @@ Freeze::EvictorI::fixEvictPosition(const EvictorElementPtr& element)
if(element->keepCount == 0)
{
- if(element->usageCount < 0)
- {
- //
- // New object
- //
- element->usageCount = 0;
- _currentEvictorSize++;
- }
- else
- {
- _evictorList.erase(element->evictPosition);
- }
- _evictorList.push_front(element);
- element->evictPosition = _evictorList.begin();
+ if(element->usageCount < 0)
+ {
+ //
+ // New object
+ //
+ element->usageCount = 0;
+ _currentEvictorSize++;
+ }
+ else
+ {
+ _evictorList.erase(element->evictPosition);
+ }
+ _evictorList.push_front(element);
+ element->evictPosition = _evictorList.begin();
}
}
@@ -1775,7 +1775,7 @@ Freeze::EvictorI::addToModifiedQueue(const EvictorElementPtr& element)
if(_saveSizeTrigger >= 0 && static_cast<Int>(_modifiedQueue.size()) >= _saveSizeTrigger)
{
- notifyAll();
+ notifyAll();
}
}
@@ -1793,22 +1793,22 @@ Freeze::EvictorI::stream(const EvictorElementPtr& element, Long streamStart, Str
if(element->status != EvictorElement::destroyed)
{
- //
- // Update stats first
- //
- Statistics& stats = element->rec.stats;
- Long diff = streamStart - (stats.creationTime + stats.lastSaveTime);
- if(stats.lastSaveTime == 0)
- {
- stats.lastSaveTime = diff;
- stats.avgSaveTime = diff;
- }
- else
- {
- stats.lastSaveTime = streamStart - stats.creationTime;
- stats.avgSaveTime = static_cast<Long>(stats.avgSaveTime * 0.95 + diff * 0.05);
- }
- ObjectStore::marshal(element->rec, obj.value, _communicator);
+ //
+ // Update stats first
+ //
+ Statistics& stats = element->rec.stats;
+ Long diff = streamStart - (stats.creationTime + stats.lastSaveTime);
+ if(stats.lastSaveTime == 0)
+ {
+ stats.lastSaveTime = diff;
+ stats.avgSaveTime = diff;
+ }
+ else
+ {
+ stats.lastSaveTime = streamStart - stats.creationTime;
+ stats.avgSaveTime = static_cast<Long>(stats.avgSaveTime * 0.95 + diff * 0.05);
+ }
+ ObjectStore::marshal(element->rec, obj.value, _communicator);
}
}
@@ -1820,11 +1820,11 @@ Freeze::EvictorI::findStore(const string& facet) const
StoreMap::const_iterator p = _storeMap.find(facet);
if(p == _storeMap.end())
{
- return 0;
+ return 0;
}
else
{
- return (*p).second;
+ return (*p).second;
}
}
@@ -1836,45 +1836,45 @@ Freeze::EvictorI::allDbs() const
try
{
- Db db(_dbEnv->getEnv(), 0);
- db.open(0, _filename.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0);
-
- Dbc* dbc = 0;
- db.cursor(0, &dbc, 0);
-
- Dbt dbKey;
- dbKey.set_flags(DB_DBT_MALLOC);
-
- Dbt dbValue;
- dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
-
- bool more = true;
- while(more)
- {
- more = (dbc->get(&dbKey, &dbValue, DB_NEXT) == 0);
- if(more)
- {
- string dbName(static_cast<char*>(dbKey.get_data()), dbKey.get_size());
-
- if(dbName.find(indexPrefix) != 0)
- {
- result.push_back(dbName);
- }
- free(dbKey.get_data());
- }
- }
-
- dbc->close();
- db.close(0);
+ Db db(_dbEnv->getEnv(), 0);
+ db.open(0, _filename.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0);
+
+ Dbc* dbc = 0;
+ db.cursor(0, &dbc, 0);
+
+ Dbt dbKey;
+ dbKey.set_flags(DB_DBT_MALLOC);
+
+ Dbt dbValue;
+ dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
+
+ bool more = true;
+ while(more)
+ {
+ more = (dbc->get(&dbKey, &dbValue, DB_NEXT) == 0);
+ if(more)
+ {
+ string dbName(static_cast<char*>(dbKey.get_data()), dbKey.get_size());
+
+ if(dbName.find(indexPrefix) != 0)
+ {
+ result.push_back(dbName);
+ }
+ free(dbKey.get_data());
+ }
+ }
+
+ dbc->close();
+ db.close(0);
}
catch(const DbException& dx)
{
- if(dx.get_errno() != ENOENT)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ if(dx.get_errno() != ENOENT)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
return result;
diff --git a/cpp/src/Freeze/EvictorI.h b/cpp/src/Freeze/EvictorI.h
index 6c85a3092df..187294cb8c6 100644
--- a/cpp/src/Freeze/EvictorI.h
+++ b/cpp/src/Freeze/EvictorI.h
@@ -43,11 +43,11 @@ public:
class Guard
{
public:
- Guard(DeactivateController&);
- ~Guard();
+ Guard(DeactivateController&);
+ ~Guard();
private:
- DeactivateController& _controller;
+ DeactivateController& _controller;
};
DeactivateController(EvictorI*);
@@ -112,7 +112,7 @@ class EvictorI : public Evictor, public IceUtil::Monitor<IceUtil::Mutex>, publi
public:
EvictorI(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&,
- const ServantInitializerPtr&, const std::vector<IndexPtr>&, bool);
+ const ServantInitializerPtr&, const std::vector<IndexPtr>&, bool);
virtual ~EvictorI();
@@ -165,10 +165,10 @@ public:
struct StreamedObject
{
- Key key;
- Value value;
- Ice::Byte status;
- ObjectStore* store;
+ Key key;
+ Value value;
+ Ice::Byte status;
+ ObjectStore* store;
};
diff --git a/cpp/src/Freeze/EvictorIteratorI.cpp b/cpp/src/Freeze/EvictorIteratorI.cpp
index d2a1ecef2f5..68feab953aa 100644
--- a/cpp/src/Freeze/EvictorIteratorI.cpp
+++ b/cpp/src/Freeze/EvictorIteratorI.cpp
@@ -33,12 +33,12 @@ Freeze::EvictorIteratorI::hasNext()
{
if(_batchIterator != _batch.end())
{
- return true;
+ return true;
}
else
{
- _batchIterator = nextBatch();
- return (_batchIterator != _batch.end());
+ _batchIterator = nextBatch();
+ return (_batchIterator != _batch.end());
}
}
@@ -47,11 +47,11 @@ Freeze::EvictorIteratorI::next()
{
if(hasNext())
{
- return *_batchIterator++;
+ return *_batchIterator++;
}
else
{
- throw Freeze::NoSuchElementException(__FILE__, __LINE__);
+ throw Freeze::NoSuchElementException(__FILE__, __LINE__);
}
}
@@ -60,13 +60,13 @@ vector<Identity>::const_iterator
Freeze::EvictorIteratorI::nextBatch()
{
DeactivateController::Guard
- deactivateGuard(_store->evictor()->deactivateController());
+ deactivateGuard(_store->evictor()->deactivateController());
_batch.clear();
if(!_more)
{
- return _batch.end();
+ return _batch.end();
}
vector<EvictorElementPtr> evictorElements;
@@ -78,145 +78,145 @@ Freeze::EvictorIteratorI::nextBatch()
try
{
- for(;;)
- {
- _batch.clear();
- evictorElements.clear();
-
- Dbt dbKey;
- initializeOutDbt(_key, dbKey);
-
- Dbt dbValue;
- dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
-
- Dbc* dbc = 0;
- try
- {
- //
- // Move to the first record
- //
- u_int32_t flags = DB_NEXT;
-
- if(_initialized)
- {
- //
- // _key represents the next element not yet returned
- // if it has been deleted, we want the one after
- //
- flags = DB_SET_RANGE;
-
- //
- // Will be used as input as well
- //
- dbKey.set_size(static_cast<u_int32_t>(firstKey.size()));
- }
-
- _store->db()->cursor(0, &dbc, 0);
-
- bool done = false;
- do
- {
- for(;;)
- {
- try
- {
- //
- // It is critical to set key size to key capacity before the
- // get, as a resize that increases the size inserts 0
- //
- _key.resize(_key.capacity());
-
- _more = (dbc->get(&dbKey, &dbValue, flags) == 0);
- if(_more)
- {
- _key.resize(dbKey.get_size());
- _initialized = true;
-
- flags = DB_NEXT;
-
- Ice::Identity ident;
- ObjectStore::unmarshal(ident, _key, communicator);
- if(_batch.size() < _batchSize)
- {
- _batch.push_back(ident);
- }
- else
- {
- //
- // Keep the last element in _key
- //
- done = true;
- }
- }
- break;
- }
- catch(const DbDeadlockException&)
- {
- throw;
- }
- catch(const DbException& dx)
- {
- handleDbException(dx, _key, dbKey, __FILE__, __LINE__);
- }
- }
- }
- while(!done && _more);
-
- Dbc* toClose = dbc;
- dbc = 0;
- toClose->close();
- break; // for (;;)
- }
- catch(const DbDeadlockException&)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
- _key = firstKey;
- //
- // Retry
- //
- }
- catch(...)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
- throw;
- }
- }
+ for(;;)
+ {
+ _batch.clear();
+ evictorElements.clear();
+
+ Dbt dbKey;
+ initializeOutDbt(_key, dbKey);
+
+ Dbt dbValue;
+ dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
+
+ Dbc* dbc = 0;
+ try
+ {
+ //
+ // Move to the first record
+ //
+ u_int32_t flags = DB_NEXT;
+
+ if(_initialized)
+ {
+ //
+ // _key represents the next element not yet returned
+ // if it has been deleted, we want the one after
+ //
+ flags = DB_SET_RANGE;
+
+ //
+ // Will be used as input as well
+ //
+ dbKey.set_size(static_cast<u_int32_t>(firstKey.size()));
+ }
+
+ _store->db()->cursor(0, &dbc, 0);
+
+ bool done = false;
+ do
+ {
+ for(;;)
+ {
+ try
+ {
+ //
+ // It is critical to set key size to key capacity before the
+ // get, as a resize that increases the size inserts 0
+ //
+ _key.resize(_key.capacity());
+
+ _more = (dbc->get(&dbKey, &dbValue, flags) == 0);
+ if(_more)
+ {
+ _key.resize(dbKey.get_size());
+ _initialized = true;
+
+ flags = DB_NEXT;
+
+ Ice::Identity ident;
+ ObjectStore::unmarshal(ident, _key, communicator);
+ if(_batch.size() < _batchSize)
+ {
+ _batch.push_back(ident);
+ }
+ else
+ {
+ //
+ // Keep the last element in _key
+ //
+ done = true;
+ }
+ }
+ break;
+ }
+ catch(const DbDeadlockException&)
+ {
+ throw;
+ }
+ catch(const DbException& dx)
+ {
+ handleDbException(dx, _key, dbKey, __FILE__, __LINE__);
+ }
+ }
+ }
+ while(!done && _more);
+
+ Dbc* toClose = dbc;
+ dbc = 0;
+ toClose->close();
+ break; // for (;;)
+ }
+ catch(const DbDeadlockException&)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+ _key = firstKey;
+ //
+ // Retry
+ //
+ }
+ catch(...)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+ throw;
+ }
+ }
}
catch(const DbException& dx)
{
- handleDbException(dx, __FILE__, __LINE__);
+ handleDbException(dx, __FILE__, __LINE__);
}
if(_batch.size() == 0)
{
- return _batch.end();
+ return _batch.end();
}
else
{
- return _batch.begin();
+ return _batch.begin();
}
}
diff --git a/cpp/src/Freeze/IndexI.cpp b/cpp/src/Freeze/IndexI.cpp
index 5058fb23ece..ca9c21e095a 100644
--- a/cpp/src/Freeze/IndexI.cpp
+++ b/cpp/src/Freeze/IndexI.cpp
@@ -37,7 +37,7 @@ vector<Identity>
Freeze::IndexI::untypedFindFirst(const Key& bytes, Int firstN) const
{
DeactivateController::Guard
- deactivateGuard(_store->evictor()->deactivateController());
+ deactivateGuard(_store->evictor()->deactivateController());
Dbt dbKey;
initializeInDbt(bytes, dbKey);
@@ -63,111 +63,111 @@ Freeze::IndexI::untypedFindFirst(const Key& bytes, Int firstN) const
try
{
- for(;;)
- {
- Dbc* dbc = 0;
- identities.clear();
-
- try
- {
- //
- // Move to the first record
- //
- _db->cursor(0, &dbc, 0);
- u_int32_t flags = DB_SET;
-
- bool found;
-
- do
- {
- for(;;)
- {
- try
- {
- //
- // It is critical to set key size to key capacity before the
- // get, as a resize that increases the size inserts 0
- //
- pkey.resize(pkey.capacity());
-
- found = (dbc->pget(&dbKey, &pdbKey, &dbValue, flags) == 0);
- if(found)
- {
- pkey.resize(pdbKey.get_size());
-
- Ice::Identity ident;
- ObjectStore::unmarshal(ident, pkey, communicator);
- identities.push_back(ident);
- flags = DB_NEXT_DUP;
- }
- break; // for(;;)
- }
- catch(const DbDeadlockException&)
- {
- throw;
- }
- catch(const DbException& dx)
- {
- handleDbException(dx, pkey, pdbKey, __FILE__, __LINE__);
- }
- }
- }
- while((firstN <= 0 || identities.size() < static_cast<size_t>(firstN)) && found);
-
- Dbc* toClose = dbc;
- dbc = 0;
- toClose->close();
- break; // for (;;)
- }
- catch(const DbDeadlockException&)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
-
- if(_store->evictor()->deadlockWarning())
- {
- Warning out(_store->communicator()->getLogger());
- out << "Deadlock in Freeze::IndexI::untypedFindFirst while searching \""
- << _store->evictor()->filename() + "/" + _dbName << "\"; retrying ...";
- }
-
- //
- // Retry
- //
- }
- catch(...)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
- throw;
- }
- }
+ for(;;)
+ {
+ Dbc* dbc = 0;
+ identities.clear();
+
+ try
+ {
+ //
+ // Move to the first record
+ //
+ _db->cursor(0, &dbc, 0);
+ u_int32_t flags = DB_SET;
+
+ bool found;
+
+ do
+ {
+ for(;;)
+ {
+ try
+ {
+ //
+ // It is critical to set key size to key capacity before the
+ // get, as a resize that increases the size inserts 0
+ //
+ pkey.resize(pkey.capacity());
+
+ found = (dbc->pget(&dbKey, &pdbKey, &dbValue, flags) == 0);
+ if(found)
+ {
+ pkey.resize(pdbKey.get_size());
+
+ Ice::Identity ident;
+ ObjectStore::unmarshal(ident, pkey, communicator);
+ identities.push_back(ident);
+ flags = DB_NEXT_DUP;
+ }
+ break; // for(;;)
+ }
+ catch(const DbDeadlockException&)
+ {
+ throw;
+ }
+ catch(const DbException& dx)
+ {
+ handleDbException(dx, pkey, pdbKey, __FILE__, __LINE__);
+ }
+ }
+ }
+ while((firstN <= 0 || identities.size() < static_cast<size_t>(firstN)) && found);
+
+ Dbc* toClose = dbc;
+ dbc = 0;
+ toClose->close();
+ break; // for (;;)
+ }
+ catch(const DbDeadlockException&)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+
+ if(_store->evictor()->deadlockWarning())
+ {
+ Warning out(_store->communicator()->getLogger());
+ out << "Deadlock in Freeze::IndexI::untypedFindFirst while searching \""
+ << _store->evictor()->filename() + "/" + _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Retry
+ //
+ }
+ catch(...)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+ throw;
+ }
+ }
}
catch(const DbException& dx)
{
- handleDbException(dx, __FILE__, __LINE__);
+ handleDbException(dx, __FILE__, __LINE__);
}
return identities;
@@ -183,7 +183,7 @@ Int
Freeze::IndexI::untypedCount(const Key& bytes) const
{
DeactivateController::Guard
- deactivateGuard(_store->evictor()->deactivateController());
+ deactivateGuard(_store->evictor()->deactivateController());
Dbt dbKey;
initializeInDbt(bytes, dbKey);
@@ -203,81 +203,81 @@ Freeze::IndexI::untypedCount(const Key& bytes) const
try
{
- for(;;)
- {
- Dbc* dbc = 0;
-
- try
- {
- //
- // Move to the first record
- //
- _db->cursor(0, &dbc, 0);
- bool found = (dbc->get(&dbKey, &dbValue, DB_SET) == 0);
-
- if(found)
- {
- db_recno_t count = 0;
- dbc->count(&count, 0);
- result = static_cast<Int>(count);
- }
-
- Dbc* toClose = dbc;
- dbc = 0;
- toClose->close();
- break; // for (;;)
- }
- catch(const DbDeadlockException&)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
-
- if(_store->evictor()->deadlockWarning())
- {
- Warning out(_store->communicator()->getLogger());
- out << "Deadlock in Freeze::IndexI::untypedCount while searching \""
- << _store->evictor()->filename() + "/" + _dbName << "\"; retrying ...";
- }
-
- //
- // Retry
- //
- }
- catch(...)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
- throw;
- }
- }
+ for(;;)
+ {
+ Dbc* dbc = 0;
+
+ try
+ {
+ //
+ // Move to the first record
+ //
+ _db->cursor(0, &dbc, 0);
+ bool found = (dbc->get(&dbKey, &dbValue, DB_SET) == 0);
+
+ if(found)
+ {
+ db_recno_t count = 0;
+ dbc->count(&count, 0);
+ result = static_cast<Int>(count);
+ }
+
+ Dbc* toClose = dbc;
+ dbc = 0;
+ toClose->close();
+ break; // for (;;)
+ }
+ catch(const DbDeadlockException&)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+
+ if(_store->evictor()->deadlockWarning())
+ {
+ Warning out(_store->communicator()->getLogger());
+ out << "Deadlock in Freeze::IndexI::untypedCount while searching \""
+ << _store->evictor()->filename() + "/" + _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Retry
+ //
+ }
+ catch(...)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+ throw;
+ }
+ }
}
catch(const DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
return result;
@@ -285,7 +285,7 @@ Freeze::IndexI::untypedCount(const Key& bytes) const
void
Freeze::IndexI::associate(ObjectStore* store, DbTxn* txn,
- bool createDb, bool populateIndex)
+ bool createDb, bool populateIndex)
{
assert(txn != 0);
_store = store;
@@ -298,7 +298,7 @@ Freeze::IndexI::associate(ObjectStore* store, DbTxn* txn,
u_int32_t flags = 0;
if(createDb)
{
- flags = DB_CREATE;
+ flags = DB_CREATE;
}
_dbName = EvictorI::indexPrefix + store->dbName() + "." + _index.name();
@@ -308,14 +308,14 @@ Freeze::IndexI::associate(ObjectStore* store, DbTxn* txn,
flags = 0;
if(populateIndex)
{
- flags = DB_CREATE;
+ flags = DB_CREATE;
}
store->db()->associate(txn, _db.get(), callback, flags);
}
int
Freeze::IndexI::secondaryKeyCreate(Db* secondary, const Dbt* dbKey,
- const Dbt* dbValue, Dbt* result)
+ const Dbt* dbValue, Dbt* result)
{
Ice::CommunicatorPtr communicator = _store->communicator();
@@ -327,19 +327,19 @@ Freeze::IndexI::secondaryKeyCreate(Db* secondary, const Dbt* dbKey,
Key bytes;
if(_index.marshalKey(rec.servant, bytes))
{
- result->set_flags(DB_DBT_APPMALLOC);
- void* data = malloc(bytes.size());
- memcpy(data, &bytes[0], bytes.size());
- result->set_data(data);
- result->set_size(static_cast<u_int32_t>(bytes.size()));
- return 0;
+ result->set_flags(DB_DBT_APPMALLOC);
+ void* data = malloc(bytes.size());
+ memcpy(data, &bytes[0], bytes.size());
+ result->set_data(data);
+ result->set_size(static_cast<u_int32_t>(bytes.size()));
+ return 0;
}
else
{
- //
- // Don't want to index this one
- //
- return DB_DONOTINDEX;
+ //
+ // Don't want to index this one
+ //
+ return DB_DONOTINDEX;
}
}
@@ -348,16 +348,16 @@ Freeze::IndexI::close()
{
if(_db.get() != 0)
{
- try
- {
- _db->close(0);
- }
- catch(const DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- _db.reset(0);
+ try
+ {
+ _db->close(0);
+ }
+ catch(const DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ _db.reset(0);
}
}
diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp
index a3e756725d2..37c894dad0c 100644
--- a/cpp/src/Freeze/MapI.cpp
+++ b/cpp/src/Freeze/MapI.cpp
@@ -86,12 +86,12 @@ Freeze::KeyCompareBase::compareEnabled() const
Freeze::MapHelper*
Freeze::MapHelper::create(const Freeze::ConnectionPtr& connection,
- const string& dbName,
- const string& key,
- const string& value,
- const Freeze::KeyCompareBasePtr& keyCompare,
- const std::vector<MapIndexBasePtr>& indices,
- bool createDb)
+ const string& dbName,
+ const string& key,
+ const string& value,
+ const Freeze::KeyCompareBasePtr& keyCompare,
+ const std::vector<MapIndexBasePtr>& indices,
+ bool createDb)
{
Freeze::ConnectionIPtr connectionI = Freeze::ConnectionIPtr::dynamicCast(connection.get());
return new MapHelperI(connectionI, dbName, key, value, keyCompare, indices, createDb);
@@ -112,14 +112,14 @@ Freeze::IteratorHelper::create(const MapHelper& m, bool readOnly)
const MapHelperI& actualMap = dynamic_cast<const MapHelperI&>(m);
auto_ptr<IteratorHelperI> r(new IteratorHelperI(actualMap, readOnly,
- 0, false));
+ 0, false));
if(r->next())
{
- return r.release();
+ return r.release();
}
else
{
- return 0;
+ return 0;
}
}
@@ -134,8 +134,8 @@ Freeze::IteratorHelper::~IteratorHelper()
//
Freeze::IteratorHelperI::IteratorHelperI(const MapHelperI& m, bool readOnly,
- const MapIndexBasePtr& index,
- bool onlyDups) :
+ const MapIndexBasePtr& index,
+ bool onlyDups) :
_map(m),
_dbc(0),
_indexed(index != 0),
@@ -144,41 +144,41 @@ Freeze::IteratorHelperI::IteratorHelperI(const MapHelperI& m, bool readOnly,
{
if(_map._trace >= 2)
{
- Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
- out << "opening iterator on Db \"" << _map._dbName << "\"";
- if(index != 0)
- {
- out << " with index \"" << index->name() << "\"";
- }
+ Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
+ out << "opening iterator on Db \"" << _map._dbName << "\"";
+ if(index != 0)
+ {
+ out << " with index \"" << index->name() << "\"";
+ }
}
DbTxn* txn = _map._connection->dbTxn();
if(txn == 0 && !readOnly)
{
- //
- // Need to start a transaction
- //
- _tx = new Tx(_map);
- txn = _tx->getTxn();
+ //
+ // Need to start a transaction
+ //
+ _tx = new Tx(_map);
+ txn = _tx->getTxn();
}
try
{
- if(index != 0)
- {
- index->_impl->db()->cursor(txn, &_dbc, 0);
- }
- else
- {
- _map._db->cursor(txn, &_dbc, 0);
- }
+ if(index != 0)
+ {
+ index->_impl->db()->cursor(txn, &_dbc, 0);
+ }
+ else
+ {
+ _map._db->cursor(txn, &_dbc, 0);
+ }
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
_map._iteratorList.push_back(this);
@@ -194,19 +194,19 @@ Freeze::IteratorHelperI::IteratorHelperI(const IteratorHelperI& it) :
{
if(_map._trace >= 2)
{
- Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
- out << "duplicating iterator on Db \"" << _map._dbName << "\"";
+ Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
+ out << "duplicating iterator on Db \"" << _map._dbName << "\"";
}
try
{
- it._dbc->dup(&_dbc, DB_POSITION);
+ it._dbc->dup(&_dbc, DB_POSITION);
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
_tx = it._tx;
@@ -241,31 +241,31 @@ Freeze::IteratorHelperI::find(const Key& key) const
{
try
{
- if(_dbc->get(&dbKey, &dbValue, DB_SET) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
+ if(_dbc->get(&dbKey, &dbValue, DB_SET) == 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
catch(const ::DbDeadlockException& dx)
{
- if(_tx != 0)
- {
- _tx->dead();
- }
-
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(_tx != 0)
+ {
+ _tx->dead();
+ }
+
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
}
}
@@ -289,42 +289,42 @@ Freeze::IteratorHelperI::lowerBound(const Key& key) const
for(;;)
{
- try
- {
- int err = _dbc->get(&dbKey, &dbValue, DB_SET_RANGE);
- if(err == 0)
- {
- _key.resize(dbKey.get_size());
- return true;
- }
- else if(err == DB_NOTFOUND)
- {
- return false;
- }
- else
- {
- //
- // Bug in Freeze
- //
- assert(0);
- throw DatabaseException(__FILE__, __LINE__);
- }
- }
- catch(const ::DbDeadlockException& dx)
- {
- if(_tx != 0)
- {
- _tx->dead();
- }
-
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- catch(const ::DbException& dx)
- {
- handleDbException(dx, _key, dbKey, __FILE__, __LINE__);
- }
+ try
+ {
+ int err = _dbc->get(&dbKey, &dbValue, DB_SET_RANGE);
+ if(err == 0)
+ {
+ _key.resize(dbKey.get_size());
+ return true;
+ }
+ else if(err == DB_NOTFOUND)
+ {
+ return false;
+ }
+ else
+ {
+ //
+ // Bug in Freeze
+ //
+ assert(0);
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ if(_tx != 0)
+ {
+ _tx->dead();
+ }
+
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ catch(const ::DbException& dx)
+ {
+ handleDbException(dx, _key, dbKey, __FILE__, __LINE__);
+ }
}
}
@@ -333,18 +333,18 @@ Freeze::IteratorHelperI::upperBound(const Key& key) const
{
if(lowerBound(key))
{
- if(_key == key)
- {
- return next(true);
- }
- else
- {
- return true;
- }
+ if(_key == key)
+ {
+ return next(true);
+ }
+ else
+ {
+ return true;
+ }
}
else
{
- return false;
+ return false;
}
}
@@ -364,7 +364,7 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const
size_t keySize = _key.capacity();
if(keySize < 1024)
{
- keySize = 1024;
+ keySize = 1024;
}
_key.resize(keySize);
@@ -374,7 +374,7 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const
size_t valueSize = _value.capacity();
if(valueSize < 1024)
{
- valueSize = 1024;
+ valueSize = 1024;
}
_value.resize(valueSize);
Dbt dbValue;
@@ -382,60 +382,60 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const
for(;;)
{
- try
- {
- int err;
-
- if(_indexed)
- {
- //
- // Not interested in getting the index's key
- //
- Dbt iKey;
- iKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
-
- err = _dbc->pget(&iKey, &dbKey, &dbValue, DB_CURRENT);
- }
- else
- {
- err = _dbc->get(&dbKey, &dbValue, DB_CURRENT);
- }
-
- if(err == 0)
- {
- _key.resize(dbKey.get_size());
- _value.resize(dbValue.get_size());
- break; // for(;;)
- }
- else if(err == DB_KEYEMPTY)
- {
- throw InvalidPositionException(__FILE__, __LINE__);
- }
- else
- {
- //
- // Bug in Freeze
- //
- assert(0);
- throw DatabaseException(__FILE__, __LINE__);
- }
- }
- catch(const ::DbDeadlockException& dx)
- {
- if(_tx != 0)
- {
- _tx->dead();
- }
-
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- catch(const ::DbException& dx)
- {
- handleDbException(dx, _key, dbKey, _value, dbValue,
- __FILE__, __LINE__);
- }
+ try
+ {
+ int err;
+
+ if(_indexed)
+ {
+ //
+ // Not interested in getting the index's key
+ //
+ Dbt iKey;
+ iKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
+
+ err = _dbc->pget(&iKey, &dbKey, &dbValue, DB_CURRENT);
+ }
+ else
+ {
+ err = _dbc->get(&dbKey, &dbValue, DB_CURRENT);
+ }
+
+ if(err == 0)
+ {
+ _key.resize(dbKey.get_size());
+ _value.resize(dbValue.get_size());
+ break; // for(;;)
+ }
+ else if(err == DB_KEYEMPTY)
+ {
+ throw InvalidPositionException(__FILE__, __LINE__);
+ }
+ else
+ {
+ //
+ // Bug in Freeze
+ //
+ assert(0);
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ if(_tx != 0)
+ {
+ _tx->dead();
+ }
+
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ catch(const ::DbException& dx)
+ {
+ handleDbException(dx, _key, dbKey, _value, dbValue,
+ __FILE__, __LINE__);
+ }
}
}
@@ -445,7 +445,7 @@ Freeze::IteratorHelperI::get() const
size_t keySize = _key.capacity();
if(keySize < 1024)
{
- keySize = 1024;
+ keySize = 1024;
}
_key.resize(keySize);
@@ -460,57 +460,57 @@ Freeze::IteratorHelperI::get() const
for(;;)
{
- try
- {
- int err;
- if(_indexed)
- {
- //
- // Not interested in getting the index's key
- //
- Dbt iKey;
- iKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
-
- err = _dbc->pget(&iKey, &dbKey, &dbValue, DB_CURRENT);
- }
- else
- {
- err = _dbc->get(&dbKey, &dbValue, DB_CURRENT);
- }
-
- if(err == 0)
- {
- _key.resize(dbKey.get_size());
- return &_key;
- }
- else if(err == DB_KEYEMPTY)
- {
- throw InvalidPositionException(__FILE__, __LINE__);
- }
- else
- {
- //
- // Bug in Freeze
- //
- assert(0);
- throw DatabaseException(__FILE__, __LINE__);
- }
- }
- catch(const ::DbDeadlockException& dx)
- {
- if(_tx != 0)
- {
- _tx->dead();
- }
-
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- catch(const ::DbException& dx)
- {
- handleDbException(dx, _key, dbKey, __FILE__, __LINE__);
- }
+ try
+ {
+ int err;
+ if(_indexed)
+ {
+ //
+ // Not interested in getting the index's key
+ //
+ Dbt iKey;
+ iKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
+
+ err = _dbc->pget(&iKey, &dbKey, &dbValue, DB_CURRENT);
+ }
+ else
+ {
+ err = _dbc->get(&dbKey, &dbValue, DB_CURRENT);
+ }
+
+ if(err == 0)
+ {
+ _key.resize(dbKey.get_size());
+ return &_key;
+ }
+ else if(err == DB_KEYEMPTY)
+ {
+ throw InvalidPositionException(__FILE__, __LINE__);
+ }
+ else
+ {
+ //
+ // Bug in Freeze
+ //
+ assert(0);
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ if(_tx != 0)
+ {
+ _tx->dead();
+ }
+
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ catch(const ::DbException& dx)
+ {
+ handleDbException(dx, _key, dbKey, __FILE__, __LINE__);
+ }
}
}
@@ -519,9 +519,9 @@ Freeze::IteratorHelperI::set(const Value& value)
{
if(_indexed)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = "Cannot set an iterator retrieved through an index";
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = "Cannot set an iterator retrieved through an index";
+ throw ex;
}
//
@@ -535,31 +535,31 @@ Freeze::IteratorHelperI::set(const Value& value)
if(_tx != 0)
{
- _map.closeAllIteratorsExcept(_tx);
+ _map.closeAllIteratorsExcept(_tx);
}
try
{
- int err;
- err = _dbc->put(&dbKey, &dbValue, DB_CURRENT);
- assert(err == 0);
+ int err;
+ err = _dbc->put(&dbKey, &dbValue, DB_CURRENT);
+ assert(err == 0);
}
catch(const ::DbDeadlockException& dx)
{
- if(_tx != 0)
- {
- _tx->dead();
- }
+ if(_tx != 0)
+ {
+ _tx->dead();
+ }
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
}
@@ -568,34 +568,34 @@ Freeze::IteratorHelperI::erase()
{
if(_tx != 0)
{
- _map.closeAllIteratorsExcept(_tx);
+ _map.closeAllIteratorsExcept(_tx);
}
try
{
- int err = _dbc->del(0);
- if(err == DB_KEYEMPTY)
- {
- throw InvalidPositionException(__FILE__, __LINE__);
- }
- assert(err == 0);
+ int err = _dbc->del(0);
+ if(err == DB_KEYEMPTY)
+ {
+ throw InvalidPositionException(__FILE__, __LINE__);
+ }
+ assert(err == 0);
}
catch(const ::DbDeadlockException& dx)
{
- if(_tx != 0)
- {
- _tx->dead();
- }
+ if(_tx != 0)
+ {
+ _tx->dead();
+ }
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
}
@@ -619,40 +619,40 @@ Freeze::IteratorHelperI::next(bool skipDups) const
int flags = DB_NEXT;
if(skipDups)
{
- flags = DB_NEXT_NODUP;
+ flags = DB_NEXT_NODUP;
}
else if(_indexed && _onlyDups)
{
- flags = DB_NEXT_DUP;
+ flags = DB_NEXT_DUP;
}
try
{
- if(_dbc->get(&dbKey, &dbValue, flags) == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
+ if(_dbc->get(&dbKey, &dbValue, flags) == 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
catch(const ::DbDeadlockException& dx)
{
- if(_tx != 0)
- {
- _tx->dead();
- }
+ if(_tx != 0)
+ {
+ _tx->dead();
+ }
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
}
@@ -661,35 +661,35 @@ Freeze::IteratorHelperI::close()
{
if(_dbc != 0)
{
- if(_map._trace >= 2)
- {
- Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
- out << "closing iterator on Db \"" << _map._dbName << "\"";
- }
-
- try
- {
- _dbc->close();
- }
- catch(const ::DbDeadlockException& dx)
- {
- bool raiseException = (_tx == 0);
- cleanup();
- if(raiseException)
- {
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- }
- catch(const ::DbException& dx)
- {
- cleanup();
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- cleanup();
+ if(_map._trace >= 2)
+ {
+ Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
+ out << "closing iterator on Db \"" << _map._dbName << "\"";
+ }
+
+ try
+ {
+ _dbc->close();
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ bool raiseException = (_tx == 0);
+ cleanup();
+ if(raiseException)
+ {
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ }
+ catch(const ::DbException& dx)
+ {
+ cleanup();
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ cleanup();
}
}
@@ -713,68 +713,68 @@ Freeze::IteratorHelperI::Tx::Tx(const MapHelperI& m) :
{
if(_map._trace >= 2)
{
- Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
- out << "starting transaction for Db \"" << _map._dbName << "\"";
+ Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
+ out << "starting transaction for Db \"" << _map._dbName << "\"";
}
try
{
- _map._connection->dbEnv()->getEnv()->txn_begin(0, &_txn, 0);
+ _map._connection->dbEnv()->getEnv()->txn_begin(0, &_txn, 0);
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
}
-
+
Freeze::IteratorHelperI::Tx::~Tx()
{
if(_dead)
{
- if(_map._trace >= 2)
- {
- Trace out(_map._connection->communicator()->getLogger(), "");
- out << "aborting transaction for Db \"" << _map._dbName << "\"";
- }
-
- try
- {
- _txn->abort();
- }
- catch(...)
- {
- //
- // Ignore exceptions to avoid crash during stack unwinding
- //
- }
+ if(_map._trace >= 2)
+ {
+ Trace out(_map._connection->communicator()->getLogger(), "");
+ out << "aborting transaction for Db \"" << _map._dbName << "\"";
+ }
+
+ try
+ {
+ _txn->abort();
+ }
+ catch(...)
+ {
+ //
+ // Ignore exceptions to avoid crash during stack unwinding
+ //
+ }
}
else
{
- if(_map._trace >= 2)
- {
- Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
- out << "committing transaction for Db \"" << _map._dbName.c_str() << "\"";
- }
-
- try
- {
- _txn->commit(0);
- }
- catch(const ::DbDeadlockException& dx)
- {
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ if(_map._trace >= 2)
+ {
+ Trace out(_map._connection->communicator()->getLogger(), "Freeze.Map");
+ out << "committing transaction for Db \"" << _map._dbName.c_str() << "\"";
+ }
+
+ try
+ {
+ _txn->commit(0);
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
@@ -792,31 +792,31 @@ Freeze::IteratorHelperI::Tx::dead()
Freeze::MapHelperI::MapHelperI(const ConnectionIPtr& connection,
- const string& dbName,
- const string& key,
- const string& value,
- const KeyCompareBasePtr& keyCompare,
- const vector<MapIndexBasePtr>& indices,
- bool createDb) :
+ const string& dbName,
+ const string& key,
+ const string& value,
+ const KeyCompareBasePtr& keyCompare,
+ const vector<MapIndexBasePtr>& indices,
+ bool createDb) :
_connection(connection),
_db(SharedDb::get(connection, dbName, key, value, keyCompare, indices, createDb)),
_dbName(dbName),
_trace(connection->trace())
{
for(vector<MapIndexBasePtr>::const_iterator p = indices.begin();
- p != indices.end(); ++p)
+ p != indices.end(); ++p)
{
- const MapIndexBasePtr& indexBase = *p;
- assert(indexBase->_impl != 0);
- assert(indexBase->_communicator == _connection->communicator());
- assert(indexBase->_map == 0);
-
+ const MapIndexBasePtr& indexBase = *p;
+ assert(indexBase->_impl != 0);
+ assert(indexBase->_communicator == _connection->communicator());
+ assert(indexBase->_map == 0);
+
#ifndef NDEBUG
- bool inserted =
+ bool inserted =
#endif
- _indices.insert(IndexMap::value_type(indexBase->name(), indexBase)).second;
- assert(inserted);
- indexBase->_map = this;
+ _indices.insert(IndexMap::value_type(indexBase->name(), indexBase)).second;
+ assert(inserted);
+ indexBase->_map = this;
}
_connection->registerMap(this);
@@ -832,38 +832,38 @@ Freeze::MapHelperI::find(const Key& k, bool readOnly) const
{
for(;;)
{
- try
- {
- auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false));
- if(r->find(k))
- {
- return r.release();
- }
- else
- {
- return 0;
- }
- }
- catch(const DeadlockException&)
- {
- if(_connection->dbTxn() != 0)
- {
- throw;
- }
- else
- {
- if(_connection->deadlockWarning())
- {
- Warning out(_connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapHelperI::find on Map \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- }
+ try
+ {
+ auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false));
+ if(r->find(k))
+ {
+ return r.release();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ catch(const DeadlockException&)
+ {
+ if(_connection->dbTxn() != 0)
+ {
+ throw;
+ }
+ else
+ {
+ if(_connection->deadlockWarning())
+ {
+ Warning out(_connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapHelperI::find on Map \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ }
}
}
@@ -872,38 +872,38 @@ Freeze::MapHelperI::lowerBound(const Key& k, bool readOnly) const
{
for(;;)
{
- try
- {
- auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false));
- if(r->lowerBound(k))
- {
- return r.release();
- }
- else
- {
- return 0;
- }
- }
- catch(const DeadlockException&)
- {
- if(_connection->dbTxn() != 0)
- {
- throw;
- }
- else
- {
- if(_connection->deadlockWarning())
- {
- Warning out(_connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapHelperI::lowerBound on Map \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- }
+ try
+ {
+ auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false));
+ if(r->lowerBound(k))
+ {
+ return r.release();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ catch(const DeadlockException&)
+ {
+ if(_connection->dbTxn() != 0)
+ {
+ throw;
+ }
+ else
+ {
+ if(_connection->deadlockWarning())
+ {
+ Warning out(_connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapHelperI::lowerBound on Map \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ }
}
}
@@ -912,38 +912,38 @@ Freeze::MapHelperI::upperBound(const Key& k, bool readOnly) const
{
for(;;)
{
- try
- {
- auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false));
- if(r->upperBound(k))
- {
- return r.release();
- }
- else
- {
- return 0;
- }
- }
- catch(const DeadlockException&)
- {
- if(_connection->dbTxn() != 0)
- {
- throw;
- }
- else
- {
- if(_connection->deadlockWarning())
- {
- Warning out(_connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapHelperI::upperBound on Map \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- }
+ try
+ {
+ auto_ptr<IteratorHelperI> r(new IteratorHelperI(*this, readOnly, 0, false));
+ if(r->upperBound(k))
+ {
+ return r.release();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ catch(const DeadlockException&)
+ {
+ if(_connection->dbTxn() != 0)
+ {
+ throw;
+ }
+ else
+ {
+ if(_connection->deadlockWarning())
+ {
+ Warning out(_connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapHelperI::upperBound on Map \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ }
}
}
@@ -958,56 +958,56 @@ Freeze::MapHelperI::put(const Key& key, const Value& value)
DbTxn* txn = _connection->dbTxn();
if(txn == 0)
{
- closeAllIterators();
+ closeAllIterators();
}
for(;;)
{
- try
- {
- int err = _db->put(txn, &dbKey, &dbValue,
- txn != 0 ? 0 : DB_AUTO_COMMIT);
-
- if(err == 0)
- {
- break;
- }
- else
- {
- //
- // Bug in Freeze
- //
- throw DatabaseException(__FILE__, __LINE__);
- }
- }
- catch(const ::DbDeadlockException& dx)
- {
- if(txn != 0)
- {
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- else
- {
- if(_connection->deadlockWarning())
- {
- Warning out(_connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapHelperI::put on Map \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ try
+ {
+ int err = _db->put(txn, &dbKey, &dbValue,
+ txn != 0 ? 0 : DB_AUTO_COMMIT);
+
+ if(err == 0)
+ {
+ break;
+ }
+ else
+ {
+ //
+ // Bug in Freeze
+ //
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ if(txn != 0)
+ {
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ else
+ {
+ if(_connection->deadlockWarning())
+ {
+ Warning out(_connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapHelperI::put on Map \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
@@ -1020,57 +1020,57 @@ Freeze::MapHelperI::erase(const Key& key)
DbTxn* txn = _connection->dbTxn();
if(txn == 0)
{
- closeAllIterators();
+ closeAllIterators();
}
for(;;)
{
- try
- {
- int err = _db->del(txn, &dbKey, txn != 0 ? 0 : DB_AUTO_COMMIT);
-
- if(err == 0)
- {
- return true;
- }
- else if(err == DB_NOTFOUND)
- {
- return false;
- }
- else
- {
- assert(0);
- throw DatabaseException(__FILE__, __LINE__);
- }
- }
- catch(const ::DbDeadlockException& dx)
- {
- if(txn != 0)
- {
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- else
- {
- if(_connection->deadlockWarning())
- {
- Warning out(_connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapHelperI::erase on Map \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ try
+ {
+ int err = _db->del(txn, &dbKey, txn != 0 ? 0 : DB_AUTO_COMMIT);
+
+ if(err == 0)
+ {
+ return true;
+ }
+ else if(err == DB_NOTFOUND)
+ {
+ return false;
+ }
+ else
+ {
+ assert(0);
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ if(txn != 0)
+ {
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ else
+ {
+ if(_connection->deadlockWarning())
+ {
+ Warning out(_connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapHelperI::erase on Map \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
@@ -1088,52 +1088,52 @@ Freeze::MapHelperI::count(const Key& key) const
for(;;)
{
- try
- {
- int err = _db->get(_connection->dbTxn(), &dbKey, &dbValue, 0);
-
- if(err == 0)
- {
- return 1;
- }
- else if(err == DB_NOTFOUND)
- {
- return 0;
- }
- else
- {
- assert(0);
- throw DatabaseException(__FILE__, __LINE__);
- }
- }
- catch(const ::DbDeadlockException& dx)
- {
- if(_connection->dbTxn() != 0)
- {
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- else
- {
- if(_connection->deadlockWarning())
- {
- Warning out(_connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapHelperI::count on Map \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ try
+ {
+ int err = _db->get(_connection->dbTxn(), &dbKey, &dbValue, 0);
+
+ if(err == 0)
+ {
+ return 1;
+ }
+ else if(err == DB_NOTFOUND)
+ {
+ return 0;
+ }
+ else
+ {
+ assert(0);
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ if(_connection->dbTxn() != 0)
+ {
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ else
+ {
+ if(_connection->deadlockWarning())
+ {
+ Warning out(_connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapHelperI::count on Map \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
@@ -1143,47 +1143,47 @@ Freeze::MapHelperI::clear()
DbTxn* txn = _connection->dbTxn();
if(txn == 0)
{
- closeAllIterators();
+ closeAllIterators();
}
for(;;)
{
- try
- {
- u_int32_t count;
- int err;
- err = _db->truncate(txn, &count, txn != 0 ? 0 : DB_AUTO_COMMIT);
- assert(err == 0);
- break;
- }
- catch(const ::DbDeadlockException& dx)
- {
- if(txn != 0)
- {
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- else
- {
- if(_connection->deadlockWarning())
- {
- Warning out(_connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapHelperI::clear on Map \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ try
+ {
+ u_int32_t count;
+ int err;
+ err = _db->truncate(txn, &count, txn != 0 ? 0 : DB_AUTO_COMMIT);
+ assert(err == 0);
+ break;
+ }
+ catch(const ::DbDeadlockException& dx)
+ {
+ if(txn != 0)
+ {
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ else
+ {
+ if(_connection->deadlockWarning())
+ {
+ Warning out(_connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapHelperI::clear on Map \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
@@ -1192,71 +1192,71 @@ Freeze::MapHelperI::destroy()
{
if(_dbName == catalogName())
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = "You cannot destroy the " + catalogName() + " database";
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = "You cannot destroy the " + catalogName() + " database";
+ throw ex;
}
TransactionPtr tx = _connection->currentTransaction();
bool ownTx = (tx == 0);
if(ownTx)
- {
- tx = _connection->beginTransaction();
+ {
+ tx = _connection->beginTransaction();
}
DbTxn* txn = _connection->dbTxn();
try
{
- close();
+ close();
- Catalog catalog(_connection, catalogName());
- catalog.erase(_dbName);
- _connection->dbEnv()->getEnv()->dbremove(txn, _dbName.c_str(), 0, 0);
+ Catalog catalog(_connection, catalogName());
+ catalog.erase(_dbName);
+ _connection->dbEnv()->getEnv()->dbremove(txn, _dbName.c_str(), 0, 0);
- if(ownTx)
- {
- tx->commit();
- }
+ if(ownTx)
+ {
+ tx->commit();
+ }
}
catch(const ::DbException& dx)
{
- if(ownTx)
- {
- tx = _connection->currentTransaction();
- if(tx != 0)
- {
- try
- {
- tx->rollback();
- }
- catch(...)
- {
- }
- }
- }
-
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(ownTx)
+ {
+ tx = _connection->currentTransaction();
+ if(tx != 0)
+ {
+ try
+ {
+ tx->rollback();
+ }
+ catch(...)
+ {
+ }
+ }
+ }
+
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
catch(...)
{
- if(ownTx)
- {
- tx = _connection->currentTransaction();
- if(tx != 0)
- {
- try
- {
- tx->rollback();
- }
- catch(...)
- {
- }
- }
- }
- throw;
+ if(ownTx)
+ {
+ tx = _connection->currentTransaction();
+ if(tx != 0)
+ {
+ try
+ {
+ tx->rollback();
+ }
+ catch(...)
+ {
+ }
+ }
+ }
+ throw;
}
}
@@ -1282,9 +1282,9 @@ Freeze::MapHelperI::size() const
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
size_t num = s->bt_ndata;
@@ -1298,7 +1298,7 @@ Freeze::MapHelperI::closeAllIterators()
{
while(!_iteratorList.empty())
{
- (*_iteratorList.begin())->close();
+ (*_iteratorList.begin())->close();
}
}
@@ -1308,9 +1308,9 @@ Freeze::MapHelperI::index(const string& name) const
IndexMap::const_iterator p = _indices.find(name);
if(p == _indices.end())
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = "Cannot find index \"" + name + "\"";
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = "Cannot find index \"" + name + "\"";
+ throw ex;
}
return p->second;
}
@@ -1320,16 +1320,16 @@ Freeze::MapHelperI::close()
{
if(_db != 0)
{
- _connection->unregisterMap(this);
+ _connection->unregisterMap(this);
}
_db = 0;
for(IndexMap::iterator p = _indices.begin(); p != _indices.end(); ++p)
{
- MapIndexBasePtr& indexBase = p->second;
+ MapIndexBasePtr& indexBase = p->second;
- indexBase->_impl = 0;
- indexBase->_map = 0;
+ indexBase->_impl = 0;
+ indexBase->_map = 0;
}
_indices.clear();
}
@@ -1343,15 +1343,15 @@ Freeze::MapHelperI::closeAllIteratorsExcept(const IteratorHelperI::TxPtr& tx) co
while(q != _iteratorList.end())
{
- if((*q)->tx().get() == tx.get())
- {
- ++q;
- }
- else
- {
- (*q)->close();
- q = _iteratorList.begin();
- }
+ if((*q)->tx().get() == tx.get())
+ {
+ ++q;
+ }
+ else
+ {
+ (*q)->close();
+ q = _iteratorList.begin();
+ }
}
}
@@ -1385,7 +1385,7 @@ callback(Db* secondary, const Dbt* key, const Dbt* value, Dbt* result)
Freeze::MapIndexI::MapIndexI(const ConnectionIPtr& connection, SharedDb& db,
- DbTxn* txn, bool createDb, const MapIndexBasePtr& index) :
+ DbTxn* txn, bool createDb, const MapIndexBasePtr& index) :
_index(index)
{
assert(txn != 0);
@@ -1397,7 +1397,7 @@ Freeze::MapIndexI::MapIndexI(const ConnectionIPtr& connection, SharedDb& db,
u_int32_t flags = 0;
if(createDb)
{
- flags = DB_CREATE;
+ flags = DB_CREATE;
}
_dbName = db.dbName() + "." + _index->name();
@@ -1406,7 +1406,7 @@ Freeze::MapIndexI::MapIndexI(const ConnectionIPtr& connection, SharedDb& db,
if(index->compareEnabled())
{
- _db->set_bt_compare(&customIndexCompare);
+ _db->set_bt_compare(&customIndexCompare);
}
_db->open(txn, _dbName.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE);
@@ -1429,17 +1429,17 @@ Freeze::MapIndexI::~MapIndexI()
IteratorHelper*
Freeze::MapIndexI::untypedFind(const Key& k, bool ro, const MapHelperI& m,
- bool onlyDups) const
+ bool onlyDups) const
{
auto_ptr<IteratorHelperI> r(new IteratorHelperI(m, ro, _index, onlyDups));
if(r->find(k))
{
- return r.release();
+ return r.release();
}
else
{
- return 0;
+ return 0;
}
}
@@ -1450,11 +1450,11 @@ Freeze::MapIndexI::untypedLowerBound(const Key& k, bool ro, const MapHelperI& m)
if(r->lowerBound(k))
{
- return r.release();
+ return r.release();
}
else
{
- return 0;
+ return 0;
}
}
@@ -1465,11 +1465,11 @@ Freeze::MapIndexI::untypedUpperBound(const Key& k, bool ro, const MapHelperI& m)
if(r->upperBound(k))
{
- return r.release();
+ return r.release();
}
else
{
- return 0;
+ return 0;
}
}
@@ -1493,81 +1493,81 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection)
try
{
- for(;;)
- {
- Dbc* dbc = 0;
-
- try
- {
- //
- // Move to the first record
- //
- _db->cursor(0, &dbc, 0);
- bool found = (dbc->get(&dbKey, &dbValue, DB_SET) == 0);
-
- if(found)
- {
- db_recno_t count = 0;
- dbc->count(&count, 0);
- result = static_cast<int>(count);
- }
-
- Dbc* toClose = dbc;
- dbc = 0;
- toClose->close();
- break; // for (;;)
- }
- catch(const DbDeadlockException&)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
-
- if(connection->deadlockWarning())
- {
- Warning out(connection->communicator()->getLogger());
- out << "Deadlock in Freeze::MapIndexI::untypedCount while searching \""
- << _dbName << "\"; retrying ...";
- }
-
- //
- // Retry
- //
- }
- catch(...)
- {
- if(dbc != 0)
- {
- try
- {
- dbc->close();
- }
- catch(const DbDeadlockException&)
- {
- //
- // Ignored
- //
- }
- }
- throw;
- }
- }
+ for(;;)
+ {
+ Dbc* dbc = 0;
+
+ try
+ {
+ //
+ // Move to the first record
+ //
+ _db->cursor(0, &dbc, 0);
+ bool found = (dbc->get(&dbKey, &dbValue, DB_SET) == 0);
+
+ if(found)
+ {
+ db_recno_t count = 0;
+ dbc->count(&count, 0);
+ result = static_cast<int>(count);
+ }
+
+ Dbc* toClose = dbc;
+ dbc = 0;
+ toClose->close();
+ break; // for (;;)
+ }
+ catch(const DbDeadlockException&)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+
+ if(connection->deadlockWarning())
+ {
+ Warning out(connection->communicator()->getLogger());
+ out << "Deadlock in Freeze::MapIndexI::untypedCount while searching \""
+ << _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Retry
+ //
+ }
+ catch(...)
+ {
+ if(dbc != 0)
+ {
+ try
+ {
+ dbc->close();
+ }
+ catch(const DbDeadlockException&)
+ {
+ //
+ // Ignored
+ //
+ }
+ }
+ throw;
+ }
+ }
}
catch(const DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
return result;
@@ -1575,7 +1575,7 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection)
int
Freeze::MapIndexI::secondaryKeyCreate(Db* secondary, const Dbt* dbKey,
- const Dbt* dbValue, Dbt* result)
+ const Dbt* dbValue, Dbt* result)
{
Byte* first = static_cast<Byte*>(dbValue->get_data());
Value value(first, first + dbValue->get_size());
diff --git a/cpp/src/Freeze/MapI.h b/cpp/src/Freeze/MapI.h
index fa2e3524b3e..3623beae33d 100644
--- a/cpp/src/Freeze/MapI.h
+++ b/cpp/src/Freeze/MapI.h
@@ -24,7 +24,7 @@ class IteratorHelperI : public IteratorHelper
public:
IteratorHelperI(const MapHelperI& m, bool readOnly,
- const MapIndexBasePtr& index, bool onlyDups);
+ const MapIndexBasePtr& index, bool onlyDups);
IteratorHelperI(const IteratorHelperI&);
virtual
@@ -66,20 +66,20 @@ public:
{
public:
- Tx(const MapHelperI&);
- ~Tx();
+ Tx(const MapHelperI&);
+ ~Tx();
- void dead();
+ void dead();
- DbTxn* getTxn()
- {
- return _txn;
- }
+ DbTxn* getTxn()
+ {
+ return _txn;
+ }
private:
- const MapHelperI& _map;
- DbTxn* _txn;
- bool _dead;
+ const MapHelperI& _map;
+ DbTxn* _txn;
+ bool _dead;
};
typedef IceUtil::Handle<Tx> TxPtr;
@@ -108,9 +108,9 @@ class MapHelperI : public MapHelper
public:
MapHelperI(const ConnectionIPtr&, const std::string&,
- const std::string&, const std::string&,
- const KeyCompareBasePtr&,
- const std::vector<MapIndexBasePtr>&, bool);
+ const std::string&, const std::string&,
+ const KeyCompareBasePtr&,
+ const std::vector<MapIndexBasePtr>&, bool);
virtual ~MapHelperI();
@@ -152,7 +152,7 @@ public:
const ConnectionIPtr& connection() const
{
- return _connection;
+ return _connection;
}
diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp
index 6f120752afb..24ab9ba484f 100644
--- a/cpp/src/Freeze/ObjectStore.cpp
+++ b/cpp/src/Freeze/ObjectStore.cpp
@@ -20,9 +20,9 @@ using namespace Freeze;
Freeze::ObjectStore::ObjectStore(const string& facet,
- bool createDb, EvictorI* evictor,
- const vector<IndexPtr>& indices,
- bool populateEmptyIndices) :
+ bool createDb, EvictorI* evictor,
+ const vector<IndexPtr>& indices,
+ bool populateEmptyIndices) :
_facet(facet),
_evictor(evictor),
_indices(indices),
@@ -30,11 +30,11 @@ Freeze::ObjectStore::ObjectStore(const string& facet,
{
if(facet == "")
{
- _dbName = EvictorI::defaultDb;
+ _dbName = EvictorI::defaultDb;
}
else
{
- _dbName = facet;
+ _dbName = facet;
}
ConnectionPtr catalogConnection = createConnection(_communicator, evictor->dbEnv()->getEnvName());
@@ -43,85 +43,85 @@ Freeze::ObjectStore::ObjectStore(const string& facet,
Catalog::iterator p = catalog.find(evictor->filename());
if(p != catalog.end())
{
- if(p->second.evictor == false)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = evictor->filename() + " is an evictor database";
- throw ex;
- }
+ if(p->second.evictor == false)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = evictor->filename() + " is an evictor database";
+ throw ex;
+ }
}
DbEnv* dbEnv = evictor->dbEnv()->getEnv();
try
{
- _db.reset(new Db(dbEnv, 0));
-
- TransactionPtr tx = catalogConnection->beginTransaction();
- DbTxn* txn = getTxn(tx);
-
- u_int32_t flags = DB_THREAD;
- if(createDb)
- {
- flags |= DB_CREATE;
- }
- _db->open(txn, evictor->filename().c_str(), _dbName.c_str(), DB_BTREE, flags, FREEZE_DB_MODE);
-
- for(size_t i = 0; i < _indices.size(); ++i)
- {
- _indices[i]->_impl->associate(this, txn, createDb, populateEmptyIndices);
- }
-
- if(p == catalog.end())
- {
- CatalogData catalogData;
- catalogData.evictor = true;
- catalog.put(Catalog::value_type(evictor->filename(), catalogData));
- }
-
- tx->commit();
+ _db.reset(new Db(dbEnv, 0));
+
+ TransactionPtr tx = catalogConnection->beginTransaction();
+ DbTxn* txn = getTxn(tx);
+
+ u_int32_t flags = DB_THREAD;
+ if(createDb)
+ {
+ flags |= DB_CREATE;
+ }
+ _db->open(txn, evictor->filename().c_str(), _dbName.c_str(), DB_BTREE, flags, FREEZE_DB_MODE);
+
+ for(size_t i = 0; i < _indices.size(); ++i)
+ {
+ _indices[i]->_impl->associate(this, txn, createDb, populateEmptyIndices);
+ }
+
+ if(p == catalog.end())
+ {
+ CatalogData catalogData;
+ catalogData.evictor = true;
+ catalog.put(Catalog::value_type(evictor->filename(), catalogData));
+ }
+
+ tx->commit();
}
catch(const DbException& dx)
{
- TransactionPtr tx = catalogConnection->currentTransaction();
- if(tx != 0)
- {
- try
- {
- tx->rollback();
- }
- catch(...)
- {
- }
- }
-
- if(dx.get_errno() == ENOENT)
- {
- NotFoundException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- else
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ TransactionPtr tx = catalogConnection->currentTransaction();
+ if(tx != 0)
+ {
+ try
+ {
+ tx->rollback();
+ }
+ catch(...)
+ {
+ }
+ }
+
+ if(dx.get_errno() == ENOENT)
+ {
+ NotFoundException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ else
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
catch(...)
{
- TransactionPtr tx = catalogConnection->currentTransaction();
- if(tx != 0)
- {
- try
- {
- tx->rollback();
- }
- catch(...)
- {
- }
- }
- throw;
+ TransactionPtr tx = catalogConnection->currentTransaction();
+ if(tx != 0)
+ {
+ try
+ {
+ tx->rollback();
+ }
+ catch(...)
+ {
+ }
+ }
+ throw;
}
}
@@ -129,7 +129,7 @@ Freeze::ObjectStore::~ObjectStore()
{
if(_db.get() != 0)
{
- close();
+ close();
}
}
@@ -138,19 +138,19 @@ Freeze::ObjectStore::close()
{
try
{
- _db->close(0);
-
- for(size_t i = 0; i < _indices.size(); ++i)
- {
- _indices[i]->_impl->close();
- }
- _indices.clear();
+ _db->close(0);
+
+ for(size_t i = 0; i < _indices.size(); ++i)
+ {
+ _indices[i]->_impl->close();
+ }
+ _indices.clear();
}
catch(const DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
_db.reset();
}
@@ -171,43 +171,43 @@ Freeze::ObjectStore::dbHasObject(const Identity& ident) const
for(;;)
{
- try
- {
- int err = _db->get(0, &dbKey, &dbValue, 0);
-
- if(err == 0)
- {
- return true;
- }
- else if(err == DB_NOTFOUND)
- {
- return false;
- }
- else
- {
- assert(0);
- throw DatabaseException(__FILE__, __LINE__);
- }
- }
- catch(const DbDeadlockException&)
- {
- if(_evictor->deadlockWarning())
- {
- Warning out(_communicator->getLogger());
- out << "Deadlock in Freeze::ObjectStore::dbHasObject while searching \""
- << _evictor->filename() + "/" + _dbName << "\"; retrying ...";
- }
-
- //
- // Ignored, try again
- //
- }
- catch(const DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ try
+ {
+ int err = _db->get(0, &dbKey, &dbValue, 0);
+
+ if(err == 0)
+ {
+ return true;
+ }
+ else if(err == DB_NOTFOUND)
+ {
+ return false;
+ }
+ else
+ {
+ assert(0);
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ }
+ catch(const DbDeadlockException&)
+ {
+ if(_evictor->deadlockWarning())
+ {
+ Warning out(_communicator->getLogger());
+ out << "Deadlock in Freeze::ObjectStore::dbHasObject while searching \""
+ << _evictor->filename() + "/" + _dbName << "\"; retrying ...";
+ }
+
+ //
+ // Ignored, try again
+ //
+ }
+ catch(const DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
@@ -217,37 +217,37 @@ Freeze::ObjectStore::save(Key& key, Value& value, Byte status, DbTxn* tx)
{
switch(status)
{
- case EvictorElement::created:
- case EvictorElement::modified:
- {
- Dbt dbKey;
- Dbt dbValue;
- initializeInDbt(key, dbKey);
- initializeInDbt(value, dbValue);
- u_int32_t flags = (status == EvictorElement::created) ? DB_NOOVERWRITE : 0;
- int err = _db->put(tx, &dbKey, &dbValue, flags);
- if(err != 0)
- {
- throw DatabaseException(__FILE__, __LINE__);
- }
- break;
- }
-
- case EvictorElement::destroyed:
- {
- Dbt dbKey;
- initializeInDbt(key, dbKey);
- int err = _db->del(tx, &dbKey, 0);
- if(err != 0)
- {
- throw DatabaseException(__FILE__, __LINE__);
- }
- break;
- }
- default:
- {
- assert(0);
- }
+ case EvictorElement::created:
+ case EvictorElement::modified:
+ {
+ Dbt dbKey;
+ Dbt dbValue;
+ initializeInDbt(key, dbKey);
+ initializeInDbt(value, dbValue);
+ u_int32_t flags = (status == EvictorElement::created) ? DB_NOOVERWRITE : 0;
+ int err = _db->put(tx, &dbKey, &dbValue, flags);
+ if(err != 0)
+ {
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ break;
+ }
+
+ case EvictorElement::destroyed:
+ {
+ Dbt dbKey;
+ initializeInDbt(key, dbKey);
+ int err = _db->del(tx, &dbKey, 0);
+ if(err != 0)
+ {
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ break;
+ }
+ default:
+ {
+ assert(0);
+ }
}
}
@@ -322,36 +322,36 @@ Freeze::ObjectStore::load(const Identity& ident)
for(;;)
{
- try
- {
- int rs = _db->get(0, &dbKey, &dbValue, 0);
- if(rs == DB_NOTFOUND)
- {
- return 0;
- }
- else if(rs != 0)
- {
- assert(0);
- throw DatabaseException(__FILE__, __LINE__);
- }
- break; // for(;;)
- }
- catch(const DbDeadlockException&)
- {
- if(_evictor->deadlockWarning())
- {
- Warning out(_communicator->getLogger());
- out << "Deadlock in Freeze::ObjectStore::load while searching \""
- << _evictor->filename() + "/" + _dbName << "\"; retrying ...";
- }
- //
- // Ignored, try again
- //
- }
- catch(const DbException& dx)
- {
- handleDbException(dx, value, dbValue, __FILE__, __LINE__);
- }
+ try
+ {
+ int rs = _db->get(0, &dbKey, &dbValue, 0);
+ if(rs == DB_NOTFOUND)
+ {
+ return 0;
+ }
+ else if(rs != 0)
+ {
+ assert(0);
+ throw DatabaseException(__FILE__, __LINE__);
+ }
+ break; // for(;;)
+ }
+ catch(const DbDeadlockException&)
+ {
+ if(_evictor->deadlockWarning())
+ {
+ Warning out(_communicator->getLogger());
+ out << "Deadlock in Freeze::ObjectStore::load while searching \""
+ << _evictor->filename() + "/" + _dbName << "\"; retrying ...";
+ }
+ //
+ // Ignored, try again
+ //
+ }
+ catch(const DbException& dx)
+ {
+ handleDbException(dx, value, dbValue, __FILE__, __LINE__);
+ }
}
EvictorElementPtr result = new EvictorElement(*this);
diff --git a/cpp/src/Freeze/ObjectStore.h b/cpp/src/Freeze/ObjectStore.h
index 274a82331f7..94db579a64d 100644
--- a/cpp/src/Freeze/ObjectStore.h
+++ b/cpp/src/Freeze/ObjectStore.h
@@ -36,7 +36,7 @@ class ObjectStore : public Cache
public:
ObjectStore(const std::string&, bool, EvictorI*,
- const std::vector<IndexPtr>& = std::vector<IndexPtr>(), bool = false);
+ const std::vector<IndexPtr>& = std::vector<IndexPtr>(), bool = false);
virtual ~ObjectStore();
diff --git a/cpp/src/Freeze/SharedDb.cpp b/cpp/src/Freeze/SharedDb.cpp
index 86205fa91b4..0c208c26eb1 100644
--- a/cpp/src/Freeze/SharedDb.cpp
+++ b/cpp/src/Freeze/SharedDb.cpp
@@ -31,15 +31,15 @@ checkTypes(const SharedDb& sharedDb, const string& key, const string& value)
{
if(key != sharedDb.key())
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = sharedDb.dbName() + "'s key type is " + sharedDb.key() + ", not " + key;
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = sharedDb.dbName() + "'s key type is " + sharedDb.key() + ", not " + key;
+ throw ex;
}
if(value != sharedDb.value())
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = sharedDb.dbName() + "'s value type is " + sharedDb.value() + ", not " + value;
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = sharedDb.dbName() + "'s value type is " + sharedDb.value() + ", not " + value;
+ throw ex;
}
}
}
@@ -68,29 +68,29 @@ Freeze::catalogName()
SharedDbPtr
Freeze::SharedDb::get(const ConnectionIPtr& connection,
- const string& dbName,
- const string& key,
- const string& value,
- const KeyCompareBasePtr& keyCompare,
- const vector<MapIndexBasePtr>& indices,
- bool createDb)
+ const string& dbName,
+ const string& key,
+ const string& value,
+ const KeyCompareBasePtr& keyCompare,
+ const vector<MapIndexBasePtr>& indices,
+ bool createDb)
{
if(dbName == _catalogName)
{
- //
- // We don't want to lock the _mapMutex to retrieve the catalog
- //
-
- SharedDbPtr result = connection->dbEnv()->getCatalog();
- checkTypes(*result, key, value);
- return result;
+ //
+ // We don't want to lock the _mapMutex to retrieve the catalog
+ //
+
+ SharedDbPtr result = connection->dbEnv()->getCatalog();
+ checkTypes(*result, key, value);
+ return result;
}
StaticMutex::Lock lock(_mapMutex);
if(sharedDbMap == 0)
{
- sharedDbMap = new SharedDbMap;
+ sharedDbMap = new SharedDbMap;
}
MapKey mapKey;
@@ -99,20 +99,20 @@ Freeze::SharedDb::get(const ConnectionIPtr& connection,
mapKey.dbName = dbName;
{
- SharedDbMap::iterator p = sharedDbMap->find(mapKey);
- if(p != sharedDbMap->end())
- {
- checkTypes(*(p->second), key, value);
- p->second->connectIndices(indices);
- return p->second;
- }
+ SharedDbMap::iterator p = sharedDbMap->find(mapKey);
+ if(p != sharedDbMap->end())
+ {
+ checkTypes(*(p->second), key, value);
+ p->second->connectIndices(indices);
+ return p->second;
+ }
}
//
// MapKey not found, let's create and open a new Db
//
auto_ptr<SharedDb> result(new SharedDb(mapKey, key, value, connection,
- keyCompare, indices, createDb));
+ keyCompare, indices, createDb));
//
// Insert it into the map
@@ -131,7 +131,7 @@ Freeze::SharedDb::openCatalog(SharedDbEnv& dbEnv)
if(sharedDbMap == 0)
{
- sharedDbMap = new SharedDbMap;
+ sharedDbMap = new SharedDbMap;
}
MapKey mapKey;
@@ -145,17 +145,17 @@ Freeze::SharedDb::openCatalog(SharedDbEnv& dbEnv)
// Insert it into the map
//
pair<SharedDbMap::iterator, bool> insertResult
- = sharedDbMap->insert(SharedDbMap::value_type(mapKey, result.get()));
+ = sharedDbMap->insert(SharedDbMap::value_type(mapKey, result.get()));
if(!insertResult.second)
{
- //
- // That's very wrong: the catalog is associated with another env
- //
- assert(0);
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = "Catalog already opened";
- throw ex;
+ //
+ // That's very wrong: the catalog is associated with another env
+ //
+ assert(0);
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = "Catalog already opened";
+ throw ex;
}
return result.release();
@@ -166,8 +166,8 @@ Freeze::SharedDb::~SharedDb()
{
if(_trace >= 1)
{
- Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
- out << "closing Db \"" << _mapKey.dbName << "\"";
+ Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
+ out << "closing Db \"" << _mapKey.dbName << "\"";
}
cleanup(false);
@@ -177,8 +177,8 @@ void Freeze::SharedDb::__incRef()
{
if(_trace >= 2)
{
- Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
- out << "incremeting reference count for Db \"" << _mapKey.dbName << "\"";
+ Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
+ out << "incremeting reference count for Db \"" << _mapKey.dbName << "\"";
}
IceUtil::StaticMutex::Lock lock(_refCountMutex);
@@ -189,57 +189,57 @@ void Freeze::SharedDb::__decRef()
{
if(_trace >= 2)
{
- Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
- out << "removing reference count for Db \"" << _mapKey.dbName << "\"";
+ Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
+ out << "removing reference count for Db \"" << _mapKey.dbName << "\"";
}
IceUtil::StaticMutex::Lock lock(_refCountMutex);
if(--_refCount == 0)
{
IceUtil::StaticMutex::TryLock mapLock(_mapMutex);
- if(!mapLock.acquired())
- {
- //
- // Reacquire mutex in proper order and check again
- //
- lock.release();
- mapLock.acquire();
- lock.acquire();
- if(_refCount > 0)
- {
- return;
- }
- }
-
- //
- // Remove from map
- //
- size_t one;
- one = sharedDbMap->erase(_mapKey);
- assert(one == 1);
-
- if(sharedDbMap->size() == 0)
- {
- delete sharedDbMap;
- sharedDbMap = 0;
- }
-
- //
- // Keep lock to prevent somebody else to re-open this Db
- // before it's closed.
- //
- delete this;
+ if(!mapLock.acquired())
+ {
+ //
+ // Reacquire mutex in proper order and check again
+ //
+ lock.release();
+ mapLock.acquire();
+ lock.acquire();
+ if(_refCount > 0)
+ {
+ return;
+ }
+ }
+
+ //
+ // Remove from map
+ //
+ size_t one;
+ one = sharedDbMap->erase(_mapKey);
+ assert(one == 1);
+
+ if(sharedDbMap->size() == 0)
+ {
+ delete sharedDbMap;
+ sharedDbMap = 0;
+ }
+
+ //
+ // Keep lock to prevent somebody else to re-open this Db
+ // before it's closed.
+ //
+ delete this;
}
}
Freeze::SharedDb::SharedDb(const MapKey& mapKey,
- const string& key,
- const string& value,
- const ConnectionIPtr& connection,
- const KeyCompareBasePtr& keyCompare,
- const vector<MapIndexBasePtr>& indices,
- bool createDb) :
+ const string& key,
+ const string& value,
+ const ConnectionIPtr& connection,
+ const KeyCompareBasePtr& keyCompare,
+ const vector<MapIndexBasePtr>& indices,
+ bool createDb) :
Db(connection->dbEnv()->getEnv(), 0),
_mapKey(mapKey),
_refCount(0),
@@ -248,128 +248,128 @@ Freeze::SharedDb::SharedDb(const MapKey& mapKey,
{
if(_trace >= 1)
{
- Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
- out << "opening Db \"" << _mapKey.dbName << "\"";
+ Trace out(_mapKey.communicator->getLogger(), "Freeze.Map");
+ out << "opening Db \"" << _mapKey.dbName << "\"";
}
ConnectionPtr catalogConnection =
- createConnection(_mapKey.communicator, connection->dbEnv()->getEnvName());
+ createConnection(_mapKey.communicator, connection->dbEnv()->getEnvName());
Catalog catalog(catalogConnection, _catalogName);
Catalog::iterator ci = catalog.find(_mapKey.dbName);
if(ci != catalog.end())
{
- if(ci->second.evictor)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = _mapKey.dbName + " is an evictor database";
- throw ex;
- }
-
- _key = ci->second.key;
- _value = ci->second.value;
- checkTypes(*this, key, value);
+ if(ci->second.evictor)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = _mapKey.dbName + " is an evictor database";
+ throw ex;
+ }
+
+ _key = ci->second.key;
+ _value = ci->second.value;
+ checkTypes(*this, key, value);
}
else
{
- _key = key;
- _value = value;
+ _key = key;
+ _value = value;
}
set_app_private(this);
if(_keyCompare->compareEnabled())
{
- set_bt_compare(&customCompare);
+ set_bt_compare(&customCompare);
}
try
{
- TransactionPtr tx = catalogConnection->beginTransaction();
- DbTxn* txn = getTxn(tx);
-
- u_int32_t flags = DB_THREAD;
- if(createDb)
- {
- flags |= DB_CREATE;
- }
- open(txn, _mapKey.dbName.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE);
-
- for(vector<MapIndexBasePtr>::const_iterator p = indices.begin();
- p != indices.end(); ++p)
- {
- const MapIndexBasePtr& indexBase = *p;
- assert(indexBase->_impl == 0);
- assert(indexBase->_communicator == 0);
- indexBase->_communicator = connection->communicator();
-
- auto_ptr<MapIndexI> indexI(new MapIndexI(connection, *this, txn, createDb, indexBase));
-
+ TransactionPtr tx = catalogConnection->beginTransaction();
+ DbTxn* txn = getTxn(tx);
+
+ u_int32_t flags = DB_THREAD;
+ if(createDb)
+ {
+ flags |= DB_CREATE;
+ }
+ open(txn, _mapKey.dbName.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE);
+
+ for(vector<MapIndexBasePtr>::const_iterator p = indices.begin();
+ p != indices.end(); ++p)
+ {
+ const MapIndexBasePtr& indexBase = *p;
+ assert(indexBase->_impl == 0);
+ assert(indexBase->_communicator == 0);
+ indexBase->_communicator = connection->communicator();
+
+ auto_ptr<MapIndexI> indexI(new MapIndexI(connection, *this, txn, createDb, indexBase));
+
#ifndef NDEBUG
- bool inserted =
+ bool inserted =
#endif
- _indices.insert(IndexMap::value_type(indexBase->name(), indexI.get())).second;
- assert(inserted);
-
- indexBase->_impl = indexI.release();
- }
-
- if(ci == catalog.end())
- {
- CatalogData catalogData;
- catalogData.evictor = false;
- catalogData.key = key;
- catalogData.value = value;
- catalog.put(Catalog::value_type(_mapKey.dbName, catalogData));
- }
-
- tx->commit();
+ _indices.insert(IndexMap::value_type(indexBase->name(), indexI.get())).second;
+ assert(inserted);
+
+ indexBase->_impl = indexI.release();
+ }
+
+ if(ci == catalog.end())
+ {
+ CatalogData catalogData;
+ catalogData.evictor = false;
+ catalogData.key = key;
+ catalogData.value = value;
+ catalog.put(Catalog::value_type(_mapKey.dbName, catalogData));
+ }
+
+ tx->commit();
}
catch(const ::DbException& dx)
{
- TransactionPtr tx = catalogConnection->currentTransaction();
- if(tx != 0)
- {
- try
- {
- tx->rollback();
- }
- catch(...)
- {
- }
- }
-
- cleanup(true);
-
- if(dx.get_errno() == ENOENT)
- {
- NotFoundException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- else
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ TransactionPtr tx = catalogConnection->currentTransaction();
+ if(tx != 0)
+ {
+ try
+ {
+ tx->rollback();
+ }
+ catch(...)
+ {
+ }
+ }
+
+ cleanup(true);
+
+ if(dx.get_errno() == ENOENT)
+ {
+ NotFoundException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ else
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
catch(...)
{
- TransactionPtr tx = catalogConnection->currentTransaction();
- if(tx != 0)
- {
- try
- {
- tx->rollback();
- }
- catch(...)
- {
- }
- }
-
- cleanup(true);
- throw;
+ TransactionPtr tx = catalogConnection->currentTransaction();
+ if(tx != 0)
+ {
+ try
+ {
+ tx->rollback();
+ }
+ catch(...)
+ {
+ }
+ }
+
+ cleanup(true);
+ throw;
}
}
@@ -385,20 +385,20 @@ Freeze::SharedDb::SharedDb(const MapKey& mapKey, DbEnv* env) :
if(_trace >= 1)
{
- Trace out(_mapKey.communicator->getLogger(), "Freeze.Db");
- out << "opening Db \"" << _mapKey.dbName << "\"";
+ Trace out(_mapKey.communicator->getLogger(), "Freeze.Db");
+ out << "opening Db \"" << _mapKey.dbName << "\"";
}
try
{
- u_int32_t flags = DB_THREAD | DB_CREATE | DB_AUTO_COMMIT;
- open(0, _mapKey.dbName.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE);
+ u_int32_t flags = DB_THREAD | DB_CREATE | DB_AUTO_COMMIT;
+ open(0, _mapKey.dbName.c_str(), 0, DB_BTREE, flags, FREEZE_DB_MODE);
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
}
@@ -406,15 +406,15 @@ void
Freeze::SharedDb::connectIndices(const vector<MapIndexBasePtr>& indices) const
{
for(vector<MapIndexBasePtr>::const_iterator p = indices.begin();
- p != indices.end(); ++p)
+ p != indices.end(); ++p)
{
- const MapIndexBasePtr& indexBase = *p;
- assert(indexBase->_impl == 0);
+ const MapIndexBasePtr& indexBase = *p;
+ assert(indexBase->_impl == 0);
- IndexMap::const_iterator q = _indices.find(indexBase->name());
- assert(q != _indices.end());
- indexBase->_impl = q->second;
- indexBase->_communicator = _mapKey.communicator;
+ IndexMap::const_iterator q = _indices.find(indexBase->name());
+ assert(q != _indices.end());
+ indexBase->_impl = q->second;
+ indexBase->_communicator = _mapKey.communicator;
}
}
@@ -423,21 +423,21 @@ Freeze::SharedDb::cleanup(bool noThrow)
{
try
{
- for(IndexMap::iterator p = _indices.begin(); p != _indices.end(); ++p)
- {
- delete p->second;
- }
- _indices.clear();
-
- close(0);
+ for(IndexMap::iterator p = _indices.begin(); p != _indices.end(); ++p)
+ {
+ delete p->second;
+ }
+ _indices.clear();
+
+ close(0);
}
catch(const ::DbException& dx)
{
- if(!noThrow)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ if(!noThrow)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
diff --git a/cpp/src/Freeze/SharedDb.h b/cpp/src/Freeze/SharedDb.h
index a6ce6672c44..3576f51fa23 100644
--- a/cpp/src/Freeze/SharedDb.h
+++ b/cpp/src/Freeze/SharedDb.h
@@ -30,7 +30,7 @@ class MapIndexI
public:
MapIndexI(const ConnectionIPtr&, SharedDb&,
- DbTxn*, bool, const MapIndexBasePtr&);
+ DbTxn*, bool, const MapIndexBasePtr&);
~MapIndexI();
@@ -45,17 +45,17 @@ public:
const std::string name() const
{
- return _index->name();
+ return _index->name();
}
Db* db() const
{
- return _db.get();
+ return _db.get();
}
const MapIndexBasePtr& getKeyCompare() const
{
- return _index;
+ return _index;
}
private:
@@ -73,9 +73,9 @@ public:
using Db::get;
static SharedDbPtr get(const ConnectionIPtr&, const std::string&,
- const std::string&, const std::string&,
- const KeyCompareBasePtr&,
- const std::vector<MapIndexBasePtr>&, bool);
+ const std::string&, const std::string&,
+ const KeyCompareBasePtr&,
+ const std::vector<MapIndexBasePtr>&, bool);
static SharedDbPtr openCatalog(SharedDbEnv&);
@@ -101,7 +101,7 @@ public:
virtual int
get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags)
{
- return ::Db::get(txnid, key, data, flags);
+ return ::Db::get(txnid, key, data, flags);
}
#endif
@@ -111,19 +111,19 @@ private:
struct MapKey
{
- std::string envName;
- Ice::CommunicatorPtr communicator;
- std::string dbName;
+ std::string envName;
+ Ice::CommunicatorPtr communicator;
+ std::string dbName;
- inline bool
- operator<(const MapKey& rhs) const;
+ inline bool
+ operator<(const MapKey& rhs) const;
};
typedef std::map<MapKey, Freeze::SharedDb*> SharedDbMap;
SharedDb(const MapKey&, const std::string&, const std::string&,
- const ConnectionIPtr&, const KeyCompareBasePtr&,
- const std::vector<MapIndexBasePtr>&, bool);
+ const ConnectionIPtr&, const KeyCompareBasePtr&,
+ const std::vector<MapIndexBasePtr>&, bool);
SharedDb(const MapKey&, DbEnv*);
@@ -170,8 +170,8 @@ inline bool
SharedDb::MapKey::operator<(const MapKey& rhs) const
{
return (communicator < rhs.communicator) ||
- ((communicator == rhs.communicator) && (dbName < rhs.dbName)) ||
- ((communicator == rhs.communicator) && (dbName == rhs.dbName) && (envName < rhs.envName));
+ ((communicator == rhs.communicator) && (dbName < rhs.dbName)) ||
+ ((communicator == rhs.communicator) && (dbName == rhs.dbName) && (envName < rhs.envName));
}
}
diff --git a/cpp/src/Freeze/SharedDbEnv.cpp b/cpp/src/Freeze/SharedDbEnv.cpp
index ea1dc64a054..3c03af446d2 100644
--- a/cpp/src/Freeze/SharedDbEnv.cpp
+++ b/cpp/src/Freeze/SharedDbEnv.cpp
@@ -59,7 +59,7 @@ inline bool
operator<(const MapKey& lhs, const MapKey& rhs)
{
return (lhs.communicator < rhs.communicator) ||
- ((lhs.communicator == rhs.communicator) && (lhs.envName < rhs.envName));
+ ((lhs.communicator == rhs.communicator) && (lhs.envName < rhs.envName));
}
#if DB_VERSION_MAJOR != 4
@@ -92,13 +92,13 @@ SharedDbEnvMap* sharedDbEnvMap;
Freeze::SharedDbEnvPtr
Freeze::SharedDbEnv::get(const CommunicatorPtr& communicator,
- const string& envName, DbEnv* env)
+ const string& envName, DbEnv* env)
{
StaticMutex::Lock lock(_mapMutex);
if(sharedDbEnvMap == 0)
{
- sharedDbEnvMap = new SharedDbEnvMap;
+ sharedDbEnvMap = new SharedDbEnvMap;
}
MapKey key;
@@ -106,11 +106,11 @@ Freeze::SharedDbEnv::get(const CommunicatorPtr& communicator,
key.communicator = communicator;
{
- SharedDbEnvMap::iterator p = sharedDbEnvMap->find(key);
- if(p != sharedDbEnvMap->end())
- {
- return p->second;
- }
+ SharedDbEnvMap::iterator p = sharedDbEnvMap->find(key);
+ if(p != sharedDbEnvMap->end())
+ {
+ return p->second;
+ }
}
//
@@ -132,8 +132,8 @@ Freeze::SharedDbEnv::~SharedDbEnv()
{
if(_trace >= 1)
{
- Trace out(_communicator->getLogger(), "Freeze.DbEnv");
- out << "closing database environment \"" << _envName << "\"";
+ Trace out(_communicator->getLogger(), "Freeze.DbEnv");
+ out << "closing database environment \"" << _envName << "\"";
}
//
@@ -146,22 +146,22 @@ Freeze::SharedDbEnv::~SharedDbEnv()
//
if(_thread != 0)
{
- _thread->terminate();
- _thread = 0;
+ _thread->terminate();
+ _thread = 0;
}
if(_envHolder.get() != 0)
{
- try
- {
- _envHolder->close(0);
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
+ try
+ {
+ _envHolder->close(0);
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
@@ -177,47 +177,47 @@ void Freeze::SharedDbEnv::__decRef()
if(--_refCount == 0)
{
IceUtil::StaticMutex::TryLock mapLock(_mapMutex);
- if(!mapLock.acquired())
- {
- //
- // Reacquire mutex in proper order and check again
- //
- lock.release();
- mapLock.acquire();
- lock.acquire();
- if(_refCount > 0)
- {
- return;
- }
- }
-
- //
- // Remove from map
- //
+ if(!mapLock.acquired())
+ {
+ //
+ // Reacquire mutex in proper order and check again
+ //
+ lock.release();
+ mapLock.acquire();
+ lock.acquire();
+ if(_refCount > 0)
+ {
+ return;
+ }
+ }
+
+ //
+ // Remove from map
+ //
MapKey key;
key.envName = _envName;
key.communicator = _communicator;
- size_t one;
- one = sharedDbEnvMap->erase(key);
- assert(one == 1);
-
- if(sharedDbEnvMap->size() == 0)
- {
- delete sharedDbEnvMap;
- sharedDbEnvMap = 0;
- }
-
- //
- // Keep lock to prevent somebody else to re-open this DbEnv
- // before it's closed.
- //
- delete this;
+ size_t one;
+ one = sharedDbEnvMap->erase(key);
+ assert(one == 1);
+
+ if(sharedDbEnvMap->size() == 0)
+ {
+ delete sharedDbEnvMap;
+ sharedDbEnvMap = 0;
+ }
+
+ //
+ // Keep lock to prevent somebody else to re-open this DbEnv
+ // before it's closed.
+ //
+ delete this;
}
}
Freeze::SharedDbEnv::SharedDbEnv(const std::string& envName,
- const Ice::CommunicatorPtr& communicator, DbEnv* env) :
+ const Ice::CommunicatorPtr& communicator, DbEnv* env) :
_env(env),
_envName(envName),
_communicator(communicator),
@@ -229,113 +229,113 @@ Freeze::SharedDbEnv::SharedDbEnv(const std::string& envName,
if(_env == 0)
{
- _envHolder.reset(new DbEnv(0));
- _env = _envHolder.get();
+ _envHolder.reset(new DbEnv(0));
+ _env = _envHolder.get();
- if(_trace >= 1)
- {
- Trace out(_communicator->getLogger(), "Freeze.DbEnv");
- out << "opening database environment \"" << envName << "\"";
- }
+ if(_trace >= 1)
+ {
+ Trace out(_communicator->getLogger(), "Freeze.DbEnv");
+ out << "opening database environment \"" << envName << "\"";
+ }
- string propertyPrefix = string("Freeze.DbEnv.") + envName;
-
- try
- {
- _env->set_errpfx(reinterpret_cast<char*>(this));
+ string propertyPrefix = string("Freeze.DbEnv.") + envName;
+
+ try
+ {
+ _env->set_errpfx(reinterpret_cast<char*>(this));
- _env->set_errcall(dbErrCallback);
+ _env->set_errcall(dbErrCallback);
#ifdef _WIN32
- //
- // Berkeley DB may use a different C++ runtime
- //
- _env->set_alloc(::malloc, ::realloc, ::free);
+ //
+ // Berkeley DB may use a different C++ runtime
+ //
+ _env->set_alloc(::malloc, ::realloc, ::free);
#endif
-
- //
- // Deadlock detection
- //
- _env->set_lk_detect(DB_LOCK_YOUNGEST);
-
- u_int32_t flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN;
-
- if(properties->getPropertyAsInt(propertyPrefix + ".DbRecoverFatal") != 0)
- {
- flags |= DB_RECOVER_FATAL | DB_CREATE;
- }
- else
- {
- flags |= DB_RECOVER | DB_CREATE;
- }
-
- if(properties->getPropertyAsIntWithDefault(propertyPrefix + ".DbPrivate", 1) != 0)
- {
- flags |= DB_PRIVATE;
- }
-
- /*
-
- //
- // Does not seem to work reliably in 4.1.25
- //
-
- time_t timeStamp = properties->getPropertyAsIntWithDefault(propertyPrefix + ".TxTimestamp", 0);
-
- if(timeStamp != 0)
- {
- try
- {
- set_tx_timestamp(&timeStamp);
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- }
- */
-
- //
- // Maybe we can deprecate this property since it can be set in the DB_CONFIG file
- //
- bool autoDelete = (properties->getPropertyAsIntWithDefault(
- propertyPrefix + ".OldLogsAutoDelete", 1) != 0);
-
- if(autoDelete)
- {
- _env->set_flags(DB_LOG_AUTOREMOVE, 1);
- }
-
- //
- // Threading
- //
- flags |= DB_THREAD;
-
- string dbHome = properties->getPropertyWithDefault(
- propertyPrefix + ".DbHome", envName);
-
- _env->open(dbHome.c_str(), flags, FREEZE_DB_MODE);
- }
- catch(const ::DbException& dx)
- {
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
-
- //
- // Default checkpoint period is every 120 seconds
- //
- Int checkpointPeriod = properties->getPropertyAsIntWithDefault(
- propertyPrefix + ".CheckpointPeriod", 120);
- Int kbyte = properties->getPropertyAsIntWithDefault(propertyPrefix + ".PeriodicCheckpointMinSize", 0);
-
- if(checkpointPeriod > 0)
- {
- _thread = new CheckpointThread(*this, Time::seconds(checkpointPeriod), kbyte, _trace);
- }
+
+ //
+ // Deadlock detection
+ //
+ _env->set_lk_detect(DB_LOCK_YOUNGEST);
+
+ u_int32_t flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN;
+
+ if(properties->getPropertyAsInt(propertyPrefix + ".DbRecoverFatal") != 0)
+ {
+ flags |= DB_RECOVER_FATAL | DB_CREATE;
+ }
+ else
+ {
+ flags |= DB_RECOVER | DB_CREATE;
+ }
+
+ if(properties->getPropertyAsIntWithDefault(propertyPrefix + ".DbPrivate", 1) != 0)
+ {
+ flags |= DB_PRIVATE;
+ }
+
+ /*
+
+ //
+ // Does not seem to work reliably in 4.1.25
+ //
+
+ time_t timeStamp = properties->getPropertyAsIntWithDefault(propertyPrefix + ".TxTimestamp", 0);
+
+ if(timeStamp != 0)
+ {
+ try
+ {
+ set_tx_timestamp(&timeStamp);
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+ }
+ */
+
+ //
+ // Maybe we can deprecate this property since it can be set in the DB_CONFIG file
+ //
+ bool autoDelete = (properties->getPropertyAsIntWithDefault(
+ propertyPrefix + ".OldLogsAutoDelete", 1) != 0);
+
+ if(autoDelete)
+ {
+ _env->set_flags(DB_LOG_AUTOREMOVE, 1);
+ }
+
+ //
+ // Threading
+ //
+ flags |= DB_THREAD;
+
+ string dbHome = properties->getPropertyWithDefault(
+ propertyPrefix + ".DbHome", envName);
+
+ _env->open(dbHome.c_str(), flags, FREEZE_DB_MODE);
+ }
+ catch(const ::DbException& dx)
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
+
+ //
+ // Default checkpoint period is every 120 seconds
+ //
+ Int checkpointPeriod = properties->getPropertyAsIntWithDefault(
+ propertyPrefix + ".CheckpointPeriod", 120);
+ Int kbyte = properties->getPropertyAsIntWithDefault(propertyPrefix + ".PeriodicCheckpointMinSize", 0);
+
+ if(checkpointPeriod > 0)
+ {
+ _thread = new CheckpointThread(*this, Time::seconds(checkpointPeriod), kbyte, _trace);
+ }
}
//
@@ -361,9 +361,9 @@ void
Freeze::CheckpointThread::terminate()
{
{
- Lock sync(*this);
- _done = true;
- notify();
+ Lock sync(*this);
+ _done = true;
+ notify();
}
getThreadControl().join();
@@ -375,33 +375,33 @@ Freeze::CheckpointThread::run()
{
for(;;)
{
- {
- Lock sync(*this);
- while(!_done && timedWait(_checkpointPeriod))
- {
- //
- // Loop
- //
- }
- if(_done)
- {
- return;
- }
- }
-
- try
- {
- if(_trace >= 2)
- {
- Trace out(_dbEnv.getCommunicator()->getLogger(), "Freeze.DbEnv");
- out << "checkpointing environment \"" << _dbEnv.getEnvName() << "\"";
- }
- _dbEnv.getEnv()->txn_checkpoint(_kbyte, 0, 0);
- }
- catch(const DbException& dx)
- {
- Warning out(_dbEnv.getCommunicator()->getLogger());
- out << "checkpoint on DbEnv \"" << _dbEnv.getEnvName() << "\" raised DbException: " << dx.what();
- }
+ {
+ Lock sync(*this);
+ while(!_done && timedWait(_checkpointPeriod))
+ {
+ //
+ // Loop
+ //
+ }
+ if(_done)
+ {
+ return;
+ }
+ }
+
+ try
+ {
+ if(_trace >= 2)
+ {
+ Trace out(_dbEnv.getCommunicator()->getLogger(), "Freeze.DbEnv");
+ out << "checkpointing environment \"" << _dbEnv.getEnvName() << "\"";
+ }
+ _dbEnv.getEnv()->txn_checkpoint(_kbyte, 0, 0);
+ }
+ catch(const DbException& dx)
+ {
+ Warning out(_dbEnv.getCommunicator()->getLogger());
+ out << "checkpoint on DbEnv \"" << _dbEnv.getEnvName() << "\" raised DbException: " << dx.what();
+ }
}
}
diff --git a/cpp/src/Freeze/TransactionHolder.cpp b/cpp/src/Freeze/TransactionHolder.cpp
index e10c402d10e..04d87729abb 100644
--- a/cpp/src/Freeze/TransactionHolder.cpp
+++ b/cpp/src/Freeze/TransactionHolder.cpp
@@ -16,7 +16,7 @@ Freeze::TransactionHolder::TransactionHolder(const ConnectionPtr& connection)
{
if(connection->currentTransaction() == 0)
{
- _transaction = connection->beginTransaction();
+ _transaction = connection->beginTransaction();
}
}
@@ -24,13 +24,13 @@ Freeze::TransactionHolder::~TransactionHolder()
{
try
{
- rollback();
+ rollback();
}
catch(...)
{
- //
- // Ignored to avoid crash during stack unwinding
- //
+ //
+ // Ignored to avoid crash during stack unwinding
+ //
}
}
@@ -39,16 +39,16 @@ Freeze::TransactionHolder::commit()
{
if(_transaction != 0)
{
- try
- {
- _transaction->commit();
- _transaction = 0;
- }
- catch(...)
- {
- _transaction = 0;
- throw;
- }
+ try
+ {
+ _transaction->commit();
+ _transaction = 0;
+ }
+ catch(...)
+ {
+ _transaction = 0;
+ throw;
+ }
}
}
@@ -57,15 +57,15 @@ Freeze::TransactionHolder::rollback()
{
if(_transaction != 0)
{
- try
- {
- _transaction->rollback();
- _transaction = 0;
- }
- catch(...)
- {
- _transaction = 0;
- throw;
- }
+ try
+ {
+ _transaction->rollback();
+ _transaction = 0;
+ }
+ catch(...)
+ {
+ _transaction = 0;
+ throw;
+ }
}
}
diff --git a/cpp/src/Freeze/TransactionI.cpp b/cpp/src/Freeze/TransactionI.cpp
index ae8c4c7e2e4..c9920c7bfc0 100644
--- a/cpp/src/Freeze/TransactionI.cpp
+++ b/cpp/src/Freeze/TransactionI.cpp
@@ -30,46 +30,46 @@ Freeze::TransactionI::commit()
long txnId = 0;
try
{
- _connection->closeAllIterators();
+ _connection->closeAllIterators();
- if(_txTrace >= 1)
- {
- txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L;
- }
+ if(_txTrace >= 1)
+ {
+ txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L;
+ }
- _txn->commit(0);
+ _txn->commit(0);
- if(_txTrace >= 1)
- {
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "committed transaction " << hex << txnId << dec;
- }
+ if(_txTrace >= 1)
+ {
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "committed transaction " << hex << txnId << dec;
+ }
}
catch(const ::DbDeadlockException& dx)
{
- if(_txTrace >= 1)
- {
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "failed to commit transaction " << hex << txnId << dec << ": " << dx.what();
- }
-
- cleanup();
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(_txTrace >= 1)
+ {
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "failed to commit transaction " << hex << txnId << dec << ": " << dx.what();
+ }
+
+ cleanup();
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
catch(const ::DbException& dx)
{
- if(_txTrace >= 1)
- {
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "failed to commit transaction " << hex << txnId << dec << ": " << dx.what();
- }
-
- cleanup();
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(_txTrace >= 1)
+ {
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "failed to commit transaction " << hex << txnId << dec << ": " << dx.what();
+ }
+
+ cleanup();
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
cleanup();
}
@@ -82,46 +82,46 @@ Freeze::TransactionI::rollback()
long txnId = 0;
try
{
- _connection->closeAllIterators();
+ _connection->closeAllIterators();
- if(_txTrace >= 1)
- {
- txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L;
- }
+ if(_txTrace >= 1)
+ {
+ txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L;
+ }
- _txn->abort();
+ _txn->abort();
- if(_txTrace >= 1)
- {
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "rolled back transaction " << hex << txnId << dec;
- }
+ if(_txTrace >= 1)
+ {
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "rolled back transaction " << hex << txnId << dec;
+ }
}
catch(const ::DbDeadlockException& dx)
{
- if(_txTrace >= 1)
- {
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "failed to rollback transaction " << hex << txnId << dec << ": " << dx.what();
- }
-
- cleanup();
- DeadlockException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(_txTrace >= 1)
+ {
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "failed to rollback transaction " << hex << txnId << dec << ": " << dx.what();
+ }
+
+ cleanup();
+ DeadlockException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
catch(const ::DbException& dx)
{
- if(_txTrace >= 1)
- {
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "failed to rollback transaction " << hex << txnId << dec << ": " << dx.what();
- }
-
- cleanup();
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(_txTrace >= 1)
+ {
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "failed to rollback transaction " << hex << txnId << dec << ": " << dx.what();
+ }
+
+ cleanup();
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
cleanup();
}
@@ -133,26 +133,26 @@ Freeze::TransactionI::TransactionI(ConnectionI* connection) :
{
try
{
- _connection->dbEnv()->getEnv()->txn_begin(0, &_txn, 0);
-
- if(_txTrace >= 1)
- {
- long txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L;
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "started transaction " << hex << txnId << dec;
- }
+ _connection->dbEnv()->getEnv()->txn_begin(0, &_txn, 0);
+
+ if(_txTrace >= 1)
+ {
+ long txnId = (_txn->id() & 0x7FFFFFFF) + 0x80000000L;
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "started transaction " << hex << txnId << dec;
+ }
}
catch(const ::DbException& dx)
{
- if(_txTrace >= 1)
- {
- Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
- out << "failed to start transaction: " << dx.what();
- }
-
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(_txTrace >= 1)
+ {
+ Trace out(_connection->communicator()->getLogger(), "Freeze.Map");
+ out << "failed to start transaction: " << dx.what();
+ }
+
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
}
}
@@ -160,7 +160,7 @@ Freeze::TransactionI::~TransactionI()
{
if(_txn != 0)
{
- rollback();
+ rollback();
}
}
diff --git a/cpp/src/Freeze/TransactionI.h b/cpp/src/Freeze/TransactionI.h
index 275f8b429f4..72cfc852d16 100644
--- a/cpp/src/Freeze/TransactionI.h
+++ b/cpp/src/Freeze/TransactionI.h
@@ -36,7 +36,7 @@ public:
DbTxn*
dbTxn() const
{
- return _txn;
+ return _txn;
}
private:
diff --git a/cpp/src/Freeze/Util.cpp b/cpp/src/Freeze/Util.cpp
index c29f3845f9e..20782bfeca4 100644
--- a/cpp/src/Freeze/Util.cpp
+++ b/cpp/src/Freeze/Util.cpp
@@ -16,75 +16,75 @@ using namespace std;
void
Freeze::handleDbException(const DbException& dx,
- const char* file, int line)
+ const char* file, int line)
{
throw DatabaseException(file, line, dx.what());
}
void
Freeze::handleDbException(const DbException& dx,
- Key& key, Dbt& dbKey,
- const char* file, int line)
+ Key& key, Dbt& dbKey,
+ const char* file, int line)
{
bool bufferSmallException =
#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR == 2)
- (dx.get_errno() == ENOMEM);
+ (dx.get_errno() == ENOMEM);
#else
(dx.get_errno() == DB_BUFFER_SMALL || dx.get_errno() == ENOMEM);
-#endif
-
+#endif
+
if(bufferSmallException && (dbKey.get_size() > dbKey.get_ulen()))
{
- //
- // Keep the old key size in case it's used as input
- //
- size_t oldKeySize = key.size();
+ //
+ // Keep the old key size in case it's used as input
+ //
+ size_t oldKeySize = key.size();
- key.resize(dbKey.get_size());
- initializeOutDbt(key, dbKey);
- dbKey.set_size(static_cast<u_int32_t>(oldKeySize));
+ key.resize(dbKey.get_size());
+ initializeOutDbt(key, dbKey);
+ dbKey.set_size(static_cast<u_int32_t>(oldKeySize));
}
else
{
- handleDbException(dx, file, line);
+ handleDbException(dx, file, line);
}
}
void
Freeze::handleDbException(const DbException& dx,
- Key& key, Dbt& dbKey,
- Value& value, Dbt& dbValue,
- const char* file, int line)
+ Key& key, Dbt& dbKey,
+ Value& value, Dbt& dbValue,
+ const char* file, int line)
{
bool bufferSmallException =
#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR == 2)
- (dx.get_errno() == ENOMEM);
+ (dx.get_errno() == ENOMEM);
#else
(dx.get_errno() == DB_BUFFER_SMALL || dx.get_errno() == ENOMEM);
-#endif
+#endif
- bool resized = false;
+ bool resized = false;
if(bufferSmallException)
{
- if(dbKey.get_size() > dbKey.get_ulen())
- {
- size_t oldKeySize = key.size();
- key.resize(dbKey.get_size());
- initializeOutDbt(key, dbKey);
- dbKey.set_size(static_cast<u_int32_t>(oldKeySize));
- resized = true;
- }
-
- if(dbValue.get_size() > dbValue.get_ulen())
- {
- value.resize(dbValue.get_size());
- initializeOutDbt(value, dbValue);
- resized = true;
- }
+ if(dbKey.get_size() > dbKey.get_ulen())
+ {
+ size_t oldKeySize = key.size();
+ key.resize(dbKey.get_size());
+ initializeOutDbt(key, dbKey);
+ dbKey.set_size(static_cast<u_int32_t>(oldKeySize));
+ resized = true;
+ }
+
+ if(dbValue.get_size() > dbValue.get_ulen())
+ {
+ value.resize(dbValue.get_size());
+ initializeOutDbt(value, dbValue);
+ resized = true;
+ }
}
if(!resized)
{
- handleDbException(dx, file, line);
+ handleDbException(dx, file, line);
}
}
diff --git a/cpp/src/Freeze/Util.h b/cpp/src/Freeze/Util.h
index b41815f2c94..52582471517 100644
--- a/cpp/src/Freeze/Util.h
+++ b/cpp/src/Freeze/Util.h
@@ -61,11 +61,11 @@ handleDbException(const DbException&, const char*, int);
void
handleDbException(const DbException&, Key&, Dbt&,
- const char*, int);
+ const char*, int);
void
handleDbException(const DbException&, Key&, Dbt&, Value&, Dbt&,
- const char*, int);
+ const char*, int);
}
diff --git a/cpp/src/FreezeScript/Data.cpp b/cpp/src/FreezeScript/Data.cpp
index 3c4050f03ee..cc51a8a2d0e 100644
--- a/cpp/src/FreezeScript/Data.cpp
+++ b/cpp/src/FreezeScript/Data.cpp
@@ -2494,28 +2494,28 @@ FreezeScript::ObjectFactory::create(const string& id)
if(_factory)
{
- if(id == Ice::Object::ice_staticId())
- {
- result = new ObjectReader(_factory, _unit->builtin(Slice::Builtin::KindObject));
- }
- else
- {
- Slice::TypeList l = _unit->lookupTypeNoBuiltin(id);
- if(!l.empty())
- {
- Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(l.front());
- if(!decl)
- {
- _factory->getErrorReporter()->error("Slice definition for `" + id + "' is not a class");
- }
- Slice::ClassDefPtr def = decl->definition();
- if(!def)
- {
- _factory->getErrorReporter()->error("no class definition for `" + id + "'");
- }
- result = new ObjectReader(_factory, decl);
- }
- }
+ if(id == Ice::Object::ice_staticId())
+ {
+ result = new ObjectReader(_factory, _unit->builtin(Slice::Builtin::KindObject));
+ }
+ else
+ {
+ Slice::TypeList l = _unit->lookupTypeNoBuiltin(id);
+ if(!l.empty())
+ {
+ Slice::ClassDeclPtr decl = Slice::ClassDeclPtr::dynamicCast(l.front());
+ if(!decl)
+ {
+ _factory->getErrorReporter()->error("Slice definition for `" + id + "' is not a class");
+ }
+ Slice::ClassDefPtr def = decl->definition();
+ if(!def)
+ {
+ _factory->getErrorReporter()->error("no class definition for `" + id + "'");
+ }
+ result = new ObjectReader(_factory, decl);
+ }
+ }
}
return result;
diff --git a/cpp/src/FreezeScript/DumpDB.cpp b/cpp/src/FreezeScript/DumpDB.cpp
index de79afd89a3..dc08bfcbda9 100644
--- a/cpp/src/FreezeScript/DumpDB.cpp
+++ b/cpp/src/FreezeScript/DumpDB.cpp
@@ -54,7 +54,7 @@ class DescriptorHandler : public IceXML::Handler
public:
DescriptorHandler(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&,
- const FreezeScript::ObjectFactoryPtr&);
+ const FreezeScript::ObjectFactoryPtr&);
virtual void startElement(const std::string&, const IceXML::Attributes&, int, int);
virtual void endElement(const std::string&, int, int);
@@ -108,13 +108,13 @@ printCatalogData(const string& dbName, const Freeze::CatalogData& data)
cout << dbName << ": ";
if(data.evictor)
{
- cout << "Evictor database" << endl;
+ cout << "Evictor database" << endl;
}
else
{
- cout << "Map database" << endl;
- cout << " key type = " << data.key << endl;
- cout << " value type = " << data.value << endl;
+ cout << "Map database" << endl;
+ cout << " key type = " << data.key << endl;
+ cout << " value type = " << data.value << endl;
}
}
@@ -159,98 +159,98 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("h"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
if(opts.isSet("c"))
{
- if(args.empty())
- {
- cerr << argv[0] << ": no database environment specified." << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- else if(args.size() > 2)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- try
- {
- FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, args[0]);
- if(args.size() == 1)
- {
- if(catalog.empty())
- {
- cout << "Catalog is empty." << endl;
- }
- else
- {
- cout << "Catalog contents:" << endl;
- for(FreezeScript::CatalogDataMap::const_iterator p = catalog.begin(); p != catalog.end(); ++p)
- {
- cout << endl;
- printCatalogData(p->first, p->second);
- }
- }
- }
- else
- {
- FreezeScript::CatalogDataMap::const_iterator p = catalog.find(args[1]);
- if(p == catalog.end())
- {
- cerr << argv[0] << ": database `" << args[1] << "' not found in environment `" << args[0] << "'."
- << endl;
- return EXIT_FAILURE;
- }
- else
- {
- printCatalogData(p->first, p->second);
- }
- }
- return EXIT_SUCCESS;
- }
- catch(const FreezeScript::FailureException& ex)
- {
- cerr << argv[0] << ": " << ex.reason() << endl;
- return EXIT_FAILURE;
- }
+ if(args.empty())
+ {
+ cerr << argv[0] << ": no database environment specified." << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ else if(args.size() > 2)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ try
+ {
+ FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, args[0]);
+ if(args.size() == 1)
+ {
+ if(catalog.empty())
+ {
+ cout << "Catalog is empty." << endl;
+ }
+ else
+ {
+ cout << "Catalog contents:" << endl;
+ for(FreezeScript::CatalogDataMap::const_iterator p = catalog.begin(); p != catalog.end(); ++p)
+ {
+ cout << endl;
+ printCatalogData(p->first, p->second);
+ }
+ }
+ }
+ else
+ {
+ FreezeScript::CatalogDataMap::const_iterator p = catalog.find(args[1]);
+ if(p == catalog.end())
+ {
+ cerr << argv[0] << ": database `" << args[1] << "' not found in environment `" << args[0] << "'."
+ << endl;
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ printCatalogData(p->first, p->second);
+ }
+ }
+ return EXIT_SUCCESS;
+ }
+ catch(const FreezeScript::FailureException& ex)
+ {
+ cerr << argv[0] << ": " << ex.reason() << endl;
+ return EXIT_FAILURE;
+ }
}
if(opts.isSet("D"))
{
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -D" + *i;
- }
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cppArgs += " -D" + *i;
+ }
}
if(opts.isSet("U"))
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -U" + *i;
- }
+ vector<string> optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cppArgs += " -U" + *i;
+ }
}
if(opts.isSet("I"))
{
- vector<string> optargs = opts.argVec("I");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cppArgs += " -I" + *i;
- }
+ vector<string> optargs = opts.argVec("I");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cppArgs += " -I" + *i;
+ }
}
debug = opts.isSet("debug");
@@ -258,32 +258,32 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
if(opts.isSet("o"))
{
- outputFile = opts.optArg("o");
+ outputFile = opts.optArg("o");
}
if(opts.isSet("f"))
{
- inputFile = opts.optArg("f");
+ inputFile = opts.optArg("f");
}
if(opts.isSet("load"))
{
vector<string> optArgs = opts.argVec("load");
- for(vector<string>::const_iterator i = optArgs.begin(); i != optArgs.end(); ++i)
- {
- slice.push_back(*i);
- }
+ for(vector<string>::const_iterator i = optArgs.begin(); i != optArgs.end(); ++i)
+ {
+ slice.push_back(*i);
+ }
}
evictor = opts.isSet("e");
if(opts.isSet("key"))
{
- keyTypeName = opts.optArg("key");
+ keyTypeName = opts.optArg("key");
}
if(opts.isSet("value"))
{
- valueTypeName = opts.optArg("value");
+ valueTypeName = opts.optArg("value");
}
if(opts.isSet("select"))
{
- selectExpr = opts.optArg("select");
+ selectExpr = opts.optArg("select");
}
caseSensitive = opts.isSet("case-sensitive");
@@ -328,55 +328,55 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
string descriptors;
if(inputFile.empty())
{
- const string evictorKeyTypeName = "::Ice::Identity";
- const string evictorValueTypeName = "::Freeze::ObjectRecord";
-
- if((!keyTypeName.empty() && valueTypeName.empty()) || (keyTypeName.empty() && !valueTypeName.empty()))
- {
- cerr << argv[0] << ": a key type and a value type must be specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- else if(!evictor && keyTypeName.empty() && valueTypeName.empty())
- {
- try
- {
- FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, dbEnvName);
- FreezeScript::CatalogDataMap::iterator p = catalog.find(dbName);
- if(p == catalog.end())
- {
- cerr << argv[0] << ": database `" << dbName << "' not found in catalog." << endl;
- cerr << "Current catalog databases:" << endl;
- for(p = catalog.begin(); p != catalog.end(); ++p)
- {
- cerr << " " << p->first << endl;
- }
- return EXIT_FAILURE;
- }
- else
- {
- if(p->second.evictor)
- {
- evictor = true;
- }
- else
- {
- keyTypeName = p->second.key;
- valueTypeName = p->second.value;
- }
- }
- }
- catch(const FreezeScript::FailureException& ex)
- {
- cerr << argv[0] << ": " << ex.reason() << endl;
- return EXIT_FAILURE;
- }
- }
+ const string evictorKeyTypeName = "::Ice::Identity";
+ const string evictorValueTypeName = "::Freeze::ObjectRecord";
+
+ if((!keyTypeName.empty() && valueTypeName.empty()) || (keyTypeName.empty() && !valueTypeName.empty()))
+ {
+ cerr << argv[0] << ": a key type and a value type must be specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ else if(!evictor && keyTypeName.empty() && valueTypeName.empty())
+ {
+ try
+ {
+ FreezeScript::CatalogDataMap catalog = FreezeScript::readCatalog(communicator, dbEnvName);
+ FreezeScript::CatalogDataMap::iterator p = catalog.find(dbName);
+ if(p == catalog.end())
+ {
+ cerr << argv[0] << ": database `" << dbName << "' not found in catalog." << endl;
+ cerr << "Current catalog databases:" << endl;
+ for(p = catalog.begin(); p != catalog.end(); ++p)
+ {
+ cerr << " " << p->first << endl;
+ }
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ if(p->second.evictor)
+ {
+ evictor = true;
+ }
+ else
+ {
+ keyTypeName = p->second.key;
+ valueTypeName = p->second.value;
+ }
+ }
+ }
+ catch(const FreezeScript::FailureException& ex)
+ {
+ cerr << argv[0] << ": " << ex.reason() << endl;
+ return EXIT_FAILURE;
+ }
+ }
if(evictor)
{
- keyTypeName = evictorKeyTypeName;
- valueTypeName = evictorValueTypeName;
+ keyTypeName = evictorKeyTypeName;
+ valueTypeName = evictorValueTypeName;
}
Slice::TypePtr keyType, valueType;
@@ -744,7 +744,7 @@ FreezeScript::SliceVisitor::visitEnum(const Slice::EnumPtr& v)
//
FreezeScript::DescriptorHandler::DescriptorHandler(const DataFactoryPtr& factory, const Slice::UnitPtr& unit,
const ErrorReporterPtr& errorReporter,
- const FreezeScript::ObjectFactoryPtr& objectFactory) :
+ const FreezeScript::ObjectFactoryPtr& objectFactory) :
_factory(factory), _unit(unit), _errorReporter(errorReporter), _objectFactory(objectFactory)
{
}
diff --git a/cpp/src/FreezeScript/DumpDescriptors.cpp b/cpp/src/FreezeScript/DumpDescriptors.cpp
index fb947a16e47..8b2a15300cc 100644
--- a/cpp/src/FreezeScript/DumpDescriptors.cpp
+++ b/cpp/src/FreezeScript/DumpDescriptors.cpp
@@ -1239,7 +1239,7 @@ FreezeScript::RecordDescriptor::RecordDescriptor(const DescriptorPtr& parent, in
const ErrorReporterPtr& errorReporter,
const IceXML::Attributes& attributes,
const Slice::UnitPtr& unit,
- const FreezeScript::ObjectFactoryPtr& objectFactory) :
+ const FreezeScript::ObjectFactoryPtr& objectFactory) :
Descriptor(parent, line, factory, errorReporter),
ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "record"),
_unit(unit),
@@ -1322,7 +1322,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& sym, ExecuteInfo*
{
dbc->close();
}
- _objectFactory->deactivate();
+ _objectFactory->deactivate();
throw;
}
@@ -1870,16 +1870,16 @@ FreezeScript::DumpVisitor::visitObject(const ObjectRefPtr& data)
ObjectDataPtr value = data->getValue();
if(value)
{
- set<const ObjectData*>::iterator p = _objectHistory.find(value.get());
- if(p == _objectHistory.end())
- {
- _objectHistory.insert(value.get());
- DataMemberMap& members = value->getMembers();
- for(DataMemberMap::iterator q = members.begin(); q != members.end(); ++q)
- {
- q->second->visit(*this);
- }
- }
+ set<const ObjectData*>::iterator p = _objectHistory.find(value.get());
+ if(p == _objectHistory.end())
+ {
+ _objectHistory.insert(value.get());
+ DataMemberMap& members = value->getMembers();
+ for(DataMemberMap::iterator q = members.begin(); q != members.end(); ++q)
+ {
+ q->second->visit(*this);
+ }
+ }
}
}
}
diff --git a/cpp/src/FreezeScript/DumpDescriptors.h b/cpp/src/FreezeScript/DumpDescriptors.h
index 4f8daf65b9c..f915c08ba1f 100644
--- a/cpp/src/FreezeScript/DumpDescriptors.h
+++ b/cpp/src/FreezeScript/DumpDescriptors.h
@@ -247,7 +247,7 @@ public:
RecordDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&,
const IceXML::Attributes&, const Slice::UnitPtr&,
- const FreezeScript::ObjectFactoryPtr&);
+ const FreezeScript::ObjectFactoryPtr&);
virtual void execute(const SymbolTablePtr&, ExecuteInfo*);
diff --git a/cpp/src/FreezeScript/Functions.cpp b/cpp/src/FreezeScript/Functions.cpp
index b96f237b3d0..4f38c91f935 100644
--- a/cpp/src/FreezeScript/Functions.cpp
+++ b/cpp/src/FreezeScript/Functions.cpp
@@ -15,8 +15,8 @@ using namespace std;
bool
FreezeScript::invokeGlobalFunction(const Ice::CommunicatorPtr& communicator, const string& name, const DataList& args,
- DataPtr& result, const DataFactoryPtr& factory,
- const ErrorReporterPtr& errorReporter)
+ DataPtr& result, const DataFactoryPtr& factory,
+ const ErrorReporterPtr& errorReporter)
{
//
// Global function.
diff --git a/cpp/src/FreezeScript/Functions.h b/cpp/src/FreezeScript/Functions.h
index b0a4b5eb441..0b5fff2b21b 100644
--- a/cpp/src/FreezeScript/Functions.h
+++ b/cpp/src/FreezeScript/Functions.h
@@ -16,7 +16,7 @@ namespace FreezeScript
{
bool invokeGlobalFunction(const Ice::CommunicatorPtr&, const std::string&, const DataList&, DataPtr&,
- const DataFactoryPtr&, const ErrorReporterPtr&);
+ const DataFactoryPtr&, const ErrorReporterPtr&);
bool invokeMemberFunction(const std::string&, const DataPtr&, const DataList&, DataPtr&, const DataFactoryPtr&,
const ErrorReporterPtr&);
diff --git a/cpp/src/FreezeScript/TransformAnalyzer.cpp b/cpp/src/FreezeScript/TransformAnalyzer.cpp
index fc9f6be8b66..4095b87007c 100644
--- a/cpp/src/FreezeScript/TransformAnalyzer.cpp
+++ b/cpp/src/FreezeScript/TransformAnalyzer.cpp
@@ -90,46 +90,46 @@ FreezeScript::AnalyzeTransformVisitor::AnalyzeTransformVisitor(XMLOutput& out, c
void
FreezeScript::AnalyzeTransformVisitor::addDatabase(const string& name, const TypePtr& oldKey, const TypePtr& newKey,
- const TypePtr& oldValue, const TypePtr& newValue)
+ const TypePtr& oldValue, const TypePtr& newValue)
{
_out << "\n";
_out << se("database");
if(!name.empty())
{
- _out << attr("name", name);
+ _out << attr("name", name);
}
string oldKeyName = oldKey ? typeToString(oldKey) : string("UNKNOWN");
string newKeyName = newKey ? typeToString(newKey) : string("UNKNOWN");
if(oldKeyName == newKeyName)
{
- _out << attr("key", oldKeyName);
+ _out << attr("key", oldKeyName);
}
else
{
- _out << attr("key", oldKeyName + "," + newKeyName);
+ _out << attr("key", oldKeyName + "," + newKeyName);
}
string oldValueName = oldValue ? typeToString(oldValue) : string("UNKNOWN");
string newValueName = newValue ? typeToString(newValue) : string("UNKNOWN");
if(oldValueName == newValueName)
{
- _out << attr("value", oldValueName);
+ _out << attr("value", oldValueName);
}
else
{
- _out << attr("value", oldValueName + "," + newValueName);
+ _out << attr("value", oldValueName + "," + newValueName);
}
_out << se("record");
if(oldKey && newKey)
{
- compareTypes("database key", oldKey, newKey);
+ compareTypes("database key", oldKey, newKey);
}
if(oldValue && newValue)
{
- compareTypes("database value", oldValue, newValue);
+ compareTypes("database value", oldValue, newValue);
}
_out << ee;
@@ -1130,7 +1130,7 @@ FreezeScript::AnalyzeInitVisitor::typeChange(const TypePtr& t, const string& sco
FreezeScript::TransformAnalyzer::TransformAnalyzer(const UnitPtr& oldUnit, const UnitPtr& newUnit,
bool ignoreTypeChanges, ostream& os, vector<string>& missingTypes,
- vector<string>& errors) :
+ vector<string>& errors) :
_old(oldUnit), _new(newUnit), _out(os),
_visitor(new AnalyzeTransformVisitor(_out, newUnit, ignoreTypeChanges, missingTypes, errors))
{
@@ -1144,7 +1144,7 @@ FreezeScript::TransformAnalyzer::~TransformAnalyzer()
void
FreezeScript::TransformAnalyzer::addDatabase(const string& name, const TypePtr& oldKey, const TypePtr& newKey,
- const TypePtr& oldValue, const TypePtr& newValue)
+ const TypePtr& oldValue, const TypePtr& newValue)
{
_visitor->addDatabase(name, oldKey, newKey, oldValue, newValue);
}
diff --git a/cpp/src/FreezeScript/TransformAnalyzer.h b/cpp/src/FreezeScript/TransformAnalyzer.h
index 9af9c06126a..73539de5d67 100644
--- a/cpp/src/FreezeScript/TransformAnalyzer.h
+++ b/cpp/src/FreezeScript/TransformAnalyzer.h
@@ -24,11 +24,11 @@ class TransformAnalyzer
public:
TransformAnalyzer(const Slice::UnitPtr&, const Slice::UnitPtr&, bool, std::ostream&, std::vector<std::string>&,
- std::vector<std::string>&);
+ std::vector<std::string>&);
~TransformAnalyzer();
void addDatabase(const std::string&, const Slice::TypePtr&, const Slice::TypePtr&, const Slice::TypePtr&,
- const Slice::TypePtr&);
+ const Slice::TypePtr&);
void finish();
private:
diff --git a/cpp/src/FreezeScript/Transformer.cpp b/cpp/src/FreezeScript/Transformer.cpp
index 5b6926c75cd..148d3867f68 100644
--- a/cpp/src/FreezeScript/Transformer.cpp
+++ b/cpp/src/FreezeScript/Transformer.cpp
@@ -1911,7 +1911,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& sym)
Ice::ByteSeq outKeyBytes, outValueBytes;
transformRecord(inKeyBytes, inValueBytes, outKeyBytes, outValueBytes);
Dbt dbNewKey(&outKeyBytes[0], static_cast<unsigned>(outKeyBytes.size())),
- dbNewValue(&outValueBytes[0], static_cast<unsigned>(outValueBytes.size()));
+ dbNewValue(&outValueBytes[0], static_cast<unsigned>(outValueBytes.size()));
if(_info->newDb->put(_info->newDbTxn, &dbNewKey, &dbNewValue, DB_NOOVERWRITE) == DB_KEYEXIST)
{
_info->errorReporter->error("duplicate key encountered");
@@ -1941,7 +1941,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& sym)
{
dbc->close();
}
- _info->objectFactory->deactivate();
+ _info->objectFactory->deactivate();
throw;
}
@@ -2051,7 +2051,7 @@ FreezeScript::DatabaseDescriptor::DatabaseDescriptor(const DescriptorPtr& parent
p = attributes.find("name");
if(p != attributes.end())
{
- _name = p->second;
+ _name = p->second;
}
p = attributes.find("key");
@@ -2077,13 +2077,13 @@ FreezeScript::DatabaseDescriptor::DatabaseDescriptor(const DescriptorPtr& parent
}
if(pos == string::npos)
{
- _oldKeyName = keyTypes;
- _newKeyName = keyTypes;
+ _oldKeyName = keyTypes;
+ _newKeyName = keyTypes;
}
else
{
- _oldKeyName = keyTypes.substr(0, pos);
- _newKeyName = keyTypes.substr(pos + 1);
+ _oldKeyName = keyTypes.substr(0, pos);
+ _newKeyName = keyTypes.substr(pos + 1);
}
pos = valueTypes.find(',');
@@ -2093,13 +2093,13 @@ FreezeScript::DatabaseDescriptor::DatabaseDescriptor(const DescriptorPtr& parent
}
if(pos == string::npos)
{
- _oldValueName = valueTypes;
- _newValueName = valueTypes;
+ _oldValueName = valueTypes;
+ _newValueName = valueTypes;
}
else
{
- _oldValueName = valueTypes.substr(0, pos);
- _newValueName = valueTypes.substr(pos + 1);
+ _oldValueName = valueTypes.substr(0, pos);
+ _newValueName = valueTypes.substr(pos + 1);
}
}
@@ -2136,12 +2136,12 @@ FreezeScript::DatabaseDescriptor::execute(const SymbolTablePtr& st)
if(_info->connection != 0)
{
- Freeze::Catalog catalog(_info->connection, Freeze::catalogName());
- Freeze::CatalogData catalogData;
- catalogData.evictor = false;
- catalogData.key = _info->newKeyType->typeId();
- catalogData.value = _info->newValueType->typeId();
- catalog.put(Freeze::Catalog::value_type(_info->newDbName, catalogData));
+ Freeze::Catalog catalog(_info->connection, Freeze::catalogName());
+ Freeze::CatalogData catalogData;
+ catalogData.evictor = false;
+ catalogData.key = _info->newKeyType->typeId();
+ catalogData.value = _info->newValueType->typeId();
+ catalog.put(Freeze::Catalog::value_type(_info->newDbName, catalogData));
}
//
@@ -2182,24 +2182,24 @@ FreezeScript::TransformDBDescriptor::addChild(const DescriptorPtr& child)
if(db)
{
- string name = db->name();
- map<string, DatabaseDescriptorPtr>::iterator p = _databases.find(name);
- if(p != _databases.end())
- {
- if(name.empty())
- {
- _info->errorReporter->error("duplicate <database> element");
- }
- else
- {
- _info->errorReporter->error(string("duplicate <database> element for ") + name);
- }
- }
- else
- {
- _databases[name] = db;
- _children.push_back(db);
- }
+ string name = db->name();
+ map<string, DatabaseDescriptorPtr>::iterator p = _databases.find(name);
+ if(p != _databases.end())
+ {
+ if(name.empty())
+ {
+ _info->errorReporter->error("duplicate <database> element");
+ }
+ else
+ {
+ _info->errorReporter->error(string("duplicate <database> element for ") + name);
+ }
+ }
+ else
+ {
+ _databases[name] = db;
+ _children.push_back(db);
+ }
}
else if(transform)
{
@@ -2243,7 +2243,7 @@ FreezeScript::TransformDBDescriptor::validate()
if(_databases.empty())
{
- _info->errorReporter->error("no <database> element defined");
+ _info->errorReporter->error("no <database> element defined");
}
for(vector<DescriptorPtr>::iterator p = _children.begin(); p != _children.end(); ++p)
@@ -2258,12 +2258,12 @@ FreezeScript::TransformDBDescriptor::execute(const SymbolTablePtr& sym)
map<string, DatabaseDescriptorPtr>::iterator p = _databases.find(_info->newDbName);
if(p == _databases.end())
{
- p = _databases.find("");
+ p = _databases.find("");
}
if(p == _databases.end())
{
- _info->errorReporter->error("no <database> element found for `" + _info->newDbName + "'");
+ _info->errorReporter->error("no <database> element found for `" + _info->newDbName + "'");
}
p->second->execute(sym);
@@ -3000,11 +3000,11 @@ FreezeScript::assignOrTransform(const DataPtr& dest, const DataPtr& src, bool co
void
FreezeScript::transformDatabase(const Ice::CommunicatorPtr& communicator,
- const FreezeScript::ObjectFactoryPtr& objectFactory,
+ const FreezeScript::ObjectFactoryPtr& objectFactory,
const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit,
Db* oldDb, Db* newDb, DbTxn* newDbTxn, const Freeze::ConnectionPtr& connection,
- const string& newDbName, const string& facetName, bool purgeObjects, ostream& errors,
- bool suppress, istream& is)
+ const string& newDbName, const string& facetName, bool purgeObjects, ostream& errors,
+ bool suppress, istream& is)
{
TransformInfoIPtr info = new TransformInfoI;
diff --git a/cpp/src/FreezeScript/Transformer.h b/cpp/src/FreezeScript/Transformer.h
index 3afc6b507f8..5f856507d78 100644
--- a/cpp/src/FreezeScript/Transformer.h
+++ b/cpp/src/FreezeScript/Transformer.h
@@ -23,10 +23,10 @@ namespace FreezeScript
void
transformDatabase(const Ice::CommunicatorPtr&,
- const FreezeScript::ObjectFactoryPtr& objectFactory,
- const Slice::UnitPtr&, const Slice::UnitPtr&,
+ const FreezeScript::ObjectFactoryPtr& objectFactory,
+ const Slice::UnitPtr&, const Slice::UnitPtr&,
Db*, Db*, DbTxn*, const Freeze::ConnectionPtr&, const std::string&, const std::string&, bool,
- std::ostream&, bool, std::istream&);
+ std::ostream&, bool, std::istream&);
} // End of namespace FreezeScript
diff --git a/cpp/src/FreezeScript/Util.cpp b/cpp/src/FreezeScript/Util.cpp
index 49585d72520..b8f5c17cfc8 100644
--- a/cpp/src/FreezeScript/Util.cpp
+++ b/cpp/src/FreezeScript/Util.cpp
@@ -218,36 +218,36 @@ FreezeScript::readCatalog(const Ice::CommunicatorPtr& communicator, const string
try
{
#ifdef _WIN32
- //
- // Berkeley DB may use a different C++ runtime.
- //
- dbEnv.set_alloc(::malloc, ::realloc, ::free);
+ //
+ // Berkeley DB may use a different C++ runtime.
+ //
+ dbEnv.set_alloc(::malloc, ::realloc, ::free);
#endif
- //
- // Open the database environment.
- //
- {
- u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_THREAD | DB_RECOVER;
- dbEnv.open(dbEnvName.c_str(), flags, mode);
- }
+ //
+ // Open the database environment.
+ //
+ {
+ u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_THREAD | DB_RECOVER;
+ dbEnv.open(dbEnvName.c_str(), flags, mode);
+ }
- Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, dbEnvName, dbEnv);
- Freeze::Catalog catalog(connection, Freeze::catalogName());
- for(Freeze::Catalog::const_iterator p = catalog.begin(); p != catalog.end(); ++p)
- {
- result.insert(make_pair(p->first, p->second));
- }
+ Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, dbEnvName, dbEnv);
+ Freeze::Catalog catalog(connection, Freeze::catalogName());
+ for(Freeze::Catalog::const_iterator p = catalog.begin(); p != catalog.end(); ++p)
+ {
+ result.insert(make_pair(p->first, p->second));
+ }
}
catch(const DbException& ex)
{
- dbEnv.close(0);
- throw FailureException(__FILE__, __LINE__, string("database error: ") + ex.what());
+ dbEnv.close(0);
+ throw FailureException(__FILE__, __LINE__, string("database error: ") + ex.what());
}
catch(...)
{
- dbEnv.close(0);
- throw FailureException(__FILE__, __LINE__, "unknown exception");
+ dbEnv.close(0);
+ throw FailureException(__FILE__, __LINE__, "unknown exception");
}
dbEnv.close(0);
diff --git a/cpp/src/FreezeScript/transformdb.cpp b/cpp/src/FreezeScript/transformdb.cpp
index 8f17b6e8d37..b3a5a6adec4 100644
--- a/cpp/src/FreezeScript/transformdb.cpp
+++ b/cpp/src/FreezeScript/transformdb.cpp
@@ -96,21 +96,21 @@ findType(const Slice::UnitPtr& u, const string& type)
string t;
if(type == "::Ice::Object")
{
- t = "Object";
+ t = "Object";
}
else if(type == "::Ice::Object*")
{
- t = "Object*";
+ t = "Object*";
}
else
{
- t = type;
+ t = type;
}
l = u->lookupType(t, false);
if(l.empty())
{
- return 0;
+ return 0;
}
return l.front();
@@ -118,97 +118,97 @@ findType(const Slice::UnitPtr& u, const string& type)
static void
transformDb(bool evictor, const Ice::CommunicatorPtr& communicator,
- const FreezeScript::ObjectFactoryPtr& objectFactory,
- DbEnv& dbEnv, DbEnv& dbEnvNew, const string& dbName,
- const Freeze::ConnectionPtr& connectionNew, vector<Db*>& dbs,
- const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit,
- DbTxn* txnNew, bool purgeObjects, bool suppress, string descriptors)
+ const FreezeScript::ObjectFactoryPtr& objectFactory,
+ DbEnv& dbEnv, DbEnv& dbEnvNew, const string& dbName,
+ const Freeze::ConnectionPtr& connectionNew, vector<Db*>& dbs,
+ const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit,
+ DbTxn* txnNew, bool purgeObjects, bool suppress, string descriptors)
{
if(evictor)
{
- //
- // The evictor database file contains multiple databases. We must first
- // determine the names of those databases, ignoring any whose names
- // begin with "$index:". Each database represents a separate facet, with
- // the facet name used as the database name. The database named "$default"
- // represents the main object.
- //
- vector<string> dbNames;
- {
- Db db(&dbEnv, 0);
- db.open(0, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0);
- Dbt dbKey, dbValue;
- dbKey.set_flags(DB_DBT_MALLOC);
- dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
-
- Dbc* dbc = 0;
- db.cursor(0, &dbc, 0);
-
- while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0)
- {
- string s(static_cast<char*>(dbKey.get_data()), dbKey.get_size());
- if(s.find("$index:") != 0)
- {
- dbNames.push_back(s);
- }
- free(dbKey.get_data());
- }
-
- dbc->close();
- db.close(0);
- }
-
- //
- // Transform each database. We must delay closing the new databases
- // until after the transaction is committed or aborted.
- //
- for(vector<string>::iterator p = dbNames.begin(); p != dbNames.end(); ++p)
- {
- string name = p->c_str();
-
- Db db(&dbEnv, 0);
- db.open(0, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE);
-
- Db* dbNew = new Db(&dbEnvNew, 0);
- dbs.push_back(dbNew);
- dbNew->open(txnNew, dbName.c_str(), name.c_str(), DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE);
-
- //
- // Execute the transformation descriptors.
- //
- istringstream istr(descriptors);
- string facet = (name == "$default" ? string("") : name);
- FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0,
- dbName, facet, purgeObjects, cerr, suppress, istr);
-
- db.close(0);
- }
-
- Freeze::Catalog catalogNew(connectionNew, Freeze::catalogName());
- Freeze::CatalogData catalogData;
- catalogData.evictor = true;
- catalogNew.put(Freeze::Catalog::value_type(dbName, catalogData));
+ //
+ // The evictor database file contains multiple databases. We must first
+ // determine the names of those databases, ignoring any whose names
+ // begin with "$index:". Each database represents a separate facet, with
+ // the facet name used as the database name. The database named "$default"
+ // represents the main object.
+ //
+ vector<string> dbNames;
+ {
+ Db db(&dbEnv, 0);
+ db.open(0, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0);
+ Dbt dbKey, dbValue;
+ dbKey.set_flags(DB_DBT_MALLOC);
+ dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
+
+ Dbc* dbc = 0;
+ db.cursor(0, &dbc, 0);
+
+ while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0)
+ {
+ string s(static_cast<char*>(dbKey.get_data()), dbKey.get_size());
+ if(s.find("$index:") != 0)
+ {
+ dbNames.push_back(s);
+ }
+ free(dbKey.get_data());
+ }
+
+ dbc->close();
+ db.close(0);
+ }
+
+ //
+ // Transform each database. We must delay closing the new databases
+ // until after the transaction is committed or aborted.
+ //
+ for(vector<string>::iterator p = dbNames.begin(); p != dbNames.end(); ++p)
+ {
+ string name = p->c_str();
+
+ Db db(&dbEnv, 0);
+ db.open(0, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE);
+
+ Db* dbNew = new Db(&dbEnvNew, 0);
+ dbs.push_back(dbNew);
+ dbNew->open(txnNew, dbName.c_str(), name.c_str(), DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE);
+
+ //
+ // Execute the transformation descriptors.
+ //
+ istringstream istr(descriptors);
+ string facet = (name == "$default" ? string("") : name);
+ FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0,
+ dbName, facet, purgeObjects, cerr, suppress, istr);
+
+ db.close(0);
+ }
+
+ Freeze::Catalog catalogNew(connectionNew, Freeze::catalogName());
+ Freeze::CatalogData catalogData;
+ catalogData.evictor = true;
+ catalogNew.put(Freeze::Catalog::value_type(dbName, catalogData));
}
else
{
- //
- // Transform a map database.
- //
- Db db(&dbEnv, 0);
- db.open(0, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE);
-
- Db* dbNew = new Db(&dbEnvNew, 0);
- dbs.push_back(dbNew);
- dbNew->open(txnNew, dbName.c_str(), 0, DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE);
-
- //
- // Execute the transformation descriptors.
- //
- istringstream istr(descriptors);
- FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew,
- connectionNew, dbName, "", purgeObjects, cerr, suppress, istr);
-
- db.close(0);
+ //
+ // Transform a map database.
+ //
+ Db db(&dbEnv, 0);
+ db.open(0, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE);
+
+ Db* dbNew = new Db(&dbEnvNew, 0);
+ dbs.push_back(dbNew);
+ dbNew->open(txnNew, dbName.c_str(), 0, DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE);
+
+ //
+ // Execute the transformation descriptors.
+ //
+ istringstream istr(descriptors);
+ FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew,
+ connectionNew, dbName, "", purgeObjects, cerr, suppress, istr);
+
+ db.close(0);
}
}
@@ -263,44 +263,44 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
if(opts.isSet("D"))
{
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- oldCppArgs += " -D" + *i;
- newCppArgs += " -D" + *i;
- }
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ oldCppArgs += " -D" + *i;
+ newCppArgs += " -D" + *i;
+ }
}
if(opts.isSet("U"))
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- oldCppArgs += " -U" + *i;
- newCppArgs += " -U" + *i;
- }
+ vector<string> optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ oldCppArgs += " -U" + *i;
+ newCppArgs += " -U" + *i;
+ }
}
debug = opts.isSet("debug");
if(opts.isSet("o"))
{
- outputFile = opts.optArg("o");
+ outputFile = opts.optArg("o");
}
ignoreTypeChanges = opts.isSet("i");
purgeObjects = opts.isSet("p");
@@ -308,102 +308,102 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
suppress = opts.isSet("w");
if(opts.isSet("f"))
{
- inputFile = opts.optArg("f");
+ inputFile = opts.optArg("f");
}
if(opts.isSet("include-old"))
{
- vector<string> optargs = opts.argVec("include-old");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- oldCppArgs += " -I" + *i;
- }
+ vector<string> optargs = opts.argVec("include-old");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ oldCppArgs += " -I" + *i;
+ }
}
if(opts.isSet("include-new"))
{
- vector<string> optargs = opts.argVec("include-new");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- newCppArgs += " -I" + *i;
- }
+ vector<string> optargs = opts.argVec("include-new");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ newCppArgs += " -I" + *i;
+ }
}
if(opts.isSet("old"))
{
- vector<string> optargs = opts.argVec("old");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- oldSlice.push_back(*i);
- }
+ vector<string> optargs = opts.argVec("old");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ oldSlice.push_back(*i);
+ }
}
if(opts.isSet("new"))
{
- vector<string> optargs = opts.argVec("new");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- newSlice.push_back(*i);
- }
+ vector<string> optargs = opts.argVec("new");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ newSlice.push_back(*i);
+ }
}
evictor = opts.isSet("e");
if(opts.isSet("key"))
{
- keyTypeNames = opts.optArg("key");
+ keyTypeNames = opts.optArg("key");
}
if(opts.isSet("value"))
{
- valueTypeNames = opts.optArg("value");
+ valueTypeNames = opts.optArg("value");
}
caseSensitive = opts.isSet("case-sensitive");
if(outputFile.empty())
{
- if(args.size() == 2)
- {
- allDb = true;
- }
- else if(args.size() != 3)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(args.size() == 2)
+ {
+ allDb = true;
+ }
+ else if(args.size() != 3)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
else
{
- if(args.size() == 1)
- {
- allDb = true;
- }
- else if(args.size() != 0)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(args.size() == 1)
+ {
+ allDb = true;
+ }
+ else if(args.size() != 0)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
if(allDb && (!keyTypeNames.empty() || !valueTypeNames.empty()))
{
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(inputFile.empty() && !allDb && !evictor && (keyTypeNames.empty() || valueTypeNames.empty()))
{
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(args.size() > 0)
{
- dbEnvName = args[0];
+ dbEnvName = args[0];
}
if(args.size() > 1)
{
- if(allDb)
- {
- dbEnvNameNew = args[1];
- }
- else
- {
- dbName = args[1];
- }
+ if(allDb)
+ {
+ dbEnvNameNew = args[1];
+ }
+ else
+ {
+ dbName = args[1];
+ }
}
if(args.size() > 2)
{
@@ -436,20 +436,20 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
FreezeScript::CatalogDataMap catalog;
if(allDb)
{
- try
- {
- catalog = FreezeScript::readCatalog(communicator, dbEnvName);
- }
- catch(const FreezeScript::FailureException& ex)
- {
- cerr << argv[0] << ": " << ex.reason() << endl;
- return EXIT_FAILURE;
- }
- if(catalog.empty())
- {
- cerr << argv[0] << ": no databases in environment `" << dbEnvName << "'" << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ catalog = FreezeScript::readCatalog(communicator, dbEnvName);
+ }
+ catch(const FreezeScript::FailureException& ex)
+ {
+ cerr << argv[0] << ": " << ex.reason() << endl;
+ return EXIT_FAILURE;
+ }
+ if(catalog.empty())
+ {
+ cerr << argv[0] << ": no databases in environment `" << dbEnvName << "'" << endl;
+ return EXIT_FAILURE;
+ }
}
//
@@ -463,166 +463,166 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
vector<string> missingTypes;
vector<string> analyzeErrors;
- FreezeScript::TransformAnalyzer analyzer(oldUnit, newUnit, ignoreTypeChanges, out, missingTypes, analyzeErrors);
-
- const string evictorKeyName = "::Ice::Identity";
- const string evictorValueName = "::Freeze::ObjectRecord";
-
- if(allDb)
- {
- //
- // Add a <database> element for each database in the catalog.
- //
- for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p)
- {
- string keyName, valueName;
-
- if(p->second.evictor)
- {
- keyName = evictorKeyName;
- valueName = evictorValueName;
- }
- else
- {
- keyName = p->second.key;
- valueName = p->second.value;
- }
-
- //
- // Look up the key and value types in the old and new Slice definitions.
- //
- Slice::TypePtr oldKeyType = findType(oldUnit, keyName);
- if(!oldKeyType)
- {
- cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first
- << "' not found in old Slice definitions" << endl;
- }
- Slice::TypePtr newKeyType = findType(newUnit, keyName);
- if(!newKeyType)
- {
- cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first
- << "' not found in new Slice definitions" << endl;
- }
- Slice::TypePtr oldValueType = findType(oldUnit, valueName);
- if(!oldValueType)
- {
- cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first
- << "' not found in old Slice definitions" << endl;
- }
- Slice::TypePtr newValueType = findType(newUnit, valueName);
- if(!newValueType)
- {
- cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first
- << "' not found in new Slice definitions" << endl;
- }
-
- //
- // If we are generating an output file, we do not consider a missing type to be
- // an error. Since the type information comes from the catalog of the old
- // environment, it's possible that the key or value types are not present in
- // the new Slice definitions. Rather than abort at this point, we simply emit
- // a partially-defined <database> element that must be edited by the user.
- //
- // If we are not generating an output file, we have to stop now.
- //
- if(outputFile.empty() && (!oldKeyType || !newKeyType || !oldValueType || !newValueType))
- {
- return EXIT_FAILURE;
- }
-
- analyzer.addDatabase(p->first, oldKeyType, newKeyType, oldValueType, newValueType);
- }
- }
- else
- {
- string oldKeyName, newKeyName, oldValueName, newValueName;
-
- if(evictor)
- {
- oldKeyName = newKeyName = evictorKeyName;
- oldValueName = newValueName = evictorValueName;
- }
- else
- {
- string::size_type pos;
-
- if(keyTypeNames.empty() || valueTypeNames.empty())
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- pos = keyTypeNames.find(',');
- if(pos == 0 || pos == keyTypeNames.size())
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- if(pos == string::npos)
- {
- oldKeyName = keyTypeNames;
- newKeyName = keyTypeNames;
- }
- else
- {
- oldKeyName = keyTypeNames.substr(0, pos);
- newKeyName = keyTypeNames.substr(pos + 1);
- }
-
- pos = valueTypeNames.find(',');
- if(pos == 0 || pos == valueTypeNames.size())
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- if(pos == string::npos)
- {
- oldValueName = valueTypeNames;
- newValueName = valueTypeNames;
- }
- else
- {
- oldValueName = valueTypeNames.substr(0, pos);
- newValueName = valueTypeNames.substr(pos + 1);
- }
- }
-
- //
- // Look up the key and value types in the old and new Slice definitions.
- //
- Slice::TypePtr oldKeyType = findType(oldUnit, oldKeyName);
- if(!oldKeyType)
- {
- cerr << argv[0] << ": type `" << oldKeyName << "' not found in old Slice definitions" << endl;
- }
- Slice::TypePtr newKeyType = findType(newUnit, newKeyName);
- if(!newKeyType)
- {
- cerr << argv[0] << ": type `" << newKeyName << "' not found in new Slice definitions" << endl;
- }
- Slice::TypePtr oldValueType = findType(oldUnit, oldValueName);
- if(!oldValueType)
- {
- cerr << argv[0] << ": type `" << oldValueName << "' not found in old Slice definitions" << endl;
- }
- Slice::TypePtr newValueType = findType(newUnit, newValueName);
- if(!newValueType)
- {
- cerr << argv[0] << ": type `" << newValueName << "' not found in new Slice definitions" << endl;
- }
-
- //
- // Stop now if any of the types could not be found.
- //
- if(!oldKeyType || !newKeyType || !oldValueType || !newValueType)
- {
- return EXIT_FAILURE;
- }
-
- analyzer.addDatabase("", oldKeyType, newKeyType, oldValueType, newValueType);
- }
-
- analyzer.finish();
+ FreezeScript::TransformAnalyzer analyzer(oldUnit, newUnit, ignoreTypeChanges, out, missingTypes, analyzeErrors);
+
+ const string evictorKeyName = "::Ice::Identity";
+ const string evictorValueName = "::Freeze::ObjectRecord";
+
+ if(allDb)
+ {
+ //
+ // Add a <database> element for each database in the catalog.
+ //
+ for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p)
+ {
+ string keyName, valueName;
+
+ if(p->second.evictor)
+ {
+ keyName = evictorKeyName;
+ valueName = evictorValueName;
+ }
+ else
+ {
+ keyName = p->second.key;
+ valueName = p->second.value;
+ }
+
+ //
+ // Look up the key and value types in the old and new Slice definitions.
+ //
+ Slice::TypePtr oldKeyType = findType(oldUnit, keyName);
+ if(!oldKeyType)
+ {
+ cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first
+ << "' not found in old Slice definitions" << endl;
+ }
+ Slice::TypePtr newKeyType = findType(newUnit, keyName);
+ if(!newKeyType)
+ {
+ cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first
+ << "' not found in new Slice definitions" << endl;
+ }
+ Slice::TypePtr oldValueType = findType(oldUnit, valueName);
+ if(!oldValueType)
+ {
+ cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first
+ << "' not found in old Slice definitions" << endl;
+ }
+ Slice::TypePtr newValueType = findType(newUnit, valueName);
+ if(!newValueType)
+ {
+ cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first
+ << "' not found in new Slice definitions" << endl;
+ }
+
+ //
+ // If we are generating an output file, we do not consider a missing type to be
+ // an error. Since the type information comes from the catalog of the old
+ // environment, it's possible that the key or value types are not present in
+ // the new Slice definitions. Rather than abort at this point, we simply emit
+ // a partially-defined <database> element that must be edited by the user.
+ //
+ // If we are not generating an output file, we have to stop now.
+ //
+ if(outputFile.empty() && (!oldKeyType || !newKeyType || !oldValueType || !newValueType))
+ {
+ return EXIT_FAILURE;
+ }
+
+ analyzer.addDatabase(p->first, oldKeyType, newKeyType, oldValueType, newValueType);
+ }
+ }
+ else
+ {
+ string oldKeyName, newKeyName, oldValueName, newValueName;
+
+ if(evictor)
+ {
+ oldKeyName = newKeyName = evictorKeyName;
+ oldValueName = newValueName = evictorValueName;
+ }
+ else
+ {
+ string::size_type pos;
+
+ if(keyTypeNames.empty() || valueTypeNames.empty())
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ pos = keyTypeNames.find(',');
+ if(pos == 0 || pos == keyTypeNames.size())
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ if(pos == string::npos)
+ {
+ oldKeyName = keyTypeNames;
+ newKeyName = keyTypeNames;
+ }
+ else
+ {
+ oldKeyName = keyTypeNames.substr(0, pos);
+ newKeyName = keyTypeNames.substr(pos + 1);
+ }
+
+ pos = valueTypeNames.find(',');
+ if(pos == 0 || pos == valueTypeNames.size())
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ if(pos == string::npos)
+ {
+ oldValueName = valueTypeNames;
+ newValueName = valueTypeNames;
+ }
+ else
+ {
+ oldValueName = valueTypeNames.substr(0, pos);
+ newValueName = valueTypeNames.substr(pos + 1);
+ }
+ }
+
+ //
+ // Look up the key and value types in the old and new Slice definitions.
+ //
+ Slice::TypePtr oldKeyType = findType(oldUnit, oldKeyName);
+ if(!oldKeyType)
+ {
+ cerr << argv[0] << ": type `" << oldKeyName << "' not found in old Slice definitions" << endl;
+ }
+ Slice::TypePtr newKeyType = findType(newUnit, newKeyName);
+ if(!newKeyType)
+ {
+ cerr << argv[0] << ": type `" << newKeyName << "' not found in new Slice definitions" << endl;
+ }
+ Slice::TypePtr oldValueType = findType(oldUnit, oldValueName);
+ if(!oldValueType)
+ {
+ cerr << argv[0] << ": type `" << oldValueName << "' not found in old Slice definitions" << endl;
+ }
+ Slice::TypePtr newValueType = findType(newUnit, newValueName);
+ if(!newValueType)
+ {
+ cerr << argv[0] << ": type `" << newValueName << "' not found in new Slice definitions" << endl;
+ }
+
+ //
+ // Stop now if any of the types could not be found.
+ //
+ if(!oldKeyType || !newKeyType || !oldValueType || !newValueType)
+ {
+ return EXIT_FAILURE;
+ }
+
+ analyzer.addDatabase("", oldKeyType, newKeyType, oldValueType, newValueType);
+ }
+
+ analyzer.finish();
if(!analyzeErrors.empty())
{
@@ -717,7 +717,7 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
// Open the old database environment. Use DB_RECOVER_FATAL if -c is specified.
// No transaction is created for the old environment.
//
- // DB_THREAD is for compatibility with Freeze (the catalog)
+ // DB_THREAD is for compatibility with Freeze (the catalog)
{
u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_THREAD;
if(catastrophicRecover)
@@ -734,42 +734,42 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator)
//
// Open the new database environment and start a transaction.
//
- //
- // DB_THREAD is for compatibility with Freeze (the catalog)
- //
+ //
+ // DB_THREAD is for compatibility with Freeze (the catalog)
+ //
{
u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_CREATE
- | DB_THREAD;
+ | DB_THREAD;
dbEnvNew.open(dbEnvNameNew.c_str(), flags, FREEZE_SCRIPT_DB_MODE);
}
- //
- // TODO: handle properly DbHome config (currently it will break if it's set for the new env)
- //
-
- //
- // Open the catalog of the new environment, and start a transaction.
- //
- Freeze::ConnectionPtr connectionNew = Freeze::createConnection(communicator, dbEnvNameNew, dbEnvNew);
- txNew = connectionNew->beginTransaction();
- DbTxn* txnNew = Freeze::getTxn(txNew);
-
- if(allDb)
- {
- //
- // Transform all databases in the old catalog.
- //
- for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p)
- {
- transformDb(p->second.evictor, communicator, objectFactory, dbEnv, dbEnvNew, p->first, connectionNew,
- dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors);
- }
- }
- else
- {
- transformDb(evictor, communicator, objectFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs,
- oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors);
- }
+ //
+ // TODO: handle properly DbHome config (currently it will break if it's set for the new env)
+ //
+
+ //
+ // Open the catalog of the new environment, and start a transaction.
+ //
+ Freeze::ConnectionPtr connectionNew = Freeze::createConnection(communicator, dbEnvNameNew, dbEnvNew);
+ txNew = connectionNew->beginTransaction();
+ DbTxn* txnNew = Freeze::getTxn(txNew);
+
+ if(allDb)
+ {
+ //
+ // Transform all databases in the old catalog.
+ //
+ for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p)
+ {
+ transformDb(p->second.evictor, communicator, objectFactory, dbEnv, dbEnvNew, p->first, connectionNew,
+ dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors);
+ }
+ }
+ else
+ {
+ transformDb(evictor, communicator, objectFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs,
+ oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors);
+ }
}
catch(const DbException& ex)
{
diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp
index fb4f49d8772..bc5995fb547 100644
--- a/cpp/src/Glacier2/Blobject.cpp
+++ b/cpp/src/Glacier2/Blobject.cpp
@@ -32,57 +32,57 @@ Glacier2::Blobject::Blobject(const CommunicatorPtr& communicator, bool reverse,
_logger(_communicator->getLogger()),
_reverse(reverse),
_forwardContext(_reverse ?
- _properties->getPropertyAsInt(serverForwardContext) > 0 :
- _properties->getPropertyAsInt(clientForwardContext) > 0),
+ _properties->getPropertyAsInt(serverForwardContext) > 0 :
+ _properties->getPropertyAsInt(clientForwardContext) > 0),
_buffered(_reverse ?
- _properties->getPropertyAsIntWithDefault(serverBuffered, 1) > 0 :
- _properties->getPropertyAsIntWithDefault(clientBuffered, 1) > 0),
+ _properties->getPropertyAsIntWithDefault(serverBuffered, 1) > 0 :
+ _properties->getPropertyAsIntWithDefault(clientBuffered, 1) > 0),
_alwaysBatch(_reverse ?
- _properties->getPropertyAsInt(serverAlwaysBatch) > 0 :
- _properties->getPropertyAsInt(clientAlwaysBatch) > 0),
+ _properties->getPropertyAsInt(serverAlwaysBatch) > 0 :
+ _properties->getPropertyAsInt(clientAlwaysBatch) > 0),
_requestTraceLevel(_reverse ?
- _properties->getPropertyAsInt(serverTraceRequest) :
- _properties->getPropertyAsInt(clientTraceRequest)),
+ _properties->getPropertyAsInt(serverTraceRequest) :
+ _properties->getPropertyAsInt(clientTraceRequest)),
_overrideTraceLevel(reverse ?
- _properties->getPropertyAsInt(serverTraceOverride) :
- _properties->getPropertyAsInt(clientTraceOverride)),
+ _properties->getPropertyAsInt(serverTraceOverride) :
+ _properties->getPropertyAsInt(clientTraceOverride)),
_sslContext(sslContext)
{
if(_buffered)
{
- try
- {
- IceUtil::Time sleepTime = _reverse ?
- IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(serverSleepTime)) :
- IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(clientSleepTime));
+ try
+ {
+ IceUtil::Time sleepTime = _reverse ?
+ IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(serverSleepTime)) :
+ IceUtil::Time::milliSeconds(_properties->getPropertyAsInt(clientSleepTime));
- const_cast<RequestQueuePtr&>(_requestQueue) = new RequestQueue(sleepTime);
-
- Int threadStackSize = _properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
-
- _requestQueue->start(static_cast<size_t>(threadStackSize));
+ const_cast<RequestQueuePtr&>(_requestQueue) = new RequestQueue(sleepTime);
+
+ Int threadStackSize = _properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
+
+ _requestQueue->start(static_cast<size_t>(threadStackSize));
- //
- // See the comment in Glacier2::RequestQueue::destroy()
- // for why we detach the thread.
- //
- _requestQueue->getThreadControl().detach();
- }
- catch(const IceUtil::Exception& ex)
- {
- {
- Error out(_logger);
- out << "cannot create thread for request queue:\n" << ex;
- }
+ //
+ // See the comment in Glacier2::RequestQueue::destroy()
+ // for why we detach the thread.
+ //
+ _requestQueue->getThreadControl().detach();
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ {
+ Error out(_logger);
+ out << "cannot create thread for request queue:\n" << ex;
+ }
- if(_requestQueue)
- {
- _requestQueue->destroy();
- }
-
- throw;
- }
+ if(_requestQueue)
+ {
+ _requestQueue->destroy();
+ }
+
+ throw;
+ }
}
}
@@ -98,14 +98,14 @@ Glacier2::Blobject::destroy()
void
Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Array_Object_ice_invokePtr& amdCB,
- const std::pair<const Ice::Byte*, const Ice::Byte*>& inParams, const Current& current)
+ const std::pair<const Ice::Byte*, const Ice::Byte*>& inParams, const Current& current)
{
//
// Set the correct facet on the proxy.
//
if(!current.facet.empty())
{
- proxy = proxy->ice_facet(current.facet);
+ proxy = proxy->ice_facet(current.facet);
}
//
@@ -115,13 +115,13 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Array_Object_ice_invokePt
if(current.requestId == 0)
{
if(_alwaysBatch && _buffered)
- {
- proxy = proxy->ice_batchOneway();
- }
- else
- {
+ {
+ proxy = proxy->ice_batchOneway();
+ }
+ else
+ {
proxy = proxy->ice_oneway();
- }
+ }
}
else if(current.requestId > 0)
{
@@ -134,229 +134,229 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Array_Object_ice_invokePt
Context::const_iterator p = current.ctx.find("_fwd");
if(p != current.ctx.end())
{
- for(unsigned int i = 0; i < p->second.length(); ++i)
- {
- char option = p->second[i];
- switch(option)
- {
- case 't':
- {
- proxy = proxy->ice_twoway();
- break;
- }
-
- case 'o':
- {
- if(_alwaysBatch && _buffered)
- {
- proxy = proxy->ice_batchOneway();
- }
- else
- {
- proxy = proxy->ice_oneway();
- }
- break;
- }
-
- case 'd':
- {
- if(_alwaysBatch && _buffered)
- {
- proxy = proxy->ice_batchDatagram();
- }
- else
- {
- proxy = proxy->ice_datagram();
- }
- break;
- }
-
- case 'O':
- {
- if(_buffered)
- {
- proxy = proxy->ice_batchOneway();
- }
- else
- {
- proxy = proxy->ice_oneway();
- }
- break;
- }
-
- case 'D':
- {
- if(_buffered)
- {
- proxy = proxy->ice_batchDatagram();
- }
- else
- {
- proxy = proxy->ice_datagram();
- }
- break;
- }
-
- case 's':
- {
- proxy = proxy->ice_secure(true);
- break;
- }
-
- case 'z':
- {
- proxy = proxy->ice_compress(true);
- break;
- }
-
- default:
- {
- Warning out(_logger);
- out << "unknown forward option `" << option << "'";
- break;
- }
- }
- }
+ for(unsigned int i = 0; i < p->second.length(); ++i)
+ {
+ char option = p->second[i];
+ switch(option)
+ {
+ case 't':
+ {
+ proxy = proxy->ice_twoway();
+ break;
+ }
+
+ case 'o':
+ {
+ if(_alwaysBatch && _buffered)
+ {
+ proxy = proxy->ice_batchOneway();
+ }
+ else
+ {
+ proxy = proxy->ice_oneway();
+ }
+ break;
+ }
+
+ case 'd':
+ {
+ if(_alwaysBatch && _buffered)
+ {
+ proxy = proxy->ice_batchDatagram();
+ }
+ else
+ {
+ proxy = proxy->ice_datagram();
+ }
+ break;
+ }
+
+ case 'O':
+ {
+ if(_buffered)
+ {
+ proxy = proxy->ice_batchOneway();
+ }
+ else
+ {
+ proxy = proxy->ice_oneway();
+ }
+ break;
+ }
+
+ case 'D':
+ {
+ if(_buffered)
+ {
+ proxy = proxy->ice_batchDatagram();
+ }
+ else
+ {
+ proxy = proxy->ice_datagram();
+ }
+ break;
+ }
+
+ case 's':
+ {
+ proxy = proxy->ice_secure(true);
+ break;
+ }
+
+ case 'z':
+ {
+ proxy = proxy->ice_compress(true);
+ break;
+ }
+
+ default:
+ {
+ Warning out(_logger);
+ out << "unknown forward option `" << option << "'";
+ break;
+ }
+ }
+ }
}
if(_requestTraceLevel >= 1)
{
- Trace out(_logger, "Glacier2");
- if(_reverse)
- {
- out << "reverse ";
- }
- out << "routing";
- if(_buffered)
- {
- out << " (buffered)";
- }
- else
- {
- out << " (not buffered)";
- }
- if(_reverse)
- {
- out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity());
- }
- else
- {
- out << "\nproxy = " << _communicator->proxyToString(proxy);
- }
- out << "\noperation = " << current.operation;
- out << "\ncontext = ";
- Context::const_iterator q = current.ctx.begin();
- while(q != current.ctx.end())
- {
- out << q->first << '/' << q->second;
- if(++q != current.ctx.end())
- {
- out << ", ";
- }
- }
+ Trace out(_logger, "Glacier2");
+ if(_reverse)
+ {
+ out << "reverse ";
+ }
+ out << "routing";
+ if(_buffered)
+ {
+ out << " (buffered)";
+ }
+ else
+ {
+ out << " (not buffered)";
+ }
+ if(_reverse)
+ {
+ out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity());
+ }
+ else
+ {
+ out << "\nproxy = " << _communicator->proxyToString(proxy);
+ }
+ out << "\noperation = " << current.operation;
+ out << "\ncontext = ";
+ Context::const_iterator q = current.ctx.begin();
+ while(q != current.ctx.end())
+ {
+ out << q->first << '/' << q->second;
+ if(++q != current.ctx.end())
+ {
+ out << ", ";
+ }
+ }
}
if(_buffered)
{
- //
- // If we are in buffered mode, we create a new request and add
- // it to the request queue. If the request is twoway, we use
- // AMI.
- //
+ //
+ // If we are in buffered mode, we create a new request and add
+ // it to the request queue. If the request is twoway, we use
+ // AMI.
+ //
- bool override;
- try
- {
- override =
- _requestQueue->addRequest(new Request(proxy, inParams, current, _forwardContext, _sslContext, amdCB));
- }
- catch(const ObjectNotExistException& ex)
- {
- amdCB->ice_exception(ex);
- return;
- }
+ bool override;
+ try
+ {
+ override =
+ _requestQueue->addRequest(new Request(proxy, inParams, current, _forwardContext, _sslContext, amdCB));
+ }
+ catch(const ObjectNotExistException& ex)
+ {
+ amdCB->ice_exception(ex);
+ return;
+ }
- if(override && _overrideTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- if(_reverse)
- {
- out << "reverse ";
- }
- out << "routing override";
- if(_reverse)
- {
- out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity());
- }
- else
- {
- out << "\nproxy = " << _communicator->proxyToString(proxy);
- }
- out << "\noperation = " << current.operation;
- out << "\ncontext = ";
- Context::const_iterator q = current.ctx.begin();
- while(q != current.ctx.end())
- {
- out << q->first << '/' << q->second;
- if(++q != current.ctx.end())
- {
- out << ", ";
- }
- }
- }
+ if(override && _overrideTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ if(_reverse)
+ {
+ out << "reverse ";
+ }
+ out << "routing override";
+ if(_reverse)
+ {
+ out << "\nidentity = " << _communicator->identityToString(proxy->ice_getIdentity());
+ }
+ else
+ {
+ out << "\nproxy = " << _communicator->proxyToString(proxy);
+ }
+ out << "\noperation = " << current.operation;
+ out << "\ncontext = ";
+ Context::const_iterator q = current.ctx.begin();
+ while(q != current.ctx.end())
+ {
+ out << q->first << '/' << q->second;
+ if(++q != current.ctx.end())
+ {
+ out << ", ";
+ }
+ }
+ }
}
else
{
- //
- // If we are in not in buffered mode, we send the request
- // directly.
- //
+ //
+ // If we are in not in buffered mode, we send the request
+ // directly.
+ //
- bool ok;
- ByteSeq outParams;
+ bool ok;
+ ByteSeq outParams;
- try
- {
- if(_forwardContext)
- {
- if(_sslContext.size() > 0)
- {
- Ice::Context ctx = current.ctx;
- ctx.insert(_sslContext.begin(), _sslContext.end());
- ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, ctx);
- }
- else
- {
- ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx);
- }
- }
- else
- {
- if(_sslContext.size() > 0)
- {
- ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, _sslContext);
- }
- else
- {
- ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams);
- }
- }
+ try
+ {
+ if(_forwardContext)
+ {
+ if(_sslContext.size() > 0)
+ {
+ Ice::Context ctx = current.ctx;
+ ctx.insert(_sslContext.begin(), _sslContext.end());
+ ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, ctx);
+ }
+ else
+ {
+ ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx);
+ }
+ }
+ else
+ {
+ if(_sslContext.size() > 0)
+ {
+ ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams, _sslContext);
+ }
+ else
+ {
+ ok = proxy->ice_invoke(current.operation, current.mode, inParams, outParams);
+ }
+ }
- pair<const Byte*, const Byte*> outPair;
- if(outParams.size() == 0)
- {
- outPair.first = outPair.second = 0;
- }
- else
- {
- outPair.first = &outParams[0];
- outPair.second = outPair.first + outParams.size();
- }
- amdCB->ice_response(ok, outPair);
- }
- catch(const LocalException& ex)
- {
- amdCB->ice_exception(ex);
- }
+ pair<const Byte*, const Byte*> outPair;
+ if(outParams.size() == 0)
+ {
+ outPair.first = outPair.second = 0;
+ }
+ else
+ {
+ outPair.first = &outParams[0];
+ outPair.second = outPair.first + outParams.size();
+ }
+ amdCB->ice_response(ok, outPair);
+ }
+ catch(const LocalException& ex)
+ {
+ amdCB->ice_exception(ex);
+ }
}
}
diff --git a/cpp/src/Glacier2/Blobject.h b/cpp/src/Glacier2/Blobject.h
index c9ffd39469d..afda9383a7e 100644
--- a/cpp/src/Glacier2/Blobject.h
+++ b/cpp/src/Glacier2/Blobject.h
@@ -28,7 +28,7 @@ public:
protected:
void invoke(Ice::ObjectPrx&, const Ice::AMD_Array_Object_ice_invokePtr&,
- const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
+ const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
const Ice::CommunicatorPtr _communicator;
const Ice::PropertiesPtr _properties;
diff --git a/cpp/src/Glacier2/ClientBlobject.cpp b/cpp/src/Glacier2/ClientBlobject.cpp
index fde2b1669d0..a1e32dca027 100644
--- a/cpp/src/Glacier2/ClientBlobject.cpp
+++ b/cpp/src/Glacier2/ClientBlobject.cpp
@@ -17,9 +17,9 @@ using namespace Ice;
using namespace Glacier2;
Glacier2::ClientBlobject::ClientBlobject(const CommunicatorPtr& communicator,
- const FilterManagerPtr& filters,
- const Ice::Context& sslContext):
-
+ const FilterManagerPtr& filters,
+ const Ice::Context& sslContext):
+
Glacier2::Blobject(communicator, false, sslContext),
_routingTable(new RoutingTable(communicator)),
_filters(filters),
@@ -33,8 +33,8 @@ Glacier2::ClientBlobject::~ClientBlobject()
void
Glacier2::ClientBlobject::ice_invoke_async(const Ice::AMD_Array_Object_ice_invokePtr& amdCB,
- const std::pair<const Byte*, const Byte*>& inParams,
- const Current& current)
+ const std::pair<const Byte*, const Byte*>& inParams,
+ const Current& current)
{
bool matched = false;
bool hasFilters = false;
@@ -42,89 +42,89 @@ Glacier2::ClientBlobject::ice_invoke_async(const Ice::AMD_Array_Object_ice_invok
if(!_filters->categories()->empty())
{
- hasFilters = true;
- if(_filters->categories()->match(current.id.category))
- {
- matched = true;
- }
- else if(_rejectTraceLevel >= 1)
- {
- if(rejectedFilters.size() != 0)
- {
- rejectedFilters += ", ";
-
- }
- rejectedFilters += "category filter";
- }
+ hasFilters = true;
+ if(_filters->categories()->match(current.id.category))
+ {
+ matched = true;
+ }
+ else if(_rejectTraceLevel >= 1)
+ {
+ if(rejectedFilters.size() != 0)
+ {
+ rejectedFilters += ", ";
+
+ }
+ rejectedFilters += "category filter";
+ }
}
if(!_filters->identities()->empty())
{
- hasFilters = true;
- if(_filters->identities()->match(current.id))
- {
- matched = true;
- }
- else if(_rejectTraceLevel >= 1)
- {
- if(rejectedFilters.size() != 0)
- {
- rejectedFilters += ", ";
-
- }
- rejectedFilters += "identity filter";
- }
+ hasFilters = true;
+ if(_filters->identities()->match(current.id))
+ {
+ matched = true;
+ }
+ else if(_rejectTraceLevel >= 1)
+ {
+ if(rejectedFilters.size() != 0)
+ {
+ rejectedFilters += ", ";
+
+ }
+ rejectedFilters += "identity filter";
+ }
}
ObjectPrx proxy = _routingTable->get(current.id);
if(!proxy)
{
- ObjectNotExistException ex(__FILE__, __LINE__);
-
- //
- // We use a special operation name indicate to the client that
- // the proxy for the Ice object has not been found in our
- // routing table. This can happen if the proxy was evicted
- // from the routing table.
- //
- ex.id = current.id;
- ex.facet = current.facet;
- ex.operation = "ice_add_proxy";
- throw ex;
+ ObjectNotExistException ex(__FILE__, __LINE__);
+
+ //
+ // We use a special operation name indicate to the client that
+ // the proxy for the Ice object has not been found in our
+ // routing table. This can happen if the proxy was evicted
+ // from the routing table.
+ //
+ ex.id = current.id;
+ ex.facet = current.facet;
+ ex.operation = "ice_add_proxy";
+ throw ex;
}
string adapterId = proxy->ice_getAdapterId();
if(!adapterId.empty() && !_filters->adapterIds()->empty())
{
- hasFilters = true;
- if(_filters->adapterIds()->match(adapterId))
- {
- matched = true;
- }
- else if(_rejectTraceLevel >= 1)
- {
- if(rejectedFilters.size() != 0)
- {
- rejectedFilters += ", ";
-
- }
- rejectedFilters += "adapter id filter";
- }
+ hasFilters = true;
+ if(_filters->adapterIds()->match(adapterId))
+ {
+ matched = true;
+ }
+ else if(_rejectTraceLevel >= 1)
+ {
+ if(rejectedFilters.size() != 0)
+ {
+ rejectedFilters += ", ";
+
+ }
+ rejectedFilters += "adapter id filter";
+ }
}
if(hasFilters && !matched)
{
- if(_rejectTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "rejecting request: " << rejectedFilters << "\n";
- out << "identity: " << _communicator->identityToString(current.id);
- }
-
- ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = current.id;
- throw ex;
+ if(_rejectTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "rejecting request: " << rejectedFilters << "\n";
+ out << "identity: " << _communicator->identityToString(current.id);
+ }
+
+ ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
}
invoke(proxy, amdCB, inParams, current);
}
diff --git a/cpp/src/Glacier2/ClientBlobject.h b/cpp/src/Glacier2/ClientBlobject.h
index 835a2da22e0..5385a0f2c0b 100644
--- a/cpp/src/Glacier2/ClientBlobject.h
+++ b/cpp/src/Glacier2/ClientBlobject.h
@@ -35,7 +35,7 @@ public:
virtual ~ClientBlobject();
virtual void ice_invoke_async(const Ice::AMD_Array_Object_ice_invokePtr&,
- const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
+ const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
Ice::ObjectProxySeq add(const Ice::ObjectProxySeq&, const Ice::Current&); // Returns evicted proxies.
diff --git a/cpp/src/Glacier2/CryptPermissionsVerifierI.cpp b/cpp/src/Glacier2/CryptPermissionsVerifierI.cpp
index 7d6736df860..66a77599e0d 100755
--- a/cpp/src/Glacier2/CryptPermissionsVerifierI.cpp
+++ b/cpp/src/Glacier2/CryptPermissionsVerifierI.cpp
@@ -29,12 +29,12 @@ Glacier2::CryptPermissionsVerifierI::checkPermissions(
if(p == _passwords.end())
{
- return false;
+ return false;
}
if(p->second.size() != 13) // Crypt passwords are 13 characters long.
{
- return false;
+ return false;
}
char buff[14];
diff --git a/cpp/src/Glacier2/FilterI.h b/cpp/src/Glacier2/FilterI.h
index b7e6ab996b1..a213f3c08a2 100755
--- a/cpp/src/Glacier2/FilterI.h
+++ b/cpp/src/Glacier2/FilterI.h
@@ -47,24 +47,24 @@ public:
bool
match(const T& candidate) const
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
- //
- // Empty vectors mean no filtering, so all matches will succeed.
- //
- if(_items.size() == 0)
- {
- return true;
- }
-
- return binary_search(_items.begin(), _items.end(), candidate);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ //
+ // Empty vectors mean no filtering, so all matches will succeed.
+ //
+ if(_items.size() == 0)
+ {
+ return true;
+ }
+
+ return binary_search(_items.begin(), _items.end(), candidate);
}
bool
empty() const
{
- return _items.size() == 0;
+ return _items.size() == 0;
}
-
+
private:
std::vector<T> _items;
@@ -128,36 +128,36 @@ FilterT<T, P>::remove(const std::vector<T>& deletions, const Ice::Current&)
while(r != toRemove.end())
{
- iterator i = mark;
- while(i != _items.end() && r != toRemove.end())
- {
- if(*r == *i)
- {
- //
- // We want this list to be in LIFO order because we are
- // going to erase things from the tail forward.
- //
- deleteList.push_front(i);
- ++i;
- ++r;
- mark = i;
- }
- else
- {
- ++i;
- }
- }
-
- if(r == toRemove.end())
- {
- break;
- }
- ++r;
+ iterator i = mark;
+ while(i != _items.end() && r != toRemove.end())
+ {
+ if(*r == *i)
+ {
+ //
+ // We want this list to be in LIFO order because we are
+ // going to erase things from the tail forward.
+ //
+ deleteList.push_front(i);
+ ++i;
+ ++r;
+ mark = i;
+ }
+ else
+ {
+ ++i;
+ }
+ }
+
+ if(r == toRemove.end())
+ {
+ break;
+ }
+ ++r;
}
for(literator i = deleteList.begin(); i != deleteList.end(); ++i)
{
- _items.erase(*i);
+ _items.erase(*i);
}
}
diff --git a/cpp/src/Glacier2/FilterManager.cpp b/cpp/src/Glacier2/FilterManager.cpp
index 13c2a44e674..99bc204ed9e 100755
--- a/cpp/src/Glacier2/FilterManager.cpp
+++ b/cpp/src/Glacier2/FilterManager.cpp
@@ -32,61 +32,61 @@ stringToSeq(const string& str, vector<string>& seq)
string::size_type end = 0;
while(current != string::npos)
{
- switch(str[current])
- {
- case '"':
- case '\'':
- {
- char quote = str[current];
- end = current+1;
- while(true)
- {
- end = str.find(quote, end);
+ switch(str[current])
+ {
+ case '"':
+ case '\'':
+ {
+ char quote = str[current];
+ end = current+1;
+ while(true)
+ {
+ end = str.find(quote, end);
- if(end == string::npos)
- {
- //
- // TODO: should this be an unmatched quote error?
- //
- seq.push_back(str.substr(current));
- break;
- }
+ if(end == string::npos)
+ {
+ //
+ // TODO: should this be an unmatched quote error?
+ //
+ seq.push_back(str.substr(current));
+ break;
+ }
- bool markString = true;
- for(string::size_type r = end -1 ; r > current && str[r] == '\\' ; --r)
- {
- markString = !markString;
- }
- //
- // We don't want the quote so we skip that.
- //
- if(markString)
- {
- ++current;
- seq.push_back(str.substr(current, end-current));
- break;
- }
- else
- {
- ++end;
- }
- }
- if(end != string::npos)
- {
- ++end;
- }
- break;
- }
+ bool markString = true;
+ for(string::size_type r = end -1 ; r > current && str[r] == '\\' ; --r)
+ {
+ markString = !markString;
+ }
+ //
+ // We don't want the quote so we skip that.
+ //
+ if(markString)
+ {
+ ++current;
+ seq.push_back(str.substr(current, end-current));
+ break;
+ }
+ else
+ {
+ ++end;
+ }
+ }
+ if(end != string::npos)
+ {
+ ++end;
+ }
+ break;
+ }
- default:
- {
- end = str.find_first_of(ws, current);
- string::size_type len = (end == string::npos) ? string::npos : end - current;
- seq.push_back(str.substr(current, len));
- break;
- }
- }
- current = str.find_first_not_of(ws, end);
+ default:
+ {
+ end = str.find_first_of(ws, current);
+ string::size_type len = (end == string::npos) ? string::npos : end - current;
+ seq.push_back(str.substr(current, len));
+ break;
+ }
+ }
+ current = str.find_first_not_of(ws, end);
}
}
@@ -102,61 +102,61 @@ stringToSeq(const CommunicatorPtr& comm, const string& str, vector<Identity>& se
string::size_type end = 0;
while(current != string::npos)
{
- switch(str[current])
- {
- case '"':
- case '\'':
- {
- char quote = str[current];
- end = current+1;
- while(true)
- {
- end = str.find(quote, end);
+ switch(str[current])
+ {
+ case '"':
+ case '\'':
+ {
+ char quote = str[current];
+ end = current+1;
+ while(true)
+ {
+ end = str.find(quote, end);
- if(end == string::npos)
- {
- //
- // TODO: should this be an unmatched quote error?
- //
- seq.push_back(comm->stringToIdentity(str.substr(current)));
- break;
- }
+ if(end == string::npos)
+ {
+ //
+ // TODO: should this be an unmatched quote error?
+ //
+ seq.push_back(comm->stringToIdentity(str.substr(current)));
+ break;
+ }
- bool markString = true;
- for(string::size_type r = end -1 ; r > current && str[r] == '\\' ; --r)
- {
- markString = !markString;
- }
- //
- // We don't want the quote so we skip that.
- //
- if(markString)
- {
- ++current;
- seq.push_back(comm->stringToIdentity(str.substr(current, end-current)));
- break;
- }
- else
- {
- ++end;
- }
- }
- if(end != string::npos)
- {
- ++end;
- }
- break;
- }
+ bool markString = true;
+ for(string::size_type r = end -1 ; r > current && str[r] == '\\' ; --r)
+ {
+ markString = !markString;
+ }
+ //
+ // We don't want the quote so we skip that.
+ //
+ if(markString)
+ {
+ ++current;
+ seq.push_back(comm->stringToIdentity(str.substr(current, end-current)));
+ break;
+ }
+ else
+ {
+ ++end;
+ }
+ }
+ if(end != string::npos)
+ {
+ ++end;
+ }
+ break;
+ }
- default:
- {
- end = str.find_first_of(ws, current);
- string::size_type len = (end == string::npos) ? string::npos : end - current;
- seq.push_back(comm->stringToIdentity(str.substr(current, len)));
- break;
- }
- }
- current = str.find_first_not_of(ws, end);
+ default:
+ {
+ end = str.find_first_of(ws, current);
+ string::size_type len = (end == string::npos) ? string::npos : end - current;
+ seq.push_back(comm->stringToIdentity(str.substr(current, len)));
+ break;
+ }
+ }
+ current = str.find_first_not_of(ws, end);
}
}
@@ -170,42 +170,42 @@ Glacier2::FilterManager::destroy()
{
if(_adapter)
{
- try
- {
- if(_categoriesPrx)
- {
- _adapter->remove(_categoriesPrx->ice_getIdentity());
- }
- }
- catch(const Exception&)
- {
- }
- try
- {
- if(_adapterIdsPrx)
- {
- _adapter->remove(_adapterIdsPrx->ice_getIdentity());
- }
- }
- catch(const Exception&)
- {
- }
- try
- {
- if(_identitiesPrx)
- {
- _adapter->remove(_identitiesPrx->ice_getIdentity());
- }
- }
- catch(const Exception&)
- {
- }
+ try
+ {
+ if(_categoriesPrx)
+ {
+ _adapter->remove(_categoriesPrx->ice_getIdentity());
+ }
+ }
+ catch(const Exception&)
+ {
+ }
+ try
+ {
+ if(_adapterIdsPrx)
+ {
+ _adapter->remove(_adapterIdsPrx->ice_getIdentity());
+ }
+ }
+ catch(const Exception&)
+ {
+ }
+ try
+ {
+ if(_identitiesPrx)
+ {
+ _adapter->remove(_identitiesPrx->ice_getIdentity());
+ }
+ }
+ catch(const Exception&)
+ {
+ }
}
}
Glacier2::FilterManager::FilterManager(const ObjectAdapterPtr& adapter, const Glacier2::StringSetIPtr& categories,
- const Glacier2::StringSetIPtr& adapters,
- const Glacier2::IdentitySetIPtr& identities) :
+ const Glacier2::StringSetIPtr& adapters,
+ const Glacier2::IdentitySetIPtr& identities) :
_categories(categories),
_adapters(adapters),
_identities(identities),
@@ -213,23 +213,23 @@ Glacier2::FilterManager::FilterManager(const ObjectAdapterPtr& adapter, const Gl
{
try
{
- if(_adapter)
- {
- _categoriesPrx = Glacier2::StringSetPrx::uncheckedCast(_adapter->addWithUUID(_categories));
- _adapterIdsPrx = Glacier2::StringSetPrx::uncheckedCast(_adapter->addWithUUID(_adapters));
- _identitiesPrx = Glacier2::IdentitySetPrx::uncheckedCast(_adapter->addWithUUID(_identities));
- }
+ if(_adapter)
+ {
+ _categoriesPrx = Glacier2::StringSetPrx::uncheckedCast(_adapter->addWithUUID(_categories));
+ _adapterIdsPrx = Glacier2::StringSetPrx::uncheckedCast(_adapter->addWithUUID(_adapters));
+ _identitiesPrx = Glacier2::IdentitySetPrx::uncheckedCast(_adapter->addWithUUID(_identities));
+ }
}
catch(...)
{
- destroy();
- throw;
+ destroy();
+ throw;
}
}
Glacier2::FilterManager*
Glacier2::FilterManager::create(const CommunicatorPtr& communicator, const ObjectAdapterPtr& adapter, const string& userId,
- const bool allowAddUser)
+ const bool allowAddUser)
{
PropertiesPtr props = communicator->getProperties();
//
@@ -239,12 +239,12 @@ Glacier2::FilterManager::create(const CommunicatorPtr& communicator, const Objec
string allow = props->getProperty("Glacier2.Filter.Category.Accept");
if(allow.empty())
{
- allow = props->getProperty("Glacier2.AllowCategories");
- if(!allow.empty())
- {
+ allow = props->getProperty("Glacier2.AllowCategories");
+ if(!allow.empty())
+ {
communicator->getLogger()->warning(
- "Glacier2.AllowCategories has been deprecated, use Glacier2.Filter.Category.Accept instead.");
- }
+ "Glacier2.AllowCategories has been deprecated, use Glacier2.Filter.Category.Accept instead.");
+ }
}
vector<string> allowSeq;
@@ -256,33 +256,33 @@ Glacier2::FilterManager::create(const CommunicatorPtr& communicator, const Objec
// DEPRECATED PROPERTY: Glacier2.AddUserToAllowCategories is to be deprecated
// and superseded by Glacier2.Filter.Category.AcceptUser.
//
- int addUserMode;
- if(!props->getProperty("Glacier2.Filter.Category.AcceptUser").empty())
- {
- addUserMode = props->getPropertyAsInt("Glacier2.Filter.Category.AcceptUser");
- }
- else
- {
- if(!props->getProperty("Glacier2.AddUserToAllowCategories").empty())
- {
+ int addUserMode;
+ if(!props->getProperty("Glacier2.Filter.Category.AcceptUser").empty())
+ {
+ addUserMode = props->getPropertyAsInt("Glacier2.Filter.Category.AcceptUser");
+ }
+ else
+ {
+ if(!props->getProperty("Glacier2.AddUserToAllowCategories").empty())
+ {
communicator->getLogger()->warning(
- "Glacier2.AddUserToAllowCategories has been deprecated, \
- use Glacier2.Filter.Category.AcceptUser instead.");
- }
- addUserMode = props->getPropertyAsInt("Glacier2.AddUserToAllowCategories");
- }
+ "Glacier2.AddUserToAllowCategories has been deprecated, \
+ use Glacier2.Filter.Category.AcceptUser instead.");
+ }
+ addUserMode = props->getPropertyAsInt("Glacier2.AddUserToAllowCategories");
+ }
- if(addUserMode > 0 && !userId.empty())
- {
- if(addUserMode == 1)
- {
- allowSeq.push_back(userId); // Add user id to allowed categories.
- }
- else if(addUserMode == 2)
- {
- allowSeq.push_back('_' + userId); // Add user id with prepended underscore to allowed categories.
- }
- }
+ if(addUserMode > 0 && !userId.empty())
+ {
+ if(addUserMode == 1)
+ {
+ allowSeq.push_back(userId); // Add user id to allowed categories.
+ }
+ else if(addUserMode == 2)
+ {
+ allowSeq.push_back('_' + userId); // Add user id with prepended underscore to allowed categories.
+ }
+ }
}
Glacier2::StringSetIPtr categoryFilter = new Glacier2::StringSetI(allowSeq);
diff --git a/cpp/src/Glacier2/FilterManager.h b/cpp/src/Glacier2/FilterManager.h
index dabd62e8a5f..71881846e81 100755
--- a/cpp/src/Glacier2/FilterManager.h
+++ b/cpp/src/Glacier2/FilterManager.h
@@ -33,37 +33,37 @@ public:
StringSetIPtr
categories() const
{
- return _categories;
+ return _categories;
}
StringSetIPtr
adapterIds() const
{
- return _adapters;
+ return _adapters;
}
IdentitySetIPtr
identities() const
{
- return _identities;
+ return _identities;
}
StringSetPrx
categoriesPrx() const
{
- return _categoriesPrx;
+ return _categoriesPrx;
}
StringSetPrx
adapterIdsPrx() const
{
- return _adapterIdsPrx;
+ return _adapterIdsPrx;
}
IdentitySetPrx
identitiesPrx() const
{
- return _identitiesPrx;
+ return _identitiesPrx;
}
static FilterManager*
diff --git a/cpp/src/Glacier2/Glacier2Router.cpp b/cpp/src/Glacier2/Glacier2Router.cpp
index 9426ae244cd..27fe0be4a3e 100644
--- a/cpp/src/Glacier2/Glacier2Router.cpp
+++ b/cpp/src/Glacier2/Glacier2Router.cpp
@@ -29,14 +29,14 @@ class AdminI : public Admin
public:
AdminI(const CommunicatorPtr& communicator) :
- _communicator(communicator)
+ _communicator(communicator)
{
}
virtual void
shutdown(const Current&)
{
- _communicator->shutdown();
+ _communicator->shutdown();
}
private:
@@ -100,30 +100,30 @@ Glacier2::RouterService::start(int argc, char* argv[])
vector<string> args;
try
{
- args = opts.parse(argc, (const char**)argv);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
error(e.reason);
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
if(opts.isSet("version"))
{
- print(ICE_STRING_VERSION);
- return false;
+ print(ICE_STRING_VERSION);
+ return false;
}
if(!args.empty())
{
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
PropertiesPtr properties = communicator()->getProperties();
@@ -137,8 +137,8 @@ Glacier2::RouterService::start(int argc, char* argv[])
if(properties->getProperty(clientEndpointsProperty).empty() &&
properties->getProperty("Glacier2.Client.Endpoints").empty())
{
- error("property `" + clientEndpointsProperty + "' is not set");
- return false;
+ error("property `" + clientEndpointsProperty + "' is not set");
+ return false;
}
ObjectAdapterPtr clientAdapter = communicator()->createObjectAdapter("Glacier2.Client");
@@ -153,7 +153,7 @@ Glacier2::RouterService::start(int argc, char* argv[])
if(!properties->getProperty(serverEndpointsProperty).empty() ||
!properties->getProperty("Glacier2.Server.Endpoints").empty())
{
- serverAdapter = communicator()->createObjectAdapter("Glacier2.Server");
+ serverAdapter = communicator()->createObjectAdapter("Glacier2.Server");
}
//
@@ -167,7 +167,7 @@ Glacier2::RouterService::start(int argc, char* argv[])
if(!properties->getProperty(adminEndpointsProperty).empty() ||
!properties->getProperty("Glacier2.Admin.Endpoints").empty())
{
- adminAdapter = communicator()->createObjectAdapter("Glacier2.Admin");
+ adminAdapter = communicator()->createObjectAdapter("Glacier2.Admin");
}
string instanceName = properties->getPropertyWithDefault("Glacier2.InstanceName", "Glacier2");
@@ -193,67 +193,67 @@ Glacier2::RouterService::start(int argc, char* argv[])
nullPermVerifId.name = "NullPermissionsVerifier";
ObjectPrx obj = communicator()->propertyToProxy(verifierProperty);
- if(obj->ice_getIdentity() == nullPermVerifId)
- {
- verifier = PermissionsVerifierPrx::uncheckedCast(
- verifierAdapter->add(new NullPermissionsVerifierI(), nullPermVerifId)->ice_collocationOptimized(true));
- }
- else
- {
- try
- {
- verifier = PermissionsVerifierPrx::checkedCast(obj);
- }
- catch(const Ice::Exception& ex)
- {
- ostringstream ostr;
- ostr << ex;
- error("unable to contact permissions verifier `" + verifierPropertyValue + "'\n" + ostr.str());
- return false;
- }
- if(!verifier)
- {
- error("permissions verifier `" + verifierPropertyValue + "' is invalid");
- return false;
- }
- }
+ if(obj->ice_getIdentity() == nullPermVerifId)
+ {
+ verifier = PermissionsVerifierPrx::uncheckedCast(
+ verifierAdapter->add(new NullPermissionsVerifierI(), nullPermVerifId)->ice_collocationOptimized(true));
+ }
+ else
+ {
+ try
+ {
+ verifier = PermissionsVerifierPrx::checkedCast(obj);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ ostringstream ostr;
+ ostr << ex;
+ error("unable to contact permissions verifier `" + verifierPropertyValue + "'\n" + ostr.str());
+ return false;
+ }
+ if(!verifier)
+ {
+ error("permissions verifier `" + verifierPropertyValue + "' is invalid");
+ return false;
+ }
+ }
}
else if(!passwordsProperty.empty())
{
- ifstream passwordFile(passwordsProperty.c_str());
- if(!passwordFile)
- {
+ ifstream passwordFile(passwordsProperty.c_str());
+ if(!passwordFile)
+ {
string err = strerror(errno);
- error("cannot open `" + passwordsProperty + "' for reading: " + err);
- return false;
- }
-
- map<string, string> passwords;
-
- while(true)
- {
- string userId;
- passwordFile >> userId;
- if(!passwordFile)
- {
- break;
- }
-
- string password;
- passwordFile >> password;
- if(!passwordFile)
- {
- break;
- }
-
- assert(!userId.empty());
- assert(!password.empty());
- passwords.insert(make_pair(userId, password));
- }
-
- PermissionsVerifierPtr verifierImpl = new CryptPermissionsVerifierI(passwords);
-
- verifier = PermissionsVerifierPrx::uncheckedCast(verifierAdapter->addWithUUID(verifierImpl));
+ error("cannot open `" + passwordsProperty + "' for reading: " + err);
+ return false;
+ }
+
+ map<string, string> passwords;
+
+ while(true)
+ {
+ string userId;
+ passwordFile >> userId;
+ if(!passwordFile)
+ {
+ break;
+ }
+
+ string password;
+ passwordFile >> password;
+ if(!passwordFile)
+ {
+ break;
+ }
+
+ assert(!userId.empty());
+ assert(!password.empty());
+ passwords.insert(make_pair(userId, password));
+ }
+
+ PermissionsVerifierPtr verifierImpl = new CryptPermissionsVerifierI(passwords);
+
+ verifier = PermissionsVerifierPrx::uncheckedCast(verifierAdapter->addWithUUID(verifierImpl));
}
//
@@ -265,24 +265,24 @@ Glacier2::RouterService::start(int argc, char* argv[])
if(!sessionManagerPropertyValue.empty())
{
try
- {
- sessionManager = SessionManagerPrx::checkedCast(communicator()->propertyToProxy(sessionManagerProperty));
- }
- catch(const Ice::Exception& ex)
- {
- ostringstream ostr;
- ostr << ex;
- error("unable to contact session manager `" + sessionManagerPropertyValue + "'\n" + ostr.str());
- return false;
- }
- if(!sessionManager)
- {
- error("session manager `" + sessionManagerPropertyValue + "' is invalid");
- return false;
- }
- sessionManager =
- SessionManagerPrx::uncheckedCast(sessionManager->ice_connectionCached(false)->ice_locatorCacheTimeout(
- properties->getPropertyAsIntWithDefault("Glacier2.SessionManager.LocatorCacheTimeout", 600)));
+ {
+ sessionManager = SessionManagerPrx::checkedCast(communicator()->propertyToProxy(sessionManagerProperty));
+ }
+ catch(const Ice::Exception& ex)
+ {
+ ostringstream ostr;
+ ostr << ex;
+ error("unable to contact session manager `" + sessionManagerPropertyValue + "'\n" + ostr.str());
+ return false;
+ }
+ if(!sessionManager)
+ {
+ error("session manager `" + sessionManagerPropertyValue + "' is invalid");
+ return false;
+ }
+ sessionManager =
+ SessionManagerPrx::uncheckedCast(sessionManager->ice_connectionCached(false)->ice_locatorCacheTimeout(
+ properties->getPropertyAsIntWithDefault("Glacier2.SessionManager.LocatorCacheTimeout", 600)));
}
//
@@ -297,33 +297,33 @@ Glacier2::RouterService::start(int argc, char* argv[])
nullSSLPermVerifId.category = instanceName;
nullSSLPermVerifId.name = "NullSSLPermissionsVerifier";
- ObjectPrx obj = communicator()->propertyToProxy(sslVerifierProperty);
- if(obj->ice_getIdentity() == nullSSLPermVerifId)
- {
+ ObjectPrx obj = communicator()->propertyToProxy(sslVerifierProperty);
+ if(obj->ice_getIdentity() == nullSSLPermVerifId)
+ {
sslVerifier = SSLPermissionsVerifierPrx::uncheckedCast(
verifierAdapter->add(new NullSSLPermissionsVerifierI(), nullSSLPermVerifId)->
- ice_collocationOptimized(true));
- }
- else
- {
+ ice_collocationOptimized(true));
+ }
+ else
+ {
try
- {
- sslVerifier = SSLPermissionsVerifierPrx::checkedCast(obj);
- }
- catch(const Ice::Exception& ex)
- {
- ostringstream ostr;
- ostr << ex;
- error("unable to contact ssl permissions verifier `" + sslVerifierPropertyValue + "'\n" + ostr.str());
- return false;
- }
- if(!sslVerifier)
- {
- error("ssl permissions verifier `" + sslVerifierPropertyValue + "' is invalid");
- return false;
- }
- }
+ {
+ sslVerifier = SSLPermissionsVerifierPrx::checkedCast(obj);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ ostringstream ostr;
+ ostr << ex;
+ error("unable to contact ssl permissions verifier `" + sslVerifierPropertyValue + "'\n" + ostr.str());
+ return false;
+ }
+ if(!sslVerifier)
+ {
+ error("ssl permissions verifier `" + sslVerifierPropertyValue + "' is invalid");
+ return false;
+ }
+ }
}
//
@@ -335,31 +335,31 @@ Glacier2::RouterService::start(int argc, char* argv[])
if(!sslSessionManagerPropertyValue.empty())
{
try
- {
- sslSessionManager =
- SSLSessionManagerPrx::checkedCast(communicator()->propertyToProxy(sslSessionManagerProperty));
- }
- catch(const Ice::Exception& ex)
- {
- ostringstream ostr;
- ostr << ex;
- error("unable to ssl session manager `" + sslSessionManagerPropertyValue + "'\n" + ostr.str());
- return false;
- }
- if(!sslSessionManager)
- {
- error("ssl session manager `" + sslSessionManagerPropertyValue + "' is invalid");
- return false;
- }
- sslSessionManager =
- SSLSessionManagerPrx::uncheckedCast(sslSessionManager->ice_connectionCached(false)->ice_locatorCacheTimeout(
- properties->getPropertyAsIntWithDefault("Glacier2.SSLSessionManager.LocatorCacheTimeout", 600)));
+ {
+ sslSessionManager =
+ SSLSessionManagerPrx::checkedCast(communicator()->propertyToProxy(sslSessionManagerProperty));
+ }
+ catch(const Ice::Exception& ex)
+ {
+ ostringstream ostr;
+ ostr << ex;
+ error("unable to ssl session manager `" + sslSessionManagerPropertyValue + "'\n" + ostr.str());
+ return false;
+ }
+ if(!sslSessionManager)
+ {
+ error("ssl session manager `" + sslSessionManagerPropertyValue + "' is invalid");
+ return false;
+ }
+ sslSessionManager =
+ SSLSessionManagerPrx::uncheckedCast(sslSessionManager->ice_connectionCached(false)->ice_locatorCacheTimeout(
+ properties->getPropertyAsIntWithDefault("Glacier2.SSLSessionManager.LocatorCacheTimeout", 600)));
}
if(!verifier && !sslVerifier)
{
- error("Glacier2 requires a permissions verifier or password file");
- return false;
+ error("Glacier2 requires a permissions verifier or password file");
+ return false;
}
//
@@ -368,17 +368,17 @@ Glacier2::RouterService::start(int argc, char* argv[])
// done here.
//
_sessionRouter = new SessionRouterI(clientAdapter, serverAdapter, verifier, sessionManager, sslVerifier,
- sslSessionManager);
+ sslSessionManager);
//
// If we have an admin adapter, we add an admin object.
//
if(adminAdapter)
{
- Identity adminId;
- adminId.category = instanceName;
- adminId.name = "admin";
- adminAdapter->add(new AdminI(communicator()), adminId);
+ Identity adminId;
+ adminId.category = instanceName;
+ adminId.name = "admin";
+ adminAdapter->add(new AdminI(communicator()), adminId);
}
//
@@ -389,20 +389,20 @@ Glacier2::RouterService::start(int argc, char* argv[])
clientAdapter->activate();
if(serverAdapter)
{
- serverAdapter->activate();
+ serverAdapter->activate();
}
if(adminAdapter)
{
- adminAdapter->activate();
+ adminAdapter->activate();
}
}
catch(const Ice::Exception& ex)
{
- ostringstream ostr;
- ostr << ex;
- error("caught exception activating object adapters\n" + ostr.str());
+ ostringstream ostr;
+ ostr << ex;
+ error("caught exception activating object adapters\n" + ostr.str());
- stop();
+ stop();
return false;
}
@@ -414,15 +414,15 @@ Glacier2::RouterService::stop()
{
if(_sessionRouter)
{
- _sessionRouter->destroy();
- _sessionRouter = 0;
+ _sessionRouter->destroy();
+ _sessionRouter = 0;
}
return true;
}
CommunicatorPtr
Glacier2::RouterService::initializeCommunicator(int& argc, char* argv[],
- const InitializationData& initializationData)
+ const InitializationData& initializationData)
{
InitializationData initData = initializationData;
initData.properties = createProperties(argc, argv, initializationData.properties);
@@ -452,7 +452,7 @@ Glacier2::RouterService::initializeCommunicator(int& argc, char* argv[],
//
if(initData.properties->getProperty("Ice.MonitorConnections").empty())
{
- initData.properties->setProperty("Ice.MonitorConnections", "60");
+ initData.properties->setProperty("Ice.MonitorConnections", "60");
}
//
@@ -470,30 +470,30 @@ void
Glacier2::RouterService::usage(const string& appName)
{
string options =
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.";
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.";
#ifdef _WIN32
if(checkSystem())
{
options.append(
- "\n"
- "\n"
- "--service NAME Run as the Windows service NAME.\n"
- "\n"
- "--install NAME [--display DISP] [--executable EXEC] [args]\n"
- " Install as Windows service NAME. If DISP is\n"
- " provided, use it as the display name,\n"
- " otherwise NAME is used. If EXEC is provided,\n"
- " use it as the service executable, otherwise\n"
- " this executable is used. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service at startup.\n"
- "--uninstall NAME Uninstall Windows service NAME.\n"
- "--start NAME [args] Start Windows service NAME. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service.\n"
- "--stop NAME Stop Windows service NAME."
+ "\n"
+ "\n"
+ "--service NAME Run as the Windows service NAME.\n"
+ "\n"
+ "--install NAME [--display DISP] [--executable EXEC] [args]\n"
+ " Install as Windows service NAME. If DISP is\n"
+ " provided, use it as the display name,\n"
+ " otherwise NAME is used. If EXEC is provided,\n"
+ " use it as the service executable, otherwise\n"
+ " this executable is used. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service at startup.\n"
+ "--uninstall NAME Uninstall Windows service NAME.\n"
+ "--start NAME [args] Start Windows service NAME. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service.\n"
+ "--stop NAME Stop Windows service NAME."
);
}
#else
@@ -502,8 +502,8 @@ Glacier2::RouterService::usage(const string& appName)
"\n"
"--daemon Run as a daemon.\n"
"--noclose Do not close open file descriptors.\n"
- "--nochdir Do not change the current working directory.\n"
- "--pidfile <file> Write process ID to <file>."
+ "--nochdir Do not change the current working directory.\n"
+ "--pidfile <file> Write process ID to <file>."
);
#endif
print("Usage: " + appName + " [options]\n" + options);
diff --git a/cpp/src/Glacier2/ProxyVerifier.cpp b/cpp/src/Glacier2/ProxyVerifier.cpp
index b0666c696c4..a71c194eed2 100644
--- a/cpp/src/Glacier2/ProxyVerifier.cpp
+++ b/cpp/src/Glacier2/ProxyVerifier.cpp
@@ -43,67 +43,67 @@ parseGroup(const string& parameter, vector<int>& validPorts, vector<Range>& rang
istringstream istr(parameter);
while(!istr.eof())
{
- ws(istr);
- int value;
- if(!(istr >> value))
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "expected number";
- throw ex;
- }
- ws(istr);
- if(!istr.eof())
- {
- char c;
- if(istr >> c)
- {
- if(c == ',')
- {
- validPorts.push_back(value);
- }
- else if(c == '-')
- {
- Range r;
- r.start = value;
- ws(istr);
- if(istr.eof())
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "Unterminated range";
- throw ex;
- }
- if(!(istr >> value))
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "expected number";
- throw ex;
- }
- r.end = value;
- ws(istr);
- if(!istr.eof())
- {
- istr >> c;
- if(c != ',')
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "expected comma separator";
- throw ex;
- }
- }
- ranges.push_back(r);
- }
- else if(!istr.eof())
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "unexpected trailing character";
- throw ex;
- }
- }
- }
- else
- {
- validPorts.push_back(value);
- }
+ ws(istr);
+ int value;
+ if(!(istr >> value))
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "expected number";
+ throw ex;
+ }
+ ws(istr);
+ if(!istr.eof())
+ {
+ char c;
+ if(istr >> c)
+ {
+ if(c == ',')
+ {
+ validPorts.push_back(value);
+ }
+ else if(c == '-')
+ {
+ Range r;
+ r.start = value;
+ ws(istr);
+ if(istr.eof())
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "Unterminated range";
+ throw ex;
+ }
+ if(!(istr >> value))
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "expected number";
+ throw ex;
+ }
+ r.end = value;
+ ws(istr);
+ if(!istr.eof())
+ {
+ istr >> c;
+ if(c != ',')
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "expected comma separator";
+ throw ex;
+ }
+ }
+ ranges.push_back(r);
+ }
+ else if(!istr.eof())
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "unexpected trailing character";
+ throw ex;
+ }
+ }
+ }
+ else
+ {
+ validPorts.push_back(value);
+ }
}
}
@@ -131,13 +131,13 @@ public:
bool
match(const string&, string::size_type&)
{
- return true;
+ return true;
}
const char*
toString() const
{
- return "(ANY)";
+ return "(ANY)";
}
};
@@ -150,27 +150,27 @@ class StartsWithString : public AddressMatcher
{
public:
StartsWithString(const string& criteria):
- _criteria(criteria),
- _description("starts with " + criteria)
+ _criteria(criteria),
+ _description("starts with " + criteria)
{
}
bool
match(const string& space, string::size_type& pos)
{
- assert(pos == 0);
- bool result = strncmp(space.c_str(), _criteria.c_str(), _criteria.size()) == 0;
- if(result)
- {
- pos += _criteria.size();
- }
- return result;
+ assert(pos == 0);
+ bool result = strncmp(space.c_str(), _criteria.c_str(), _criteria.size()) == 0;
+ if(result)
+ {
+ pos += _criteria.size();
+ }
+ return result;
}
const char*
toString() const
{
- return _description.c_str();
+ return _description.c_str();
}
private:
@@ -186,35 +186,35 @@ class EndsWithString : public AddressMatcher
{
public:
EndsWithString(const string& criteria):
- _criteria(criteria),
- _description("ends with " + criteria)
+ _criteria(criteria),
+ _description("ends with " + criteria)
{
}
bool
match(const string& space, string::size_type& pos)
{
- if(space.size() - pos < _criteria.size())
- {
- return false;
- }
+ if(space.size() - pos < _criteria.size())
+ {
+ return false;
+ }
- string::size_type spaceEnd = space.size();
- for(string::size_type i = _criteria.size(); i > 0; --i)
- {
- if(space[spaceEnd - 1] != _criteria[i-1])
- {
- return false;
- }
- --spaceEnd;
- }
- return true;
+ string::size_type spaceEnd = space.size();
+ for(string::size_type i = _criteria.size(); i > 0; --i)
+ {
+ if(space[spaceEnd - 1] != _criteria[i-1])
+ {
+ return false;
+ }
+ --spaceEnd;
+ }
+ return true;
}
virtual const char*
toString() const
{
- return _description.c_str();
+ return _description.c_str();
}
private:
@@ -226,26 +226,26 @@ class MatchesString : public AddressMatcher
{
public:
MatchesString(const string& criteria):
- _criteria(criteria),
- _description("matches " + criteria)
+ _criteria(criteria),
+ _description("matches " + criteria)
{
}
bool
match(const string& space, string::size_type& pos)
{
- if(strncmp(space.c_str(), _criteria.c_str(), _criteria.size()) == 0)
- {
- pos += _criteria.size();
- return true;
- }
- return false;
+ if(strncmp(space.c_str(), _criteria.c_str(), _criteria.size()) == 0)
+ {
+ pos += _criteria.size();
+ return true;
+ }
+ return false;
}
virtual const char*
toString() const
{
- return _description.c_str();
+ return _description.c_str();
}
private:
@@ -261,27 +261,27 @@ class ContainsString : public AddressMatcher
{
public:
ContainsString(const string& criteria):
- _criteria(criteria),
- _description("contains " + criteria)
+ _criteria(criteria),
+ _description("contains " + criteria)
{
}
bool
match(const string& space, string::size_type& pos)
{
- string::size_type offset = space.find(_criteria, pos);
- if(offset == string::npos)
- {
- return false;
- }
- pos = offset + _criteria.size() +1;
- return true;
+ string::size_type offset = space.find(_criteria, pos);
+ if(offset == string::npos)
+ {
+ return false;
+ }
+ pos = offset + _criteria.size() +1;
+ return true;
}
virtual const char*
toString() const
{
- return _description.c_str();
+ return _description.c_str();
}
private:
@@ -298,90 +298,90 @@ class MatchesNumber : public AddressMatcher
{
public:
MatchesNumber(const vector<int>& values, const vector<Range>& ranges,
- const char* descriptionPrefix = "matches "):
- _values(values),
- _ranges(ranges)
- {
- ostringstream ostr;
- ostr << descriptionPrefix;
- {
- bool start = true;
- for(vector<int>::const_iterator i = values.begin(); i != values.end(); ++i)
- {
- if(start)
- {
- if(values.size() > 1)
- {
- ostr << "one of ";
- }
- start = false;
- }
- else
- {
- ostr << ", ";
- }
-
- ostr << *i;
- }
- }
- if(values.size() > 0 && ranges.size() > 0)
- {
- ostr << " or ";
- }
- {
- bool start = true;
- for(vector<Range>::const_iterator i = ranges.begin(); i != ranges.end(); ++i)
- {
- if(start)
- {
- start = false;
- }
- else
- {
- ostr << ", or";
- }
- ostr << i->start << " up to " << i->end;
- }
- }
- ostr << ends;
- _description = ostr.str();
+ const char* descriptionPrefix = "matches "):
+ _values(values),
+ _ranges(ranges)
+ {
+ ostringstream ostr;
+ ostr << descriptionPrefix;
+ {
+ bool start = true;
+ for(vector<int>::const_iterator i = values.begin(); i != values.end(); ++i)
+ {
+ if(start)
+ {
+ if(values.size() > 1)
+ {
+ ostr << "one of ";
+ }
+ start = false;
+ }
+ else
+ {
+ ostr << ", ";
+ }
+
+ ostr << *i;
+ }
+ }
+ if(values.size() > 0 && ranges.size() > 0)
+ {
+ ostr << " or ";
+ }
+ {
+ bool start = true;
+ for(vector<Range>::const_iterator i = ranges.begin(); i != ranges.end(); ++i)
+ {
+ if(start)
+ {
+ start = false;
+ }
+ else
+ {
+ ostr << ", or";
+ }
+ ostr << i->start << " up to " << i->end;
+ }
+ }
+ ostr << ends;
+ _description = ostr.str();
}
bool
match(const string & space, string::size_type& pos)
{
- istringstream istr(space.substr(pos));
- int val;
- if(!(istr >> val))
- {
- return false;
- }
- pos += istr.tellg();
- {
- for(vector<int>::const_iterator i = _values.begin(); i != _values.end(); ++i)
- {
- if(val == *i)
- {
- return true;
- }
- }
- }
- {
- for(vector<Range>::const_iterator i = _ranges.begin(); i != _ranges.end(); ++i)
- {
- if((val >= i->start) && (val <= i->end))
- {
- return true;
- }
- }
- }
- return false;
+ istringstream istr(space.substr(pos));
+ int val;
+ if(!(istr >> val))
+ {
+ return false;
+ }
+ pos += istr.tellg();
+ {
+ for(vector<int>::const_iterator i = _values.begin(); i != _values.end(); ++i)
+ {
+ if(val == *i)
+ {
+ return true;
+ }
+ }
+ }
+ {
+ for(vector<Range>::const_iterator i = _ranges.begin(); i != _ranges.end(); ++i)
+ {
+ if((val >= i->start) && (val <= i->end))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
}
virtual const char*
toString() const
{
- return _description.c_str();
+ return _description.c_str();
}
private:
@@ -397,27 +397,27 @@ class ContainsNumberMatch : public MatchesNumber
{
public:
ContainsNumberMatch(const vector<int>& values, const vector<Range>& ranges):
- MatchesNumber(values, ranges, "contains ")
+ MatchesNumber(values, ranges, "contains ")
{
}
bool
match(const string& space, string::size_type& pos)
{
- while(true)
- {
- pos = space.find_first_of("0123456789", pos);
- if(pos == string::npos)
- {
- return false;
- }
-
- if(MatchesNumber::match(space, pos))
- {
- return true;
- }
- }
- return false;
+ while(true)
+ {
+ pos = space.find_first_of("0123456789", pos);
+ if(pos == string::npos)
+ {
+ return false;
+ }
+
+ if(MatchesNumber::match(space, pos))
+ {
+ return true;
+ }
+ }
+ return false;
}
};
@@ -425,20 +425,20 @@ class EndsWithNumber : public MatchesNumber
{
public:
EndsWithNumber(const vector<int>& values, const vector<Range>& ranges):
- MatchesNumber(values, ranges, "ends with ")
+ MatchesNumber(values, ranges, "ends with ")
{
}
bool
match(const string& space, string::size_type& pos)
{
- pos = space.find_last_not_of("0123456789", pos);
- if(pos == space.size()-1)
- {
- return false;
- }
+ pos = space.find_last_not_of("0123456789", pos);
+ if(pos == space.size()-1)
+ {
+ return false;
+ }
- return MatchesNumber::match(space, pos);
+ return MatchesNumber::match(space, pos);
}
};
@@ -469,13 +469,13 @@ public:
AddressMatcher*
create(const string& criteria)
{
- return new StartsWithString(criteria);
+ return new StartsWithString(criteria);
}
AddressMatcher*
create(const vector<int>& ports, const vector<Range>& ranges)
{
- return new MatchesNumber(ports, ranges);
+ return new MatchesNumber(ports, ranges);
}
};
@@ -485,13 +485,13 @@ public:
AddressMatcher*
create(const string& criteria)
{
- return new ContainsString(criteria);
+ return new ContainsString(criteria);
}
AddressMatcher*
create(const vector<int>& ports, const vector<Range>& ranges)
{
- return new ContainsNumberMatch(ports, ranges);
+ return new ContainsNumberMatch(ports, ranges);
}
};
@@ -501,13 +501,13 @@ public:
AddressMatcher*
create(const string& criteria)
{
- return new MatchesString(criteria);
+ return new MatchesString(criteria);
}
AddressMatcher*
create(const vector<int>& ports, const vector<Range>& ranges)
{
- return new MatchesNumber(ports, ranges);
+ return new MatchesNumber(ports, ranges);
}
};
@@ -517,13 +517,13 @@ public:
AddressMatcher*
create(const string& criteria)
{
- return new EndsWithString(criteria);
+ return new EndsWithString(criteria);
}
AddressMatcher*
create(const vector<int>& ports, const vector<Range>& ranges)
{
- return new EndsWithNumber(ports, ranges);
+ return new EndsWithNumber(ports, ranges);
}
};
@@ -534,84 +534,84 @@ class AddressRule : public Glacier2::ProxyRule
{
public:
AddressRule(const CommunicatorPtr& communicator, const vector<AddressMatcher*>& address, MatchesNumber* port,
- const int traceLevel) :
- _communicator(communicator),
- _addressRules(address),
- _portMatcher(port),
- _traceLevel(traceLevel)
+ const int traceLevel) :
+ _communicator(communicator),
+ _addressRules(address),
+ _portMatcher(port),
+ _traceLevel(traceLevel)
{
}
~AddressRule()
{
- for(vector<AddressMatcher*>::const_iterator i = _addressRules.begin(); i != _addressRules.end(); ++i)
- {
- delete *i;
- }
- delete _portMatcher;
+ for(vector<AddressMatcher*>::const_iterator i = _addressRules.begin(); i != _addressRules.end(); ++i)
+ {
+ delete *i;
+ }
+ delete _portMatcher;
}
virtual bool
check(const ObjectPrx& prx) const
{
- EndpointSeq endpoints = prx->ice_getEndpoints();
- if(endpoints.size() == 0)
- {
- return false;
- }
-
- for(EndpointSeq::const_iterator i = endpoints.begin(); i != endpoints.end(); ++i)
- {
- string info = (*i)->toString();
- string host;
- if(!extractPart("-h ", info, host))
- {
- return false;
- }
- string port;
- if(!extractPart("-p ", info, port))
- {
- return false;
- }
- string::size_type pos = 0;
- if(!_portMatcher || _portMatcher->match(port, pos))
- {
- pos = 0;
- for(vector<AddressMatcher*>::const_iterator i = _addressRules.begin(); i != _addressRules.end(); ++i)
- {
- if(!(*i)->match(host, pos))
- {
- if(_traceLevel >= 3)
- {
- Trace out(_communicator->getLogger(), "Glacier2");
- out << (*i)->toString() << " failed to match " << host << " at pos=" << pos << "\n";
- }
- return false;
- }
- if(_traceLevel >= 3)
- {
- Trace out(_communicator->getLogger(), "Glacier2");
- out << (*i)->toString() << " matched " << host << " at pos=" << pos << "\n";
- }
- }
- }
- }
- return true;
+ EndpointSeq endpoints = prx->ice_getEndpoints();
+ if(endpoints.size() == 0)
+ {
+ return false;
+ }
+
+ for(EndpointSeq::const_iterator i = endpoints.begin(); i != endpoints.end(); ++i)
+ {
+ string info = (*i)->toString();
+ string host;
+ if(!extractPart("-h ", info, host))
+ {
+ return false;
+ }
+ string port;
+ if(!extractPart("-p ", info, port))
+ {
+ return false;
+ }
+ string::size_type pos = 0;
+ if(!_portMatcher || _portMatcher->match(port, pos))
+ {
+ pos = 0;
+ for(vector<AddressMatcher*>::const_iterator i = _addressRules.begin(); i != _addressRules.end(); ++i)
+ {
+ if(!(*i)->match(host, pos))
+ {
+ if(_traceLevel >= 3)
+ {
+ Trace out(_communicator->getLogger(), "Glacier2");
+ out << (*i)->toString() << " failed to match " << host << " at pos=" << pos << "\n";
+ }
+ return false;
+ }
+ if(_traceLevel >= 3)
+ {
+ Trace out(_communicator->getLogger(), "Glacier2");
+ out << (*i)->toString() << " matched " << host << " at pos=" << pos << "\n";
+ }
+ }
+ }
+ }
+ return true;
}
void
dump() const
{
- cerr << "address(";
- for(vector<AddressMatcher*>::const_iterator i = _addressRules.begin(); i != _addressRules.end(); ++i)
- {
- cerr << (*i)->toString() << " ";
- }
- if(_portMatcher != 0)
- {
- cerr << "):port(" << _portMatcher->toString() << " ";
- }
- cerr << ")" << endl;
+ cerr << "address(";
+ for(vector<AddressMatcher*>::const_iterator i = _addressRules.begin(); i != _addressRules.end(); ++i)
+ {
+ cerr << (*i)->toString() << " ";
+ }
+ if(_portMatcher != 0)
+ {
+ cerr << "):port(" << _portMatcher->toString() << " ";
+ }
+ cerr << ")" << endl;
}
private:
@@ -619,22 +619,22 @@ private:
bool
extractPart(const char* opt, const string& source, string& result) const
{
- string::size_type start = source.find(opt);
- if(start == string::npos)
- {
- return false;
- }
- start += strlen(opt);
- string::size_type end = source.find(' ', start);
- if(end != string::npos)
- {
- result = source.substr(start, end - start);
- }
- else
- {
- result = source.substr(start);
- }
- return true;
+ string::size_type start = source.find(opt);
+ if(start == string::npos)
+ {
+ return false;
+ }
+ start += strlen(opt);
+ string::size_type end = source.find(' ', start);
+ if(end != string::npos)
+ {
+ result = source.substr(start, end - start);
+ }
+ else
+ {
+ result = source.substr(start);
+ }
+ return true;
}
CommunicatorPtr _communicator;
@@ -645,7 +645,7 @@ private:
static void
parseProperty(const Ice::CommunicatorPtr& communicator, const string& property, vector<ProxyRule*>& rules,
- const int traceLevel)
+ const int traceLevel)
{
StartFactory startsWithFactory;
WildCardFactory wildCardFactory;
@@ -654,165 +654,165 @@ parseProperty(const Ice::CommunicatorPtr& communicator, const string& property,
vector<ProxyRule*> allRules;
try
{
- istringstream propertyInput(property);
-
- while(!propertyInput.eof() && propertyInput.good())
- {
- MatchesNumber* portMatch = 0;
- vector<AddressMatcher*> currentRuleSet;
-
- string parameter;
- ws(propertyInput);
- propertyInput >> parameter;
-
- string portInfo;
- string::size_type portPortion = parameter.find(':');
-
- string addr;
- if(portPortion != string::npos)
- {
- addr = parameter.substr(0, portPortion);
- string port = parameter.substr(portPortion + 1);
- string::size_type openBracket = port.find('[');
- if(openBracket != string::npos)
- {
- ++openBracket;
- string::size_type closeBracket = port.find(']', openBracket);
- if(closeBracket == string::npos)
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "unclosed group";
- throw ex;
- }
- port = port.substr(openBracket, closeBracket-openBracket);
- }
- vector<int> ports;
- vector<Range> ranges;
- parseGroup(port, ports, ranges);
- portMatch = new MatchesNumber(ports, ranges);
- }
- else
- {
- addr = parameter;
- }
-
- //
- // The addr portion can contain alphanumerics, * and
- // ranges.
- //
- string::size_type current = 0;
-
- if(current == addr.size())
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "expected address information before ':'";
- throw ex;
- }
-
- //
- // TODO: assuming that there is no leading or trailing whitespace. This
- // should probably be confirmed.
- //
- assert(!isspace(parameter[current]));
- assert(!isspace(addr[addr.size() -1]));
-
- if(current != 0)
- {
- addr = addr.substr(current);
- }
-
- string::size_type mark = 0;
- bool inGroup = false;
- AddressMatcherFactory* currentFactory = &startsWithFactory;
-
- if(addr == "*")
- {
- //
- // Special case. Match everything.
- //
- currentRuleSet.push_back(new MatchesAny);
- }
- else
- {
- for(current = 0; current < addr.size(); ++current)
- {
- if(addr[current] == '*')
- {
- if(inGroup)
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "wildcards not permitted in groups";
- throw ex;
- }
- //
- // current == mark when the wildcard is at the head of a
- // string or directly after a group.
- //
- if(current != mark)
- {
- currentRuleSet.push_back(currentFactory->create(addr.substr(mark, current-mark)));
- }
- currentFactory = &wildCardFactory;
- mark = current + 1;
- }
- else if(addr[current] == '[')
- {
- // ??? what does it mean if current == mark?
- if(current != mark)
- {
- currentRuleSet.push_back(currentFactory->create(addr.substr(mark, current-mark)));
- currentFactory = &followingFactory;
- }
- inGroup = true;
- mark = current + 1;
- }
- else if(addr[current] == ']')
- {
- if(!inGroup)
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "group close without group start";
- throw ex;
- }
- inGroup = false;
- if(mark == current)
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "empty group";
- throw ex;
- }
- string group = addr.substr(mark, current - mark);
- vector<int> numbers;
- vector<Range> ranges;
- parseGroup(group, numbers, ranges);
- currentRuleSet.push_back(currentFactory->create(numbers, ranges));
- currentFactory = &followingFactory;
- mark = current + 1;
- }
- }
- currentFactory = &endsWithFactory;
-
- if(inGroup)
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "unclosed group";
- throw ex;
- }
- if(mark != current)
- {
- currentRuleSet.push_back(currentFactory->create(addr.substr(mark, current - mark)));
- }
- }
- allRules.push_back(new AddressRule(communicator, currentRuleSet, portMatch, traceLevel));
- }
+ istringstream propertyInput(property);
+
+ while(!propertyInput.eof() && propertyInput.good())
+ {
+ MatchesNumber* portMatch = 0;
+ vector<AddressMatcher*> currentRuleSet;
+
+ string parameter;
+ ws(propertyInput);
+ propertyInput >> parameter;
+
+ string portInfo;
+ string::size_type portPortion = parameter.find(':');
+
+ string addr;
+ if(portPortion != string::npos)
+ {
+ addr = parameter.substr(0, portPortion);
+ string port = parameter.substr(portPortion + 1);
+ string::size_type openBracket = port.find('[');
+ if(openBracket != string::npos)
+ {
+ ++openBracket;
+ string::size_type closeBracket = port.find(']', openBracket);
+ if(closeBracket == string::npos)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "unclosed group";
+ throw ex;
+ }
+ port = port.substr(openBracket, closeBracket-openBracket);
+ }
+ vector<int> ports;
+ vector<Range> ranges;
+ parseGroup(port, ports, ranges);
+ portMatch = new MatchesNumber(ports, ranges);
+ }
+ else
+ {
+ addr = parameter;
+ }
+
+ //
+ // The addr portion can contain alphanumerics, * and
+ // ranges.
+ //
+ string::size_type current = 0;
+
+ if(current == addr.size())
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "expected address information before ':'";
+ throw ex;
+ }
+
+ //
+ // TODO: assuming that there is no leading or trailing whitespace. This
+ // should probably be confirmed.
+ //
+ assert(!isspace(parameter[current]));
+ assert(!isspace(addr[addr.size() -1]));
+
+ if(current != 0)
+ {
+ addr = addr.substr(current);
+ }
+
+ string::size_type mark = 0;
+ bool inGroup = false;
+ AddressMatcherFactory* currentFactory = &startsWithFactory;
+
+ if(addr == "*")
+ {
+ //
+ // Special case. Match everything.
+ //
+ currentRuleSet.push_back(new MatchesAny);
+ }
+ else
+ {
+ for(current = 0; current < addr.size(); ++current)
+ {
+ if(addr[current] == '*')
+ {
+ if(inGroup)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "wildcards not permitted in groups";
+ throw ex;
+ }
+ //
+ // current == mark when the wildcard is at the head of a
+ // string or directly after a group.
+ //
+ if(current != mark)
+ {
+ currentRuleSet.push_back(currentFactory->create(addr.substr(mark, current-mark)));
+ }
+ currentFactory = &wildCardFactory;
+ mark = current + 1;
+ }
+ else if(addr[current] == '[')
+ {
+ // ??? what does it mean if current == mark?
+ if(current != mark)
+ {
+ currentRuleSet.push_back(currentFactory->create(addr.substr(mark, current-mark)));
+ currentFactory = &followingFactory;
+ }
+ inGroup = true;
+ mark = current + 1;
+ }
+ else if(addr[current] == ']')
+ {
+ if(!inGroup)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "group close without group start";
+ throw ex;
+ }
+ inGroup = false;
+ if(mark == current)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "empty group";
+ throw ex;
+ }
+ string group = addr.substr(mark, current - mark);
+ vector<int> numbers;
+ vector<Range> ranges;
+ parseGroup(group, numbers, ranges);
+ currentRuleSet.push_back(currentFactory->create(numbers, ranges));
+ currentFactory = &followingFactory;
+ mark = current + 1;
+ }
+ }
+ currentFactory = &endsWithFactory;
+
+ if(inGroup)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "unclosed group";
+ throw ex;
+ }
+ if(mark != current)
+ {
+ currentRuleSet.push_back(currentFactory->create(addr.substr(mark, current - mark)));
+ }
+ }
+ allRules.push_back(new AddressRule(communicator, currentRuleSet, portMatch, traceLevel));
+ }
}
catch(...)
{
- for(vector<ProxyRule*>::const_iterator i = allRules.begin(); i != allRules.end(); ++i)
- {
- delete *i;
- }
- throw;
+ for(vector<ProxyRule*>::const_iterator i = allRules.begin(); i != allRules.end(); ++i)
+ {
+ delete *i;
+ }
+ throw;
}
rules = allRules;
}
@@ -825,10 +825,10 @@ match(const vector<ProxyRule*>& rules, const ObjectPrx& proxy)
{
for(vector<ProxyRule*>::const_iterator i = rules.begin(); i != rules.end(); ++i)
{
- if((*i)->check(proxy))
- {
- return true;
- }
+ if((*i)->check(proxy))
+ {
+ return true;
+ }
}
return false;
}
@@ -841,36 +841,36 @@ class ProxyLengthRule : public ProxyRule
{
public:
ProxyLengthRule(const CommunicatorPtr communicator, const string& count, int traceLevel) :
- _communicator(communicator),
- _traceLevel(traceLevel)
- {
- istringstream s(count);
- if(!(s >> _count) || !s.eof())
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "Error parsing ProxySizeMax property";
- throw ex;
- }
- if(_count <= 0)
- {
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "ProxySizeMax must be greater than 1";
- throw ex;
- }
+ _communicator(communicator),
+ _traceLevel(traceLevel)
+ {
+ istringstream s(count);
+ if(!(s >> _count) || !s.eof())
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "Error parsing ProxySizeMax property";
+ throw ex;
+ }
+ if(_count <= 0)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "ProxySizeMax must be greater than 1";
+ throw ex;
+ }
}
bool
check(const ObjectPrx& p) const
{
- string s = p->ice_toString();
- bool result = (s.size() > _count);
- if(_traceLevel >= 1)
- {
- Trace out(_communicator->getLogger(), "Glacier2");
- out << _communicator->proxyToString(p) << (result ? " exceeds " : " meets ")
- << "proxy size restriction\n";
- }
- return result;
+ string s = p->ice_toString();
+ bool result = (s.size() > _count);
+ if(_traceLevel >= 1)
+ {
+ Trace out(_communicator->getLogger(), "Glacier2");
+ out << _communicator->proxyToString(p) << (result ? " exceeds " : " meets ")
+ << "proxy size restriction\n";
+ }
+ return result;
}
private:
@@ -892,19 +892,19 @@ Glacier2::ProxyVerifier::ProxyVerifier(const CommunicatorPtr& communicator, cons
string s = communicator->getProperties()->getProperty("Glacier2.Filter.Address.Accept");
if(s != "")
{
- Glacier2::parseProperty(communicator, s, _acceptRules, _traceLevel);
+ Glacier2::parseProperty(communicator, s, _acceptRules, _traceLevel);
}
s = communicator->getProperties()->getProperty("Glacier2.Filter.Address.Reject");
if(s != "")
{
- Glacier2::parseProperty(communicator, s, _rejectRules, _traceLevel);
+ Glacier2::parseProperty(communicator, s, _rejectRules, _traceLevel);
}
s = communicator->getProperties()->getProperty("Glacier2.Filter.ProxySizeMax");
if(s != "")
{
- _rejectRules.push_back(new ProxyLengthRule(communicator, s, _traceLevel));
+ _rejectRules.push_back(new ProxyLengthRule(communicator, s, _traceLevel));
}
}
@@ -912,11 +912,11 @@ Glacier2::ProxyVerifier::~ProxyVerifier()
{
for(vector<ProxyRule*>::const_iterator i = _acceptRules.begin(); i != _acceptRules.end(); ++i)
{
- delete (*i);
+ delete (*i);
}
for(vector<ProxyRule*>::const_iterator j = _rejectRules.begin(); j != _rejectRules.end(); ++j)
{
- delete (*j);
+ delete (*j);
}
}
@@ -928,31 +928,31 @@ Glacier2::ProxyVerifier::verify(const ObjectPrx& proxy)
//
if(_acceptRules.size() == 0 && _rejectRules.size() == 0)
{
- return true;
+ return true;
}
bool result = false;
if(_rejectRules.size() == 0)
{
- //
- // If there are no reject rules, we assume "reject all".
- //
- result = match(_acceptRules, proxy);
+ //
+ // If there are no reject rules, we assume "reject all".
+ //
+ result = match(_acceptRules, proxy);
}
else if(_acceptRules.size() == 0)
{
- //
- // If no accept rules are defined we assume accept all.
- //
- result = !match(_rejectRules, proxy);
+ //
+ // If no accept rules are defined we assume accept all.
+ //
+ result = !match(_rejectRules, proxy);
}
else
{
- if(match(_acceptRules, proxy))
- {
- result = !match(_rejectRules, proxy);
- }
+ if(match(_acceptRules, proxy))
+ {
+ result = !match(_rejectRules, proxy);
+ }
}
//
@@ -960,15 +960,15 @@ Glacier2::ProxyVerifier::verify(const ObjectPrx& proxy)
//
if(_traceLevel > 0)
{
- Trace out(_communicator->getLogger(), "Glacier2");
- if(result)
- {
- out << "accepted proxy " << _communicator->proxyToString(proxy) << '\n';
- }
- else
- {
- out << "rejected proxy " << _communicator->proxyToString(proxy) << '\n';
- }
+ Trace out(_communicator->getLogger(), "Glacier2");
+ if(result)
+ {
+ out << "accepted proxy " << _communicator->proxyToString(proxy) << '\n';
+ }
+ else
+ {
+ out << "rejected proxy " << _communicator->proxyToString(proxy) << '\n';
+ }
}
return result;
}
diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp
index 55f700a0d65..099b73f3640 100644
--- a/cpp/src/Glacier2/RequestQueue.cpp
+++ b/cpp/src/Glacier2/RequestQueue.cpp
@@ -30,22 +30,22 @@ class AMI_Array_Object_ice_invokeI : public AMI_Array_Object_ice_invoke
public:
AMI_Array_Object_ice_invokeI(const RequestQueuePtr& requestQueue, const AMD_Array_Object_ice_invokePtr& amdCB) :
- _requestQueue(requestQueue),
- _amdCB(amdCB)
+ _requestQueue(requestQueue),
+ _amdCB(amdCB)
{
- assert(_amdCB);
+ assert(_amdCB);
}
virtual void
ice_response(bool ok, const pair<const Byte*, const Byte*>& outParams)
{
- _requestQueue->addResponse(new Response(_amdCB, ok, outParams));
+ _requestQueue->addResponse(new Response(_amdCB, ok, outParams));
}
virtual void
ice_exception(const Exception& ex)
{
- _requestQueue->addResponse(new Response(_amdCB, ex));
+ _requestQueue->addResponse(new Response(_amdCB, ex));
}
private:
@@ -57,8 +57,8 @@ private:
}
Glacier2::Request::Request(const ObjectPrx& proxy, const std::pair<const Byte*, const Byte*>& inParams,
- const Current& current, bool forwardContext, const Ice::Context& sslContext,
- const AMD_Array_Object_ice_invokePtr& amdCB) :
+ const Current& current, bool forwardContext, const Ice::Context& sslContext,
+ const AMD_Array_Object_ice_invokePtr& amdCB) :
_proxy(proxy),
_inParams(inParams.first, inParams.second),
_current(current),
@@ -72,15 +72,15 @@ Glacier2::Request::Request(const ObjectPrx& proxy, const std::pair<const Byte*,
//
if(!_proxy->ice_isTwoway())
{
- bool ok = true;
- pair<const Byte*, const Byte*> outParams(0, 0);
- _amdCB->ice_response(ok, outParams);
+ bool ok = true;
+ pair<const Byte*, const Byte*> outParams(0, 0);
+ _amdCB->ice_response(ok, outParams);
}
Context::const_iterator p = current.ctx.find("_ovrd");
if(p != current.ctx.end())
{
- const_cast<string&>(_override) = p->second;
+ const_cast<string&>(_override) = p->second;
}
}
@@ -96,71 +96,71 @@ Glacier2::Request::invoke(const RequestQueuePtr& requestQueue)
else
{
inPair.first = &_inParams[0];
- inPair.second = inPair.first + _inParams.size();
+ inPair.second = inPair.first + _inParams.size();
}
if(_proxy->ice_isTwoway())
{
- AMI_Array_Object_ice_invokePtr cb = new AMI_Array_Object_ice_invokeI(requestQueue, _amdCB);
- if(_forwardContext)
- {
- if(_sslContext.size() > 0)
- {
- Ice::Context ctx = _current.ctx;
- ctx.insert(_sslContext.begin(), _sslContext.end());
- _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair, ctx);
- }
- else
- {
- _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair, _current.ctx);
- }
- }
- else
- {
- if(_sslContext.size() > 0)
- {
- _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair, _sslContext);
- }
- else
- {
- _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair);
- }
- }
- return true; // A twoway method is being dispatched.
+ AMI_Array_Object_ice_invokePtr cb = new AMI_Array_Object_ice_invokeI(requestQueue, _amdCB);
+ if(_forwardContext)
+ {
+ if(_sslContext.size() > 0)
+ {
+ Ice::Context ctx = _current.ctx;
+ ctx.insert(_sslContext.begin(), _sslContext.end());
+ _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair, ctx);
+ }
+ else
+ {
+ _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair, _current.ctx);
+ }
+ }
+ else
+ {
+ if(_sslContext.size() > 0)
+ {
+ _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair, _sslContext);
+ }
+ else
+ {
+ _proxy->ice_invoke_async(cb, _current.operation, _current.mode, inPair);
+ }
+ }
+ return true; // A twoway method is being dispatched.
}
else
{
- try
- {
- ByteSeq outParams;
- if(_forwardContext)
- {
- if(_sslContext.size() > 0)
- {
- Ice::Context ctx = _current.ctx;
- ctx.insert(_sslContext.begin(), _sslContext.end());
- _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams, ctx);
- }
- else
- {
- _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams, _current.ctx);
- }
- }
- else
- {
- if(_sslContext.size() > 0)
- {
- _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams, _sslContext);
- }
- else
- {
- _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams);
- }
- }
- }
- catch(const LocalException&)
- {
- }
- return false;
+ try
+ {
+ ByteSeq outParams;
+ if(_forwardContext)
+ {
+ if(_sslContext.size() > 0)
+ {
+ Ice::Context ctx = _current.ctx;
+ ctx.insert(_sslContext.begin(), _sslContext.end());
+ _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams, ctx);
+ }
+ else
+ {
+ _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams, _current.ctx);
+ }
+ }
+ else
+ {
+ if(_sslContext.size() > 0)
+ {
+ _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams, _sslContext);
+ }
+ else
+ {
+ _proxy->ice_invoke(_current.operation, _current.mode, inPair, outParams);
+ }
+ }
+ }
+ catch(const LocalException&)
+ {
+ }
+ return false;
}
}
@@ -172,7 +172,7 @@ Glacier2::Request::override(const RequestPtr& other) const
//
if(_override.empty() || other->_override.empty())
{
- return false;
+ return false;
}
//
@@ -181,7 +181,7 @@ Glacier2::Request::override(const RequestPtr& other) const
//
if(_proxy->ice_isTwoway() || other->_proxy->ice_isTwoway())
{
- return false;
+ return false;
}
//
@@ -189,7 +189,7 @@ Glacier2::Request::override(const RequestPtr& other) const
//
if(_proxy != other->_proxy)
{
- return false;
+ return false;
}
return _override == other->_override;
@@ -208,7 +208,7 @@ Glacier2::Request::getConnection() const
}
Glacier2::Response::Response(const AMD_Array_Object_ice_invokePtr& amdCB, bool ok,
- const pair<const Byte*, const Byte*>& outParams) :
+ const pair<const Byte*, const Byte*>& outParams) :
_amdCB(amdCB),
_ok(ok),
_outParams(outParams.first, outParams.second)
@@ -227,21 +227,21 @@ Glacier2::Response::invoke()
{
if(_exception.get())
{
- _amdCB->ice_exception(*_exception.get());
+ _amdCB->ice_exception(*_exception.get());
}
else
{
pair<const Byte*, const Byte*> outPair;
- if(_outParams.size() == 0)
- {
- outPair.first = outPair.second = 0;
- }
- else
- {
- outPair.first = &_outParams[0];
- outPair.second = outPair.first + _outParams.size();
- }
- _amdCB->ice_response(_ok, outPair);
+ if(_outParams.size() == 0)
+ {
+ outPair.first = outPair.second = 0;
+ }
+ else
+ {
+ outPair.first = &_outParams[0];
+ outPair.second = outPair.first + _outParams.size();
+ }
+ _amdCB->ice_response(_ok, outPair);
}
}
@@ -265,12 +265,12 @@ void
Glacier2::RequestQueue::destroy()
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- assert(!_destroy);
- _destroy = true;
- _sleep = false;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ assert(!_destroy);
+ _destroy = true;
+ _sleep = false;
+ notify();
}
//
@@ -295,14 +295,14 @@ Glacier2::RequestQueue::addRequest(const RequestPtr& request)
for(vector<RequestPtr>::iterator p = _requests.begin(); p != _requests.end(); ++p)
{
- //
+ //
// If the new request overrides an old one, then abort the old
// request and replace it with the new request.
- //
+ //
if(request->override(*p))
{
*p = request;
- return true;
+ return true;
}
}
@@ -312,11 +312,11 @@ Glacier2::RequestQueue::addRequest(const RequestPtr& request)
_requests.push_back(request);
if(!_sleep)
{
- //
- // No need to notify if the request queue thread is sleeping,
- // once it wakes up it will check if there's requests to send.
- //
- notify();
+ //
+ // No need to notify if the request queue thread is sleeping,
+ // once it wakes up it will check if there's requests to send.
+ //
+ notify();
}
return false;
}
@@ -336,73 +336,73 @@ Glacier2::RequestQueue::run()
ptrdiff_t dispatchCount = 0; // The dispatch count keeps track of the number of outstanding twoway requests.
while(true)
{
- vector<RequestPtr> requests;
- vector<ResponsePtr> responses;
+ vector<RequestPtr> requests;
+ vector<ResponsePtr> responses;
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
- //
- // Wait indefinitely if there's no requests/responses to
- // send. If the queue is being destroyed we still need to
- // wait until all the responses for twoway requests are
- // received.
- //
+ //
+ // Wait indefinitely if there's no requests/responses to
+ // send. If the queue is being destroyed we still need to
+ // wait until all the responses for twoway requests are
+ // received.
+ //
while((!_destroy || dispatchCount != 0) && _responses.empty() && (_requests.empty() || _sleep))
{
- if(_sleep)
- {
- IceUtil::Time now = IceUtil::Time::now();
- if(!timedWait(_sleepDuration))
- {
- _sleepDuration = IceUtil::Time();
- }
- else
- {
- _sleepDuration -= IceUtil::Time::now() - now;
- }
- if(_sleepDuration <= IceUtil::Time())
- {
- _sleep = false;
- }
- }
- else
- {
- wait();
- }
+ if(_sleep)
+ {
+ IceUtil::Time now = IceUtil::Time::now();
+ if(!timedWait(_sleepDuration))
+ {
+ _sleepDuration = IceUtil::Time();
+ }
+ else
+ {
+ _sleepDuration -= IceUtil::Time::now() - now;
+ }
+ if(_sleepDuration <= IceUtil::Time())
+ {
+ _sleep = false;
+ }
+ }
+ else
+ {
+ wait();
+ }
}
- //
- // If the queue is being destroyed and there's no requests
- // or responses to send, we're done.
- //
+ //
+ // If the queue is being destroyed and there's no requests
+ // or responses to send, we're done.
+ //
if(_destroy && _requests.empty() && _responses.empty())
{
- assert(dispatchCount == 0); // We would have blocked in the wait() above otherwise.
+ assert(dispatchCount == 0); // We would have blocked in the wait() above otherwise.
return;
}
- //
- // If there's requests to sent and we're not sleeping,
- // send the requests. If a sleep time is configured, we
- // set the sleep duration and set the sleep flag to make
- // sure we'll sleep again once we're done sending requests
- // and responses.
- //
- if(!_requests.empty() && !_sleep)
- {
- requests.swap(_requests);
- if(_sleepTime > IceUtil::Time())
- {
- _sleep = true;
- _sleepDuration = _sleepTime;
- }
- }
- if(!_responses.empty())
- {
- responses.swap(_responses);
- }
- }
+ //
+ // If there's requests to sent and we're not sleeping,
+ // send the requests. If a sleep time is configured, we
+ // set the sleep duration and set the sleep flag to make
+ // sure we'll sleep again once we're done sending requests
+ // and responses.
+ //
+ if(!_requests.empty() && !_sleep)
+ {
+ requests.swap(_requests);
+ if(_sleepTime > IceUtil::Time())
+ {
+ _sleep = true;
+ _sleepDuration = _sleepTime;
+ }
+ }
+ if(!_responses.empty())
+ {
+ responses.swap(_responses);
+ }
+ }
//
// Send requests, flush batch requests, and sleep outside the
@@ -410,53 +410,53 @@ Glacier2::RequestQueue::run()
// while this is being done.
//
- set<ConnectionPtr> flushSet;
-
- for(vector<RequestPtr>::const_iterator p = requests.begin(); p != requests.end(); ++p)
- {
- if((*p)->isBatch())
- {
- try
- {
- flushSet.insert((*p)->getConnection());
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
- }
-
- //
- // Invoke returns true if the request expects a response.
- // If that's the case we increment the dispatch count to
- // ensure that the thread won't be destroyed before the
- // response is received.
- //
- if((*p)->invoke(self)) // Exceptions are caught within invoke().
- {
- ++dispatchCount;
- }
- }
-
- for(set<ConnectionPtr>::const_iterator q = flushSet.begin(); q != flushSet.end(); ++q)
- {
- try
- {
- (*q)->flushBatchRequests();
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
- }
-
- //
- // Send the responses and decrement the dispatch count.
- //
- for(vector<ResponsePtr>::const_iterator r = responses.begin(); r != responses.end(); ++r)
- {
- (*r)->invoke();
- }
- dispatchCount -= responses.size();
+ set<ConnectionPtr> flushSet;
+
+ for(vector<RequestPtr>::const_iterator p = requests.begin(); p != requests.end(); ++p)
+ {
+ if((*p)->isBatch())
+ {
+ try
+ {
+ flushSet.insert((*p)->getConnection());
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
+ }
+
+ //
+ // Invoke returns true if the request expects a response.
+ // If that's the case we increment the dispatch count to
+ // ensure that the thread won't be destroyed before the
+ // response is received.
+ //
+ if((*p)->invoke(self)) // Exceptions are caught within invoke().
+ {
+ ++dispatchCount;
+ }
+ }
+
+ for(set<ConnectionPtr>::const_iterator q = flushSet.begin(); q != flushSet.end(); ++q)
+ {
+ try
+ {
+ (*q)->flushBatchRequests();
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
+ }
+
+ //
+ // Send the responses and decrement the dispatch count.
+ //
+ for(vector<ResponsePtr>::const_iterator r = responses.begin(); r != responses.end(); ++r)
+ {
+ (*r)->invoke();
+ }
+ dispatchCount -= responses.size();
}
}
diff --git a/cpp/src/Glacier2/RequestQueue.h b/cpp/src/Glacier2/RequestQueue.h
index 7a9e4db280d..2599b24f7aa 100644
--- a/cpp/src/Glacier2/RequestQueue.h
+++ b/cpp/src/Glacier2/RequestQueue.h
@@ -28,7 +28,7 @@ class Request : public IceUtil::Shared
public:
Request(const Ice::ObjectPrx&, const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&, bool,
- const Ice::Context&, const Ice::AMD_Array_Object_ice_invokePtr&);
+ const Ice::Context&, const Ice::AMD_Array_Object_ice_invokePtr&);
bool invoke(const RequestQueuePtr&);
bool override(const RequestPtr&) const;
diff --git a/cpp/src/Glacier2/RouterI.cpp b/cpp/src/Glacier2/RouterI.cpp
index c3f34f4c4d6..ff917e8b445 100644
--- a/cpp/src/Glacier2/RouterI.cpp
+++ b/cpp/src/Glacier2/RouterI.cpp
@@ -19,9 +19,9 @@ using namespace Ice;
using namespace Glacier2;
Glacier2::RouterI::RouterI(const ObjectAdapterPtr& clientAdapter, const ObjectAdapterPtr& serverAdapter,
- const ConnectionPtr& connection, const string& userId, const SessionPrx& session,
- const Identity& controlId, const FilterManagerPtr& filters,
- const Ice::Context& sslContext) :
+ const ConnectionPtr& connection, const string& userId, const SessionPrx& session,
+ const Identity& controlId, const FilterManagerPtr& filters,
+ const Ice::Context& sslContext) :
_communicator(clientAdapter->getCommunicator()),
_clientBlobject(new ClientBlobject(_communicator, filters, sslContext)),
_serverAdapter(serverAdapter),
@@ -39,26 +39,26 @@ Glacier2::RouterI::RouterI(const ObjectAdapterPtr& clientAdapter, const ObjectAd
if(_communicator->getProperties()->getPropertyAsInt("Glacier2.ReturnClientProxy") > 0)
{
const_cast<Ice::ObjectPrx&>(_clientProxy) =
- clientAdapter->createProxy(_communicator->stringToIdentity("dummy"));
+ clientAdapter->createProxy(_communicator->stringToIdentity("dummy"));
}
if(serverAdapter)
{
- ObjectPrx& serverProxy = const_cast<ObjectPrx&>(_serverProxy);
- Identity ident;
- ident.name = "dummy";
- ident.category.resize(20);
- char buf[20];
- IceUtil::generateRandom(buf, static_cast<int>(sizeof(buf)));
- for(unsigned int i = 0; i < sizeof(buf); ++i)
- {
- const unsigned char c = static_cast<unsigned char>(buf[i]); // A value between 0-255
- ident.category[i] = 33 + c % (127-33); // We use ASCII 33-126 (from ! to ~, w/o space).
- }
- serverProxy = serverAdapter->createProxy(ident);
-
- ServerBlobjectPtr& serverBlobject = const_cast<ServerBlobjectPtr&>(_serverBlobject);
- serverBlobject = new ServerBlobject(_communicator, _connection);
+ ObjectPrx& serverProxy = const_cast<ObjectPrx&>(_serverProxy);
+ Identity ident;
+ ident.name = "dummy";
+ ident.category.resize(20);
+ char buf[20];
+ IceUtil::generateRandom(buf, static_cast<int>(sizeof(buf)));
+ for(unsigned int i = 0; i < sizeof(buf); ++i)
+ {
+ const unsigned char c = static_cast<unsigned char>(buf[i]); // A value between 0-255
+ ident.category[i] = 33 + c % (127-33); // We use ASCII 33-126 (from ! to ~, w/o space).
+ }
+ serverProxy = serverAdapter->createProxy(ident);
+
+ ServerBlobjectPtr& serverBlobject = const_cast<ServerBlobjectPtr&>(_serverBlobject);
+ serverBlobject = new ServerBlobject(_communicator, _connection);
}
}
@@ -75,43 +75,43 @@ Glacier2::RouterI::destroy()
if(_serverBlobject)
{
- _serverBlobject->destroy();
+ _serverBlobject->destroy();
}
if(_session)
{
if(_serverAdapter)
- {
- try
- {
- //
- // Remove the session control object.
- //
- _serverAdapter->remove(_controlId);
- }
- catch(const NotRegisteredException&)
- {
- }
- catch(const ObjectAdapterDeactivatedException&)
- {
- //
- // Expected if the router has been shutdown.
- //
- }
- }
-
- //
- // This can raise an exception, therefore it must be the last
- // statement in this destroy() function.
- //
- if(_sslContext.size() > 0)
- {
- _session->destroy(_sslContext);
- }
- else
- {
- _session->destroy();
- }
+ {
+ try
+ {
+ //
+ // Remove the session control object.
+ //
+ _serverAdapter->remove(_controlId);
+ }
+ catch(const NotRegisteredException&)
+ {
+ }
+ catch(const ObjectAdapterDeactivatedException&)
+ {
+ //
+ // Expected if the router has been shutdown.
+ //
+ }
+ }
+
+ //
+ // This can raise an exception, therefore it must be the last
+ // statement in this destroy() function.
+ //
+ if(_sslContext.size() > 0)
+ {
+ _session->destroy(_sslContext);
+ }
+ else
+ {
+ _session->destroy();
+ }
}
}
@@ -231,7 +231,7 @@ Glacier2::RouterI::toString() const
out << "id = " << _userId << '\n';
if(_serverProxy)
{
- out << "category = " << _serverProxy->ice_getIdentity().category << '\n';
+ out << "category = " << _serverProxy->ice_getIdentity().category << '\n';
}
out << _connection->toString();
diff --git a/cpp/src/Glacier2/RouterI.h b/cpp/src/Glacier2/RouterI.h
index c046413c7c3..64bccd5d50c 100644
--- a/cpp/src/Glacier2/RouterI.h
+++ b/cpp/src/Glacier2/RouterI.h
@@ -31,7 +31,7 @@ public:
RouterI(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&, const Ice::ConnectionPtr&, const std::string&,
const SessionPrx&, const Ice::Identity&, const FilterManagerPtr&, const Ice::Context& sslContext);
-
+
virtual ~RouterI();
void destroy();
diff --git a/cpp/src/Glacier2/RoutingTable.cpp b/cpp/src/Glacier2/RoutingTable.cpp
index 6a366130837..b5f73e7ed10 100644
--- a/cpp/src/Glacier2/RoutingTable.cpp
+++ b/cpp/src/Glacier2/RoutingTable.cpp
@@ -35,69 +35,69 @@ Glacier2::RoutingTable::add(const ObjectProxySeq& unfiltered, const Ice::Current
ObjectProxySeq::const_iterator prx;
for(prx = unfiltered.begin(); prx != unfiltered.end(); ++prx)
{
- if(!*prx) // We ignore null proxies.
- {
- continue;
- }
+ if(!*prx) // We ignore null proxies.
+ {
+ continue;
+ }
- if(!_verifier.verify(*prx))
- {
- current.con->close(true);
- throw ObjectNotExistException(__FILE__, __LINE__);
- }
- ObjectPrx proxy = (*prx)->ice_twoway()->ice_secure(false)->ice_facet(""); // We add proxies in default form.
- proxies.push_back(proxy);
+ if(!_verifier.verify(*prx))
+ {
+ current.con->close(true);
+ throw ObjectNotExistException(__FILE__, __LINE__);
+ }
+ ObjectPrx proxy = (*prx)->ice_twoway()->ice_secure(false)->ice_facet(""); // We add proxies in default form.
+ proxies.push_back(proxy);
}
ObjectProxySeq evictedProxies;
for(prx = proxies.begin(); prx != proxies.end(); ++prx)
{
- ObjectPrx proxy = *prx;
- EvictorMap::iterator p = _map.find(proxy->ice_getIdentity());
-
- if(p == _map.end())
- {
- if(_traceLevel == 1 || _traceLevel >= 3)
- {
- Trace out(_communicator->getLogger(), "Glacier2");
- out << "adding proxy to routing table:\n" << _communicator->proxyToString(proxy);
- }
-
- EvictorEntryPtr entry = new EvictorEntry;
- p = _map.insert(_map.begin(), pair<const Identity, EvictorEntryPtr>(proxy->ice_getIdentity(), entry));
- EvictorQueue::iterator q = _queue.insert(_queue.end(), p);
- entry->proxy = proxy;
- entry->pos = q;
- }
- else
- {
- if(_traceLevel == 1 || _traceLevel >= 3)
- {
- Trace out(_communicator->getLogger(), "Glacier2");
- out << "proxy already in routing table:\n" << _communicator->proxyToString(proxy);
- }
-
- EvictorEntryPtr entry = p->second;
- _queue.erase(entry->pos);
- EvictorQueue::iterator q = _queue.insert(_queue.end(), p);
- entry->pos = q;
- }
-
- while(static_cast<int>(_map.size()) > _maxSize)
- {
- p = _queue.front();
-
- if(_traceLevel >= 2)
- {
- Trace out(_communicator->getLogger(), "Glacier2");
- out << "evicting proxy from routing table:\n" << _communicator->proxyToString(p->second->proxy);
- }
-
- evictedProxies.push_back(p->second->proxy);
+ ObjectPrx proxy = *prx;
+ EvictorMap::iterator p = _map.find(proxy->ice_getIdentity());
+
+ if(p == _map.end())
+ {
+ if(_traceLevel == 1 || _traceLevel >= 3)
+ {
+ Trace out(_communicator->getLogger(), "Glacier2");
+ out << "adding proxy to routing table:\n" << _communicator->proxyToString(proxy);
+ }
+
+ EvictorEntryPtr entry = new EvictorEntry;
+ p = _map.insert(_map.begin(), pair<const Identity, EvictorEntryPtr>(proxy->ice_getIdentity(), entry));
+ EvictorQueue::iterator q = _queue.insert(_queue.end(), p);
+ entry->proxy = proxy;
+ entry->pos = q;
+ }
+ else
+ {
+ if(_traceLevel == 1 || _traceLevel >= 3)
+ {
+ Trace out(_communicator->getLogger(), "Glacier2");
+ out << "proxy already in routing table:\n" << _communicator->proxyToString(proxy);
+ }
+
+ EvictorEntryPtr entry = p->second;
+ _queue.erase(entry->pos);
+ EvictorQueue::iterator q = _queue.insert(_queue.end(), p);
+ entry->pos = q;
+ }
+
+ while(static_cast<int>(_map.size()) > _maxSize)
+ {
+ p = _queue.front();
+
+ if(_traceLevel >= 2)
+ {
+ Trace out(_communicator->getLogger(), "Glacier2");
+ out << "evicting proxy from routing table:\n" << _communicator->proxyToString(p->second->proxy);
+ }
+
+ evictedProxies.push_back(p->second->proxy);
- _map.erase(p);
- _queue.pop_front();
- }
+ _map.erase(p);
+ _queue.pop_front();
+ }
}
return evictedProxies;
@@ -108,7 +108,7 @@ Glacier2::RoutingTable::get(const Identity& ident)
{
if(ident.name.empty())
{
- return 0;
+ return 0;
}
IceUtil::Mutex::Lock sync(*this);
@@ -117,15 +117,15 @@ Glacier2::RoutingTable::get(const Identity& ident)
if(p == _map.end())
{
- return 0;
+ return 0;
}
else
{
- EvictorEntryPtr entry = p->second;
- _queue.erase(entry->pos);
- EvictorQueue::iterator q = _queue.insert(_queue.end(), p);
- entry->pos = q;
+ EvictorEntryPtr entry = p->second;
+ _queue.erase(entry->pos);
+ EvictorQueue::iterator q = _queue.insert(_queue.end(), p);
+ entry->pos = q;
- return entry->proxy;
+ return entry->proxy;
}
}
diff --git a/cpp/src/Glacier2/RoutingTable.h b/cpp/src/Glacier2/RoutingTable.h
index 59c82eb9ff1..140ac29fd42 100644
--- a/cpp/src/Glacier2/RoutingTable.h
+++ b/cpp/src/Glacier2/RoutingTable.h
@@ -45,8 +45,8 @@ private:
friend struct EvictorEntry;
struct EvictorEntry : public IceUtil::Shared
{
- Ice::ObjectPrx proxy;
- EvictorQueue::iterator pos;
+ Ice::ObjectPrx proxy;
+ EvictorQueue::iterator pos;
};
EvictorMap _map;
diff --git a/cpp/src/Glacier2/ServerBlobject.cpp b/cpp/src/Glacier2/ServerBlobject.cpp
index 2942f2df17e..aafc1c8429f 100644
--- a/cpp/src/Glacier2/ServerBlobject.cpp
+++ b/cpp/src/Glacier2/ServerBlobject.cpp
@@ -25,8 +25,8 @@ Glacier2::ServerBlobject::~ServerBlobject()
void
Glacier2::ServerBlobject::ice_invoke_async(const Ice::AMD_Array_Object_ice_invokePtr& amdCB,
- const std::pair<const Byte*, const Byte*>& inParams,
- const Current& current)
+ const std::pair<const Byte*, const Byte*>& inParams,
+ const Current& current)
{
ObjectPrx proxy = _connection->createProxy(current.id);
assert(proxy);
diff --git a/cpp/src/Glacier2/ServerBlobject.h b/cpp/src/Glacier2/ServerBlobject.h
index 965341a9f1f..200a951cc59 100644
--- a/cpp/src/Glacier2/ServerBlobject.h
+++ b/cpp/src/Glacier2/ServerBlobject.h
@@ -26,7 +26,7 @@ public:
virtual ~ServerBlobject();
virtual void ice_invoke_async(const Ice::AMD_Array_Object_ice_invokePtr&,
- const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
+ const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
private:
diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp
index 2052f7cfd45..a095748b52d 100644
--- a/cpp/src/Glacier2/SessionRouterI.cpp
+++ b/cpp/src/Glacier2/SessionRouterI.cpp
@@ -29,43 +29,43 @@ class SessionControlI : public SessionControl
public:
SessionControlI(const SessionRouterIPtr& sessionRouter, const ConnectionPtr& connection,
- const FilterManagerPtr& filterManager, IceUtil::Time timeout) :
+ const FilterManagerPtr& filterManager, IceUtil::Time timeout) :
_sessionRouter(sessionRouter),
- _connection(connection),
- _filters(filterManager),
- _timeout(static_cast<int>(timeout.toSeconds()))
+ _connection(connection),
+ _filters(filterManager),
+ _timeout(static_cast<int>(timeout.toSeconds()))
{
}
virtual StringSetPrx
categories(const Current&)
{
- return _filters->categoriesPrx();
+ return _filters->categoriesPrx();
}
virtual StringSetPrx
adapterIds(const Current&)
{
- return _filters->adapterIdsPrx();
+ return _filters->adapterIdsPrx();
}
virtual IdentitySetPrx
identities(const Current&)
{
- return _filters->identitiesPrx();
+ return _filters->identitiesPrx();
}
virtual int
getSessionTimeout(const Current&)
{
- return _timeout;
+ return _timeout;
}
virtual void
destroy(const Current&)
{
_sessionRouter->destroySession(_connection);
- _filters->destroy();
+ _filters->destroy();
}
private:
@@ -81,14 +81,14 @@ class ClientLocator : public ServantLocator
public:
ClientLocator(const SessionRouterIPtr& sessionRouter) :
- _sessionRouter(sessionRouter)
+ _sessionRouter(sessionRouter)
{
}
virtual ObjectPtr
locate(const Current& current, LocalObjectPtr&)
{
- return _sessionRouter->getRouter(current.con, current.id)->getClientBlobject();
+ return _sessionRouter->getRouter(current.con, current.id)->getClientBlobject();
}
virtual void
@@ -111,14 +111,14 @@ class ServerLocator : public ServantLocator
public:
ServerLocator(const SessionRouterIPtr& sessionRouter) :
- _sessionRouter(sessionRouter)
+ _sessionRouter(sessionRouter)
{
}
virtual ObjectPtr
locate(const Current& current, LocalObjectPtr&)
{
- return _sessionRouter->getRouter(current.id.category)->getServerBlobject();
+ return _sessionRouter->getRouter(current.id.category)->getServerBlobject();
}
virtual void
@@ -141,19 +141,19 @@ class UserPasswordAuthorizer : public Authorizer
public:
UserPasswordAuthorizer(const PermissionsVerifierPrx& verifier, const string& user, const string& password) :
- _verifier(verifier), _user(user), _password(password)
+ _verifier(verifier), _user(user), _password(password)
{
}
virtual bool
authorize(string& reason, const Ice::Context& ctx)
{
- if(_verifier)
- {
- return _verifier->checkPermissions(_user, _password, reason, ctx);
- }
- reason = "No PermissionsVerifier is available";
- return false;
+ if(_verifier)
+ {
+ return _verifier->checkPermissions(_user, _password, reason, ctx);
+ }
+ reason = "No PermissionsVerifier is available";
+ return false;
}
private:
@@ -168,20 +168,20 @@ class SSLPasswordAuthorizer : public Authorizer
public:
SSLPasswordAuthorizer(const SSLPermissionsVerifierPrx& verifier, const SSLInfo& info) :
- _verifier(verifier), _info(info)
+ _verifier(verifier), _info(info)
{
}
virtual bool
authorize(string& reason, const Ice::Context& ctx)
{
- if(_verifier)
- {
- return _verifier->authorize(_info, reason, ctx);
- }
+ if(_verifier)
+ {
+ return _verifier->authorize(_info, reason, ctx);
+ }
- reason = "No SSLPermissionsVerifier is available";
- return false;
+ reason = "No SSLPermissionsVerifier is available";
+ return false;
}
private:
@@ -195,14 +195,14 @@ class UserSessionFactory : public SessionFactory
public:
UserSessionFactory(const SessionManagerPrx& manager, const string& user) :
- _manager(manager), _user(user)
+ _manager(manager), _user(user)
{
}
virtual SessionPrx
create(const SessionControlPrx& control, const Ice::Context& ctx)
{
- return _manager->create(_user, control, ctx);
+ return _manager->create(_user, control, ctx);
}
private:
@@ -216,14 +216,14 @@ class SSLSessionFactory : public SessionFactory
public:
SSLSessionFactory(const SSLSessionManagerPrx& manager, const SSLInfo& info) :
- _manager(manager), _info(info)
+ _manager(manager), _info(info)
{
}
virtual SessionPrx
create(const SessionControlPrx& control, const Ice::Context& ctx)
{
- return _manager->create(_info, control, ctx);
+ return _manager->create(_info, control, ctx);
}
private:
@@ -237,11 +237,11 @@ private:
using namespace Glacier2;
Glacier2::SessionRouterI::SessionRouterI(const ObjectAdapterPtr& clientAdapter,
- const ObjectAdapterPtr& serverAdapter,
- const PermissionsVerifierPrx& verifier,
- const SessionManagerPrx& sessionManager,
- const SSLPermissionsVerifierPrx& sslVerifier,
- const SSLSessionManagerPrx& sslSessionManager) :
+ const ObjectAdapterPtr& serverAdapter,
+ const PermissionsVerifierPrx& verifier,
+ const SessionManagerPrx& sessionManager,
+ const SSLPermissionsVerifierPrx& sslVerifier,
+ const SSLSessionManagerPrx& sslSessionManager) :
_properties(clientAdapter->getCommunicator()->getProperties()),
_logger(clientAdapter->getCommunicator()->getLogger()),
_sessionTraceLevel(_properties->getPropertyAsInt("Glacier2.Trace.Session")),
@@ -280,12 +280,12 @@ Glacier2::SessionRouterI::SessionRouterI(const ObjectAdapterPtr& clientAdapter,
//
if(_serverAdapter)
{
- _serverAdapter->addServantLocator(new ServerLocator(this), "");
+ _serverAdapter->addServantLocator(new ServerLocator(this), "");
}
if(_sessionThread)
{
- _sessionThread->start();
+ _sessionThread->start();
}
}
@@ -307,20 +307,20 @@ Glacier2::SessionRouterI::destroy()
SessionThreadPtr sessionThread;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- assert(!_destroy);
- _destroy = true;
- notify();
-
- _routersByConnection.swap(routers);
- _routersByConnectionHint = _routersByConnection.end();
-
- _routersByCategory.clear();
- _routersByCategoryHint = _routersByCategory.end();
-
- sessionThread = _sessionThread;
- _sessionThread = 0;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ assert(!_destroy);
+ _destroy = true;
+ notify();
+
+ _routersByConnection.swap(routers);
+ _routersByConnectionHint = _routersByConnection.end();
+
+ _routersByCategory.clear();
+ _routersByCategoryHint = _routersByCategory.end();
+
+ sessionThread = _sessionThread;
+ _sessionThread = 0;
}
//
@@ -329,26 +329,26 @@ Glacier2::SessionRouterI::destroy()
//
for(map<ConnectionPtr, RouterIPtr>::iterator p = routers.begin(); p != routers.end(); ++p)
{
- RouterIPtr router = p->second;
-
- try
- {
- router->destroy();
- }
- catch(const Exception& ex)
- {
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "exception while destroying session\n" << ex;
- }
- }
+ RouterIPtr router = p->second;
+
+ try
+ {
+ router->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "exception while destroying session\n" << ex;
+ }
+ }
}
if(sessionThread)
{
- sessionThread->destroy();
- sessionThread->getThreadControl().join();
+ sessionThread->destroy();
+ sessionThread->getThreadControl().join();
}
}
@@ -394,10 +394,10 @@ Glacier2::SessionRouterI::createSession(const std::string& userId, const std::st
SessionFactoryPtr factory;
if(_sessionManager)
{
- factory = new UserSessionFactory(_sessionManager, userId);
+ factory = new UserSessionFactory(_sessionManager, userId);
}
return createSessionInternal(userId, true, new UserPasswordAuthorizer(_verifier, userId, password), factory,
- Ice::Context(), current);
+ Ice::Context(), current);
}
SessionPrx
@@ -405,9 +405,9 @@ Glacier2::SessionRouterI::createSessionFromSecureConnection(const Current& curre
{
if(!_sslVerifier)
{
- PermissionDeniedException exc;
- exc.reason = "no configured ssl permissions verifier";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "no configured ssl permissions verifier";
+ throw exc;
}
string userDN;
@@ -419,62 +419,62 @@ Glacier2::SessionRouterI::createSessionFromSecureConnection(const Current& curre
//
try
{
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(current.con);
- sslinfo.remotePort = ntohs(info.remoteAddr.sin_port);
- sslinfo.remoteHost = IceInternal::inetAddrToString(info.remoteAddr.sin_addr);
- sslinfo.localPort = ntohs(info.localAddr.sin_port);
- sslinfo.localHost = IceInternal::inetAddrToString(info.localAddr.sin_addr);
-
- sslinfo.cipher = info.cipher;
-
- if(info.certs.size() > 0)
- {
- sslinfo.certs.resize(info.certs.size());
- for(unsigned int i = 0; i < info.certs.size(); ++i)
- {
- sslinfo.certs[i] = info.certs[i]->encode();
- }
- userDN = info.certs[0]->getSubjectDN();
- }
-
- if(_properties->getPropertyAsInt("Glacier2.AddSSLContext") > 0)
- {
- sslCtx["SSL.Active"] = "1";
- sslCtx["SSL.Cipher"] = sslinfo.cipher;
- ostringstream os;
- os << sslinfo.remotePort;
- sslCtx["SSL.Remote.Port"] = os.str();
- sslCtx["SSL.Remote.Host"] = sslinfo.remoteHost;
- os.str("");
- os << ntohs(info.localAddr.sin_port);
- sslCtx["SSL.Local.Port"] = os.str();
- sslCtx["SSL.Local.Host"] = sslinfo.localHost;
- if(info.certs.size() > 0)
- {
- sslCtx["SSL.PeerCert"] = info.certs[0]->encode();
- }
- }
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(current.con);
+ sslinfo.remotePort = ntohs(info.remoteAddr.sin_port);
+ sslinfo.remoteHost = IceInternal::inetAddrToString(info.remoteAddr.sin_addr);
+ sslinfo.localPort = ntohs(info.localAddr.sin_port);
+ sslinfo.localHost = IceInternal::inetAddrToString(info.localAddr.sin_addr);
+
+ sslinfo.cipher = info.cipher;
+
+ if(info.certs.size() > 0)
+ {
+ sslinfo.certs.resize(info.certs.size());
+ for(unsigned int i = 0; i < info.certs.size(); ++i)
+ {
+ sslinfo.certs[i] = info.certs[i]->encode();
+ }
+ userDN = info.certs[0]->getSubjectDN();
+ }
+
+ if(_properties->getPropertyAsInt("Glacier2.AddSSLContext") > 0)
+ {
+ sslCtx["SSL.Active"] = "1";
+ sslCtx["SSL.Cipher"] = sslinfo.cipher;
+ ostringstream os;
+ os << sslinfo.remotePort;
+ sslCtx["SSL.Remote.Port"] = os.str();
+ sslCtx["SSL.Remote.Host"] = sslinfo.remoteHost;
+ os.str("");
+ os << ntohs(info.localAddr.sin_port);
+ sslCtx["SSL.Local.Port"] = os.str();
+ sslCtx["SSL.Local.Host"] = sslinfo.localHost;
+ if(info.certs.size() > 0)
+ {
+ sslCtx["SSL.PeerCert"] = info.certs[0]->encode();
+ }
+ }
}
catch(const IceSSL::ConnectionInvalidException&)
{
- PermissionDeniedException exc;
- exc.reason = "not ssl connection";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "not ssl connection";
+ throw exc;
}
catch(const IceSSL::CertificateEncodingException&)
{
- PermissionDeniedException exc;
- exc.reason = "certificate encoding exception";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "certificate encoding exception";
+ throw exc;
}
SessionFactoryPtr factory;
if(_sslSessionManager)
{
- factory = new SSLSessionFactory(_sslSessionManager, sslinfo);
+ factory = new SSLSessionFactory(_sslSessionManager, sslinfo);
}
return createSessionInternal(userDN, false, new SSLPasswordAuthorizer(_sslVerifier, sslinfo), factory, sslCtx,
- current);
+ current);
}
void
@@ -489,43 +489,43 @@ Glacier2::SessionRouterI::destroySession(const ConnectionPtr& connection)
RouterIPtr router;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- if(_destroy)
- {
- connection->close(true);
- throw ObjectNotExistException(__FILE__, __LINE__);
- }
-
- map<ConnectionPtr, RouterIPtr>::iterator p;
-
- if(_routersByConnectionHint != _routersByConnection.end() && _routersByConnectionHint->first == connection)
- {
- p = _routersByConnectionHint;
- }
- else
- {
- p = _routersByConnection.find(connection);
- }
-
- if(p == _routersByConnection.end())
- {
- SessionNotExistException exc;
- throw exc;
- }
-
- router = p->second;
-
- _routersByConnection.erase(p++);
- _routersByConnectionHint = p;
-
- if(_serverAdapter)
- {
- string category = router->getServerProxy(Current())->ice_getIdentity().category;
- assert(!category.empty());
- _routersByCategory.erase(category);
- _routersByCategoryHint = _routersByCategory.end();
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ if(_destroy)
+ {
+ connection->close(true);
+ throw ObjectNotExistException(__FILE__, __LINE__);
+ }
+
+ map<ConnectionPtr, RouterIPtr>::iterator p;
+
+ if(_routersByConnectionHint != _routersByConnection.end() && _routersByConnectionHint->first == connection)
+ {
+ p = _routersByConnectionHint;
+ }
+ else
+ {
+ p = _routersByConnection.find(connection);
+ }
+
+ if(p == _routersByConnection.end())
+ {
+ SessionNotExistException exc;
+ throw exc;
+ }
+
+ router = p->second;
+
+ _routersByConnection.erase(p++);
+ _routersByConnectionHint = p;
+
+ if(_serverAdapter)
+ {
+ string category = router->getServerProxy(Current())->ice_getIdentity().category;
+ assert(!category.empty());
+ _routersByCategory.erase(category);
+ _routersByCategoryHint = _routersByCategory.end();
+ }
}
//
@@ -534,22 +534,22 @@ Glacier2::SessionRouterI::destroySession(const ConnectionPtr& connection)
//
try
{
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "destroying session\n";
- out << router->toString();
- }
-
- router->destroy();
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "destroying session\n";
+ out << router->toString();
+ }
+
+ router->destroy();
}
catch(const Exception& ex)
{
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "exception while destroying session\n" << ex;
- }
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "exception while destroying session\n" << ex;
+ }
}
}
@@ -566,34 +566,34 @@ Glacier2::SessionRouterI::getRouter(const ConnectionPtr& connection, const Ice::
if(_destroy)
{
- connection->close(true);
- throw ObjectNotExistException(__FILE__, __LINE__);
+ connection->close(true);
+ throw ObjectNotExistException(__FILE__, __LINE__);
}
map<ConnectionPtr, RouterIPtr>& routers = const_cast<map<ConnectionPtr, RouterIPtr>&>(_routersByConnection);
if(_routersByConnectionHint != routers.end() && _routersByConnectionHint->first == connection)
{
- return _routersByConnectionHint->second;
+ return _routersByConnectionHint->second;
}
map<ConnectionPtr, RouterIPtr>::iterator p = routers.find(connection);
if(p != routers.end())
{
- _routersByConnectionHint = p;
- return p->second;
+ _routersByConnectionHint = p;
+ return p->second;
}
else
{
- if(_rejectTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "rejecting request. no session is associated with the connection.\n";
- out << "identity: " << _clientAdapter->getCommunicator()->identityToString(id);
- }
- connection->close(true);
- throw ObjectNotExistException(__FILE__, __LINE__);
+ if(_rejectTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "rejecting request. no session is associated with the connection.\n";
+ out << "identity: " << _clientAdapter->getCommunicator()->identityToString(id);
+ }
+ connection->close(true);
+ throw ObjectNotExistException(__FILE__, __LINE__);
}
}
@@ -604,26 +604,26 @@ Glacier2::SessionRouterI::getRouter(const string& category) const
if(_destroy)
{
- throw ObjectNotExistException(__FILE__, __LINE__);
+ throw ObjectNotExistException(__FILE__, __LINE__);
}
map<string, RouterIPtr>& routers = const_cast<map<string, RouterIPtr>&>(_routersByCategory);
if(_routersByCategoryHint != routers.end() && _routersByCategoryHint->first == category)
{
- return _routersByCategoryHint->second;
+ return _routersByCategoryHint->second;
}
map<string, RouterIPtr>::iterator p = routers.find(category);
if(p != routers.end())
{
- _routersByCategoryHint = p;
- return p->second;
+ _routersByCategoryHint = p;
+ return p->second;
}
else
{
- throw ObjectNotExistException(__FILE__, __LINE__);
+ throw ObjectNotExistException(__FILE__, __LINE__);
}
}
@@ -633,41 +633,41 @@ Glacier2::SessionRouterI::expireSessions()
vector<RouterIPtr> routers;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- if(_destroy)
- {
- return;
- }
-
- assert(_sessionTimeout > IceUtil::Time());
- IceUtil::Time minTimestamp = IceUtil::Time::now() - _sessionTimeout;
-
- map<ConnectionPtr, RouterIPtr>::iterator p = _routersByConnection.begin();
-
- while(p != _routersByConnection.end())
- {
- if(p->second->getTimestamp() < minTimestamp)
- {
- RouterIPtr router = p->second;
- routers.push_back(router);
-
- _routersByConnection.erase(p++);
- _routersByConnectionHint = p;
-
- if(_serverAdapter)
- {
- string category = router->getServerProxy(Current())->ice_getIdentity().category;
- assert(!category.empty());
- _routersByCategory.erase(category);
- _routersByCategoryHint = _routersByCategory.end();
- }
- }
- else
- {
- ++p;
- }
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ if(_destroy)
+ {
+ return;
+ }
+
+ assert(_sessionTimeout > IceUtil::Time());
+ IceUtil::Time minTimestamp = IceUtil::Time::now() - _sessionTimeout;
+
+ map<ConnectionPtr, RouterIPtr>::iterator p = _routersByConnection.begin();
+
+ while(p != _routersByConnection.end())
+ {
+ if(p->second->getTimestamp() < minTimestamp)
+ {
+ RouterIPtr router = p->second;
+ routers.push_back(router);
+
+ _routersByConnection.erase(p++);
+ _routersByConnectionHint = p;
+
+ if(_serverAdapter)
+ {
+ string category = router->getServerProxy(Current())->ice_getIdentity().category;
+ assert(!category.empty());
+ _routersByCategory.erase(category);
+ _routersByCategoryHint = _routersByCategory.end();
+ }
+ }
+ else
+ {
+ ++p;
+ }
+ }
}
//
@@ -676,169 +676,169 @@ Glacier2::SessionRouterI::expireSessions()
//
for(vector<RouterIPtr>::iterator p = routers.begin(); p != routers.end(); ++p)
{
- RouterIPtr router = *p;
-
- try
- {
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "expiring session\n";
- out << router->toString();
- }
-
- router->destroy();
- }
- catch(const Exception& ex)
- {
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "exception while expiring session\n" << ex;
- }
- }
+ RouterIPtr router = *p;
+
+ try
+ {
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "expiring session\n";
+ out << router->toString();
+ }
+
+ router->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "exception while expiring session\n" << ex;
+ }
+ }
}
}
SessionPrx
Glacier2::SessionRouterI::createSessionInternal(const string& userId, bool allowAddUserMode,
- const AuthorizerPtr& authorizer, const SessionFactoryPtr& factory,
- const Ice::Context& sslContext, const Current& current)
+ const AuthorizerPtr& authorizer, const SessionFactoryPtr& factory,
+ const Ice::Context& sslContext, const Current& current)
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- if(_destroy)
- {
- current.con->close(true);
- throw ObjectNotExistException(__FILE__, __LINE__);
- }
-
- //
- // Check whether a session already exists for the connection.
- //
- {
- map<ConnectionPtr, RouterIPtr>::iterator p;
- if(_routersByConnectionHint != _routersByConnection.end() &&
- _routersByConnectionHint->first == current.con)
- {
- p = _routersByConnectionHint;
- }
- else
- {
- p = _routersByConnection.find(current.con);
- }
-
- if(p != _routersByConnection.end())
- {
- CannotCreateSessionException exc;
- exc.reason = "session exists";
- throw exc;
- }
- }
-
- //
- // If some other thread is currently trying to create a
- // session, we wait until this thread is finished.
- //
- bool searchAgain = false;
- while(_pending.find(current.con) != _pending.end())
- {
- wait();
-
- if(_destroy)
- {
- current.con->close(true);
- throw ObjectNotExistException(__FILE__, __LINE__);
- }
-
- searchAgain = true;
- }
-
- //
- // Check for existing sessions again if we waited above, as
- // new sessions have been added in the meantime.
- //
- if(searchAgain)
- {
- map<ConnectionPtr, RouterIPtr>::iterator p;
- if(_routersByConnectionHint != _routersByConnection.end() &&
- _routersByConnectionHint->first == current.con)
- {
- p = _routersByConnectionHint;
- }
- else
- {
- p = _routersByConnection.find(current.con);
- }
-
- if(p != _routersByConnection.end())
- {
- CannotCreateSessionException exc;
- exc.reason = "session exists";
- throw exc;
- }
- }
-
- //
- // No session exists yet, so we will try to create one. To
- // avoid that other threads try to create sessions for the
- // same connection, we add our endpoints to _pending.
- //
- _pending.insert(current.con);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ if(_destroy)
+ {
+ current.con->close(true);
+ throw ObjectNotExistException(__FILE__, __LINE__);
+ }
+
+ //
+ // Check whether a session already exists for the connection.
+ //
+ {
+ map<ConnectionPtr, RouterIPtr>::iterator p;
+ if(_routersByConnectionHint != _routersByConnection.end() &&
+ _routersByConnectionHint->first == current.con)
+ {
+ p = _routersByConnectionHint;
+ }
+ else
+ {
+ p = _routersByConnection.find(current.con);
+ }
+
+ if(p != _routersByConnection.end())
+ {
+ CannotCreateSessionException exc;
+ exc.reason = "session exists";
+ throw exc;
+ }
+ }
+
+ //
+ // If some other thread is currently trying to create a
+ // session, we wait until this thread is finished.
+ //
+ bool searchAgain = false;
+ while(_pending.find(current.con) != _pending.end())
+ {
+ wait();
+
+ if(_destroy)
+ {
+ current.con->close(true);
+ throw ObjectNotExistException(__FILE__, __LINE__);
+ }
+
+ searchAgain = true;
+ }
+
+ //
+ // Check for existing sessions again if we waited above, as
+ // new sessions have been added in the meantime.
+ //
+ if(searchAgain)
+ {
+ map<ConnectionPtr, RouterIPtr>::iterator p;
+ if(_routersByConnectionHint != _routersByConnection.end() &&
+ _routersByConnectionHint->first == current.con)
+ {
+ p = _routersByConnectionHint;
+ }
+ else
+ {
+ p = _routersByConnection.find(current.con);
+ }
+
+ if(p != _routersByConnection.end())
+ {
+ CannotCreateSessionException exc;
+ exc.reason = "session exists";
+ throw exc;
+ }
+ }
+
+ //
+ // No session exists yet, so we will try to create one. To
+ // avoid that other threads try to create sessions for the
+ // same connection, we add our endpoints to _pending.
+ //
+ _pending.insert(current.con);
}
try
{
- //
- // Authorize.
- //
- string reason;
- bool ok;
-
- try
- {
- ok = authorizer->authorize(reason, current.ctx);
- }
- catch(const Exception& ex)
- {
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "exception while verifying password:\n" << ex;
- }
-
- PermissionDeniedException exc;
- exc.reason = "internal server error";
- throw exc;
- }
-
- if(!ok)
- {
- PermissionDeniedException exc;
- if(reason.empty())
- {
- exc.reason = "permission denied";
- }
- else
- {
- exc.reason = reason;
- }
- throw exc;
- }
+ //
+ // Authorize.
+ //
+ string reason;
+ bool ok;
+
+ try
+ {
+ ok = authorizer->authorize(reason, current.ctx);
+ }
+ catch(const Exception& ex)
+ {
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "exception while verifying password:\n" << ex;
+ }
+
+ PermissionDeniedException exc;
+ exc.reason = "internal server error";
+ throw exc;
+ }
+
+ if(!ok)
+ {
+ PermissionDeniedException exc;
+ if(reason.empty())
+ {
+ exc.reason = "permission denied";
+ }
+ else
+ {
+ exc.reason = reason;
+ }
+ throw exc;
+ }
}
catch(const Exception& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
- //
- // Signal other threads that we are done with trying to
- // establish a session for our connection;
- //
- _pending.erase(current.con);
- notify();
+ //
+ // Signal other threads that we are done with trying to
+ // establish a session for our connection;
+ //
+ _pending.erase(current.con);
+ notify();
- ex.ice_throw();
+ ex.ice_throw();
}
@@ -848,151 +848,151 @@ Glacier2::SessionRouterI::createSessionInternal(const string& userId, bool allow
try
{
- //
- // The client blobject requires direct access to the full filter
- // servant, but proliferating the implementation of the servant
- // throughout the router code is undesirable. To avoid lots of
- // physical interdependencies, we create the filters and
- // clientblobject together and pass the clientblobject to the
- // router. We create the clientblobject here since it is
- // responsible for creating the filters and we want them to be
- // accessible during session creation.
- //
- FilterManagerPtr filterManager = FilterManager::create(_clientAdapter->getCommunicator(), _serverAdapter,
- userId, allowAddUserMode);
+ //
+ // The client blobject requires direct access to the full filter
+ // servant, but proliferating the implementation of the servant
+ // throughout the router code is undesirable. To avoid lots of
+ // physical interdependencies, we create the filters and
+ // clientblobject together and pass the clientblobject to the
+ // router. We create the clientblobject here since it is
+ // responsible for creating the filters and we want them to be
+ // accessible during session creation.
+ //
+ FilterManagerPtr filterManager = FilterManager::create(_clientAdapter->getCommunicator(), _serverAdapter,
+ userId, allowAddUserMode);
//
- // If we have a session manager configured, we create a
- // client-visible session object.
- //
- if(factory)
- {
- SessionControlPrx control;
- if(_serverAdapter)
- {
- control = SessionControlPrx::uncheckedCast(
- _serverAdapter->addWithUUID(
- new SessionControlI(this, current.con, filterManager, _sessionTimeout)));
- controlId = control->ice_getIdentity();
- }
- session = factory->create(control, current.ctx);
- }
+ // If we have a session manager configured, we create a
+ // client-visible session object.
+ //
+ if(factory)
+ {
+ SessionControlPrx control;
+ if(_serverAdapter)
+ {
+ control = SessionControlPrx::uncheckedCast(
+ _serverAdapter->addWithUUID(
+ new SessionControlI(this, current.con, filterManager, _sessionTimeout)));
+ controlId = control->ice_getIdentity();
+ }
+ session = factory->create(control, current.ctx);
+ }
- //
- // Add a new per-client router.
- //
- router = new RouterI(_clientAdapter, _serverAdapter, current.con, userId,
- session, controlId, filterManager, sslContext);
+ //
+ // Add a new per-client router.
+ //
+ router = new RouterI(_clientAdapter, _serverAdapter, current.con, userId,
+ session, controlId, filterManager, sslContext);
}
catch(const Exception& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- //
- // Signal other threads that we are done with trying to
- // establish a session for our connection;
- //
- _pending.erase(current.con);
- notify();
-
- assert(!router);
-
- if(session)
- {
- if(_serverAdapter)
- {
- try
- {
- _serverAdapter->remove(controlId);
- }
- catch(const Exception&)
- {
- // Ignore all exceptions here.
- }
- }
- try
- {
- session->destroy();
- }
- catch(const Exception&)
- {
- // Ignore all exceptions here.
- }
- }
-
- try
- {
- ex.ice_throw();
- }
- catch(const Glacier2::CannotCreateSessionException&)
- {
- throw;
- }
- catch(const Exception&)
- {
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "exception while creating session with session manager:\n" << ex;
- }
-
- CannotCreateSessionException exc;
- exc.reason = "internal server error";
- throw exc;
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ //
+ // Signal other threads that we are done with trying to
+ // establish a session for our connection;
+ //
+ _pending.erase(current.con);
+ notify();
+
+ assert(!router);
+
+ if(session)
+ {
+ if(_serverAdapter)
+ {
+ try
+ {
+ _serverAdapter->remove(controlId);
+ }
+ catch(const Exception&)
+ {
+ // Ignore all exceptions here.
+ }
+ }
+ try
+ {
+ session->destroy();
+ }
+ catch(const Exception&)
+ {
+ // Ignore all exceptions here.
+ }
+ }
+
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ throw;
+ }
+ catch(const Exception&)
+ {
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "exception while creating session with session manager:\n" << ex;
+ }
+
+ CannotCreateSessionException exc;
+ exc.reason = "internal server error";
+ throw exc;
+ }
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
- //
- // Signal other threads that we are done with trying to
- // establish a session for our connection;
- //
- _pending.erase(current.con);
- notify();
-
- if(_destroy)
- {
- try
- {
- router->destroy();
- }
- catch(const Exception&)
- {
- // Ignore all exceptions here.
- }
-
- current.con->close(true);
- throw ObjectNotExistException(__FILE__, __LINE__);
- }
-
- _routersByConnectionHint = _routersByConnection.insert(
- _routersByConnectionHint, pair<const ConnectionPtr, RouterIPtr>(current.con, router));
-
- if(_serverAdapter)
- {
- string category = router->getServerProxy(current)->ice_getIdentity().category;
- assert(!category.empty());
- pair<map<string, RouterIPtr>::iterator, bool> rc =
- _routersByCategory.insert(pair<const string, RouterIPtr>(category, router));
- assert(rc.second);
- _routersByCategoryHint = rc.first;
- }
-
- if(_sessionTraceLevel >= 1)
- {
- Trace out(_logger, "Glacier2");
- out << "created session\n";
- out << router->toString();
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+
+ //
+ // Signal other threads that we are done with trying to
+ // establish a session for our connection;
+ //
+ _pending.erase(current.con);
+ notify();
+
+ if(_destroy)
+ {
+ try
+ {
+ router->destroy();
+ }
+ catch(const Exception&)
+ {
+ // Ignore all exceptions here.
+ }
+
+ current.con->close(true);
+ throw ObjectNotExistException(__FILE__, __LINE__);
+ }
+
+ _routersByConnectionHint = _routersByConnection.insert(
+ _routersByConnectionHint, pair<const ConnectionPtr, RouterIPtr>(current.con, router));
+
+ if(_serverAdapter)
+ {
+ string category = router->getServerProxy(current)->ice_getIdentity().category;
+ assert(!category.empty());
+ pair<map<string, RouterIPtr>::iterator, bool> rc =
+ _routersByCategory.insert(pair<const string, RouterIPtr>(category, router));
+ assert(rc.second);
+ _routersByCategoryHint = rc.first;
+ }
+
+ if(_sessionTraceLevel >= 1)
+ {
+ Trace out(_logger, "Glacier2");
+ out << "created session\n";
+ out << router->toString();
+ }
}
-
+
return session;
}
Glacier2::SessionRouterI::SessionThread::SessionThread(const SessionRouterIPtr& sessionRouter,
- const IceUtil::Time& sessionTimeout) :
+ const IceUtil::Time& sessionTimeout) :
_sessionRouter(sessionRouter),
_sessionTimeout(sessionTimeout)
{
@@ -1016,27 +1016,27 @@ Glacier2::SessionRouterI::SessionThread::run()
{
while(true)
{
- SessionRouterIPtr sessionRouter;
+ SessionRouterIPtr sessionRouter;
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
- if(!_sessionRouter)
- {
- return;
- }
-
- assert(_sessionTimeout > IceUtil::Time());
- timedWait(_sessionTimeout / 4);
+ if(!_sessionRouter)
+ {
+ return;
+ }
+
+ assert(_sessionTimeout > IceUtil::Time());
+ timedWait(_sessionTimeout / 4);
- if(!_sessionRouter)
- {
- return;
- }
+ if(!_sessionRouter)
+ {
+ return;
+ }
- sessionRouter = _sessionRouter;
- }
+ sessionRouter = _sessionRouter;
+ }
- sessionRouter->expireSessions();
+ sessionRouter->expireSessions();
}
}
diff --git a/cpp/src/Glacier2/SessionRouterI.h b/cpp/src/Glacier2/SessionRouterI.h
index 7fc7a5c2f60..9be3f25e2b0 100644
--- a/cpp/src/Glacier2/SessionRouterI.h
+++ b/cpp/src/Glacier2/SessionRouterI.h
@@ -48,8 +48,8 @@ class SessionRouterI : public Router, public IceUtil::Monitor<IceUtil::Mutex>
public:
SessionRouterI(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&,
- const PermissionsVerifierPrx&, const SessionManagerPrx&,
- const SSLPermissionsVerifierPrx&, const SSLSessionManagerPrx&);
+ const PermissionsVerifierPrx&, const SessionManagerPrx&,
+ const SSLPermissionsVerifierPrx&, const SSLSessionManagerPrx&);
virtual ~SessionRouterI();
void destroy();
@@ -73,7 +73,7 @@ public:
private:
SessionPrx createSessionInternal(const std::string&, bool, const AuthorizerPtr&, const SessionFactoryPtr&,
- const Ice::Context&, const Ice::Current&);
+ const Ice::Context&, const Ice::Current&);
const Ice::PropertiesPtr _properties;
const Ice::LoggerPtr _logger;
@@ -91,16 +91,16 @@ private:
{
public:
- SessionThread(const SessionRouterIPtr&, const IceUtil::Time&);
- virtual ~SessionThread();
- void destroy();
+ SessionThread(const SessionRouterIPtr&, const IceUtil::Time&);
+ virtual ~SessionThread();
+ void destroy();
- virtual void run();
+ virtual void run();
private:
- SessionRouterIPtr _sessionRouter;
- const IceUtil::Time _sessionTimeout;
+ SessionRouterIPtr _sessionRouter;
+ const IceUtil::Time _sessionTimeout;
};
typedef IceUtil::Handle<SessionThread> SessionThreadPtr;
SessionThreadPtr _sessionThread;
diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp
index ae9a1ea7c4e..adcd5ddfb69 100644
--- a/cpp/src/Ice/Application.cpp
+++ b/cpp/src/Ice/Application.cpp
@@ -68,26 +68,26 @@ holdInterruptCallback(int signal)
{
CtrlCHandlerCallback callback = 0;
{
- StaticMutex::Lock lock(_mutex);
- while(!_released)
- {
- _condVar->wait(lock);
- }
-
- if(_destroyed)
- {
- //
- // Being destroyed by main thread
- //
- return;
- }
- assert(_ctrlCHandler != 0);
- callback = _ctrlCHandler->getCallback();
+ StaticMutex::Lock lock(_mutex);
+ while(!_released)
+ {
+ _condVar->wait(lock);
+ }
+
+ if(_destroyed)
+ {
+ //
+ // Being destroyed by main thread
+ //
+ return;
+ }
+ assert(_ctrlCHandler != 0);
+ callback = _ctrlCHandler->getCallback();
}
if(callback != 0)
{
- callback(signal);
+ callback(signal);
}
}
@@ -95,60 +95,60 @@ static void
destroyOnInterruptCallback(int signal)
{
{
- StaticMutex::Lock lock(_mutex);
- if(_destroyed)
- {
- //
- // Being destroyed by main thread
- //
- return;
- }
- if(_nohup && signal == SIGHUP)
- {
- return;
- }
-
- assert(!_callbackInProgress);
- _callbackInProgress = true;
- _interrupted = true;
- _destroyed = true;
- }
-
+ StaticMutex::Lock lock(_mutex);
+ if(_destroyed)
+ {
+ //
+ // Being destroyed by main thread
+ //
+ return;
+ }
+ if(_nohup && signal == SIGHUP)
+ {
+ return;
+ }
+
+ assert(!_callbackInProgress);
+ _callbackInProgress = true;
+ _interrupted = true;
+ _destroyed = true;
+ }
+
assert(_communicator != 0);
try
{
- _communicator->destroy();
+ _communicator->destroy();
}
catch(const IceUtil::Exception& ex)
{
- cerr << _appName << " (while destroying in response to signal " << signal
- << "): " << ex << endl;
+ cerr << _appName << " (while destroying in response to signal " << signal
+ << "): " << ex << endl;
}
catch(const std::exception& ex)
{
- cerr << _appName << " (while destroying in response to signal " << signal
- << "): std::exception: " << ex.what() << endl;
+ cerr << _appName << " (while destroying in response to signal " << signal
+ << "): std::exception: " << ex.what() << endl;
}
catch(const std::string& msg)
{
- cerr << _appName << " (while destroying in response to signal " << signal
- << "): " << msg << endl;
+ cerr << _appName << " (while destroying in response to signal " << signal
+ << "): " << msg << endl;
}
catch(const char * msg)
{
- cerr << _appName << " (while destroying in response to signal " << signal
- << "): " << msg << endl;
+ cerr << _appName << " (while destroying in response to signal " << signal
+ << "): " << msg << endl;
}
catch(...)
{
- cerr << _appName << " (while destroying in response to signal " << signal
- << "): unknown exception" << endl;
+ cerr << _appName << " (while destroying in response to signal " << signal
+ << "): unknown exception" << endl;
}
{
- StaticMutex::Lock lock(_mutex);
- _callbackInProgress = false;
+ StaticMutex::Lock lock(_mutex);
+ _callbackInProgress = false;
}
_condVar->signal();
}
@@ -158,57 +158,57 @@ static void
shutdownOnInterruptCallback(int signal)
{
{
- StaticMutex::Lock lock(_mutex);
- if(_destroyed)
- {
- //
- // Being destroyed by main thread
- //
- return;
- }
- if(_nohup && signal == SIGHUP)
- {
- return;
- }
- assert(!_callbackInProgress);
- _callbackInProgress = true;
- _interrupted = true;
+ StaticMutex::Lock lock(_mutex);
+ if(_destroyed)
+ {
+ //
+ // Being destroyed by main thread
+ //
+ return;
+ }
+ if(_nohup && signal == SIGHUP)
+ {
+ return;
+ }
+ assert(!_callbackInProgress);
+ _callbackInProgress = true;
+ _interrupted = true;
}
assert(_communicator != 0);
try
{
- _communicator->shutdown();
+ _communicator->shutdown();
}
catch(const IceUtil::Exception& ex)
{
- cerr << _appName << " (while shutting down in response to signal " << signal
- << "): " << ex << endl;
+ cerr << _appName << " (while shutting down in response to signal " << signal
+ << "): " << ex << endl;
}
catch(const std::exception& ex)
{
- cerr << _appName << " (while shutting down in response to signal " << signal
- << "): std::exception: " << ex.what() << endl;
+ cerr << _appName << " (while shutting down in response to signal " << signal
+ << "): std::exception: " << ex.what() << endl;
}
catch(const std::string& msg)
{
- cerr << _appName << " (while shutting down in response to signal " << signal
- << "): " << msg << endl;
+ cerr << _appName << " (while shutting down in response to signal " << signal
+ << "): " << msg << endl;
}
catch(const char * msg)
{
- cerr << _appName << " (while shutting down in response to signal " << signal
- << "): " << msg << endl;
+ cerr << _appName << " (while shutting down in response to signal " << signal
+ << "): " << msg << endl;
}
catch(...)
{
- cerr << _appName << " (while shutting down in response to signal " << signal
- << "): unknown exception" << endl;
+ cerr << _appName << " (while shutting down in response to signal " << signal
+ << "): unknown exception" << endl;
}
{
- StaticMutex::Lock lock(_mutex);
- _callbackInProgress = false;
+ StaticMutex::Lock lock(_mutex);
+ _callbackInProgress = false;
}
_condVar->signal();
}
@@ -217,55 +217,55 @@ static void
callbackOnInterruptCallback(int signal)
{
{
- StaticMutex::Lock lock(_mutex);
- if(_destroyed)
- {
- //
- // Being destroyed by main thread
- //
- return;
- }
- // For SIGHUP the user callback is always called. It can
- // decide what to do.
- assert(!_callbackInProgress);
- _callbackInProgress = true;
- _interrupted = true;
+ StaticMutex::Lock lock(_mutex);
+ if(_destroyed)
+ {
+ //
+ // Being destroyed by main thread
+ //
+ return;
+ }
+ // For SIGHUP the user callback is always called. It can
+ // decide what to do.
+ assert(!_callbackInProgress);
+ _callbackInProgress = true;
+ _interrupted = true;
}
assert(_application != 0);
try
{
- _application->interruptCallback(signal);
+ _application->interruptCallback(signal);
}
catch(const IceUtil::Exception& ex)
{
- cerr << _appName << " (while interrupting in response to signal " << signal
- << "): " << ex << endl;
+ cerr << _appName << " (while interrupting in response to signal " << signal
+ << "): " << ex << endl;
}
catch(const std::exception& ex)
{
- cerr << _appName << " (while interrupting in response to signal " << signal
- << "): std::exception: " << ex.what() << endl;
+ cerr << _appName << " (while interrupting in response to signal " << signal
+ << "): std::exception: " << ex.what() << endl;
}
catch(const std::string& msg)
{
- cerr << _appName << " (while interrupting in response to signal " << signal
- << "): " << msg << endl;
+ cerr << _appName << " (while interrupting in response to signal " << signal
+ << "): " << msg << endl;
}
catch(const char * msg)
{
- cerr << _appName << " (while interrupting in response to signal " << signal
- << "): " << msg << endl;
+ cerr << _appName << " (while interrupting in response to signal " << signal
+ << "): " << msg << endl;
}
catch(...)
{
- cerr << _appName << " (while interrupting in response to signal " << signal
- << "): unknown exception" << endl;
+ cerr << _appName << " (while interrupting in response to signal " << signal
+ << "): unknown exception" << endl;
}
{
- StaticMutex::Lock lock(_mutex);
- _callbackInProgress = false;
+ StaticMutex::Lock lock(_mutex);
+ _callbackInProgress = false;
}
_condVar->signal();
}
@@ -295,26 +295,26 @@ Ice::Application::main(int argc, char* argv[], const char* configFile)
InitializationData initData;
if(configFile)
{
- try
- {
- initData.properties = createProperties();
- initData.properties->load(configFile);
- }
- catch(const IceUtil::Exception& ex)
- {
- cerr << argv[0] << ": " << ex << endl;
- return EXIT_FAILURE;
- }
- catch(const std::exception& ex)
- {
- cerr << argv[0] << ": std::exception: " << ex.what() << endl;
- return EXIT_FAILURE;
- }
- catch(...)
- {
- cerr << argv[0] << ": unknown exception" << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ initData.properties = createProperties();
+ initData.properties->load(configFile);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ cerr << argv[0] << ": " << ex << endl;
+ return EXIT_FAILURE;
+ }
+ catch(const std::exception& ex)
+ {
+ cerr << argv[0] << ": std::exception: " << ex.what() << endl;
+ return EXIT_FAILURE;
+ }
+ catch(...)
+ {
+ cerr << argv[0] << ": unknown exception" << endl;
+ return EXIT_FAILURE;
+ }
}
return main(argc, argv, initData);
}
@@ -326,26 +326,26 @@ Ice::Application::main(int argc, char* argv[], const char* configFile, const Ice
InitializationData initData;
if(configFile)
{
- try
- {
- initData.properties = createProperties();
- initData.properties->load(configFile);
- }
- catch(const IceUtil::Exception& ex)
- {
- cerr << argv[0] << ": " << ex << endl;
- return EXIT_FAILURE;
- }
- catch(const std::exception& ex)
- {
- cerr << argv[0] << ": std::exception: " << ex.what() << endl;
- return EXIT_FAILURE;
- }
- catch(...)
- {
- cerr << argv[0] << ": unknown exception" << endl;
- return EXIT_FAILURE;
- }
+ try
+ {
+ initData.properties = createProperties();
+ initData.properties->load(configFile);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ cerr << argv[0] << ": " << ex << endl;
+ return EXIT_FAILURE;
+ }
+ catch(const std::exception& ex)
+ {
+ cerr << argv[0] << ": std::exception: " << ex.what() << endl;
+ return EXIT_FAILURE;
+ }
+ catch(...)
+ {
+ cerr << argv[0] << ": unknown exception" << endl;
+ return EXIT_FAILURE;
+ }
}
initData.logger = logger;
return main(argc, argv, initData);
@@ -356,133 +356,133 @@ Ice::Application::main(int argc, char* argv[], const InitializationData& initDat
{
if(_communicator != 0)
{
- cerr << argv[0] << ": only one instance of the Application class can be used" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": only one instance of the Application class can be used" << endl;
+ return EXIT_FAILURE;
}
int status;
try
{
- //
- // The ctrlCHandler must be created before starting any thread, in particular
- // before initializing the communicator.
- //
- CtrlCHandler ctrCHandler;
- _ctrlCHandler = &ctrCHandler;
-
- try
- {
- if(_condVar.get() == 0)
- {
- _condVar.reset(new Cond);
- }
-
- _interrupted = false;
- _appName = argv[0];
-
- _application = this;
- _communicator = initialize(argc, argv, initData);
- _destroyed = false;
-
- //
- // Used by destroyOnInterruptCallback and shutdownOnInterruptCallback.
- //
- _nohup = (_communicator->getProperties()->getPropertyAsInt("Ice.Nohup") > 0);
-
- //
- // The default is to destroy when a signal is received.
- //
- destroyOnInterrupt();
- status = run(argc, argv);
- }
- catch(const IceUtil::Exception& ex)
- {
- cerr << _appName << ": " << ex << endl;
- status = EXIT_FAILURE;
- }
- catch(const std::exception& ex)
- {
- cerr << _appName << ": std::exception: " << ex.what() << endl;
- status = EXIT_FAILURE;
- }
- catch(const std::string& msg)
- {
- cerr << _appName << ": " << msg << endl;
- status = EXIT_FAILURE;
- }
- catch(const char* msg)
- {
- cerr << _appName << ": " << msg << endl;
- status = EXIT_FAILURE;
- }
- catch(...)
- {
- cerr << _appName << ": unknown exception" << endl;
- status = EXIT_FAILURE;
- }
-
- //
- // Don't want any new interrupt and at this point (post-run),
- // it would not make sense to release a held signal to run
- // shutdown or destroy.
- //
- ignoreInterrupt();
-
- {
- StaticMutex::Lock lock(_mutex);
- while(_callbackInProgress)
- {
- _condVar->wait(lock);
- }
- if(_destroyed)
- {
- _communicator = 0;
- }
- else
- {
- _destroyed = true;
- //
- // And _communicator != 0, meaning will be destroyed
- // next, _destroyed = true also ensures that any
- // remaining callback won't do anything
- //
- }
- _application = 0;
- }
-
- if(_communicator != 0)
- {
- try
- {
- _communicator->destroy();
- }
- catch(const IceUtil::Exception& ex)
- {
- cerr << _appName << ": " << ex << endl;
- status = EXIT_FAILURE;
- }
- catch(const std::exception& ex)
- {
- cerr << _appName << ": std::exception: " << ex.what() << endl;
- status = EXIT_FAILURE;
- }
- catch(...)
- {
- cerr << _appName << ": unknown exception" << endl;
- status = EXIT_FAILURE;
- }
- _communicator = 0;
- }
-
- //
- // Set _ctrlCHandler to 0 only once communicator->destroy() has completed.
- //
- _ctrlCHandler = 0;
+ //
+ // The ctrlCHandler must be created before starting any thread, in particular
+ // before initializing the communicator.
+ //
+ CtrlCHandler ctrCHandler;
+ _ctrlCHandler = &ctrCHandler;
+
+ try
+ {
+ if(_condVar.get() == 0)
+ {
+ _condVar.reset(new Cond);
+ }
+
+ _interrupted = false;
+ _appName = argv[0];
+
+ _application = this;
+ _communicator = initialize(argc, argv, initData);
+ _destroyed = false;
+
+ //
+ // Used by destroyOnInterruptCallback and shutdownOnInterruptCallback.
+ //
+ _nohup = (_communicator->getProperties()->getPropertyAsInt("Ice.Nohup") > 0);
+
+ //
+ // The default is to destroy when a signal is received.
+ //
+ destroyOnInterrupt();
+ status = run(argc, argv);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ cerr << _appName << ": " << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(const std::exception& ex)
+ {
+ cerr << _appName << ": std::exception: " << ex.what() << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(const std::string& msg)
+ {
+ cerr << _appName << ": " << msg << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(const char* msg)
+ {
+ cerr << _appName << ": " << msg << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(...)
+ {
+ cerr << _appName << ": unknown exception" << endl;
+ status = EXIT_FAILURE;
+ }
+
+ //
+ // Don't want any new interrupt and at this point (post-run),
+ // it would not make sense to release a held signal to run
+ // shutdown or destroy.
+ //
+ ignoreInterrupt();
+
+ {
+ StaticMutex::Lock lock(_mutex);
+ while(_callbackInProgress)
+ {
+ _condVar->wait(lock);
+ }
+ if(_destroyed)
+ {
+ _communicator = 0;
+ }
+ else
+ {
+ _destroyed = true;
+ //
+ // And _communicator != 0, meaning will be destroyed
+ // next, _destroyed = true also ensures that any
+ // remaining callback won't do anything
+ //
+ }
+ _application = 0;
+ }
+
+ if(_communicator != 0)
+ {
+ try
+ {
+ _communicator->destroy();
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ cerr << _appName << ": " << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(const std::exception& ex)
+ {
+ cerr << _appName << ": std::exception: " << ex.what() << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(...)
+ {
+ cerr << _appName << ": unknown exception" << endl;
+ status = EXIT_FAILURE;
+ }
+ _communicator = 0;
+ }
+
+ //
+ // Set _ctrlCHandler to 0 only once communicator->destroy() has completed.
+ //
+ _ctrlCHandler = 0;
}
catch(const CtrlCHandlerException&)
{
- cerr << argv[0] << ": only one instance of the Application class can be used" << endl;
- status = EXIT_FAILURE;
+ cerr << argv[0] << ": only one instance of the Application class can be used" << endl;
+ status = EXIT_FAILURE;
}
return status;
@@ -513,13 +513,13 @@ Ice::Application::destroyOnInterrupt()
//
if(_ctrlCHandler != 0)
{
- StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
- if(_ctrlCHandler->getCallback() == holdInterruptCallback)
- {
- _released = true;
- _condVar->signal();
- }
- _ctrlCHandler->setCallback(destroyOnInterruptCallback);
+ StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
+ if(_ctrlCHandler->getCallback() == holdInterruptCallback)
+ {
+ _released = true;
+ _condVar->signal();
+ }
+ _ctrlCHandler->setCallback(destroyOnInterruptCallback);
}
}
@@ -528,13 +528,13 @@ Ice::Application::shutdownOnInterrupt()
{
if(_ctrlCHandler != 0)
{
- StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
- if(_ctrlCHandler->getCallback() == holdInterruptCallback)
- {
- _released = true;
- _condVar->signal();
- }
- _ctrlCHandler->setCallback(shutdownOnInterruptCallback);
+ StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
+ if(_ctrlCHandler->getCallback() == holdInterruptCallback)
+ {
+ _released = true;
+ _condVar->signal();
+ }
+ _ctrlCHandler->setCallback(shutdownOnInterruptCallback);
}
}
@@ -543,13 +543,13 @@ Ice::Application::ignoreInterrupt()
{
if(_ctrlCHandler != 0)
{
- StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
- if(_ctrlCHandler->getCallback() == holdInterruptCallback)
- {
- _released = true;
- _condVar->signal();
- }
- _ctrlCHandler->setCallback(0);
+ StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
+ if(_ctrlCHandler->getCallback() == holdInterruptCallback)
+ {
+ _released = true;
+ _condVar->signal();
+ }
+ _ctrlCHandler->setCallback(0);
}
}
@@ -558,13 +558,13 @@ Ice::Application::callbackOnInterrupt()
{
if(_ctrlCHandler != 0)
{
- StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
- if(_ctrlCHandler->getCallback() == holdInterruptCallback)
- {
- _released = true;
- _condVar->signal();
- }
- _ctrlCHandler->setCallback(callbackOnInterruptCallback);
+ StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
+ if(_ctrlCHandler->getCallback() == holdInterruptCallback)
+ {
+ _released = true;
+ _condVar->signal();
+ }
+ _ctrlCHandler->setCallback(callbackOnInterruptCallback);
}
}
@@ -573,14 +573,14 @@ Ice::Application::holdInterrupt()
{
if(_ctrlCHandler != 0)
{
- StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
- if(_ctrlCHandler->getCallback() != holdInterruptCallback)
- {
- _previousCallback = _ctrlCHandler->getCallback();
- _released = false;
- _ctrlCHandler->setCallback(holdInterruptCallback);
- }
- // else, we were already holding signals
+ StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
+ if(_ctrlCHandler->getCallback() != holdInterruptCallback)
+ {
+ _previousCallback = _ctrlCHandler->getCallback();
+ _released = false;
+ _ctrlCHandler->setCallback(holdInterruptCallback);
+ }
+ // else, we were already holding signals
}
}
@@ -589,21 +589,21 @@ Ice::Application::releaseInterrupt()
{
if(_ctrlCHandler != 0)
{
- StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
- if(_ctrlCHandler->getCallback() == holdInterruptCallback)
- {
- //
- // Note that it's very possible no signal is held;
- // in this case the callback is just replaced and
- // setting _released to true and signalling _condVar
- // do no harm.
- //
-
- _released = true;
- _ctrlCHandler->setCallback(_previousCallback);
- _condVar->signal();
- }
- // Else nothing to release.
+ StaticMutex::Lock lock(_mutex); // we serialize all the interrupt-setting
+ if(_ctrlCHandler->getCallback() == holdInterruptCallback)
+ {
+ //
+ // Note that it's very possible no signal is held;
+ // in this case the callback is just replaced and
+ // setting _released to true and signalling _condVar
+ // do no harm.
+ //
+
+ _released = true;
+ _ctrlCHandler->setCallback(_previousCallback);
+ _condVar->signal();
+ }
+ // Else nothing to release.
}
}
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index 67ea3e484a0..2e38c4c12df 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -51,23 +51,23 @@ IceInternal::BasicStream::clear()
{
while(_currentReadEncaps && _currentReadEncaps != &_preAllocatedReadEncaps)
{
- ReadEncaps* oldEncaps = _currentReadEncaps;
- _currentReadEncaps = _currentReadEncaps->previous;
- delete oldEncaps;
+ ReadEncaps* oldEncaps = _currentReadEncaps;
+ _currentReadEncaps = _currentReadEncaps->previous;
+ delete oldEncaps;
}
while(_currentWriteEncaps && _currentWriteEncaps != &_preAllocatedWriteEncaps)
{
- WriteEncaps* oldEncaps = _currentWriteEncaps;
- _currentWriteEncaps = _currentWriteEncaps->previous;
- delete oldEncaps;
+ WriteEncaps* oldEncaps = _currentWriteEncaps;
+ _currentWriteEncaps = _currentWriteEncaps->previous;
+ delete oldEncaps;
}
while(_seqDataStack)
{
- SeqData* oldSeqData = _seqDataStack;
- _seqDataStack = _seqDataStack->previous;
- delete oldSeqData;
+ SeqData* oldSeqData = _seqDataStack;
+ _seqDataStack = _seqDataStack->previous;
+ delete oldSeqData;
}
delete _objectList;
@@ -91,34 +91,34 @@ IceInternal::BasicStream::swap(BasicStream& other)
if(_currentReadEncaps || other._currentReadEncaps)
{
- _preAllocatedReadEncaps.swap(other._preAllocatedReadEncaps);
+ _preAllocatedReadEncaps.swap(other._preAllocatedReadEncaps);
- if(!_currentReadEncaps)
- {
- _currentReadEncaps = &_preAllocatedReadEncaps;
- other._currentReadEncaps = 0;
- }
- else if(!other._currentReadEncaps)
- {
- other._currentReadEncaps = &other._preAllocatedReadEncaps;
- _currentReadEncaps = 0;
- }
+ if(!_currentReadEncaps)
+ {
+ _currentReadEncaps = &_preAllocatedReadEncaps;
+ other._currentReadEncaps = 0;
+ }
+ else if(!other._currentReadEncaps)
+ {
+ other._currentReadEncaps = &other._preAllocatedReadEncaps;
+ _currentReadEncaps = 0;
+ }
}
if(_currentWriteEncaps || other._currentWriteEncaps)
{
- _preAllocatedWriteEncaps.swap(other._preAllocatedWriteEncaps);
+ _preAllocatedWriteEncaps.swap(other._preAllocatedWriteEncaps);
- if(!_currentWriteEncaps)
- {
- _currentWriteEncaps = &_preAllocatedWriteEncaps;
- other._currentWriteEncaps = 0;
- }
- else if(!other._currentWriteEncaps)
- {
- other._currentWriteEncaps = &other._preAllocatedWriteEncaps;
- _currentWriteEncaps = 0;
- }
+ if(!_currentWriteEncaps)
+ {
+ _currentWriteEncaps = &_preAllocatedWriteEncaps;
+ other._currentWriteEncaps = 0;
+ }
+ else if(!other._currentWriteEncaps)
+ {
+ other._currentWriteEncaps = &other._preAllocatedWriteEncaps;
+ _currentWriteEncaps = 0;
+ }
}
std::swap(_seqDataStack, other._seqDataStack);
@@ -179,7 +179,7 @@ IceInternal::BasicStream::startSeq(int numElements, int minSize)
{
if(numElements == 0) // Optimization to avoid pushing a useless stack frame.
{
- return;
+ return;
}
//
@@ -192,17 +192,17 @@ IceInternal::BasicStream::startSeq(int numElements, int minSize)
int bytesLeft = static_cast<int>(b.end() - i);
if(_seqDataStack->previous == 0) // Outermost sequence
{
- //
- // The sequence must fit within the message.
- //
- if(numElements * minSize > bytesLeft)
- {
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * minSize > bytesLeft)
+ {
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
}
else // Nested sequence
{
- checkSeq(bytesLeft);
+ checkSeq(bytesLeft);
}
}
@@ -212,17 +212,17 @@ IceInternal::BasicStream::checkFixedSeq(int numElements, int elemSize)
int bytesLeft = static_cast<int>(b.end() - i);
if(_seqDataStack == 0) // Outermost sequence
{
- //
- // The sequence must fit within the message.
- //
- if(numElements * elemSize > bytesLeft)
- {
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * elemSize > bytesLeft)
+ {
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
}
else // Nested sequence
{
- checkSeq(bytesLeft - numElements * elemSize);
+ checkSeq(bytesLeft - numElements * elemSize);
}
}
@@ -231,7 +231,7 @@ IceInternal::BasicStream::endSeq(int sz)
{
if(sz == 0) // Pop only if something was pushed previously.
{
- return;
+ return;
}
//
@@ -300,11 +300,11 @@ IceInternal::BasicStream::skipEncaps()
read(sz);
if(sz < 0)
{
- throw NegativeSizeException(__FILE__, __LINE__);
+ throw NegativeSizeException(__FILE__, __LINE__);
}
if(i - sizeof(Int) + sz > b.end())
{
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
i += sz - sizeof(Int);
}
@@ -343,7 +343,7 @@ IceInternal::BasicStream::startReadSlice()
read(sz);
if(sz < 0)
{
- throw NegativeSizeException(__FILE__, __LINE__);
+ throw NegativeSizeException(__FILE__, __LINE__);
}
_readSlice = i - b.begin();
}
@@ -360,12 +360,12 @@ IceInternal::BasicStream::skipSlice()
read(sz);
if(sz < 0)
{
- throw NegativeSizeException(__FILE__, __LINE__);
+ throw NegativeSizeException(__FILE__, __LINE__);
}
i += sz - sizeof(Int);
if(i > b.end())
{
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
}
@@ -375,14 +375,14 @@ IceInternal::BasicStream::writeTypeId(const string& id)
TypeIdWriteMap::const_iterator k = _currentWriteEncaps->typeIdMap->find(id);
if(k != _currentWriteEncaps->typeIdMap->end())
{
- write(true);
- writeSize(k->second);
+ write(true);
+ writeSize(k->second);
}
else
{
- _currentWriteEncaps->typeIdMap->insert(make_pair(id, ++_currentWriteEncaps->typeIdIndex));
- write(false);
- write(id, false);
+ _currentWriteEncaps->typeIdMap->insert(make_pair(id, ++_currentWriteEncaps->typeIdIndex));
+ write(false);
+ write(id, false);
}
}
@@ -393,19 +393,19 @@ IceInternal::BasicStream::readTypeId(string& id)
read(isIndex);
if(isIndex)
{
- Ice::Int index;
- readSize(index);
- TypeIdReadMap::const_iterator k = _currentReadEncaps->typeIdMap->find(index);
- if(k == _currentReadEncaps->typeIdMap->end())
- {
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- id = k->second;
+ Ice::Int index;
+ readSize(index);
+ TypeIdReadMap::const_iterator k = _currentReadEncaps->typeIdMap->find(index);
+ if(k == _currentReadEncaps->typeIdMap->end())
+ {
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ id = k->second;
}
else
{
- read(id, false);
- _currentReadEncaps->typeIdMap->insert(make_pair(++_currentReadEncaps->typeIdIndex, id));
+ read(id, false);
+ _currentReadEncaps->typeIdMap->insert(make_pair(++_currentReadEncaps->typeIdIndex, id));
}
}
@@ -414,9 +414,9 @@ IceInternal::BasicStream::writeBlob(const vector<Byte>& v)
{
if(!v.empty())
{
- Container::size_type pos = b.size();
- resize(pos + v.size());
- memcpy(&b[pos], &v[0], v.size());
+ Container::size_type pos = b.size();
+ resize(pos + v.size());
+ memcpy(&b[pos], &v[0], v.size());
}
}
@@ -425,16 +425,16 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
{
if(sz > 0)
{
- if(b.end() - i < sz)
- {
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- vector<Byte>(i, i + sz).swap(v);
- i += sz;
+ if(b.end() - i < sz)
+ {
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ vector<Byte>(i, i + sz).swap(v);
+ i += sz;
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -445,9 +445,9 @@ IceInternal::BasicStream::write(const Byte* begin, const Byte* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz);
- memcpy(&b[pos], begin, sz);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ memcpy(&b[pos], begin, sz);
}
}
@@ -476,9 +476,9 @@ IceInternal::BasicStream::write(const vector<bool>& v)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz);
- copy(v.begin(), v.end(), b.begin() + pos);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ copy(v.begin(), v.end(), b.begin() + pos);
}
}
@@ -517,7 +517,7 @@ IceInternal::BasicStream::write(const bool* begin, const bool* end)
{
Container::size_type pos = b.size();
resize(pos + sz);
- BasicStreamWriteBoolHelper<sizeof(bool)>::write(begin, pos, b, sz);
+ BasicStreamWriteBoolHelper<sizeof(bool)>::write(begin, pos, b, sz);
}
}
@@ -550,11 +550,11 @@ struct BasicStreamReadBoolHelper
bool* array = new bool[sz];
for(int idx = 0; idx < sz; ++idx)
{
- array[idx] = static_cast<bool>(*(i + idx));
+ array[idx] = static_cast<bool>(*(i + idx));
}
v.first = array;
v.second = array + sz;
- return array;
+ return array;
}
};
@@ -565,7 +565,7 @@ struct BasicStreamReadBoolHelper<1>
{
v.first = reinterpret_cast<bool*>(i);
v.second = reinterpret_cast<bool*>(i) + sz;
- return 0;
+ return 0;
}
};
@@ -580,7 +580,7 @@ IceInternal::BasicStream::read(pair<const bool*, const bool*>& v)
if(sz > 0)
{
checkFixedSeq(sz, 1);
- result = BasicStreamReadBoolHelper<sizeof(bool)>::read(v, sz, i);
+ result = BasicStreamReadBoolHelper<sizeof(bool)>::read(v, sz, i);
i += sz;
}
else
@@ -614,19 +614,19 @@ IceInternal::BasicStream::write(const Short* begin, const Short* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Short));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Short));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Short);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Short);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short));
#endif
}
}
@@ -636,7 +636,7 @@ IceInternal::BasicStream::read(Short& v)
{
if(b.end() - i < static_cast<int>(sizeof(Short)))
{
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Short);
@@ -658,26 +658,26 @@ IceInternal::BasicStream::read(vector<Short>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Short));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Short));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Short);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Short);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -689,35 +689,35 @@ IceInternal::BasicStream::read(pair<const Short*, const Short*>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
+ checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
#if defined(__i386) || defined(_M_IX86)
v.first = reinterpret_cast<Short*>(i);
- i += sz * static_cast<int>(sizeof(Short));
+ i += sz * static_cast<int>(sizeof(Short));
v.second = reinterpret_cast<Short*>(i);
#else
result = new Short[sz];
v.first = result;
v.second = result + sz;
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Short));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Short));
# ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Short) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Short);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Short) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Short);
+ }
# else
- copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
# endif
#endif
}
else
{
- v.first = v.second = 0;
+ v.first = v.second = 0;
}
return result;
}
@@ -729,21 +729,21 @@ IceInternal::BasicStream::write(const Int* begin, const Int* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Int));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Int));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Int);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Int);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int));
#endif
}
}
@@ -755,28 +755,28 @@ IceInternal::BasicStream::read(vector<Int>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Int));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Int));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Int);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Int);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -788,37 +788,37 @@ IceInternal::BasicStream::read(pair<const Int*, const Int*>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
+ checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
#if defined(__i386) || defined(_M_IX86)
v.first = reinterpret_cast<Int*>(i);
- i += sz * static_cast<int>(sizeof(Int));
+ i += sz * static_cast<int>(sizeof(Int));
v.second = reinterpret_cast<Int*>(i);
#else
result = new Int[sz];
v.first = result;
v.second = result + sz;
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Int));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Int));
# ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Int) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Int);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Int) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Int);
+ }
# else
- copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
# endif
#endif
}
else
{
- v.first = v.second = 0;
+ v.first = v.second = 0;
}
return result;
}
@@ -859,25 +859,25 @@ IceInternal::BasicStream::write(const Long* begin, const Long* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Long));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Long));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Long);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Long);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long));
#endif
}
}
@@ -887,7 +887,7 @@ IceInternal::BasicStream::read(Long& v)
{
if(b.end() - i < static_cast<int>(sizeof(Long)))
{
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Long);
@@ -921,32 +921,32 @@ IceInternal::BasicStream::read(vector<Long>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Long));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Long));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Long);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Long);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -958,41 +958,41 @@ IceInternal::BasicStream::read(pair<const Long*, const Long*>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
+ checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
#if defined(__i386) || defined(_M_IX86)
v.first = reinterpret_cast<Long*>(i);
- i += sz * static_cast<int>(sizeof(Long));
+ i += sz * static_cast<int>(sizeof(Long));
v.second = reinterpret_cast<Long*>(i);
#else
result = new Long[sz];
v.first = result;
v.second = result + sz;
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Long));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Long));
# ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Long) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Long);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Long) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Long);
+ }
# else
- copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
# endif
#endif
}
else
{
- v.first = v.second = 0;
+ v.first = v.second = 0;
}
return result;
}
@@ -1025,21 +1025,21 @@ IceInternal::BasicStream::write(const Float* begin, const Float* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Float));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Float));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Float);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Float);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float));
#endif
}
}
@@ -1049,7 +1049,7 @@ IceInternal::BasicStream::read(Float& v)
{
if(b.end() - i < static_cast<int>(sizeof(Float)))
{
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Float);
@@ -1075,28 +1075,28 @@ IceInternal::BasicStream::read(vector<Float>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Float));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Float));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Float);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Float);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1108,37 +1108,37 @@ IceInternal::BasicStream::read(pair<const Float*, const Float*>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
+ checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
#if defined(__i386) || defined(_M_IX86)
v.first = reinterpret_cast<Float*>(i);
- i += sz * static_cast<int>(sizeof(Float));
+ i += sz * static_cast<int>(sizeof(Float));
v.second = reinterpret_cast<Float*>(i);
#else
result = new Float[sz];
v.first = result;
v.second = result + sz;
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Float));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Float));
# ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Float) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Float);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Float) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Float);
+ }
# else
- copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
# endif
#endif
}
else
{
- v.first = v.second = 0;
+ v.first = v.second = 0;
}
return result;
}
@@ -1179,25 +1179,25 @@ IceInternal::BasicStream::write(const Double* begin, const Double* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Double));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Double));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Double);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Double);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double));
#endif
}
}
@@ -1207,7 +1207,7 @@ IceInternal::BasicStream::read(Double& v)
{
if(b.end() - i < static_cast<int>(sizeof(Double)))
{
- throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Double);
@@ -1241,32 +1241,32 @@ IceInternal::BasicStream::read(vector<Double>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Double));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Double));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Double);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Double);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1278,41 +1278,41 @@ IceInternal::BasicStream::read(pair<const Double*, const Double*>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
+ checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
#if defined(__i386) || defined(_M_IX86)
v.first = reinterpret_cast<Double*>(i);
- i += sz * static_cast<int>(sizeof(Double));
+ i += sz * static_cast<int>(sizeof(Double));
v.second = reinterpret_cast<Double*>(i);
#else
result = new Double[sz];
v.first = result;
v.second = result + sz;
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Double));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Double));
# ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Double) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Double);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&result[0]) + sizeof(Double) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Double);
+ }
# else
- copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&result[0]));
# endif
#endif
}
else
{
- v.first = v.second = 0;
+ v.first = v.second = 0;
}
return result;
}
@@ -1339,22 +1339,22 @@ IceInternal::BasicStream::writeConverted(const string& v)
// Impossible to tell, so we guess. If we don't guess correctly,
// we'll have to fix the mistake afterwards
//
-
+
Int guessedSize = static_cast<Int>(v.size());
writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
-
+
size_t firstIndex = b.size();
StreamUTF8BufferI buffer(*this);
-
+
Byte* lastByte = _stringConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
if(lastByte != b.end())
{
b.resize(lastByte - b.begin());
}
size_t lastIndex = b.size();
-
+
Int actualSize = static_cast<Int>(lastIndex - firstIndex);
-
+
//
// Check against the guess
//
@@ -1362,29 +1362,29 @@ IceInternal::BasicStream::writeConverted(const string& v)
{
if(guessedSize <= 254 && actualSize > 254)
{
- //
- // Move the UTF-8 sequence 4 bytes further
- // Use memmove instead of memcpy since the source and destination typically overlap.
- //
- resize(b.size() + 4);
- memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
+ //
+ // Move the UTF-8 sequence 4 bytes further
+ // Use memmove instead of memcpy since the source and destination typically overlap.
+ //
+ resize(b.size() + 4);
+ memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
}
else if(guessedSize > 254 && actualSize <= 254)
{
- //
- // Move the UTF-8 sequence 4 bytes back
- //
- memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
- resize(b.size() - 4);
+ //
+ // Move the UTF-8 sequence 4 bytes back
+ //
+ memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
+ resize(b.size() - 4);
}
if(guessedSize <= 254)
{
- rewriteSize(actualSize, b.begin() + firstIndex - 1);
+ rewriteSize(actualSize, b.begin() + firstIndex - 1);
}
else
{
- rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
+ rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
}
}
}
@@ -1396,10 +1396,10 @@ IceInternal::BasicStream::write(const string* begin, const string* end, bool con
writeSize(sz);
if(sz > 0)
{
- for(int i = 0; i < sz; ++i)
- {
- write(begin[i], convert);
- }
+ for(int i = 0; i < sz; ++i)
+ {
+ write(begin[i], convert);
+ }
}
}
@@ -1410,15 +1410,15 @@ IceInternal::BasicStream::read(vector<string>& v, bool convert)
readSize(sz);
if(sz > 0)
{
- startSeq(sz, 1);
- v.resize(sz);
- for(int j = 0; j < sz; ++j)
- {
- read(v[j], convert);
- checkSeq();
- endElement();
- }
- endSeq(sz);
+ startSeq(sz, 1);
+ v.resize(sz);
+ for(int j = 0; j < sz; ++j)
+ {
+ read(v[j], convert);
+ checkSeq();
+ endElement();
+ }
+ endSeq(sz);
}
else
{
@@ -1432,7 +1432,7 @@ IceInternal::BasicStream::write(const wstring& v)
if(v.empty())
{
writeSize(0);
- return;
+ return;
}
//
@@ -1440,22 +1440,22 @@ IceInternal::BasicStream::write(const wstring& v)
// Impossible to tell, so we guess. If we don't guess correctly,
// we'll have to fix the mistake afterwards
//
-
+
Int guessedSize = static_cast<Int>(v.size());
writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
-
+
size_t firstIndex = b.size();
StreamUTF8BufferI buffer(*this);
-
+
Byte* lastByte = _wstringConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
if(lastByte != b.end())
{
b.resize(lastByte - b.begin());
}
size_t lastIndex = b.size();
-
+
Int actualSize = static_cast<Int>(lastIndex - firstIndex);
-
+
//
// Check against the guess
//
@@ -1463,29 +1463,29 @@ IceInternal::BasicStream::write(const wstring& v)
{
if(guessedSize <= 254 && actualSize > 254)
{
- //
- // Move the UTF-8 sequence 4 bytes further
- // Use memmove instead of memcpy since the source and destination typically overlap.
- //
- resize(b.size() + 4);
- memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
+ //
+ // Move the UTF-8 sequence 4 bytes further
+ // Use memmove instead of memcpy since the source and destination typically overlap.
+ //
+ resize(b.size() + 4);
+ memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
}
else if(guessedSize > 254 && actualSize <= 254)
{
- //
- // Move the UTF-8 sequence 4 bytes back
- //
- memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
- resize(b.size() - 4);
+ //
+ // Move the UTF-8 sequence 4 bytes back
+ //
+ memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
+ resize(b.size() - 4);
}
if(guessedSize <= 254)
{
- rewriteSize(actualSize, b.begin() + firstIndex - 1);
+ rewriteSize(actualSize, b.begin() + firstIndex - 1);
}
else
{
- rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
+ rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
}
}
}
@@ -1497,10 +1497,10 @@ IceInternal::BasicStream::write(const wstring* begin, const wstring* end)
writeSize(sz);
if(sz > 0)
{
- for(int i = 0; i < sz; ++i)
- {
- write(begin[i]);
- }
+ for(int i = 0; i < sz; ++i)
+ {
+ write(begin[i]);
+ }
}
}
@@ -1511,15 +1511,15 @@ IceInternal::BasicStream::read(vector<wstring>& v)
readSize(sz);
if(sz > 0)
{
- startSeq(sz, 1);
- v.resize(sz);
- for(int j = 0; j < sz; ++j)
- {
- read(v[j]);
- checkSeq();
- endElement();
- }
- endSeq(sz);
+ startSeq(sz, 1);
+ v.resize(sz);
+ for(int j = 0; j < sz; ++j)
+ {
+ read(v[j]);
+ checkSeq();
+ endElement();
+ }
+ endSeq(sz);
}
else
{
@@ -1544,50 +1544,50 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
{
if(!_currentWriteEncaps) // Lazy initialization.
{
- _currentWriteEncaps = &_preAllocatedWriteEncaps;
- _currentWriteEncaps->start = b.size();
+ _currentWriteEncaps = &_preAllocatedWriteEncaps;
+ _currentWriteEncaps->start = b.size();
}
if(!_currentWriteEncaps->toBeMarshaledMap) // Lazy initialization.
{
- _currentWriteEncaps->toBeMarshaledMap = new PtrToIndexMap;
- _currentWriteEncaps->marshaledMap = new PtrToIndexMap;
- _currentWriteEncaps->typeIdMap = new TypeIdWriteMap;
+ _currentWriteEncaps->toBeMarshaledMap = new PtrToIndexMap;
+ _currentWriteEncaps->marshaledMap = new PtrToIndexMap;
+ _currentWriteEncaps->typeIdMap = new TypeIdWriteMap;
}
if(v)
{
- //
- // Look for this instance in the to-be-marshaled map.
- //
- PtrToIndexMap::iterator p = _currentWriteEncaps->toBeMarshaledMap->find(v);
- if(p == _currentWriteEncaps->toBeMarshaledMap->end())
- {
- //
- // Didn't find it, try the marshaled map next.
- //
- PtrToIndexMap::iterator q = _currentWriteEncaps->marshaledMap->find(v);
- if(q == _currentWriteEncaps->marshaledMap->end())
- {
- //
- // We haven't seen this instance previously, create a
- // new index, and insert it into the to-be-marshaled
- // map.
- //
- q = _currentWriteEncaps->toBeMarshaledMap->insert(
- _currentWriteEncaps->toBeMarshaledMap->end(),
- pair<const ObjectPtr, Int>(v, ++_currentWriteEncaps->writeIndex));
- }
- p = q;
- }
- //
- // Write the index for the instance.
- //
- write(-(p->second));
+ //
+ // Look for this instance in the to-be-marshaled map.
+ //
+ PtrToIndexMap::iterator p = _currentWriteEncaps->toBeMarshaledMap->find(v);
+ if(p == _currentWriteEncaps->toBeMarshaledMap->end())
+ {
+ //
+ // Didn't find it, try the marshaled map next.
+ //
+ PtrToIndexMap::iterator q = _currentWriteEncaps->marshaledMap->find(v);
+ if(q == _currentWriteEncaps->marshaledMap->end())
+ {
+ //
+ // We haven't seen this instance previously, create a
+ // new index, and insert it into the to-be-marshaled
+ // map.
+ //
+ q = _currentWriteEncaps->toBeMarshaledMap->insert(
+ _currentWriteEncaps->toBeMarshaledMap->end(),
+ pair<const ObjectPtr, Int>(v, ++_currentWriteEncaps->writeIndex));
+ }
+ p = q;
+ }
+ //
+ // Write the index for the instance.
+ //
+ write(-(p->second));
}
else
{
- write(0); // Write null pointer.
+ write(0); // Write null pointer.
}
}
@@ -1596,14 +1596,14 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr)
{
if(!_currentReadEncaps) // Lazy initialization.
{
- _currentReadEncaps = &_preAllocatedReadEncaps;
+ _currentReadEncaps = &_preAllocatedReadEncaps;
}
if(!_currentReadEncaps->patchMap) // Lazy initialization.
{
- _currentReadEncaps->patchMap = new PatchMap;
- _currentReadEncaps->unmarshaledMap = new IndexToPtrMap;
- _currentReadEncaps->typeIdMap = new TypeIdReadMap;
+ _currentReadEncaps->patchMap = new PatchMap;
+ _currentReadEncaps->unmarshaledMap = new IndexToPtrMap;
+ _currentReadEncaps->typeIdMap = new TypeIdReadMap;
}
ObjectPtr v;
@@ -1613,30 +1613,30 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr)
if(index == 0)
{
- patchFunc(patchAddr, v); // Null Ptr.
- return;
+ patchFunc(patchAddr, v); // Null Ptr.
+ return;
}
if(index < 0 && patchAddr)
{
- PatchMap::iterator p = _currentReadEncaps->patchMap->find(-index);
- if(p == _currentReadEncaps->patchMap->end())
- {
- //
- // We have no outstanding instances to be patched for this
- // index, so make a new entry in the patch map.
- //
- p = _currentReadEncaps->patchMap->insert(make_pair(-index, PatchList())).first;
- }
- //
- // Append a patch entry for this instance.
- //
- PatchEntry e;
- e.patchFunc = patchFunc;
- e.patchAddr = patchAddr;
- p->second.push_back(e);
- patchPointers(-index, _currentReadEncaps->unmarshaledMap->end(), p);
- return;
+ PatchMap::iterator p = _currentReadEncaps->patchMap->find(-index);
+ if(p == _currentReadEncaps->patchMap->end())
+ {
+ //
+ // We have no outstanding instances to be patched for this
+ // index, so make a new entry in the patch map.
+ //
+ p = _currentReadEncaps->patchMap->insert(make_pair(-index, PatchList())).first;
+ }
+ //
+ // Append a patch entry for this instance.
+ //
+ PatchEntry e;
+ e.patchFunc = patchFunc;
+ e.patchAddr = patchAddr;
+ p->second.push_back(e);
+ patchPointers(-index, _currentReadEncaps->unmarshaledMap->end(), p);
+ return;
}
assert(index > 0);
@@ -1645,16 +1645,16 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr)
string id = mostDerivedId;
while(true)
{
- //
- // If we slice all the way down to Ice::Object, we throw
- // because Ice::Object is abstract.
- //
+ //
+ // If we slice all the way down to Ice::Object, we throw
+ // because Ice::Object is abstract.
+ //
if(id == Ice::Object::ice_staticId())
- {
- throw NoObjectFactoryException(__FILE__, __LINE__,
- "class sliced to ::Ice::Object, which is abstract",
- mostDerivedId);
- }
+ {
+ throw NoObjectFactoryException(__FILE__, __LINE__,
+ "class sliced to ::Ice::Object, which is abstract",
+ mostDerivedId);
+ }
//
// Try to find a factory registered for the specific type.
@@ -1709,7 +1709,7 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr)
traceSlicing("class", id, _slicingCat, _instance->initializationData().logger);
}
skipSlice(); // Slice off this derived part -- we don't understand it.
- readTypeId(id); // Read next id for next iteration.
+ readTypeId(id); // Read next id for next iteration.
continue;
}
else
@@ -1720,8 +1720,8 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr)
}
}
- IndexToPtrMap::const_iterator unmarshaledPos =
- _currentReadEncaps->unmarshaledMap->insert(make_pair(index, v)).first;
+ IndexToPtrMap::const_iterator unmarshaledPos =
+ _currentReadEncaps->unmarshaledMap->insert(make_pair(index, v)).first;
//
// Record each object instance so that readPendingObjects can
@@ -1734,9 +1734,9 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr)
}
_objectList->push_back(v);
- v->__read(this, false);
- patchPointers(index, unmarshaledPos, _currentReadEncaps->patchMap->end());
- return;
+ v->__read(this, false);
+ patchPointers(index, unmarshaledPos, _currentReadEncaps->patchMap->end());
+ return;
}
//
@@ -1754,7 +1754,7 @@ IceInternal::BasicStream::write(const UserException& v)
v.__write(this);
if(v.__usesClasses())
{
- writePendingObjects();
+ writePendingObjects();
}
}
@@ -1768,49 +1768,49 @@ IceInternal::BasicStream::throwException()
read(id, false);
for(;;)
{
- //
- // Look for a factory for this ID.
- //
- UserExceptionFactoryPtr factory = factoryTable->getExceptionFactory(id);
- if(factory)
- {
- //
- // Got factory -- get the factory to instantiate the
- // exception, initialize the exception members, and throw
- // the exception.
- //
- try
- {
- factory->createAndThrow();
- }
- catch(UserException& ex)
- {
- ex.__read(this, false);
- if(usesClasses)
- {
- readPendingObjects();
- }
- ex.ice_throw();
- }
- }
- else
- {
- //
- // Performance sensitive, so we use lazy initialization
- // for tracing.
- //
- if(_traceSlicing == -1)
- {
- _traceSlicing = _instance->traceLevels()->slicing;
- _slicingCat = _instance->traceLevels()->slicingCat;
- }
- if(_traceSlicing > 0)
- {
- traceSlicing("exception", id, _slicingCat, _instance->initializationData().logger);
- }
- skipSlice(); // Slice off what we don't understand.
- read(id, false); // Read type id for next slice.
- }
+ //
+ // Look for a factory for this ID.
+ //
+ UserExceptionFactoryPtr factory = factoryTable->getExceptionFactory(id);
+ if(factory)
+ {
+ //
+ // Got factory -- get the factory to instantiate the
+ // exception, initialize the exception members, and throw
+ // the exception.
+ //
+ try
+ {
+ factory->createAndThrow();
+ }
+ catch(UserException& ex)
+ {
+ ex.__read(this, false);
+ if(usesClasses)
+ {
+ readPendingObjects();
+ }
+ ex.ice_throw();
+ }
+ }
+ else
+ {
+ //
+ // Performance sensitive, so we use lazy initialization
+ // for tracing.
+ //
+ if(_traceSlicing == -1)
+ {
+ _traceSlicing = _instance->traceLevels()->slicing;
+ _slicingCat = _instance->traceLevels()->slicingCat;
+ }
+ if(_traceSlicing > 0)
+ {
+ traceSlicing("exception", id, _slicingCat, _instance->initializationData().logger);
+ }
+ skipSlice(); // Slice off what we don't understand.
+ read(id, false); // Read type id for next slice.
+ }
}
//
@@ -1827,35 +1827,35 @@ IceInternal::BasicStream::writePendingObjects()
{
if(_currentWriteEncaps && _currentWriteEncaps->toBeMarshaledMap)
{
- while(_currentWriteEncaps->toBeMarshaledMap->size())
- {
- PtrToIndexMap savedMap = *_currentWriteEncaps->toBeMarshaledMap;
- writeSize(static_cast<Int>(savedMap.size()));
- for(PtrToIndexMap::iterator p = savedMap.begin(); p != savedMap.end(); ++p)
- {
- //
- // Add an instance from the old to-be-marshaled map to
- // the marshaled map and then ask the instance to
- // marshal itself. Any new class instances that are
- // triggered by the classes marshaled are added to
- // toBeMarshaledMap.
- //
- _currentWriteEncaps->marshaledMap->insert(*p);
- writeInstance(p->first, p->second);
- }
-
- //
- // We have marshaled all the instances for this pass,
- // substract what we have marshaled from the
- // toBeMarshaledMap.
- //
- PtrToIndexMap newMap;
- set_difference(_currentWriteEncaps->toBeMarshaledMap->begin(),
- _currentWriteEncaps->toBeMarshaledMap->end(),
- savedMap.begin(), savedMap.end(),
- insert_iterator<PtrToIndexMap>(newMap, newMap.begin()));
- *_currentWriteEncaps->toBeMarshaledMap = newMap;
- }
+ while(_currentWriteEncaps->toBeMarshaledMap->size())
+ {
+ PtrToIndexMap savedMap = *_currentWriteEncaps->toBeMarshaledMap;
+ writeSize(static_cast<Int>(savedMap.size()));
+ for(PtrToIndexMap::iterator p = savedMap.begin(); p != savedMap.end(); ++p)
+ {
+ //
+ // Add an instance from the old to-be-marshaled map to
+ // the marshaled map and then ask the instance to
+ // marshal itself. Any new class instances that are
+ // triggered by the classes marshaled are added to
+ // toBeMarshaledMap.
+ //
+ _currentWriteEncaps->marshaledMap->insert(*p);
+ writeInstance(p->first, p->second);
+ }
+
+ //
+ // We have marshaled all the instances for this pass,
+ // substract what we have marshaled from the
+ // toBeMarshaledMap.
+ //
+ PtrToIndexMap newMap;
+ set_difference(_currentWriteEncaps->toBeMarshaledMap->begin(),
+ _currentWriteEncaps->toBeMarshaledMap->end(),
+ savedMap.begin(), savedMap.end(),
+ insert_iterator<PtrToIndexMap>(newMap, newMap.begin()));
+ *_currentWriteEncaps->toBeMarshaledMap = newMap;
+ }
}
writeSize(0); // Zero marker indicates end of sequence of sequences of instances.
}
@@ -1866,11 +1866,11 @@ IceInternal::BasicStream::readPendingObjects()
Int num;
do
{
- readSize(num);
- for(Int k = num; k > 0; --k)
- {
- read(0, 0);
- }
+ readSize(num);
+ for(Int k = num; k > 0; --k)
+ {
+ read(0, 0);
+ }
}
while(num);
@@ -1970,7 +1970,7 @@ IceInternal::BasicStream::writeInstance(const ObjectPtr& v, Int index)
void
IceInternal::BasicStream::patchPointers(Int index, IndexToPtrMap::const_iterator unmarshaledPos,
- PatchMap::iterator patchPos)
+ PatchMap::iterator patchPos)
{
//
// Called whenever we have unmarshaled a new instance. The index
@@ -1981,34 +1981,34 @@ IceInternal::BasicStream::patchPointers(Int index, IndexToPtrMap::const_iterator
// with the new address.
//
assert( (unmarshaledPos != _currentReadEncaps->unmarshaledMap->end()
- && patchPos == _currentReadEncaps->patchMap->end())
- || (unmarshaledPos == _currentReadEncaps->unmarshaledMap->end()
- && patchPos != _currentReadEncaps->patchMap->end())
- );
+ && patchPos == _currentReadEncaps->patchMap->end())
+ || (unmarshaledPos == _currentReadEncaps->unmarshaledMap->end()
+ && patchPos != _currentReadEncaps->patchMap->end())
+ );
if(unmarshaledPos != _currentReadEncaps->unmarshaledMap->end())
{
- //
- // We have just unmarshaled an instance -- check if something
- // needs patching for that instance.
- //
- patchPos = _currentReadEncaps->patchMap->find(index);
- if(patchPos == _currentReadEncaps->patchMap->end())
- {
- return; // We don't have anything to patch for the instance just unmarshaled.
- }
+ //
+ // We have just unmarshaled an instance -- check if something
+ // needs patching for that instance.
+ //
+ patchPos = _currentReadEncaps->patchMap->find(index);
+ if(patchPos == _currentReadEncaps->patchMap->end())
+ {
+ return; // We don't have anything to patch for the instance just unmarshaled.
+ }
}
else
{
- //
- // We have just unmarshaled an index -- check if we have
- // unmarshaled the instance for that index yet.
- //
- unmarshaledPos = _currentReadEncaps->unmarshaledMap->find(index);
- if(unmarshaledPos == _currentReadEncaps->unmarshaledMap->end())
- {
- return; // We haven't unmarshaled the instance yet.
- }
+ //
+ // We have just unmarshaled an index -- check if we have
+ // unmarshaled the instance for that index yet.
+ //
+ unmarshaledPos = _currentReadEncaps->unmarshaledMap->find(index);
+ if(unmarshaledPos == _currentReadEncaps->unmarshaledMap->end())
+ {
+ return; // We haven't unmarshaled the instance yet.
+ }
}
assert(patchPos->second.size() > 0);
@@ -2020,7 +2020,7 @@ IceInternal::BasicStream::patchPointers(Int index, IndexToPtrMap::const_iterator
//
for(PatchList::iterator k = patchPos->second.begin(); k != patchPos->second.end(); ++k)
{
- (*k->patchFunc)(k->patchAddr, v);
+ (*k->patchFunc)(k->patchAddr, v);
}
//
diff --git a/cpp/src/Ice/Buffer.cpp b/cpp/src/Ice/Buffer.cpp
index b0b4ffecdd7..ba09f6f3cfb 100644
--- a/cpp/src/Ice/Buffer.cpp
+++ b/cpp/src/Ice/Buffer.cpp
@@ -58,31 +58,31 @@ IceInternal::Buffer::Container::reserve(size_type n)
{
if(n > _capacity)
{
- _capacity = std::max<size_type>(n, std::min(2 * _capacity, _maxCapacity));
- _capacity = std::max<size_type>(static_cast<size_type>(240), _capacity);
+ _capacity = std::max<size_type>(n, std::min(2 * _capacity, _maxCapacity));
+ _capacity = std::max<size_type>(static_cast<size_type>(240), _capacity);
}
else if(n < _capacity)
{
- _capacity = n;
+ _capacity = n;
}
else
{
- return;
+ return;
}
if(_buf)
{
- _buf = reinterpret_cast<pointer>(::realloc(_buf, _capacity));
+ _buf = reinterpret_cast<pointer>(::realloc(_buf, _capacity));
}
else
{
- _buf = reinterpret_cast<pointer>(::malloc(_capacity));
+ _buf = reinterpret_cast<pointer>(::malloc(_capacity));
}
-
+
if(!_buf)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
}
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index ec72da06d01..c7ca49ea899 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -35,7 +35,7 @@ IceUtil::Handle<IceInternal::GC> theCollector = 0;
struct GarbageCollectorStats
{
GarbageCollectorStats() :
- runs(0), examined(0), collected(0)
+ runs(0), examined(0), collected(0)
{
}
int runs;
@@ -56,15 +56,15 @@ printGCStats(const IceInternal::GCStats& stats)
{
if(gcTraceLevel)
{
- if(gcTraceLevel > 1)
- {
- Trace out(getProcessLogger(), gcTraceCat);
- out << stats.collected << "/" << stats.examined << ", " << stats.time * 1000 << "ms";
- }
- ++gcStats.runs;
- gcStats.examined += stats.examined;
- gcStats.collected += stats.collected;
- gcStats.time += stats.time;
+ if(gcTraceLevel > 1)
+ {
+ Trace out(getProcessLogger(), gcTraceCat);
+ out << stats.collected << "/" << stats.examined << ", " << stats.time * 1000 << "ms";
+ }
+ ++gcStats.runs;
+ gcStats.examined += stats.examined;
+ gcStats.collected += stats.collected;
+ gcStats.time += stats.time;
}
}
@@ -73,37 +73,37 @@ Ice::CommunicatorI::destroy()
{
if(_instance->destroy())
{
- IceUtil::StaticMutex::Lock sync(gcMutex);
-
- //
- // Wait for the collector thread to stop if this is the last communicator
- // to be destroyed.
- //
- bool last = (--communicatorCount == 0);
- if(last && gcInterval > 0 && theCollector)
- {
- theCollector->stop();
- }
-
- if(theCollector)
+ IceUtil::StaticMutex::Lock sync(gcMutex);
+
+ //
+ // Wait for the collector thread to stop if this is the last communicator
+ // to be destroyed.
+ //
+ bool last = (--communicatorCount == 0);
+ if(last && gcInterval > 0 && theCollector)
+ {
+ theCollector->stop();
+ }
+
+ if(theCollector)
{
- theCollector->collectGarbage(); // Collect whenever a communicator is destroyed.
- }
-
- if(last)
- {
- if(gcTraceLevel)
- {
- Trace out(getProcessLogger(), gcTraceCat);
- out << "totals: " << gcStats.collected << "/" << gcStats.examined << ", "
- << gcStats.time * 1000 << "ms" << ", " << gcStats.runs << " run";
- if(gcStats.runs != 1)
- {
- out << "s";
- }
- }
- theCollector = 0; // Force destruction of the collector.
- }
+ theCollector->collectGarbage(); // Collect whenever a communicator is destroyed.
+ }
+
+ if(last)
+ {
+ if(gcTraceLevel)
+ {
+ Trace out(getProcessLogger(), gcTraceCat);
+ out << "totals: " << gcStats.collected << "/" << gcStats.examined << ", "
+ << gcStats.time * 1000 << "ms" << ", " << gcStats.runs << " run";
+ if(gcStats.runs != 1)
+ {
+ out << "s";
+ }
+ }
+ theCollector = 0; // Force destruction of the collector.
+ }
}
}
@@ -263,47 +263,47 @@ Ice::CommunicatorI::CommunicatorI(const InitializationData& initData)
__setNoDelete(true);
try
{
- const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
+ const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
//
// Keep a reference to the dynamic library list to ensure
// the libraries are not unloaded until this Communicator's
// destructor is invoked.
//
- const_cast<DynamicLibraryListPtr&>(_dynamicLibraryList) = _instance->dynamicLibraryList();
+ const_cast<DynamicLibraryListPtr&>(_dynamicLibraryList) = _instance->dynamicLibraryList();
}
catch(...)
{
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
{
- //
- // If this is the first communicator that is created, use that communicator's
- // property settings to determine whether to start the garbage collector.
- // We remember that communicator's trace and logger settings so the garbage
- // collector can continue to log messages even if the first communicator that
- // is created isn't the last communicator to be destroyed.
- //
- IceUtil::StaticMutex::Lock sync(gcMutex);
- static bool gcOnce = true;
- if(gcOnce)
- {
- gcTraceLevel = _instance->traceLevels()->gc;
- gcTraceCat = _instance->traceLevels()->gcCat;
- gcInterval = _instance->initializationData().properties->getPropertyAsInt("Ice.GC.Interval");
- gcOnce = false;
- }
- if(++communicatorCount == 1)
- {
- theCollector = new IceInternal::GC(gcInterval, printGCStats);
- if(gcInterval > 0)
- {
- theCollector->start();
- }
- }
+ //
+ // If this is the first communicator that is created, use that communicator's
+ // property settings to determine whether to start the garbage collector.
+ // We remember that communicator's trace and logger settings so the garbage
+ // collector can continue to log messages even if the first communicator that
+ // is created isn't the last communicator to be destroyed.
+ //
+ IceUtil::StaticMutex::Lock sync(gcMutex);
+ static bool gcOnce = true;
+ if(gcOnce)
+ {
+ gcTraceLevel = _instance->traceLevels()->gc;
+ gcTraceCat = _instance->traceLevels()->gcCat;
+ gcInterval = _instance->initializationData().properties->getPropertyAsInt("Ice.GC.Interval");
+ gcOnce = false;
+ }
+ if(++communicatorCount == 1)
+ {
+ theCollector = new IceInternal::GC(gcInterval, printGCStats);
+ if(gcInterval > 0)
+ {
+ theCollector->start();
+ }
+ }
}
}
@@ -311,8 +311,8 @@ Ice::CommunicatorI::~CommunicatorI()
{
if(!_instance->destroyed())
{
- Warning out(_instance->initializationData().logger);
- out << "Ice::Communicator::destroy() has not been called";
+ Warning out(_instance->initializationData().logger);
+ out << "Ice::Communicator::destroy() has not been called";
}
}
@@ -321,11 +321,11 @@ Ice::CommunicatorI::finishSetup(int& argc, char* argv[])
{
try
{
- _instance->finishSetup(argc, argv);
+ _instance->finishSetup(argc, argv);
}
catch(...)
{
- _instance->destroy();
- throw;
+ _instance->destroy();
+ throw;
}
}
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 5b33b528d5a..3008dfaa485 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -45,18 +45,18 @@ IceInternal::OutgoingConnectionFactory::destroy()
if(_destroyed)
{
- return;
+ return;
}
#ifdef _STLP_BEGIN_NAMESPACE
// voidbind2nd is an STLport extension for broken compilers in IceUtil/Functional.h
for_each(_connections.begin(), _connections.end(),
- voidbind2nd(Ice::secondVoidMemFun1<EndpointIPtr, ConnectionI, ConnectionI::DestructionReason>
- (&ConnectionI::destroy), ConnectionI::CommunicatorDestroyed));
+ voidbind2nd(Ice::secondVoidMemFun1<EndpointIPtr, ConnectionI, ConnectionI::DestructionReason>
+ (&ConnectionI::destroy), ConnectionI::CommunicatorDestroyed));
#else
for_each(_connections.begin(), _connections.end(),
- bind2nd(Ice::secondVoidMemFun1<const EndpointIPtr, ConnectionI, ConnectionI::DestructionReason>
- (&ConnectionI::destroy), ConnectionI::CommunicatorDestroyed));
+ bind2nd(Ice::secondVoidMemFun1<const EndpointIPtr, ConnectionI, ConnectionI::DestructionReason>
+ (&ConnectionI::destroy), ConnectionI::CommunicatorDestroyed));
#endif
_destroyed = true;
@@ -69,27 +69,27 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished()
multimap<EndpointIPtr, ConnectionIPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the factory is destroyed. We also wait
- // until there are no pending connections anymore. Only then
- // we can be sure the _connections contains all connections.
- //
- while(!_destroyed || !_pending.empty())
- {
- wait();
- }
-
- //
- // We want to wait until all connections are finished outside the
- // thread synchronization.
- //
- connections.swap(_connections);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the factory is destroyed. We also wait
+ // until there are no pending connections anymore. Only then
+ // we can be sure the _connections contains all connections.
+ //
+ while(!_destroyed || !_pending.empty())
+ {
+ wait();
+ }
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections.swap(_connections);
}
for_each(connections.begin(), connections.end(),
- Ice::secondVoidMemFun<const EndpointIPtr, ConnectionI>(&ConnectionI::waitUntilFinished));
+ Ice::secondVoidMemFun<const EndpointIPtr, ConnectionI>(&ConnectionI::waitUntilFinished));
}
ConnectionIPtr
@@ -100,131 +100,131 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointIPtr>& endpt
vector<EndpointIPtr> endpoints = endpts;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(_destroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
-
- //
- // Reap connections for which destruction has completed.
- //
- std::multimap<EndpointIPtr, ConnectionIPtr>::iterator p = _connections.begin();
- while(p != _connections.end())
- {
- if(p->second->isFinished())
- {
- _connections.erase(p++);
- }
- else
- {
- ++p;
- }
- }
-
- //
- // Modify endpoints with overrides.
- //
- vector<EndpointIPtr>::iterator q;
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- if(_instance->defaultsAndOverrides()->overrideTimeout)
- {
- *q = (*q)->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
- }
-
- //
- // The Connection object does not take the compression flag of
- // endpoints into account, but instead gets the information
- // about whether messages should be compressed or not from
- // other sources. In order to allow connection sharing for
- // endpoints that differ in the value of the compression flag
- // only, we always set the compression flag to false here in
- // this connection factory.
- //
- *q = (*q)->compress(false);
- }
-
- //
- // Search for existing connections.
- //
- vector<EndpointIPtr>::const_iterator r;
- for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
- {
- pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
- multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(*q);
-
- while(pr.first != pr.second)
- {
- //
- // Don't return connections for which destruction has
- // been initiated. The connection must also match the
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(_destroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ std::multimap<EndpointIPtr, ConnectionIPtr>::iterator p = _connections.begin();
+ while(p != _connections.end())
+ {
+ if(p->second->isFinished())
+ {
+ _connections.erase(p++);
+ }
+ else
+ {
+ ++p;
+ }
+ }
+
+ //
+ // Modify endpoints with overrides.
+ //
+ vector<EndpointIPtr>::iterator q;
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ if(_instance->defaultsAndOverrides()->overrideTimeout)
+ {
+ *q = (*q)->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ }
+
+ //
+ // The Connection object does not take the compression flag of
+ // endpoints into account, but instead gets the information
+ // about whether messages should be compressed or not from
+ // other sources. In order to allow connection sharing for
+ // endpoints that differ in the value of the compression flag
+ // only, we always set the compression flag to false here in
+ // this connection factory.
+ //
+ *q = (*q)->compress(false);
+ }
+
+ //
+ // Search for existing connections.
+ //
+ vector<EndpointIPtr>::const_iterator r;
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
+ {
+ pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
+ multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(*q);
+
+ while(pr.first != pr.second)
+ {
+ //
+ // Don't return connections for which destruction has
+ // been initiated. The connection must also match the
// requested thread-per-connection setting.
- //
- if(!pr.first->second->isDestroyed() &&
+ //
+ if(!pr.first->second->isDestroyed() &&
pr.first->second->threadPerConnection() == threadPerConnection)
- {
- if(_instance->defaultsAndOverrides()->overrideCompress)
- {
- compress = _instance->defaultsAndOverrides()->overrideCompressValue;
- }
- else
- {
- compress = (*r)->compress();
- }
-
- return pr.first->second;
- }
-
- ++pr.first;
- }
- }
-
- //
- // If some other thread is currently trying to establish a
- // connection to any of our endpoints, we wait until this
- // thread is finished.
- //
- bool searchAgain = false;
- while(!_destroyed)
- {
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- if(_pending.find(*q) != _pending.end())
- {
- break;
- }
- }
-
- if(q == endpoints.end())
- {
- break;
- }
-
- searchAgain = true;
-
- wait();
- }
-
- if(_destroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
-
- //
- // Search for existing connections again if we waited above,
- // as new connections might have been added in the meantime.
- //
- if(searchAgain)
- {
- for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
- {
- pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
- multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(*q);
-
- while(pr.first != pr.second)
- {
+ {
+ if(_instance->defaultsAndOverrides()->overrideCompress)
+ {
+ compress = _instance->defaultsAndOverrides()->overrideCompressValue;
+ }
+ else
+ {
+ compress = (*r)->compress();
+ }
+
+ return pr.first->second;
+ }
+
+ ++pr.first;
+ }
+ }
+
+ //
+ // If some other thread is currently trying to establish a
+ // connection to any of our endpoints, we wait until this
+ // thread is finished.
+ //
+ bool searchAgain = false;
+ while(!_destroyed)
+ {
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ if(_pending.find(*q) != _pending.end())
+ {
+ break;
+ }
+ }
+
+ if(q == endpoints.end())
+ {
+ break;
+ }
+
+ searchAgain = true;
+
+ wait();
+ }
+
+ if(_destroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ //
+ // Search for existing connections again if we waited above,
+ // as new connections might have been added in the meantime.
+ //
+ if(searchAgain)
+ {
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
+ {
+ pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
+ multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(*q);
+
+ while(pr.first != pr.second)
+ {
//
// Don't return connections for which destruction has
// been initiated. The connection must also match the
@@ -232,31 +232,31 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointIPtr>& endpt
//
if(!pr.first->second->isDestroyed() &&
pr.first->second->threadPerConnection() == threadPerConnection)
- {
- if(_instance->defaultsAndOverrides()->overrideCompress)
- {
- compress = _instance->defaultsAndOverrides()->overrideCompressValue;
- }
- else
- {
- compress = (*r)->compress();
- }
-
- return pr.first->second;
- }
-
- ++pr.first;
- }
- }
- }
-
- //
- // No connection to any of our endpoints exists yet, so we
- // will try to create one. To avoid that other threads try to
- // create connections to the same endpoints, we add our
- // endpoints to _pending.
- //
- _pending.insert(endpoints.begin(), endpoints.end());
+ {
+ if(_instance->defaultsAndOverrides()->overrideCompress)
+ {
+ compress = _instance->defaultsAndOverrides()->overrideCompressValue;
+ }
+ else
+ {
+ compress = (*r)->compress();
+ }
+
+ return pr.first->second;
+ }
+
+ ++pr.first;
+ }
+ }
+ }
+
+ //
+ // No connection to any of our endpoints exists yet, so we
+ // will try to create one. To avoid that other threads try to
+ // create connections to the same endpoints, we add our
+ // endpoints to _pending.
+ //
+ _pending.insert(endpoints.begin(), endpoints.end());
}
ConnectionIPtr connection;
@@ -266,112 +266,112 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointIPtr>& endpt
vector<EndpointIPtr>::const_iterator r;
for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
{
- EndpointIPtr endpoint = *q;
-
- try
- {
- TransceiverPtr transceiver = endpoint->clientTransceiver();
- if(!transceiver)
- {
- ConnectorPtr connector = endpoint->connector();
- assert(connector);
-
- Int timeout;
- if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
- {
- timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
- }
- // It is not necessary to check for overrideTimeout,
- // the endpoint has already been modified with this
- // override, if set.
- else
- {
- timeout = endpoint->timeout();
- }
-
- transceiver = connector->connect(timeout);
- assert(transceiver);
- }
- connection = new ConnectionI(_instance, transceiver, endpoint, 0, threadPerConnection,
+ EndpointIPtr endpoint = *q;
+
+ try
+ {
+ TransceiverPtr transceiver = endpoint->clientTransceiver();
+ if(!transceiver)
+ {
+ ConnectorPtr connector = endpoint->connector();
+ assert(connector);
+
+ Int timeout;
+ if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
+ {
+ timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
+ }
+ // It is not necessary to check for overrideTimeout,
+ // the endpoint has already been modified with this
+ // override, if set.
+ else
+ {
+ timeout = endpoint->timeout();
+ }
+
+ transceiver = connector->connect(timeout);
+ assert(transceiver);
+ }
+ connection = new ConnectionI(_instance, transceiver, endpoint, 0, threadPerConnection,
_instance->threadPerConnectionStackSize());
- connection->validate();
-
- if(_instance->defaultsAndOverrides()->overrideCompress)
- {
- compress = _instance->defaultsAndOverrides()->overrideCompressValue;
- }
- else
- {
- compress = (*r)->compress();
- }
- break;
- }
- catch(const LocalException& ex)
- {
- exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
-
- //
- // If a connection object was constructed, then validate()
- // must have raised the exception.
- //
- if(connection)
- {
- connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
- connection = 0;
- }
- }
-
- TraceLevelsPtr traceLevels = _instance->traceLevels();
- if(traceLevels->retry >= 2)
- {
- Trace out(_instance->initializationData().logger, traceLevels->retryCat);
-
- out << "connection to endpoint failed";
- if(moreEndpts || q + 1 != endpoints.end())
- {
- out << ", trying next endpoint\n";
- }
- else
- {
- out << " and no more endpoints to try\n";
- }
- out << *exception.get();
- }
+ connection->validate();
+
+ if(_instance->defaultsAndOverrides()->overrideCompress)
+ {
+ compress = _instance->defaultsAndOverrides()->overrideCompressValue;
+ }
+ else
+ {
+ compress = (*r)->compress();
+ }
+ break;
+ }
+ catch(const LocalException& ex)
+ {
+ exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+
+ //
+ // If a connection object was constructed, then validate()
+ // must have raised the exception.
+ //
+ if(connection)
+ {
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ connection = 0;
+ }
+ }
+
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
+ if(traceLevels->retry >= 2)
+ {
+ Trace out(_instance->initializationData().logger, traceLevels->retryCat);
+
+ out << "connection to endpoint failed";
+ if(moreEndpts || q + 1 != endpoints.end())
+ {
+ out << ", trying next endpoint\n";
+ }
+ else
+ {
+ out << " and no more endpoints to try\n";
+ }
+ out << *exception.get();
+ }
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // Signal other threads that we are done with trying to
- // establish connections to our endpoints.
- //
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- _pending.erase(*q);
- }
- notifyAll();
-
- if(!connection)
- {
- assert(exception.get());
- exception->ice_throw();
- }
- else
- {
- _connections.insert(_connections.end(),
- pair<const EndpointIPtr, ConnectionIPtr>(connection->endpoint(), connection));
-
- if(_destroyed)
- {
- connection->destroy(ConnectionI::CommunicatorDestroyed);
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
- else
- {
- connection->activate();
- }
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // Signal other threads that we are done with trying to
+ // establish connections to our endpoints.
+ //
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ _pending.erase(*q);
+ }
+ notifyAll();
+
+ if(!connection)
+ {
+ assert(exception.get());
+ exception->ice_throw();
+ }
+ else
+ {
+ _connections.insert(_connections.end(),
+ pair<const EndpointIPtr, ConnectionIPtr>(connection->endpoint(), connection));
+
+ if(_destroyed)
+ {
+ connection->destroy(ConnectionI::CommunicatorDestroyed);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+ else
+ {
+ connection->activate();
+ }
+ }
}
assert(connection);
@@ -385,7 +385,7 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route
if(_destroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
assert(routerInfo);
@@ -401,44 +401,44 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route
vector<EndpointIPtr>::const_iterator p;
for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
- EndpointIPtr endpoint = *p;
-
- //
- // Modify endpoints with overrides.
- //
- if(_instance->defaultsAndOverrides()->overrideTimeout)
- {
- endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
- }
-
- //
- // The Connection object does not take the compression flag of
- // endpoints into account, but instead gets the information
- // about whether messages should be compressed or not from
- // other sources. In order to allow connection sharing for
- // endpoints that differ in the value of the compression flag
- // only, we always set the compression flag to false here in
- // this connection factory.
- //
- endpoint = endpoint->compress(false);
-
- pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
- multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(endpoint);
-
- while(pr.first != pr.second)
- {
- try
- {
- pr.first->second->setAdapter(adapter);
- }
- catch(const Ice::LocalException&)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- ++pr.first;
- }
+ EndpointIPtr endpoint = *p;
+
+ //
+ // Modify endpoints with overrides.
+ //
+ if(_instance->defaultsAndOverrides()->overrideTimeout)
+ {
+ endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ }
+
+ //
+ // The Connection object does not take the compression flag of
+ // endpoints into account, but instead gets the information
+ // about whether messages should be compressed or not from
+ // other sources. In order to allow connection sharing for
+ // endpoints that differ in the value of the compression flag
+ // only, we always set the compression flag to false here in
+ // this connection factory.
+ //
+ endpoint = endpoint->compress(false);
+
+ pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
+ multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(endpoint);
+
+ while(pr.first != pr.second)
+ {
+ try
+ {
+ pr.first->second->setAdapter(adapter);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ ++pr.first;
+ }
}
}
@@ -449,24 +449,24 @@ IceInternal::OutgoingConnectionFactory::removeAdapter(const ObjectAdapterPtr& ad
if(_destroyed)
{
- return;
+ return;
}
for(multimap<EndpointIPtr, ConnectionIPtr>::const_iterator p = _connections.begin(); p != _connections.end(); ++p)
{
- if(p->second->getAdapter() == adapter)
- {
- try
- {
- p->second->setAdapter(0);
- }
- catch(const Ice::LocalException&)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- }
+ if(p->second->getAdapter() == adapter)
+ {
+ try
+ {
+ p->second->setAdapter(0);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ }
}
}
@@ -476,26 +476,26 @@ IceInternal::OutgoingConnectionFactory::flushBatchRequests()
list<ConnectionIPtr> c;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- for(std::multimap<EndpointIPtr, ConnectionIPtr>::const_iterator p = _connections.begin();
- p != _connections.end();
- ++p)
- {
- c.push_back(p->second);
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ for(std::multimap<EndpointIPtr, ConnectionIPtr>::const_iterator p = _connections.begin();
+ p != _connections.end();
+ ++p)
+ {
+ c.push_back(p->second);
+ }
}
for(list<ConnectionIPtr>::const_iterator p = c.begin(); p != c.end(); ++p)
{
- try
- {
- (*p)->flushBatchRequests();
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
+ try
+ {
+ (*p)->flushBatchRequests();
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
}
}
@@ -538,22 +538,22 @@ IceInternal::IncomingConnectionFactory::waitUntilHolding() const
list<ConnectionIPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the connection factory itself is in holding
- // state.
- //
- while(_state < StateHolding)
- {
- wait();
- }
-
- //
- // We want to wait until all connections are in holding state
- // outside the thread synchronization.
- //
- connections = _connections;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the connection factory itself is in holding
+ // state.
+ //
+ while(_state < StateHolding)
+ {
+ wait();
+ }
+
+ //
+ // We want to wait until all connections are in holding state
+ // outside the thread synchronization.
+ //
+ connections = _connections;
}
//
@@ -569,35 +569,35 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
list<ConnectionIPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the factory is destroyed. If we are using
- // an acceptor, we also wait for it to be closed.
- //
- while(_state != StateClosed || _acceptor)
- {
- wait();
- }
-
- threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
- _threadPerIncomingConnectionFactory = 0;
-
- //
- // Clear the OA. See bug 1673 for the details of why this is necessary.
- //
- _adapter = 0;
-
- //
- // We want to wait until all connections are finished outside the
- // thread synchronization.
- //
- connections.swap(_connections);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the factory is destroyed. If we are using
+ // an acceptor, we also wait for it to be closed.
+ //
+ while(_state != StateClosed || _acceptor)
+ {
+ wait();
+ }
+
+ threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
+ _threadPerIncomingConnectionFactory = 0;
+
+ //
+ // Clear the OA. See bug 1673 for the details of why this is necessary.
+ //
+ _adapter = 0;
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections.swap(_connections);
}
if(threadPerIncomingConnectionFactory)
{
- threadPerIncomingConnectionFactory->getThreadControl().join();
+ threadPerIncomingConnectionFactory->getThreadControl().join();
}
for_each(connections.begin(), connections.end(), Ice::voidMemFun(&ConnectionI::waitUntilFinished));
@@ -615,7 +615,7 @@ IceInternal::IncomingConnectionFactory::equivalent(const EndpointIPtr& endp) con
{
if(_transceiver)
{
- return endp->equivalent(_transceiver);
+ return endp->equivalent(_transceiver);
}
assert(_acceptor);
@@ -633,7 +633,7 @@ IceInternal::IncomingConnectionFactory::connections() const
// Only copy connections which have not been destroyed.
//
remove_copy_if(_connections.begin(), _connections.end(), back_inserter(result),
- Ice::constMemFun(&ConnectionI::isDestroyed));
+ Ice::constMemFun(&ConnectionI::isDestroyed));
return result;
}
@@ -645,14 +645,14 @@ IceInternal::IncomingConnectionFactory::flushBatchRequests()
for(list<ConnectionIPtr>::const_iterator p = c.begin(); p != c.end(); ++p)
{
- try
- {
- (*p)->flushBatchRequests();
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
+ try
+ {
+ (*p)->flushBatchRequests();
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
}
}
@@ -682,13 +682,13 @@ class PromoteFollower
public:
PromoteFollower(const ThreadPoolPtr& threadPool) :
- _threadPool(threadPool)
+ _threadPool(threadPool)
{
}
~PromoteFollower()
{
- _threadPool->promoteFollower();
+ _threadPool->promoteFollower();
}
private:
@@ -704,73 +704,73 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt
ConnectionIPtr connection;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // This makes sure that we promote a follower before we leave
- // the scope of the mutex above, but after we call accept()
- // (if we call it).
- //
- // If _threadPool is null, then this class doesn't do
- // anything.
- //
- PromoteFollower promote(threadPool);
-
- if(_state != StateActive)
- {
- IceUtil::ThreadControl::yield();
- return;
- }
-
- //
- // Reap connections for which destruction has completed.
- //
- _connections.erase(remove_if(_connections.begin(), _connections.end(),
- Ice::constMemFun(&ConnectionI::isFinished)),
- _connections.end());
-
- //
- // Now accept a new connection.
- //
- TransceiverPtr transceiver;
- try
- {
- transceiver = _acceptor->accept(0);
- }
- catch(const SocketException&)
- {
- // Ignore socket exceptions.
- return;
- }
- catch(const TimeoutException&)
- {
- // Ignore timeouts.
- return;
- }
- catch(const LocalException& ex)
- {
- // Warn about other Ice local exceptions.
- if(_warn)
- {
- Warning out(_instance->initializationData().logger);
- out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
- }
- return;
- }
-
- assert(transceiver);
-
- try
- {
- connection = new ConnectionI(_instance, transceiver, _endpoint, _adapter, _threadPerConnection,
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // This makes sure that we promote a follower before we leave
+ // the scope of the mutex above, but after we call accept()
+ // (if we call it).
+ //
+ // If _threadPool is null, then this class doesn't do
+ // anything.
+ //
+ PromoteFollower promote(threadPool);
+
+ if(_state != StateActive)
+ {
+ IceUtil::ThreadControl::yield();
+ return;
+ }
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ _connections.erase(remove_if(_connections.begin(), _connections.end(),
+ Ice::constMemFun(&ConnectionI::isFinished)),
+ _connections.end());
+
+ //
+ // Now accept a new connection.
+ //
+ TransceiverPtr transceiver;
+ try
+ {
+ transceiver = _acceptor->accept(0);
+ }
+ catch(const SocketException&)
+ {
+ // Ignore socket exceptions.
+ return;
+ }
+ catch(const TimeoutException&)
+ {
+ // Ignore timeouts.
+ return;
+ }
+ catch(const LocalException& ex)
+ {
+ // Warn about other Ice local exceptions.
+ if(_warn)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
+ }
+ return;
+ }
+
+ assert(transceiver);
+
+ try
+ {
+ connection = new ConnectionI(_instance, transceiver, _endpoint, _adapter, _threadPerConnection,
_threadPerConnectionStackSize);
- }
- catch(const LocalException&)
- {
- return;
- }
+ }
+ catch(const LocalException&)
+ {
+ return;
+ }
- _connections.push_back(connection);
+ _connections.push_back(connection);
}
assert(connection);
@@ -781,14 +781,14 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt
//
try
{
- connection->validate();
+ connection->validate();
}
catch(const LocalException&)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
- _connections.remove(connection);
- return;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ _connections.remove(connection);
+ return;
}
connection->activate();
@@ -808,10 +808,10 @@ IceInternal::IncomingConnectionFactory::finished(const ThreadPoolPtr& threadPool
if(_finishedCount == 0 && _state == StateClosed)
{
- dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->decFdsInUse();
- _acceptor->close();
- _acceptor = 0;
- notifyAll();
+ dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->decFdsInUse();
+ _acceptor->close();
+ _acceptor = 0;
+ notifyAll();
}
}
@@ -828,7 +828,7 @@ IceInternal::IncomingConnectionFactory::toString() const
if(_transceiver)
{
- return _transceiver->toString();
+ return _transceiver->toString();
}
assert(_acceptor);
@@ -836,9 +836,9 @@ IceInternal::IncomingConnectionFactory::toString() const
}
IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const InstancePtr& instance,
- const EndpointIPtr& endpoint,
- const ObjectAdapterPtr& adapter,
- const string& adapterName) :
+ const EndpointIPtr& endpoint,
+ const ObjectAdapterPtr& adapter,
+ const string& adapterName) :
EventHandler(instance),
_endpoint(endpoint),
_adapter(adapter),
@@ -849,14 +849,14 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
{
if(_instance->defaultsAndOverrides()->overrideTimeout)
{
- const_cast<EndpointIPtr&>(_endpoint) =
- _endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ const_cast<EndpointIPtr&>(_endpoint) =
+ _endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
}
if(_instance->defaultsAndOverrides()->overrideCompress)
{
- const_cast<EndpointIPtr&>(_endpoint) =
- _endpoint->compress(_instance->defaultsAndOverrides()->overrideCompressValue);
+ const_cast<EndpointIPtr&>(_endpoint) =
+ _endpoint->compress(_instance->defaultsAndOverrides()->overrideCompressValue);
}
ObjectAdapterI* adapterImpl = dynamic_cast<ObjectAdapterI*>(_adapter.get());
@@ -866,75 +866,75 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
const_cast<TransceiverPtr&>(_transceiver) = _endpoint->serverTransceiver(const_cast<EndpointIPtr&>(_endpoint));
if(_transceiver)
{
- ConnectionIPtr connection;
+ ConnectionIPtr connection;
- try
- {
- connection = new ConnectionI(_instance, _transceiver, _endpoint, _adapter, _threadPerConnection,
+ try
+ {
+ connection = new ConnectionI(_instance, _transceiver, _endpoint, _adapter, _threadPerConnection,
_threadPerConnectionStackSize);
- connection->validate();
- }
- catch(const LocalException&)
- {
- //
- // If a connection object was constructed, then validate()
- // must have raised the exception.
- //
- if(connection)
- {
- connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
- }
-
- return;
- }
-
- _connections.push_back(connection);
+ connection->validate();
+ }
+ catch(const LocalException&)
+ {
+ //
+ // If a connection object was constructed, then validate()
+ // must have raised the exception.
+ //
+ if(connection)
+ {
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ }
+
+ return;
+ }
+
+ _connections.push_back(connection);
}
else
{
- _acceptor = _endpoint->acceptor(const_cast<EndpointIPtr&>(_endpoint), adapterName);
- assert(_acceptor);
- _acceptor->listen();
-
- __setNoDelete(true);
- try
- {
- if(_threadPerConnection)
- {
- //
- // If we are in thread per connection mode, we also use
- // one thread per incoming connection factory, that
- // accepts new connections on this endpoint.
- //
- _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
- _threadPerIncomingConnectionFactory->start(_threadPerConnectionStackSize);
- }
- else
- {
- adapterImpl->getThreadPool()->incFdsInUse();
- }
- }
- catch(const IceUtil::Exception& ex)
- {
- if(_threadPerConnection)
- {
- Error out(_instance->initializationData().logger);
- out << "cannot create thread for incoming connection factory:\n" << ex;
- }
-
- try
- {
- _acceptor->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- __setNoDelete(false);
- ex.ice_throw();
- }
- __setNoDelete(false);
+ _acceptor = _endpoint->acceptor(const_cast<EndpointIPtr&>(_endpoint), adapterName);
+ assert(_acceptor);
+ _acceptor->listen();
+
+ __setNoDelete(true);
+ try
+ {
+ if(_threadPerConnection)
+ {
+ //
+ // If we are in thread per connection mode, we also use
+ // one thread per incoming connection factory, that
+ // accepts new connections on this endpoint.
+ //
+ _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
+ _threadPerIncomingConnectionFactory->start(_threadPerConnectionStackSize);
+ }
+ else
+ {
+ adapterImpl->getThreadPool()->incFdsInUse();
+ }
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ if(_threadPerConnection)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "cannot create thread for incoming connection factory:\n" << ex;
+ }
+
+ try
+ {
+ _acceptor->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ __setNoDelete(false);
+ ex.ice_throw();
+ }
+ __setNoDelete(false);
}
}
@@ -951,74 +951,74 @@ IceInternal::IncomingConnectionFactory::setState(State state)
{
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
switch(state)
{
- case StateActive:
- {
- if(_state != StateHolding) // Can only switch from holding to active.
- {
- return;
- }
- if(!_threadPerConnection && _acceptor)
- {
- registerWithPool();
- }
- for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&ConnectionI::activate));
- break;
- }
-
- case StateHolding:
- {
- if(_state != StateActive) // Can only switch from active to holding.
- {
- return;
- }
- if(!_threadPerConnection && _acceptor)
- {
- unregisterWithPool();
- }
- for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&ConnectionI::hold));
- break;
- }
-
- case StateClosed:
- {
- if(_acceptor)
- {
- if(_threadPerConnection)
- {
- //
- // If we are in thread per connection mode, we connect
- // to our own acceptor, which unblocks our thread per
- // incoming connection factory stuck in accept().
- //
- _acceptor->connectToSelf();
- }
- else
- {
- //
- // Otherwise we first must make sure that we are
- // registered, then we unregister, and let finished()
- // do the close.
- //
- registerWithPool();
- unregisterWithPool();
- }
- }
+ case StateActive:
+ {
+ if(_state != StateHolding) // Can only switch from holding to active.
+ {
+ return;
+ }
+ if(!_threadPerConnection && _acceptor)
+ {
+ registerWithPool();
+ }
+ for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&ConnectionI::activate));
+ break;
+ }
+
+ case StateHolding:
+ {
+ if(_state != StateActive) // Can only switch from active to holding.
+ {
+ return;
+ }
+ if(!_threadPerConnection && _acceptor)
+ {
+ unregisterWithPool();
+ }
+ for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&ConnectionI::hold));
+ break;
+ }
+
+ case StateClosed:
+ {
+ if(_acceptor)
+ {
+ if(_threadPerConnection)
+ {
+ //
+ // If we are in thread per connection mode, we connect
+ // to our own acceptor, which unblocks our thread per
+ // incoming connection factory stuck in accept().
+ //
+ _acceptor->connectToSelf();
+ }
+ else
+ {
+ //
+ // Otherwise we first must make sure that we are
+ // registered, then we unregister, and let finished()
+ // do the close.
+ //
+ registerWithPool();
+ unregisterWithPool();
+ }
+ }
#ifdef _STLP_BEGIN_NAMESPACE
- // voidbind2nd is an STLport extension for broken compilers in IceUtil/Functional.h
- for_each(_connections.begin(), _connections.end(),
- voidbind2nd(Ice::voidMemFun1(&ConnectionI::destroy), ConnectionI::ObjectAdapterDeactivated));
+ // voidbind2nd is an STLport extension for broken compilers in IceUtil/Functional.h
+ for_each(_connections.begin(), _connections.end(),
+ voidbind2nd(Ice::voidMemFun1(&ConnectionI::destroy), ConnectionI::ObjectAdapterDeactivated));
#else
- for_each(_connections.begin(), _connections.end(),
- bind2nd(Ice::voidMemFun1(&ConnectionI::destroy), ConnectionI::ObjectAdapterDeactivated));
+ for_each(_connections.begin(), _connections.end(),
+ bind2nd(Ice::voidMemFun1(&ConnectionI::destroy), ConnectionI::ObjectAdapterDeactivated));
#endif
- break;
- }
+ break;
+ }
}
_state = state;
@@ -1033,8 +1033,8 @@ IceInternal::IncomingConnectionFactory::registerWithPool()
if(!_registeredWithPool)
{
- dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->_register(_acceptor->fd(), this);
- _registeredWithPool = true;
+ dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->_register(_acceptor->fd(), this);
+ _registeredWithPool = true;
}
}
@@ -1046,9 +1046,9 @@ IceInternal::IncomingConnectionFactory::unregisterWithPool()
if(_registeredWithPool)
{
- dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->unregister(_acceptor->fd());
- _registeredWithPool = false;
- ++_finishedCount; // For each unregistration, finished() is called once.
+ dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->unregister(_acceptor->fd());
+ _registeredWithPool = false;
+ ++_finishedCount; // For each unregistration, finished() is called once.
}
}
@@ -1059,111 +1059,111 @@ IceInternal::IncomingConnectionFactory::run()
while(true)
{
- //
- // We must accept new connections outside the thread
- // synchronization, because we use blocking accept.
- //
- TransceiverPtr transceiver;
- try
- {
- transceiver = _acceptor->accept(-1);
- }
- catch(const SocketException&)
- {
- // Ignore socket exceptions.
- }
- catch(const TimeoutException&)
- {
- // Ignore timeouts.
- }
- catch(const LocalException& ex)
- {
- // Warn about other Ice local exceptions.
- if(_warn)
- {
- Warning out(_instance->initializationData().logger);
- out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
- }
- }
-
- ConnectionIPtr connection;
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- while(_state == StateHolding)
- {
- wait();
- }
-
- if(_state == StateClosed)
- {
- if(transceiver)
- {
- try
- {
- transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
- }
-
- try
- {
- _acceptor->close();
- }
- catch(const LocalException& ex)
- {
- _acceptor = 0;
- notifyAll();
- ex.ice_throw();
- }
-
- _acceptor = 0;
- notifyAll();
- return;
- }
-
- assert(_state == StateActive);
-
- //
- // Reap connections for which destruction has completed.
- //
- _connections.erase(remove_if(_connections.begin(), _connections.end(),
- Ice::constMemFun(&ConnectionI::isFinished)),
- _connections.end());
-
- //
- // Create a connection object for the connection.
- //
- if(transceiver)
- {
- try
- {
- connection = new ConnectionI(_instance, transceiver, _endpoint, _adapter, _threadPerConnection,
+ //
+ // We must accept new connections outside the thread
+ // synchronization, because we use blocking accept.
+ //
+ TransceiverPtr transceiver;
+ try
+ {
+ transceiver = _acceptor->accept(-1);
+ }
+ catch(const SocketException&)
+ {
+ // Ignore socket exceptions.
+ }
+ catch(const TimeoutException&)
+ {
+ // Ignore timeouts.
+ }
+ catch(const LocalException& ex)
+ {
+ // Warn about other Ice local exceptions.
+ if(_warn)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
+ }
+ }
+
+ ConnectionIPtr connection;
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ while(_state == StateHolding)
+ {
+ wait();
+ }
+
+ if(_state == StateClosed)
+ {
+ if(transceiver)
+ {
+ try
+ {
+ transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+ }
+
+ try
+ {
+ _acceptor->close();
+ }
+ catch(const LocalException& ex)
+ {
+ _acceptor = 0;
+ notifyAll();
+ ex.ice_throw();
+ }
+
+ _acceptor = 0;
+ notifyAll();
+ return;
+ }
+
+ assert(_state == StateActive);
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ _connections.erase(remove_if(_connections.begin(), _connections.end(),
+ Ice::constMemFun(&ConnectionI::isFinished)),
+ _connections.end());
+
+ //
+ // Create a connection object for the connection.
+ //
+ if(transceiver)
+ {
+ try
+ {
+ connection = new ConnectionI(_instance, transceiver, _endpoint, _adapter, _threadPerConnection,
_threadPerConnectionStackSize);
- }
- catch(const LocalException&)
- {
- return;
- }
-
- _connections.push_back(connection);
- }
- }
-
- //
- // In thread per connection mode, the connection's thread will
- // take care of connection validation and activation (for
- // non-datagram connections). We don't want to block this
- // thread waiting until validation is complete, because in
- // contrast to thread pool mode, it is the only thread that
- // can accept connections with this factory's
- // acceptor. Therefore we don't call validate() and activate()
- // from the connection factory in thread per connection mode.
- //
+ }
+ catch(const LocalException&)
+ {
+ return;
+ }
+
+ _connections.push_back(connection);
+ }
+ }
+
+ //
+ // In thread per connection mode, the connection's thread will
+ // take care of connection validation and activation (for
+ // non-datagram connections). We don't want to block this
+ // thread waiting until validation is complete, because in
+ // contrast to thread pool mode, it is the only thread that
+ // can accept connections with this factory's
+ // acceptor. Therefore we don't call validate() and activate()
+ // from the connection factory in thread per connection mode.
+ //
}
}
@@ -1178,22 +1178,22 @@ IceInternal::IncomingConnectionFactory::ThreadPerIncomingConnectionFactory::run(
{
try
{
- _factory->run();
+ _factory->run();
}
catch(const Exception& ex)
- {
- Error out(_factory->_instance->initializationData().logger);
- out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex;
+ {
+ Error out(_factory->_instance->initializationData().logger);
+ out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex;
}
catch(const std::exception& ex)
{
- Error out(_factory->_instance->initializationData().logger);
- out << "std::exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what();
+ Error out(_factory->_instance->initializationData().logger);
+ out << "std::exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what();
}
catch(...)
{
- Error out(_factory->_instance->initializationData().logger);
- out << "unknown exception in thread per incoming connection factory:\n" << _factory->toString();
+ Error out(_factory->_instance->initializationData().logger);
+ out << "unknown exception in thread per incoming connection factory:\n" << _factory->toString();
}
_factory = 0; // Resolve cyclic dependency.
diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h
index d7e58df05f5..7758e675b8d 100644
--- a/cpp/src/Ice/ConnectionFactory.h
+++ b/cpp/src/Ice/ConnectionFactory.h
@@ -91,15 +91,15 @@ public:
private:
IncomingConnectionFactory(const InstancePtr&, const EndpointIPtr&, const Ice::ObjectAdapterPtr&,
- const std::string&);
+ const std::string&);
virtual ~IncomingConnectionFactory();
friend class Ice::ObjectAdapterI;
enum State
{
- StateActive,
- StateHolding,
- StateClosed
+ StateActive,
+ StateHolding,
+ StateClosed
};
void setState(State);
@@ -111,13 +111,13 @@ private:
class ThreadPerIncomingConnectionFactory : public IceUtil::Thread
{
public:
-
- ThreadPerIncomingConnectionFactory(const IncomingConnectionFactoryPtr&);
- virtual void run();
+
+ ThreadPerIncomingConnectionFactory(const IncomingConnectionFactoryPtr&);
+ virtual void run();
private:
-
- IncomingConnectionFactoryPtr _factory;
+
+ IncomingConnectionFactoryPtr _factory;
};
friend class ThreadPerIncomingConnectionFactory;
IceUtil::ThreadPtr _threadPerIncomingConnectionFactory;
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index d832f87a886..22b4c28cf23 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -41,189 +41,189 @@ Ice::ConnectionI::validate()
if(!_endpoint->datagram()) // Datagram connections are always implicitly validated.
{
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(_thread && _thread->getThreadControl() != IceUtil::ThreadControl())
- {
- //
- // In thread per connection mode, this connection's thread
- // will take care of connection validation. Therefore all we
- // have to do here is to wait until this thread has completed
- // validation.
- //
- while(_state == StateNotValidated)
- {
- wait();
- }
-
- if(_state >= StateClosing)
- {
- assert(_exception.get());
- _exception->ice_throw();
- }
-
- return;
- }
-
- //
- // The connection might already be closed (e.g.: the communicator
- // was destroyed or object adapter deactivated.)
- //
- assert(_state == StateNotValidated || _state == StateClosed);
- if(_state == StateClosed)
- {
- assert(_exception.get());
- _exception->ice_throw();
- }
-
- if(_adapter)
- {
- active = true; // The server side has the active role for connection validation.
- }
- else
- {
- active = false; // The client side has the passive role for connection validation.
- }
- }
-
- try
- {
- Int timeout;
- if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
- {
- timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
- }
- else
- {
- timeout = _endpoint->timeout();
- }
-
- if(active)
- {
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
-
- BasicStream os(_instance.get());
- os.write(magic[0]);
- os.write(magic[1]);
- os.write(magic[2]);
- os.write(magic[3]);
- os.write(protocolMajor);
- os.write(protocolMinor);
- os.write(encodingMajor);
- os.write(encodingMinor);
- os.write(validateConnectionMsg);
- os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
- os.write(headerSize); // Message size.
- os.i = os.b.begin();
- traceHeader("sending validate connection", os, _logger, _traceLevels);
- try
- {
- _transceiver->initialize(timeout);
- _transceiver->write(os, timeout);
- }
- catch(const TimeoutException&)
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- }
- else
- {
- BasicStream is(_instance.get());
- is.b.resize(headerSize);
- is.i = is.b.begin();
- try
- {
- _transceiver->initialize(timeout);
- _transceiver->read(is, timeout);
- }
- catch(const TimeoutException&)
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- assert(is.i == is.b.end());
- is.i = is.b.begin();
- Byte m[4];
- is.read(m[0]);
- is.read(m[1]);
- is.read(m[2]);
- is.read(m[3]);
- if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
- {
- BadMagicException ex(__FILE__, __LINE__);
- ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic));
- throw ex;
- }
- Byte pMajor;
- Byte pMinor;
- is.read(pMajor);
- is.read(pMinor);
- if(pMajor != protocolMajor)
- {
- UnsupportedProtocolException ex(__FILE__, __LINE__);
- ex.badMajor = static_cast<unsigned char>(pMajor);
- ex.badMinor = static_cast<unsigned char>(pMinor);
- ex.major = static_cast<unsigned char>(protocolMajor);
- ex.minor = static_cast<unsigned char>(protocolMinor);
- throw ex;
- }
- Byte eMajor;
- Byte eMinor;
- is.read(eMajor);
- is.read(eMinor);
- if(eMajor != encodingMajor)
- {
- UnsupportedEncodingException ex(__FILE__, __LINE__);
- ex.badMajor = static_cast<unsigned char>(eMajor);
- ex.badMinor = static_cast<unsigned char>(eMinor);
- ex.major = static_cast<unsigned char>(encodingMajor);
- ex.minor = static_cast<unsigned char>(encodingMinor);
- throw ex;
- }
- Byte messageType;
- is.read(messageType);
- if(messageType != validateConnectionMsg)
- {
- throw ConnectionNotValidatedException(__FILE__, __LINE__);
- }
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(_thread && _thread->getThreadControl() != IceUtil::ThreadControl())
+ {
+ //
+ // In thread per connection mode, this connection's thread
+ // will take care of connection validation. Therefore all we
+ // have to do here is to wait until this thread has completed
+ // validation.
+ //
+ while(_state == StateNotValidated)
+ {
+ wait();
+ }
+
+ if(_state >= StateClosing)
+ {
+ assert(_exception.get());
+ _exception->ice_throw();
+ }
+
+ return;
+ }
+
+ //
+ // The connection might already be closed (e.g.: the communicator
+ // was destroyed or object adapter deactivated.)
+ //
+ assert(_state == StateNotValidated || _state == StateClosed);
+ if(_state == StateClosed)
+ {
+ assert(_exception.get());
+ _exception->ice_throw();
+ }
+
+ if(_adapter)
+ {
+ active = true; // The server side has the active role for connection validation.
+ }
+ else
+ {
+ active = false; // The client side has the passive role for connection validation.
+ }
+ }
+
+ try
+ {
+ Int timeout;
+ if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
+ {
+ timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
+ }
+ else
+ {
+ timeout = _endpoint->timeout();
+ }
+
+ if(active)
+ {
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
+
+ BasicStream os(_instance.get());
+ os.write(magic[0]);
+ os.write(magic[1]);
+ os.write(magic[2]);
+ os.write(magic[3]);
+ os.write(protocolMajor);
+ os.write(protocolMinor);
+ os.write(encodingMajor);
+ os.write(encodingMinor);
+ os.write(validateConnectionMsg);
+ os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
+ os.write(headerSize); // Message size.
+ os.i = os.b.begin();
+ traceHeader("sending validate connection", os, _logger, _traceLevels);
+ try
+ {
+ _transceiver->initialize(timeout);
+ _transceiver->write(os, timeout);
+ }
+ catch(const TimeoutException&)
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ }
+ else
+ {
+ BasicStream is(_instance.get());
+ is.b.resize(headerSize);
+ is.i = is.b.begin();
+ try
+ {
+ _transceiver->initialize(timeout);
+ _transceiver->read(is, timeout);
+ }
+ catch(const TimeoutException&)
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ assert(is.i == is.b.end());
+ is.i = is.b.begin();
+ Byte m[4];
+ is.read(m[0]);
+ is.read(m[1]);
+ is.read(m[2]);
+ is.read(m[3]);
+ if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
+ {
+ BadMagicException ex(__FILE__, __LINE__);
+ ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic));
+ throw ex;
+ }
+ Byte pMajor;
+ Byte pMinor;
+ is.read(pMajor);
+ is.read(pMinor);
+ if(pMajor != protocolMajor)
+ {
+ UnsupportedProtocolException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(pMajor);
+ ex.badMinor = static_cast<unsigned char>(pMinor);
+ ex.major = static_cast<unsigned char>(protocolMajor);
+ ex.minor = static_cast<unsigned char>(protocolMinor);
+ throw ex;
+ }
+ Byte eMajor;
+ Byte eMinor;
+ is.read(eMajor);
+ is.read(eMinor);
+ if(eMajor != encodingMajor)
+ {
+ UnsupportedEncodingException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(eMajor);
+ ex.badMinor = static_cast<unsigned char>(eMinor);
+ ex.major = static_cast<unsigned char>(encodingMajor);
+ ex.minor = static_cast<unsigned char>(encodingMinor);
+ throw ex;
+ }
+ Byte messageType;
+ is.read(messageType);
+ if(messageType != validateConnectionMsg)
+ {
+ throw ConnectionNotValidatedException(__FILE__, __LINE__);
+ }
Byte compress;
is.read(compress); // Ignore compression status for validate connection.
- Int size;
- is.read(size);
- if(size != headerSize)
- {
- throw IllegalMessageSizeException(__FILE__, __LINE__);
- }
- traceHeader("received validate connection", is, _logger, _traceLevels);
- }
- }
- catch(const LocalException& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
- _exception->ice_throw();
- }
- }
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
- }
-
- //
- // We start out in holding state.
- //
- setState(StateHolding);
+ Int size;
+ is.read(size);
+ if(size != headerSize)
+ {
+ throw IllegalMessageSizeException(__FILE__, __LINE__);
+ }
+ traceHeader("received validate connection", is, _logger, _traceLevels);
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
+ _exception->ice_throw();
+ }
+ }
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
+ }
+
+ //
+ // We start out in holding state.
+ //
+ setState(StateHolding);
}
}
@@ -234,7 +234,7 @@ Ice::ConnectionI::activate()
while(_state == StateNotValidated)
{
- wait();
+ wait();
}
setState(StateActive);
@@ -247,7 +247,7 @@ Ice::ConnectionI::hold()
while(_state == StateNotValidated)
{
- wait();
+ wait();
}
setState(StateHolding);
@@ -260,17 +260,17 @@ Ice::ConnectionI::destroy(DestructionReason reason)
switch(reason)
{
- case ObjectAdapterDeactivated:
- {
- setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__));
- break;
- }
+ case ObjectAdapterDeactivated:
+ {
+ setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__));
+ break;
+ }
- case CommunicatorDestroyed:
- {
- setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__));
- break;
- }
+ case CommunicatorDestroyed:
+ {
+ setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__));
+ break;
+ }
}
}
@@ -281,23 +281,23 @@ Ice::ConnectionI::close(bool force)
if(force)
{
- setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
+ setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
}
else
{
- //
- // If we do a graceful shutdown, then we wait until all
- // outstanding requests have been completed. Otherwise, the
- // CloseConnectionException will cause all outstanding
- // requests to be retried, regardless of whether the server
- // has processed them or not.
- //
- while(!_requests.empty() || !_asyncRequests.empty())
- {
- wait();
- }
-
- setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
+ //
+ // If we do a graceful shutdown, then we wait until all
+ // outstanding requests have been completed. Otherwise, the
+ // CloseConnectionException will cause all outstanding
+ // requests to be retried, regardless of whether the server
+ // has processed them or not.
+ //
+ while(!_requests.empty() || !_asyncRequests.empty())
+ {
+ wait();
+ }
+
+ setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
}
}
@@ -320,37 +320,37 @@ Ice::ConnectionI::isFinished() const
IceUtil::ThreadPtr threadPerConnection;
{
- //
- // We can use trylock here, because as long as there are still
- // threads operating in this connection object, connection
- // destruction is considered as not yet finished.
- //
- IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
-
- if(!sync.acquired())
- {
- return false;
- }
+ //
+ // We can use trylock here, because as long as there are still
+ // threads operating in this connection object, connection
+ // destruction is considered as not yet finished.
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
+
+ if(!sync.acquired())
+ {
+ return false;
+ }
- if(_transceiver || _dispatchCount != 0)
- {
- return false;
- }
+ if(_transceiver || _dispatchCount != 0)
+ {
+ return false;
+ }
- if(_thread && _thread->isAlive())
- {
- return false;
- }
+ if(_thread && _thread->isAlive())
+ {
+ return false;
+ }
- assert(_state == StateClosed);
+ assert(_state == StateClosed);
- threadPerConnection = _thread;
- _thread = 0;
+ threadPerConnection = _thread;
+ _thread = 0;
}
if(threadPerConnection)
{
- threadPerConnection->getThreadControl().join();
+ threadPerConnection->getThreadControl().join();
}
return true;
@@ -363,8 +363,8 @@ Ice::ConnectionI::throwException() const
if(_exception.get())
{
- assert(_state >= StateClosing);
- _exception->ice_throw();
+ assert(_state >= StateClosing);
+ _exception->ice_throw();
}
}
@@ -375,7 +375,7 @@ Ice::ConnectionI::waitUntilHolding() const
while(_state < StateHolding || _dispatchCount > 0)
{
- wait();
+ wait();
}
}
@@ -385,76 +385,76 @@ Ice::ConnectionI::waitUntilFinished()
IceUtil::ThreadPtr threadPerConnection;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // We wait indefinitely until connection closing has been
- // initiated. We also wait indefinitely until all outstanding
- // requests are completed. Otherwise we couldn't guarantee
- // that there are no outstanding calls when deactivate() is
- // called on the servant locators.
- //
- while(_state < StateClosing || _dispatchCount > 0)
- {
- wait();
- }
-
- //
- // Now we must wait until close() has been called on the
- // transceiver.
- //
- while(_transceiver)
- {
- if(_state != StateClosed && _endpoint->timeout() >= 0)
- {
- IceUtil::Time timeout = IceUtil::Time::milliSeconds(_endpoint->timeout());
- IceUtil::Time waitTime = _stateTime + timeout - IceUtil::Time::now();
-
- if(waitTime > IceUtil::Time())
- {
- //
- // We must wait a bit longer until we close this
- // connection.
- //
- if(!timedWait(waitTime))
- {
- setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
- }
- }
- else
- {
- //
- // We already waited long enough, so let's close this
- // connection!
- //
- setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
- }
-
- //
- // No return here, we must still wait until close() is
- // called on the _transceiver.
- //
- }
- else
- {
- wait();
- }
- }
-
- assert(_state == StateClosed);
-
- threadPerConnection = _thread;
- _thread = 0;
-
- //
- // Clear the OA. See bug 1673 for the details of why this is necessary.
- //
- _adapter = 0;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // We wait indefinitely until connection closing has been
+ // initiated. We also wait indefinitely until all outstanding
+ // requests are completed. Otherwise we couldn't guarantee
+ // that there are no outstanding calls when deactivate() is
+ // called on the servant locators.
+ //
+ while(_state < StateClosing || _dispatchCount > 0)
+ {
+ wait();
+ }
+
+ //
+ // Now we must wait until close() has been called on the
+ // transceiver.
+ //
+ while(_transceiver)
+ {
+ if(_state != StateClosed && _endpoint->timeout() >= 0)
+ {
+ IceUtil::Time timeout = IceUtil::Time::milliSeconds(_endpoint->timeout());
+ IceUtil::Time waitTime = _stateTime + timeout - IceUtil::Time::now();
+
+ if(waitTime > IceUtil::Time())
+ {
+ //
+ // We must wait a bit longer until we close this
+ // connection.
+ //
+ if(!timedWait(waitTime))
+ {
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ }
+ }
+ else
+ {
+ //
+ // We already waited long enough, so let's close this
+ // connection!
+ //
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ }
+
+ //
+ // No return here, we must still wait until close() is
+ // called on the _transceiver.
+ //
+ }
+ else
+ {
+ wait();
+ }
+ }
+
+ assert(_state == StateClosed);
+
+ threadPerConnection = _thread;
+ _thread = 0;
+
+ //
+ // Clear the OA. See bug 1673 for the details of why this is necessary.
+ //
+ _adapter = 0;
}
if(threadPerConnection)
{
- threadPerConnection->getThreadControl().join();
+ threadPerConnection->getThreadControl().join();
}
}
@@ -465,12 +465,12 @@ Ice::ConnectionI::monitor()
if(!sync.acquired())
{
- return;
+ return;
}
if(_state != StateActive)
{
- return;
+ return;
}
//
@@ -478,11 +478,11 @@ Ice::ConnectionI::monitor()
//
for(map<Int, AsyncRequest>::iterator p = _asyncRequests.begin(); p != _asyncRequests.end(); ++p)
{
- if(p->second.t > IceUtil::Time() && p->second.t <= IceUtil::Time::now())
- {
- setState(StateClosed, TimeoutException(__FILE__, __LINE__));
- return;
- }
+ if(p->second.t > IceUtil::Time() && p->second.t <= IceUtil::Time::now())
+ {
+ setState(StateClosed, TimeoutException(__FILE__, __LINE__));
+ return;
+ }
}
//
@@ -493,11 +493,11 @@ Ice::ConnectionI::monitor()
!_batchStreamInUse && _batchStream.b.empty() &&
_dispatchCount == 0)
{
- if(IceUtil::Time::now() >= _acmAbsoluteTimeout)
- {
- setState(StateClosing, ConnectionTimeoutException(__FILE__, __LINE__));
- return;
- }
+ if(IceUtil::Time::now() >= _acmAbsoluteTimeout)
+ {
+ setState(StateClosing, ConnectionTimeoutException(__FILE__, __LINE__));
+ return;
+ }
}
}
@@ -507,162 +507,162 @@ Ice::ConnectionI::sendRequest(BasicStream* os, Outgoing* out, bool compress)
Int requestId;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- assert(!(out && _endpoint->datagram())); // Twoway requests cannot be datagrams.
-
- if(_exception.get())
- {
- //
- // If the connection is closed before we even have a chance
- // to send our request, we always try to send the request
- // again.
- //
- throw LocalExceptionWrapper(*_exception.get(), true);
- }
-
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
-
- //
- // Only add to the request map if this is a twoway call.
- //
- if(out)
- {
- //
- // Create a new unique request ID.
- //
- requestId = _nextRequestId++;
- if(requestId <= 0)
- {
- _nextRequestId = 1;
- requestId = _nextRequestId++;
- }
-
- //
- // Fill in the request ID.
- //
- const Byte* p = reinterpret_cast<const Byte*>(&requestId);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ assert(!(out && _endpoint->datagram())); // Twoway requests cannot be datagrams.
+
+ if(_exception.get())
+ {
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), true);
+ }
+
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
+
+ //
+ // Only add to the request map if this is a twoway call.
+ //
+ if(out)
+ {
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ const Byte* p = reinterpret_cast<const Byte*>(&requestId);
#ifdef ICE_BIG_ENDIAN
- reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize);
+ reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize);
#else
- copy(p, p + sizeof(Int), os->b.begin() + headerSize);
+ copy(p, p + sizeof(Int), os->b.begin() + headerSize);
#endif
- //
- // Add to the requests map.
- //
- _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out));
- }
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
- }
+ //
+ // Add to the requests map.
+ //
+ _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out));
+ }
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
+ }
}
try
{
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
-
- if(compress && os->b.size() >= 100) // Only compress messages larger than 100 bytes.
- {
- //
- // Message compressed. Request compressed response, if any.
- //
- os->b[9] = 2;
-
- //
- // Do compression.
- //
- BasicStream cstream(_instance.get());
- doCompress(*os, cstream);
-
- //
- // Send the request.
- //
- os->i = os->b.begin();
- traceRequest("sending request", *os, _logger, _traceLevels);
- cstream.i = cstream.b.begin();
- _transceiver->write(cstream, _endpoint->timeout());
- }
- else
- {
- if(compress)
- {
- //
- // Message not compressed. Request compressed response, if any.
- //
- os->b[9] = 1;
- }
-
- //
- // No compression, just fill in the message size.
- //
- Int sz = static_cast<Int>(os->b.size());
- const Byte* p = reinterpret_cast<const Byte*>(&sz);
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
+
+ if(compress && os->b.size() >= 100) // Only compress messages larger than 100 bytes.
+ {
+ //
+ // Message compressed. Request compressed response, if any.
+ //
+ os->b[9] = 2;
+
+ //
+ // Do compression.
+ //
+ BasicStream cstream(_instance.get());
+ doCompress(*os, cstream);
+
+ //
+ // Send the request.
+ //
+ os->i = os->b.begin();
+ traceRequest("sending request", *os, _logger, _traceLevels);
+ cstream.i = cstream.b.begin();
+ _transceiver->write(cstream, _endpoint->timeout());
+ }
+ else
+ {
+ if(compress)
+ {
+ //
+ // Message not compressed. Request compressed response, if any.
+ //
+ os->b[9] = 1;
+ }
+
+ //
+ // No compression, just fill in the message size.
+ //
+ Int sz = static_cast<Int>(os->b.size());
+ const Byte* p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
- reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
+ reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
#else
- copy(p, p + sizeof(Int), os->b.begin() + 10);
+ copy(p, p + sizeof(Int), os->b.begin() + 10);
#endif
-
- //
- // Send the request.
- //
- os->i = os->b.begin();
- traceRequest("sending request", *os, _logger, _traceLevels);
- _transceiver->write(*os, _endpoint->timeout());
- }
+
+ //
+ // Send the request.
+ //
+ os->i = os->b.begin();
+ traceRequest("sending request", *os, _logger, _traceLevels);
+ _transceiver->write(*os, _endpoint->timeout());
+ }
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
-
- if(out)
- {
- //
- // If the request has already been removed from the
- // request map, we are out of luck. It would mean that
- // finished() has been called already, and therefore the
- // exception has been set using the Outgoing::finished()
- // callback. In this case, we cannot throw the exception
- // here, because we must not both raise an exception and
- // have Outgoing::finished() called with an
- // exception. This means that in some rare cases, a
- // request will not be retried even though it could. But I
- // honestly don't know how I could avoid this, without a
- // very elaborate and complex design, which would be bad
- // for performance.
- //
- map<Int, Outgoing*>::iterator p = _requests.find(requestId);
- if(p != _requests.end())
- {
- if(p == _requestsHint)
- {
- _requests.erase(p++);
- _requestsHint = p;
- }
- else
- {
- _requests.erase(p);
- }
-
- _exception->ice_throw();
- }
- }
- else
- {
- _exception->ice_throw();
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
+
+ if(out)
+ {
+ //
+ // If the request has already been removed from the
+ // request map, we are out of luck. It would mean that
+ // finished() has been called already, and therefore the
+ // exception has been set using the Outgoing::finished()
+ // callback. In this case, we cannot throw the exception
+ // here, because we must not both raise an exception and
+ // have Outgoing::finished() called with an
+ // exception. This means that in some rare cases, a
+ // request will not be retried even though it could. But I
+ // honestly don't know how I could avoid this, without a
+ // very elaborate and complex design, which would be bad
+ // for performance.
+ //
+ map<Int, Outgoing*>::iterator p = _requests.find(requestId);
+ if(p != _requests.end())
+ {
+ if(p == _requestsHint)
+ {
+ _requests.erase(p++);
+ _requestsHint = p;
+ }
+ else
+ {
+ _requests.erase(p);
+ }
+
+ _exception->ice_throw();
+ }
+ }
+ else
+ {
+ _exception->ice_throw();
+ }
}
}
@@ -672,156 +672,156 @@ Ice::ConnectionI::sendAsyncRequest(BasicStream* os, const OutgoingAsyncPtr& out,
Int requestId;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- assert(!_endpoint->datagram()); // Twoway requests cannot be datagrams, and async implies twoway.
-
- if(_exception.get())
- {
- //
- // If the exception is closed before we even have a chance
- // to send our request, we always try to send the request
- // again.
- //
- throw LocalExceptionWrapper(*_exception.get(), true);
- }
-
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
-
- //
- // Create a new unique request ID.
- //
- requestId = _nextRequestId++;
- if(requestId <= 0)
- {
- _nextRequestId = 1;
- requestId = _nextRequestId++;
- }
-
- //
- // Fill in the request ID.
- //
- const Byte* p = reinterpret_cast<const Byte*>(&requestId);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ assert(!_endpoint->datagram()); // Twoway requests cannot be datagrams, and async implies twoway.
+
+ if(_exception.get())
+ {
+ //
+ // If the exception is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), true);
+ }
+
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
+
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ const Byte* p = reinterpret_cast<const Byte*>(&requestId);
#ifdef ICE_BIG_ENDIAN
- reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize);
+ reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize);
#else
- copy(p, p + sizeof(Int), os->b.begin() + headerSize);
+ copy(p, p + sizeof(Int), os->b.begin() + headerSize);
#endif
-
- //
- // Add to the async requests map.
- //
- struct AsyncRequest asyncRequest;
- asyncRequest.p = out;
- if(_endpoint->timeout() > 0)
- {
- asyncRequest.t = IceUtil::Time::now() + IceUtil::Time::milliSeconds(_endpoint->timeout());
- }
- _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(),
- pair<const Int, AsyncRequest>(requestId, asyncRequest));
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
- }
+
+ //
+ // Add to the async requests map.
+ //
+ struct AsyncRequest asyncRequest;
+ asyncRequest.p = out;
+ if(_endpoint->timeout() > 0)
+ {
+ asyncRequest.t = IceUtil::Time::now() + IceUtil::Time::milliSeconds(_endpoint->timeout());
+ }
+ _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(),
+ pair<const Int, AsyncRequest>(requestId, asyncRequest));
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
+ }
}
try
{
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
-
- if(compress && os->b.size() >= 100) // Only compress messages larger than 100 bytes.
- {
- //
- // Message compressed. Request compressed response, if any.
- //
- os->b[9] = 2;
-
- //
- // Do compression.
- //
- BasicStream cstream(_instance.get());
- doCompress(*os, cstream);
-
- //
- // Send the request.
- //
- os->i = os->b.begin();
- traceRequest("sending asynchronous request", *os, _logger, _traceLevels);
- cstream.i = cstream.b.begin();
- _transceiver->write(cstream, _endpoint->timeout());
- }
- else
- {
- if(compress)
- {
- //
- // Message not compressed. Request compressed response, if any.
- //
- os->b[9] = 1;
- }
-
- //
- // No compression, just fill in the message size.
- //
- Int sz = static_cast<Int>(os->b.size());
- const Byte* p = reinterpret_cast<const Byte*>(&sz);
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
+
+ if(compress && os->b.size() >= 100) // Only compress messages larger than 100 bytes.
+ {
+ //
+ // Message compressed. Request compressed response, if any.
+ //
+ os->b[9] = 2;
+
+ //
+ // Do compression.
+ //
+ BasicStream cstream(_instance.get());
+ doCompress(*os, cstream);
+
+ //
+ // Send the request.
+ //
+ os->i = os->b.begin();
+ traceRequest("sending asynchronous request", *os, _logger, _traceLevels);
+ cstream.i = cstream.b.begin();
+ _transceiver->write(cstream, _endpoint->timeout());
+ }
+ else
+ {
+ if(compress)
+ {
+ //
+ // Message not compressed. Request compressed response, if any.
+ //
+ os->b[9] = 1;
+ }
+
+ //
+ // No compression, just fill in the message size.
+ //
+ Int sz = static_cast<Int>(os->b.size());
+ const Byte* p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
- reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
+ reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
#else
- copy(p, p + sizeof(Int), os->b.begin() + 10);
+ copy(p, p + sizeof(Int), os->b.begin() + 10);
#endif
- //
- // Send the request.
- //
- os->i = os->b.begin();
- traceRequest("sending asynchronous request", *os, _logger, _traceLevels);
- _transceiver->write(*os, _endpoint->timeout());
- }
+ //
+ // Send the request.
+ //
+ os->i = os->b.begin();
+ traceRequest("sending asynchronous request", *os, _logger, _traceLevels);
+ _transceiver->write(*os, _endpoint->timeout());
+ }
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
-
- //
- // If the request has already been removed from the async
- // request map, we are out of luck. It would mean that
- // finished() has been called already, and therefore the
- // exception has been set using the
- // OutgoingAsync::__finished() callback. In this case, we
- // cannot throw the exception here, because we must not both
- // raise an exception and have OutgoingAsync::__finished()
- // called with an exception. This means that in some rare
- // cases, a request will not be retried even though it
- // could. But I honestly don't know how I could avoid this,
- // without a very elaborate and complex design, which would be
- // bad for performance.
- //
- map<Int, AsyncRequest>::iterator p = _asyncRequests.find(requestId);
- if(p != _asyncRequests.end())
- {
- if(p == _asyncRequestsHint)
- {
- _asyncRequests.erase(p++);
- _asyncRequestsHint = p;
- }
- else
- {
- _asyncRequests.erase(p);
- }
-
- _exception->ice_throw();
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
+
+ //
+ // If the request has already been removed from the async
+ // request map, we are out of luck. It would mean that
+ // finished() has been called already, and therefore the
+ // exception has been set using the
+ // OutgoingAsync::__finished() callback. In this case, we
+ // cannot throw the exception here, because we must not both
+ // raise an exception and have OutgoingAsync::__finished()
+ // called with an exception. This means that in some rare
+ // cases, a request will not be retried even though it
+ // could. But I honestly don't know how I could avoid this,
+ // without a very elaborate and complex design, which would be
+ // bad for performance.
+ //
+ map<Int, AsyncRequest>::iterator p = _asyncRequests.find(requestId);
+ if(p != _asyncRequests.end())
+ {
+ if(p == _asyncRequestsHint)
+ {
+ _asyncRequests.erase(p++);
+ _asyncRequestsHint = p;
+ }
+ else
+ {
+ _asyncRequests.erase(p);
+ }
+
+ _exception->ice_throw();
+ }
}
}
@@ -835,12 +835,12 @@ Ice::ConnectionI::prepareBatchRequest(BasicStream* os)
//
while(_batchStreamInUse && !_exception.get())
{
- wait();
+ wait();
}
if(_exception.get())
{
- _exception->ice_throw();
+ _exception->ice_throw();
}
assert(_state > StateNotValidated);
@@ -848,15 +848,15 @@ Ice::ConnectionI::prepareBatchRequest(BasicStream* os)
if(_batchStream.b.empty())
{
- try
- {
- _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- ex.ice_throw();
- }
+ try
+ {
+ _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ ex.ice_throw();
+ }
}
_batchStreamInUse = true;
@@ -884,41 +884,41 @@ Ice::ConnectionI::finishBatchRequest(BasicStream* os, bool compress)
_batchStream.swap(*os);
if(_batchAutoFlush)
- {
- IceUtil::Mutex::Lock sendSync(_sendMutex);
- if(!_transceiver)
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
-
- //
- // Throw memory limit exception if the first message added causes us to
- // go over limit. Otherwise put aside the marshalled message that caused
- // limit to be exceeded and rollback stream to the marker.
- //
- try
- {
- _transceiver->checkSendSize(_batchStream, _instance->messageSizeMax());
- }
- catch(const Ice::Exception&)
- {
- if(_batchRequestNum == 0)
- {
- resetBatch(true);
- throw;
- }
- vector<Ice::Byte>(_batchStream.b.begin() + _batchMarker, _batchStream.b.end()).swap(lastRequest);
- _batchStream.b.resize(_batchMarker);
- autoflush = true;
- }
- }
-
- if(!autoflush)
- {
- //
- // Increment the number of requests in the batch.
- //
+ {
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+ if(!_transceiver)
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
+
+ //
+ // Throw memory limit exception if the first message added causes us to
+ // go over limit. Otherwise put aside the marshalled message that caused
+ // limit to be exceeded and rollback stream to the marker.
+ //
+ try
+ {
+ _transceiver->checkSendSize(_batchStream, _instance->messageSizeMax());
+ }
+ catch(const Ice::Exception&)
+ {
+ if(_batchRequestNum == 0)
+ {
+ resetBatch(true);
+ throw;
+ }
+ vector<Ice::Byte>(_batchStream.b.begin() + _batchMarker, _batchStream.b.end()).swap(lastRequest);
+ _batchStream.b.resize(_batchMarker);
+ autoflush = true;
+ }
+ }
+
+ if(!autoflush)
+ {
+ //
+ // Increment the number of requests in the batch.
+ //
++_batchRequestNum;
//
@@ -927,7 +927,7 @@ Ice::ConnectionI::finishBatchRequest(BasicStream* os, bool compress)
//
if(compress)
{
- _batchRequestCompress = true;
+ _batchRequestCompress = true;
}
//
@@ -942,41 +942,41 @@ Ice::ConnectionI::finishBatchRequest(BasicStream* os, bool compress)
if(autoflush)
{
//
- // We have to keep _batchStreamInUse set until after we insert the
- // saved marshalled data into a new stream.
- //
+ // We have to keep _batchStreamInUse set until after we insert the
+ // saved marshalled data into a new stream.
+ //
flushBatchRequestsInternal(true);
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- //
- // Throw memory limit exception if the message that caused us to go over
- // limit causes us to exceed the limit by itself.
- //
+ //
+ // Throw memory limit exception if the message that caused us to go over
+ // limit causes us to exceed the limit by itself.
+ //
if(sizeof(requestBatchHdr) + lastRequest.size() > _instance->messageSizeMax())
- {
- resetBatch(true);
- throw MemoryLimitException(__FILE__, __LINE__);
- }
-
- //
- // Start a new batch with the last message that caused us to
- // go over the limit.
- //
- try
- {
- _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
- _batchStream.writeBlob(&lastRequest[0], lastRequest.size());
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- ex.ice_throw();
- }
+ {
+ resetBatch(true);
+ throw MemoryLimitException(__FILE__, __LINE__);
+ }
+
+ //
+ // Start a new batch with the last message that caused us to
+ // go over the limit.
+ //
+ try
+ {
+ _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
+ _batchStream.writeBlob(&lastRequest[0], lastRequest.size());
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ ex.ice_throw();
+ }
if(compress)
{
- _batchRequestCompress = true;
+ _batchRequestCompress = true;
}
//
@@ -984,7 +984,7 @@ Ice::ConnectionI::finishBatchRequest(BasicStream* os, bool compress)
//
++_batchRequestNum;
_batchStreamInUse = false;
- notifyAll();
+ notifyAll();
}
}
@@ -1011,133 +1011,133 @@ void
Ice::ConnectionI::flushBatchRequestsInternal(bool ignoreInUse)
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(!ignoreInUse)
- {
- while(_batchStreamInUse && !_exception.get())
- {
- wait();
- }
- }
-
- if(_exception.get())
- {
- _exception->ice_throw();
- }
-
- if(_batchStream.b.empty())
- {
- return; // Nothing to do.
- }
-
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
-
- _batchStream.i = _batchStream.b.begin();
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
- }
-
- //
- // Prevent that new batch requests are added while we are
- // flushing.
- //
- _batchStreamInUse = true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(!ignoreInUse)
+ {
+ while(_batchStreamInUse && !_exception.get())
+ {
+ wait();
+ }
+ }
+
+ if(_exception.get())
+ {
+ _exception->ice_throw();
+ }
+
+ if(_batchStream.b.empty())
+ {
+ return; // Nothing to do.
+ }
+
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
+
+ _batchStream.i = _batchStream.b.begin();
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
+ }
+
+ //
+ // Prevent that new batch requests are added while we are
+ // flushing.
+ //
+ _batchStreamInUse = true;
}
try
{
- IceUtil::Mutex::Lock sendSync(_sendMutex);
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
- //
- // Fill in the number of requests in the batch.
- //
- const Byte* p = reinterpret_cast<const Byte*>(&_batchRequestNum);
+ //
+ // Fill in the number of requests in the batch.
+ //
+ const Byte* p = reinterpret_cast<const Byte*>(&_batchRequestNum);
#ifdef ICE_BIG_ENDIAN
- reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize);
+ reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize);
#else
- copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize);
+ copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize);
#endif
-
- if(_batchRequestCompress && _batchStream.b.size() >= 100) // Only compress messages larger than 100 bytes.
- {
- //
- // Message compressed. Request compressed response, if any.
- //
- _batchStream.b[9] = 2;
-
- //
- // Do compression.
- //
- BasicStream cstream(_instance.get());
- doCompress(_batchStream, cstream);
-
- //
- // Send the batch request.
- //
- _batchStream.i = _batchStream.b.begin();
- traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
- cstream.i = cstream.b.begin();
- _transceiver->write(cstream, _endpoint->timeout());
- }
- else
- {
- if(_batchRequestCompress)
- {
- //
- // Message not compressed. Request compressed response, if any.
- //
- _batchStream.b[9] = 1;
- }
-
- //
- // No compression, just fill in the message size.
- //
- Int sz = static_cast<Int>(_batchStream.b.size());
- const Byte* q = reinterpret_cast<const Byte*>(&sz);
+
+ if(_batchRequestCompress && _batchStream.b.size() >= 100) // Only compress messages larger than 100 bytes.
+ {
+ //
+ // Message compressed. Request compressed response, if any.
+ //
+ _batchStream.b[9] = 2;
+
+ //
+ // Do compression.
+ //
+ BasicStream cstream(_instance.get());
+ doCompress(_batchStream, cstream);
+
+ //
+ // Send the batch request.
+ //
+ _batchStream.i = _batchStream.b.begin();
+ traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
+ cstream.i = cstream.b.begin();
+ _transceiver->write(cstream, _endpoint->timeout());
+ }
+ else
+ {
+ if(_batchRequestCompress)
+ {
+ //
+ // Message not compressed. Request compressed response, if any.
+ //
+ _batchStream.b[9] = 1;
+ }
+
+ //
+ // No compression, just fill in the message size.
+ //
+ Int sz = static_cast<Int>(_batchStream.b.size());
+ const Byte* q = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
- reverse_copy(q, q + sizeof(Int), _batchStream.b.begin() + 10);
+ reverse_copy(q, q + sizeof(Int), _batchStream.b.begin() + 10);
#else
- copy(q, q + sizeof(Int), _batchStream.b.begin() + 10);
+ copy(q, q + sizeof(Int), _batchStream.b.begin() + 10);
#endif
-
- //
- // Send the batch request.
- //
- _batchStream.i = _batchStream.b.begin();
- traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
- _transceiver->write(_batchStream, _endpoint->timeout());
- }
+
+ //
+ // Send the batch request.
+ //
+ _batchStream.i = _batchStream.b.begin();
+ traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
+ _transceiver->write(_batchStream, _endpoint->timeout());
+ }
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
- //
- // Since batch requests are all oneways (or datagrams), we
- // must report the exception to the caller.
- //
- _exception->ice_throw();
+ //
+ // Since batch requests are all oneways (or datagrams), we
+ // must report the exception to the caller.
+ //
+ _exception->ice_throw();
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- //
- // Reset the batch stream, and notify that flushing is over.
- //
- resetBatch(!ignoreInUse);
+ //
+ // Reset the batch stream, and notify that flushing is over.
+ //
+ resetBatch(!ignoreInUse);
}
}
@@ -1167,100 +1167,100 @@ Ice::ConnectionI::sendResponse(BasicStream* os, Byte compressFlag)
{
try
{
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
-
- //
- // Only compress if compression was requested by the client,
- // and if the message is larger than 100 bytes.
- //
- if(compressFlag > 0 && os->b.size() >= 100)
- {
- //
- // Message compressed. Request compressed response, if any.
- //
- os->b[9] = 2;
-
- //
- // Do compression.
- //
- BasicStream cstream(_instance.get());
- doCompress(*os, cstream);
-
- //
- // Send the reply.
- //
- os->i = os->b.begin();
- traceReply("sending reply", *os, _logger, _traceLevels);
- cstream.i = cstream.b.begin();
- _transceiver->write(cstream, _endpoint->timeout());
- }
- else
- {
- if(compressFlag > 0)
- {
- //
- // Message not compressed. Request compressed response, if any.
- //
- os->b[9] = 1;
- }
-
- //
- // No compression, just fill in the message size.
- //
- Int sz = static_cast<Int>(os->b.size());
- const Byte* p = reinterpret_cast<const Byte*>(&sz);
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
+
+ //
+ // Only compress if compression was requested by the client,
+ // and if the message is larger than 100 bytes.
+ //
+ if(compressFlag > 0 && os->b.size() >= 100)
+ {
+ //
+ // Message compressed. Request compressed response, if any.
+ //
+ os->b[9] = 2;
+
+ //
+ // Do compression.
+ //
+ BasicStream cstream(_instance.get());
+ doCompress(*os, cstream);
+
+ //
+ // Send the reply.
+ //
+ os->i = os->b.begin();
+ traceReply("sending reply", *os, _logger, _traceLevels);
+ cstream.i = cstream.b.begin();
+ _transceiver->write(cstream, _endpoint->timeout());
+ }
+ else
+ {
+ if(compressFlag > 0)
+ {
+ //
+ // Message not compressed. Request compressed response, if any.
+ //
+ os->b[9] = 1;
+ }
+
+ //
+ // No compression, just fill in the message size.
+ //
+ Int sz = static_cast<Int>(os->b.size());
+ const Byte* p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
- reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
+ reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
#else
- copy(p, p + sizeof(Int), os->b.begin() + 10);
+ copy(p, p + sizeof(Int), os->b.begin() + 10);
#endif
-
- //
- // Send the reply.
- //
- os->i = os->b.begin();
- traceReply("sending reply", *os, _logger, _traceLevels);
- _transceiver->write(*os, _endpoint->timeout());
- }
+
+ //
+ // Send the reply.
+ //
+ os->i = os->b.begin();
+ traceReply("sending reply", *os, _logger, _traceLevels);
+ _transceiver->write(*os, _endpoint->timeout());
+ }
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- }
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- assert(_state > StateNotValidated);
-
- try
- {
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
-
- if(_acmTimeout > 0)
- {
- _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
- }
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ }
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ assert(_state > StateNotValidated);
+
+ try
+ {
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+
+ if(_acmTimeout > 0)
+ {
+ _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
}
}
@@ -1273,19 +1273,19 @@ Ice::ConnectionI::sendNoResponse()
try
{
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
}
catch(const LocalException& ex)
{
- setState(StateClosed, ex);
+ setState(StateClosed, ex);
}
}
@@ -1308,7 +1308,7 @@ Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter)
if(_exception.get())
{
- _exception->ice_throw();
+ _exception->ice_throw();
}
assert(_state < StateClosing);
@@ -1317,15 +1317,15 @@ Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter)
if(_adapter)
{
- _servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager();
- if(!_servantManager)
- {
- _adapter = 0;
- }
+ _servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager();
+ if(!_servantManager)
+ {
+ _adapter = 0;
+ }
}
else
{
- _servantManager = 0;
+ _servantManager = 0;
}
//
@@ -1351,7 +1351,7 @@ Ice::ConnectionI::createProxy(const Identity& ident) const
vector<ConnectionIPtr> connections;
connections.push_back(const_cast<ConnectionI*>(this));
ReferencePtr ref = _instance->referenceFactory()->create(ident, _instance->getDefaultContext(),
- "", Reference::ModeTwoway, connections);
+ "", Reference::ModeTwoway, connections);
return _instance->proxyFactory()->referenceToProxy(ref);
}
@@ -1396,28 +1396,28 @@ Ice::ConnectionI::message(BasicStream& stream, const ThreadPoolPtr& threadPool)
OutgoingAsyncPtr outAsync;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- //
- // We must promote within the synchronization, otherwise there
- // could be various race conditions with close connection
- // messages and other messages.
- //
- threadPool->promoteFollower();
+ //
+ // We must promote within the synchronization, otherwise there
+ // could be various race conditions with close connection
+ // messages and other messages.
+ //
+ threadPool->promoteFollower();
- if(_state != StateClosed)
- {
- parseMessage(stream, invokeNum, requestId, compress, servantManager, adapter, outAsync);
- }
+ if(_state != StateClosed)
+ {
+ parseMessage(stream, invokeNum, requestId, compress, servantManager, adapter, outAsync);
+ }
- //
- // parseMessage() can close the connection, so we must check
- // for closed state again.
- //
- if(_state == StateClosed)
- {
- return;
- }
+ //
+ // parseMessage() can close the connection, so we must check
+ // for closed state again.
+ //
+ if(_state == StateClosed)
+ {
+ return;
+ }
}
//
@@ -1426,7 +1426,7 @@ Ice::ConnectionI::message(BasicStream& stream, const ThreadPoolPtr& threadPool)
//
if(outAsync)
{
- outAsync->__finished(stream);
+ outAsync->__finished(stream);
}
//
@@ -1450,57 +1450,57 @@ Ice::ConnectionI::finished(const ThreadPoolPtr& threadPool)
map<Int, AsyncRequest> asyncRequests;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- --_finishedCount;
- assert(threadPool.get() == _threadPool.get());
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ --_finishedCount;
+ assert(threadPool.get() == _threadPool.get());
- if(_finishedCount == 0 && _state == StateClosed)
- {
- _threadPool->decFdsInUse();
+ if(_finishedCount == 0 && _state == StateClosed)
+ {
+ _threadPool->decFdsInUse();
- //
- // We must make sure that nobody is sending when we close
- // the transceiver.
- //
- IceUtil::Mutex::Lock sendSync(_sendMutex);
+ //
+ // We must make sure that nobody is sending when we close
+ // the transceiver.
+ //
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
- try
- {
- _transceiver->close();
- }
- catch(const LocalException& ex)
- {
- localEx.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
- }
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException& ex)
+ {
+ localEx.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+ }
- _transceiver = 0;
- notifyAll();
- }
+ _transceiver = 0;
+ notifyAll();
+ }
- if(_state == StateClosed || _state == StateClosing)
- {
- requests.swap(_requests);
- _requestsHint = _requests.end();
+ if(_state == StateClosed || _state == StateClosing)
+ {
+ requests.swap(_requests);
+ _requestsHint = _requests.end();
- asyncRequests.swap(_asyncRequests);
- _asyncRequestsHint = _asyncRequests.end();
- }
+ asyncRequests.swap(_asyncRequests);
+ _asyncRequestsHint = _asyncRequests.end();
+ }
}
for(map<Int, Outgoing*>::iterator p = requests.begin(); p != requests.end(); ++p)
{
- p->second->finished(*_exception.get()); // The exception is immutable at this point.
+ p->second->finished(*_exception.get()); // The exception is immutable at this point.
}
for(map<Int, AsyncRequest>::iterator q = asyncRequests.begin(); q != asyncRequests.end(); ++q)
{
- q->second.p->__finished(*_exception.get()); // The exception is immutable at this point.
+ q->second.p->__finished(*_exception.get()); // The exception is immutable at this point.
}
if(localEx.get())
{
- localEx->ice_throw();
+ localEx->ice_throw();
}
}
@@ -1524,13 +1524,13 @@ Ice::ConnectionI::invokeException(const LocalException& ex, int invokeNum)
if(invokeNum > 0)
{
- assert(_dispatchCount > 0);
- _dispatchCount -= invokeNum;
- assert(_dispatchCount >= 0);
- if(_dispatchCount == 0)
- {
- notifyAll();
- }
+ assert(_dispatchCount > 0);
+ _dispatchCount -= invokeNum;
+ assert(_dispatchCount >= 0);
+ if(_dispatchCount == 0)
+ {
+ notifyAll();
+ }
}
}
@@ -1565,9 +1565,9 @@ Ice::ConnectionI::getTransceiver() const
}
Ice::ConnectionI::ConnectionI(const InstancePtr& instance,
- const TransceiverPtr& transceiver,
- const EndpointIPtr& endpoint,
- const ObjectAdapterPtr& adapter,
+ const TransceiverPtr& transceiver,
+ const EndpointIPtr& endpoint,
+ const ObjectAdapterPtr& adapter,
bool threadPerConnection,
size_t threadPerConnectionStackSize) :
EventHandler(instance),
@@ -1601,92 +1601,92 @@ Ice::ConnectionI::ConnectionI(const InstancePtr& instance,
Int& acmTimeout = const_cast<Int&>(_acmTimeout);
if(_endpoint->datagram())
{
- acmTimeout = 0;
+ acmTimeout = 0;
}
else
{
- if(_adapter)
- {
- acmTimeout = _instance->serverACM();
- }
- else
- {
- acmTimeout = _instance->clientACM();
- }
+ if(_adapter)
+ {
+ acmTimeout = _instance->serverACM();
+ }
+ else
+ {
+ acmTimeout = _instance->clientACM();
+ }
}
int& compressionLevel = const_cast<int&>(_compressionLevel);
compressionLevel = _instance->initializationData().properties->getPropertyAsIntWithDefault(
- "Ice.Compression.Level", 1);
+ "Ice.Compression.Level", 1);
if(compressionLevel < 1)
{
- compressionLevel = 1;
+ compressionLevel = 1;
}
else if(compressionLevel > 9)
{
- compressionLevel = 9;
+ compressionLevel = 9;
}
ObjectAdapterI* adapterImpl = _adapter ? dynamic_cast<ObjectAdapterI*>(_adapter.get()) : 0;
if(adapterImpl)
{
- _servantManager = adapterImpl->getServantManager();
+ _servantManager = adapterImpl->getServantManager();
}
__setNoDelete(true);
try
{
- if(!threadPerConnection)
- {
- //
- // Only set _threadPool if we really need it, i.e., if we are
- // not in thread per connection mode. Thread pools have lazy
- // initialization in Instance, and we don't want them to be
- // created if they are not needed.
- //
- if(adapterImpl)
- {
- const_cast<ThreadPoolPtr&>(_threadPool) = adapterImpl->getThreadPool();
- }
- else
- {
- const_cast<ThreadPoolPtr&>(_threadPool) = _instance->clientThreadPool();
- }
- _threadPool->incFdsInUse();
- }
- else
- {
- //
- // If we are in thread per connection mode, create the
- // thread for this connection.
- //
- _thread = new ThreadPerConnection(this);
- _thread->start(threadPerConnectionStackSize);
- }
+ if(!threadPerConnection)
+ {
+ //
+ // Only set _threadPool if we really need it, i.e., if we are
+ // not in thread per connection mode. Thread pools have lazy
+ // initialization in Instance, and we don't want them to be
+ // created if they are not needed.
+ //
+ if(adapterImpl)
+ {
+ const_cast<ThreadPoolPtr&>(_threadPool) = adapterImpl->getThreadPool();
+ }
+ else
+ {
+ const_cast<ThreadPoolPtr&>(_threadPool) = _instance->clientThreadPool();
+ }
+ _threadPool->incFdsInUse();
+ }
+ else
+ {
+ //
+ // If we are in thread per connection mode, create the
+ // thread for this connection.
+ //
+ _thread = new ThreadPerConnection(this);
+ _thread->start(threadPerConnectionStackSize);
+ }
}
catch(const IceUtil::Exception& ex)
{
- {
- Error out(_logger);
- if(threadPerConnection)
- {
- out << "cannot create thread for connection:\n" << ex;
- }
- // Otherwise with thread pool the thread pool itself
- // prints a warning if the threads cannot be created.
- }
-
- try
- {
- _transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- __setNoDelete(false);
- ex.ice_throw();
+ {
+ Error out(_logger);
+ if(threadPerConnection)
+ {
+ out << "cannot create thread for connection:\n" << ex;
+ }
+ // Otherwise with thread pool the thread pool itself
+ // prints a warning if the threads cannot be created.
+ }
+
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ __setNoDelete(false);
+ ex.ice_throw();
}
__setNoDelete(false);
}
@@ -1710,40 +1710,40 @@ Ice::ConnectionI::setState(State state, const LocalException& ex)
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
if(!_exception.get())
{
- //
- // If we are in closed state, an exception must be set.
- //
- assert(_state != StateClosed);
-
- _exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
-
- if(_warn)
- {
- //
- // We don't warn if we are not validated.
- //
- if(_state > StateNotValidated)
- {
- //
- // Don't warn about certain expected exceptions.
- //
- if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
- dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
- dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
- dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
- (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state == StateClosing)))
- {
- Warning out(_logger);
- out << "connection exception:\n" << *_exception.get() << '\n' << _desc;
- }
- }
- }
+ //
+ // If we are in closed state, an exception must be set.
+ //
+ assert(_state != StateClosed);
+
+ _exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+
+ if(_warn)
+ {
+ //
+ // We don't warn if we are not validated.
+ //
+ if(_state > StateNotValidated)
+ {
+ //
+ // Don't warn about certain expected exceptions.
+ //
+ if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
+ dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
+ (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state == StateClosing)))
+ {
+ Warning out(_logger);
+ out << "connection exception:\n" << *_exception.get() << '\n' << _desc;
+ }
+ }
+ }
}
//
@@ -1763,7 +1763,7 @@ Ice::ConnectionI::setState(State state)
//
if(_endpoint->datagram() && state == StateClosing)
{
- state = StateClosed;
+ state = StateClosed;
}
//
@@ -1771,133 +1771,133 @@ Ice::ConnectionI::setState(State state)
//
if(_state == StateNotValidated && state == StateClosing)
{
- state = StateClosed;
+ state = StateClosed;
}
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
switch(state)
{
- case StateNotValidated:
- {
- assert(false);
- break;
- }
+ case StateNotValidated:
+ {
+ assert(false);
+ break;
+ }
- case StateActive:
- {
- //
+ case StateActive:
+ {
+ //
// Can only switch from holding or not validated to
// active.
- //
- if(_state != StateHolding && _state != StateNotValidated)
- {
- return;
- }
- if(!_threadPerConnection)
- {
- registerWithPool();
- }
- break;
- }
-
- case StateHolding:
- {
- //
- // Can only switch from active or not validated to
- // holding.
- //
- if(_state != StateActive && _state != StateNotValidated)
- {
- return;
- }
- if(!_threadPerConnection)
- {
- unregisterWithPool();
- }
- break;
- }
-
- case StateClosing:
- {
- //
- // Can't change back from closed.
- //
- if(_state == StateClosed)
- {
- return;
- }
- if(!_threadPerConnection)
- {
- registerWithPool(); // We need to continue to read in closing state.
- }
- break;
- }
-
- case StateClosed:
- {
- if(_threadPerConnection)
- {
- //
- // If we are in thread per connection mode, we
- // shutdown both for reading and writing. This will
- // unblock and read call with an exception. The thread
- // per connection then closes the transceiver.
- //
- _transceiver->shutdownReadWrite();
- }
- else if(_state == StateNotValidated)
- {
- //
- // If we change from not validated we can close right
- // away.
- //
- assert(!_registeredWithPool);
-
- _threadPool->decFdsInUse();
-
- //
- // We must make sure that nobody is sending when we
- // close the transceiver.
- //
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- try
- {
- _transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- _transceiver = 0;
- //notifyAll(); // We notify already below.
- }
- else
- {
- //
- // Otherwise we first must make sure that we are
- // registered, then we unregister, and let finished()
- // do the close.
- //
- registerWithPool();
- unregisterWithPool();
-
- //
- // We must prevent any further writes when _state == StateClosed.
- // However, functions such as sendResponse cannot acquire the main
- // mutex in order to check _state. Therefore we shut down the write
- // end of the transceiver, which causes subsequent write attempts
- // to fail with an exception.
- //
- _transceiver->shutdownWrite();
- }
- break;
- }
+ //
+ if(_state != StateHolding && _state != StateNotValidated)
+ {
+ return;
+ }
+ if(!_threadPerConnection)
+ {
+ registerWithPool();
+ }
+ break;
+ }
+
+ case StateHolding:
+ {
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(_state != StateActive && _state != StateNotValidated)
+ {
+ return;
+ }
+ if(!_threadPerConnection)
+ {
+ unregisterWithPool();
+ }
+ break;
+ }
+
+ case StateClosing:
+ {
+ //
+ // Can't change back from closed.
+ //
+ if(_state == StateClosed)
+ {
+ return;
+ }
+ if(!_threadPerConnection)
+ {
+ registerWithPool(); // We need to continue to read in closing state.
+ }
+ break;
+ }
+
+ case StateClosed:
+ {
+ if(_threadPerConnection)
+ {
+ //
+ // If we are in thread per connection mode, we
+ // shutdown both for reading and writing. This will
+ // unblock and read call with an exception. The thread
+ // per connection then closes the transceiver.
+ //
+ _transceiver->shutdownReadWrite();
+ }
+ else if(_state == StateNotValidated)
+ {
+ //
+ // If we change from not validated we can close right
+ // away.
+ //
+ assert(!_registeredWithPool);
+
+ _threadPool->decFdsInUse();
+
+ //
+ // We must make sure that nobody is sending when we
+ // close the transceiver.
+ //
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ _transceiver = 0;
+ //notifyAll(); // We notify already below.
+ }
+ else
+ {
+ //
+ // Otherwise we first must make sure that we are
+ // registered, then we unregister, and let finished()
+ // do the close.
+ //
+ registerWithPool();
+ unregisterWithPool();
+
+ //
+ // We must prevent any further writes when _state == StateClosed.
+ // However, functions such as sendResponse cannot acquire the main
+ // mutex in order to check _state. Therefore we shut down the write
+ // end of the transceiver, which causes subsequent write attempts
+ // to fail with an exception.
+ //
+ _transceiver->shutdownWrite();
+ }
+ break;
+ }
}
//
@@ -1909,14 +1909,14 @@ Ice::ConnectionI::setState(State state)
ConnectionMonitorPtr connectionMonitor = _instance->connectionMonitor();
if(connectionMonitor)
{
- if(state == StateActive)
- {
- connectionMonitor->add(this);
- }
- else if(_state == StateActive)
- {
- connectionMonitor->remove(this);
- }
+ if(state == StateActive)
+ {
+ connectionMonitor->add(this);
+ }
+ else if(_state == StateActive)
+ {
+ connectionMonitor->remove(this);
+ }
}
_state = state;
@@ -1926,14 +1926,14 @@ Ice::ConnectionI::setState(State state)
if(_state == StateClosing && _dispatchCount == 0)
{
- try
- {
- initiateShutdown();
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- }
+ try
+ {
+ initiateShutdown();
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
}
}
@@ -1945,39 +1945,39 @@ Ice::ConnectionI::initiateShutdown() const
if(!_endpoint->datagram())
{
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- //
- // Before we shut down, we send a close connection message.
- //
- BasicStream os(_instance.get());
- os.write(magic[0]);
- os.write(magic[1]);
- os.write(magic[2]);
- os.write(magic[3]);
- os.write(protocolMajor);
- os.write(protocolMinor);
- os.write(encodingMajor);
- os.write(encodingMinor);
- os.write(closeConnectionMsg);
- os.write((Byte)1); // Compression status: compression supported but not used.
- os.write(headerSize); // Message size.
-
- //
- // Send the message.
- //
- os.i = os.b.begin();
- traceHeader("sending close connection", os, _logger, _traceLevels);
- _transceiver->write(os, _endpoint->timeout());
- //
- // The CloseConnection message should be sufficient. Closing the write
- // end of the socket is probably an artifact of how things were done
- // in IIOP. In fact, shutting down the write end of the socket causes
- // problems on Windows by preventing the peer from using the socket.
- // For example, the peer is no longer able to continue writing a large
- // message after the socket is shutdown.
- //
- //_transceiver->shutdownWrite();
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ //
+ // Before we shut down, we send a close connection message.
+ //
+ BasicStream os(_instance.get());
+ os.write(magic[0]);
+ os.write(magic[1]);
+ os.write(magic[2]);
+ os.write(magic[3]);
+ os.write(protocolMajor);
+ os.write(protocolMinor);
+ os.write(encodingMajor);
+ os.write(encodingMinor);
+ os.write(closeConnectionMsg);
+ os.write((Byte)1); // Compression status: compression supported but not used.
+ os.write(headerSize); // Message size.
+
+ //
+ // Send the message.
+ //
+ os.i = os.b.begin();
+ traceHeader("sending close connection", os, _logger, _traceLevels);
+ _transceiver->write(os, _endpoint->timeout());
+ //
+ // The CloseConnection message should be sufficient. Closing the write
+ // end of the socket is probably an artifact of how things were done
+ // in IIOP. In fact, shutting down the write end of the socket causes
+ // problems on Windows by preventing the peer from using the socket.
+ // For example, the peer is no longer able to continue writing a large
+ // message after the socket is shutdown.
+ //
+ //_transceiver->shutdownWrite();
}
}
@@ -1988,8 +1988,8 @@ Ice::ConnectionI::registerWithPool()
if(!_registeredWithPool)
{
- _threadPool->_register(_transceiver->fd(), this);
- _registeredWithPool = true;
+ _threadPool->_register(_transceiver->fd(), this);
+ _registeredWithPool = true;
}
}
@@ -2000,9 +2000,9 @@ Ice::ConnectionI::unregisterWithPool()
if(_registeredWithPool)
{
- _threadPool->unregister(_transceiver->fd());
- _registeredWithPool = false;
- ++_finishedCount; // For each unregistration, finished() is called once.
+ _threadPool->unregister(_transceiver->fd());
+ _registeredWithPool = false;
+ ++_finishedCount; // For each unregistration, finished() is called once.
}
}
@@ -2011,59 +2011,59 @@ getBZ2Error(int bzError)
{
if(bzError == BZ_RUN_OK)
{
- return ": BZ_RUN_OK";
+ return ": BZ_RUN_OK";
}
else if(bzError == BZ_FLUSH_OK)
{
- return ": BZ_FLUSH_OK";
+ return ": BZ_FLUSH_OK";
}
else if(bzError == BZ_FINISH_OK)
{
- return ": BZ_FINISH_OK";
+ return ": BZ_FINISH_OK";
}
else if(bzError == BZ_STREAM_END)
{
- return ": BZ_STREAM_END";
+ return ": BZ_STREAM_END";
}
else if(bzError == BZ_CONFIG_ERROR)
{
- return ": BZ_CONFIG_ERROR";
+ return ": BZ_CONFIG_ERROR";
}
else if(bzError == BZ_SEQUENCE_ERROR)
{
- return ": BZ_SEQUENCE_ERROR";
+ return ": BZ_SEQUENCE_ERROR";
}
else if(bzError == BZ_PARAM_ERROR)
{
- return ": BZ_PARAM_ERROR";
+ return ": BZ_PARAM_ERROR";
}
else if(bzError == BZ_MEM_ERROR)
{
- return ": BZ_MEM_ERROR";
+ return ": BZ_MEM_ERROR";
}
else if(bzError == BZ_DATA_ERROR)
{
- return ": BZ_DATA_ERROR";
+ return ": BZ_DATA_ERROR";
}
else if(bzError == BZ_DATA_ERROR_MAGIC)
{
- return ": BZ_DATA_ERROR_MAGIC";
+ return ": BZ_DATA_ERROR_MAGIC";
}
else if(bzError == BZ_IO_ERROR)
{
- return ": BZ_IO_ERROR";
+ return ": BZ_IO_ERROR";
}
else if(bzError == BZ_UNEXPECTED_EOF)
{
- return ": BZ_UNEXPECTED_EOF";
+ return ": BZ_UNEXPECTED_EOF";
}
else if(bzError == BZ_OUTBUFF_FULL)
{
- return ": BZ_OUTBUFF_FULL";
+ return ": BZ_OUTBUFF_FULL";
}
else
{
- return "";
+ return "";
}
}
@@ -2079,15 +2079,15 @@ Ice::ConnectionI::doCompress(BasicStream& uncompressed, BasicStream& compressed)
unsigned int compressedLen = static_cast<unsigned int>(uncompressedLen * 1.01 + 600);
compressed.b.resize(headerSize + sizeof(Int) + compressedLen);
int bzError = BZ2_bzBuffToBuffCompress(reinterpret_cast<char*>(&compressed.b[0]) + headerSize + sizeof(Int),
- &compressedLen,
- reinterpret_cast<char*>(&uncompressed.b[0]) + headerSize,
- uncompressedLen,
- _compressionLevel, 0, 0);
+ &compressedLen,
+ reinterpret_cast<char*>(&uncompressed.b[0]) + headerSize,
+ uncompressedLen,
+ _compressionLevel, 0, 0);
if(bzError != BZ_OK)
{
- CompressionException ex(__FILE__, __LINE__);
- ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError);
- throw ex;
+ CompressionException ex(__FILE__, __LINE__);
+ ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError);
+ throw ex;
}
compressed.b.resize(headerSize + sizeof(Int) + compressedLen);
@@ -2130,22 +2130,22 @@ Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompresse
compressed.read(uncompressedSize);
if(uncompressedSize <= headerSize)
{
- throw IllegalMessageSizeException(__FILE__, __LINE__);
+ throw IllegalMessageSizeException(__FILE__, __LINE__);
}
uncompressed.resize(uncompressedSize);
unsigned int uncompressedLen = uncompressedSize - headerSize;
unsigned int compressedLen = static_cast<unsigned int>(compressed.b.size() - headerSize - sizeof(Int));
int bzError = BZ2_bzBuffToBuffDecompress(reinterpret_cast<char*>(&uncompressed.b[0]) + headerSize,
- &uncompressedLen,
- reinterpret_cast<char*>(&compressed.b[0]) + headerSize + sizeof(Int),
- compressedLen,
- 0, 0);
+ &uncompressedLen,
+ reinterpret_cast<char*>(&compressed.b[0]) + headerSize + sizeof(Int),
+ compressedLen,
+ 0, 0);
if(bzError != BZ_OK)
{
- CompressionException ex(__FILE__, __LINE__);
- ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError);
- throw ex;
+ CompressionException ex(__FILE__, __LINE__);
+ ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError);
+ throw ex;
}
copy(compressed.b.begin(), compressed.b.begin() + headerSize, uncompressed.b.begin());
@@ -2153,222 +2153,222 @@ Ice::ConnectionI::doUncompress(BasicStream& compressed, BasicStream& uncompresse
void
Ice::ConnectionI::parseMessage(BasicStream& stream, Int& invokeNum, Int& requestId, Byte& compress,
- ServantManagerPtr& servantManager, ObjectAdapterPtr& adapter,
- OutgoingAsyncPtr& outAsync)
+ ServantManagerPtr& servantManager, ObjectAdapterPtr& adapter,
+ OutgoingAsyncPtr& outAsync)
{
assert(_state > StateNotValidated && _state < StateClosed);
if(_acmTimeout > 0)
{
- _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
+ _acmAbsoluteTimeout = IceUtil::Time::now() + IceUtil::Time::seconds(_acmTimeout);
}
try
{
- //
- // We don't need to check magic and version here. This has
- // already been done by the ThreadPool or the
- // ThreadPerConnection, which provides us with the stream.
- //
- assert(stream.i == stream.b.end());
- stream.i = stream.b.begin() + 8;
- Byte messageType;
- stream.read(messageType);
- stream.read(compress);
- if(compress == 2)
- {
- BasicStream ustream(_instance.get());
- doUncompress(stream, ustream);
- stream.b.swap(ustream.b);
- }
- stream.i = stream.b.begin() + headerSize;
+ //
+ // We don't need to check magic and version here. This has
+ // already been done by the ThreadPool or the
+ // ThreadPerConnection, which provides us with the stream.
+ //
+ assert(stream.i == stream.b.end());
+ stream.i = stream.b.begin() + 8;
+ Byte messageType;
+ stream.read(messageType);
+ stream.read(compress);
+ if(compress == 2)
+ {
+ BasicStream ustream(_instance.get());
+ doUncompress(stream, ustream);
+ stream.b.swap(ustream.b);
+ }
+ stream.i = stream.b.begin() + headerSize;
- switch(messageType)
- {
- case closeConnectionMsg:
- {
- traceHeader("received close connection", stream, _logger, _traceLevels);
- if(_endpoint->datagram())
- {
- if(_warn)
- {
- Warning out(_logger);
- out << "ignoring close connection message for datagram connection:\n" << _desc;
- }
- }
- else
- {
- setState(StateClosed, CloseConnectionException(__FILE__, __LINE__));
- }
- break;
- }
-
- case requestMsg:
- {
- if(_state == StateClosing)
- {
- traceRequest("received request during closing\n"
- "(ignored by server, client will retry)",
- stream, _logger, _traceLevels);
- }
- else
- {
- traceRequest("received request", stream, _logger, _traceLevels);
- stream.read(requestId);
- invokeNum = 1;
- servantManager = _servantManager;
- adapter = _adapter;
- ++_dispatchCount;
- }
- break;
- }
-
- case requestBatchMsg:
- {
- if(_state == StateClosing)
- {
- traceBatchRequest("received batch request during closing\n"
- "(ignored by server, client will retry)",
- stream, _logger, _traceLevels);
- }
- else
- {
- traceBatchRequest("received batch request", stream, _logger, _traceLevels);
- stream.read(invokeNum);
- if(invokeNum < 0)
- {
- invokeNum = 0;
- throw NegativeSizeException(__FILE__, __LINE__);
- }
- servantManager = _servantManager;
- adapter = _adapter;
- _dispatchCount += invokeNum;
- }
- break;
- }
-
- case replyMsg:
- {
- traceReply("received reply", stream, _logger, _traceLevels);
-
- stream.read(requestId);
-
- map<Int, Outgoing*>::iterator p = _requests.end();
- map<Int, AsyncRequest>::iterator q = _asyncRequests.end();
-
- if(_requestsHint != _requests.end())
- {
- if(_requestsHint->first == requestId)
- {
- p = _requestsHint;
- }
- }
-
- if(p == _requests.end())
- {
- if(_asyncRequestsHint != _asyncRequests.end())
- {
- if(_asyncRequestsHint->first == requestId)
- {
- q = _asyncRequestsHint;
- }
- }
- }
-
- if(p == _requests.end() && q == _asyncRequests.end())
- {
- p = _requests.find(requestId);
- }
-
- if(p == _requests.end() && q == _asyncRequests.end())
- {
- q = _asyncRequests.find(requestId);
- }
-
- if(p == _requests.end() && q == _asyncRequests.end())
- {
- throw UnknownRequestIdException(__FILE__, __LINE__);
- }
-
- if(p != _requests.end())
- {
- p->second->finished(stream);
-
- if(p == _requestsHint)
- {
- _requests.erase(p++);
- _requestsHint = p;
- }
- else
- {
- _requests.erase(p);
- }
- }
- else
- {
- assert(q != _asyncRequests.end());
-
- outAsync = q->second.p;
-
- if(q == _asyncRequestsHint)
- {
- _asyncRequests.erase(q++);
- _asyncRequestsHint = q;
- }
- else
- {
- _asyncRequests.erase(q);
- }
- }
-
- break;
- }
-
- case validateConnectionMsg:
- {
- traceHeader("received validate connection", stream, _logger, _traceLevels);
- if(_warn)
- {
- Warning out(_logger);
- out << "ignoring unexpected validate connection message:\n" << _desc;
- }
- break;
- }
-
- default:
- {
- traceHeader("received unknown message\n"
- "(invalid, closing connection)",
- stream, _logger, _traceLevels);
- throw UnknownMessageException(__FILE__, __LINE__);
- break;
- }
- }
+ switch(messageType)
+ {
+ case closeConnectionMsg:
+ {
+ traceHeader("received close connection", stream, _logger, _traceLevels);
+ if(_endpoint->datagram())
+ {
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "ignoring close connection message for datagram connection:\n" << _desc;
+ }
+ }
+ else
+ {
+ setState(StateClosed, CloseConnectionException(__FILE__, __LINE__));
+ }
+ break;
+ }
+
+ case requestMsg:
+ {
+ if(_state == StateClosing)
+ {
+ traceRequest("received request during closing\n"
+ "(ignored by server, client will retry)",
+ stream, _logger, _traceLevels);
+ }
+ else
+ {
+ traceRequest("received request", stream, _logger, _traceLevels);
+ stream.read(requestId);
+ invokeNum = 1;
+ servantManager = _servantManager;
+ adapter = _adapter;
+ ++_dispatchCount;
+ }
+ break;
+ }
+
+ case requestBatchMsg:
+ {
+ if(_state == StateClosing)
+ {
+ traceBatchRequest("received batch request during closing\n"
+ "(ignored by server, client will retry)",
+ stream, _logger, _traceLevels);
+ }
+ else
+ {
+ traceBatchRequest("received batch request", stream, _logger, _traceLevels);
+ stream.read(invokeNum);
+ if(invokeNum < 0)
+ {
+ invokeNum = 0;
+ throw NegativeSizeException(__FILE__, __LINE__);
+ }
+ servantManager = _servantManager;
+ adapter = _adapter;
+ _dispatchCount += invokeNum;
+ }
+ break;
+ }
+
+ case replyMsg:
+ {
+ traceReply("received reply", stream, _logger, _traceLevels);
+
+ stream.read(requestId);
+
+ map<Int, Outgoing*>::iterator p = _requests.end();
+ map<Int, AsyncRequest>::iterator q = _asyncRequests.end();
+
+ if(_requestsHint != _requests.end())
+ {
+ if(_requestsHint->first == requestId)
+ {
+ p = _requestsHint;
+ }
+ }
+
+ if(p == _requests.end())
+ {
+ if(_asyncRequestsHint != _asyncRequests.end())
+ {
+ if(_asyncRequestsHint->first == requestId)
+ {
+ q = _asyncRequestsHint;
+ }
+ }
+ }
+
+ if(p == _requests.end() && q == _asyncRequests.end())
+ {
+ p = _requests.find(requestId);
+ }
+
+ if(p == _requests.end() && q == _asyncRequests.end())
+ {
+ q = _asyncRequests.find(requestId);
+ }
+
+ if(p == _requests.end() && q == _asyncRequests.end())
+ {
+ throw UnknownRequestIdException(__FILE__, __LINE__);
+ }
+
+ if(p != _requests.end())
+ {
+ p->second->finished(stream);
+
+ if(p == _requestsHint)
+ {
+ _requests.erase(p++);
+ _requestsHint = p;
+ }
+ else
+ {
+ _requests.erase(p);
+ }
+ }
+ else
+ {
+ assert(q != _asyncRequests.end());
+
+ outAsync = q->second.p;
+
+ if(q == _asyncRequestsHint)
+ {
+ _asyncRequests.erase(q++);
+ _asyncRequestsHint = q;
+ }
+ else
+ {
+ _asyncRequests.erase(q);
+ }
+ }
+
+ break;
+ }
+
+ case validateConnectionMsg:
+ {
+ traceHeader("received validate connection", stream, _logger, _traceLevels);
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "ignoring unexpected validate connection message:\n" << _desc;
+ }
+ break;
+ }
+
+ default:
+ {
+ traceHeader("received unknown message\n"
+ "(invalid, closing connection)",
+ stream, _logger, _traceLevels);
+ throw UnknownMessageException(__FILE__, __LINE__);
+ break;
+ }
+ }
}
catch(const SocketException& ex)
{
- exception(ex);
+ exception(ex);
}
catch(const LocalException& ex)
{
- if(_endpoint->datagram())
- {
- if(_warn)
- {
- Warning out(_logger);
- out << "datagram connection exception:\n" << ex << '\n' << _desc;
- }
- }
- else
- {
- setState(StateClosed, ex);
- }
+ if(_endpoint->datagram())
+ {
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "datagram connection exception:\n" << ex << '\n' << _desc;
+ }
+ }
+ else
+ {
+ setState(StateClosed, ex);
+ }
}
}
void
Ice::ConnectionI::invokeAll(BasicStream& stream, Int invokeNum, Int requestId, Byte compress,
- const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter)
+ const ServantManagerPtr& servantManager, const ObjectAdapterPtr& adapter)
{
//
// Note: In contrast to other private or protected methods, this
@@ -2377,45 +2377,45 @@ Ice::ConnectionI::invokeAll(BasicStream& stream, Int invokeNum, Int requestId, B
try
{
- while(invokeNum > 0)
- {
- //
- // Prepare the invocation.
- //
- bool response = !_endpoint->datagram() && requestId != 0;
- Incoming in(_instance.get(), this, adapter, response, compress, requestId);
- BasicStream* is = in.is();
- stream.swap(*is);
- BasicStream* os = in.os();
-
- //
- // Prepare the response if necessary.
- //
- if(response)
- {
- assert(invokeNum == 1); // No further invocations if a response is expected.
- os->writeBlob(replyHdr, sizeof(replyHdr));
-
- //
- // Add the request ID.
- //
- os->write(requestId);
- }
-
- in.invoke(servantManager);
-
- //
- // If there are more invocations, we need the stream back.
- //
- if(--invokeNum > 0)
- {
- stream.swap(*is);
- }
- }
+ while(invokeNum > 0)
+ {
+ //
+ // Prepare the invocation.
+ //
+ bool response = !_endpoint->datagram() && requestId != 0;
+ Incoming in(_instance.get(), this, adapter, response, compress, requestId);
+ BasicStream* is = in.is();
+ stream.swap(*is);
+ BasicStream* os = in.os();
+
+ //
+ // Prepare the response if necessary.
+ //
+ if(response)
+ {
+ assert(invokeNum == 1); // No further invocations if a response is expected.
+ os->writeBlob(replyHdr, sizeof(replyHdr));
+
+ //
+ // Add the request ID.
+ //
+ os->write(requestId);
+ }
+
+ in.invoke(servantManager);
+
+ //
+ // If there are more invocations, we need the stream back.
+ //
+ if(--invokeNum > 0)
+ {
+ stream.swap(*is);
+ }
+ }
}
catch(const LocalException& ex)
{
- invokeException(ex, invokeNum); // Fatal invocation exception
+ invokeException(ex, invokeNum); // Fatal invocation exception
}
}
@@ -2430,40 +2430,40 @@ Ice::ConnectionI::run()
//
if(!_endpoint->datagram())
{
- try
- {
- validate();
- }
- catch(const LocalException&)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- assert(_state == StateClosed);
-
- //
- // We must make sure that nobody is sending when we close
- // the transceiver.
- //
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- if(_transceiver)
- {
- try
- {
- _transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- _transceiver = 0;
- }
- notifyAll();
- return;
- }
-
- activate();
+ try
+ {
+ validate();
+ }
+ catch(const LocalException&)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ assert(_state == StateClosed);
+
+ //
+ // We must make sure that nobody is sending when we close
+ // the transceiver.
+ //
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ if(_transceiver)
+ {
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ _transceiver = 0;
+ }
+ notifyAll();
+ return;
+ }
+
+ activate();
}
const bool warnUdp = _instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Datagrams") > 0;
@@ -2472,213 +2472,213 @@ Ice::ConnectionI::run()
while(!closed)
{
- //
- // We must accept new connections outside the thread
- // synchronization, because we use blocking accept.
- //
-
- BasicStream stream(_instance.get());
-
- try
- {
- stream.b.resize(headerSize);
- stream.i = stream.b.begin();
- _transceiver->read(stream, -1);
-
- ptrdiff_t pos = stream.i - stream.b.begin();
- if(pos < headerSize)
- {
- //
- // This situation is possible for small UDP packets.
- //
- throw IllegalMessageSizeException(__FILE__, __LINE__);
- }
- stream.i = stream.b.begin();
- const Byte* header;
- stream.readBlob(header, headerSize);
- if(header[0] != magic[0] || header[1] != magic[1] || header[2] != magic[2] || header[3] != magic[3])
- {
- BadMagicException ex(__FILE__, __LINE__);
- ex.badMagic = Ice::ByteSeq(&header[0], &header[0] + sizeof(magic));
- throw ex;
- }
- if(header[4] != protocolMajor)
- {
- UnsupportedProtocolException ex(__FILE__, __LINE__);
- ex.badMajor = static_cast<unsigned char>(header[4]);
- ex.badMinor = static_cast<unsigned char>(header[5]);
- ex.major = static_cast<unsigned char>(protocolMajor);
- ex.minor = static_cast<unsigned char>(protocolMinor);
- throw ex;
- }
- if(header[6] != encodingMajor)
- {
- UnsupportedEncodingException ex(__FILE__, __LINE__);
- ex.badMajor = static_cast<unsigned char>(header[6]);
- ex.badMinor = static_cast<unsigned char>(header[7]);
- ex.major = static_cast<unsigned char>(encodingMajor);
- ex.minor = static_cast<unsigned char>(encodingMinor);
- throw ex;
- }
-
- Int size;
- stream.i -= sizeof(Int);
- stream.read(size);
- if(size < headerSize)
- {
- throw IllegalMessageSizeException(__FILE__, __LINE__);
- }
- if(size > static_cast<Int>(_instance->messageSizeMax()))
- {
- throw MemoryLimitException(__FILE__, __LINE__);
- }
- if(size > static_cast<Int>(stream.b.size()))
- {
- stream.b.resize(size);
- }
- stream.i = stream.b.begin() + pos;
-
- if(stream.i != stream.b.end())
- {
- if(_endpoint->datagram())
- {
- if(warnUdp)
- {
- Warning out(_logger);
- out << "DatagramLimitException: maximum size of " << pos << " exceeded";
- }
- throw DatagramLimitException(__FILE__, __LINE__);
- }
- else
- {
- _transceiver->read(stream, -1);
- assert(stream.i == stream.b.end());
- }
- }
- }
- catch(const DatagramLimitException&) // Expected.
- {
- continue;
- }
- catch(const SocketException& ex)
- {
- exception(ex);
- }
- catch(const LocalException& ex)
- {
- if(_endpoint->datagram())
- {
- if(_warn)
- {
- Warning out(_logger);
- out << "datagram connection exception:\n" << ex << '\n' << _desc;
- }
- continue;
- }
- else
- {
- exception(ex);
- }
- }
-
- Byte compress = 0;
- Int requestId = 0;
- Int invokeNum = 0;
- ServantManagerPtr servantManager;
- ObjectAdapterPtr adapter;
- OutgoingAsyncPtr outAsync;
-
- auto_ptr<LocalException> localEx;
-
- map<Int, Outgoing*> requests;
- map<Int, AsyncRequest> asyncRequests;
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- while(_state == StateHolding)
- {
- wait();
- }
-
- if(_state != StateClosed)
- {
- parseMessage(stream, invokeNum, requestId, compress, servantManager, adapter, outAsync);
- }
-
- //
+ //
+ // We must accept new connections outside the thread
+ // synchronization, because we use blocking accept.
+ //
+
+ BasicStream stream(_instance.get());
+
+ try
+ {
+ stream.b.resize(headerSize);
+ stream.i = stream.b.begin();
+ _transceiver->read(stream, -1);
+
+ ptrdiff_t pos = stream.i - stream.b.begin();
+ if(pos < headerSize)
+ {
+ //
+ // This situation is possible for small UDP packets.
+ //
+ throw IllegalMessageSizeException(__FILE__, __LINE__);
+ }
+ stream.i = stream.b.begin();
+ const Byte* header;
+ stream.readBlob(header, headerSize);
+ if(header[0] != magic[0] || header[1] != magic[1] || header[2] != magic[2] || header[3] != magic[3])
+ {
+ BadMagicException ex(__FILE__, __LINE__);
+ ex.badMagic = Ice::ByteSeq(&header[0], &header[0] + sizeof(magic));
+ throw ex;
+ }
+ if(header[4] != protocolMajor)
+ {
+ UnsupportedProtocolException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(header[4]);
+ ex.badMinor = static_cast<unsigned char>(header[5]);
+ ex.major = static_cast<unsigned char>(protocolMajor);
+ ex.minor = static_cast<unsigned char>(protocolMinor);
+ throw ex;
+ }
+ if(header[6] != encodingMajor)
+ {
+ UnsupportedEncodingException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(header[6]);
+ ex.badMinor = static_cast<unsigned char>(header[7]);
+ ex.major = static_cast<unsigned char>(encodingMajor);
+ ex.minor = static_cast<unsigned char>(encodingMinor);
+ throw ex;
+ }
+
+ Int size;
+ stream.i -= sizeof(Int);
+ stream.read(size);
+ if(size < headerSize)
+ {
+ throw IllegalMessageSizeException(__FILE__, __LINE__);
+ }
+ if(size > static_cast<Int>(_instance->messageSizeMax()))
+ {
+ throw MemoryLimitException(__FILE__, __LINE__);
+ }
+ if(size > static_cast<Int>(stream.b.size()))
+ {
+ stream.b.resize(size);
+ }
+ stream.i = stream.b.begin() + pos;
+
+ if(stream.i != stream.b.end())
+ {
+ if(_endpoint->datagram())
+ {
+ if(warnUdp)
+ {
+ Warning out(_logger);
+ out << "DatagramLimitException: maximum size of " << pos << " exceeded";
+ }
+ throw DatagramLimitException(__FILE__, __LINE__);
+ }
+ else
+ {
+ _transceiver->read(stream, -1);
+ assert(stream.i == stream.b.end());
+ }
+ }
+ }
+ catch(const DatagramLimitException&) // Expected.
+ {
+ continue;
+ }
+ catch(const SocketException& ex)
+ {
+ exception(ex);
+ }
+ catch(const LocalException& ex)
+ {
+ if(_endpoint->datagram())
+ {
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "datagram connection exception:\n" << ex << '\n' << _desc;
+ }
+ continue;
+ }
+ else
+ {
+ exception(ex);
+ }
+ }
+
+ Byte compress = 0;
+ Int requestId = 0;
+ Int invokeNum = 0;
+ ServantManagerPtr servantManager;
+ ObjectAdapterPtr adapter;
+ OutgoingAsyncPtr outAsync;
+
+ auto_ptr<LocalException> localEx;
+
+ map<Int, Outgoing*> requests;
+ map<Int, AsyncRequest> asyncRequests;
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ while(_state == StateHolding)
+ {
+ wait();
+ }
+
+ if(_state != StateClosed)
+ {
+ parseMessage(stream, invokeNum, requestId, compress, servantManager, adapter, outAsync);
+ }
+
+ //
// parseMessage() can close the connection, so we must
// check for closed state again.
- //
- if(_state == StateClosed)
- {
- //
- // We must make sure that nobody is sending when we close
- // the transceiver.
- //
- IceUtil::Mutex::Lock sendSync(_sendMutex);
-
- try
- {
- _transceiver->close();
- }
- catch(const LocalException& ex)
- {
- localEx.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
- }
-
- _transceiver = 0;
- notifyAll();
-
- //
- // We cannot simply return here. We have to make sure
- // that all requests (regular and async) are notified
- // about the closed connection below.
- //
- closed = true;
- }
-
- if(_state == StateClosed || _state == StateClosing)
- {
- requests.swap(_requests);
- _requestsHint = _requests.end();
-
- asyncRequests.swap(_asyncRequests);
- _asyncRequestsHint = _asyncRequests.end();
- }
- }
-
- //
- // Asynchronous replies must be handled outside the thread
- // synchronization, so that nested calls are possible.
- //
- if(outAsync)
- {
- outAsync->__finished(stream);
- }
-
- //
- // Method invocation (or multiple invocations for batch messages)
- // must be done outside the thread synchronization, so that nested
- // calls are possible.
- //
- invokeAll(stream, invokeNum, requestId, compress, servantManager, adapter);
-
- for(map<Int, Outgoing*>::iterator p = requests.begin(); p != requests.end(); ++p)
- {
- p->second->finished(*_exception.get()); // The exception is immutable at this point.
- }
-
- for(map<Int, AsyncRequest>::iterator q = asyncRequests.begin(); q != asyncRequests.end(); ++q)
- {
- q->second.p->__finished(*_exception.get()); // The exception is immutable at this point.
- }
-
- if(localEx.get())
- {
- assert(closed);
- localEx->ice_throw();
- }
+ //
+ if(_state == StateClosed)
+ {
+ //
+ // We must make sure that nobody is sending when we close
+ // the transceiver.
+ //
+ IceUtil::Mutex::Lock sendSync(_sendMutex);
+
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException& ex)
+ {
+ localEx.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+ }
+
+ _transceiver = 0;
+ notifyAll();
+
+ //
+ // We cannot simply return here. We have to make sure
+ // that all requests (regular and async) are notified
+ // about the closed connection below.
+ //
+ closed = true;
+ }
+
+ if(_state == StateClosed || _state == StateClosing)
+ {
+ requests.swap(_requests);
+ _requestsHint = _requests.end();
+
+ asyncRequests.swap(_asyncRequests);
+ _asyncRequestsHint = _asyncRequests.end();
+ }
+ }
+
+ //
+ // Asynchronous replies must be handled outside the thread
+ // synchronization, so that nested calls are possible.
+ //
+ if(outAsync)
+ {
+ outAsync->__finished(stream);
+ }
+
+ //
+ // Method invocation (or multiple invocations for batch messages)
+ // must be done outside the thread synchronization, so that nested
+ // calls are possible.
+ //
+ invokeAll(stream, invokeNum, requestId, compress, servantManager, adapter);
+
+ for(map<Int, Outgoing*>::iterator p = requests.begin(); p != requests.end(); ++p)
+ {
+ p->second->finished(*_exception.get()); // The exception is immutable at this point.
+ }
+
+ for(map<Int, AsyncRequest>::iterator q = asyncRequests.begin(); q != asyncRequests.end(); ++q)
+ {
+ q->second.p->__finished(*_exception.get()); // The exception is immutable at this point.
+ }
+
+ if(localEx.get())
+ {
+ assert(closed);
+ localEx->ice_throw();
+ }
}
}
@@ -2700,19 +2700,19 @@ Ice::ConnectionI::ThreadPerConnection::run()
_connection->run();
}
catch(const Exception& ex)
- {
- Error out(_connection->_logger);
- out << "exception in thread per connection:\n" << _connection->toString() << ex;
+ {
+ Error out(_connection->_logger);
+ out << "exception in thread per connection:\n" << _connection->toString() << ex;
}
catch(const std::exception& ex)
{
- Error out(_connection->_logger);
- out << "std::exception in thread per connection:\n" << _connection->toString() << ex.what();
+ Error out(_connection->_logger);
+ out << "std::exception in thread per connection:\n" << _connection->toString() << ex.what();
}
catch(...)
{
- Error out(_connection->_logger);
- out << "unknown exception in thread per connection:\n" << _connection->toString();
+ Error out(_connection->_logger);
+ out << "unknown exception in thread per connection:\n" << _connection->toString();
}
if(_connection->_instance->initializationData().threadHook)
diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h
index 626f1c776be..f07841c5632 100644
--- a/cpp/src/Ice/ConnectionI.h
+++ b/cpp/src/Ice/ConnectionI.h
@@ -40,15 +40,15 @@ namespace Ice
class LocalException;
class ICE_API ConnectionI : public Connection, public IceInternal::EventHandler,
- public IceUtil::Monitor<IceUtil::Mutex>
+ public IceUtil::Monitor<IceUtil::Mutex>
{
public:
void validate();
enum DestructionReason
{
- ObjectAdapterDeactivated,
- CommunicatorDestroyed
+ ObjectAdapterDeactivated,
+ CommunicatorDestroyed
};
void activate();
void hold();
@@ -103,18 +103,18 @@ public:
private:
ConnectionI(const IceInternal::InstancePtr&, const IceInternal::TransceiverPtr&,
- const IceInternal::EndpointIPtr&, const ObjectAdapterPtr&, bool, size_t);
+ const IceInternal::EndpointIPtr&, const ObjectAdapterPtr&, bool, size_t);
virtual ~ConnectionI();
friend class IceInternal::IncomingConnectionFactory;
friend class IceInternal::OutgoingConnectionFactory;
enum State
{
- StateNotValidated,
- StateActive,
- StateHolding,
- StateClosing,
- StateClosed
+ StateNotValidated,
+ StateActive,
+ StateHolding,
+ StateClosing,
+ StateClosed
};
void resetBatch(bool);
@@ -132,22 +132,22 @@ private:
void doUncompress(IceInternal::BasicStream&, IceInternal::BasicStream&);
void parseMessage(IceInternal::BasicStream&, Int&, Int&, Byte&,
- IceInternal::ServantManagerPtr&, ObjectAdapterPtr&, IceInternal::OutgoingAsyncPtr&);
+ IceInternal::ServantManagerPtr&, ObjectAdapterPtr&, IceInternal::OutgoingAsyncPtr&);
void invokeAll(IceInternal::BasicStream&, Int, Int, Byte,
- const IceInternal::ServantManagerPtr&, const ObjectAdapterPtr&);
+ const IceInternal::ServantManagerPtr&, const ObjectAdapterPtr&);
void run(); // For thread per connection.
class ThreadPerConnection : public IceUtil::Thread
{
public:
-
- ThreadPerConnection(const ConnectionIPtr&);
- virtual void run();
+
+ ThreadPerConnection(const ConnectionIPtr&);
+ virtual void run();
private:
-
- ConnectionIPtr _connection;
+
+ ConnectionIPtr _connection;
};
friend class ThreadPerConnection;
// Defined as mutable because "isFinished() const" sets this to 0.
@@ -183,8 +183,8 @@ private:
struct AsyncRequest
{
- IceInternal::OutgoingAsyncPtr p;
- IceUtil::Time t;
+ IceInternal::OutgoingAsyncPtr p;
+ IceUtil::Time t;
};
std::map<Int, AsyncRequest> _asyncRequests;
std::map<Int, AsyncRequest>::iterator _asyncRequestsHint;
diff --git a/cpp/src/Ice/ConnectionMonitor.cpp b/cpp/src/Ice/ConnectionMonitor.cpp
index d67962fb9e9..3c9eee7845a 100644
--- a/cpp/src/Ice/ConnectionMonitor.cpp
+++ b/cpp/src/Ice/ConnectionMonitor.cpp
@@ -24,13 +24,13 @@ void
IceInternal::ConnectionMonitor::destroy()
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- assert(_instance);
- _instance = 0;
- _connections.clear();
-
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ assert(_instance);
+ _instance = 0;
+ _connections.clear();
+
+ notify();
}
getThreadControl().join();
@@ -71,53 +71,53 @@ IceInternal::ConnectionMonitor::run()
{
while(true)
{
- set<ConnectionIPtr> connections;
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(_instance && !timedWait(_interval))
- {
- connections = _connections;
- }
+ set<ConnectionIPtr> connections;
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(_instance && !timedWait(_interval))
+ {
+ connections = _connections;
+ }
- if(!_instance)
- {
- return;
- }
- }
-
- //
- // Monitor connections outside the thread synchronization, so
- // that connections can be added or removed during monitoring.
- //
- for(set<ConnectionIPtr>::const_iterator p = connections.begin(); p != connections.end(); ++p)
- {
- try
- {
- (*p)->monitor();
- }
- catch(const Exception& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(!_instance)
- {
- return;
- }
+ if(!_instance)
+ {
+ return;
+ }
+ }
+
+ //
+ // Monitor connections outside the thread synchronization, so
+ // that connections can be added or removed during monitoring.
+ //
+ for(set<ConnectionIPtr>::const_iterator p = connections.begin(); p != connections.end(); ++p)
+ {
+ try
+ {
+ (*p)->monitor();
+ }
+ catch(const Exception& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(!_instance)
+ {
+ return;
+ }
- Error out(_instance->initializationData().logger);
- out << "exception in connection monitor:\n" << ex;
- }
- catch(...)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(!_instance)
- {
- return;
- }
+ Error out(_instance->initializationData().logger);
+ out << "exception in connection monitor:\n" << ex;
+ }
+ catch(...)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(!_instance)
+ {
+ return;
+ }
- Error out(_instance->initializationData().logger);
- out << "unknown exception in connection monitor";
- }
- }
+ Error out(_instance->initializationData().logger);
+ out << "unknown exception in connection monitor";
+ }
+ }
}
}
diff --git a/cpp/src/Ice/DLLMain.cpp b/cpp/src/Ice/DLLMain.cpp
index 55f94abae45..dab9d417bb4 100755
--- a/cpp/src/Ice/DLLMain.cpp
+++ b/cpp/src/Ice/DLLMain.cpp
@@ -34,7 +34,7 @@ ice_DLL_Main(HINSTANCE hDLL, DWORD reason, LPVOID reserved)
}
else if(reason == DLL_THREAD_DETACH)
{
- Ice::ImplicitContextI::cleanupThread();
+ Ice::ImplicitContextI::cleanupThread();
}
return TRUE;
diff --git a/cpp/src/Ice/DefaultsAndOverrides.cpp b/cpp/src/Ice/DefaultsAndOverrides.cpp
index 04f5508d903..64bcd99b63b 100644
--- a/cpp/src/Ice/DefaultsAndOverrides.cpp
+++ b/cpp/src/Ice/DefaultsAndOverrides.cpp
@@ -38,33 +38,33 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro
value = properties->getProperty("Ice.Override.Timeout");
if(!value.empty())
{
- const_cast<bool&>(overrideTimeout) = true;
- const_cast<Int&>(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout");
+ const_cast<bool&>(overrideTimeout) = true;
+ const_cast<Int&>(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout");
}
value = properties->getProperty("Ice.Override.ConnectTimeout");
if(!value.empty())
{
- const_cast<bool&>(overrideConnectTimeout) = true;
- const_cast<Int&>(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout");
+ const_cast<bool&>(overrideConnectTimeout) = true;
+ const_cast<Int&>(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout");
}
value = properties->getProperty("Ice.Override.Compress");
if(!value.empty())
{
- const_cast<bool&>(overrideCompress) = true;
- const_cast<bool&>(overrideCompressValue) = properties->getPropertyAsInt("Ice.Override.Compress");
+ const_cast<bool&>(overrideCompress) = true;
+ const_cast<bool&>(overrideCompressValue) = properties->getPropertyAsInt("Ice.Override.Compress");
}
value = properties->getProperty("Ice.Override.Secure");
if(!value.empty())
{
- const_cast<bool&>(overrideSecure) = true;
- const_cast<bool&>(overrideSecureValue) = properties->getPropertyAsInt("Ice.Override.Secure");
+ const_cast<bool&>(overrideSecure) = true;
+ const_cast<bool&>(overrideSecureValue) = properties->getPropertyAsInt("Ice.Override.Secure");
}
const_cast<bool&>(defaultCollocationOptimization) =
- properties->getPropertyAsIntWithDefault("Ice.Default.CollocationOptimization", 1) > 0;
+ properties->getPropertyAsIntWithDefault("Ice.Default.CollocationOptimization", 1) > 0;
value = properties->getPropertyWithDefault("Ice.Default.EndpointSelection", "Random");
if(value == "Random")
@@ -83,8 +83,8 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro
}
const_cast<int&>(defaultLocatorCacheTimeout) =
- properties->getPropertyAsIntWithDefault("Ice.Default.LocatorCacheTimeout", -1);
+ properties->getPropertyAsIntWithDefault("Ice.Default.LocatorCacheTimeout", -1);
const_cast<bool&>(defaultPreferSecure) =
- properties->getPropertyAsIntWithDefault("Ice.Default.PreferSecure", 0) > 0;
+ properties->getPropertyAsIntWithDefault("Ice.Default.PreferSecure", 0) > 0;
}
diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp
index d27825ab907..b25c85fb9e1 100644
--- a/cpp/src/Ice/Direct.cpp
+++ b/cpp/src/Ice/Direct.cpp
@@ -39,55 +39,55 @@ IceInternal::Direct::Direct(const Current& current) :
try
{
- _servant = servantManager->findServant(_current.id, _current.facet);
- if(!_servant)
- {
- _locator = servantManager->findServantLocator(_current.id.category);
- if(!_locator && !_current.id.category.empty())
- {
- _locator = servantManager->findServantLocator("");
- }
- if(_locator)
- {
- _servant = _locator->locate(_current, _cookie);
- }
- }
- if(!_servant)
- {
- if(servantManager && servantManager->hasServant(_current.id))
- {
- FacetNotExistException ex(__FILE__, __LINE__);
- ex.id = _current.id;
- ex.facet = _current.facet;
- ex.operation = _current.operation;
- throw ex;
- }
- else
- {
- ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = _current.id;
- ex.facet = _current.facet;
- ex.operation = _current.operation;
- throw ex;
- }
- }
+ _servant = servantManager->findServant(_current.id, _current.facet);
+ if(!_servant)
+ {
+ _locator = servantManager->findServantLocator(_current.id.category);
+ if(!_locator && !_current.id.category.empty())
+ {
+ _locator = servantManager->findServantLocator("");
+ }
+ if(_locator)
+ {
+ _servant = _locator->locate(_current, _cookie);
+ }
+ }
+ if(!_servant)
+ {
+ if(servantManager && servantManager->hasServant(_current.id))
+ {
+ FacetNotExistException ex(__FILE__, __LINE__);
+ ex.id = _current.id;
+ ex.facet = _current.facet;
+ ex.operation = _current.operation;
+ throw ex;
+ }
+ else
+ {
+ ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = _current.id;
+ ex.facet = _current.facet;
+ ex.operation = _current.operation;
+ throw ex;
+ }
+ }
}
catch(...)
{
- if(_locator && _servant)
- {
- try
- {
- _locator->finished(_current, _servant, _cookie);
- }
- catch(...)
- {
- adapter->decDirectCount();
- throw;
- }
- }
- adapter->decDirectCount();
- throw;
+ if(_locator && _servant)
+ {
+ try
+ {
+ _locator->finished(_current, _servant, _cookie);
+ }
+ catch(...)
+ {
+ adapter->decDirectCount();
+ throw;
+ }
+ }
+ adapter->decDirectCount();
+ throw;
}
}
@@ -104,15 +104,15 @@ IceInternal::Direct::destroy()
if(_locator && _servant)
{
- try
- {
- _locator->finished(_current, _servant, _cookie);
- }
- catch(...)
- {
- adapter->decDirectCount();
- throw;
- }
+ try
+ {
+ _locator->finished(_current, _servant, _cookie);
+ }
+ catch(...)
+ {
+ adapter->decDirectCount();
+ throw;
+ }
}
adapter->decDirectCount();
diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp
index d1b25c1a46c..769b0368b19 100644
--- a/cpp/src/Ice/DynamicLibrary.cpp
+++ b/cpp/src/Ice/DynamicLibrary.cpp
@@ -66,21 +66,21 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
libName = libSpec;
if(useIceVersion)
{
- int majorVersion = (ICE_INT_VERSION / 10000);
- int minorVersion = (ICE_INT_VERSION / 100) - majorVersion * 100;
- ostringstream os;
- os << majorVersion * 10 + minorVersion;
+ int majorVersion = (ICE_INT_VERSION / 10000);
+ int minorVersion = (ICE_INT_VERSION / 100) - majorVersion * 100;
+ ostringstream os;
+ os << majorVersion * 10 + minorVersion;
- int patchVersion = ICE_INT_VERSION % 100;
- if(patchVersion > 50)
- {
- os << 'b';
- if(patchVersion >= 52)
- {
- os << (patchVersion - 50);
- }
- }
- version = os.str();
+ int patchVersion = ICE_INT_VERSION % 100;
+ if(patchVersion > 50)
+ {
+ os << 'b';
+ if(patchVersion >= 52)
+ {
+ os << (patchVersion - 50);
+ }
+ }
+ version = os.str();
}
}
else
@@ -101,7 +101,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
lib = "lib" + libName;
if(!version.empty())
{
- lib += "." + version;
+ lib += "." + version;
}
lib += ".dylib";
#elif defined(__hpux)
@@ -112,7 +112,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc
}
else
{
- lib += ".sl";
+ lib += ".sl";
}
#elif defined(_AIX)
lib = "lib" + libName + ".a(lib" + libName + ".so";
diff --git a/cpp/src/Ice/EndpointFactoryManager.cpp b/cpp/src/Ice/EndpointFactoryManager.cpp
index bb8a784e9ab..25db4169e20 100644
--- a/cpp/src/Ice/EndpointFactoryManager.cpp
+++ b/cpp/src/Ice/EndpointFactoryManager.cpp
@@ -75,8 +75,8 @@ IceInternal::EndpointFactoryManager::create(const string& str) const
if(beg == string::npos)
{
EndpointParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
+ ex.str = str;
+ throw ex;
}
string::size_type end = str.find_first_of(delim, beg);
diff --git a/cpp/src/Ice/EventLoggerI.cpp b/cpp/src/Ice/EventLoggerI.cpp
index a61325f1463..c626e62c83f 100755
--- a/cpp/src/Ice/EventLoggerI.cpp
+++ b/cpp/src/Ice/EventLoggerI.cpp
@@ -70,7 +70,7 @@ Ice::EventLoggerI::EventLoggerI(const string& appName) :
// "EventMessageFile" key should contain the path to this DLL.
//
err = RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ,
- (unsigned char*)path, static_cast<DWORD>(strlen(path) + 1));
+ (unsigned char*)path, static_cast<DWORD>(strlen(path) + 1));
if(err != ERROR_SUCCESS)
{
RegCloseKey(hKey);
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index d43712b6658..3141a604d3e 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -56,7 +56,7 @@ Ice::InitializationException::ice_print(ostream& out) const
out << ":\ninitialization exception";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -67,7 +67,7 @@ Ice::UnknownException::ice_print(ostream& out) const
out << ":\nunknown exception";
if(!unknown.empty())
{
- out << ":\n" << unknown;
+ out << ":\n" << unknown;
}
}
@@ -78,7 +78,7 @@ Ice::UnknownLocalException::ice_print(ostream& out) const
out << ":\nunknown local exception";
if(!unknown.empty())
{
- out << ":\n" << unknown;
+ out << ":\n" << unknown;
}
}
@@ -89,7 +89,7 @@ Ice::UnknownUserException::ice_print(ostream& out) const
out << ":\nunknown user exception";
if(!unknown.empty())
{
- out << ":\n" << unknown;
+ out << ":\n" << unknown;
}
}
@@ -238,11 +238,11 @@ Ice::SocketException::ice_print(ostream& out) const
out << ":\nsocket exception: ";
if(error == 0)
{
- out << "unknown error";
+ out << "unknown error";
}
else
{
- out << errorToString(error);
+ out << errorToString(error);
}
}
@@ -253,7 +253,7 @@ Ice::FileException::ice_print(ostream& out) const
out << ":\nfile exception: " << errorToString(error);
if(!path.empty())
{
- out << "\npath: " << path;
+ out << "\npath: " << path;
}
}
@@ -278,11 +278,11 @@ Ice::ConnectionLostException::ice_print(ostream& out) const
out << ":\nconnection lost: ";
if(error == 0)
{
- out << "recv() returned zero";
+ out << "recv() returned zero";
}
else
{
- out << errorToString(error);
+ out << errorToString(error);
}
}
@@ -328,7 +328,7 @@ Ice::ProtocolException::ice_print(ostream& out) const
out << ":\nprotocol exception";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -338,23 +338,23 @@ Ice::BadMagicException::ice_print(ostream& out) const
Exception::ice_print(out);
out << ":\nunknown magic number: ";
- ios_base::fmtflags originalFlags = out.flags(); // Save stream state
+ ios_base::fmtflags originalFlags = out.flags(); // Save stream state
ostream::char_type originalFill = out.fill();
- out.flags(ios_base::hex); // Change to hex
- out.fill('0'); // Fill with leading zeros
+ out.flags(ios_base::hex); // Change to hex
+ out.fill('0'); // Fill with leading zeros
out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[0])) << ", ";
out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[1])) << ", ";
out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[2])) << ", ";
out << "0x" << setw(2) << static_cast<unsigned int>(static_cast<unsigned char>(badMagic[3]));
- out.fill(originalFill); // Restore stream state
+ out.fill(originalFill); // Restore stream state
out.flags(originalFlags);
if(!reason.empty())
{
- out << "\n" << reason;
+ out << "\n" << reason;
}
}
@@ -374,7 +374,7 @@ Ice::UnsupportedEncodingException::ice_print(ostream& out) const
out << "\n(can only support encodings compatible with version " << major << "." << major << ")";
if(!reason.empty())
{
- out << "\n" << reason;
+ out << "\n" << reason;
}
}
@@ -385,7 +385,7 @@ Ice::UnknownMessageException::ice_print(ostream& out) const
out << ":\nprotocol error: unknown message type";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -396,7 +396,7 @@ Ice::ConnectionNotValidatedException::ice_print(ostream& out) const
out << ":\nprotocol error: received message over unvalidated connection";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -407,7 +407,7 @@ Ice::UnknownRequestIdException::ice_print(ostream& out) const
out << ":\nprotocol error: unknown request id";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -418,7 +418,7 @@ Ice::UnknownReplyStatusException::ice_print(ostream& out) const
out << ":\nprotocol error: unknown reply status";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -429,7 +429,7 @@ Ice::CloseConnectionException::ice_print(ostream& out) const
out << ":\nprotocol error: connection closed";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -440,7 +440,7 @@ Ice::ForcedCloseConnectionException::ice_print(ostream& out) const
out << ":\nprotocol error: connection forcefully closed";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -451,7 +451,7 @@ Ice::IllegalMessageSizeException::ice_print(ostream& out) const
out << ":\nprotocol error: illegal message size";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -462,7 +462,7 @@ Ice::CompressionException::ice_print(ostream& out) const
out << ":\nprotocol error: failed to compress or uncompress data";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -473,7 +473,7 @@ Ice::DatagramLimitException::ice_print(ostream& out) const
out << ":\nprotocol error: maximum datagram payload size exceeded";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -484,7 +484,7 @@ Ice::MarshalException::ice_print(ostream& out) const
out << ":\nprotocol error: error during marshaling or unmarshaling";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -495,7 +495,7 @@ Ice::ProxyUnmarshalException::ice_print(ostream& out) const
out << ":\nprotocol error: inconsistent proxy data during unmarshaling";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -506,7 +506,7 @@ Ice::UnmarshalOutOfBoundsException::ice_print(ostream& out) const
out << ":\nprotocol error: out of bounds during unmarshaling";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -517,7 +517,7 @@ Ice::IllegalIndirectionException::ice_print(ostream& out) const
out << ":\nprotocol error: encountered illegal protocol indirection";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -528,21 +528,21 @@ Ice::NoObjectFactoryException::ice_print(ostream& out) const
out << ":\nprotocol error: no suitable object factory found for `" << type << "'";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
-}
+}
void
Ice::UnexpectedObjectException::ice_print(ostream& out) const
{
Exception::ice_print(out);
out << ":\nunexpected class instance of type `" << type <<
- "'; expected instance of type `" << expectedType << "'";
+ "'; expected instance of type `" << expectedType << "'";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
-}
+}
void
Ice::MemoryLimitException::ice_print(ostream& out) const
@@ -551,7 +551,7 @@ Ice::MemoryLimitException::ice_print(ostream& out) const
out << ":\nprotocol error: memory limit exceeded";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -562,7 +562,7 @@ Ice::StringConversionException::ice_print(ostream& out) const
out << ":\nprotocol error: string conversion failed";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -573,7 +573,7 @@ Ice::EncapsulationException::ice_print(ostream& out) const
out << ":\nprotocol error: illegal encapsulation";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -584,7 +584,7 @@ Ice::NegativeSizeException::ice_print(ostream& out) const
out << ":\nprotocol error: negative size for sequence, dictionary, etc.";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
@@ -656,7 +656,7 @@ Ice::SecurityException::ice_print(ostream& out) const
out << ":\nsecurity exception";
if(!reason.empty())
{
- out << ":\n" << reason;
+ out << ":\n" << reason;
}
}
diff --git a/cpp/src/Ice/FactoryTableDef.cpp b/cpp/src/Ice/FactoryTableDef.cpp
index e31a7fd0a7e..9241c8da8d6 100644
--- a/cpp/src/Ice/FactoryTableDef.cpp
+++ b/cpp/src/Ice/FactoryTableDef.cpp
@@ -17,11 +17,11 @@
namespace IceInternal
{
-FactoryTableWrapper factoryTableWrapper; // Single global instance of the wrapper object that
- // initializes factoryTable.
+FactoryTableWrapper factoryTableWrapper; // Single global instance of the wrapper object that
+ // initializes factoryTable.
-ICE_API FactoryTableDef* factoryTable; // Single global instance of the factory table for
- // non-local exceptions and non-abstract classes
+ICE_API FactoryTableDef* factoryTable; // Single global instance of the factory table for
+ // non-local exceptions and non-abstract classes
}
//
@@ -35,11 +35,11 @@ IceInternal::FactoryTableDef::addExceptionFactory(const std::string& t, const Ic
EFTable::iterator i = _eft.find(t);
if(i == _eft.end())
{
- _eft[t] = EFPair(f, 1);
+ _eft[t] = EFPair(f, 1);
}
else
{
- i->second.second++;
+ i->second.second++;
}
}
@@ -54,23 +54,23 @@ IceInternal::FactoryTableDef::getExceptionFactory(const std::string& t) const
#ifdef __APPLE__
if(i == _eft.end())
{
- lock.release();
-
- //
- // Try to find the symbol, if found this should trigger the
- // object static constructors to be called.
- //
- std::string symbol = "__F";
- for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
- {
- symbol += ((*p) == ':') ? '_' : *p;
- }
- symbol += "__initializer";
- dlsym(RTLD_DEFAULT, symbol.c_str());
-
- lock.acquire();
-
- i = _eft.find(t);
+ lock.release();
+
+ //
+ // Try to find the symbol, if found this should trigger the
+ // object static constructors to be called.
+ //
+ std::string symbol = "__F";
+ for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
+ {
+ symbol += ((*p) == ':') ? '_' : *p;
+ }
+ symbol += "__initializer";
+ dlsym(RTLD_DEFAULT, symbol.c_str());
+
+ lock.acquire();
+
+ i = _eft.find(t);
}
#endif
return i != _eft.end() ? i->second.first : IceInternal::UserExceptionFactoryPtr();
@@ -89,10 +89,10 @@ IceInternal::FactoryTableDef::removeExceptionFactory(const std::string& t)
EFTable::iterator i = _eft.find(t);
if(i != _eft.end())
{
- if(--i->second.second == 0)
- {
- _eft.erase(i);
- }
+ if(--i->second.second == 0)
+ {
+ _eft.erase(i);
+ }
}
}
@@ -106,11 +106,11 @@ IceInternal::FactoryTableDef::addObjectFactory(const std::string& t, const Ice::
OFTable::iterator i = _oft.find(t);
if(i == _oft.end())
{
- _oft[t] = OFPair(f, 1);
+ _oft[t] = OFPair(f, 1);
}
else
{
- i->second.second++;
+ i->second.second++;
}
}
@@ -125,23 +125,23 @@ IceInternal::FactoryTableDef::getObjectFactory(const std::string& t) const
#ifdef __APPLE__
if(i == _oft.end())
{
- lock.release();
-
- //
- // Try to find the symbol, if found this should trigger the
- // object static constructors to be called.
- //
- std::string symbol = "__F";
- for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
- {
- symbol += ((*p) == ':') ? '_' : *p;
- }
- symbol += "__initializer";
- dlsym(RTLD_DEFAULT, symbol.c_str());
-
- lock.acquire();
-
- i = _oft.find(t);
+ lock.release();
+
+ //
+ // Try to find the symbol, if found this should trigger the
+ // object static constructors to be called.
+ //
+ std::string symbol = "__F";
+ for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
+ {
+ symbol += ((*p) == ':') ? '_' : *p;
+ }
+ symbol += "__initializer";
+ dlsym(RTLD_DEFAULT, symbol.c_str());
+
+ lock.acquire();
+
+ i = _oft.find(t);
}
#endif
return i != _oft.end() ? i->second.first : Ice::ObjectFactoryPtr();
@@ -160,10 +160,10 @@ IceInternal::FactoryTableDef::removeObjectFactory(const std::string& t)
OFTable::iterator i = _oft.find(t);
if(i != _oft.end())
{
- if(--i->second.second == 0)
- {
- _oft.erase(i);
- }
+ if(--i->second.second == 0)
+ {
+ _oft.erase(i);
+ }
}
}
@@ -193,7 +193,7 @@ IceInternal::FactoryTableWrapper::initialize()
IceUtil::StaticMutex::Lock lock(_m);
if(_initCount == 0)
{
- factoryTable = new FactoryTableDef;
+ factoryTable = new FactoryTableDef;
}
++_initCount;
}
@@ -207,9 +207,9 @@ IceInternal::FactoryTableWrapper::finalize()
IceUtil::StaticMutex::Lock lock(_m);
if(--_initCount == 0)
{
- delete factoryTable;
+ delete factoryTable;
}
}
IceUtil::StaticMutex IceInternal::FactoryTableWrapper::_m = ICE_STATIC_MUTEX_INITIALIZER;
-int IceInternal::FactoryTableWrapper::_initCount = 0; // Initialization count
+int IceInternal::FactoryTableWrapper::_initCount = 0; // Initialization count
diff --git a/cpp/src/Ice/GC.cpp b/cpp/src/Ice/GC.cpp
index 432a34a7469..605997439a5 100755
--- a/cpp/src/Ice/GC.cpp
+++ b/cpp/src/Ice/GC.cpp
@@ -35,14 +35,14 @@ recursivelyReachable(GCShared* p, GCObjectSet& o)
{
if(o.find(p) == o.end())
{
- assert(p);
- o.insert(p);
- GCCountMap tmp;
- p->__gcReachable(tmp);
- for(GCCountMap::const_iterator i = tmp.begin(); i != tmp.end(); ++i)
- {
- recursivelyReachable(i->first, o);
- }
+ assert(p);
+ o.insert(p);
+ GCCountMap tmp;
+ p->__gcReachable(tmp);
+ for(GCCountMap::const_iterator i = tmp.begin(); i != tmp.end(); ++i)
+ {
+ recursivelyReachable(i->first, o);
+ }
}
}
@@ -82,13 +82,13 @@ IceInternal::GCShared::__decRef()
assert(_ref > 0);
if(--_ref == 0)
{
- doDelete = !_noDelete;
- _noDelete = true;
+ doDelete = !_noDelete;
+ _noDelete = true;
}
lock.release();
if(doDelete)
{
- delete this;
+ delete this;
}
}
@@ -114,10 +114,10 @@ IceInternal::GCShared::__gcIncRef()
if(_ref == 0)
{
#ifdef NDEBUG // To avoid annoying warnings about variables that are not used...
- gcObjects.insert(this);
+ gcObjects.insert(this);
#else
- std::pair<GCObjectSet::iterator, bool> rc = gcObjects.insert(this);
- assert(rc.second);
+ std::pair<GCObjectSet::iterator, bool> rc = gcObjects.insert(this);
+ assert(rc.second);
#endif
}
++_ref;
@@ -131,19 +131,19 @@ IceInternal::GCShared::__gcDecRef()
assert(_ref > 0);
if(--_ref == 0)
{
- doDelete = !_noDelete;
- _noDelete = true;
+ doDelete = !_noDelete;
+ _noDelete = true;
#ifdef NDEBUG // To avoid annoying warnings about variables that are not used...
- gcObjects.erase(this);
+ gcObjects.erase(this);
#else
- GCObjectSet::size_type num = gcObjects.erase(this);
- assert(num == 1);
+ GCObjectSet::size_type num = gcObjects.erase(this);
+ assert(num == 1);
#endif
}
lock.release();
if(doDelete)
{
- delete this;
+ delete this;
}
}
@@ -158,7 +158,7 @@ IceInternal::GC::GC(int interval, StatsCallback cb)
StaticMutex::Lock sync(numCollectorsMutex);
if(numCollectors++ > 0)
{
- abort(); // Enforce singleton.
+ abort(); // Enforce singleton.
}
_state = NotStarted;
@@ -179,33 +179,33 @@ IceInternal::GC::run()
assert(_interval > 0);
{
- Monitor<Mutex>::Lock sync(*this);
+ Monitor<Mutex>::Lock sync(*this);
- _state = Started;
- notify();
+ _state = Started;
+ notify();
}
Time waitTime = Time::seconds(_interval);
while(true)
{
- bool collect = false;
- {
- Monitor<Mutex>::Lock sync(*this);
-
- if(_state == Stopping)
- {
- _state = Stopped;
- return;
- }
- if(!timedWait(waitTime))
- {
- collect = true;
- }
- }
- if(collect)
- {
- collectGarbage();
- }
+ bool collect = false;
+ {
+ Monitor<Mutex>::Lock sync(*this);
+
+ if(_state == Stopping)
+ {
+ _state = Stopped;
+ return;
+ }
+ if(!timedWait(waitTime))
+ {
+ collect = true;
+ }
+ }
+ if(collect)
+ {
+ collectGarbage();
+ }
}
}
@@ -213,32 +213,32 @@ void
IceInternal::GC::stop()
{
{
- Monitor<Mutex>::Lock sync(*this);
-
- if(_state >= Stopping)
- {
- return; // Don't attempt to stop the thread twice.
- }
-
- //
- // Wait until the thread is actually started. (If we don't do this, we
- // can get a problem if a call to stop() immediately follows a call to start():
- // the call to stop() may happen before pthread_create() has scheduled the thread's run()
- // function, and then the notify() that is used to tell the thread to stop can be lost.
- //
- while(_state < Started)
- {
- wait();
- }
+ Monitor<Mutex>::Lock sync(*this);
+
+ if(_state >= Stopping)
+ {
+ return; // Don't attempt to stop the thread twice.
+ }
+
+ //
+ // Wait until the thread is actually started. (If we don't do this, we
+ // can get a problem if a call to stop() immediately follows a call to start():
+ // the call to stop() may happen before pthread_create() has scheduled the thread's run()
+ // function, and then the notify() that is used to tell the thread to stop can be lost.
+ //
+ while(_state < Started)
+ {
+ wait();
+ }
}
//
// Tell the thread to stop.
//
{
- Monitor<Mutex>::Lock sync(*this);
- _state = Stopping;
- notify();
+ Monitor<Mutex>::Lock sync(*this);
+ _state = Stopping;
+ notify();
}
getThreadControl().join();
@@ -252,13 +252,13 @@ IceInternal::GC::collectGarbage()
// Do nothing if the collector is running already.
//
{
- Monitor<Mutex>::Lock sync(*this);
+ Monitor<Mutex>::Lock sync(*this);
- if(_collecting)
- {
- return;
- }
- _collecting = true;
+ if(_collecting)
+ {
+ return;
+ }
+ _collecting = true;
}
RecMutex::Lock sync(gcRecMutex); // Prevent any further class reference count activity.
@@ -268,108 +268,108 @@ IceInternal::GC::collectGarbage()
if(_statsCallback)
{
- t = Time::now();
- stats.examined = static_cast<int>(gcObjects.size());
+ t = Time::now();
+ stats.examined = static_cast<int>(gcObjects.size());
}
GCCountMap counts;
{
- //
- // gcObjects contains the set of class instances that have at least one member of class type,
- // that is, gcObjects contains all those instances that can point at other instances.
- //
- // Create a map that, for each object in gcObjects, contains an <object, refcount> pair.
- // In addition, for each object in gcObjects, add the objects that are immediately (not
- // recursively) reachable from that object to a reachable map that counts how many times
- // the object is pointed at.
- //
- GCCountMap reachable;
- {
- for(GCObjectSet::const_iterator i = gcObjects.begin(); i != gcObjects.end(); ++i)
- {
- counts.insert(GCCountMap::value_type(*i, (*i)->__getRefUnsafe()));
- (*i)->__gcReachable(reachable);
- }
- }
-
- //
- // Decrement the reference count for each object in the counts map by the count in the reachable
- // map. This drops the reference count of each object in the counts map by the number of times that
- // the object is pointed at by other objects in the counts map.
//
- {
- for(GCCountMap::const_iterator i = reachable.begin(); i != reachable.end(); ++i)
- {
- GCCountMap::iterator pos = counts.find(i->first);
- assert(pos != counts.end());
- pos->second -= i->second;
- }
- }
+ // gcObjects contains the set of class instances that have at least one member of class type,
+ // that is, gcObjects contains all those instances that can point at other instances.
+ //
+ // Create a map that, for each object in gcObjects, contains an <object, refcount> pair.
+ // In addition, for each object in gcObjects, add the objects that are immediately (not
+ // recursively) reachable from that object to a reachable map that counts how many times
+ // the object is pointed at.
+ //
+ GCCountMap reachable;
+ {
+ for(GCObjectSet::const_iterator i = gcObjects.begin(); i != gcObjects.end(); ++i)
+ {
+ counts.insert(GCCountMap::value_type(*i, (*i)->__getRefUnsafe()));
+ (*i)->__gcReachable(reachable);
+ }
+ }
+
+ //
+ // Decrement the reference count for each object in the counts map by the count in the reachable
+ // map. This drops the reference count of each object in the counts map by the number of times that
+ // the object is pointed at by other objects in the counts map.
+ //
+ {
+ for(GCCountMap::const_iterator i = reachable.begin(); i != reachable.end(); ++i)
+ {
+ GCCountMap::iterator pos = counts.find(i->first);
+ assert(pos != counts.end());
+ pos->second -= i->second;
+ }
+ }
}
{
- //
- // Any instances in the counts map with a ref count > 0 are referenced from outside the objects in
- // gcObjects (and are therefore reachable from the program, for example, via Ptr variable on the stack).
- // The set of live objects therefore are all the objects with a reference count > 0, as well as all
- // objects that are (recursively) reachable from these objects.
- //
- GCObjectSet liveObjects;
- {
- for(GCCountMap::const_iterator i = counts.begin(); i != counts.end(); ++i)
- {
- if(i->second > 0)
- {
- recursivelyReachable(i->first, liveObjects);
- }
- }
- }
-
- //
- // Remove all live objects from the counts map.
- //
- {
- for(GCObjectSet::const_iterator i = liveObjects.begin(); i != liveObjects.end(); ++i)
- {
+ //
+ // Any instances in the counts map with a ref count > 0 are referenced from outside the objects in
+ // gcObjects (and are therefore reachable from the program, for example, via Ptr variable on the stack).
+ // The set of live objects therefore are all the objects with a reference count > 0, as well as all
+ // objects that are (recursively) reachable from these objects.
+ //
+ GCObjectSet liveObjects;
+ {
+ for(GCCountMap::const_iterator i = counts.begin(); i != counts.end(); ++i)
+ {
+ if(i->second > 0)
+ {
+ recursivelyReachable(i->first, liveObjects);
+ }
+ }
+ }
+
+ //
+ // Remove all live objects from the counts map.
+ //
+ {
+ for(GCObjectSet::const_iterator i = liveObjects.begin(); i != liveObjects.end(); ++i)
+ {
#ifndef NDEBUG
- size_t erased =
+ size_t erased =
#endif
- counts.erase(*i);
- assert(erased != 0);
- }
- }
+ counts.erase(*i);
+ assert(erased != 0);
+ }
+ }
}
//
// What is left in the counts map can be garbage collected.
//
{
- GCCountMap::const_iterator i;
- for(i = counts.begin(); i != counts.end(); ++i)
- {
- //
- // For classes with members that point at potentially-cyclic instances, __gcClear()
- // decrements the reference count of the pointed-at instances as many times as they are
- // pointed at and clears the corresponding Ptr members in the pointing class.
- // For classes that cannot be part of a cycle (because they do not contain class members)
- // and are therefore true leaves, __gcClear() assigns 0 to the corresponding class member,
- // which either decrements the ref count or, if it reaches zero, deletes the instance as usual.
- //
- i->first->__gcClear();
- }
- for(i = counts.begin(); i != counts.end(); ++i)
- {
- gcObjects.erase(i->first); // Remove this object from candidate set.
- delete i->first; // Delete this object.
- }
+ GCCountMap::const_iterator i;
+ for(i = counts.begin(); i != counts.end(); ++i)
+ {
+ //
+ // For classes with members that point at potentially-cyclic instances, __gcClear()
+ // decrements the reference count of the pointed-at instances as many times as they are
+ // pointed at and clears the corresponding Ptr members in the pointing class.
+ // For classes that cannot be part of a cycle (because they do not contain class members)
+ // and are therefore true leaves, __gcClear() assigns 0 to the corresponding class member,
+ // which either decrements the ref count or, if it reaches zero, deletes the instance as usual.
+ //
+ i->first->__gcClear();
+ }
+ for(i = counts.begin(); i != counts.end(); ++i)
+ {
+ gcObjects.erase(i->first); // Remove this object from candidate set.
+ delete i->first; // Delete this object.
+ }
}
if(_statsCallback)
{
- stats.time = Time::now() - t;
- stats.collected = static_cast<int>(counts.size());
- _statsCallback(stats);
+ stats.time = Time::now() - t;
+ stats.collected = static_cast<int>(counts.size());
+ _statsCallback(stats);
}
//
@@ -381,8 +381,8 @@ IceInternal::GC::collectGarbage()
counts.clear();
{
- Monitor<Mutex>::Lock sync(*this);
+ Monitor<Mutex>::Lock sync(*this);
- _collecting = false;
+ _collecting = false;
}
}
diff --git a/cpp/src/Ice/IdentityUtil.cpp b/cpp/src/Ice/IdentityUtil.cpp
index 8b078b0e96c..4758804b4fb 100644
--- a/cpp/src/Ice/IdentityUtil.cpp
+++ b/cpp/src/Ice/IdentityUtil.cpp
@@ -81,10 +81,10 @@ Ice::identityToString(const Identity& ident)
{
if(ident.category.empty())
{
- return IceUtil::escapeString(ident.name, "/");
+ return IceUtil::escapeString(ident.name, "/");
}
else
{
- return IceUtil::escapeString(ident.category, "/") + '/' + IceUtil::escapeString(ident.name, "/");
+ return IceUtil::escapeString(ident.category, "/") + '/' + IceUtil::escapeString(ident.name, "/");
}
}
diff --git a/cpp/src/Ice/ImplicitContextI.cpp b/cpp/src/Ice/ImplicitContextI.cpp
index ab78a011dab..7dd27c0fada 100644
--- a/cpp/src/Ice/ImplicitContextI.cpp
+++ b/cpp/src/Ice/ImplicitContextI.cpp
@@ -80,14 +80,14 @@ public:
struct Slot
{
- Slot() :
- context(0),
- owner(-1) // just to avoid UMR; a random value would work as well
- {
- }
-
- Context* context;
- long owner;
+ Slot() :
+ context(0),
+ owner(-1) // just to avoid UMR; a random value would work as well
+ {
+ }
+
+ Context* context;
+ long owner;
};
@@ -129,25 +129,25 @@ ImplicitContextI::create(const std::string& kind)
{
if(kind == "None" || kind == "")
{
- return 0;
+ return 0;
}
else if(kind == "Shared")
{
- return new SharedImplicitContext;
+ return new SharedImplicitContext;
}
else if(kind == "SharedWithoutLocking")
{
- return new SharedImplicitContextWithoutLocking;
+ return new SharedImplicitContextWithoutLocking;
}
else if(kind == "PerThread")
{
- return new PerThreadImplicitContext;
+ return new PerThreadImplicitContext;
}
else
{
- throw Ice::InitializationException(
- __FILE__, __LINE__,
- "'" + kind + "' is not a valid value for Ice.ImplicitContext");
+ throw Ice::InitializationException(
+ __FILE__, __LINE__,
+ "'" + kind + "' is not a valid value for Ice.ImplicitContext");
return 0; // Keep the compiler happy.
}
}
@@ -158,8 +158,8 @@ ImplicitContextI::cleanupThread()
{
if(PerThreadImplicitContext::_nextId > 0)
{
- PerThreadImplicitContext::threadDestructor(
- TlsGetValue(PerThreadImplicitContext::_key));
+ PerThreadImplicitContext::threadDestructor(
+ TlsGetValue(PerThreadImplicitContext::_key));
}
}
#endif
@@ -186,7 +186,7 @@ SharedImplicitContextWithoutLocking::get(const string& k) const
Context::const_iterator p = _context.find(k);
if(p == _context.end())
{
- throw NotSetException(__FILE__, __LINE__, k);
+ throw NotSetException(__FILE__, __LINE__, k);
}
return p->second;
}
@@ -197,7 +197,7 @@ SharedImplicitContextWithoutLocking::getWithDefault(const string& k, const strin
Context::const_iterator p = _context.find(k);
if(p == _context.end())
{
- return d;
+ return d;
}
return p->second;
}
@@ -213,7 +213,7 @@ SharedImplicitContextWithoutLocking::remove(const string& k)
{
if(_context.erase(k) == 0)
{
- throw NotSetException(__FILE__, __LINE__, k);
+ throw NotSetException(__FILE__, __LINE__, k);
}
}
@@ -222,17 +222,17 @@ SharedImplicitContextWithoutLocking::write(const Context& proxyCtx, ::IceInterna
{
if(proxyCtx.size() == 0)
{
- __write(s, _context, __U__Context());
+ __write(s, _context, __U__Context());
}
else if(_context.size() == 0)
{
- __write(s, proxyCtx, __U__Context());
+ __write(s, proxyCtx, __U__Context());
}
else
{
- Context combined = proxyCtx;
- combined.insert(_context.begin(), _context.end());
- __write(s, combined, __U__Context());
+ Context combined = proxyCtx;
+ combined.insert(_context.begin(), _context.end());
+ __write(s, combined, __U__Context());
}
}
@@ -241,16 +241,16 @@ SharedImplicitContextWithoutLocking::combine(const Context& proxyCtx, Context& c
{
if(proxyCtx.size() == 0)
{
- ctx = _context;
+ ctx = _context;
}
else if(_context.size() == 0)
{
- ctx = proxyCtx;
+ ctx = proxyCtx;
}
else
{
- ctx = proxyCtx;
- ctx.insert(_context.begin(), _context.end());
+ ctx = proxyCtx;
+ ctx.insert(_context.begin(), _context.end());
}
}
@@ -307,19 +307,19 @@ SharedImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStream
IceUtil::Mutex::Lock lock(_mutex);
if(proxyCtx.size() == 0)
{
- __write(s, _context, __U__Context());
+ __write(s, _context, __U__Context());
}
else if(_context.size() == 0)
{
- lock.release();
- __write(s, proxyCtx, __U__Context());
+ lock.release();
+ __write(s, proxyCtx, __U__Context());
}
else
{
- Context combined = proxyCtx;
- combined.insert(_context.begin(), _context.end());
- lock.release();
- __write(s, combined, __U__Context());
+ Context combined = proxyCtx;
+ combined.insert(_context.begin(), _context.end());
+ lock.release();
+ __write(s, combined, __U__Context());
}
}
@@ -350,22 +350,22 @@ PerThreadImplicitContext::PerThreadImplicitContext()
_id = _nextId++;
if(_id == 0)
{
- //
- // Initialize; note that we never dealloc this key (it would be
- // complex, and since it's a static variable, it's not really a leak)
- //
+ //
+ // Initialize; note that we never dealloc this key (it would be
+ // complex, and since it's a static variable, it's not really a leak)
+ //
#ifdef _WIN32
- _key = TlsAlloc();
- if(_key == TLS_OUT_OF_INDEXES)
- {
- throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ _key = TlsAlloc();
+ if(_key == TLS_OUT_OF_INDEXES)
+ {
+ throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
#else
- int err = pthread_key_create(&_key, &threadDestructor);
- if(err != 0)
- {
- throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err);
- }
+ int err = pthread_key_create(&_key, &threadDestructor);
+ if(err != 0)
+ {
+ throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err);
+ }
#endif
}
@@ -374,17 +374,17 @@ PerThreadImplicitContext::PerThreadImplicitContext()
//
if(_indexInUse == 0)
{
- _indexInUse = new IndexInUse(1);
+ _indexInUse = new IndexInUse(1);
}
size_t i = 0;
while(i < _indexInUse->size() && (*_indexInUse)[i])
{
- i++;
+ i++;
}
if(i == _indexInUse->size())
{
- _indexInUse->resize(i + 1);
+ _indexInUse->resize(i + 1);
}
(*_indexInUse)[i] = true;
_index = i;
@@ -397,8 +397,8 @@ PerThreadImplicitContext::~PerThreadImplicitContext()
if(find(_indexInUse->begin(), _indexInUse->end(), true) == _indexInUse->end())
{
- delete _indexInUse;
- _indexInUse = 0;
+ delete _indexInUse;
+ _indexInUse = 0;
}
}
@@ -408,17 +408,17 @@ PerThreadImplicitContext::threadDestructor(void* v)
SlotVector* sv = static_cast<SlotVector*>(v);
if(sv != 0)
{
- //
- // Cleanup each slot
- //
- for(SlotVector::iterator p = sv->begin(); p != sv->end(); ++p)
- {
- delete p->context;
- }
- //
- // Then the vector
- //
- delete sv;
+ //
+ // Cleanup each slot
+ //
+ for(SlotVector::iterator p = sv->begin(); p != sv->end(); ++p)
+ {
+ delete p->context;
+ }
+ //
+ // Then the vector
+ //
+ delete sv;
}
}
@@ -432,65 +432,65 @@ PerThreadImplicitContext::getThreadContext(bool allocate) const
#endif
if(sv == 0)
{
- if(!allocate)
- {
- return 0;
- }
+ if(!allocate)
+ {
+ return 0;
+ }
- sv = new SlotVector(_index + 1);
+ sv = new SlotVector(_index + 1);
#ifdef _WIN32
- if(TlsSetValue(_key, sv) == 0)
- {
- throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ if(TlsSetValue(_key, sv) == 0)
+ {
+ throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
#else
- if(int err = pthread_setspecific(_key, sv))
- {
- throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err);
- }
+ if(int err = pthread_setspecific(_key, sv))
+ {
+ throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err);
+ }
#endif
}
else
{
- if(sv->size() <= _index)
- {
- if(!allocate)
- {
- return 0;
- }
- else
- {
- sv->resize(_index + 1);
- }
- }
+ if(sv->size() <= _index)
+ {
+ if(!allocate)
+ {
+ return 0;
+ }
+ else
+ {
+ sv->resize(_index + 1);
+ }
+ }
}
Slot& slot = (*sv)[_index];
if(slot.context != 0)
{
- if(slot.owner != _id)
- {
- //
- // Reuse the slot from another (dead) communicator
- //
- slot.context->clear();
- slot.owner = _id;
- }
- //
- // else keep this slot.context
- //
+ if(slot.owner != _id)
+ {
+ //
+ // Reuse the slot from another (dead) communicator
+ //
+ slot.context->clear();
+ slot.owner = _id;
+ }
+ //
+ // else keep this slot.context
+ //
}
else
{
- if(allocate)
- {
- slot.context = new Context;
- slot.owner = _id;
- }
- //
- // else keep null slot.context
- //
+ if(allocate)
+ {
+ slot.context = new Context;
+ slot.owner = _id;
+ }
+ //
+ // else keep null slot.context
+ //
}
return slot.context;
}
@@ -505,33 +505,33 @@ PerThreadImplicitContext::clearThreadContext() const
#endif
if(sv != 0 && _index < sv->size())
{
- delete (*sv)[_index].context;
- (*sv)[_index].context = 0;
-
- int i = sv->size() - 1;
- while(i >= 0 && (*sv)[i].context == 0)
- {
- i--;
- }
- if(i < 0)
- {
- delete sv;
+ delete (*sv)[_index].context;
+ (*sv)[_index].context = 0;
+
+ int i = sv->size() - 1;
+ while(i >= 0 && (*sv)[i].context == 0)
+ {
+ i--;
+ }
+ if(i < 0)
+ {
+ delete sv;
#ifdef _WIN32
- if(TlsSetValue(_key, 0) == 0)
- {
- IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ if(TlsSetValue(_key, 0) == 0)
+ {
+ IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
#else
- if(int err = pthread_setspecific(_key, 0))
- {
- throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err);
- }
+ if(int err = pthread_setspecific(_key, 0))
+ {
+ throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err);
+ }
#endif
- }
- else
- {
- sv->resize(i + 1);
- }
+ }
+ else
+ {
+ sv->resize(i + 1);
+ }
}
}
@@ -542,11 +542,11 @@ PerThreadImplicitContext::getContext() const
Context* ctx = getThreadContext(false);
if(ctx == 0)
{
- return Context();
+ return Context();
}
else
{
- return *ctx;
+ return *ctx;
}
}
@@ -555,13 +555,13 @@ PerThreadImplicitContext::setContext(const Context& newContext)
{
if(newContext.size() == 0)
{
- clearThreadContext();
+ clearThreadContext();
}
else
{
- Context* ctx = getThreadContext(true);
- assert(ctx != 0);
- *ctx = newContext;
+ Context* ctx = getThreadContext(true);
+ assert(ctx != 0);
+ *ctx = newContext;
}
}
@@ -571,12 +571,12 @@ PerThreadImplicitContext::get(const string& k) const
Context* ctx = getThreadContext(false);
if(ctx == 0)
{
- throw NotSetException(__FILE__, __LINE__, k);
+ throw NotSetException(__FILE__, __LINE__, k);
}
Context::const_iterator p = ctx->find(k);
if(p == ctx->end())
{
- throw NotSetException(__FILE__, __LINE__, k);
+ throw NotSetException(__FILE__, __LINE__, k);
}
return p->second;
}
@@ -587,12 +587,12 @@ PerThreadImplicitContext::getWithDefault(const string& k, const string& d) const
Context* ctx = getThreadContext(false);
if(ctx == 0)
{
- return d;
+ return d;
}
Context::const_iterator p = ctx->find(k);
if(p == ctx->end())
{
- return d;
+ return d;
}
return p->second;
}
@@ -610,12 +610,12 @@ PerThreadImplicitContext::remove(const string& k)
Context* ctx = getThreadContext(false);
if(ctx == 0 || ctx->erase(k) == 0)
{
- throw NotSetException(__FILE__, __LINE__, k);
+ throw NotSetException(__FILE__, __LINE__, k);
}
if(ctx->size() == 0)
{
- clearThreadContext();
+ clearThreadContext();
}
}
@@ -626,17 +626,17 @@ PerThreadImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStr
if(threadCtx == 0 || threadCtx->size() == 0)
{
- __write(s, proxyCtx, __U__Context());
+ __write(s, proxyCtx, __U__Context());
}
else if(proxyCtx.size() == 0)
{
- __write(s, *threadCtx, __U__Context());
+ __write(s, *threadCtx, __U__Context());
}
else
{
- Context combined = proxyCtx;
- combined.insert(threadCtx->begin(), threadCtx->end());
- __write(s, combined, __U__Context());
+ Context combined = proxyCtx;
+ combined.insert(threadCtx->begin(), threadCtx->end());
+ __write(s, combined, __U__Context());
}
}
@@ -647,15 +647,15 @@ PerThreadImplicitContext::combine(const Context& proxyCtx, Context& ctx) const
if(threadCtx == 0 || threadCtx->size() == 0)
{
- ctx = proxyCtx;
+ ctx = proxyCtx;
}
else if(proxyCtx.size() == 0)
{
- ctx = *threadCtx;
+ ctx = *threadCtx;
}
else
{
- ctx = proxyCtx;
- ctx.insert(threadCtx->begin(), threadCtx->end());
+ ctx = proxyCtx;
+ ctx.insert(threadCtx->begin(), threadCtx->end());
}
}
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index bd41e14fef1..22dbebf73e7 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -25,8 +25,8 @@ using namespace Ice;
using namespace IceInternal;
IceInternal::IncomingBase::IncomingBase(Instance* instance, ConnectionI* connection,
- const ObjectAdapterPtr& adapter,
- bool response, Byte compress, Int requestId) :
+ const ObjectAdapterPtr& adapter,
+ bool response, Byte compress, Int requestId) :
_response(response),
_compress(compress),
_os(instance),
@@ -74,199 +74,199 @@ IceInternal::IncomingBase::__handleException(const Ice::Exception& ex)
{
try
{
- ex.ice_throw();
+ ex.ice_throw();
}
catch(RequestFailedException& ex)
{
- if(ex.id.name.empty())
- {
- ex.id = _current.id;
- }
-
- if(ex.facet.empty() && !_current.facet.empty())
- {
- ex.facet = _current.facet;
- }
-
- if(ex.operation.empty() && !_current.operation.empty())
- {
- ex.operation = _current.operation;
- }
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- if(dynamic_cast<ObjectNotExistException*>(&ex))
- {
- _os.write(static_cast<Byte>(DispatchObjectNotExist));
- }
- else if(dynamic_cast<FacetNotExistException*>(&ex))
- {
- _os.write(static_cast<Byte>(DispatchFacetNotExist));
- }
- else if(dynamic_cast<OperationNotExistException*>(&ex))
- {
- _os.write(static_cast<Byte>(DispatchOperationNotExist));
- }
- else
- {
- assert(false);
- }
-
- ex.id.__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(ex.facet.empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- _os.write(&ex.facet, &ex.facet + 1);
- }
-
- _os.write(ex.operation, false);
-
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(ex.id.name.empty())
+ {
+ ex.id = _current.id;
+ }
+
+ if(ex.facet.empty() && !_current.facet.empty())
+ {
+ ex.facet = _current.facet;
+ }
+
+ if(ex.operation.empty() && !_current.operation.empty())
+ {
+ ex.operation = _current.operation;
+ }
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ __warning(ex);
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ if(dynamic_cast<ObjectNotExistException*>(&ex))
+ {
+ _os.write(static_cast<Byte>(DispatchObjectNotExist));
+ }
+ else if(dynamic_cast<FacetNotExistException*>(&ex))
+ {
+ _os.write(static_cast<Byte>(DispatchFacetNotExist));
+ }
+ else if(dynamic_cast<OperationNotExistException*>(&ex))
+ {
+ _os.write(static_cast<Byte>(DispatchOperationNotExist));
+ }
+ else
+ {
+ assert(false);
+ }
+
+ ex.id.__write(&_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(ex.facet.empty())
+ {
+ _os.write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ _os.write(&ex.facet, &ex.facet + 1);
+ }
+
+ _os.write(ex.operation, false);
+
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
catch(const UnknownLocalException& ex)
{
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownLocalException));
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownLocalException));
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
catch(const UnknownUserException& ex)
{
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownUserException));
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownUserException));
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
catch(const UnknownException& ex)
{
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownException));
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
catch(const LocalException& ex)
{
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownLocalException));
- ostringstream str;
- str << ex;
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownLocalException));
+ ostringstream str;
+ str << ex;
+ _os.write(str.str(), false);
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
catch(const UserException& ex)
{
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownUserException));
- ostringstream str;
- str << ex;
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownUserException));
+ ostringstream str;
+ str << ex;
+ _os.write(str.str(), false);
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
catch(const Exception& ex)
{
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- ostringstream str;
- str << ex;
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownException));
+ ostringstream str;
+ str << ex;
+ _os.write(str.str(), false);
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
}
@@ -275,22 +275,22 @@ IceInternal::IncomingBase::__handleException(const std::exception& ex)
{
if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
- __warning(string("std::exception: ") + ex.what());
+ __warning(string("std::exception: ") + ex.what());
}
if(_response)
{
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- ostringstream str;
- str << "std::exception: " << ex.what();
- _os.write(str.str(), false);
- _connection->sendResponse(&_os, _compress);
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownException));
+ ostringstream str;
+ str << "std::exception: " << ex.what();
+ _os.write(str.str(), false);
+ _connection->sendResponse(&_os, _compress);
}
else
{
- _connection->sendNoResponse();
+ _connection->sendNoResponse();
}
}
@@ -299,27 +299,27 @@ IceInternal::IncomingBase::__handleException()
{
if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
{
- __warning("unknown c++ exception");
+ __warning("unknown c++ exception");
}
if(_response)
{
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(DispatchUnknownException));
- string reason = "unknown c++ exception";
- _os.write(reason, false);
- _connection->sendResponse(&_os, _compress);
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(DispatchUnknownException));
+ string reason = "unknown c++ exception";
+ _os.write(reason, false);
+ _connection->sendResponse(&_os, _compress);
}
else
{
- _connection->sendNoResponse();
+ _connection->sendNoResponse();
}
}
IceInternal::Incoming::Incoming(Instance* instance, ConnectionI* connection,
- const ObjectAdapterPtr& adapter,
- bool response, Byte compress, Int requestId) :
+ const ObjectAdapterPtr& adapter,
+ bool response, Byte compress, Int requestId) :
IncomingBase(instance, connection, adapter, response, compress, requestId),
_is(instance)
{
@@ -338,16 +338,16 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
//
string facet;
{
- vector<string> facetPath;
- _is.read(facetPath);
- if(!facetPath.empty())
- {
- if(facetPath.size() > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
- }
+ vector<string> facetPath;
+ _is.read(facetPath);
+ if(!facetPath.empty())
+ {
+ if(facetPath.size() > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
+ }
}
_current.facet.swap(facet);
@@ -361,19 +361,19 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
_is.readSize(sz);
while(sz--)
{
- pair<const string, string> pr;
- _is.read(const_cast<string&>(pr.first));
- _is.read(pr.second);
- _current.ctx.insert(_current.ctx.end(), pr);
+ pair<const string, string> pr;
+ _is.read(const_cast<string&>(pr.first));
+ _is.read(pr.second);
+ _current.ctx.insert(_current.ctx.end(), pr);
}
_is.startReadEncaps();
if(_response)
{
- assert(_os.b.size() == headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(0));
- _os.startWriteEncaps();
+ assert(_os.b.size() == headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(0));
+ _os.startWriteEncaps();
}
// Initialize status to some value, to keep the compiler happy.
@@ -387,72 +387,72 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
try
{
- try
- {
- if(servantManager)
- {
- _servant = servantManager->findServant(_current.id, _current.facet);
- if(!_servant)
- {
- _locator = servantManager->findServantLocator(_current.id.category);
- if(!_locator && !_current.id.category.empty())
- {
- _locator = servantManager->findServantLocator("");
- }
- if(_locator)
- {
- _servant = _locator->locate(_current, _cookie);
- }
- }
- }
- if(!_servant)
- {
- if(servantManager && servantManager->hasServant(_current.id))
- {
- status = DispatchFacetNotExist;
- }
- else
- {
- status = DispatchObjectNotExist;
- }
- }
- else
- {
- status = _servant->__dispatch(*this, _current);
- }
- }
- catch(...)
- {
- if(_locator && _servant && status != DispatchAsync)
- {
- _locator->finished(_current, _servant, _cookie);
- }
-
- throw;
- }
-
- if(_locator && _servant && status != DispatchAsync)
- {
- _locator->finished(_current, _servant, _cookie);
- }
+ try
+ {
+ if(servantManager)
+ {
+ _servant = servantManager->findServant(_current.id, _current.facet);
+ if(!_servant)
+ {
+ _locator = servantManager->findServantLocator(_current.id.category);
+ if(!_locator && !_current.id.category.empty())
+ {
+ _locator = servantManager->findServantLocator("");
+ }
+ if(_locator)
+ {
+ _servant = _locator->locate(_current, _cookie);
+ }
+ }
+ }
+ if(!_servant)
+ {
+ if(servantManager && servantManager->hasServant(_current.id))
+ {
+ status = DispatchFacetNotExist;
+ }
+ else
+ {
+ status = DispatchObjectNotExist;
+ }
+ }
+ else
+ {
+ status = _servant->__dispatch(*this, _current);
+ }
+ }
+ catch(...)
+ {
+ if(_locator && _servant && status != DispatchAsync)
+ {
+ _locator->finished(_current, _servant, _cookie);
+ }
+
+ throw;
+ }
+
+ if(_locator && _servant && status != DispatchAsync)
+ {
+ _locator->finished(_current, _servant, _cookie);
+ }
}
catch(const Exception& ex)
{
- _is.endReadEncaps();
- __handleException(ex);
- return;
+ _is.endReadEncaps();
+ __handleException(ex);
+ return;
}
catch(const std::exception& ex)
{
- _is.endReadEncaps();
- __handleException(ex);
- return;
+ _is.endReadEncaps();
+ __handleException(ex);
+ return;
}
catch(...)
{
- _is.endReadEncaps();
- __handleException();
- return;
+ _is.endReadEncaps();
+ __handleException();
+ return;
}
//
@@ -469,50 +469,50 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
//
if(status == DispatchAsync)
{
- //
- // If this was an asynchronous dispatch, we're done here.
- //
- return;
+ //
+ // If this was an asynchronous dispatch, we're done here.
+ //
+ return;
}
if(_response)
{
- _os.endWriteEncaps();
-
- if(status != DispatchOK && status != DispatchUserException)
- {
- assert(status == DispatchObjectNotExist ||
- status == DispatchFacetNotExist ||
- status == DispatchOperationNotExist);
-
- _os.b.resize(headerSize + 4); // Dispatch status position.
- _os.write(static_cast<Byte>(status));
-
- _current.id.__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(_current.facet.empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- _os.write(&_current.facet, &_current.facet + 1);
- }
-
- _os.write(_current.operation, false);
- }
- else
- {
- *(_os.b.begin() + headerSize + 4) = static_cast<Byte>(status); // Dispatch status position.
- }
-
- _connection->sendResponse(&_os, _compress);
+ _os.endWriteEncaps();
+
+ if(status != DispatchOK && status != DispatchUserException)
+ {
+ assert(status == DispatchObjectNotExist ||
+ status == DispatchFacetNotExist ||
+ status == DispatchOperationNotExist);
+
+ _os.b.resize(headerSize + 4); // Dispatch status position.
+ _os.write(static_cast<Byte>(status));
+
+ _current.id.__write(&_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(_current.facet.empty())
+ {
+ _os.write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ _os.write(&_current.facet, &_current.facet + 1);
+ }
+
+ _os.write(_current.operation, false);
+ }
+ else
+ {
+ *(_os.b.begin() + headerSize + 4) = static_cast<Byte>(status); // Dispatch status position.
+ }
+
+ _connection->sendResponse(&_os, _compress);
}
else
{
- _connection->sendNoResponse();
+ _connection->sendNoResponse();
}
}
diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp
index 00127ea64e9..b7c60f8592d 100644
--- a/cpp/src/Ice/IncomingAsync.cpp
+++ b/cpp/src/Ice/IncomingAsync.cpp
@@ -41,34 +41,34 @@ IceInternal::IncomingAsync::__response(bool ok)
{
try
{
- if(!__servantLocatorFinished())
- {
- return;
- }
-
- if(_response)
- {
- _os.endWriteEncaps();
-
- if(ok)
- {
- *(_os.b.begin() + headerSize + 4) = static_cast<Byte>(DispatchOK);
- }
- else
- {
- *(_os.b.begin() + headerSize + 4) = static_cast<Byte>(DispatchUserException);
- }
-
- _connection->sendResponse(&_os, _compress);
- }
- else
- {
- _connection->sendNoResponse();
- }
+ if(!__servantLocatorFinished())
+ {
+ return;
+ }
+
+ if(_response)
+ {
+ _os.endWriteEncaps();
+
+ if(ok)
+ {
+ *(_os.b.begin() + headerSize + 4) = static_cast<Byte>(DispatchOK);
+ }
+ else
+ {
+ *(_os.b.begin() + headerSize + 4) = static_cast<Byte>(DispatchUserException);
+ }
+
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
}
catch(const LocalException& ex)
{
- _connection->invokeException(ex, 1); // Fatal invocation exception
+ _connection->invokeException(ex, 1); // Fatal invocation exception
}
}
@@ -77,16 +77,16 @@ IceInternal::IncomingAsync::__exception(const Exception& exc)
{
try
{
- if(!__servantLocatorFinished())
- {
- return;
- }
+ if(!__servantLocatorFinished())
+ {
+ return;
+ }
- __handleException(exc);
+ __handleException(exc);
}
catch(const LocalException& ex)
{
- _connection->invokeException(ex, 1); // Fatal invocation exception
+ _connection->invokeException(ex, 1); // Fatal invocation exception
}
}
@@ -95,16 +95,16 @@ IceInternal::IncomingAsync::__exception(const std::exception& exc)
{
try
{
- if(!__servantLocatorFinished())
- {
- return;
- }
+ if(!__servantLocatorFinished())
+ {
+ return;
+ }
- __handleException(exc);
+ __handleException(exc);
}
catch(const LocalException& ex)
{
- _connection->invokeException(ex, 1); // Fatal invocation exception
+ _connection->invokeException(ex, 1); // Fatal invocation exception
}
}
@@ -113,16 +113,16 @@ IceInternal::IncomingAsync::__exception()
{
try
{
- if(!__servantLocatorFinished())
- {
- return;
- }
+ if(!__servantLocatorFinished())
+ {
+ return;
+ }
- __handleException();
+ __handleException();
}
catch(const LocalException& ex)
{
- _connection->invokeException(ex, 1); // Fatal invocation exception
+ _connection->invokeException(ex, 1); // Fatal invocation exception
}
}
@@ -131,26 +131,26 @@ IceInternal::IncomingAsync::__servantLocatorFinished()
{
try
{
- if(_locator && _servant)
- {
- _locator->finished(_current, _servant, _cookie);
- }
- return true;
+ if(_locator && _servant)
+ {
+ _locator->finished(_current, _servant, _cookie);
+ }
+ return true;
}
catch(const Exception& ex)
{
- __handleException(ex);
- return false;
+ __handleException(ex);
+ return false;
}
catch(const std::exception& ex)
{
- __handleException(ex);
- return false;
+ __handleException(ex);
+ return false;
}
catch(...)
{
- __handleException();
- return false;
+ __handleException();
+ return false;
}
}
@@ -164,12 +164,12 @@ IceAsync::Ice::AMD_Object_ice_invoke::ice_response(bool ok, const vector<Byte>&
{
try
{
- __os()->writeBlob(outParams);
+ __os()->writeBlob(outParams);
}
catch(const LocalException& ex)
{
- __exception(ex);
- return;
+ __exception(ex);
+ return;
}
__response(ok);
}
@@ -202,12 +202,12 @@ IceAsync::Ice::AMD_Array_Object_ice_invoke::ice_response(bool ok, const pair<con
{
try
{
- __os()->writeBlob(outParams.first, static_cast<Int>(outParams.second - outParams.first));
+ __os()->writeBlob(outParams.first, static_cast<Int>(outParams.second - outParams.first));
}
catch(const LocalException& ex)
{
- __exception(ex);
- return;
+ __exception(ex);
+ return;
}
__response(ok);
}
diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp
index cb7252ddf94..70ce1296280 100644
--- a/cpp/src/Ice/Initialize.cpp
+++ b/cpp/src/Ice/Initialize.cpp
@@ -32,7 +32,7 @@ Ice::collectGarbage()
{
if(theCollector)
{
- theCollector->collectGarbage();
+ theCollector->collectGarbage();
}
}
@@ -80,7 +80,7 @@ Ice::stringSeqToArgs(const StringSeq& args, int& argc, char* argv[])
//
if(argv && argcOrig != argc)
{
- argv[argc] = 0;
+ argv[argc] = 0;
}
}
@@ -115,7 +115,7 @@ inline void checkIceVersion(Int version)
//
if(ICE_INT_VERSION != version)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
# else
@@ -124,7 +124,7 @@ inline void checkIceVersion(Int version)
//
if(ICE_INT_VERSION / 100 != version / 100)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
//
@@ -132,7 +132,7 @@ inline void checkIceVersion(Int version)
//
if(version % 100 > 50)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
//
@@ -141,7 +141,7 @@ inline void checkIceVersion(Int version)
//
if(version % 100 > ICE_INT_VERSION % 100)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
# endif
@@ -172,42 +172,42 @@ Ice::initialize(StringSeq& args, const InitializationData& initializationData, I
CommunicatorPtr communicator;
try
{
- //
- // Make a dummy argc/argv.
- // (We can't use argsToStringSeq() because that requires an already initialized argv.)
- //
- int argc = args.size();
- origArgc = argc;
- argv = new char*[args.size() + 1];
- int i;
- for(i = 0; i != argc; ++i)
- {
- argv[i] = new char[args[i].size() + 1];
+ //
+ // Make a dummy argc/argv.
+ // (We can't use argsToStringSeq() because that requires an already initialized argv.)
+ //
+ int argc = args.size();
+ origArgc = argc;
+ argv = new char*[args.size() + 1];
+ int i;
+ for(i = 0; i != argc; ++i)
+ {
+ argv[i] = new char[args[i].size() + 1];
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
- strcpy_s(argv[i], args[i].size() + 1, args[i].c_str());
+ strcpy_s(argv[i], args[i].size() + 1, args[i].c_str());
#else
- strcpy(argv[i], args[i].c_str());
+ strcpy(argv[i], args[i].c_str());
#endif
- }
- argv[argc] = 0;
-
- communicator = initialize(argc, argv, initializationData, version);
-
- args = argsToStringSeq(argc, argv);
-
- for(i = 0; i < origArgc; ++i)
- {
- delete[] argv[i];
- }
- delete[] argv;
+ }
+ argv[argc] = 0;
+
+ communicator = initialize(argc, argv, initializationData, version);
+
+ args = argsToStringSeq(argc, argv);
+
+ for(i = 0; i < origArgc; ++i)
+ {
+ delete[] argv[i];
+ }
+ delete[] argv;
}
catch(...)
{
- for(int i = 0; i < origArgc; ++i)
- {
- delete[] argv[i];
- }
- delete[] argv;
+ for(int i = 0; i < origArgc; ++i)
+ {
+ delete[] argv[i];
+ }
+ delete[] argv;
throw;
}
return communicator;
@@ -249,7 +249,7 @@ Ice::initializeWithLogger(int& argc, char* argv[], const LoggerPtr& logger, Int
CommunicatorPtr
Ice::initializeWithPropertiesAndLogger(int& argc, char* argv[], const PropertiesPtr& properties,
- const LoggerPtr& logger, Int version)
+ const LoggerPtr& logger, Int version)
{
InitializationData initData;
initData.properties = properties;
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 5548d792c9b..ecb2f466bd2 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -98,7 +98,7 @@ IceInternal::Instance::routerManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _routerManager;
@@ -111,7 +111,7 @@ IceInternal::Instance::locatorManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _locatorManager;
@@ -124,7 +124,7 @@ IceInternal::Instance::referenceFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _referenceFactory;
@@ -137,7 +137,7 @@ IceInternal::Instance::proxyFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _proxyFactory;
@@ -150,7 +150,7 @@ IceInternal::Instance::outgoingConnectionFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _outgoingConnectionFactory;
@@ -163,7 +163,7 @@ IceInternal::Instance::connectionMonitor() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _connectionMonitor;
@@ -176,7 +176,7 @@ IceInternal::Instance::servantFactoryManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _servantFactoryManager;
@@ -189,7 +189,7 @@ IceInternal::Instance::objectAdapterFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _objectAdapterFactory;
@@ -202,12 +202,12 @@ IceInternal::Instance::clientThreadPool()
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(!_clientThreadPool) // Lazy initialization.
{
- _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0);
+ _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0);
}
return _clientThreadPool;
@@ -220,13 +220,13 @@ IceInternal::Instance::serverThreadPool()
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(!_serverThreadPool) // Lazy initialization.
{
- int timeout = _initData.properties->getPropertyAsInt("Ice.ServerIdleTime");
- _serverThreadPool = new ThreadPool(this, "Ice.ThreadPool.Server", timeout);
+ int timeout = _initData.properties->getPropertyAsInt("Ice.ServerIdleTime");
+ _serverThreadPool = new ThreadPool(this, "Ice.ThreadPool.Server", timeout);
}
return _serverThreadPool;
@@ -253,7 +253,7 @@ IceInternal::Instance::endpointFactoryManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _endpointFactoryManager;
@@ -266,7 +266,7 @@ IceInternal::Instance::dynamicLibraryList() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _dynamicLibraryList;
@@ -279,7 +279,7 @@ IceInternal::Instance::pluginManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _pluginManager;
@@ -306,15 +306,15 @@ IceInternal::Instance::flushBatchRequests()
ObjectAdapterFactoryPtr adapterFactory;
{
- IceUtil::RecMutex::Lock sync(*this);
+ IceUtil::RecMutex::Lock sync(*this);
- if(_state == StateDestroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
+ if(_state == StateDestroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
- connectionFactory = _outgoingConnectionFactory;
- adapterFactory = _objectAdapterFactory;
+ connectionFactory = _outgoingConnectionFactory;
+ adapterFactory = _objectAdapterFactory;
}
connectionFactory->flushBatchRequests();
@@ -328,7 +328,7 @@ IceInternal::Instance::setDefaultContext(const Context& ctx)
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
_defaultContext = new SharedContext(ctx);
@@ -341,7 +341,7 @@ IceInternal::Instance::getDefaultContext() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _defaultContext;
@@ -409,15 +409,15 @@ IceInternal::Instance::stringToIdentity(const string& s) const
if(_initData.stringConverter)
{
string tmpString;
- _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.name.data()),
- reinterpret_cast<const Byte*>(ident.name.data() + ident.name.size()),
- tmpString);
- ident.name = tmpString;
+ _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.name.data()),
+ reinterpret_cast<const Byte*>(ident.name.data() + ident.name.size()),
+ tmpString);
+ ident.name = tmpString;
- _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.category.data()),
- reinterpret_cast<const Byte*>(ident.category.data() + ident.category.size()),
- tmpString);
- ident.category = tmpString;
+ _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.category.data()),
+ reinterpret_cast<const Byte*>(ident.category.data() + ident.category.size()),
+ tmpString);
+ ident.category = tmpString;
}
return ident;
@@ -432,12 +432,12 @@ IceInternal::Instance::identityToString(const Identity& ident) const
{
UTF8BufferI buffer;
Byte* last = _initData.stringConverter->toUTF8(ident.name.data(), ident.name.data() + ident.name.size(),
- buffer);
+ buffer);
name = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
- buffer.reset();
+ buffer.reset();
last = _initData.stringConverter->toUTF8(ident.category.data(), ident.category.data() + ident.category.size(),
- buffer);
+ buffer);
category = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
}
@@ -464,189 +464,189 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
{
try
{
- __setNoDelete(true);
-
- IceUtil::StaticMutex::Lock sync(staticMutex);
- instanceCount++;
-
- if(!_initData.properties)
- {
- _initData.properties = createProperties();
- }
-
- if(!oneOffDone)
- {
- //
- // StdOut and StdErr redirection
- //
- string stdOutFilename = _initData.properties->getProperty("Ice.StdOut");
- string stdErrFilename = _initData.properties->getProperty("Ice.StdErr");
-
- if(stdOutFilename != "")
- {
- FILE* file = freopen(stdOutFilename.c_str(), "a", stdout);
- if(file == 0)
- {
- FileException ex(__FILE__, __LINE__);
- ex.path = stdOutFilename;
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-
- if(stdErrFilename != "")
- {
- FILE* file = freopen(stdErrFilename.c_str(), "a", stderr);
- if(file == 0)
- {
- FileException ex(__FILE__, __LINE__);
- ex.path = stdErrFilename;
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-
- if(_initData.properties->getPropertyAsInt("Ice.NullHandleAbort") > 0)
- {
- IceUtil::nullHandleAbort = true;
- }
-
+ __setNoDelete(true);
+
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ instanceCount++;
+
+ if(!_initData.properties)
+ {
+ _initData.properties = createProperties();
+ }
+
+ if(!oneOffDone)
+ {
+ //
+ // StdOut and StdErr redirection
+ //
+ string stdOutFilename = _initData.properties->getProperty("Ice.StdOut");
+ string stdErrFilename = _initData.properties->getProperty("Ice.StdErr");
+
+ if(stdOutFilename != "")
+ {
+ FILE* file = freopen(stdOutFilename.c_str(), "a", stdout);
+ if(file == 0)
+ {
+ FileException ex(__FILE__, __LINE__);
+ ex.path = stdOutFilename;
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+
+ if(stdErrFilename != "")
+ {
+ FILE* file = freopen(stdErrFilename.c_str(), "a", stderr);
+ if(file == 0)
+ {
+ FileException ex(__FILE__, __LINE__);
+ ex.path = stdErrFilename;
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+
+ if(_initData.properties->getPropertyAsInt("Ice.NullHandleAbort") > 0)
+ {
+ IceUtil::nullHandleAbort = true;
+ }
+
#ifndef _WIN32
- string newUser = _initData.properties->getProperty("Ice.ChangeUser");
- if(!newUser.empty())
- {
- struct passwd* pw = getpwnam(newUser.c_str());
- if(!pw)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- if(setgid(pw->pw_gid) == -1)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- if(setuid(pw->pw_uid) == -1)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- }
+ string newUser = _initData.properties->getProperty("Ice.ChangeUser");
+ if(!newUser.empty())
+ {
+ struct passwd* pw = getpwnam(newUser.c_str());
+ if(!pw)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ if(setgid(pw->pw_gid) == -1)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ if(setuid(pw->pw_uid) == -1)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
#endif
- oneOffDone = true;
- }
-
- if(instanceCount == 1)
- {
-
+ oneOffDone = true;
+ }
+
+ if(instanceCount == 1)
+ {
+
#ifdef _WIN32
- WORD version = MAKEWORD(1, 1);
- WSADATA data;
- if(WSAStartup(version, &data) != 0)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ WORD version = MAKEWORD(1, 1);
+ WSADATA data;
+ if(WSAStartup(version, &data) != 0)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
#endif
-
+
#ifndef _WIN32
- struct sigaction action;
- action.sa_handler = SIG_IGN;
- sigemptyset(&action.sa_mask);
- action.sa_flags = 0;
- sigaction(SIGPIPE, &action, 0);
-
- if(_initData.properties->getPropertyAsInt("Ice.UseSyslog") > 0)
- {
- identForOpenlog = _initData.properties->getProperty("Ice.ProgramName");
- if(identForOpenlog.empty())
- {
- identForOpenlog = "<Unknown Ice Program>";
- }
- openlog(identForOpenlog.c_str(), LOG_PID, LOG_USER);
- }
+ struct sigaction action;
+ action.sa_handler = SIG_IGN;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction(SIGPIPE, &action, 0);
+
+ if(_initData.properties->getPropertyAsInt("Ice.UseSyslog") > 0)
+ {
+ identForOpenlog = _initData.properties->getProperty("Ice.ProgramName");
+ if(identForOpenlog.empty())
+ {
+ identForOpenlog = "<Unknown Ice Program>";
+ }
+ openlog(identForOpenlog.c_str(), LOG_PID, LOG_USER);
+ }
#endif
- }
-
- sync.release();
-
+ }
+
+ sync.release();
+
- if(!_initData.logger)
- {
+ if(!_initData.logger)
+ {
#ifdef _WIN32
- if(_initData.properties->getPropertyAsInt("Ice.UseEventLog") > 0)
- {
- _initData.logger = new EventLoggerI(_initData.properties->getProperty("Ice.ProgramName"));
- }
+ if(_initData.properties->getPropertyAsInt("Ice.UseEventLog") > 0)
+ {
+ _initData.logger = new EventLoggerI(_initData.properties->getProperty("Ice.ProgramName"));
+ }
#else
- if(_initData.properties->getPropertyAsInt("Ice.UseSyslog") > 0)
- {
- _initData.logger = new SysLoggerI;
- }
+ if(_initData.properties->getPropertyAsInt("Ice.UseSyslog") > 0)
+ {
+ _initData.logger = new SysLoggerI;
+ }
#endif
- else
- {
- _initData.logger = getProcessLogger();
- }
- }
-
- const_cast<TraceLevelsPtr&>(_traceLevels) = new TraceLevels(_initData.properties);
-
- const_cast<DefaultsAndOverridesPtr&>(_defaultsAndOverrides) = new DefaultsAndOverrides(_initData.properties);
-
- {
- static const int defaultMessageSizeMax = 1024;
- Int num = _initData.properties->getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
- if(num < 1)
- {
- const_cast<size_t&>(_messageSizeMax) = defaultMessageSizeMax * 1024; // Ignore stupid values.
- }
- else if(static_cast<size_t>(num) > (size_t)(0x7fffffff / 1024))
- {
- const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(0x7fffffff);
- }
- else
- {
- // Property is in kilobytes, _messageSizeMax in bytes.
- const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(num) * 1024;
- }
- }
-
- //
- // Client ACM enabled by default. Server ACM disabled by default.
- //
- const_cast<Int&>(_clientACM) = _initData.properties->getPropertyAsIntWithDefault("Ice.ACM.Client", 60);
- const_cast<Int&>(_serverACM) = _initData.properties->getPropertyAsInt("Ice.ACM.Server");
-
- const_cast<bool&>(_threadPerConnection) = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection") > 0;
-
- {
- Int stackSize = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
- if(stackSize < 0)
- {
- stackSize = 0;
- }
- const_cast<size_t&>(_threadPerConnectionStackSize) = static_cast<size_t>(stackSize);
- }
-
- const_cast<ImplicitContextIPtr&>(_implicitContext) =
- ImplicitContextI::create(_initData.properties->getProperty("Ice.ImplicitContext"));
-
- _routerManager = new RouterManager;
-
- _locatorManager = new LocatorManager;
-
- _referenceFactory = new ReferenceFactory(this, communicator);
-
- _proxyFactory = new ProxyFactory(this);
-
- _endpointFactoryManager = new EndpointFactoryManager(this);
+ else
+ {
+ _initData.logger = getProcessLogger();
+ }
+ }
+
+ const_cast<TraceLevelsPtr&>(_traceLevels) = new TraceLevels(_initData.properties);
+
+ const_cast<DefaultsAndOverridesPtr&>(_defaultsAndOverrides) = new DefaultsAndOverrides(_initData.properties);
+
+ {
+ static const int defaultMessageSizeMax = 1024;
+ Int num = _initData.properties->getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
+ if(num < 1)
+ {
+ const_cast<size_t&>(_messageSizeMax) = defaultMessageSizeMax * 1024; // Ignore stupid values.
+ }
+ else if(static_cast<size_t>(num) > (size_t)(0x7fffffff / 1024))
+ {
+ const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(0x7fffffff);
+ }
+ else
+ {
+ // Property is in kilobytes, _messageSizeMax in bytes.
+ const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(num) * 1024;
+ }
+ }
+
+ //
+ // Client ACM enabled by default. Server ACM disabled by default.
+ //
+ const_cast<Int&>(_clientACM) = _initData.properties->getPropertyAsIntWithDefault("Ice.ACM.Client", 60);
+ const_cast<Int&>(_serverACM) = _initData.properties->getPropertyAsInt("Ice.ACM.Server");
+
+ const_cast<bool&>(_threadPerConnection) = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection") > 0;
+
+ {
+ Int stackSize = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
+ if(stackSize < 0)
+ {
+ stackSize = 0;
+ }
+ const_cast<size_t&>(_threadPerConnectionStackSize) = static_cast<size_t>(stackSize);
+ }
+
+ const_cast<ImplicitContextIPtr&>(_implicitContext) =
+ ImplicitContextI::create(_initData.properties->getProperty("Ice.ImplicitContext"));
+
+ _routerManager = new RouterManager;
+
+ _locatorManager = new LocatorManager;
+
+ _referenceFactory = new ReferenceFactory(this, communicator);
+
+ _proxyFactory = new ProxyFactory(this);
+
+ _endpointFactoryManager = new EndpointFactoryManager(this);
EndpointFactoryPtr tcpEndpointFactory = new TcpEndpointFactory(this);
_endpointFactoryManager->add(tcpEndpointFactory);
EndpointFactoryPtr udpEndpointFactory = new UdpEndpointFactory(this);
@@ -656,28 +656,28 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_pluginManager = new PluginManagerI(communicator, _dynamicLibraryList);
- _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
+ _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
- _servantFactoryManager = new ObjectFactoryManager();
+ _servantFactoryManager = new ObjectFactoryManager();
- _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
+ _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
- if(_initData.wstringConverter == 0)
- {
- _initData.wstringConverter = new UnicodeWstringConverter();
- }
+ if(_initData.wstringConverter == 0)
+ {
+ _initData.wstringConverter = new UnicodeWstringConverter();
+ }
- __setNoDelete(false);
+ __setNoDelete(false);
}
catch(...)
{
- {
- IceUtil::StaticMutex::Lock sync(staticMutex);
- --instanceCount;
- }
- destroy();
- __setNoDelete(false);
- throw;
+ {
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ --instanceCount;
+ }
+ destroy();
+ __setNoDelete(false);
+ throw;
}
}
@@ -703,21 +703,21 @@ IceInternal::Instance::~Instance()
if(--instanceCount == 0)
{
#ifdef _WIN32
- WSACleanup();
+ WSACleanup();
#endif
-
+
#ifndef _WIN32
- struct sigaction action;
- action.sa_handler = SIG_DFL;
- sigemptyset(&action.sa_mask);
- action.sa_flags = 0;
- sigaction(SIGPIPE, &action, 0);
-
- if(!identForOpenlog.empty())
- {
- closelog();
- identForOpenlog.clear();
- }
+ struct sigaction action;
+ action.sa_handler = SIG_DFL;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction(SIGPIPE, &action, 0);
+
+ if(!identForOpenlog.empty())
+ {
+ closelog();
+ identForOpenlog.clear();
+ }
#endif
}
}
@@ -755,24 +755,24 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
bool printProcessId = false;
if(!printProcessIdDone && _initData.properties->getPropertyAsInt("Ice.PrintProcessId") > 0)
{
- //
- // Safe double-check locking (no dependent variable!)
- //
- IceUtil::StaticMutex::Lock sync(staticMutex);
- printProcessId = !printProcessIdDone;
-
- //
- // We anticipate: we want to print it once, and we don't care when.
- //
- printProcessIdDone = true;
+ //
+ // Safe double-check locking (no dependent variable!)
+ //
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ printProcessId = !printProcessIdDone;
+
+ //
+ // We anticipate: we want to print it once, and we don't care when.
+ //
+ printProcessIdDone = true;
}
if(printProcessId)
{
#ifdef _MSC_VER
- cout << _getpid() << endl;
+ cout << _getpid() << endl;
#else
- cout << getpid() << endl;
+ cout << getpid() << endl;
#endif
}
@@ -782,20 +782,20 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
Int interval = 0;
if(_clientACM > 0 && _serverACM > 0)
{
- interval = min(_clientACM, _serverACM);
+ interval = min(_clientACM, _serverACM);
}
else if(_clientACM > 0)
{
- interval = _clientACM;
+ interval = _clientACM;
}
else if(_serverACM > 0)
{
- interval = _serverACM;
+ interval = _serverACM;
}
interval = _initData.properties->getPropertyAsIntWithDefault("Ice.MonitorConnections", interval);
if(interval > 0)
{
- _connectionMonitor = new ConnectionMonitor(this, interval);
+ _connectionMonitor = new ConnectionMonitor(this, interval);
}
//
@@ -808,29 +808,29 @@ bool
IceInternal::Instance::destroy()
{
{
- IceUtil::RecMutex::Lock sync(*this);
-
- //
- // If the _state is not StateActive then the instance is
- // either being destroyed, or has already been destroyed.
- //
- if(_state != StateActive)
- {
- return false;
- }
+ IceUtil::RecMutex::Lock sync(*this);
+
+ //
+ // If the _state is not StateActive then the instance is
+ // either being destroyed, or has already been destroyed.
+ //
+ if(_state != StateActive)
+ {
+ return false;
+ }
- //
- // We cannot set state to StateDestroyed otherwise instance
- // methods called during the destroy process (such as
- // outgoingConnectionFactory() from
- // ObjectAdapterI::deactivate() will cause an exception.
- //
- _state = StateDestroyInProgress;
+ //
+ // We cannot set state to StateDestroyed otherwise instance
+ // methods called during the destroy process (such as
+ // outgoingConnectionFactory() from
+ // ObjectAdapterI::deactivate() will cause an exception.
+ //
+ _state = StateDestroyInProgress;
}
if(_objectAdapterFactory)
{
- _objectAdapterFactory->shutdown();
+ _objectAdapterFactory->shutdown();
}
if(_outgoingConnectionFactory)
@@ -852,74 +852,74 @@ IceInternal::Instance::destroy()
ThreadPoolPtr clientThreadPool;
{
- IceUtil::RecMutex::Lock sync(*this);
-
- _objectAdapterFactory = 0;
- _outgoingConnectionFactory = 0;
-
- if(_connectionMonitor)
- {
- _connectionMonitor->destroy();
- _connectionMonitor = 0;
- }
-
- if(_serverThreadPool)
- {
- _serverThreadPool->destroy();
- std::swap(_serverThreadPool, serverThreadPool);
- }
-
- if(_clientThreadPool)
- {
- _clientThreadPool->destroy();
- std::swap(_clientThreadPool, clientThreadPool);
- }
-
- if(_servantFactoryManager)
- {
- _servantFactoryManager->destroy();
- _servantFactoryManager = 0;
- }
-
- if(_referenceFactory)
- {
- _referenceFactory->destroy();
- _referenceFactory = 0;
- }
-
- // No destroy function defined.
- // _proxyFactory->destroy();
- _proxyFactory = 0;
-
- if(_routerManager)
- {
- _routerManager->destroy();
- _routerManager = 0;
- }
-
- if(_locatorManager)
- {
- _locatorManager->destroy();
- _locatorManager = 0;
- }
-
- if(_endpointFactoryManager)
- {
- _endpointFactoryManager->destroy();
- _endpointFactoryManager = 0;
- }
-
- if(_pluginManager)
- {
- _pluginManager->destroy();
- _pluginManager = 0;
- }
-
- // No destroy function defined.
- // _dynamicLibraryList->destroy();
- _dynamicLibraryList = 0;
-
- _state = StateDestroyed;
+ IceUtil::RecMutex::Lock sync(*this);
+
+ _objectAdapterFactory = 0;
+ _outgoingConnectionFactory = 0;
+
+ if(_connectionMonitor)
+ {
+ _connectionMonitor->destroy();
+ _connectionMonitor = 0;
+ }
+
+ if(_serverThreadPool)
+ {
+ _serverThreadPool->destroy();
+ std::swap(_serverThreadPool, serverThreadPool);
+ }
+
+ if(_clientThreadPool)
+ {
+ _clientThreadPool->destroy();
+ std::swap(_clientThreadPool, clientThreadPool);
+ }
+
+ if(_servantFactoryManager)
+ {
+ _servantFactoryManager->destroy();
+ _servantFactoryManager = 0;
+ }
+
+ if(_referenceFactory)
+ {
+ _referenceFactory->destroy();
+ _referenceFactory = 0;
+ }
+
+ // No destroy function defined.
+ // _proxyFactory->destroy();
+ _proxyFactory = 0;
+
+ if(_routerManager)
+ {
+ _routerManager->destroy();
+ _routerManager = 0;
+ }
+
+ if(_locatorManager)
+ {
+ _locatorManager->destroy();
+ _locatorManager = 0;
+ }
+
+ if(_endpointFactoryManager)
+ {
+ _endpointFactoryManager->destroy();
+ _endpointFactoryManager = 0;
+ }
+
+ if(_pluginManager)
+ {
+ _pluginManager->destroy();
+ _pluginManager = 0;
+ }
+
+ // No destroy function defined.
+ // _dynamicLibraryList->destroy();
+ _dynamicLibraryList = 0;
+
+ _state = StateDestroyed;
}
//
@@ -927,11 +927,11 @@ IceInternal::Instance::destroy()
//
if(clientThreadPool)
{
- clientThreadPool->joinWithAllThreads();
+ clientThreadPool->joinWithAllThreads();
}
if(serverThreadPool)
{
- serverThreadPool->joinWithAllThreads();
+ serverThreadPool->joinWithAllThreads();
}
return true;
}
@@ -956,7 +956,7 @@ IceInternal::UTF8BufferI::getMoreBytes(size_t howMany, Byte* firstUnused)
}
else
{
- assert(firstUnused != 0);
+ assert(firstUnused != 0);
_offset = firstUnused - _buffer;
_buffer = (Byte*)realloc(_buffer, _offset + howMany);
}
diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h
index 3a4245ff2b7..27f875fc181 100644
--- a/cpp/src/Ice/Instance.h
+++ b/cpp/src/Ice/Instance.h
@@ -81,7 +81,7 @@ public:
const Ice::ImplicitContextIPtr& getImplicitContext() const
{
- return _implicitContext;
+ return _implicitContext;
}
private:
@@ -94,9 +94,9 @@ private:
enum State
{
- StateActive,
- StateDestroyInProgress,
- StateDestroyed
+ StateActive,
+ StateDestroyInProgress,
+ StateDestroyed
};
State _state;
Ice::InitializationData _initData;
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index 146126f95ab..15e27d67d03 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -54,7 +54,7 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc)
{
if(!loc)
{
- return 0;
+ return 0;
}
LocatorPrx locator = LocatorPrx::uncheckedCast(loc->ice_locator(0)); // The locator can't be located.
@@ -69,39 +69,39 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc)
if(_tableHint != _table.end())
{
- if(_tableHint->first == locator)
- {
- p = _tableHint;
- }
+ if(_tableHint->first == locator)
+ {
+ p = _tableHint;
+ }
}
if(p == _table.end())
{
- p = _table.find(locator);
+ p = _table.find(locator);
}
if(p == _table.end())
{
- //
- // Rely on locator identity for the adapter table. We want to
- // have only one table per locator (not one per locator
- // proxy).
- //
- map<Identity, LocatorTablePtr>::iterator t = _locatorTables.find(locator->ice_getIdentity());
- if(t == _locatorTables.end())
- {
- t = _locatorTables.insert(_locatorTables.begin(),
- pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(),
- new LocatorTable()));
- }
-
- _tableHint = _table.insert(_tableHint,
- pair<const LocatorPrx, LocatorInfoPtr>(locator,
- new LocatorInfo(locator, t->second)));
+ //
+ // Rely on locator identity for the adapter table. We want to
+ // have only one table per locator (not one per locator
+ // proxy).
+ //
+ map<Identity, LocatorTablePtr>::iterator t = _locatorTables.find(locator->ice_getIdentity());
+ if(t == _locatorTables.end())
+ {
+ t = _locatorTables.insert(_locatorTables.begin(),
+ pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(),
+ new LocatorTable()));
+ }
+
+ _tableHint = _table.insert(_tableHint,
+ pair<const LocatorPrx, LocatorInfoPtr>(locator,
+ new LocatorInfo(locator, t->second)));
}
else
{
- _tableHint = p;
+ _tableHint = p;
}
return _tableHint->second;
@@ -125,7 +125,7 @@ IceInternal::LocatorTable::getAdapterEndpoints(const string& adapter, int ttl, v
{
if(ttl == 0) // No locator cache.
{
- return false;
+ return false;
}
IceUtil::Mutex::Lock sync(*this);
@@ -134,8 +134,8 @@ IceInternal::LocatorTable::getAdapterEndpoints(const string& adapter, int ttl, v
if(p != _adapterEndpointsMap.end() && checkTTL(p->second.first, ttl))
{
- endpoints = p->second.second;
- return true;
+ endpoints = p->second.second;
+ return true;
}
return false;
}
@@ -149,11 +149,11 @@ IceInternal::LocatorTable::addAdapterEndpoints(const string& adapter, const vect
if(p != _adapterEndpointsMap.end())
{
- p->second = make_pair(IceUtil::Time::now(), endpoints);
+ p->second = make_pair(IceUtil::Time::now(), endpoints);
}
else
{
- _adapterEndpointsMap.insert(make_pair(adapter, make_pair(IceUtil::Time::now(), endpoints)));
+ _adapterEndpointsMap.insert(make_pair(adapter, make_pair(IceUtil::Time::now(), endpoints)));
}
}
@@ -165,7 +165,7 @@ IceInternal::LocatorTable::removeAdapterEndpoints(const string& adapter)
map<string, pair<IceUtil::Time, vector<EndpointIPtr> > >::iterator p = _adapterEndpointsMap.find(adapter);
if(p == _adapterEndpointsMap.end())
{
- return vector<EndpointIPtr>();
+ return vector<EndpointIPtr>();
}
vector<EndpointIPtr> endpoints = p->second.second;
@@ -180,7 +180,7 @@ IceInternal::LocatorTable::getProxy(const Identity& id, int ttl, ObjectPrx& prox
{
if(ttl == 0) // No locator cache
{
- return false;
+ return false;
}
IceUtil::Mutex::Lock sync(*this);
@@ -189,8 +189,8 @@ IceInternal::LocatorTable::getProxy(const Identity& id, int ttl, ObjectPrx& prox
if(p != _objectMap.end() && checkTTL(p->second.first, ttl))
{
- proxy = p->second.second;
- return true;
+ proxy = p->second.second;
+ return true;
}
return false;
}
@@ -204,11 +204,11 @@ IceInternal::LocatorTable::addProxy(const Identity& id, const ObjectPrx& proxy)
if(p != _objectMap.end())
{
- p->second = make_pair(IceUtil::Time::now(), proxy);
+ p->second = make_pair(IceUtil::Time::now(), proxy);
}
else
{
- _objectMap.insert(make_pair(id, make_pair(IceUtil::Time::now(), proxy)));
+ _objectMap.insert(make_pair(id, make_pair(IceUtil::Time::now(), proxy)));
}
}
@@ -220,7 +220,7 @@ IceInternal::LocatorTable::removeProxy(const Identity& id)
map<Identity, pair<IceUtil::Time, ObjectPrx> >::iterator p = _objectMap.find(id);
if(p == _objectMap.end())
{
- return 0;
+ return 0;
}
ObjectPrx proxy = p->second.second;
@@ -234,11 +234,11 @@ IceInternal::LocatorTable::checkTTL(const IceUtil::Time& time, int ttl) const
assert(ttl != 0);
if (ttl < 0) // TTL = infinite
{
- return true;
+ return true;
}
else
{
- return IceUtil::Time::now() - time <= IceUtil::Time::seconds(ttl);
+ return IceUtil::Time::now() - time <= IceUtil::Time::seconds(ttl);
}
}
@@ -293,12 +293,12 @@ IceInternal::LocatorInfo::getLocatorRegistry()
if(!_locatorRegistry) // Lazy initialization.
{
- _locatorRegistry = _locator->getRegistry();
+ _locatorRegistry = _locator->getRegistry();
- //
- // The locator registry can't be located.
- //
- _locatorRegistry = LocatorRegistryPrx::uncheckedCast(_locatorRegistry->ice_locator(0));
+ //
+ // The locator registry can't be located.
+ //
+ _locatorRegistry = LocatorRegistryPrx::uncheckedCast(_locatorRegistry->ice_locator(0));
}
return _locatorRegistry;
@@ -312,156 +312,156 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, int ttl,
cached = true;
try
{
- if(!ref->getAdapterId().empty())
- {
- if(!_table->getAdapterEndpoints(ref->getAdapterId(), ttl, endpoints))
- {
- cached = false;
-
- if(ref->getInstance()->traceLevels()->location >= 1)
- {
- Trace out(ref->getInstance()->initializationData().logger,
- ref->getInstance()->traceLevels()->locationCat);
- out << "searching for adapter by id" << "\n";
- out << "adapter = " << ref->getAdapterId();
- }
-
- object = _locator->findAdapterById(ref->getAdapterId());
- if(object)
- {
- endpoints = object->__reference()->getEndpoints();
- _table->addAdapterEndpoints(ref->getAdapterId(), endpoints);
- }
- }
- }
- else
- {
- bool objectCached = true;
- if(!_table->getProxy(ref->getIdentity(), ttl, object))
- {
- if(ref->getInstance()->traceLevels()->location >= 1)
- {
- Trace out(ref->getInstance()->initializationData().logger,
- ref->getInstance()->traceLevels()->locationCat);
- out << "searching for object by id" << "\n";
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
- }
-
- objectCached = false;
- object = _locator->findObjectById(ref->getIdentity());
- }
-
- bool endpointsCached = true;
- if(object)
- {
- DirectReferencePtr odr = DirectReferencePtr::dynamicCast(object->__reference());
- if(odr)
- {
- endpointsCached = false;
- endpoints = odr->getEndpoints();
- }
- else
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- assert(oir);
- if(!oir->getAdapterId().empty())
- {
- endpoints = getEndpoints(oir, ttl, endpointsCached);
- }
- }
- }
-
- if(!objectCached && !endpoints.empty())
- {
- _table->addProxy(ref->getIdentity(), object);
- }
-
- cached = objectCached || endpointsCached;
- }
+ if(!ref->getAdapterId().empty())
+ {
+ if(!_table->getAdapterEndpoints(ref->getAdapterId(), ttl, endpoints))
+ {
+ cached = false;
+
+ if(ref->getInstance()->traceLevels()->location >= 1)
+ {
+ Trace out(ref->getInstance()->initializationData().logger,
+ ref->getInstance()->traceLevels()->locationCat);
+ out << "searching for adapter by id" << "\n";
+ out << "adapter = " << ref->getAdapterId();
+ }
+
+ object = _locator->findAdapterById(ref->getAdapterId());
+ if(object)
+ {
+ endpoints = object->__reference()->getEndpoints();
+ _table->addAdapterEndpoints(ref->getAdapterId(), endpoints);
+ }
+ }
+ }
+ else
+ {
+ bool objectCached = true;
+ if(!_table->getProxy(ref->getIdentity(), ttl, object))
+ {
+ if(ref->getInstance()->traceLevels()->location >= 1)
+ {
+ Trace out(ref->getInstance()->initializationData().logger,
+ ref->getInstance()->traceLevels()->locationCat);
+ out << "searching for object by id" << "\n";
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
+ }
+
+ objectCached = false;
+ object = _locator->findObjectById(ref->getIdentity());
+ }
+
+ bool endpointsCached = true;
+ if(object)
+ {
+ DirectReferencePtr odr = DirectReferencePtr::dynamicCast(object->__reference());
+ if(odr)
+ {
+ endpointsCached = false;
+ endpoints = odr->getEndpoints();
+ }
+ else
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ assert(oir);
+ if(!oir->getAdapterId().empty())
+ {
+ endpoints = getEndpoints(oir, ttl, endpointsCached);
+ }
+ }
+ }
+
+ if(!objectCached && !endpoints.empty())
+ {
+ _table->addProxy(ref->getIdentity(), object);
+ }
+
+ cached = objectCached || endpointsCached;
+ }
}
catch(const AdapterNotFoundException&)
{
- if(ref->getInstance()->traceLevels()->location >= 1)
- {
- Trace out(ref->getInstance()->initializationData().logger,
- ref->getInstance()->traceLevels()->locationCat);
- out << "adapter not found" << "\n";
- out << "adapter = " << ref->getAdapterId();
+ if(ref->getInstance()->traceLevels()->location >= 1)
+ {
+ Trace out(ref->getInstance()->initializationData().logger,
+ ref->getInstance()->traceLevels()->locationCat);
+ out << "adapter not found" << "\n";
+ out << "adapter = " << ref->getAdapterId();
}
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object adapter";
- ex.id = ref->getAdapterId();
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object adapter";
+ ex.id = ref->getAdapterId();
+ throw ex;
}
catch(const ObjectNotFoundException&)
{
- if(ref->getInstance()->traceLevels()->location >= 1)
- {
- Trace out(ref->getInstance()->initializationData().logger,
- ref->getInstance()->traceLevels()->locationCat);
- out << "object not found" << "\n";
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
+ if(ref->getInstance()->traceLevels()->location >= 1)
+ {
+ Trace out(ref->getInstance()->initializationData().logger,
+ ref->getInstance()->traceLevels()->locationCat);
+ out << "object not found" << "\n";
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
}
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object";
- ex.id = ref->getInstance()->identityToString(ref->getIdentity());
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object";
+ ex.id = ref->getInstance()->identityToString(ref->getIdentity());
+ throw ex;
}
catch(const NotRegisteredException&)
{
- throw;
+ throw;
}
catch(const LocalException& ex)
{
- if(ref->getInstance()->traceLevels()->location >= 1)
- {
- Trace out(ref->getInstance()->initializationData().logger,
- ref->getInstance()->traceLevels()->locationCat);
- out << "couldn't contact the locator to retrieve adapter endpoints\n";
- if(ref->getAdapterId().empty())
- {
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
- }
- else
- {
- out << "adapter = " << ref->getAdapterId() << "\n";
- }
- out << "reason = " << ex;
- }
- throw;
+ if(ref->getInstance()->traceLevels()->location >= 1)
+ {
+ Trace out(ref->getInstance()->initializationData().logger,
+ ref->getInstance()->traceLevels()->locationCat);
+ out << "couldn't contact the locator to retrieve adapter endpoints\n";
+ if(ref->getAdapterId().empty())
+ {
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
+ }
+ else
+ {
+ out << "adapter = " << ref->getAdapterId() << "\n";
+ }
+ out << "reason = " << ex;
+ }
+ throw;
}
if(ref->getInstance()->traceLevels()->location >= 1)
{
if(!endpoints.empty())
- {
- if(cached)
- {
- trace("found endpoints in locator table", ref, endpoints);
- }
- else
- {
- trace("retrieved endpoints from locator, adding to locator table", ref, endpoints);
- }
- }
- else
- {
- Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
- out << "no endpoints configured for ";
- if(ref->getAdapterId().empty())
- {
- out << "object\n";
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
- }
- else
- {
- out << "adapter\n";
- out << "adapter = " << ref->getAdapterId();
- }
- }
+ {
+ if(cached)
+ {
+ trace("found endpoints in locator table", ref, endpoints);
+ }
+ else
+ {
+ trace("retrieved endpoints from locator, adding to locator table", ref, endpoints);
+ }
+ }
+ else
+ {
+ Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
+ out << "no endpoints configured for ";
+ if(ref->getAdapterId().empty())
+ {
+ out << "object\n";
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
+ }
+ else
+ {
+ out << "adapter\n";
+ out << "adapter = " << ref->getAdapterId();
+ }
+ }
}
return endpoints;
@@ -472,25 +472,25 @@ IceInternal::LocatorInfo::clearObjectCache(const IndirectReferencePtr& ref)
{
if(ref->getAdapterId().empty())
{
- ObjectPrx object = _table->removeProxy(ref->getIdentity());
- if(object)
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- if(oir)
- {
- if(!oir->getAdapterId().empty())
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
- }
- }
- }
+ ObjectPrx object = _table->removeProxy(ref->getIdentity());
+ if(object)
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ if(oir)
+ {
+ if(!oir->getAdapterId().empty())
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
+ }
+ }
+ }
}
}
@@ -499,56 +499,56 @@ IceInternal::LocatorInfo::clearCache(const IndirectReferencePtr& ref)
{
if(!ref->getAdapterId().empty())
{
- vector<EndpointIPtr> endpoints = _table->removeAdapterEndpoints(ref->getAdapterId());
+ vector<EndpointIPtr> endpoints = _table->removeAdapterEndpoints(ref->getAdapterId());
- if(!endpoints.empty() && ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, endpoints);
- }
+ if(!endpoints.empty() && ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, endpoints);
+ }
}
else
{
- ObjectPrx object = _table->removeProxy(ref->getIdentity());
- if(object)
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- if(oir)
- {
- if(!oir->getAdapterId().empty())
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
- }
- }
- }
+ ObjectPrx object = _table->removeProxy(ref->getIdentity());
+ if(object)
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ if(oir)
+ {
+ if(!oir->getAdapterId().empty())
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
+ }
+ }
+ }
}
}
void
IceInternal::LocatorInfo::trace(const string& msg,
- const IndirectReferencePtr& ref,
- const vector<EndpointIPtr>& endpoints)
+ const IndirectReferencePtr& ref,
+ const vector<EndpointIPtr>& endpoints)
{
Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
out << msg << '\n';
if(!ref->getAdapterId().empty())
{
- out << "adapter = " << ref->getAdapterId() << '\n';
+ out << "adapter = " << ref->getAdapterId() << '\n';
}
else
{
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << '\n';
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << '\n';
}
const char* sep = endpoints.size() > 1 ? ":" : "";
ostringstream o;
transform(endpoints.begin(), endpoints.end(), ostream_iterator<string>(o, sep),
- Ice::constMemFun(&Endpoint::toString));
+ Ice::constMemFun(&Endpoint::toString));
out << "endpoints = " << o.str();
}
diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp
index d347e221d91..8e4aef6f8fa 100644
--- a/cpp/src/Ice/LoggerI.cpp
+++ b/cpp/src/Ice/LoggerI.cpp
@@ -21,7 +21,7 @@ Ice::LoggerI::LoggerI(const string& prefix)
{
if(!prefix.empty())
{
- _prefix = prefix + ": ";
+ _prefix = prefix + ": ";
}
}
@@ -46,8 +46,8 @@ Ice::LoggerI::trace(const string& category, const string& message)
string::size_type idx = 0;
while((idx = s.find("\n", idx)) != string::npos)
{
- s.insert(idx + 1, " ");
- ++idx;
+ s.insert(idx + 1, " ");
+ ++idx;
}
IceUtil::StaticMutex::Lock sync(outputMutex);
diff --git a/cpp/src/Ice/LoggerUtil.cpp b/cpp/src/Ice/LoggerUtil.cpp
index ca888e23688..6d6f907ee61 100644
--- a/cpp/src/Ice/LoggerUtil.cpp
+++ b/cpp/src/Ice/LoggerUtil.cpp
@@ -30,7 +30,7 @@ Ice::Print::flush()
string s = _str.str();
if(!s.empty())
{
- _logger->print(s);
+ _logger->print(s);
}
_str.str("");
}
@@ -64,7 +64,7 @@ Ice::Warning::flush()
string s = _str.str();
if(!s.empty())
{
- _logger->warning(s);
+ _logger->warning(s);
}
_str.str("");
}
@@ -98,7 +98,7 @@ Ice::Error::flush()
string s = _str.str();
if(!s.empty())
{
- _logger->error(s);
+ _logger->error(s);
}
_str.str("");
}
@@ -133,7 +133,7 @@ Ice::Trace::flush()
string s = _str.str();
if(!s.empty())
{
- _logger->trace(_category, s);
+ _logger->trace(_category, s);
}
_str.str("");
}
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index 9cc42da481c..737f2f3f148 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -73,7 +73,7 @@ IceInternal::acceptInterrupted()
{
if(interrupted())
{
- return true;
+ return true;
}
#ifdef _WIN32
@@ -168,7 +168,7 @@ IceInternal::connectionLost()
errno == ENOTCONN ||
errno == ESHUTDOWN ||
errno == ECONNABORTED ||
- errno == EPIPE;
+ errno == EPIPE;
#endif
}
@@ -200,24 +200,24 @@ IceInternal::createSocket(bool udp)
if(udp)
{
- fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
else
{
- fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+ fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
}
if(fd == INVALID_SOCKET)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
if(!udp)
{
- setTcpNoDelay(fd);
- setKeepAlive(fd);
+ setTcpNoDelay(fd);
+ setKeepAlive(fd);
}
return fd;
@@ -230,18 +230,18 @@ IceInternal::closeSocket(SOCKET fd)
int error = WSAGetLastError();
if(closesocket(fd) == SOCKET_ERROR)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
WSASetLastError(error);
#else
int error = errno;
if(close(fd) == SOCKET_ERROR)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
errno = error;
#endif
@@ -266,29 +266,29 @@ IceInternal::shutdownSocketWrite(SOCKET fd)
{
if(shutdown(fd, SHUT_WR) == SOCKET_ERROR)
{
- //
- // Ignore errors indicating that we are shutdown already.
- //
+ //
+ // Ignore errors indicating that we are shutdown already.
+ //
#if defined(_WIN32)
- int error = WSAGetLastError();
- if(error == WSAENOTCONN)
- {
- return;
- }
+ int error = WSAGetLastError();
+ if(error == WSAENOTCONN)
+ {
+ return;
+ }
#elif defined(__APPLE__)
- if(errno == ENOTCONN || errno == EINVAL)
- {
- return;
- }
+ if(errno == ENOTCONN || errno == EINVAL)
+ {
+ return;
+ }
#else
- if(errno == ENOTCONN)
- {
- return;
- }
+ if(errno == ENOTCONN)
+ {
+ return;
+ }
#endif
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -297,30 +297,30 @@ IceInternal::shutdownSocketReadWrite(SOCKET fd)
{
if(shutdown(fd, SHUT_RDWR) == SOCKET_ERROR)
{
- //
- // Ignore errors indicating that we are shutdown already.
- //
+ //
+ // Ignore errors indicating that we are shutdown already.
+ //
#if defined(_WIN32)
- int error = WSAGetLastError();
- if(error == WSAENOTCONN)
- {
- return;
- }
+ int error = WSAGetLastError();
+ if(error == WSAENOTCONN)
+ {
+ return;
+ }
#elif defined(__APPLE__)
- if(errno == ENOTCONN || errno == EINVAL)
- {
- return;
- }
+ if(errno == ENOTCONN || errno == EINVAL)
+ {
+ return;
+ }
#else
- if(errno == ENOTCONN)
- {
- return;
- }
+ if(errno == ENOTCONN)
+ {
+ return;
+ }
#endif
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -330,47 +330,47 @@ IceInternal::setBlock(SOCKET fd, bool block)
if(block)
{
#ifdef _WIN32
- unsigned long arg = 0;
- if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
+ unsigned long arg = 0;
+ if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
#else
- int flags = fcntl(fd, F_GETFL);
- flags &= ~O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = errno;
- throw ex;
- }
+ int flags = fcntl(fd, F_GETFL);
+ flags &= ~O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = errno;
+ throw ex;
+ }
#endif
}
else
{
#ifdef _WIN32
- unsigned long arg = 1;
- if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
+ unsigned long arg = 1;
+ if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
#else
- int flags = fcntl(fd, F_GETFL);
- flags |= O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = errno;
- throw ex;
- }
+ int flags = fcntl(fd, F_GETFL);
+ flags |= O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = errno;
+ throw ex;
+ }
#endif
}
}
@@ -381,10 +381,10 @@ IceInternal::setTcpNoDelay(SOCKET fd)
int flag = 1;
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -394,10 +394,10 @@ IceInternal::setKeepAlive(SOCKET fd)
int flag = 1;
if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -406,10 +406,10 @@ IceInternal::setSendBufferSize(SOCKET fd, int sz)
{
if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&sz, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -420,10 +420,10 @@ IceInternal::getSendBufferSize(SOCKET fd)
socklen_t len = sizeof(sz);
if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&sz, &len) == SOCKET_ERROR || len != sizeof(sz))
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
return sz;
}
@@ -433,10 +433,10 @@ IceInternal::setRecvBufferSize(SOCKET fd, int sz)
{
if(setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&sz, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -447,10 +447,10 @@ IceInternal::getRecvBufferSize(SOCKET fd)
socklen_t len = sizeof(sz);
if(getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&sz, &len) == SOCKET_ERROR || len != sizeof(sz))
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
return sz;
}
@@ -462,19 +462,19 @@ IceInternal::doBind(SOCKET fd, struct sockaddr_in& addr)
int flag = 1;
if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
#endif
if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
socklen_t len = static_cast<socklen_t>(sizeof(addr));
@@ -492,15 +492,15 @@ IceInternal::doListen(SOCKET fd, int backlog)
repeatListen:
if(::listen(fd, backlog) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeatListen;
- }
-
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ if(interrupted())
+ {
+ goto repeatListen;
+ }
+
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -522,173 +522,173 @@ IceInternal::doConnect(SOCKET fd, struct sockaddr_in& addr, int timeout)
WSAEVENT event = WSACreateEvent();
if(event == 0)
{
- closeSocketNoThrow(fd);
+ closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
}
if(WSAEventSelect(fd, event, FD_CONNECT) == SOCKET_ERROR)
{
- int error = WSAGetLastError();
+ int error = WSAGetLastError();
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
}
#endif
repeatConnect:
if(::connect(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeatConnect;
- }
-
- if(connectInProgress())
- {
- int val;
+ if(interrupted())
+ {
+ goto repeatConnect;
+ }
+
+ if(connectInProgress())
+ {
+ int val;
#ifdef _WIN32
- WSAEVENT events[1];
- events[0] = event;
- long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
- DWORD rc = WSAWaitForMultipleEvents(1, events, FALSE, tout, FALSE);
- if(rc == WSA_WAIT_FAILED)
- {
- int error = WSAGetLastError();
-
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- if(rc == WSA_WAIT_TIMEOUT)
- {
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- assert(timeout >= 0);
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- assert(rc == WSA_WAIT_EVENT_0);
-
- WSANETWORKEVENTS nevents;
- if(WSAEnumNetworkEvents(fd, event, &nevents) == SOCKET_ERROR)
- {
- int error = WSAGetLastError();
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- //
- // Now we close the event, because we're finished and
- // this code be repeated.
- //
- WSACloseEvent(event);
-
- assert(nevents.lNetworkEvents & FD_CONNECT);
- val = nevents.iErrorCode[FD_CONNECT_BIT];
+ WSAEVENT events[1];
+ events[0] = event;
+ long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
+ DWORD rc = WSAWaitForMultipleEvents(1, events, FALSE, tout, FALSE);
+ if(rc == WSA_WAIT_FAILED)
+ {
+ int error = WSAGetLastError();
+
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ if(rc == WSA_WAIT_TIMEOUT)
+ {
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ assert(timeout >= 0);
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ assert(rc == WSA_WAIT_EVENT_0);
+
+ WSANETWORKEVENTS nevents;
+ if(WSAEnumNetworkEvents(fd, event, &nevents) == SOCKET_ERROR)
+ {
+ int error = WSAGetLastError();
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ //
+ // Now we close the event, because we're finished and
+ // this code be repeated.
+ //
+ WSACloseEvent(event);
+
+ assert(nevents.lNetworkEvents & FD_CONNECT);
+ val = nevents.iErrorCode[FD_CONNECT_BIT];
#else
- repeatPoll:
- struct pollfd pollFd[1];
- pollFd[0].fd = fd;
- pollFd[0].events = POLLOUT;
- int ret = ::poll(pollFd, 1, timeout);
- if(ret == 0)
- {
- closeSocketNoThrow(fd);
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- else if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatPoll;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- //
- // Strange windows bug: The following call to Sleep() is
- // necessary, otherwise no error is reported through
- // getsockopt.
- //
- //Sleep(0);
- socklen_t len = static_cast<socklen_t>(sizeof(int));
- if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ repeatPoll:
+ struct pollfd pollFd[1];
+ pollFd[0].fd = fd;
+ pollFd[0].events = POLLOUT;
+ int ret = ::poll(pollFd, 1, timeout);
+ if(ret == 0)
+ {
+ closeSocketNoThrow(fd);
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ else if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatPoll;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ //
+ // Strange windows bug: The following call to Sleep() is
+ // necessary, otherwise no error is reported through
+ // getsockopt.
+ //
+ //Sleep(0);
+ socklen_t len = static_cast<socklen_t>(sizeof(int));
+ if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
#endif
-
- if(val > 0)
- {
- closeSocketNoThrow(fd);
+
+ if(val > 0)
+ {
+ closeSocketNoThrow(fd);
#ifdef _WIN32
- WSASetLastError(val);
+ WSASetLastError(val);
#else
- errno = val;
+ errno = val;
#endif
- if(connectionRefused())
- {
- ConnectionRefusedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else if(connectFailed())
- {
- ConnectFailedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- return;
- }
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ return;
+ }
- closeSocketNoThrow(fd);
- if(connectionRefused())
- {
- ConnectionRefusedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else if(connectFailed())
- {
- ConnectFailedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ closeSocketNoThrow(fd);
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
}
}
@@ -704,60 +704,60 @@ IceInternal::doAccept(SOCKET fd, int timeout)
repeatAccept:
if((ret = ::accept(fd, 0, 0)) == INVALID_SOCKET)
{
- if(acceptInterrupted())
- {
- goto repeatAccept;
- }
-
- if(wouldBlock())
- {
- repeatSelect:
- int rs;
+ if(acceptInterrupted())
+ {
+ goto repeatAccept;
+ }
+
+ if(wouldBlock())
+ {
+ repeatSelect:
+ int rs;
#ifdef _WIN32
- fd_set fdSet;
- FD_ZERO(&fdSet);
- FD_SET(fd, &fdSet);
- if(timeout >= 0)
- {
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- rs = ::select(static_cast<int>(fd + 1), &fdSet, 0, 0, &tv);
- }
- else
- {
- rs = ::select(static_cast<int>(fd + 1), &fdSet, 0, 0, 0);
- }
+ fd_set fdSet;
+ FD_ZERO(&fdSet);
+ FD_SET(fd, &fdSet);
+ if(timeout >= 0)
+ {
+ struct timeval tv;
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
+ rs = ::select(static_cast<int>(fd + 1), &fdSet, 0, 0, &tv);
+ }
+ else
+ {
+ rs = ::select(static_cast<int>(fd + 1), &fdSet, 0, 0, 0);
+ }
#else
- struct pollfd pollFd[1];
- pollFd[0].fd = fd;
- pollFd[0].events = POLLIN;
- rs = ::poll(pollFd, 1, timeout);
+ struct pollfd pollFd[1];
+ pollFd[0].fd = fd;
+ pollFd[0].events = POLLIN;
+ rs = ::poll(pollFd, 1, timeout);
#endif
-
- if(rs == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatSelect;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- if(rs == 0)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- goto repeatAccept;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+
+ if(rs == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatSelect;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ if(rs == 0)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ goto repeatAccept;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
setTcpNoDelay(ret);
@@ -786,59 +786,59 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
{
#ifdef _WIN32
- //
- // Windows XP has getaddrinfo(), but we don't want to require XP to run Ice.
- //
-
- //
- // gethostbyname() is thread safe on Windows, with a separate hostent per thread
- //
- struct hostent* entry;
- int retry = 5;
- do
- {
- entry = gethostbyname(host.c_str());
- }
- while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
-
- if(entry == 0)
- {
- DNSException ex(__FILE__, __LINE__);
-
- ex.error = WSAGetLastError();
- ex.host = host;
- throw ex;
- }
- memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
+ //
+ // Windows XP has getaddrinfo(), but we don't want to require XP to run Ice.
+ //
+
+ //
+ // gethostbyname() is thread safe on Windows, with a separate hostent per thread
+ //
+ struct hostent* entry;
+ int retry = 5;
+ do
+ {
+ entry = gethostbyname(host.c_str());
+ }
+ while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
+
+ if(entry == 0)
+ {
+ DNSException ex(__FILE__, __LINE__);
+
+ ex.error = WSAGetLastError();
+ ex.host = host;
+ throw ex;
+ }
+ memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
#else
- struct addrinfo* info = 0;
- int retry = 5;
-
- struct addrinfo hints = { 0 };
- hints.ai_family = PF_INET;
-
- int rs = 0;
- do
- {
- rs = getaddrinfo(host.c_str(), 0, &hints, &info);
- }
- while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
-
- if(rs != 0)
- {
- DNSException ex(__FILE__, __LINE__);
- ex.error = rs;
- ex.host = host;
- throw ex;
- }
-
- assert(info->ai_family == PF_INET);
- struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
-
- addr.sin_addr.s_addr = sin->sin_addr.s_addr;
- freeaddrinfo(info);
+ struct addrinfo* info = 0;
+ int retry = 5;
+
+ struct addrinfo hints = { 0 };
+ hints.ai_family = PF_INET;
+
+ int rs = 0;
+ do
+ {
+ rs = getaddrinfo(host.c_str(), 0, &hints, &info);
+ }
+ while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
+
+ if(rs != 0)
+ {
+ DNSException ex(__FILE__, __LINE__);
+ ex.error = rs;
+ ex.host = host;
+ throw ex;
+ }
+
+ assert(info->ai_family == PF_INET);
+ struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
+
+ addr.sin_addr.s_addr = sin->sin_addr.s_addr;
+ freeaddrinfo(info);
#endif
}
@@ -871,12 +871,12 @@ IceInternal::createPipe(SOCKET fds[2])
try
{
- fds[0] = createSocket(false);
+ fds[0] = createSocket(false);
}
catch(...)
{
- ::closesocket(fd);
- throw;
+ ::closesocket(fd);
+ throw;
}
try
@@ -886,19 +886,19 @@ IceInternal::createPipe(SOCKET fds[2])
}
catch(...)
{
- ::closesocket(fd);
- throw;
+ ::closesocket(fd);
+ throw;
}
try
{
- fds[1] = doAccept(fd, -1);
+ fds[1] = doAccept(fd, -1);
}
catch(...)
{
- ::closesocket(fds[0]);
- ::closesocket(fd);
- throw;
+ ::closesocket(fds[0]);
+ ::closesocket(fd);
+ throw;
}
::closesocket(fd);
@@ -909,18 +909,18 @@ IceInternal::createPipe(SOCKET fds[2])
}
catch(...)
{
- ::closesocket(fds[0]);
- ::closesocket(fd);
- throw;
+ ::closesocket(fds[0]);
+ ::closesocket(fd);
+ throw;
}
#else
if(::pipe(fds) != 0)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
try
@@ -929,8 +929,8 @@ IceInternal::createPipe(SOCKET fds[2])
}
catch(...)
{
- closeSocketNoThrow(fds[1]);
- throw;
+ closeSocketNoThrow(fds[1]);
+ throw;
}
try
@@ -939,8 +939,8 @@ IceInternal::createPipe(SOCKET fds[2])
}
catch(...)
{
- closeSocketNoThrow(fds[0]);
- throw;
+ closeSocketNoThrow(fds[0]);
+ throw;
}
#endif
@@ -953,196 +953,196 @@ IceInternal::errorToString(int error)
{
if(error < WSABASEERR)
{
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
- if(ok)
- {
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((const char*)msg) > 0);
- string result = (const char*)msg;
- if(result[result.length() - 1] == '\n')
- {
- result = result.substr(0, result.length() - 2);
- }
- LocalFree(lpMsgBuf);
- return result;
- }
- else
- {
- ostringstream os;
- os << "unknown error: " << error;
- return os.str();
- }
+ LPVOID lpMsgBuf = 0;
+ DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
+ if(ok)
+ {
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((const char*)msg) > 0);
+ string result = (const char*)msg;
+ if(result[result.length() - 1] == '\n')
+ {
+ result = result.substr(0, result.length() - 2);
+ }
+ LocalFree(lpMsgBuf);
+ return result;
+ }
+ else
+ {
+ ostringstream os;
+ os << "unknown error: " << error;
+ return os.str();
+ }
}
switch(error)
{
case WSAEINTR:
- return "WSAEINTR";
-
+ return "WSAEINTR";
+
case WSAEBADF:
- return "WSAEBADF";
-
+ return "WSAEBADF";
+
case WSAEACCES:
- return "WSAEACCES";
-
+ return "WSAEACCES";
+
case WSAEFAULT:
- return "WSAEFAULT";
-
+ return "WSAEFAULT";
+
case WSAEINVAL:
- return "WSAEINVAL";
-
+ return "WSAEINVAL";
+
case WSAEMFILE:
- return "WSAEMFILE";
-
+ return "WSAEMFILE";
+
case WSAEWOULDBLOCK:
- return "WSAEWOULDBLOCK";
-
+ return "WSAEWOULDBLOCK";
+
case WSAEINPROGRESS:
- return "WSAEINPROGRESS";
-
+ return "WSAEINPROGRESS";
+
case WSAEALREADY:
- return "WSAEALREADY";
-
+ return "WSAEALREADY";
+
case WSAENOTSOCK:
- return "WSAENOTSOCK";
-
+ return "WSAENOTSOCK";
+
case WSAEDESTADDRREQ:
- return "WSAEDESTADDRREQ";
-
+ return "WSAEDESTADDRREQ";
+
case WSAEMSGSIZE:
- return "WSAEMSGSIZE";
-
+ return "WSAEMSGSIZE";
+
case WSAEPROTOTYPE:
- return "WSAEPROTOTYPE";
-
+ return "WSAEPROTOTYPE";
+
case WSAENOPROTOOPT:
- return "WSAENOPROTOOPT";
-
+ return "WSAENOPROTOOPT";
+
case WSAEPROTONOSUPPORT:
- return "WSAEPROTONOSUPPORT";
-
+ return "WSAEPROTONOSUPPORT";
+
case WSAESOCKTNOSUPPORT:
- return "WSAESOCKTNOSUPPORT";
-
+ return "WSAESOCKTNOSUPPORT";
+
case WSAEOPNOTSUPP:
- return "WSAEOPNOTSUPP";
-
+ return "WSAEOPNOTSUPP";
+
case WSAEPFNOSUPPORT:
- return "WSAEPFNOSUPPORT";
-
+ return "WSAEPFNOSUPPORT";
+
case WSAEAFNOSUPPORT:
- return "WSAEAFNOSUPPORT";
-
+ return "WSAEAFNOSUPPORT";
+
case WSAEADDRINUSE:
- return "WSAEADDRINUSE";
-
+ return "WSAEADDRINUSE";
+
case WSAEADDRNOTAVAIL:
- return "WSAEADDRNOTAVAIL";
-
+ return "WSAEADDRNOTAVAIL";
+
case WSAENETDOWN:
- return "WSAENETDOWN";
-
+ return "WSAENETDOWN";
+
case WSAENETUNREACH:
- return "WSAENETUNREACH";
-
+ return "WSAENETUNREACH";
+
case WSAENETRESET:
- return "WSAENETRESET";
-
+ return "WSAENETRESET";
+
case WSAECONNABORTED:
- return "WSAECONNABORTED";
-
+ return "WSAECONNABORTED";
+
case WSAECONNRESET:
- return "WSAECONNRESET";
-
+ return "WSAECONNRESET";
+
case WSAENOBUFS:
- return "WSAENOBUFS";
-
+ return "WSAENOBUFS";
+
case WSAEISCONN:
- return "WSAEISCONN";
-
+ return "WSAEISCONN";
+
case WSAENOTCONN:
- return "WSAENOTCONN";
-
+ return "WSAENOTCONN";
+
case WSAESHUTDOWN:
- return "WSAESHUTDOWN";
-
+ return "WSAESHUTDOWN";
+
case WSAETOOMANYREFS:
- return "WSAETOOMANYREFS";
-
+ return "WSAETOOMANYREFS";
+
case WSAETIMEDOUT:
- return "WSAETIMEDOUT";
-
+ return "WSAETIMEDOUT";
+
case WSAECONNREFUSED:
- return "WSAECONNREFUSED";
-
+ return "WSAECONNREFUSED";
+
case WSAELOOP:
- return "WSAELOOP";
-
+ return "WSAELOOP";
+
case WSAENAMETOOLONG:
- return "WSAENAMETOOLONG";
-
+ return "WSAENAMETOOLONG";
+
case WSAEHOSTDOWN:
- return "WSAEHOSTDOWN";
-
+ return "WSAEHOSTDOWN";
+
case WSAEHOSTUNREACH:
- return "WSAEHOSTUNREACH";
-
+ return "WSAEHOSTUNREACH";
+
case WSAENOTEMPTY:
- return "WSAENOTEMPTY";
-
+ return "WSAENOTEMPTY";
+
case WSAEPROCLIM:
- return "WSAEPROCLIM";
-
+ return "WSAEPROCLIM";
+
case WSAEUSERS:
- return "WSAEUSERS";
-
+ return "WSAEUSERS";
+
case WSAEDQUOT:
- return "WSAEDQUOT";
-
+ return "WSAEDQUOT";
+
case WSAESTALE:
- return "WSAESTALE";
-
+ return "WSAESTALE";
+
case WSAEREMOTE:
- return "WSAEREMOTE";
-
+ return "WSAEREMOTE";
+
case WSAEDISCON:
- return "WSAEDISCON";
-
+ return "WSAEDISCON";
+
case WSASYSNOTREADY:
- return "WSASYSNOTREADY";
-
+ return "WSASYSNOTREADY";
+
case WSAVERNOTSUPPORTED:
- return "WSAVERNOTSUPPORTED";
-
+ return "WSAVERNOTSUPPORTED";
+
case WSANOTINITIALISED:
- return "WSANOTINITIALISED";
-
+ return "WSANOTINITIALISED";
+
case WSAHOST_NOT_FOUND:
- return "WSAHOST_NOT_FOUND";
-
+ return "WSAHOST_NOT_FOUND";
+
case WSATRY_AGAIN:
- return "WSATRY_AGAIN";
-
+ return "WSATRY_AGAIN";
+
case WSANO_RECOVERY:
- return "WSANO_RECOVERY";
-
+ return "WSANO_RECOVERY";
+
case WSANO_DATA:
- return "WSANO_DATA";
+ return "WSANO_DATA";
default:
{
- ostringstream os;
- os << "unknown socket error: " << error;
- return os.str();
+ ostringstream os;
+ os << "unknown socket error: " << error;
+ return os.str();
}
}
}
@@ -1184,7 +1184,7 @@ IceInternal::fdToString(SOCKET fd)
{
if(fd == INVALID_SOCKET)
{
- return "<closed>";
+ return "<closed>";
}
struct sockaddr_in localAddr;
@@ -1197,11 +1197,11 @@ IceInternal::fdToString(SOCKET fd)
s << "local address = " << addrToString(localAddr);
if(peerConnected)
{
- s << "\nremote address = " << addrToString(remoteAddr);
+ s << "\nremote address = " << addrToString(remoteAddr);
}
else
{
- s << "\nremote address = <not connected>";
+ s << "\nremote address = <not connected>";
}
return s.str();
}
@@ -1212,10 +1212,10 @@ IceInternal::fdToLocalAddress(SOCKET fd, struct sockaddr_in& addr)
socklen_t len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
if(getsockname(fd, reinterpret_cast<struct sockaddr*>(&addr), &len) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -1225,17 +1225,17 @@ IceInternal::fdToRemoteAddress(SOCKET fd, struct sockaddr_in& addr)
socklen_t len = static_cast<socklen_t>(sizeof(struct sockaddr_in));
if(getpeername(fd, reinterpret_cast<struct sockaddr*>(&addr), &len) == SOCKET_ERROR)
{
- if(notConnected())
- {
- return false;
- }
- else
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ if(notConnected())
+ {
+ return false;
+ }
+ else
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
}
return true;
@@ -1275,10 +1275,10 @@ IceInternal::getLocalHosts()
if(curr->ifa_addr && curr->ifa_addr->sa_family == AF_INET)
{
struct sockaddr_in* addr = reinterpret_cast<struct sockaddr_in*>(curr->ifa_addr);
- if(addr->sin_addr.s_addr != 0)
- {
- result.push_back(inetAddrToString((*addr).sin_addr));
- }
+ if(addr->sin_addr.s_addr != 0)
+ {
+ result.push_back(inetAddrToString((*addr).sin_addr));
+ }
}
curr = curr->ifa_next;
@@ -1312,17 +1312,17 @@ IceInternal::getLocalHosts()
int rs = ioctl(fd, cmd, &ifc);
if(rs == SOCKET_ERROR)
{
- free(ifc.ifc_buf);
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ free(ifc.ifc_buf);
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
else if(ifc.ifc_len == old_ifc_len)
{
//
- // Returned same length twice in a row, finished.
- //
+ // Returned same length twice in a row, finished.
+ //
break;
}
else
@@ -1341,10 +1341,10 @@ IceInternal::getLocalHosts()
if(ifr[i].ifr_addr.sa_family == AF_INET)
{
struct sockaddr_in* addr = reinterpret_cast<struct sockaddr_in*>(&ifr[i].ifr_addr);
- if(addr->sin_addr.s_addr != 0)
- {
- result.push_back(inetAddrToString((*addr).sin_addr));
- }
+ if(addr->sin_addr.s_addr != 0)
+ {
+ result.push_back(inetAddrToString((*addr).sin_addr));
+ }
}
}
@@ -1368,8 +1368,8 @@ IceInternal::getLocalAddresses()
buffer.resize(1024);
unsigned long len = 0;
DWORD rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0,
- &buffer[0], static_cast<DWORD>(buffer.size()),
- &len, 0, 0);
+ &buffer[0], static_cast<DWORD>(buffer.size()),
+ &len, 0, 0);
if(rs == SOCKET_ERROR)
{
//
@@ -1380,8 +1380,8 @@ IceInternal::getLocalAddresses()
{
buffer.resize(len);
rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0,
- &buffer[0], static_cast<DWORD>(buffer.size()),
- &len, 0, 0);
+ &buffer[0], static_cast<DWORD>(buffer.size()),
+ &len, 0, 0);
}
if(rs == SOCKET_ERROR)
@@ -1433,17 +1433,17 @@ IceInternal::isLocalAddress(const struct sockaddr_in& addr)
vector<struct sockaddr_in> localAddrs = getLocalAddresses();
for(vector<struct sockaddr_in>::const_iterator p = localAddrs.begin(); p != localAddrs.end(); ++p)
{
- if(compareAddress(addr0, *p))
- {
- return true;
- }
+ if(compareAddress(addr0, *p))
+ {
+ return true;
+ }
}
}
catch(const Ice::LocalException&)
{
- //
- // TODO: Warning?
- //
+ //
+ // TODO: Warning?
+ //
}
return false;
}
@@ -1455,17 +1455,17 @@ IceInternal::isPeerLocal(SOCKET fd)
struct sockaddr_in remoteAddr;
if(getpeername(fd, reinterpret_cast<struct sockaddr*>(&remoteAddr), &remoteLen) == SOCKET_ERROR)
{
- if(notConnected())
- {
- return false;
- }
- else
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ if(notConnected())
+ {
+ return false;
+ }
+ else
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
}
return isLocalAddress(remoteAddr);
}
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index dd6a5d86cd9..34e00c0cae8 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -152,31 +152,31 @@ DispatchStatus
Ice::Object::__dispatch(Incoming& in, const Current& current)
{
pair<string*, string*> r =
- equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
+ equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
if(r.first == r.second)
{
- return DispatchOperationNotExist;
- }
+ return DispatchOperationNotExist;
+ }
switch(r.first - __all)
{
case 0:
{
- return ___ice_id(in, current);
+ return ___ice_id(in, current);
}
case 1:
{
- return ___ice_ids(in, current);
+ return ___ice_ids(in, current);
}
case 2:
- {
- return ___ice_isA(in, current);
- }
- case 3:
- {
- return ___ice_ping(in, current);
- }
+ {
+ return ___ice_isA(in, current);
+ }
+ case 3:
+ {
+ return ___ice_ping(in, current);
+ }
}
assert(false);
@@ -197,8 +197,8 @@ Ice::Object::__read(BasicStream* __is, bool __rid)
{
if(__rid)
{
- string myId;
- __is->readTypeId(myId);
+ string myId;
+ __is->readTypeId(myId);
}
__is->startReadSlice();
@@ -208,7 +208,7 @@ Ice::Object::__read(BasicStream* __is, bool __rid)
__is->readSize(sz);
if(sz != 0)
{
- throw Ice::MarshalException(__FILE__, __LINE__);
+ throw Ice::MarshalException(__FILE__, __LINE__);
}
__is->endReadSlice();
@@ -228,7 +228,7 @@ Ice::Object::__read(const InputStreamPtr& __inS, bool __rid)
{
if(__rid)
{
- __inS->readTypeId();
+ __inS->readTypeId();
}
__inS->startSlice();
@@ -237,7 +237,7 @@ Ice::Object::__read(const InputStreamPtr& __inS, bool __rid)
Int sz = __inS->readSize();
if(sz != 0)
{
- throw Ice::MarshalException(__FILE__, __LINE__);
+ throw Ice::MarshalException(__FILE__, __LINE__);
}
__inS->endSlice();
@@ -256,13 +256,13 @@ operationModeToString(OperationMode mode)
switch(mode)
{
case Normal:
- return "::Ice::Normal";
+ return "::Ice::Normal";
case Nonmutating:
- return "::Ice::Nonmutating";
+ return "::Ice::Nonmutating";
case Idempotent:
- return "::Ice::Idempotent";
+ return "::Ice::Idempotent";
}
ostringstream os;
@@ -275,29 +275,29 @@ Ice::Object::__checkMode(OperationMode expected, OperationMode received)
{
if(expected != received)
{
- if(expected == Idempotent && received == Nonmutating)
- {
- //
- // Fine: typically an old client still using the deprecated nonmutating keyword
- //
-
- //
- // Note that expected == Nonmutating and received == Idempotent is not ok:
- // the server may still use the deprecated nonmutating keyword to detect updates
- // and the client should not break this (deprecated) feature.
- //
- }
- else
- {
- Ice::MarshalException ex(__FILE__, __LINE__);
- std::ostringstream __reason;
- __reason << "unexpected operation mode. expected = "
- << operationModeToString(expected)
- << " received = "
- << operationModeToString(received);
- ex.reason = __reason.str();
- throw ex;
- }
+ if(expected == Idempotent && received == Nonmutating)
+ {
+ //
+ // Fine: typically an old client still using the deprecated nonmutating keyword
+ //
+
+ //
+ // Note that expected == Nonmutating and received == Idempotent is not ok:
+ // the server may still use the deprecated nonmutating keyword to detect updates
+ // and the client should not break this (deprecated) feature.
+ //
+ }
+ else
+ {
+ Ice::MarshalException ex(__FILE__, __LINE__);
+ std::ostringstream __reason;
+ __reason << "unexpected operation mode. expected = "
+ << operationModeToString(expected)
+ << " received = "
+ << operationModeToString(received);
+ ex.reason = __reason.str();
+ throw ex;
+ }
}
}
@@ -312,11 +312,11 @@ Ice::Blobject::__dispatch(Incoming& in, const Current& current)
in.os()->writeBlob(outParams);
if(ok)
{
- return DispatchOK;
+ return DispatchOK;
}
else
{
- return DispatchUserException;
+ return DispatchUserException;
}
}
@@ -332,11 +332,11 @@ Ice::BlobjectArray::__dispatch(Incoming& in, const Current& current)
in.os()->writeBlob(outParams);
if(ok)
{
- return DispatchOK;
+ return DispatchOK;
}
else
{
- return DispatchUserException;
+ return DispatchUserException;
}
}
@@ -349,19 +349,19 @@ Ice::BlobjectAsync::__dispatch(Incoming& in, const Current& current)
AMD_Object_ice_invokePtr cb = new ::IceAsync::Ice::AMD_Object_ice_invoke(in);
try
{
- ice_invoke_async(cb, inParams, current);
+ ice_invoke_async(cb, inParams, current);
}
catch(const Exception& ex)
{
- cb->ice_exception(ex);
+ cb->ice_exception(ex);
}
catch(const ::std::exception& ex)
{
- cb->ice_exception(ex);
+ cb->ice_exception(ex);
}
catch(...)
{
- cb->ice_exception();
+ cb->ice_exception();
}
return DispatchAsync;
}
@@ -376,19 +376,19 @@ Ice::BlobjectArrayAsync::__dispatch(Incoming& in, const Current& current)
AMD_Array_Object_ice_invokePtr cb = new ::IceAsync::Ice::AMD_Array_Object_ice_invoke(in);
try
{
- ice_invoke_async(cb, inParams, current);
+ ice_invoke_async(cb, inParams, current);
}
catch(const Exception& ex)
{
- cb->ice_exception(ex);
+ cb->ice_exception(ex);
}
catch(const ::std::exception& ex)
{
- cb->ice_exception(ex);
+ cb->ice_exception(ex);
}
catch(...)
{
- cb->ice_exception();
+ cb->ice_exception();
}
return DispatchAsync;
}
diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp
index 8f93caf12a8..334be027f82 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.cpp
+++ b/cpp/src/Ice/ObjectAdapterFactory.cpp
@@ -26,23 +26,23 @@ IceInternal::ObjectAdapterFactory::shutdown()
map<string, ObjectAdapterIPtr> adapters;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // Ignore shutdown requests if the object adapter factory has
- // already been shut down.
- //
- if(!_instance)
- {
- return;
- }
-
- adapters = _adapters;
-
- _instance = 0;
- _communicator = 0;
-
- notifyAll();
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ //
+ // Ignore shutdown requests if the object adapter factory has
+ // already been shut down.
+ //
+ if(!_instance)
+ {
+ return;
+ }
+
+ adapters = _adapters;
+
+ _instance = 0;
+ _communicator = 0;
+
+ notifyAll();
}
//
@@ -50,48 +50,48 @@ IceInternal::ObjectAdapterFactory::shutdown()
// deadlocks.
//
for_each(adapters.begin(), adapters.end(),
- IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::deactivate));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::deactivate));
}
void
IceInternal::ObjectAdapterFactory::waitForShutdown()
{
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // First we wait for the shutdown of the factory itself.
- //
- while(_instance)
- {
- wait();
- }
-
- //
- // If some other thread is currently shutting down, we wait
- // until this thread is finished.
- //
- while(_waitForShutdown)
- {
- wait();
- }
- _waitForShutdown = true;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ //
+ // First we wait for the shutdown of the factory itself.
+ //
+ while(_instance)
+ {
+ wait();
+ }
+
+ //
+ // If some other thread is currently shutting down, we wait
+ // until this thread is finished.
+ //
+ while(_waitForShutdown)
+ {
+ wait();
+ }
+ _waitForShutdown = true;
}
//
// Now we wait for deactivation of each object adapter.
//
for_each(_adapters.begin(), _adapters.end(),
- IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::waitForDeactivate));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::waitForDeactivate));
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- //
- // Signal that waiting is complete.
- //
- _waitForShutdown = false;
- notifyAll();
+ //
+ // Signal that waiting is complete.
+ //
+ _waitForShutdown = false;
+ notifyAll();
}
}
@@ -114,41 +114,41 @@ IceInternal::ObjectAdapterFactory::destroy()
map<string, ObjectAdapterIPtr> adapters;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- adapters = _adapters;
- _adapters.clear();
+ adapters = _adapters;
+ _adapters.clear();
}
//
// Now we destroy each object adapter.
//
for_each(adapters.begin(), adapters.end(),
- IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::destroy));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::destroy));
}
ObjectAdapterPtr
IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const string& endpoints,
- const RouterPrx& router)
+ const RouterPrx& router)
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
if(!_instance)
{
- throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
+ throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
map<string, ObjectAdapterIPtr>::iterator p = _adapters.find(name);
if(p != _adapters.end())
{
- throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
+ throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
}
if(name.empty() && (!endpoints.empty() || router != 0))
{
InitializationException ex(__FILE__, __LINE__);
- ex.reason = "Cannot configure endpoints or router with nameless object adapter";
- throw ex;
+ ex.reason = "Cannot configure endpoints or router with nameless object adapter";
+ throw ex;
}
ObjectAdapterIPtr adapter;
@@ -156,7 +156,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const
{
string uuid = IceUtil::generateUUID();
adapter = new ObjectAdapterI(_instance, _communicator, this, uuid, "", 0, true);
- _adapters.insert(make_pair(uuid, adapter));
+ _adapters.insert(make_pair(uuid, adapter));
}
else
{
@@ -173,22 +173,22 @@ IceInternal::ObjectAdapterFactory::findObjectAdapter(const ObjectPrx& proxy)
if(!_instance)
{
- return 0;
+ return 0;
}
for(map<string, ObjectAdapterIPtr>::iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
- try
- {
- if(p->second->isLocal(proxy))
- {
- return p->second;
- }
- }
- catch(const ObjectAdapterDeactivatedException&)
- {
- // Ignore.
- }
+ try
+ {
+ if(p->second->isLocal(proxy))
+ {
+ return p->second;
+ }
+ }
+ catch(const ObjectAdapterDeactivatedException&)
+ {
+ // Ignore.
+ }
}
return 0;
@@ -213,7 +213,7 @@ struct FlushAdapter
{
void operator() (ObjectAdapterIPtr p)
{
- p->flushBatchRequests();
+ p->flushBatchRequests();
}
};
@@ -224,18 +224,18 @@ IceInternal::ObjectAdapterFactory::flushBatchRequests() const
{
list<ObjectAdapterIPtr> a;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- for(map<string, ObjectAdapterIPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
- {
- a.push_back(p->second);
- }
+ for(map<string, ObjectAdapterIPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
+ {
+ a.push_back(p->second);
+ }
}
for_each(a.begin(), a.end(), FlushAdapter());
}
IceInternal::ObjectAdapterFactory::ObjectAdapterFactory(const InstancePtr& instance,
- const CommunicatorPtr& communicator) :
+ const CommunicatorPtr& communicator) :
_instance(instance),
_communicator(communicator),
_waitForShutdown(false)
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index 483ad0542a3..b05a9697500 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -74,84 +74,84 @@ Ice::ObjectAdapterI::activate()
bool printAdapterReady = false;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- checkForDeactivation();
-
- //
- // If the one off initializations of the adapter are already
- // done, we just need to activate the incoming connection
- // factories and we're done.
- //
- if(_activateOneOffDone)
- {
- for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::activate));
- return;
- }
-
- //
- // One off initializations of the adapter: update the locator
- // registry and print the "adapter ready" message. We set the
- // _waitForActivate flag to prevent deactivation from other
- // threads while these one off initializations are done.
- //
- _waitForActivate = true;
-
- locatorInfo = _locatorInfo;
- if(!_noConfig)
- {
- PropertiesPtr properties = _instance->initializationData().properties;
- printAdapterReady = properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
- //
- // DEPREACTED PROPERTY: Remove extra code in future release
- //
- registerProcess = properties->getPropertyAsIntWithDefault(_propertyPrefix + _name + ".RegisterProcess",
- properties->getPropertyAsInt(_name + ".RegisterProcess")) > 0;
- }
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ checkForDeactivation();
+
+ //
+ // If the one off initializations of the adapter are already
+ // done, we just need to activate the incoming connection
+ // factories and we're done.
+ //
+ if(_activateOneOffDone)
+ {
+ for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ Ice::voidMemFun(&IncomingConnectionFactory::activate));
+ return;
+ }
+
+ //
+ // One off initializations of the adapter: update the locator
+ // registry and print the "adapter ready" message. We set the
+ // _waitForActivate flag to prevent deactivation from other
+ // threads while these one off initializations are done.
+ //
+ _waitForActivate = true;
+
+ locatorInfo = _locatorInfo;
+ if(!_noConfig)
+ {
+ PropertiesPtr properties = _instance->initializationData().properties;
+ printAdapterReady = properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
+ //
+ // DEPREACTED PROPERTY: Remove extra code in future release
+ //
+ registerProcess = properties->getPropertyAsIntWithDefault(_propertyPrefix + _name + ".RegisterProcess",
+ properties->getPropertyAsInt(_name + ".RegisterProcess")) > 0;
+ }
}
try
{
- Ice::Identity dummy;
- dummy.name = "dummy";
- updateLocatorRegistry(locatorInfo, createDirectProxy(dummy), registerProcess);
+ Ice::Identity dummy;
+ dummy.name = "dummy";
+ updateLocatorRegistry(locatorInfo, createDirectProxy(dummy), registerProcess);
}
catch(const Ice::LocalException&)
{
- //
- // If we couldn't update the locator registry, we let the
- // exception go through and don't activate the adapter to
- // allow to user code to retry activating the adapter
- // later.
- //
- {
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- _waitForActivate = false;
- notifyAll();
- }
- throw;
+ //
+ // If we couldn't update the locator registry, we let the
+ // exception go through and don't activate the adapter to
+ // allow to user code to retry activating the adapter
+ // later.
+ //
+ {
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ _waitForActivate = false;
+ notifyAll();
+ }
+ throw;
}
if(printAdapterReady)
{
- cout << _name << " ready" << endl;
+ cout << _name << " ready" << endl;
}
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- assert(!_deactivated); // Not possible if _waitForActivate = true;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ assert(!_deactivated); // Not possible if _waitForActivate = true;
- //
- // Signal threads waiting for the activation.
- //
- _waitForActivate = false;
- notifyAll();
+ //
+ // Signal threads waiting for the activation.
+ //
+ _waitForActivate = false;
+ notifyAll();
- _activateOneOffDone = true;
+ _activateOneOffDone = true;
- for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::activate));
+ for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ Ice::voidMemFun(&IncomingConnectionFactory::activate));
}
}
@@ -161,9 +161,9 @@ Ice::ObjectAdapterI::hold()
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
checkForDeactivation();
-
+
for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::hold));
+ Ice::voidMemFun(&IncomingConnectionFactory::hold));
}
void
@@ -174,7 +174,7 @@ Ice::ObjectAdapterI::waitForHold()
checkForDeactivation();
for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::constVoidMemFun(&IncomingConnectionFactory::waitUntilHolding));
+ Ice::constVoidMemFun(&IncomingConnectionFactory::waitUntilHolding));
}
void
@@ -184,58 +184,58 @@ Ice::ObjectAdapterI::deactivate()
OutgoingConnectionFactoryPtr outgoingConnectionFactory;
LocatorInfoPtr locatorInfo;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // Ignore deactivation requests if the object adapter has already
- // been deactivated.
- //
- if(_deactivated)
- {
- return;
- }
-
- //
- // Wait for activation to complete. This is necessary to not
- // get out of order locator updates.
- //
- while(_waitForActivate)
- {
- wait();
- }
-
- if(_routerInfo)
- {
- //
- // Remove entry from the router manager.
- //
- _instance->routerManager()->erase(_routerInfo->getRouter());
-
- //
- // Clear this object adapter with the router.
- //
- _routerInfo->setAdapter(0);
- }
-
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ //
+ // Ignore deactivation requests if the object adapter has already
+ // been deactivated.
+ //
+ if(_deactivated)
+ {
+ return;
+ }
+
+ //
+ // Wait for activation to complete. This is necessary to not
+ // get out of order locator updates.
+ //
+ while(_waitForActivate)
+ {
+ wait();
+ }
+
+ if(_routerInfo)
+ {
+ //
+ // Remove entry from the router manager.
+ //
+ _instance->routerManager()->erase(_routerInfo->getRouter());
+
+ //
+ // Clear this object adapter with the router.
+ //
+ _routerInfo->setAdapter(0);
+ }
+
incomingConnectionFactories = _incomingConnectionFactories;
- outgoingConnectionFactory = _instance->outgoingConnectionFactory();
- locatorInfo = _locatorInfo;
+ outgoingConnectionFactory = _instance->outgoingConnectionFactory();
+ locatorInfo = _locatorInfo;
- _deactivated = true;
+ _deactivated = true;
- notifyAll();
+ notifyAll();
}
try
{
- updateLocatorRegistry(locatorInfo, 0, false);
+ updateLocatorRegistry(locatorInfo, 0, false);
}
catch(const Ice::LocalException&)
{
- //
- // We can't throw exceptions in deactivate so we ignore
- // failures to update the locator registry.
- //
+ //
+ // We can't throw exceptions in deactivate so we ignore
+ // failures to update the locator registry.
+ //
}
//
@@ -244,7 +244,7 @@ Ice::ObjectAdapterI::deactivate()
// message.
//
for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::destroy));
+ Ice::voidMemFun(&IncomingConnectionFactory::destroy));
//
// Must be called outside the thread synchronization, because
@@ -260,23 +260,23 @@ Ice::ObjectAdapterI::waitForDeactivate()
vector<IceInternal::IncomingConnectionFactoryPtr> incomingConnectionFactories;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- if(_destroyed)
- {
- return;
- }
-
- //
- // Wait for deactivation of the adapter itself, and for
- // the return of all direct method calls using this adapter.
- //
- while(!_deactivated || _directCount > 0)
- {
- wait();
- }
-
- incomingConnectionFactories = _incomingConnectionFactories;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ if(_destroyed)
+ {
+ return;
+ }
+
+ //
+ // Wait for deactivation of the adapter itself, and for
+ // the return of all direct method calls using this adapter.
+ //
+ while(!_deactivated || _directCount > 0)
+ {
+ wait();
+ }
+
+ incomingConnectionFactories = _incomingConnectionFactories;
}
//
@@ -284,7 +284,7 @@ Ice::ObjectAdapterI::waitForDeactivate()
// finished.
//
for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::waitUntilFinished));
+ Ice::voidMemFun(&IncomingConnectionFactory::waitUntilFinished));
}
bool
@@ -299,26 +299,26 @@ void
Ice::ObjectAdapterI::destroy()
{
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // Another thread is in the process of destroying the object
- // adapter. Wait for it to finish.
- //
- while(_destroying)
- {
- wait();
- }
-
- //
- // Object adpater is already destroyed.
- //
- if(_destroyed)
- {
- return;
- }
-
- _destroying = true;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ //
+ // Another thread is in the process of destroying the object
+ // adapter. Wait for it to finish.
+ //
+ while(_destroying)
+ {
+ wait();
+ }
+
+ //
+ // Object adpater is already destroyed.
+ //
+ if(_destroyed)
+ {
+ return;
+ }
+
+ _destroying = true;
}
//
@@ -338,41 +338,41 @@ Ice::ObjectAdapterI::destroy()
//
if(_threadPool)
{
- _threadPool->destroy();
- _threadPool->joinWithAllThreads();
+ _threadPool->destroy();
+ _threadPool->joinWithAllThreads();
}
ObjectAdapterFactoryPtr objectAdapterFactory;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // Signal that destroy is complete.
- //
- _destroying = false;
- _destroyed = true;
- notifyAll();
-
- //
- // We're done, now we can throw away all incoming connection
- // factories.
- //
- _incomingConnectionFactories.clear();
-
- //
- // Remove object references (some of them cyclic).
- //
- _instance = 0;
- _threadPool = 0;
- _communicator = 0;
- _routerEndpoints.clear();
- _routerInfo = 0;
- _publishedEndpoints.clear();
- _locatorInfo = 0;
-
- objectAdapterFactory = _objectAdapterFactory;
- _objectAdapterFactory = 0;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ //
+ // Signal that destroy is complete.
+ //
+ _destroying = false;
+ _destroyed = true;
+ notifyAll();
+
+ //
+ // We're done, now we can throw away all incoming connection
+ // factories.
+ //
+ _incomingConnectionFactories.clear();
+
+ //
+ // Remove object references (some of them cyclic).
+ //
+ _instance = 0;
+ _threadPool = 0;
+ _communicator = 0;
+ _routerEndpoints.clear();
+ _routerInfo = 0;
+ _publishedEndpoints.clear();
+ _locatorInfo = 0;
+
+ objectAdapterFactory = _objectAdapterFactory;
+ _objectAdapterFactory = 0;
}
if(objectAdapterFactory)
@@ -549,8 +549,8 @@ Ice::ObjectAdapterI::createReverseProxy(const Identity& ident) const
vector<IncomingConnectionFactoryPtr>::const_iterator p;
for(p = _incomingConnectionFactories.begin(); p != _incomingConnectionFactories.end(); ++p)
{
- list<ConnectionIPtr> cons = (*p)->connections();
- copy(cons.begin(), cons.end(), back_inserter(connections));
+ list<ConnectionIPtr> cons = (*p)->connections();
+ copy(cons.begin(), cons.end(), back_inserter(connections));
}
//
@@ -558,7 +558,7 @@ Ice::ObjectAdapterI::createReverseProxy(const Identity& ident) const
// reference.
//
ReferencePtr ref = _instance->referenceFactory()->create(ident, _instance->getDefaultContext(),
- "", Reference::ModeTwoway, connections);
+ "", Reference::ModeTwoway, connections);
return _instance->proxyFactory()->referenceToProxy(ref);
}
@@ -582,32 +582,32 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const
IndirectReferencePtr ir = IndirectReferencePtr::dynamicCast(ref);
if(ir)
{
- if(!ir->getAdapterId().empty())
- {
- //
- // Proxy is local if the reference adapter id matches this
- // adapter id.
- //
- return ir->getAdapterId() == _id;
- }
-
- //
- // Get Locator endpoint information for indirect references.
- //
- LocatorInfoPtr info = ir->getLocatorInfo();
- if(info)
- {
- bool isCached;
- endpoints = info->getEndpoints(ir, ir->getLocatorCacheTimeout(), isCached);
- }
- else
- {
- return false;
- }
+ if(!ir->getAdapterId().empty())
+ {
+ //
+ // Proxy is local if the reference adapter id matches this
+ // adapter id.
+ //
+ return ir->getAdapterId() == _id;
+ }
+
+ //
+ // Get Locator endpoint information for indirect references.
+ //
+ LocatorInfoPtr info = ir->getLocatorInfo();
+ if(info)
+ {
+ bool isCached;
+ endpoints = info->getEndpoints(ir, ir->getLocatorCacheTimeout(), isCached);
+ }
+ else
+ {
+ return false;
+ }
}
else
{
- endpoints = ref->getEndpoints();
+ endpoints = ref->getEndpoints();
}
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
@@ -620,14 +620,14 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const
//
for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
- vector<IncomingConnectionFactoryPtr>::const_iterator q;
- for(q = _incomingConnectionFactories.begin(); q != _incomingConnectionFactories.end(); ++q)
- {
- if((*q)->equivalent(*p))
- {
- return true;
- }
- }
+ vector<IncomingConnectionFactoryPtr>::const_iterator q;
+ for(q = _incomingConnectionFactories.begin(); q != _incomingConnectionFactories.end(); ++q)
+ {
+ if((*q)->equivalent(*p))
+ {
+ return true;
+ }
+ }
}
//
@@ -639,10 +639,10 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const
{
for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
- if(binary_search(_routerEndpoints.begin(), _routerEndpoints.end(), *p)) // _routerEndpoints is sorted.
- {
- return true;
- }
+ if(binary_search(_routerEndpoints.begin(), _routerEndpoints.end(), *p)) // _routerEndpoints is sorted.
+ {
+ return true;
+ }
}
}
@@ -654,8 +654,8 @@ Ice::ObjectAdapterI::flushBatchRequests()
{
vector<IncomingConnectionFactoryPtr> f;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- f = _incomingConnectionFactories;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ f = _incomingConnectionFactories;
}
for_each(f.begin(), f.end(), Ice::voidMemFun(&IncomingConnectionFactory::flushBatchRequests));
}
@@ -683,7 +683,7 @@ Ice::ObjectAdapterI::decDirectCount()
assert(_directCount > 0);
if(--_directCount == 0)
{
- notifyAll();
+ notifyAll();
}
}
@@ -700,11 +700,11 @@ Ice::ObjectAdapterI::getThreadPool() const
if(_threadPool)
{
- return _threadPool;
+ return _threadPool;
}
else
{
- return _instance->serverThreadPool();
+ return _instance->serverThreadPool();
}
}
@@ -736,8 +736,8 @@ Ice::ObjectAdapterI::getThreadPerConnectionStackSize() const
}
Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const CommunicatorPtr& communicator,
- const ObjectAdapterFactoryPtr& objectAdapterFactory, const string& name,
- const string& endpointInfo, const RouterPrx& router, bool noConfig) :
+ const ObjectAdapterFactoryPtr& objectAdapterFactory, const string& name,
+ const string& endpointInfo, const RouterPrx& router, bool noConfig) :
_deactivated(false),
_instance(instance),
_communicator(communicator),
@@ -769,28 +769,28 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
{
StringSeq props = filterProperties(_propertyPrefix + _name + ".");
if(oldProps.size() == 0 && props.size() == 0)
- {
+ {
InitializationException ex(__FILE__, __LINE__);
- ex.reason = "object adapter \"" + _name + "\" requires configuration.";
- throw ex;
+ ex.reason = "object adapter \"" + _name + "\" requires configuration.";
+ throw ex;
}
}
if(oldProps.size() != 0)
{
- Warning out(_instance->initializationData().logger);
- out << "The following properties have been deprecated, please prepend \"Ice.OA.\":";
- for(unsigned int i = 0; i < oldProps.size(); ++i)
- {
- out << "\n " << oldProps[i];
- }
+ Warning out(_instance->initializationData().logger);
+ out << "The following properties have been deprecated, please prepend \"Ice.OA.\":";
+ for(unsigned int i = 0; i < oldProps.size(); ++i)
+ {
+ out << "\n " << oldProps[i];
+ }
}
const_cast<string&>(_id) = properties->getPropertyWithDefault(_propertyPrefix + _name + ".AdapterId",
- properties->getProperty(_name + ".AdapterId"));
+ properties->getProperty(_name + ".AdapterId"));
const_cast<string&>(_replicaGroupId) =
- properties->getPropertyWithDefault(_propertyPrefix + _name + ".ReplicaGroupId",
- properties->getProperty(_name + ".ReplicaGroupId"));
+ properties->getPropertyWithDefault(_propertyPrefix + _name + ".ReplicaGroupId",
+ properties->getProperty(_name + ".ReplicaGroupId"));
__setNoDelete(true);
try
@@ -811,7 +811,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
if(_threadPerConnection && (threadPoolSize > 0 || threadPoolSizeMax > 0))
{
InitializationException ex(__FILE__, __LINE__);
- ex.reason = "object adapter \"" + _name + "\" cannot be configured for both\n"
+ ex.reason = "object adapter \"" + _name + "\" cannot be configured for both\n"
"thread pool and thread per connection";
throw ex;
}
@@ -832,138 +832,138 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
// Create the per-adapter thread pool, if necessary. This is done before the creation of the incoming
// connection factory as the thread pool is needed during creation for the call to incFdsInUse.
//
- if(threadPoolSize > 0 || threadPoolSizeMax > 0)
- {
- if(!properties->getProperty(_propertyPrefix + _name + ".ThreadPool.Size").empty() ||
- !properties->getProperty(_propertyPrefix + _name + ".ThreadPool.SizeMax").empty())
- {
+ if(threadPoolSize > 0 || threadPoolSizeMax > 0)
+ {
+ if(!properties->getProperty(_propertyPrefix + _name + ".ThreadPool.Size").empty() ||
+ !properties->getProperty(_propertyPrefix + _name + ".ThreadPool.SizeMax").empty())
+ {
_threadPool = new ThreadPool(_instance, _propertyPrefix + _name + ".ThreadPool", 0);
- }
- else
- {
+ }
+ else
+ {
_threadPool = new ThreadPool(_instance, _name + ".ThreadPool", 0);
- }
- }
-
- if(!router)
- {
- const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast(
- _instance->proxyFactory()->propertyToProxy(_propertyPrefix + _name + ".Router"));
- if(!router)
- {
- const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast(
- _instance->proxyFactory()->propertyToProxy(_name + ".Router"));
- }
- }
- if(router)
- {
+ }
+ }
+
+ if(!router)
+ {
+ const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast(
+ _instance->proxyFactory()->propertyToProxy(_propertyPrefix + _name + ".Router"));
+ if(!router)
+ {
+ const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast(
+ _instance->proxyFactory()->propertyToProxy(_name + ".Router"));
+ }
+ }
+ if(router)
+ {
_routerInfo = _instance->routerManager()->get(router);
if(_routerInfo)
{
- //
- // Make sure this router is not already registered with another adapter.
- //
- if(_routerInfo->getAdapter())
- {
- throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter with router",
- _instance->identityToString(router->ice_getIdentity()));
- }
-
- //
- // Add the router's server proxy endpoints to this object
- // adapter.
- //
- vector<EndpointIPtr> endpoints = _routerInfo->getServerEndpoints();
- copy(endpoints.begin(), endpoints.end(), back_inserter(_routerEndpoints));
- sort(_routerEndpoints.begin(), _routerEndpoints.end()); // Must be sorted.
- _routerEndpoints.erase(unique(_routerEndpoints.begin(), _routerEndpoints.end()),
- _routerEndpoints.end());
-
- //
- // Associate this object adapter with the router. This way,
- // new outgoing connections to the router's client proxy will
- // use this object adapter for callbacks.
- //
- _routerInfo->setAdapter(this);
-
- //
- // Also modify all existing outgoing connections to the
- // router's client proxy to use this object adapter for
- // callbacks.
- //
- _instance->outgoingConnectionFactory()->setRouterInfo(_routerInfo);
+ //
+ // Make sure this router is not already registered with another adapter.
+ //
+ if(_routerInfo->getAdapter())
+ {
+ throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter with router",
+ _instance->identityToString(router->ice_getIdentity()));
+ }
+
+ //
+ // Add the router's server proxy endpoints to this object
+ // adapter.
+ //
+ vector<EndpointIPtr> endpoints = _routerInfo->getServerEndpoints();
+ copy(endpoints.begin(), endpoints.end(), back_inserter(_routerEndpoints));
+ sort(_routerEndpoints.begin(), _routerEndpoints.end()); // Must be sorted.
+ _routerEndpoints.erase(unique(_routerEndpoints.begin(), _routerEndpoints.end()),
+ _routerEndpoints.end());
+
+ //
+ // Associate this object adapter with the router. This way,
+ // new outgoing connections to the router's client proxy will
+ // use this object adapter for callbacks.
+ //
+ _routerInfo->setAdapter(this);
+
+ //
+ // Also modify all existing outgoing connections to the
+ // router's client proxy to use this object adapter for
+ // callbacks.
+ //
+ _instance->outgoingConnectionFactory()->setRouterInfo(_routerInfo);
+ }
+ }
+ else
+ {
+ //
+ // Parse the endpoints, but don't store them in the adapter.
+ // The connection factory might change it, for example, to
+ // fill in the real port number.
+ //
+ vector<EndpointIPtr> endpoints;
+ if(endpointInfo.empty())
+ {
+ endpoints = parseEndpoints(properties->getPropertyWithDefault(_propertyPrefix + _name + ".Endpoints",
+ properties->getProperty(_name + ".Endpoints")));
}
- }
- else
- {
- //
- // Parse the endpoints, but don't store them in the adapter.
- // The connection factory might change it, for example, to
- // fill in the real port number.
- //
- vector<EndpointIPtr> endpoints;
- if(endpointInfo.empty())
- {
- endpoints = parseEndpoints(properties->getPropertyWithDefault(_propertyPrefix + _name + ".Endpoints",
- properties->getProperty(_name + ".Endpoints")));
- }
- else
- {
- endpoints = parseEndpoints(endpointInfo);
- }
- for(vector<EndpointIPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
- {
- _incomingConnectionFactories.push_back(new IncomingConnectionFactory(instance, *p, this, _name));
- }
- if(endpoints.empty())
- {
- TraceLevelsPtr tl = _instance->traceLevels();
- if(tl->network >= 2)
- {
- Trace out(_instance->initializationData().logger, tl->networkCat);
- out << "created adapter `" << name << "' without endpoints";
- }
- }
-
- //
- // Parse published endpoints. If set, these are used in proxies
- // instead of the connection factory endpoints.
- //
- string endpts = properties->getPropertyWithDefault(_propertyPrefix + _name + ".PublishedEndpoints",
- properties->getProperty(_name + ".PublishedEndpoints"));
- _publishedEndpoints = parseEndpoints(endpts);
- if(_publishedEndpoints.empty())
- {
- transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- back_inserter(_publishedEndpoints), Ice::constMemFun(&IncomingConnectionFactory::endpoint));
- }
-
- //
- // Filter out any endpoints that are not meant to be published.
- //
- _publishedEndpoints.erase(remove_if(_publishedEndpoints.begin(), _publishedEndpoints.end(),
- not1(Ice::constMemFun(&EndpointI::publish))), _publishedEndpoints.end());
- }
-
- string locatorProperty = _propertyPrefix + _name + ".Locator";
- if(!properties->getProperty(locatorProperty).empty())
- {
- setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(locatorProperty)));
- }
- else if(!properties->getProperty(_name + ".Locator").empty())
- {
- setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(_name + ".Locator")));
- }
- else
- {
- setLocator(_instance->referenceFactory()->getDefaultLocator());
- }
+ else
+ {
+ endpoints = parseEndpoints(endpointInfo);
+ }
+ for(vector<EndpointIPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
+ {
+ _incomingConnectionFactories.push_back(new IncomingConnectionFactory(instance, *p, this, _name));
+ }
+ if(endpoints.empty())
+ {
+ TraceLevelsPtr tl = _instance->traceLevels();
+ if(tl->network >= 2)
+ {
+ Trace out(_instance->initializationData().logger, tl->networkCat);
+ out << "created adapter `" << name << "' without endpoints";
+ }
+ }
+
+ //
+ // Parse published endpoints. If set, these are used in proxies
+ // instead of the connection factory endpoints.
+ //
+ string endpts = properties->getPropertyWithDefault(_propertyPrefix + _name + ".PublishedEndpoints",
+ properties->getProperty(_name + ".PublishedEndpoints"));
+ _publishedEndpoints = parseEndpoints(endpts);
+ if(_publishedEndpoints.empty())
+ {
+ transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ back_inserter(_publishedEndpoints), Ice::constMemFun(&IncomingConnectionFactory::endpoint));
+ }
+
+ //
+ // Filter out any endpoints that are not meant to be published.
+ //
+ _publishedEndpoints.erase(remove_if(_publishedEndpoints.begin(), _publishedEndpoints.end(),
+ not1(Ice::constMemFun(&EndpointI::publish))), _publishedEndpoints.end());
+ }
+
+ string locatorProperty = _propertyPrefix + _name + ".Locator";
+ if(!properties->getProperty(locatorProperty).empty())
+ {
+ setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(locatorProperty)));
+ }
+ else if(!properties->getProperty(_name + ".Locator").empty())
+ {
+ setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(_name + ".Locator")));
+ }
+ else
+ {
+ setLocator(_instance->referenceFactory()->getDefaultLocator());
+ }
}
catch(...)
{
- destroy();
- __setNoDelete(false);
- throw;
+ destroy();
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -972,22 +972,22 @@ Ice::ObjectAdapterI::~ObjectAdapterI()
{
if(!_deactivated)
{
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << getName() << "' has not been deactivated";
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << getName() << "' has not been deactivated";
}
else if(!_destroyed)
{
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << getName() << "' has not been destroyed";
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << getName() << "' has not been destroyed";
}
else
{
- //assert(!_servantManager); // We don't clear this reference, it needs to be immutable.
- assert(!_threadPool);
- assert(!_communicator);
- assert(_incomingConnectionFactories.empty());
- assert(_directCount == 0);
- assert(!_waitForActivate);
+ //assert(!_servantManager); // We don't clear this reference, it needs to be immutable.
+ assert(!_threadPool);
+ assert(!_communicator);
+ assert(_incomingConnectionFactories.empty());
+ assert(_directCount == 0);
+ assert(!_waitForActivate);
}
}
@@ -996,15 +996,15 @@ Ice::ObjectAdapterI::newProxy(const Identity& ident, const string& facet) const
{
if(_id.empty())
{
- return newDirectProxy(ident, facet);
+ return newDirectProxy(ident, facet);
}
else if(_replicaGroupId.empty())
{
- return newIndirectProxy(ident, facet, _id);
+ return newIndirectProxy(ident, facet, _id);
}
else
{
- return newIndirectProxy(ident, facet, _replicaGroupId);
+ return newIndirectProxy(ident, facet, _replicaGroupId);
}
}
@@ -1024,9 +1024,9 @@ Ice::ObjectAdapterI::newDirectProxy(const Identity& ident, const string& facet)
// Create a reference and return a proxy for this reference.
//
ReferencePtr ref = _instance->referenceFactory()->create(
- ident, _instance->getDefaultContext(), facet, Reference::ModeTwoway, false,
- _instance->defaultsAndOverrides()->defaultPreferSecure, endpoints, 0,
- _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
+ ident, _instance->getDefaultContext(), facet, Reference::ModeTwoway, false,
+ _instance->defaultsAndOverrides()->defaultPreferSecure, endpoints, 0,
+ _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
_instance->defaultsAndOverrides()->defaultEndpointSelection, _instance->threadPerConnection());
return _instance->proxyFactory()->referenceToProxy(ref);
@@ -1039,11 +1039,11 @@ Ice::ObjectAdapterI::newIndirectProxy(const Identity& ident, const string& facet
// Create an indirect reference with the given adapter id.
//
ReferencePtr ref = _instance->referenceFactory()->create(
- ident, _instance->getDefaultContext(), facet, Reference::ModeTwoway, false,
- _instance->defaultsAndOverrides()->defaultPreferSecure, id, 0,
- _locatorInfo, _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
+ ident, _instance->getDefaultContext(), facet, Reference::ModeTwoway, false,
+ _instance->defaultsAndOverrides()->defaultPreferSecure, id, 0,
+ _locatorInfo, _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
_instance->defaultsAndOverrides()->defaultEndpointSelection, _instance->threadPerConnection(),
- _instance->defaultsAndOverrides()->defaultLocatorCacheTimeout);
+ _instance->defaultsAndOverrides()->defaultLocatorCacheTimeout);
//
// Return a proxy for the reference.
@@ -1056,9 +1056,9 @@ Ice::ObjectAdapterI::checkForDeactivation() const
{
if(_deactivated)
{
- ObjectAdapterDeactivatedException ex(__FILE__, __LINE__);
- ex.name = getName();
- throw ex;
+ ObjectAdapterDeactivatedException ex(__FILE__, __LINE__);
+ ex.name = getName();
+ throw ex;
}
}
@@ -1085,38 +1085,38 @@ Ice::ObjectAdapterI::parseEndpoints(const string& str) const
vector<EndpointIPtr> endpoints;
while(end < endpts.length())
{
- const string delim = " \t\n\r";
-
- beg = endpts.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = endpts.find(':', beg);
- if(end == string::npos)
- {
- end = endpts.length();
- }
-
- if(end == beg)
- {
- ++end;
- continue;
- }
-
- string s = endpts.substr(beg, end - beg);
- EndpointIPtr endp = _instance->endpointFactoryManager()->create(s);
- if(endp == 0)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = s;
- throw ex;
- }
- vector<EndpointIPtr> endps = endp->expand(true);
- endpoints.insert(endpoints.end(), endps.begin(), endps.end());
-
- ++end;
+ const string delim = " \t\n\r";
+
+ beg = endpts.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = endpts.find(':', beg);
+ if(end == string::npos)
+ {
+ end = endpts.length();
+ }
+
+ if(end == beg)
+ {
+ ++end;
+ continue;
+ }
+
+ string s = endpts.substr(beg, end - beg);
+ EndpointIPtr endp = _instance->endpointFactoryManager()->create(s);
+ if(endp == 0)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = s;
+ throw ex;
+ }
+ vector<EndpointIPtr> endps = endp->expand(true);
+ endpoints.insert(endpoints.end(), endps.begin(), endps.end());
+
+ ++end;
}
return endpoints;
@@ -1124,12 +1124,12 @@ Ice::ObjectAdapterI::parseEndpoints(const string& str) const
void
ObjectAdapterI::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locatorInfo,
- const Ice::ObjectPrx& proxy,
- bool registerProcess)
+ const Ice::ObjectPrx& proxy,
+ bool registerProcess)
{
if(!registerProcess && _id.empty())
{
- return; // Nothing to update.
+ return; // Nothing to update.
}
//
@@ -1147,76 +1147,76 @@ ObjectAdapterI::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locator
string serverId;
if(registerProcess)
{
- assert(_instance);
- serverId = _instance->initializationData().properties->getProperty("Ice.ServerId");
-
- if(!locatorRegistry)
- {
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << getName() << "' cannot register the process without a locator registry";
- }
- else if(serverId.empty())
- {
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << getName() << "' cannot register the process without a value for Ice.ServerId";
- }
+ assert(_instance);
+ serverId = _instance->initializationData().properties->getProperty("Ice.ServerId");
+
+ if(!locatorRegistry)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << getName() << "' cannot register the process without a locator registry";
+ }
+ else if(serverId.empty())
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << getName() << "' cannot register the process without a value for Ice.ServerId";
+ }
}
if(!locatorRegistry)
{
- return;
+ return;
}
if(!_id.empty())
{
- try
- {
- if(_replicaGroupId.empty())
- {
- locatorRegistry->setAdapterDirectProxy(_id, proxy);
- }
- else
- {
- locatorRegistry->setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
- }
- }
- catch(const AdapterNotFoundException&)
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object adapter";
- ex.id = _id;
- throw ex;
- }
- catch(const InvalidReplicaGroupIdException&)
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "replica group";
- ex.id = _replicaGroupId;
- throw ex;
- }
- catch(const AdapterAlreadyActiveException&)
- {
- ObjectAdapterIdInUseException ex(__FILE__, __LINE__);
- ex.id = _id;
- throw ex;
- }
- }
+ try
+ {
+ if(_replicaGroupId.empty())
+ {
+ locatorRegistry->setAdapterDirectProxy(_id, proxy);
+ }
+ else
+ {
+ locatorRegistry->setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
+ }
+ }
+ catch(const AdapterNotFoundException&)
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object adapter";
+ ex.id = _id;
+ throw ex;
+ }
+ catch(const InvalidReplicaGroupIdException&)
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "replica group";
+ ex.id = _replicaGroupId;
+ throw ex;
+ }
+ catch(const AdapterAlreadyActiveException&)
+ {
+ ObjectAdapterIdInUseException ex(__FILE__, __LINE__);
+ ex.id = _id;
+ throw ex;
+ }
+ }
if(registerProcess && !serverId.empty())
{
- try
- {
- ProcessPtr servant = new ProcessI(_communicator);
- Ice::ObjectPrx process = createDirectProxy(addWithUUID(servant)->ice_getIdentity());
- locatorRegistry->setServerProcessProxy(serverId, ProcessPrx::uncheckedCast(process));
- }
- catch(const ServerNotFoundException&)
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "server";
- ex.id = serverId;
- throw ex;
- }
+ try
+ {
+ ProcessPtr servant = new ProcessI(_communicator);
+ Ice::ObjectPrx process = createDirectProxy(addWithUUID(servant)->ice_getIdentity());
+ locatorRegistry->setServerProcessProxy(serverId, ProcessPrx::uncheckedCast(process));
+ }
+ catch(const ServerNotFoundException&)
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "server";
+ ex.id = serverId;
+ throw ex;
+ }
}
}
@@ -1225,17 +1225,17 @@ Ice::ObjectAdapterI::filterProperties(const string& prefix)
{
static const string suffixes[] =
{
- "AdapterId",
- "Endpoints",
- "Locator",
- "PublishedEndpoints",
- "RegisterProcess",
- "ReplicaGroupId",
- "Router",
- "ThreadPool.Size",
- "ThreadPool.SizeMax",
- "ThreadPool.SizeWarn",
- "ThreadPool.StackSize"
+ "AdapterId",
+ "Endpoints",
+ "Locator",
+ "PublishedEndpoints",
+ "RegisterProcess",
+ "ReplicaGroupId",
+ "Router",
+ "ThreadPool.Size",
+ "ThreadPool.SizeMax",
+ "ThreadPool.SizeWarn",
+ "ThreadPool.StackSize"
};
StringSeq propertySet;
@@ -1243,9 +1243,9 @@ Ice::ObjectAdapterI::filterProperties(const string& prefix)
for(unsigned int i = 0; i < sizeof(suffixes)/sizeof(*suffixes); ++i)
{
if(props.find(prefix + suffixes[i]) != props.end())
- {
- propertySet.push_back(prefix + suffixes[i]);
- }
+ {
+ propertySet.push_back(prefix + suffixes[i]);
+ }
}
return propertySet;
@@ -1267,15 +1267,15 @@ Ice::ObjectAdapterI::ProcessI::writeMessage(const string& message, Int fd, const
{
switch(fd)
{
- case 1:
- {
- cout << message << endl;
- break;
- }
- case 2:
- {
- cerr << message << endl;
- break;
- }
+ case 1:
+ {
+ cout << message << endl;
+ break;
+ }
+ case 2:
+ {
+ cerr << message << endl;
+ break;
+ }
}
}
diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h
index e9b6fe0cb6f..b61b7e3e1a7 100644
--- a/cpp/src/Ice/ObjectAdapterI.h
+++ b/cpp/src/Ice/ObjectAdapterI.h
@@ -89,8 +89,8 @@ public:
private:
ObjectAdapterI(const IceInternal::InstancePtr&, const CommunicatorPtr&,
- const IceInternal::ObjectAdapterFactoryPtr&, const std::string&, const std::string&,
- const RouterPrx&, bool);
+ const IceInternal::ObjectAdapterFactoryPtr&, const std::string&, const std::string&,
+ const RouterPrx&, bool);
virtual ~ObjectAdapterI();
friend class IceInternal::ObjectAdapterFactory;
@@ -135,7 +135,7 @@ private:
ProcessI(const CommunicatorPtr&);
virtual void shutdown(const Current&);
- virtual void writeMessage(const std::string&, Int, const Current&);
+ virtual void writeMessage(const std::string&, Int, const Current&);
private:
diff --git a/cpp/src/Ice/ObjectFactoryManager.cpp b/cpp/src/Ice/ObjectFactoryManager.cpp
index c52894f4234..5ed3f2a7d38 100644
--- a/cpp/src/Ice/ObjectFactoryManager.cpp
+++ b/cpp/src/Ice/ObjectFactoryManager.cpp
@@ -28,10 +28,10 @@ IceInternal::ObjectFactoryManager::add(const ObjectFactoryPtr& factory, const st
if((_factoryMapHint != _factoryMap.end() && _factoryMapHint->first == id)
|| _factoryMap.find(id) != _factoryMap.end())
{
- AlreadyRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object factory";
- ex.id = id;
- throw ex;
+ AlreadyRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object factory";
+ ex.id = id;
+ throw ex;
}
_factoryMapHint = _factoryMap.insert(_factoryMapHint, pair<const string, ObjectFactoryPtr>(id, factory));
@@ -42,41 +42,41 @@ IceInternal::ObjectFactoryManager::remove(const string& id)
{
ObjectFactoryPtr factory = 0;
{
- IceUtil::Mutex::Lock sync(*this);
-
- FactoryMap::iterator p = _factoryMap.end();
- if(_factoryMapHint != _factoryMap.end())
- {
- if(_factoryMapHint->first == id)
- {
- p = _factoryMapHint;
- }
- }
-
- if(p == _factoryMap.end())
- {
- p = _factoryMap.find(id);
- if(p == _factoryMap.end())
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object factory";
- ex.id = id;
- throw ex;
- }
- }
- assert(p != _factoryMap.end());
-
- factory = p->second;
-
- if(p == _factoryMapHint)
- {
- _factoryMap.erase(p++);
- _factoryMapHint = p;
- }
- else
- {
- _factoryMap.erase(p);
- }
+ IceUtil::Mutex::Lock sync(*this);
+
+ FactoryMap::iterator p = _factoryMap.end();
+ if(_factoryMapHint != _factoryMap.end())
+ {
+ if(_factoryMapHint->first == id)
+ {
+ p = _factoryMapHint;
+ }
+ }
+
+ if(p == _factoryMap.end())
+ {
+ p = _factoryMap.find(id);
+ if(p == _factoryMap.end())
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object factory";
+ ex.id = id;
+ throw ex;
+ }
+ }
+ assert(p != _factoryMap.end());
+
+ factory = p->second;
+
+ if(p == _factoryMapHint)
+ {
+ _factoryMap.erase(p++);
+ _factoryMapHint = p;
+ }
+ else
+ {
+ _factoryMap.erase(p);
+ }
}
//
@@ -96,25 +96,25 @@ IceInternal::ObjectFactoryManager::find(const string& id) const
FactoryMap::iterator p = factoryMap.end();
if(_factoryMapHint != factoryMap.end())
{
- if(_factoryMapHint->first == id)
- {
- p = _factoryMapHint;
- }
+ if(_factoryMapHint->first == id)
+ {
+ p = _factoryMapHint;
+ }
}
if(p == factoryMap.end())
{
- p = factoryMap.find(id);
+ p = factoryMap.find(id);
}
if(p != factoryMap.end())
{
- _factoryMapHint = p;
- return p->second;
+ _factoryMapHint = p;
+ return p->second;
}
else
{
- return 0;
+ return 0;
}
}
@@ -128,14 +128,14 @@ IceInternal::ObjectFactoryManager::destroy()
{
FactoryMap oldMap;
{
- IceUtil::Mutex::Lock sync(*this);
- oldMap.swap(_factoryMap);
- _factoryMapHint = _factoryMap.end();
+ IceUtil::Mutex::Lock sync(*this);
+ oldMap.swap(_factoryMap);
+ _factoryMapHint = _factoryMap.end();
}
//
// Destroy all outside lock
//
for_each(oldMap.begin(), oldMap.end(),
- Ice::secondVoidMemFun<const string, ObjectFactory>(&ObjectFactory::destroy));
+ Ice::secondVoidMemFun<const string, ObjectFactory>(&ObjectFactory::destroy));
}
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index c16f5618c05..33a6fc3931a 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -46,7 +46,7 @@ IceInternal::LocalExceptionWrapper::retry() const
}
IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const string& operation,
- OperationMode mode, const Context* context, bool compress) :
+ OperationMode mode, const Context* context, bool compress) :
_connection(connection),
_reference(ref),
_state(StateUnsent),
@@ -56,80 +56,80 @@ IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const s
{
switch(_reference->getMode())
{
- case Reference::ModeTwoway:
- case Reference::ModeOneway:
- case Reference::ModeDatagram:
- {
- _os.writeBlob(requestHdr, sizeof(requestHdr));
- break;
- }
-
- case Reference::ModeBatchOneway:
- case Reference::ModeBatchDatagram:
- {
- _connection->prepareBatchRequest(&_os);
- break;
- }
+ case Reference::ModeTwoway:
+ case Reference::ModeOneway:
+ case Reference::ModeDatagram:
+ {
+ _os.writeBlob(requestHdr, sizeof(requestHdr));
+ break;
+ }
+
+ case Reference::ModeBatchOneway:
+ case Reference::ModeBatchDatagram:
+ {
+ _connection->prepareBatchRequest(&_os);
+ break;
+ }
}
try
{
- _reference->getIdentity().__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(_reference->getFacet().empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- string facet = _reference->getFacet();
- _os.write(&facet, &facet + 1);
- }
-
- _os.write(operation, false);
-
- _os.write(static_cast<Byte>(mode));
-
- if(context != 0)
- {
- //
- // Explicit context
- //
- __write(&_os, *context, __U__Context());
- }
- else
- {
- //
- // Implicit context
- //
- const ImplicitContextIPtr& implicitContext =
- _reference->getInstance()->getImplicitContext();
-
- const Context& prxContext = _reference->getContext()->getValue();
-
- if(implicitContext == 0)
- {
- __write(&_os, prxContext, __U__Context());
- }
- else
- {
- implicitContext->write(prxContext, &_os);
- }
- }
-
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward requests as
- // blobs.
- //
- _os.startWriteEncaps();
+ _reference->getIdentity().__write(&_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(_reference->getFacet().empty())
+ {
+ _os.write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ string facet = _reference->getFacet();
+ _os.write(&facet, &facet + 1);
+ }
+
+ _os.write(operation, false);
+
+ _os.write(static_cast<Byte>(mode));
+
+ if(context != 0)
+ {
+ //
+ // Explicit context
+ //
+ __write(&_os, *context, __U__Context());
+ }
+ else
+ {
+ //
+ // Implicit context
+ //
+ const ImplicitContextIPtr& implicitContext =
+ _reference->getInstance()->getImplicitContext();
+
+ const Context& prxContext = _reference->getContext()->getValue();
+
+ if(implicitContext == 0)
+ {
+ __write(&_os, prxContext, __U__Context());
+ }
+ else
+ {
+ implicitContext->write(prxContext, &_os);
+ }
+ }
+
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward requests as
+ // blobs.
+ //
+ _os.startWriteEncaps();
}
catch(const LocalException& ex)
{
- abort(ex);
+ abort(ex);
}
}
@@ -142,145 +142,145 @@ IceInternal::Outgoing::invoke()
switch(_reference->getMode())
{
- case Reference::ModeTwoway:
- {
- //
- // We let all exceptions raised by sending directly
- // propagate to the caller, because they can be retried
- // without violating "at-most-once". In case of such
- // exceptions, the connection object does not call back on
- // this object, so we don't need to lock the mutex, keep
- // track of state, or save exceptions.
- //
- _connection->sendRequest(&_os, this, _compress);
-
- //
- // Wait until the request has completed, or until the
- // request times out.
- //
-
- bool timedOut = false;
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
-
- //
+ case Reference::ModeTwoway:
+ {
+ //
+ // We let all exceptions raised by sending directly
+ // propagate to the caller, because they can be retried
+ // without violating "at-most-once". In case of such
+ // exceptions, the connection object does not call back on
+ // this object, so we don't need to lock the mutex, keep
+ // track of state, or save exceptions.
+ //
+ _connection->sendRequest(&_os, this, _compress);
+
+ //
+ // Wait until the request has completed, or until the
+ // request times out.
+ //
+
+ bool timedOut = false;
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
+
+ //
// It's possible that the request has already
// completed, due to a regular response, or because of
// an exception. So we only change the state to "in
// progress" if it is still "unsent".
- //
- if(_state == StateUnsent)
- {
- _state = StateInProgress;
- }
-
- Int timeout = _connection->timeout();
- while(_state == StateInProgress && !timedOut)
- {
- if(timeout >= 0)
- {
- _monitor.timedWait(IceUtil::Time::milliSeconds(timeout));
-
- if(_state == StateInProgress)
- {
- timedOut = true;
- }
- }
- else
- {
- _monitor.wait();
- }
- }
- }
-
- if(timedOut)
- {
- //
- // Must be called outside the synchronization of this
- // object.
- //
- _connection->exception(TimeoutException(__FILE__, __LINE__));
-
- //
- // We must wait until the exception set above has
- // propagated to this Outgoing object.
- //
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
-
- while(_state == StateInProgress)
- {
- _monitor.wait();
- }
- }
- }
-
- if(_exception.get())
- {
- //
- // A CloseConnectionException indicates graceful
- // server shutdown, and is therefore always repeatable
- // without violating "at-most-once". That's because by
- // sending a close connection message, the server
- // guarantees that all outstanding requests can safely
- // be repeated.
- //
- // An ObjectNotExistException can always be retried as
- // well without violating "at-most-once".
- //
- if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
- dynamic_cast<ObjectNotExistException*>(_exception.get()))
- {
- _exception->ice_throw();
- }
-
- //
- // Throw the exception wrapped in a
- // LocalExceptionWrapper, to indicate that the request
- // cannot be resent without potentially violating the
- // "at-most-once" principle.
- //
- throw LocalExceptionWrapper(*_exception.get(), false);
- }
-
- if(_state == StateUserException)
- {
- return false;
- }
-
- assert(_state == StateOK);
- break;
- }
-
- case Reference::ModeOneway:
- case Reference::ModeDatagram:
- {
- //
- // For oneway and datagram requests, the connection object
- // never calls back on this object. Therefore we don't
- // need to lock the mutex or save exceptions. We simply
- // let all exceptions from sending propagate to the
- // caller, because such exceptions can be retried without
- // violating "at-most-once".
- //
- _state = StateInProgress;
- _connection->sendRequest(&_os, 0, _compress);
- break;
- }
-
- case Reference::ModeBatchOneway:
- case Reference::ModeBatchDatagram:
- {
- //
- // For batch oneways and datagrams, the same rules as for
- // regular oneways and datagrams (see comment above)
- // apply.
- //
- _state = StateInProgress;
- _connection->finishBatchRequest(&_os, _compress);
- break;
- }
+ //
+ if(_state == StateUnsent)
+ {
+ _state = StateInProgress;
+ }
+
+ Int timeout = _connection->timeout();
+ while(_state == StateInProgress && !timedOut)
+ {
+ if(timeout >= 0)
+ {
+ _monitor.timedWait(IceUtil::Time::milliSeconds(timeout));
+
+ if(_state == StateInProgress)
+ {
+ timedOut = true;
+ }
+ }
+ else
+ {
+ _monitor.wait();
+ }
+ }
+ }
+
+ if(timedOut)
+ {
+ //
+ // Must be called outside the synchronization of this
+ // object.
+ //
+ _connection->exception(TimeoutException(__FILE__, __LINE__));
+
+ //
+ // We must wait until the exception set above has
+ // propagated to this Outgoing object.
+ //
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
+
+ while(_state == StateInProgress)
+ {
+ _monitor.wait();
+ }
+ }
+ }
+
+ if(_exception.get())
+ {
+ //
+ // A CloseConnectionException indicates graceful
+ // server shutdown, and is therefore always repeatable
+ // without violating "at-most-once". That's because by
+ // sending a close connection message, the server
+ // guarantees that all outstanding requests can safely
+ // be repeated.
+ //
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
+ if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<ObjectNotExistException*>(_exception.get()))
+ {
+ _exception->ice_throw();
+ }
+
+ //
+ // Throw the exception wrapped in a
+ // LocalExceptionWrapper, to indicate that the request
+ // cannot be resent without potentially violating the
+ // "at-most-once" principle.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), false);
+ }
+
+ if(_state == StateUserException)
+ {
+ return false;
+ }
+
+ assert(_state == StateOK);
+ break;
+ }
+
+ case Reference::ModeOneway:
+ case Reference::ModeDatagram:
+ {
+ //
+ // For oneway and datagram requests, the connection object
+ // never calls back on this object. Therefore we don't
+ // need to lock the mutex or save exceptions. We simply
+ // let all exceptions from sending propagate to the
+ // caller, because such exceptions can be retried without
+ // violating "at-most-once".
+ //
+ _state = StateInProgress;
+ _connection->sendRequest(&_os, 0, _compress);
+ break;
+ }
+
+ case Reference::ModeBatchOneway:
+ case Reference::ModeBatchDatagram:
+ {
+ //
+ // For batch oneways and datagrams, the same rules as for
+ // regular oneways and datagrams (see comment above)
+ // apply.
+ //
+ _state = StateInProgress;
+ _connection->finishBatchRequest(&_os, _compress);
+ break;
+ }
}
return true;
@@ -298,14 +298,14 @@ IceInternal::Outgoing::abort(const LocalException& ex)
//
if(_reference->getMode() == Reference::ModeBatchOneway || _reference->getMode() == Reference::ModeBatchDatagram)
{
- _connection->abortBatchRequest();
-
- //
- // If we abort a batch requests, we cannot retry, because not
- // only the batch request that caused the problem will be
- // aborted, but all other requests in the batch as well.
- //
- throw LocalExceptionWrapper(ex, false);
+ _connection->abortBatchRequest();
+
+ //
+ // If we abort a batch requests, we cannot retry, because not
+ // only the batch request that caused the problem will be
+ // aborted, but all other requests in the batch as well.
+ //
+ throw LocalExceptionWrapper(ex, false);
}
ex.ice_throw();
@@ -326,152 +326,152 @@ IceInternal::Outgoing::finished(BasicStream& is)
switch(static_cast<DispatchStatus>(status))
{
- case DispatchOK:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _is.startReadEncaps();
- _state = StateOK; // The state must be set last, in case there is an exception.
- break;
- }
-
- case DispatchUserException:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _is.startReadEncaps();
- _state = StateUserException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case DispatchObjectNotExist:
- case DispatchFacetNotExist:
- case DispatchOperationNotExist:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- Identity ident;
- ident.__read(&_is);
-
- //
- // For compatibility with the old FacetPath.
- //
- vector<string> facetPath;
- _is.read(facetPath);
- string facet;
- if(!facetPath.empty())
- {
- if(facetPath.size() > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
- }
-
- string operation;
- _is.read(operation, false);
-
- RequestFailedException* ex;
- switch(static_cast<DispatchStatus>(status))
- {
- case DispatchObjectNotExist:
- {
- ex = new ObjectNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case DispatchFacetNotExist:
- {
- ex = new FacetNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case DispatchOperationNotExist:
- {
- ex = new OperationNotExistException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->id = ident;
- ex->facet = facet;
- ex->operation = operation;
- _exception.reset(ex);
-
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case DispatchUnknownException:
- case DispatchUnknownLocalException:
- case DispatchUnknownUserException:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- string unknown;
- _is.read(unknown, false);
-
- UnknownException* ex;
- switch(static_cast<DispatchStatus>(status))
- {
- case DispatchUnknownException:
- {
- ex = new UnknownException(__FILE__, __LINE__);
- break;
- }
-
- case DispatchUnknownLocalException:
- {
- ex = new UnknownLocalException(__FILE__, __LINE__);
- break;
- }
-
- case DispatchUnknownUserException:
- {
- ex = new UnknownUserException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->unknown = unknown;
- _exception.reset(ex);
-
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- default:
- {
- _exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
- _state = StateLocalException;
- break;
- }
+ case DispatchOK:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _is.startReadEncaps();
+ _state = StateOK; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case DispatchUserException:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _is.startReadEncaps();
+ _state = StateUserException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case DispatchObjectNotExist:
+ case DispatchFacetNotExist:
+ case DispatchOperationNotExist:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ Identity ident;
+ ident.__read(&_is);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ vector<string> facetPath;
+ _is.read(facetPath);
+ string facet;
+ if(!facetPath.empty())
+ {
+ if(facetPath.size() > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
+ }
+
+ string operation;
+ _is.read(operation, false);
+
+ RequestFailedException* ex;
+ switch(static_cast<DispatchStatus>(status))
+ {
+ case DispatchObjectNotExist:
+ {
+ ex = new ObjectNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case DispatchFacetNotExist:
+ {
+ ex = new FacetNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case DispatchOperationNotExist:
+ {
+ ex = new OperationNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->id = ident;
+ ex->facet = facet;
+ ex->operation = operation;
+ _exception.reset(ex);
+
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case DispatchUnknownException:
+ case DispatchUnknownLocalException:
+ case DispatchUnknownUserException:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ string unknown;
+ _is.read(unknown, false);
+
+ UnknownException* ex;
+ switch(static_cast<DispatchStatus>(status))
+ {
+ case DispatchUnknownException:
+ {
+ ex = new UnknownException(__FILE__, __LINE__);
+ break;
+ }
+
+ case DispatchUnknownLocalException:
+ {
+ ex = new UnknownLocalException(__FILE__, __LINE__);
+ break;
+ }
+
+ case DispatchUnknownUserException:
+ {
+ ex = new UnknownUserException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->unknown = unknown;
+ _exception.reset(ex);
+
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ default:
+ {
+ _exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
+ _state = StateLocalException;
+ break;
+ }
}
_monitor.notify();
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index e03c3b58d57..ad53705d9e9 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -56,148 +56,148 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is)
try
{
- __is->swap(is);
-
- Byte b;
- __is->read(b);
- status = static_cast<DispatchStatus>(b);
-
- switch(status)
- {
- case DispatchOK:
- case DispatchUserException:
- {
- __is->startReadEncaps();
- break;
- }
-
- case DispatchObjectNotExist:
- case DispatchFacetNotExist:
- case DispatchOperationNotExist:
- {
- Identity ident;
- ident.__read(__is);
-
- //
- // For compatibility with the old FacetPath.
- //
- vector<string> facetPath;
- __is->read(facetPath);
- string facet;
- if(!facetPath.empty())
- {
- if(facetPath.size() > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
- }
-
- string operation;
- __is->read(operation, false);
-
- auto_ptr<RequestFailedException> ex;
- switch(static_cast<DispatchStatus>(status))
- {
- case DispatchObjectNotExist:
- {
- ex.reset(new ObjectNotExistException(__FILE__, __LINE__));
- break;
- }
-
- case DispatchFacetNotExist:
- {
- ex.reset(new FacetNotExistException(__FILE__, __LINE__));
- break;
- }
-
- case DispatchOperationNotExist:
- {
- ex.reset(new OperationNotExistException(__FILE__, __LINE__));
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- ex->id = ident;
- ex->facet = facet;
- ex->operation = operation;
- ex->ice_throw();
- }
-
- case DispatchUnknownException:
- case DispatchUnknownLocalException:
- case DispatchUnknownUserException:
- {
- string unknown;
- __is->read(unknown, false);
-
- auto_ptr<UnknownException> ex;
- switch(static_cast<DispatchStatus>(status))
- {
- case DispatchUnknownException:
- {
- ex.reset(new UnknownException(__FILE__, __LINE__));
- break;
- }
-
- case DispatchUnknownLocalException:
- {
- ex.reset(new UnknownLocalException(__FILE__, __LINE__));
- break;
- }
-
- case DispatchUnknownUserException:
- {
- ex.reset(new UnknownUserException(__FILE__, __LINE__));
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- ex->unknown = unknown;
- ex->ice_throw();
- }
-
- default:
- {
- throw UnknownReplyStatusException(__FILE__, __LINE__);
- }
- }
+ __is->swap(is);
+
+ Byte b;
+ __is->read(b);
+ status = static_cast<DispatchStatus>(b);
+
+ switch(status)
+ {
+ case DispatchOK:
+ case DispatchUserException:
+ {
+ __is->startReadEncaps();
+ break;
+ }
+
+ case DispatchObjectNotExist:
+ case DispatchFacetNotExist:
+ case DispatchOperationNotExist:
+ {
+ Identity ident;
+ ident.__read(__is);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ vector<string> facetPath;
+ __is->read(facetPath);
+ string facet;
+ if(!facetPath.empty())
+ {
+ if(facetPath.size() > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
+ }
+
+ string operation;
+ __is->read(operation, false);
+
+ auto_ptr<RequestFailedException> ex;
+ switch(static_cast<DispatchStatus>(status))
+ {
+ case DispatchObjectNotExist:
+ {
+ ex.reset(new ObjectNotExistException(__FILE__, __LINE__));
+ break;
+ }
+
+ case DispatchFacetNotExist:
+ {
+ ex.reset(new FacetNotExistException(__FILE__, __LINE__));
+ break;
+ }
+
+ case DispatchOperationNotExist:
+ {
+ ex.reset(new OperationNotExistException(__FILE__, __LINE__));
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ ex->id = ident;
+ ex->facet = facet;
+ ex->operation = operation;
+ ex->ice_throw();
+ }
+
+ case DispatchUnknownException:
+ case DispatchUnknownLocalException:
+ case DispatchUnknownUserException:
+ {
+ string unknown;
+ __is->read(unknown, false);
+
+ auto_ptr<UnknownException> ex;
+ switch(static_cast<DispatchStatus>(status))
+ {
+ case DispatchUnknownException:
+ {
+ ex.reset(new UnknownException(__FILE__, __LINE__));
+ break;
+ }
+
+ case DispatchUnknownLocalException:
+ {
+ ex.reset(new UnknownLocalException(__FILE__, __LINE__));
+ break;
+ }
+
+ case DispatchUnknownUserException:
+ {
+ ex.reset(new UnknownUserException(__FILE__, __LINE__));
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ ex->unknown = unknown;
+ ex->ice_throw();
+ }
+
+ default:
+ {
+ throw UnknownReplyStatusException(__FILE__, __LINE__);
+ }
+ }
}
catch(const LocalException& ex)
{
- __finished(ex);
- return;
+ __finished(ex);
+ return;
}
assert(status == DispatchOK || status == DispatchUserException);
try
{
- __response(status == DispatchOK);
+ __response(status == DispatchOK);
}
catch(const Exception& ex)
{
- warning(ex);
+ warning(ex);
}
catch(const std::exception& ex)
{
- warning(ex);
+ warning(ex);
}
catch(...)
{
- warning();
+ warning();
}
cleanup();
@@ -210,48 +210,48 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc)
if(__os) // Don't retry if cleanup() was already called.
{
- //
- // A CloseConnectionException indicates graceful server
- // shutdown, and is therefore always repeatable without
- // violating "at-most-once". That's because by sending a close
- // connection message, the server guarantees that all
- // outstanding requests can safely be repeated. Otherwise, we
- // can also retry if the operation mode is Nonmutating or
- // Idempotent.
- //
- // An ObjectNotExistException can always be retried as
- // well without violating "at-most-once".
- //
- if(_mode == Nonmutating || _mode == Idempotent || dynamic_cast<const CloseConnectionException*>(&exc) ||
- dynamic_cast<const ObjectNotExistException*>(&exc))
- {
- try
- {
- _proxy->__handleException(_delegate, exc, _cnt);
- __send();
- return;
- }
- catch(const LocalException&)
- {
- }
- }
+ //
+ // A CloseConnectionException indicates graceful server
+ // shutdown, and is therefore always repeatable without
+ // violating "at-most-once". That's because by sending a close
+ // connection message, the server guarantees that all
+ // outstanding requests can safely be repeated. Otherwise, we
+ // can also retry if the operation mode is Nonmutating or
+ // Idempotent.
+ //
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
+ if(_mode == Nonmutating || _mode == Idempotent || dynamic_cast<const CloseConnectionException*>(&exc) ||
+ dynamic_cast<const ObjectNotExistException*>(&exc))
+ {
+ try
+ {
+ _proxy->__handleException(_delegate, exc, _cnt);
+ __send();
+ return;
+ }
+ catch(const LocalException&)
+ {
+ }
+ }
}
try
{
- ice_exception(exc);
+ ice_exception(exc);
}
catch(const Exception& ex)
{
- warning(ex);
+ warning(ex);
}
catch(const std::exception& ex)
{
- warning(ex);
+ warning(ex);
}
catch(...)
{
- warning();
+ warning();
}
cleanup();
@@ -259,90 +259,90 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc)
void
IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operation, OperationMode mode,
- const Context* context)
+ const Context* context)
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(_monitor);
try
{
- //
- // We must first wait for other requests to finish.
- //
- while(__os)
- {
- _monitor.wait();
- }
-
- //
- // Can't call async via a oneway proxy.
- //
- prx->__checkTwowayOnly(operation);
-
- _proxy = prx;
+ //
+ // We must first wait for other requests to finish.
+ //
+ while(__os)
+ {
+ _monitor.wait();
+ }
+
+ //
+ // Can't call async via a oneway proxy.
+ //
+ prx->__checkTwowayOnly(operation);
+
+ _proxy = prx;
_delegate = 0;
- _cnt = 0;
- _mode = mode;
-
- ReferencePtr ref = _proxy->__reference();
- assert(!__is);
- __is = new BasicStream(ref->getInstance().get());
- assert(!__os);
- __os = new BasicStream(ref->getInstance().get());
-
- __os->writeBlob(requestHdr, sizeof(requestHdr));
-
- ref->getIdentity().__write(__os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(ref->getFacet().empty())
- {
- __os->write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- string facet = ref->getFacet();
- __os->write(&facet, &facet + 1);
- }
-
- __os->write(operation, false);
-
- __os->write(static_cast<Byte>(_mode));
-
- if(context != 0)
- {
- //
- // Explicit context
- //
- __write(__os, *context, __U__Context());
- }
- else
- {
- //
- // Implicit context
- //
- const ImplicitContextIPtr& implicitContext =
- ref->getInstance()->getImplicitContext();
-
- const Context& prxContext = ref->getContext()->getValue();
-
- if(implicitContext == 0)
- {
- __write(__os, prxContext, __U__Context());
- }
- else
- {
- implicitContext->write(prxContext, __os);
- }
- }
-
- __os->startWriteEncaps();
+ _cnt = 0;
+ _mode = mode;
+
+ ReferencePtr ref = _proxy->__reference();
+ assert(!__is);
+ __is = new BasicStream(ref->getInstance().get());
+ assert(!__os);
+ __os = new BasicStream(ref->getInstance().get());
+
+ __os->writeBlob(requestHdr, sizeof(requestHdr));
+
+ ref->getIdentity().__write(__os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(ref->getFacet().empty())
+ {
+ __os->write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ string facet = ref->getFacet();
+ __os->write(&facet, &facet + 1);
+ }
+
+ __os->write(operation, false);
+
+ __os->write(static_cast<Byte>(_mode));
+
+ if(context != 0)
+ {
+ //
+ // Explicit context
+ //
+ __write(__os, *context, __U__Context());
+ }
+ else
+ {
+ //
+ // Implicit context
+ //
+ const ImplicitContextIPtr& implicitContext =
+ ref->getInstance()->getImplicitContext();
+
+ const Context& prxContext = ref->getContext()->getValue();
+
+ if(implicitContext == 0)
+ {
+ __write(__os, prxContext, __U__Context());
+ }
+ else
+ {
+ implicitContext->write(prxContext, __os);
+ }
+ }
+
+ __os->startWriteEncaps();
}
catch(const LocalException& ex)
{
- cleanup();
- ex.ice_throw();
+ cleanup();
+ ex.ice_throw();
}
}
@@ -353,37 +353,37 @@ IceInternal::OutgoingAsync::__send()
try
{
- while(true)
- {
- bool compress;
- _delegate = _proxy->__getDelegate();
- Ice::ConnectionIPtr connection = _delegate->__getConnection(compress);
- try
- {
- connection->sendAsyncRequest(__os, this, compress);
-
- //
- // Don't do anything after sendAsyncRequest() returned
- // without an exception. I such case, there will be
- // callbacks, i.e., calls to the __finished()
- // functions. Since there is no mutex protection, we
- // cannot modify state here and in such callbacks.
- //
- return;
- }
- catch(const LocalExceptionWrapper& ex)
- {
- _proxy->__handleExceptionWrapper(_delegate, ex);
- }
- catch(const LocalException& ex)
- {
- _proxy->__handleException(_delegate, ex, _cnt);
- }
- }
+ while(true)
+ {
+ bool compress;
+ _delegate = _proxy->__getDelegate();
+ Ice::ConnectionIPtr connection = _delegate->__getConnection(compress);
+ try
+ {
+ connection->sendAsyncRequest(__os, this, compress);
+
+ //
+ // Don't do anything after sendAsyncRequest() returned
+ // without an exception. I such case, there will be
+ // callbacks, i.e., calls to the __finished()
+ // functions. Since there is no mutex protection, we
+ // cannot modify state here and in such callbacks.
+ //
+ return;
+ }
+ catch(const LocalExceptionWrapper& ex)
+ {
+ _proxy->__handleExceptionWrapper(_delegate, ex);
+ }
+ catch(const LocalException& ex)
+ {
+ _proxy->__handleException(_delegate, ex, _cnt);
+ }
+ }
}
catch(const LocalException& ex)
{
- __finished(ex);
+ __finished(ex);
}
}
@@ -392,13 +392,13 @@ IceInternal::OutgoingAsync::warning(const Exception& ex) const
{
if(__os) // Don't print anything if cleanup() was already called.
{
- ReferencePtr ref = _proxy->__reference();
- if(ref->getInstance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
- {
- Warning out(ref->getInstance()->initializationData().logger);
- out << "Ice::Exception raised by AMI callback:\n" << ex;
- }
+ ReferencePtr ref = _proxy->__reference();
+ if(ref->getInstance()->initializationData().properties->
+ getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
+ {
+ Warning out(ref->getInstance()->initializationData().logger);
+ out << "Ice::Exception raised by AMI callback:\n" << ex;
+ }
}
}
@@ -407,13 +407,13 @@ IceInternal::OutgoingAsync::warning(const std::exception& ex) const
{
if(__os) // Don't print anything if cleanup() was already called.
{
- ReferencePtr ref = _proxy->__reference();
- if(ref->getInstance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
- {
- Warning out(ref->getInstance()->initializationData().logger);
- out << "std::exception raised by AMI callback:\n" << ex.what();
- }
+ ReferencePtr ref = _proxy->__reference();
+ if(ref->getInstance()->initializationData().properties->
+ getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
+ {
+ Warning out(ref->getInstance()->initializationData().logger);
+ out << "std::exception raised by AMI callback:\n" << ex.what();
+ }
}
}
@@ -422,13 +422,13 @@ IceInternal::OutgoingAsync::warning() const
{
if(__os) // Don't print anything if cleanup() was already called.
{
- ReferencePtr ref = _proxy->__reference();
- if(ref->getInstance()->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
- {
- Warning out(ref->getInstance()->initializationData().logger);
- out << "unknown exception raised by AMI callback";
- }
+ ReferencePtr ref = _proxy->__reference();
+ if(ref->getInstance()->initializationData().properties->
+ getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
+ {
+ Warning out(ref->getInstance()->initializationData().logger);
+ out << "unknown exception raised by AMI callback";
+ }
}
}
@@ -445,18 +445,18 @@ IceInternal::OutgoingAsync::cleanup()
void
Ice::AMI_Object_ice_invoke::__invoke(const ObjectPrx& prx, const string& operation, OperationMode mode,
- const vector<Byte>& inParams, const Context* context)
+ const vector<Byte>& inParams, const Context* context)
{
try
{
- __prepare(prx, operation, mode, context);
- __os->writeBlob(inParams);
- __os->endWriteEncaps();
+ __prepare(prx, operation, mode, context);
+ __os->writeBlob(inParams);
+ __os->endWriteEncaps();
}
catch(const LocalException& ex)
{
- __finished(ex);
- return;
+ __finished(ex);
+ return;
}
__send();
}
@@ -467,31 +467,31 @@ Ice::AMI_Object_ice_invoke::__response(bool ok) // ok == true means no user exce
vector<Byte> outParams;
try
{
- Int sz = __is->getReadEncapsSize();
- __is->readBlob(outParams, sz);
+ Int sz = __is->getReadEncapsSize();
+ __is->readBlob(outParams, sz);
}
catch(const LocalException& ex)
{
- __finished(ex);
- return;
+ __finished(ex);
+ return;
}
ice_response(ok, outParams);
}
void
Ice::AMI_Array_Object_ice_invoke::__invoke(const ObjectPrx& prx, const string& operation, OperationMode mode,
- const pair<const Byte*, const Byte*>& inParams, const Context* context)
+ const pair<const Byte*, const Byte*>& inParams, const Context* context)
{
try
{
- __prepare(prx, operation, mode, context);
- __os->writeBlob(inParams.first, static_cast<Int>(inParams.second - inParams.first));
- __os->endWriteEncaps();
+ __prepare(prx, operation, mode, context);
+ __os->writeBlob(inParams.first, static_cast<Int>(inParams.second - inParams.first));
+ __os->endWriteEncaps();
}
catch(const LocalException& ex)
{
- __finished(ex);
- return;
+ __finished(ex);
+ return;
}
__send();
}
@@ -502,14 +502,14 @@ Ice::AMI_Array_Object_ice_invoke::__response(bool ok) // ok == true means no use
pair<const Byte*, const Byte*> outParams;
try
{
- Int sz = __is->getReadEncapsSize();
- __is->readBlob(outParams.first, sz);
- outParams.second = outParams.first + sz;
+ Int sz = __is->getReadEncapsSize();
+ __is->readBlob(outParams.first, sz);
+ outParams.second = outParams.first + sz;
}
catch(const LocalException& ex)
{
- __finished(ex);
- return;
+ __finished(ex);
+ return;
}
ice_response(ok, outParams);
}
diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp
index b199954e938..123c74c0be8 100644
--- a/cpp/src/Ice/PluginManagerI.cpp
+++ b/cpp/src/Ice/PluginManagerI.cpp
@@ -29,9 +29,9 @@ Ice::PluginManagerI::initializePlugins()
{
if(_initialized)
{
- InitializationException ex(__FILE__, __LINE__);
- ex.reason = "plugins already initialized";
- throw ex;
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "plugins already initialized";
+ throw ex;
}
//
@@ -40,30 +40,30 @@ Ice::PluginManagerI::initializePlugins()
vector<PluginPtr> initializedPlugins;
try
{
- for(vector<PluginPtr>::iterator p = _initOrder.begin(); p != _initOrder.end(); ++p)
- {
- (*p)->initialize();
- initializedPlugins.push_back(*p);
- }
+ for(vector<PluginPtr>::iterator p = _initOrder.begin(); p != _initOrder.end(); ++p)
+ {
+ (*p)->initialize();
+ initializedPlugins.push_back(*p);
+ }
}
catch(...)
{
- //
- // Destroy the plugins that have been successfully initialized, in the
- // reverse order.
- //
- for(vector<PluginPtr>::reverse_iterator p = initializedPlugins.rbegin(); p != initializedPlugins.rend(); ++p)
- {
- try
- {
- (*p)->destroy();
- }
- catch(...)
- {
- // Ignore.
- }
- }
- throw;
+ //
+ // Destroy the plugins that have been successfully initialized, in the
+ // reverse order.
+ //
+ for(vector<PluginPtr>::reverse_iterator p = initializedPlugins.rbegin(); p != initializedPlugins.rend(); ++p)
+ {
+ try
+ {
+ (*p)->destroy();
+ }
+ catch(...)
+ {
+ // Ignore.
+ }
+ }
+ throw;
}
_initialized = true;
@@ -76,7 +76,7 @@ Ice::PluginManagerI::getPlugin(const string& name)
if(!_communicator)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
map<string, PluginPtr>::const_iterator r = _plugins.find(name);
@@ -98,16 +98,16 @@ Ice::PluginManagerI::addPlugin(const string& name, const PluginPtr& plugin)
if(!_communicator)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
map<string, PluginPtr>::const_iterator r = _plugins.find(name);
if(r != _plugins.end())
{
AlreadyRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = _kindOfObject;
- ex.id = name;
- throw ex;
+ ex.kindOfObject = _kindOfObject;
+ ex.id = name;
+ throw ex;
}
_plugins[name] = plugin;
}
@@ -119,15 +119,15 @@ Ice::PluginManagerI::destroy()
if(_communicator)
{
- map<string, PluginPtr>::iterator r;
- for(r = _plugins.begin(); r != _plugins.end(); ++r)
- {
- r->second->destroy();
- r->second = 0;
- }
-
- _logger = 0;
- _communicator = 0;
+ map<string, PluginPtr>::iterator r;
+ for(r = _plugins.begin(); r != _plugins.end(); ++r)
+ {
+ r->second->destroy();
+ r->second = 0;
+ }
+
+ _logger = 0;
+ _communicator = 0;
}
_libraries = 0;
@@ -166,44 +166,44 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
string::size_type beg = 0;
if(!loadOrder.empty())
{
- const string delim = ", \t\n";
- beg = loadOrder.find_first_not_of(delim, beg);
- while(beg != string::npos)
- {
- string name;
- string::size_type end = loadOrder.find_first_of(delim, beg);
- if(end == string::npos)
- {
- name = loadOrder.substr(beg);
- beg = end;
- }
- else
- {
- name = loadOrder.substr(beg, end - beg);
- beg = loadOrder.find_first_not_of(delim, end);
- }
-
- map<string, PluginPtr>::iterator p = _plugins.find(name);
- if(p != _plugins.end())
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "plugin `" + name + "' already loaded";
- throw ex;
- }
-
- PropertyDict::iterator q = plugins.find("Ice.Plugin." + name);
- if(q != plugins.end())
- {
- loadPlugin(name, q->second, cmdArgs, false);
- plugins.erase(q);
- }
- else
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "plugin `" + name + "' not defined";
- throw ex;
- }
- }
+ const string delim = ", \t\n";
+ beg = loadOrder.find_first_not_of(delim, beg);
+ while(beg != string::npos)
+ {
+ string name;
+ string::size_type end = loadOrder.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ name = loadOrder.substr(beg);
+ beg = end;
+ }
+ else
+ {
+ name = loadOrder.substr(beg, end - beg);
+ beg = loadOrder.find_first_not_of(delim, end);
+ }
+
+ map<string, PluginPtr>::iterator p = _plugins.find(name);
+ if(p != _plugins.end())
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "plugin `" + name + "' already loaded";
+ throw ex;
+ }
+
+ PropertyDict::iterator q = plugins.find("Ice.Plugin." + name);
+ if(q != plugins.end())
+ {
+ loadPlugin(name, q->second, cmdArgs, false);
+ plugins.erase(q);
+ }
+ else
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "plugin `" + name + "' not defined";
+ throw ex;
+ }
+ }
}
//
@@ -213,7 +213,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
for(p = plugins.begin(); p != plugins.end(); ++p)
{
string name = p->first.substr(prefix.size());
- loadPlugin(name, p->second, cmdArgs, false);
+ loadPlugin(name, p->second, cmdArgs, false);
}
string loggerStr = properties->getProperty("Ice.LoggerPlugin");
@@ -231,7 +231,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
//
if(properties->getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0)
{
- initializePlugins();
+ initializePlugins();
}
}
@@ -249,26 +249,26 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St
string::size_type pos = pluginSpec.find_first_of(delim);
if(pos == string::npos)
{
- entryPoint = pluginSpec;
+ entryPoint = pluginSpec;
}
else
{
- entryPoint = pluginSpec.substr(0, pos);
- string::size_type beg = pluginSpec.find_first_not_of(delim, pos);
- while(beg != string::npos)
- {
- string::size_type end = pluginSpec.find_first_of(delim, beg);
- if(end == string::npos)
- {
- args.push_back(pluginSpec.substr(beg));
- beg = end;
- }
- else
- {
- args.push_back(pluginSpec.substr(beg, end - beg));
- beg = pluginSpec.find_first_not_of(delim, end);
- }
- }
+ entryPoint = pluginSpec.substr(0, pos);
+ string::size_type beg = pluginSpec.find_first_not_of(delim, pos);
+ while(beg != string::npos)
+ {
+ string::size_type end = pluginSpec.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ args.push_back(pluginSpec.substr(beg));
+ beg = end;
+ }
+ else
+ {
+ args.push_back(pluginSpec.substr(beg, end - beg));
+ beg = pluginSpec.find_first_not_of(delim, end);
+ }
+ }
}
//
@@ -307,15 +307,15 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St
if(isLogger)
{
LOGGER_FACTORY factory = (LOGGER_FACTORY)sym;
- _logger = factory(_communicator, args);
- if(!_logger)
- {
+ _logger = factory(_communicator, args);
+ if(!_logger)
+ {
PluginInitializationException e(__FILE__, __LINE__);
ostringstream out;
out << "failure in entry point `" << entryPoint << "'";
e.reason = out.str();
throw e;
- }
+ }
}
else
{
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 84b0f29bce3..86ddccf7cae 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -28,11 +28,11 @@ Ice::PropertiesI::getProperty(const string& key)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ return p->second;
}
else
{
- return string();
+ return string();
}
}
@@ -44,11 +44,11 @@ Ice::PropertiesI::getPropertyWithDefault(const string& key, const string& value)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ return p->second;
}
else
{
- return value;
+ return value;
}
}
@@ -66,11 +66,11 @@ Ice::PropertiesI::getPropertyAsIntWithDefault(const string& key, Int value)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- istringstream v(p->second);
- if(!(v >> value) || !v.eof())
- {
- return 0;
- }
+ istringstream v(p->second);
+ if(!(v >> value) || !v.eof())
+ {
+ return 0;
+ }
}
return value;
@@ -99,7 +99,7 @@ Ice::PropertiesI::setProperty(const string& key, const string& value)
{
if(key.empty())
{
- return;
+ return;
}
//
@@ -109,28 +109,28 @@ Ice::PropertiesI::setProperty(const string& key, const string& value)
string::size_type dotPos = key.find('.');
if(dotPos != string::npos)
{
- string prefix = key.substr(0, dotPos);
- for(const char* const** i = IceInternal::PropertyNames::validProps; *i != 0; ++i)
- {
- string pattern(*i[0]);
- dotPos = pattern.find('.');
- assert(dotPos != string::npos);
- string propPrefix = pattern.substr(0, dotPos);
- if(propPrefix != prefix)
- {
- continue;
- }
-
- bool found = false;
- for(const char* const* j = *i; *j != 0 && !found; ++j)
- {
- found = IceUtil::match(key, *j);
- }
- if(!found)
- {
- logger->warning("unknown property: " + key);
- }
- }
+ string prefix = key.substr(0, dotPos);
+ for(const char* const** i = IceInternal::PropertyNames::validProps; *i != 0; ++i)
+ {
+ string pattern(*i[0]);
+ dotPos = pattern.find('.');
+ assert(dotPos != string::npos);
+ string propPrefix = pattern.substr(0, dotPos);
+ if(propPrefix != prefix)
+ {
+ continue;
+ }
+
+ bool found = false;
+ for(const char* const* j = *i; *j != 0 && !found; ++j)
+ {
+ found = IceUtil::match(key, *j);
+ }
+ if(!found)
+ {
+ logger->warning("unknown property: " + key);
+ }
+ }
}
IceUtil::Mutex::Lock sync(*this);
@@ -140,11 +140,11 @@ Ice::PropertiesI::setProperty(const string& key, const string& value)
//
if(!value.empty())
{
- _properties[key] = value;
+ _properties[key] = value;
}
else
{
- _properties.erase(key);
+ _properties.erase(key);
}
}
@@ -158,7 +158,7 @@ Ice::PropertiesI::getCommandLineOptions()
map<string, string>::const_iterator p;
for(p = _properties.begin(); p != _properties.end(); ++p)
{
- result.push_back("--" + p->first + "=" + p->second);
+ result.push_back("--" + p->first + "=" + p->second);
}
return result;
}
@@ -169,7 +169,7 @@ Ice::PropertiesI::parseCommandLineOptions(const string& prefix, const StringSeq&
string pfx = prefix;
if(!pfx.empty() && pfx[pfx.size() - 1] != '.')
{
- pfx += '.';
+ pfx += '.';
}
pfx = "--" + pfx;
@@ -215,7 +215,7 @@ Ice::PropertiesI::load(const std::string& file)
if(!in)
{
FileException ex(__FILE__, __LINE__);
- ex.path = file;
+ ex.path = file;
ex.error = getSystemErrno();
throw ex;
}
@@ -223,7 +223,7 @@ Ice::PropertiesI::load(const std::string& file)
char line[1024];
while(in.getline(line, 1024))
{
- parseLine(line, _converter);
+ parseLine(line, _converter);
}
}
@@ -250,24 +250,24 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co
{
if(defaults != 0)
{
- _properties = defaults->getPropertiesForPrefix("");
+ _properties = defaults->getPropertiesForPrefix("");
}
StringSeq::iterator q = args.begin();
if(_properties.find("Ice.ProgramName") == _properties.end())
{
- if(q != args.end())
- {
- //
- // Use the first argument as the value for Ice.ProgramName. Replace
- // any backslashes in this value with forward slashes, in case this
- // value is used by the event logger.
- //
- string name = *q;
- replace(name.begin(), name.end(), '\\', '/');
- setProperty("Ice.ProgramName", name);
- }
+ if(q != args.end())
+ {
+ //
+ // Use the first argument as the value for Ice.ProgramName. Replace
+ // any backslashes in this value with forward slashes, in case this
+ // value is used by the event logger.
+ //
+ string name = *q;
+ replace(name.begin(), name.end(), '\\', '/');
+ setProperty("Ice.ProgramName", name);
+ }
}
StringSeq tmp;
@@ -283,27 +283,27 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co
s += "=1";
}
parseLine(s.substr(2), 0);
- loadConfigFiles = true;
+ loadConfigFiles = true;
}
else
{
- tmp.push_back(s);
+ tmp.push_back(s);
}
- ++q;
+ ++q;
}
args = tmp;
if(!loadConfigFiles)
{
- //
- // If Ice.Config is not set, load from ICE_CONFIG (if set)
- //
- loadConfigFiles = (_properties.find("Ice.Config") == _properties.end());
+ //
+ // If Ice.Config is not set, load from ICE_CONFIG (if set)
+ //
+ loadConfigFiles = (_properties.find("Ice.Config") == _properties.end());
}
if(loadConfigFiles)
{
- loadConfig();
+ loadConfig();
}
args = parseIceCommandLineOptions(args);
@@ -319,25 +319,25 @@ Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& conver
string::size_type idx = s.find('#');
if(idx != string::npos)
{
- s.erase(idx);
+ s.erase(idx);
}
idx = s.find_last_not_of(delim);
if(idx != string::npos && idx + 1 < s.length())
{
- s.erase(idx + 1);
+ s.erase(idx + 1);
}
string::size_type beg = s.find_first_not_of(delim);
if(beg == string::npos)
{
- return;
+ return;
}
string::size_type end = s.find_first_of(delim + "=", beg);
if(end == string::npos)
{
- return;
+ return;
}
string key = s.substr(beg, end - beg);
@@ -345,7 +345,7 @@ Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& conver
end = s.find('=', end);
if(end == string::npos)
{
- return;
+ return;
}
++end;
@@ -353,20 +353,20 @@ Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& conver
beg = s.find_first_not_of(delim, end);
if(beg != string::npos)
{
- end = s.length();
- value = s.substr(beg, end - beg);
+ end = s.length();
+ value = s.substr(beg, end - beg);
}
if(converter)
{
string tmp;
- converter->fromUTF8(reinterpret_cast<const Byte*>(key.data()),
- reinterpret_cast<const Byte*>(key.data() + key.size()), tmp);
- key.swap(tmp);
+ converter->fromUTF8(reinterpret_cast<const Byte*>(key.data()),
+ reinterpret_cast<const Byte*>(key.data() + key.size()), tmp);
+ key.swap(tmp);
- converter->fromUTF8(reinterpret_cast<const Byte*>(value.data()),
- reinterpret_cast<const Byte*>(value.data() + value.size()), tmp);
- value.swap(tmp);
+ converter->fromUTF8(reinterpret_cast<const Byte*>(value.data()),
+ reinterpret_cast<const Byte*>(value.data() + value.size()), tmp);
+ value.swap(tmp);
}
setProperty(key, value);
diff --git a/cpp/src/Ice/Protocol.cpp b/cpp/src/Ice/Protocol.cpp
index 793748dbae2..fbe3f832934 100644
--- a/cpp/src/Ice/Protocol.cpp
+++ b/cpp/src/Ice/Protocol.cpp
@@ -12,7 +12,7 @@
namespace IceInternal
{
-const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
+const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
#ifdef __BCPLUSPLUS__
const Ice::Byte requestHdr[headerSize + sizeof(Ice::Int)] =
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index eb20297fb6a..2ad7d17e5da 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -56,23 +56,23 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string&
if(b)
{
- ObjectPrx bb = b->ice_facet(f);
- try
- {
- if(context == 0 ? bb->ice_isA(typeId) : bb->ice_isA(typeId, *context))
- {
- return bb;
- }
+ ObjectPrx bb = b->ice_facet(f);
+ try
+ {
+ if(context == 0 ? bb->ice_isA(typeId) : bb->ice_isA(typeId, *context))
+ {
+ return bb;
+ }
#ifndef NDEBUG
- else
- {
- assert(typeId != "::Ice::Object");
- }
+ else
+ {
+ assert(typeId != "::Ice::Object");
+ }
#endif
- }
- catch(const FacetNotExistException&)
- {
- }
+ }
+ catch(const FacetNotExistException&)
+ {
+ }
}
return 0;
}
@@ -132,21 +132,21 @@ IceProxy::Ice::Object::ice_isA(const string& typeId, const Context* context)
int __cnt = 0;
while(true)
{
- Handle< ::IceDelegate::Ice::Object> __del;
- try
- {
- __checkTwowayOnly("ice_isA");
- __del = __getDelegate();
- return __del->ice_isA(typeId, context);
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__del, __ex, __cnt);
- }
+ Handle< ::IceDelegate::Ice::Object> __del;
+ try
+ {
+ __checkTwowayOnly("ice_isA");
+ __del = __getDelegate();
+ return __del->ice_isA(typeId, context);
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__del, __ex, __cnt);
+ }
}
}
@@ -156,21 +156,21 @@ IceProxy::Ice::Object::ice_ping(const Context* context)
int __cnt = 0;
while(true)
{
- Handle< ::IceDelegate::Ice::Object> __del;
- try
- {
- __del = __getDelegate();
- __del->ice_ping(context);
- return;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__del, __ex, __cnt);
- }
+ Handle< ::IceDelegate::Ice::Object> __del;
+ try
+ {
+ __del = __getDelegate();
+ __del->ice_ping(context);
+ return;
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__del, __ex, __cnt);
+ }
}
}
@@ -180,21 +180,21 @@ IceProxy::Ice::Object::ice_ids(const Context* context)
int __cnt = 0;
while(true)
{
- Handle< ::IceDelegate::Ice::Object> __del;
- try
- {
- __checkTwowayOnly("ice_ids");
- __del = __getDelegate();
- return __del->ice_ids(context);
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__del, __ex, __cnt);
- }
+ Handle< ::IceDelegate::Ice::Object> __del;
+ try
+ {
+ __checkTwowayOnly("ice_ids");
+ __del = __getDelegate();
+ return __del->ice_ids(context);
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__del, __ex, __cnt);
+ }
}
}
@@ -204,31 +204,31 @@ IceProxy::Ice::Object::ice_id(const Context* context)
int __cnt = 0;
while(true)
{
- Handle< ::IceDelegate::Ice::Object> __del;
- try
- {
- __checkTwowayOnly("ice_id");
- __del = __getDelegate();
- return __del->ice_id(context);
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__del, __ex, __cnt);
- }
+ Handle< ::IceDelegate::Ice::Object> __del;
+ try
+ {
+ __checkTwowayOnly("ice_id");
+ __del = __getDelegate();
+ return __del->ice_id(context);
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__del, __ex, __cnt);
+ }
}
}
bool
IceProxy::Ice::Object::ice_invoke(const string& operation,
- OperationMode mode,
- const vector<Byte>& inParams,
- vector<Byte>& outParams,
- const Context* context)
+ OperationMode mode,
+ const vector<Byte>& inParams,
+ vector<Byte>& outParams,
+ const Context* context)
{
pair<const Byte*, const Byte*> inPair;
if(inParams.size() == 0)
@@ -238,7 +238,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
else
{
inPair.first = &inParams[0];
- inPair.second = inPair.first + inParams.size();
+ inPair.second = inPair.first + inParams.size();
}
return ice_invoke(operation, mode, inPair, outParams, context);
}
@@ -246,73 +246,73 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
bool
IceProxy::Ice::Object::ice_invoke(const string& operation,
- OperationMode mode,
- const pair<const Byte*, const Byte*>& inParams,
- vector<Byte>& outParams,
- const Context* context)
+ OperationMode mode,
+ const pair<const Byte*, const Byte*>& inParams,
+ vector<Byte>& outParams,
+ const Context* context)
{
int __cnt = 0;
while(true)
{
- Handle< ::IceDelegate::Ice::Object> __del;
- try
- {
- __del = __getDelegate();
- return __del->ice_invoke(operation, mode, inParams, outParams, context);
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- bool canRetry = mode == Nonmutating || mode == Idempotent;
- if(canRetry)
- {
- __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
- }
- else
- {
- __handleExceptionWrapper(__del, __ex);
- }
- }
- catch(const LocalException& __ex)
- {
- __handleException(__del, __ex, __cnt);
- }
+ Handle< ::IceDelegate::Ice::Object> __del;
+ try
+ {
+ __del = __getDelegate();
+ return __del->ice_invoke(operation, mode, inParams, outParams, context);
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ bool canRetry = mode == Nonmutating || mode == Idempotent;
+ if(canRetry)
+ {
+ __handleExceptionWrapperRelaxed(__del, __ex, __cnt);
+ }
+ else
+ {
+ __handleExceptionWrapper(__del, __ex);
+ }
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__del, __ex, __cnt);
+ }
}
}
void
IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb,
- const string& operation,
- OperationMode mode,
- const vector<Byte>& inParams)
+ const string& operation,
+ OperationMode mode,
+ const vector<Byte>& inParams)
{
cb->__invoke(this, operation, mode, inParams, 0);
}
void
IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb,
- const string& operation,
- OperationMode mode,
- const vector<Byte>& inParams,
- const Context& context)
+ const string& operation,
+ OperationMode mode,
+ const vector<Byte>& inParams,
+ const Context& context)
{
cb->__invoke(this, operation, mode, inParams, &context);
}
void
IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb,
- const string& operation,
- OperationMode mode,
- const pair<const Byte*, const Byte*>& inParams)
+ const string& operation,
+ OperationMode mode,
+ const pair<const Byte*, const Byte*>& inParams)
{
cb->__invoke(this, operation, mode, inParams, 0);
}
void
IceProxy::Ice::Object::ice_invoke_async(const AMI_Array_Object_ice_invokePtr& cb,
- const string& operation,
- OperationMode mode,
- const pair<const Byte*, const Byte*>& inParams,
- const Context& context)
+ const string& operation,
+ OperationMode mode,
+ const pair<const Byte*, const Byte*>& inParams,
+ const Context& context)
{
cb->__invoke(this, operation, mode, inParams, &context);
}
@@ -332,13 +332,13 @@ IceProxy::Ice::Object::ice_identity(const Identity& newIdentity) const
}
if(newIdentity == _reference->getIdentity())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeIdentity(newIdentity));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeIdentity(newIdentity));
+ return proxy;
}
}
@@ -387,13 +387,13 @@ IceProxy::Ice::Object::ice_facet(const string& newFacet) const
{
if(newFacet == _reference->getFacet())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeFacet(newFacet));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeFacet(newFacet));
+ return proxy;
}
}
@@ -414,13 +414,13 @@ IceProxy::Ice::Object::ice_adapterId(const string& newAdapterId) const
{
if(newAdapterId == _reference->getAdapterId())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeAdapterId(newAdapterId));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeAdapterId(newAdapterId));
+ return proxy;
}
}
@@ -437,7 +437,7 @@ IceProxy::Ice::Object::ice_getEndpoints() const
EndpointSeq retSeq;
for(vector<EndpointIPtr>::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
- retSeq.push_back(EndpointPtr::dynamicCast(*p));
+ retSeq.push_back(EndpointPtr::dynamicCast(*p));
}
return retSeq;
}
@@ -448,18 +448,18 @@ IceProxy::Ice::Object::ice_endpoints(const EndpointSeq& newEndpoints) const
vector<EndpointIPtr> endpoints;
for(EndpointSeq::const_iterator p = newEndpoints.begin(); p != newEndpoints.end(); ++p)
{
- endpoints.push_back(EndpointIPtr::dynamicCast(*p));
+ endpoints.push_back(EndpointIPtr::dynamicCast(*p));
}
if(endpoints == _reference->getEndpoints())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeEndpoints(endpoints));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeEndpoints(endpoints));
+ return proxy;
}
}
@@ -480,13 +480,13 @@ IceProxy::Ice::Object::ice_locatorCacheTimeout(Int newTimeout) const
{
if(newTimeout == _reference->getLocatorCacheTimeout())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeLocatorCacheTimeout(newTimeout));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeLocatorCacheTimeout(newTimeout));
+ return proxy;
}
}
@@ -501,13 +501,13 @@ IceProxy::Ice::Object::ice_connectionCached(bool newCache) const
{
if(newCache == _reference->getCacheConnection())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeCacheConnection(newCache));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeCacheConnection(newCache));
+ return proxy;
}
}
@@ -522,13 +522,13 @@ IceProxy::Ice::Object::ice_endpointSelection(EndpointSelectionType newType) cons
{
if(newType == _reference->getEndpointSelection())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeEndpointSelection(newType));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeEndpointSelection(newType));
+ return proxy;
}
}
@@ -543,13 +543,13 @@ IceProxy::Ice::Object::ice_secure(bool b) const
{
if(b == _reference->getSecure())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeSecure(b));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeSecure(b));
+ return proxy;
}
}
@@ -564,13 +564,13 @@ IceProxy::Ice::Object::ice_preferSecure(bool b) const
{
if(b == _reference->getPreferSecure())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changePreferSecure(b));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changePreferSecure(b));
+ return proxy;
}
}
@@ -587,13 +587,13 @@ IceProxy::Ice::Object::ice_router(const RouterPrx& router) const
ReferencePtr ref = _reference->changeRouter(router);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -610,13 +610,13 @@ IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const
ReferencePtr ref = _reference->changeLocator(locator);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -637,13 +637,13 @@ IceProxy::Ice::Object::ice_collocationOptimized(bool b) const
{
if(b == _reference->getCollocationOptimization())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeCollocationOptimization(b));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeCollocationOptimization(b));
+ return proxy;
}
}
@@ -652,13 +652,13 @@ IceProxy::Ice::Object::ice_twoway() const
{
if(_reference->getMode() == Reference::ModeTwoway)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeMode(Reference::ModeTwoway));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeMode(Reference::ModeTwoway));
+ return proxy;
}
}
@@ -673,13 +673,13 @@ IceProxy::Ice::Object::ice_oneway() const
{
if(_reference->getMode() == Reference::ModeOneway)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeMode(Reference::ModeOneway));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeMode(Reference::ModeOneway));
+ return proxy;
}
}
@@ -694,13 +694,13 @@ IceProxy::Ice::Object::ice_batchOneway() const
{
if(_reference->getMode() == Reference::ModeBatchOneway)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeMode(Reference::ModeBatchOneway));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeMode(Reference::ModeBatchOneway));
+ return proxy;
}
}
@@ -715,13 +715,13 @@ IceProxy::Ice::Object::ice_datagram() const
{
if(_reference->getMode() == Reference::ModeDatagram)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeMode(Reference::ModeDatagram));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeMode(Reference::ModeDatagram));
+ return proxy;
}
}
@@ -736,13 +736,13 @@ IceProxy::Ice::Object::ice_batchDatagram() const
{
if(_reference->getMode() == Reference::ModeBatchDatagram)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeMode(Reference::ModeBatchDatagram));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeMode(Reference::ModeBatchDatagram));
+ return proxy;
}
}
@@ -758,13 +758,13 @@ IceProxy::Ice::Object::ice_compress(bool b) const
ReferencePtr ref = _reference->changeCompress(b);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -774,13 +774,13 @@ IceProxy::Ice::Object::ice_timeout(int t) const
ReferencePtr ref = _reference->changeTimeout(t);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -790,13 +790,13 @@ IceProxy::Ice::Object::ice_connectionId(const string& id) const
ReferencePtr ref = _reference->changeConnectionId(id);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -834,17 +834,17 @@ IceProxy::Ice::Object::ice_getConnection()
int __cnt = 0;
while(true)
{
- Handle< ::IceDelegate::Ice::Object> __del;
- try
- {
- __del = __getDelegate();
- bool compress;
- return __del->__getConnection(compress);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__del, __ex, __cnt);
- }
+ Handle< ::IceDelegate::Ice::Object> __del;
+ try
+ {
+ __del = __getDelegate();
+ bool compress;
+ return __del->__getConnection(compress);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__del, __ex, __cnt);
+ }
}
}
@@ -853,20 +853,20 @@ IceProxy::Ice::Object::ice_getCachedConnection() const
{
Handle< ::IceDelegate::Ice::Object> __del;
{
- IceUtil::Mutex::Lock sync(*this);
- __del = _delegate;
+ IceUtil::Mutex::Lock sync(*this);
+ __del = _delegate;
}
if(__del)
{
- try
- {
- bool compress;
- return __del->__getConnection(compress);
- }
- catch(const CollocationOptimizationException&)
- {
- }
+ try
+ {
+ bool compress;
+ return __del->__getConnection(compress);
+ }
+ catch(const CollocationOptimizationException&)
+ {
+ }
}
return 0;
}
@@ -885,11 +885,11 @@ IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from)
Handle< ::IceDelegateM::Ice::Object> delegateM;
{
- IceUtil::Mutex::Lock sync(*from.get());
+ IceUtil::Mutex::Lock sync(*from.get());
- ref = from->_reference;
- delegateD = dynamic_cast< ::IceDelegateD::Ice::Object*>(from->_delegate.get());
- delegateM = dynamic_cast< ::IceDelegateM::Ice::Object*>(from->_delegate.get());
+ ref = from->_reference;
+ delegateD = dynamic_cast< ::IceDelegateD::Ice::Object*>(from->_delegate.get());
+ delegateM = dynamic_cast< ::IceDelegateM::Ice::Object*>(from->_delegate.get());
}
//
@@ -904,31 +904,31 @@ IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from)
if(_reference->getCacheConnection())
{
- //
- // The _delegate attribute is only used if "cache connection"
- // is enabled. If it's not enabled, we don't keep track of the
- // delegate -- a new delegate is created for each invocations.
- //
+ //
+ // The _delegate attribute is only used if "cache connection"
+ // is enabled. If it's not enabled, we don't keep track of the
+ // delegate -- a new delegate is created for each invocations.
+ //
- if(delegateD)
- {
- Handle< ::IceDelegateD::Ice::Object> delegate = __createDelegateD();
- delegate->__copyFrom(delegateD);
- _delegate = delegate;
- }
- else if(delegateM)
- {
- Handle< ::IceDelegateM::Ice::Object> delegate = __createDelegateM();
- delegate->__copyFrom(delegateM);
- _delegate = delegate;
- }
+ if(delegateD)
+ {
+ Handle< ::IceDelegateD::Ice::Object> delegate = __createDelegateD();
+ delegate->__copyFrom(delegateD);
+ _delegate = delegate;
+ }
+ else if(delegateM)
+ {
+ Handle< ::IceDelegateM::Ice::Object> delegate = __createDelegateM();
+ delegate->__copyFrom(delegateM);
+ _delegate = delegate;
+ }
}
}
void
IceProxy::Ice::Object::__handleException(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>& delegate,
- const LocalException& ex,
- int& cnt)
+ const LocalException& ex,
+ int& cnt)
{
//
// Only _delegate needs to be mutex protected here.
@@ -936,7 +936,7 @@ IceProxy::Ice::Object::__handleException(const ::IceInternal::Handle< ::IceDeleg
IceUtil::Mutex::Lock sync(*this);
if(delegate.get() == _delegate.get())
{
- _delegate = 0;
+ _delegate = 0;
}
ProxyFactoryPtr proxyFactory;
@@ -946,9 +946,9 @@ IceProxy::Ice::Object::__handleException(const ::IceInternal::Handle< ::IceDeleg
}
catch(const CommunicatorDestroyedException&)
{
- //
- // The communicator is already destroyed, so we cannot retry.
- //
+ //
+ // The communicator is already destroyed, so we cannot retry.
+ //
ex.ice_throw();
}
@@ -958,37 +958,37 @@ IceProxy::Ice::Object::__handleException(const ::IceInternal::Handle< ::IceDeleg
void
IceProxy::Ice::Object::__handleExceptionWrapper(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>& delegate,
- const LocalExceptionWrapper& ex)
+ const LocalExceptionWrapper& ex)
{
{
- IceUtil::Mutex::Lock sync(*this);
- if(delegate.get() == _delegate.get())
- {
- _delegate = 0;
- }
+ IceUtil::Mutex::Lock sync(*this);
+ if(delegate.get() == _delegate.get())
+ {
+ _delegate = 0;
+ }
}
if(!ex.retry())
{
- ex.get()->ice_throw();
+ ex.get()->ice_throw();
}
}
void
IceProxy::Ice::Object::__handleExceptionWrapperRelaxed(const ::IceInternal::Handle< ::IceDelegate::Ice::Object>& del,
- const LocalExceptionWrapper& ex, int& cnt)
+ const LocalExceptionWrapper& ex, int& cnt)
{
if(!ex.retry())
{
- __handleException(del, *ex.get(), cnt);
+ __handleException(del, *ex.get(), cnt);
}
else
{
- IceUtil::Mutex::Lock sync(*this);
- if(del.get() == _delegate.get())
- {
- _delegate = 0;
- }
+ IceUtil::Mutex::Lock sync(*this);
+ if(del.get() == _delegate.get())
+ {
+ _delegate = 0;
+ }
}
}
@@ -1009,8 +1009,8 @@ IceProxy::Ice::Object::__checkTwowayOnly(const char* name) const
if(!ice_isTwoway())
{
TwowayOnlyException ex(__FILE__, __LINE__);
- ex.operation = name;
- throw ex;
+ ex.operation = name;
+ throw ex;
}
}
@@ -1025,8 +1025,8 @@ IceProxy::Ice::Object::__checkTwowayOnly(const string& name) const
if(!ice_isTwoway())
{
TwowayOnlyException ex(__FILE__, __LINE__);
- ex.operation = name;
- throw ex;
+ ex.operation = name;
+ throw ex;
}
}
@@ -1043,47 +1043,47 @@ IceProxy::Ice::Object::__getDelegate()
if(_delegate)
{
- return _delegate;
+ return _delegate;
}
Handle< ::IceDelegate::Ice::Object> delegate;
if(_reference->getCollocationOptimization())
{
- ObjectAdapterPtr adapter = _reference->getInstance()->objectAdapterFactory()->findObjectAdapter(this);
- if(adapter)
- {
- Handle< ::IceDelegateD::Ice::Object> d = __createDelegateD();
- d->setup(_reference, adapter);
- delegate = d;
- }
+ ObjectAdapterPtr adapter = _reference->getInstance()->objectAdapterFactory()->findObjectAdapter(this);
+ if(adapter)
+ {
+ Handle< ::IceDelegateD::Ice::Object> d = __createDelegateD();
+ d->setup(_reference, adapter);
+ delegate = d;
+ }
}
if(!delegate)
{
- Handle< ::IceDelegateM::Ice::Object> d = __createDelegateM();
- d->setup(_reference);
- delegate = d;
-
- //
- // If this proxy is for a non-local object, and we are
- // using a router, then add this proxy to the router info
- // object.
- //
- RouterInfoPtr ri = _reference->getRouterInfo();
- if(ri)
- {
- ri->addProxy(this);
- }
+ Handle< ::IceDelegateM::Ice::Object> d = __createDelegateM();
+ d->setup(_reference);
+ delegate = d;
+
+ //
+ // If this proxy is for a non-local object, and we are
+ // using a router, then add this proxy to the router info
+ // object.
+ //
+ RouterInfoPtr ri = _reference->getRouterInfo();
+ if(ri)
+ {
+ ri->addProxy(this);
+ }
}
if(_reference->getCacheConnection())
{
- //
- // The _delegate attribute is only used if "cache connection"
- // is enabled. If it's not enabled, we don't keep track of the
- // delegate -- a new delegate is created for each invocations.
- //
- _delegate = delegate;
+ //
+ // The _delegate attribute is only used if "cache connection"
+ // is enabled. If it's not enabled, we don't keep track of the
+ // delegate -- a new delegate is created for each invocations.
+ //
+ _delegate = delegate;
}
return delegate;
@@ -1126,34 +1126,34 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context* context)
Outgoing __og(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, context, __compress);
try
{
- BasicStream* __os = __og.os();
- __os->write(__id, false);
+ BasicStream* __os = __og.os();
+ __os->write(__id, false);
}
catch(const ::Ice::LocalException& __ex)
{
- __og.abort(__ex);
+ __og.abort(__ex);
}
bool __ret;
bool __ok = __og.invoke();
try
{
- BasicStream* __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
- }
+ BasicStream* __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is->throwException();
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
+ }
__is->read(__ret);
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::LocalExceptionWrapper(__ex, false);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
return __ret;
}
@@ -1166,22 +1166,22 @@ IceDelegateM::Ice::Object::ice_ping(const Context* context)
bool __ok = __og.invoke();
try
{
- BasicStream* __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
- }
+ BasicStream* __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is->throwException();
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
+ }
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::LocalExceptionWrapper(__ex, false);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
}
@@ -1194,23 +1194,23 @@ IceDelegateM::Ice::Object::ice_ids(const Context* context)
bool __ok = __og.invoke();
try
{
- BasicStream* __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
- }
- __is->read(__ret, false);
+ BasicStream* __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is->throwException();
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
+ }
+ __is->read(__ret, false);
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::LocalExceptionWrapper(__ex, false);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
return __ret;
}
@@ -1224,23 +1224,23 @@ IceDelegateM::Ice::Object::ice_id(const Context* context)
bool __ok = __og.invoke();
try
{
- BasicStream* __is = __og.is();
- if(!__ok)
- {
- try
- {
- __is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
- }
- __is->read(__ret, false);
+ BasicStream* __is = __og.is();
+ if(!__ok)
+ {
+ try
+ {
+ __is->throwException();
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
+ }
+ __is->read(__ret, false);
}
catch(const ::Ice::LocalException& __ex)
{
- throw ::IceInternal::LocalExceptionWrapper(__ex, false);
+ throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
return __ret;
}
@@ -1248,19 +1248,19 @@ IceDelegateM::Ice::Object::ice_id(const Context* context)
bool
IceDelegateM::Ice::Object::ice_invoke(const string& operation,
OperationMode mode,
- const pair<const Byte*, const Byte*>& inParams,
- vector<Byte>& outParams,
- const Context* context)
+ const pair<const Byte*, const Byte*>& inParams,
+ vector<Byte>& outParams,
+ const Context* context)
{
Outgoing __og(__connection.get(), __reference.get(), operation, mode, context, __compress);
try
{
- BasicStream* __os = __og.os();
- __os->writeBlob(inParams.first, static_cast<Int>(inParams.second - inParams.first));
+ BasicStream* __os = __og.os();
+ __os->writeBlob(inParams.first, static_cast<Int>(inParams.second - inParams.first));
}
catch(const ::Ice::LocalException& __ex)
{
- __og.abort(__ex);
+ __og.abort(__ex);
}
bool ok = __og.invoke();
if(__reference->getMode() == Reference::ModeTwoway)
@@ -1329,19 +1329,19 @@ IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context* context)
__initCurrent(__current, "ice_isA", ::Ice::Nonmutating, context);
while(true)
{
- Direct __direct(__current);
- bool __ret;
- try
- {
- __ret = __direct.servant()->ice_isA(__id, __current);
- }
- catch(...)
- {
- __direct.destroy();
- throw;
- }
- __direct.destroy();
- return __ret;
+ Direct __direct(__current);
+ bool __ret;
+ try
+ {
+ __ret = __direct.servant()->ice_isA(__id, __current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return __ret;
}
return false; // To keep the Visual C++ compiler happy.
}
@@ -1353,18 +1353,18 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context* context)
__initCurrent(__current, "ice_ping", ::Ice::Nonmutating, context);
while(true)
{
- Direct __direct(__current);
- try
- {
- __direct.servant()->ice_ping(__current);
- }
- catch(...)
- {
- __direct.destroy();
- throw;
- }
- __direct.destroy();
- return;
+ Direct __direct(__current);
+ try
+ {
+ __direct.servant()->ice_ping(__current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return;
}
}
@@ -1375,19 +1375,19 @@ IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context* context)
__initCurrent(__current, "ice_ids", ::Ice::Nonmutating, context);
while(true)
{
- Direct __direct(__current);
- vector<string> __ret;
- try
- {
- __ret = __direct.servant()->ice_ids(__current);
- }
- catch(...)
- {
- __direct.destroy();
- throw;
- }
- __direct.destroy();
- return __ret;
+ Direct __direct(__current);
+ vector<string> __ret;
+ try
+ {
+ __ret = __direct.servant()->ice_ids(__current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return __ret;
}
return vector<string>(); // To keep the Visual C++ compiler happy.
}
@@ -1399,29 +1399,29 @@ IceDelegateD::Ice::Object::ice_id(const ::Ice::Context* context)
__initCurrent(__current, "ice_id", ::Ice::Nonmutating, context);
while(true)
{
- Direct __direct(__current);
- string __ret;
- try
- {
- __ret = __direct.servant()->ice_id(__current);
- }
- catch(...)
- {
- __direct.destroy();
- throw;
- }
- __direct.destroy();
- return __ret;
+ Direct __direct(__current);
+ string __ret;
+ try
+ {
+ __ret = __direct.servant()->ice_id(__current);
+ }
+ catch(...)
+ {
+ __direct.destroy();
+ throw;
+ }
+ __direct.destroy();
+ return __ret;
}
return string(); // To keep the Visual C++ compiler happy.
}
bool
IceDelegateD::Ice::Object::ice_invoke(const string&,
- OperationMode,
- const pair<const Byte*, const Byte*>& inParams,
- vector<Byte>&,
- const Context*)
+ OperationMode,
+ const pair<const Byte*, const Byte*>& inParams,
+ vector<Byte>&,
+ const Context*)
{
throw CollocationOptimizationException(__FILE__, __LINE__);
return false;
@@ -1456,7 +1456,7 @@ IceDelegateD::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegate
void
IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, OperationMode mode,
- const Context* context)
+ const Context* context)
{
current.adapter = __adapter;
current.id = __reference->getIdentity();
@@ -1465,29 +1465,29 @@ IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, Ope
current.mode = mode;
if(context != 0)
{
- //
- // Explicit context
- //
- current.ctx = *context;
+ //
+ // Explicit context
+ //
+ current.ctx = *context;
}
else
{
- //
- // Implicit context
- //
- const ImplicitContextIPtr& implicitContext =
- __reference->getInstance()->getImplicitContext();
+ //
+ // Implicit context
+ //
+ const ImplicitContextIPtr& implicitContext =
+ __reference->getInstance()->getImplicitContext();
- const Context& prxContext = __reference->getContext()->getValue();
+ const Context& prxContext = __reference->getContext()->getValue();
- if(implicitContext == 0)
- {
- current.ctx = prxContext;
- }
- else
- {
- implicitContext->combine(prxContext, current.ctx);
- }
+ if(implicitContext == 0)
+ {
+ current.ctx = prxContext;
+ }
+ else
+ {
+ implicitContext->combine(prxContext, current.ctx);
+ }
}
current.requestId = -1;
}
@@ -1512,19 +1512,19 @@ Ice::proxyIdentityLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return false;
+ return false;
}
else if(!lhs && rhs)
{
- return true;
+ return true;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- return lhs->ice_getIdentity() < rhs->ice_getIdentity();
+ return lhs->ice_getIdentity() < rhs->ice_getIdentity();
}
}
@@ -1533,19 +1533,19 @@ Ice::proxyIdentityEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return true;
+ return true;
}
else if(!lhs && rhs)
{
- return false;
+ return false;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- return lhs->ice_getIdentity() == rhs->ice_getIdentity();
+ return lhs->ice_getIdentity() == rhs->ice_getIdentity();
}
}
@@ -1554,43 +1554,43 @@ Ice::proxyIdentityAndFacetLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return false;
+ return false;
}
else if(!lhs && rhs)
{
- return true;
+ return true;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- Identity lhsIdentity = lhs->ice_getIdentity();
- Identity rhsIdentity = rhs->ice_getIdentity();
-
- if(lhsIdentity < rhsIdentity)
- {
- return true;
- }
- else if(rhsIdentity < lhsIdentity)
- {
- return false;
- }
-
- string lhsFacet = lhs->ice_getFacet();
- string rhsFacet = rhs->ice_getFacet();
-
- if(lhsFacet < rhsFacet)
- {
- return true;
- }
- else if(rhsFacet < lhsFacet)
- {
- return false;
- }
-
- return false;
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity < rhsIdentity)
+ {
+ return true;
+ }
+ else if(rhsIdentity < lhsIdentity)
+ {
+ return false;
+ }
+
+ string lhsFacet = lhs->ice_getFacet();
+ string rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet < rhsFacet)
+ {
+ return true;
+ }
+ else if(rhsFacet < lhsFacet)
+ {
+ return false;
+ }
+
+ return false;
}
}
@@ -1599,33 +1599,33 @@ Ice::proxyIdentityAndFacetEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return true;
+ return true;
}
else if(!lhs && rhs)
{
- return false;
+ return false;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- Identity lhsIdentity = lhs->ice_getIdentity();
- Identity rhsIdentity = rhs->ice_getIdentity();
-
- if(lhsIdentity == rhsIdentity)
- {
- string lhsFacet = lhs->ice_getFacet();
- string rhsFacet = rhs->ice_getFacet();
-
- if(lhsFacet == rhsFacet)
- {
- return true;
- }
- }
-
- return false;
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity == rhsIdentity)
+ {
+ string lhsFacet = lhs->ice_getFacet();
+ string rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet == rhsFacet)
+ {
+ return true;
+ }
+ }
+
+ return false;
}
}
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp
index 3de3450d22f..338cd0a62fb 100644
--- a/cpp/src/Ice/ProxyFactory.cpp
+++ b/cpp/src/Ice/ProxyFactory.cpp
@@ -39,11 +39,11 @@ IceInternal::ProxyFactory::proxyToString(const ObjectPrx& proxy) const
{
if(proxy)
{
- return proxy->__reference()->toString();
+ return proxy->__reference()->toString();
}
else
{
- return "";
+ return "";
}
}
@@ -69,13 +69,13 @@ IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s)
{
if(proxy)
{
- proxy->__reference()->getIdentity().__write(s);
- proxy->__reference()->streamWrite(s);
+ proxy->__reference()->getIdentity().__write(s);
+ proxy->__reference()->streamWrite(s);
}
else
{
- Identity ident;
- ident.__write(s);
+ Identity ident;
+ ident.__write(s);
}
}
@@ -104,48 +104,48 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
if(one)
{
- LocatorInfoPtr li = ref->getLocatorInfo();
- if(li)
- {
- //
- // We retry ObjectNotExistException if the reference is
- // indirect.
- //
- li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref));
- }
- else if(ref->getRouterInfo() && one->operation == "ice_add_proxy")
- {
- //
- // If we have a router, an ObjectNotExistException with an
- // operation name "ice_add_proxy" indicates to the client
- // that the router isn't aware of the proxy (for example,
- // because it was evicted by the router). In this case, we
- // must *always* retry, so that the missing proxy is added
- // to the router.
- //
- if(traceLevels->retry >= 1)
- {
- Trace out(logger, traceLevels->retryCat);
- out << "retrying operation call to add proxy to router\n" << ex;
- }
- return; // We must always retry, so we don't look at the retry count.
- }
- else
- {
- //
- // For all other cases, we don't retry
- // ObjectNotExistException.
- //
- ex.ice_throw();
- }
+ LocatorInfoPtr li = ref->getLocatorInfo();
+ if(li)
+ {
+ //
+ // We retry ObjectNotExistException if the reference is
+ // indirect.
+ //
+ li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref));
+ }
+ else if(ref->getRouterInfo() && one->operation == "ice_add_proxy")
+ {
+ //
+ // If we have a router, an ObjectNotExistException with an
+ // operation name "ice_add_proxy" indicates to the client
+ // that the router isn't aware of the proxy (for example,
+ // because it was evicted by the router). In this case, we
+ // must *always* retry, so that the missing proxy is added
+ // to the router.
+ //
+ if(traceLevels->retry >= 1)
+ {
+ Trace out(logger, traceLevels->retryCat);
+ out << "retrying operation call to add proxy to router\n" << ex;
+ }
+ return; // We must always retry, so we don't look at the retry count.
+ }
+ else
+ {
+ //
+ // For all other cases, we don't retry
+ // ObjectNotExistException.
+ //
+ ex.ice_throw();
+ }
}
else if(dynamic_cast<const RequestFailedException*>(&ex))
{
- //
+ //
// We don't retry other *NotExistException, which are all
// derived from RequestFailedException.
- //
- ex.ice_throw();
+ //
+ ex.ice_throw();
}
//
@@ -172,7 +172,7 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
//
if(dynamic_cast<const MarshalException*>(&ex))
{
- ex.ice_throw();
+ ex.ice_throw();
}
++cnt;
@@ -180,33 +180,33 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
if(cnt > static_cast<int>(_retryIntervals.size()))
{
- if(traceLevels->retry >= 1)
- {
- Trace out(logger, traceLevels->retryCat);
- out << "cannot retry operation call because retry limit has been exceeded\n" << ex;
- }
- ex.ice_throw();
+ if(traceLevels->retry >= 1)
+ {
+ Trace out(logger, traceLevels->retryCat);
+ out << "cannot retry operation call because retry limit has been exceeded\n" << ex;
+ }
+ ex.ice_throw();
}
int interval = _retryIntervals[cnt - 1];
if(traceLevels->retry >= 1)
{
- Trace out(logger, traceLevels->retryCat);
- out << "retrying operation call";
- if(interval > 0)
- {
- out << " in " << interval << "ms";
- }
- out << " because of exception\n" << ex;
+ Trace out(logger, traceLevels->retryCat);
+ out << "retrying operation call";
+ if(interval > 0)
+ {
+ out << " in " << interval << "ms";
+ }
+ out << " because of exception\n" << ex;
}
if(interval > 0)
{
- //
- // Sleep before retrying.
- //
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(interval));
+ //
+ // Sleep before retrying.
+ //
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(interval));
}
}
@@ -220,46 +220,46 @@ IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) :
while(true)
{
- const string delim = " \t";
+ const string delim = " \t";
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- if(_retryIntervals.empty())
- {
- _retryIntervals.push_back(0);
- }
- break;
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ if(_retryIntervals.empty())
+ {
+ _retryIntervals.push_back(0);
+ }
+ break;
+ }
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- if(beg == end)
- {
- break;
- }
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ if(beg == end)
+ {
+ break;
+ }
- istringstream value(str.substr(beg, end - beg));
+ istringstream value(str.substr(beg, end - beg));
- int v;
- if(!(value >> v) || !value.eof())
- {
- v = 0;
- }
+ int v;
+ if(!(value >> v) || !value.eof())
+ {
+ v = 0;
+ }
- //
- // If -1 is the first value, no retry and wait intervals.
- //
- if(v == -1 && _retryIntervals.empty())
- {
- break;
- }
+ //
+ // If -1 is the first value, no retry and wait intervals.
+ //
+ if(v == -1 && _retryIntervals.empty())
+ {
+ break;
+ }
- _retryIntervals.push_back(v > 0 ? v : 0);
+ _retryIntervals.push_back(v > 0 ? v : 0);
}
}
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 99308ff37af..2dfe49d0e55 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -41,7 +41,7 @@ struct RandomNumberGenerator : public std::unary_function<ptrdiff_t, ptrdiff_t>
{
ptrdiff_t operator()(ptrdiff_t d)
{
- return IceUtil::random(static_cast<int>(d));
+ return IceUtil::random(static_cast<int>(d));
}
};
@@ -74,7 +74,7 @@ IceInternal::Reference::changeMode(Mode newMode) const
{
if(newMode == _mode)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_mode = newMode;
@@ -86,7 +86,7 @@ IceInternal::Reference::changeIdentity(const Identity& newIdentity) const
{
if(newIdentity == _identity)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_identity = newIdentity;
@@ -98,7 +98,7 @@ IceInternal::Reference::changeFacet(const string& newFacet) const
{
if(newFacet == _facet)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_facet = newFacet;
@@ -132,19 +132,19 @@ Reference::hash() const
for(q = _context->getValue().begin(); q != _context->getValue().end(); ++q)
{
- for(p = q->first.begin(); p != q->first.end(); ++p)
- {
- h = 5 * h + *p;
- }
- for(p = q->second.begin(); p != q->second.end(); ++p)
- {
- h = 5 * h + *p;
- }
+ for(p = q->first.begin(); p != q->first.end(); ++p)
+ {
+ h = 5 * h + *p;
+ }
+ for(p = q->second.begin(); p != q->second.end(); ++p)
+ {
+ h = 5 * h + *p;
+ }
}
for(p = _facet.begin(); p != _facet.end(); ++p)
{
- h = 5 * h + *p;
+ h = 5 * h + *p;
}
h = 5 * h + static_cast<Int>(getSecure());
@@ -168,11 +168,11 @@ IceInternal::Reference::streamWrite(BasicStream* s) const
//
if(_facet.empty())
{
- s->write(static_cast<string*>(0), static_cast<string*>(0));
+ s->write(static_cast<string*>(0), static_cast<string*>(0));
}
else
{
- s->write(&_facet, &_facet + 1);
+ s->write(&_facet, &_facet + 1);
}
s->write(static_cast<Byte>(_mode));
@@ -213,66 +213,66 @@ IceInternal::Reference::toString() const
{
s << " -f ";
- //
- // If the encoded facet string contains characters which
- // the reference parser uses as separators, then we enclose
- // the facet string in quotes.
- //
- string fs = _facet;
+ //
+ // If the encoded facet string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the facet string in quotes.
+ //
+ string fs = _facet;
if(_instance->initializationData().stringConverter)
{
UTF8BufferI buffer;
Byte* last =
- _instance->initializationData().stringConverter->toUTF8(fs.data(), fs.data() + fs.size(), buffer);
- fs = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
+ _instance->initializationData().stringConverter->toUTF8(fs.data(), fs.data() + fs.size(), buffer);
+ fs = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
+ }
+ fs = IceUtil::escapeString(fs, "");
+ if(fs.find_first_of(" :@") != string::npos)
+ {
+ s << '"' << fs << '"';
+ }
+ else
+ {
+ s << fs;
}
- fs = IceUtil::escapeString(fs, "");
- if(fs.find_first_of(" :@") != string::npos)
- {
- s << '"' << fs << '"';
- }
- else
- {
- s << fs;
- }
}
switch(_mode)
{
- case ModeTwoway:
- {
- s << " -t";
- break;
- }
-
- case ModeOneway:
- {
- s << " -o";
- break;
- }
-
- case ModeBatchOneway:
- {
- s << " -O";
- break;
- }
-
- case ModeDatagram:
- {
- s << " -d";
- break;
- }
-
- case ModeBatchDatagram:
- {
- s << " -D";
- break;
- }
+ case ModeTwoway:
+ {
+ s << " -t";
+ break;
+ }
+
+ case ModeOneway:
+ {
+ s << " -o";
+ break;
+ }
+
+ case ModeBatchOneway:
+ {
+ s << " -O";
+ break;
+ }
+
+ case ModeDatagram:
+ {
+ s << " -d";
+ break;
+ }
+
+ case ModeBatchDatagram:
+ {
+ s << " -D";
+ break;
+ }
}
if(getSecure())
{
- s << " -s";
+ s << " -s";
}
return s.str();
@@ -289,27 +289,27 @@ IceInternal::Reference::operator==(const Reference& r) const
if(getType() != r.getType())
{
- return false;
+ return false;
}
if(_mode != r._mode)
{
- return false;
+ return false;
}
if(_identity != r._identity)
{
- return false;
+ return false;
}
if(_context->getValue() != r._context->getValue())
{
- return false;
+ return false;
}
if(_facet != r._facet)
{
- return false;
+ return false;
}
return true;
@@ -330,47 +330,47 @@ IceInternal::Reference::operator<(const Reference& r) const
if(_mode < r._mode)
{
- return true;
+ return true;
}
else if(r._mode < _mode)
{
- return false;
+ return false;
}
if(_identity < r._identity)
{
- return true;
+ return true;
}
else if(r._identity < _identity)
{
- return false;
+ return false;
}
if(_context->getValue() < r._context->getValue())
{
- return true;
+ return true;
}
else if(r._context->getValue() < _context->getValue())
{
- return false;
+ return false;
}
if(_facet < r._facet)
{
- return true;
+ return true;
}
else if(r._facet < _facet)
{
- return false;
+ return false;
}
if(getType() < r.getType())
{
- return true;
+ return true;
}
else if(r.getType() < getType())
{
- return false;
+ return false;
}
return false;
@@ -383,7 +383,7 @@ public:
bool
operator()(ConnectionIPtr p) const
{
- return p->endpoint()->datagram();
+ return p->endpoint()->datagram();
}
};
@@ -394,12 +394,12 @@ public:
bool
operator()(ConnectionIPtr p) const
{
- return p->endpoint()->secure();
+ return p->endpoint()->secure();
}
};
IceInternal::Reference::Reference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
- const SharedContextPtr& ctx, const string& fs, Mode md) :
+ const SharedContextPtr& ctx, const string& fs, Mode md) :
_hashInitialized(false),
_instance(inst),
_communicator(com),
@@ -425,8 +425,8 @@ void IceInternal::incRef(IceInternal::FixedReference* p) { p->__incRef(); }
void IceInternal::decRef(IceInternal::FixedReference* p) { p->__decRef(); }
IceInternal::FixedReference::FixedReference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
- const SharedContextPtr& ctx, const string& fs, Mode md,
- const vector<ConnectionIPtr>& fixedConns) :
+ const SharedContextPtr& ctx, const string& fs, Mode md,
+ const vector<ConnectionIPtr>& fixedConns) :
Reference(inst, com, ident, ctx, fs, md),
_fixedConnections(fixedConns)
{
@@ -620,9 +620,9 @@ IceInternal::FixedReference::getConnection(bool& compress) const
vector<ConnectionIPtr> filteredConns = filterConnections(_fixedConnections);
if(filteredConns.empty())
{
- NoEndpointException ex(__FILE__, __LINE__);
- ex.proxy = ""; // No stringified representation for fixed proxies
- throw ex;
+ NoEndpointException ex(__FILE__, __LINE__);
+ ex.proxy = ""; // No stringified representation for fixed proxies
+ throw ex;
}
ConnectionIPtr connection = filteredConns[0];
@@ -669,7 +669,7 @@ IceInternal::FixedReference::operator<(const Reference& r) const
{
const FixedReference* rhs = dynamic_cast<const FixedReference*>(&r);
assert(rhs);
- return _fixedConnections < rhs->_fixedConnections;
+ return _fixedConnections < rhs->_fixedConnections;
}
return false;
}
@@ -693,28 +693,28 @@ IceInternal::FixedReference::filterConnections(const vector<ConnectionIPtr>& all
switch(getMode())
{
- case Reference::ModeTwoway:
- case Reference::ModeOneway:
- case Reference::ModeBatchOneway:
- {
- //
- // Filter out datagram connections.
- //
+ case Reference::ModeTwoway:
+ case Reference::ModeOneway:
+ case Reference::ModeBatchOneway:
+ {
+ //
+ // Filter out datagram connections.
+ //
connections.erase(remove_if(connections.begin(), connections.end(), ConnectionIsDatagram()),
- connections.end());
- break;
- }
-
- case Reference::ModeDatagram:
- case Reference::ModeBatchDatagram:
- {
- //
- // Filter out non-datagram connections.
- //
+ connections.end());
+ break;
+ }
+
+ case Reference::ModeDatagram:
+ case Reference::ModeBatchDatagram:
+ {
+ //
+ // Filter out non-datagram connections.
+ //
connections.erase(remove_if(connections.begin(), connections.end(), not1(ConnectionIsDatagram())),
- connections.end());
- break;
- }
+ connections.end());
+ break;
+ }
}
//
@@ -733,17 +733,17 @@ IceInternal::FixedReference::filterConnections(const vector<ConnectionIPtr>& all
DefaultsAndOverridesPtr overrides = getInstance()->defaultsAndOverrides();
if(overrides->overrideSecure ? overrides->overrideSecureValue : getSecure())
{
- connections.erase(remove_if(connections.begin(), connections.end(), not1(ConnectionIsSecure())),
- connections.end());
+ connections.erase(remove_if(connections.begin(), connections.end(), not1(ConnectionIsSecure())),
+ connections.end());
}
else
{
- //
- // We must use stable_partition() instead of just simply
- // partition(), because otherwise some STL implementations
- // order our now randomized connections.
- //
- stable_partition(connections.begin(), connections.end(), not1(ConnectionIsSecure()));
+ //
+ // We must use stable_partition() instead of just simply
+ // partition(), because otherwise some STL implementations
+ // order our now randomized connections.
+ //
+ stable_partition(connections.begin(), connections.end(), not1(ConnectionIsSecure()));
}
return connections;
@@ -758,10 +758,10 @@ IceInternal::RoutableReference::getRoutedEndpoints() const
if(_routerInfo)
{
//
- // If we route, we send everything to the router's client
- // proxy endpoints.
- //
- return _routerInfo->getClientEndpoints();
+ // If we route, we send everything to the router's client
+ // proxy endpoints.
+ //
+ return _routerInfo->getClientEndpoints();
}
return vector<EndpointIPtr>();
}
@@ -807,7 +807,7 @@ IceInternal::RoutableReference::changeSecure(bool newSecure) const
{
if(newSecure == _secure)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_secure = newSecure;
@@ -819,7 +819,7 @@ IceInternal::RoutableReference::changePreferSecure(bool newPreferSecure) const
{
if(newPreferSecure == _preferSecure)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_preferSecure = newPreferSecure;
@@ -832,7 +832,7 @@ IceInternal::RoutableReference::changeRouter(const RouterPrx& newRouter) const
RouterInfoPtr newRouterInfo = getInstance()->routerManager()->get(newRouter);
if(newRouterInfo == _routerInfo)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_routerInfo = newRouterInfo;
@@ -844,7 +844,7 @@ IceInternal::RoutableReference::changeCollocationOptimization(bool newCollocatio
{
if(newCollocationOptimization == _collocationOptimization)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_collocationOptimization = newCollocationOptimization;
@@ -856,7 +856,7 @@ IceInternal::RoutableReference::changeCompress(bool newCompress) const
{
if(_overrideCompress && newCompress == _compress)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_compress = newCompress;
@@ -869,7 +869,7 @@ IceInternal::RoutableReference::changeTimeout(int newTimeout) const
{
if(_overrideTimeout && newTimeout == _timeout)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_timeout = newTimeout;
@@ -882,7 +882,7 @@ IceInternal::RoutableReference::changeConnectionId(const string& id) const
{
if(id == _connectionId)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_connectionId = id;
@@ -894,7 +894,7 @@ IceInternal::RoutableReference::changeCacheConnection(bool newCache) const
{
if(newCache == _cacheConnection)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_cacheConnection = newCache;
@@ -906,7 +906,7 @@ IceInternal::RoutableReference::changeEndpointSelection(EndpointSelectionType ne
{
if(newType == _endpointSelection)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_endpointSelection = newType;
@@ -945,35 +945,35 @@ IceInternal::RoutableReference::operator==(const Reference& r) const
}
if(_secure != rhs->_secure)
{
- return false;
+ return false;
}
if(_preferSecure != rhs->_preferSecure)
{
- return false;
+ return false;
}
if(_collocationOptimization != rhs->_collocationOptimization)
{
- return false;
+ return false;
}
if(_cacheConnection != rhs->_cacheConnection)
{
- return false;
+ return false;
}
if(_endpointSelection != rhs->_endpointSelection)
{
- return false;
+ return false;
}
if(_connectionId != rhs->_connectionId)
{
- return false;
+ return false;
}
if(_overrideCompress != rhs->_overrideCompress || _overrideCompress && _compress != rhs->_compress)
{
- return false;
+ return false;
}
if(_overrideTimeout != rhs->_overrideTimeout || _overrideTimeout && _timeout != rhs->_timeout)
{
- return false;
+ return false;
}
if(_threadPerConnection != rhs->_threadPerConnection)
{
@@ -1002,93 +1002,93 @@ IceInternal::RoutableReference::operator<(const Reference& r) const
if(Reference::operator==(r))
{
const RoutableReference* rhs = dynamic_cast<const RoutableReference*>(&r);
- assert(rhs);
- if(!_secure && rhs->_secure)
- {
- return true;
- }
- else if(rhs->_secure < _secure)
- {
- return false;
- }
- else if(!_preferSecure && rhs->_preferSecure)
- {
- return true;
- }
- else if(rhs->_preferSecure < _preferSecure)
- {
- return false;
- }
- if(!_collocationOptimization && rhs->_collocationOptimization)
- {
- return true;
- }
- else if(rhs->_collocationOptimization < _collocationOptimization)
- {
- return false;
- }
- if(!_cacheConnection && rhs->_cacheConnection)
- {
- return true;
- }
- else if(rhs->_cacheConnection < _cacheConnection)
- {
- return false;
- }
- if(_endpointSelection < rhs->_endpointSelection)
- {
- return true;
- }
- else if(rhs->_endpointSelection < _endpointSelection)
- {
- return false;
- }
- if(_connectionId < rhs->_connectionId)
- {
- return true;
- }
- else if(rhs->_connectionId < _connectionId)
- {
- return false;
- }
- if(!_overrideCompress && rhs->_overrideCompress)
- {
- return true;
- }
- else if(rhs->_overrideCompress < _overrideCompress)
- {
- return false;
- }
- else if(_overrideCompress)
- {
- if(!_compress && rhs->_compress)
- {
- return true;
- }
- else if(rhs->_compress < _compress)
- {
- return false;
- }
- }
- if(!_overrideTimeout && rhs->_overrideTimeout)
- {
- return true;
- }
- else if(rhs->_overrideTimeout < _overrideTimeout)
- {
- return false;
- }
- else if(_overrideTimeout)
- {
- if(_timeout < rhs->_timeout)
- {
- return true;
- }
- else if(rhs->_timeout < _timeout)
- {
- return false;
- }
- }
+ assert(rhs);
+ if(!_secure && rhs->_secure)
+ {
+ return true;
+ }
+ else if(rhs->_secure < _secure)
+ {
+ return false;
+ }
+ else if(!_preferSecure && rhs->_preferSecure)
+ {
+ return true;
+ }
+ else if(rhs->_preferSecure < _preferSecure)
+ {
+ return false;
+ }
+ if(!_collocationOptimization && rhs->_collocationOptimization)
+ {
+ return true;
+ }
+ else if(rhs->_collocationOptimization < _collocationOptimization)
+ {
+ return false;
+ }
+ if(!_cacheConnection && rhs->_cacheConnection)
+ {
+ return true;
+ }
+ else if(rhs->_cacheConnection < _cacheConnection)
+ {
+ return false;
+ }
+ if(_endpointSelection < rhs->_endpointSelection)
+ {
+ return true;
+ }
+ else if(rhs->_endpointSelection < _endpointSelection)
+ {
+ return false;
+ }
+ if(_connectionId < rhs->_connectionId)
+ {
+ return true;
+ }
+ else if(rhs->_connectionId < _connectionId)
+ {
+ return false;
+ }
+ if(!_overrideCompress && rhs->_overrideCompress)
+ {
+ return true;
+ }
+ else if(rhs->_overrideCompress < _overrideCompress)
+ {
+ return false;
+ }
+ else if(_overrideCompress)
+ {
+ if(!_compress && rhs->_compress)
+ {
+ return true;
+ }
+ else if(rhs->_compress < _compress)
+ {
+ return false;
+ }
+ }
+ if(!_overrideTimeout && rhs->_overrideTimeout)
+ {
+ return true;
+ }
+ else if(rhs->_overrideTimeout < _overrideTimeout)
+ {
+ return false;
+ }
+ else if(_overrideTimeout)
+ {
+ if(_timeout < rhs->_timeout)
+ {
+ return true;
+ }
+ else if(rhs->_timeout < _timeout)
+ {
+ return false;
+ }
+ }
if(!_threadPerConnection && rhs->_threadPerConnection)
{
return true;
@@ -1097,15 +1097,15 @@ IceInternal::RoutableReference::operator<(const Reference& r) const
{
return false;
}
- return _routerInfo < rhs->_routerInfo;
+ return _routerInfo < rhs->_routerInfo;
}
return false;
}
IceInternal::RoutableReference::RoutableReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const SharedContextPtr& ctx, const string& fs,
- Mode md, bool sec, bool prefSec, const RouterInfoPtr& rtrInfo,
- bool collocationOpt, bool cacheConnection,
+ const Identity& ident, const SharedContextPtr& ctx, const string& fs,
+ Mode md, bool sec, bool prefSec, const RouterInfoPtr& rtrInfo,
+ bool collocationOpt, bool cacheConnection,
EndpointSelectionType endpointSelection, bool threadPerConnection) :
Reference(inst, com, ident, ctx, fs, md),
_secure(sec),
@@ -1148,36 +1148,36 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
// Filter out unknown endpoints.
//
endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::unknown)),
- endpoints.end());
+ endpoints.end());
//
// Filter out endpoints according to the mode of the reference.
//
switch(getMode())
{
- case Reference::ModeTwoway:
- case Reference::ModeOneway:
- case Reference::ModeBatchOneway:
- {
- //
- // Filter out datagram endpoints.
- //
+ case Reference::ModeTwoway:
+ case Reference::ModeOneway:
+ case Reference::ModeBatchOneway:
+ {
+ //
+ // Filter out datagram endpoints.
+ //
endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::datagram)),
endpoints.end());
- break;
- }
-
- case Reference::ModeDatagram:
- case Reference::ModeBatchDatagram:
- {
- //
- // Filter out non-datagram endpoints.
- //
+ break;
+ }
+
+ case Reference::ModeDatagram:
+ case Reference::ModeBatchDatagram:
+ {
+ //
+ // Filter out non-datagram endpoints.
+ //
endpoints.erase(remove_if(endpoints.begin(), endpoints.end(),
- not1(Ice::constMemFun(&EndpointI::datagram))),
+ not1(Ice::constMemFun(&EndpointI::datagram))),
endpoints.end());
- break;
- }
+ break;
+ }
}
//
@@ -1185,22 +1185,22 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
//
switch(getEndpointSelection())
{
- case Random:
- {
- RandomNumberGenerator rng;
- random_shuffle(endpoints.begin(), endpoints.end(), rng);
- break;
- }
- case Ordered:
- {
- // Nothing to do.
- break;
- }
- default:
- {
- assert(false);
- break;
- }
+ case Random:
+ {
+ RandomNumberGenerator rng;
+ random_shuffle(endpoints.begin(), endpoints.end(), rng);
+ break;
+ }
+ case Ordered:
+ {
+ // Nothing to do.
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
}
//
@@ -1212,33 +1212,33 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
DefaultsAndOverridesPtr overrides = getInstance()->defaultsAndOverrides();
if(overrides->overrideSecure ? overrides->overrideSecureValue : getSecure())
{
- endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure))),
- endpoints.end());
+ endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure))),
+ endpoints.end());
}
else if(getPreferSecure())
{
- //
- // We must use stable_partition() instead of just simply
- // partition(), because otherwise some STL implementations
- // order our now randomized endpoints.
- //
- stable_partition(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::secure));
+ //
+ // We must use stable_partition() instead of just simply
+ // partition(), because otherwise some STL implementations
+ // order our now randomized endpoints.
+ //
+ stable_partition(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::secure));
}
else
{
- //
- // We must use stable_partition() instead of just simply
- // partition(), because otherwise some STL implementations
- // order our now randomized endpoints.
- //
- stable_partition(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure)));
+ //
+ // We must use stable_partition() instead of just simply
+ // partition(), because otherwise some STL implementations
+ // order our now randomized endpoints.
+ //
+ stable_partition(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure)));
}
if(endpoints.empty())
{
NoEndpointException ex(__FILE__, __LINE__);
- ex.proxy = toString();
- throw ex;
+ ex.proxy = toString();
+ throw ex;
}
//
@@ -1247,42 +1247,42 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
if(getCacheConnection() || endpoints.size() == 1)
{
- //
- // Get an existing connection or create one if there's no
- // existing connection to one of the given endpoints.
- //
- return factory->create(endpoints, false, _threadPerConnection, comp);
+ //
+ // Get an existing connection or create one if there's no
+ // existing connection to one of the given endpoints.
+ //
+ return factory->create(endpoints, false, _threadPerConnection, comp);
}
else
{
- //
- // Go through the list of endpoints and try to create the
- // connection until it succeeds. This is different from just
- // calling create() with the given endpoints since this might
- // create a new connection even if there's an existing
- // connection for one of the endpoints.
- //
-
- auto_ptr<LocalException> exception;
- vector<EndpointIPtr> endpoint;
- endpoint.push_back(0);
-
- for(vector<EndpointIPtr>::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
- {
- try
- {
- endpoint.back() = *p;
- return factory->create(endpoint, p + 1 == endpoints.end(), _threadPerConnection, comp);
- }
- catch(const LocalException& ex)
- {
- exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
- }
- }
-
- assert(exception.get());
- exception->ice_throw();
- return 0; // Keeps the compiler happy.
+ //
+ // Go through the list of endpoints and try to create the
+ // connection until it succeeds. This is different from just
+ // calling create() with the given endpoints since this might
+ // create a new connection even if there's an existing
+ // connection for one of the endpoints.
+ //
+
+ auto_ptr<LocalException> exception;
+ vector<EndpointIPtr> endpoint;
+ endpoint.push_back(0);
+
+ for(vector<EndpointIPtr>::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
+ {
+ try
+ {
+ endpoint.back() = *p;
+ return factory->create(endpoint, p + 1 == endpoints.end(), _threadPerConnection, comp);
+ }
+ catch(const LocalException& ex)
+ {
+ exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+ }
+ }
+
+ assert(exception.get());
+ exception->ice_throw();
+ return 0; // Keeps the compiler happy.
}
}
@@ -1291,15 +1291,15 @@ IceInternal::RoutableReference::applyOverrides(vector<EndpointIPtr>& endpoints)
{
for(vector<EndpointIPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
- *p = (*p)->connectionId(_connectionId);
- if(_overrideCompress)
- {
- *p = (*p)->compress(_compress);
- }
- if(_overrideTimeout)
- {
- *p = (*p)->timeout(_timeout);
- }
+ *p = (*p)->connectionId(_connectionId);
+ if(_overrideCompress)
+ {
+ *p = (*p)->compress(_compress);
+ }
+ if(_overrideTimeout)
+ {
+ *p = (*p)->timeout(_timeout);
+ }
}
}
@@ -1307,9 +1307,9 @@ void IceInternal::incRef(IceInternal::DirectReference* p) { p->__incRef(); }
void IceInternal::decRef(IceInternal::DirectReference* p) { p->__decRef(); }
IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const SharedContextPtr& ctx, const string& fs,
- Mode md, bool sec, bool prefSec, const vector<EndpointIPtr>& endpts,
- const RouterInfoPtr& rtrInfo, bool collocationOpt, bool cacheConnection,
+ const Identity& ident, const SharedContextPtr& ctx, const string& fs,
+ Mode md, bool sec, bool prefSec, const vector<EndpointIPtr>& endpts,
+ const RouterInfoPtr& rtrInfo, bool collocationOpt, bool cacheConnection,
EndpointSelectionType endpointSelection, bool threadPerConnection) :
RoutableReference(inst, com, ident, ctx, fs, md, sec, prefSec, rtrInfo, collocationOpt, cacheConnection,
endpointSelection, threadPerConnection),
@@ -1353,12 +1353,12 @@ IceInternal::DirectReference::changeCompress(bool newCompress) const
DirectReferencePtr r = DirectReferencePtr::dynamicCast(RoutableReference::changeCompress(newCompress));
if(r.get() != this) // Also override the compress flag on the endpoints if it was updated.
{
- vector<EndpointIPtr> newEndpoints;
- for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- newEndpoints.push_back((*p)->compress(newCompress));
- }
- r->_endpoints = newEndpoints;
+ vector<EndpointIPtr> newEndpoints;
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ newEndpoints.push_back((*p)->compress(newCompress));
+ }
+ r->_endpoints = newEndpoints;
}
return r;
}
@@ -1369,12 +1369,12 @@ IceInternal::DirectReference::changeTimeout(int newTimeout) const
DirectReferencePtr r = DirectReferencePtr::dynamicCast(RoutableReference::changeTimeout(newTimeout));
if(r.get() != this) // Also override the timeout on the endpoints if it was updated.
{
- vector<EndpointIPtr> newEndpoints;
- for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- newEndpoints.push_back((*p)->timeout(newTimeout));
- }
- r->_endpoints = newEndpoints;
+ vector<EndpointIPtr> newEndpoints;
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ newEndpoints.push_back((*p)->timeout(newTimeout));
+ }
+ r->_endpoints = newEndpoints;
}
return r;
}
@@ -1385,12 +1385,12 @@ IceInternal::DirectReference::changeConnectionId(const string& newConnectionId)
DirectReferencePtr r = DirectReferencePtr::dynamicCast(RoutableReference::changeConnectionId(newConnectionId));
if(r.get() != this) // Also override the connection id on the endpoints if it was updated.
{
- vector<EndpointIPtr> newEndpoints;
- for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- newEndpoints.push_back((*p)->connectionId(newConnectionId));
- }
- r->_endpoints = newEndpoints;
+ vector<EndpointIPtr> newEndpoints;
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ newEndpoints.push_back((*p)->connectionId(newConnectionId));
+ }
+ r->_endpoints = newEndpoints;
}
return r;
}
@@ -1406,17 +1406,17 @@ IceInternal::DirectReference::changeAdapterId(const string& newAdapterId) const
{
if(!newAdapterId.empty())
{
- LocatorInfoPtr locatorInfo =
- getInstance()->locatorManager()->get(getInstance()->referenceFactory()->getDefaultLocator());
- return getInstance()->referenceFactory()->create(getIdentity(), getContext(), getFacet(), getMode(),
- getSecure(), getPreferSecure(), newAdapterId, getRouterInfo(),
- locatorInfo, getCollocationOptimization(),
+ LocatorInfoPtr locatorInfo =
+ getInstance()->locatorManager()->get(getInstance()->referenceFactory()->getDefaultLocator());
+ return getInstance()->referenceFactory()->create(getIdentity(), getContext(), getFacet(), getMode(),
+ getSecure(), getPreferSecure(), newAdapterId, getRouterInfo(),
+ locatorInfo, getCollocationOptimization(),
getCacheConnection(), getEndpointSelection(),
getThreadPerConnection(), getLocatorCacheTimeout());
}
else
{
- return DirectReferencePtr(const_cast<DirectReference*>(this));
+ return DirectReferencePtr(const_cast<DirectReference*>(this));
}
}
@@ -1425,7 +1425,7 @@ IceInternal::DirectReference::changeEndpoints(const vector<EndpointIPtr>& newEnd
{
if(newEndpoints == _endpoints)
{
- return DirectReferencePtr(const_cast<DirectReference*>(this));
+ return DirectReferencePtr(const_cast<DirectReference*>(this));
}
DirectReferencePtr r = DirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_endpoints = newEndpoints;
@@ -1442,14 +1442,14 @@ IceInternal::DirectReference::streamWrite(BasicStream* s) const
s->writeSize(sz);
if(sz)
{
- for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- (*p)->streamWrite(s);
- }
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ (*p)->streamWrite(s);
+ }
}
else
{
- s->write(string("")); // Adapter id.
+ s->write(string("")); // Adapter id.
}
}
@@ -1468,12 +1468,12 @@ IceInternal::DirectReference::toString() const
vector<EndpointIPtr>::const_iterator p;
for(p = _endpoints.begin(); p != _endpoints.end(); ++p)
{
- string endp = (*p)->toString();
- if(!endp.empty())
- {
- result.append(":");
- result.append(endp);
- }
+ string endp = (*p)->toString();
+ if(!endp.empty())
+ {
+ result.append(":");
+ result.append(endp);
+ }
}
return result;
}
@@ -1486,7 +1486,7 @@ IceInternal::DirectReference::getConnection(bool& comp) const
if(endpts.empty())
{
- endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
+ endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
}
ConnectionIPtr connection = createConnection(endpts, comp);
@@ -1540,8 +1540,8 @@ IceInternal::DirectReference::operator<(const Reference& r) const
if(RoutableReference::operator==(r))
{
const DirectReference* rhs = dynamic_cast<const DirectReference*>(&r);
- assert(rhs);
- return _endpoints < rhs->_endpoints;
+ assert(rhs);
+ return _endpoints < rhs->_endpoints;
}
return false;
}
@@ -1562,10 +1562,10 @@ void IceInternal::incRef(IceInternal::IndirectReference* p) { p->__incRef(); }
void IceInternal::decRef(IceInternal::IndirectReference* p) { p->__decRef(); }
IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const SharedContextPtr& ctx, const string& fs,
- Mode md, bool sec, bool prefSec, const string& adptid,
- const RouterInfoPtr& rtrInfo, const LocatorInfoPtr& locInfo,
- bool collocationOpt, bool cacheConnection,
+ const Identity& ident, const SharedContextPtr& ctx, const string& fs,
+ Mode md, bool sec, bool prefSec, const string& adptid,
+ const RouterInfoPtr& rtrInfo, const LocatorInfoPtr& locInfo,
+ bool collocationOpt, bool cacheConnection,
EndpointSelectionType endpointSelection, bool threadPerConnection,
int locatorCacheTimeout) :
RoutableReference(inst, com, ident, ctx, fs, md, sec, prefSec, rtrInfo, collocationOpt, cacheConnection,
@@ -1606,7 +1606,7 @@ IceInternal::IndirectReference::changeLocator(const LocatorPrx& newLocator) cons
LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator);
if(newLocatorInfo == _locatorInfo)
{
- return IndirectReferencePtr(const_cast<IndirectReference*>(this));
+ return IndirectReferencePtr(const_cast<IndirectReference*>(this));
}
IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_locatorInfo = newLocatorInfo;
@@ -1618,7 +1618,7 @@ IceInternal::IndirectReference::changeAdapterId(const string& newAdapterId) cons
{
if(newAdapterId == _adapterId)
{
- return IndirectReferencePtr(const_cast<IndirectReference*>(this));
+ return IndirectReferencePtr(const_cast<IndirectReference*>(this));
}
IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_adapterId = newAdapterId;
@@ -1630,14 +1630,14 @@ IceInternal::IndirectReference::changeEndpoints(const vector<EndpointIPtr>& newE
{
if(!newEndpoints.empty())
{
- return getInstance()->referenceFactory()->create(getIdentity(), getContext(), getFacet(), getMode(),
- getSecure(), getPreferSecure(), newEndpoints, getRouterInfo(),
- getCollocationOptimization(), getCacheConnection(),
+ return getInstance()->referenceFactory()->create(getIdentity(), getContext(), getFacet(), getMode(),
+ getSecure(), getPreferSecure(), newEndpoints, getRouterInfo(),
+ getCollocationOptimization(), getCacheConnection(),
getEndpointSelection(), getThreadPerConnection());
}
else
{
- return IndirectReferencePtr(const_cast<IndirectReference*>(this));
+ return IndirectReferencePtr(const_cast<IndirectReference*>(this));
}
}
@@ -1646,7 +1646,7 @@ IceInternal::IndirectReference::changeLocatorCacheTimeout(int timeout) const
{
if(timeout == _locatorCacheTimeout)
{
- return IndirectReferencePtr(const_cast<IndirectReference*>(this));
+ return IndirectReferencePtr(const_cast<IndirectReference*>(this));
}
IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_locatorCacheTimeout = timeout;
@@ -1690,18 +1690,18 @@ IceInternal::IndirectReference::toString() const
{
UTF8BufferI buffer;
Byte* last = getInstance()->initializationData().stringConverter->toUTF8(a.data(), a.data() + a.size(), buffer);
- a = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
+ a = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
}
a = IceUtil::escapeString(a, "");
if(a.find_first_of(" ") != string::npos)
{
- result.append("\"");
- result.append(a);
- result.append("\"");
+ result.append("\"");
+ result.append(a);
+ result.append("\"");
}
else
{
- result.append(_adapterId);
+ result.append(_adapterId);
}
return result;
}
@@ -1713,59 +1713,59 @@ IceInternal::IndirectReference::getConnection(bool& comp) const
while(true)
{
- vector<EndpointIPtr> endpts = RoutableReference::getRoutedEndpoints();
- bool cached = false;
- if(endpts.empty() && _locatorInfo)
- {
- const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
- endpts = _locatorInfo->getEndpoints(self, _locatorCacheTimeout, cached);
- }
-
- applyOverrides(endpts);
-
- try
- {
- connection = createConnection(endpts, comp);
- assert(connection);
- }
- catch(const NoEndpointException& ex)
- {
- throw ex; // No need to retry if there's no endpoints.
- }
- catch(const LocalException& ex)
- {
- if(!getRouterInfo())
- {
- assert(_locatorInfo);
-
- // COMPILERFIX: Braces needed to prevent BCB from causing Reference refCount from
- // being decremented twice when loop continues.
- {
- const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
- _locatorInfo->clearCache(self);
- }
-
- if(cached)
- {
- // COMPILERFIX: Braces needed to prevent BCB from causing TraceLevels refCount from
- // being decremented twice when loop continues.
- {
- TraceLevelsPtr traceLevels = getInstance()->traceLevels();
- if(traceLevels->retry >= 2)
- {
- Trace out(getInstance()->initializationData().logger, traceLevels->retryCat);
- out << "connection to cached endpoints failed\n"
- << "removing endpoints from cache and trying one more time\n" << ex;
- }
- }
- continue;
- }
- }
-
- throw;
- }
-
- break;
+ vector<EndpointIPtr> endpts = RoutableReference::getRoutedEndpoints();
+ bool cached = false;
+ if(endpts.empty() && _locatorInfo)
+ {
+ const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
+ endpts = _locatorInfo->getEndpoints(self, _locatorCacheTimeout, cached);
+ }
+
+ applyOverrides(endpts);
+
+ try
+ {
+ connection = createConnection(endpts, comp);
+ assert(connection);
+ }
+ catch(const NoEndpointException& ex)
+ {
+ throw ex; // No need to retry if there's no endpoints.
+ }
+ catch(const LocalException& ex)
+ {
+ if(!getRouterInfo())
+ {
+ assert(_locatorInfo);
+
+ // COMPILERFIX: Braces needed to prevent BCB from causing Reference refCount from
+ // being decremented twice when loop continues.
+ {
+ const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
+ _locatorInfo->clearCache(self);
+ }
+
+ if(cached)
+ {
+ // COMPILERFIX: Braces needed to prevent BCB from causing TraceLevels refCount from
+ // being decremented twice when loop continues.
+ {
+ TraceLevelsPtr traceLevels = getInstance()->traceLevels();
+ if(traceLevels->retry >= 2)
+ {
+ Trace out(getInstance()->initializationData().logger, traceLevels->retryCat);
+ out << "connection to cached endpoints failed\n"
+ << "removing endpoints from cache and trying one more time\n" << ex;
+ }
+ }
+ continue;
+ }
+ }
+
+ throw;
+ }
+
+ break;
}
//
@@ -1815,7 +1815,7 @@ IceInternal::IndirectReference::operator==(const Reference& r) const
}
return _adapterId == rhs->_adapterId && _locatorInfo == rhs->_locatorInfo &&
- _locatorCacheTimeout == rhs->_locatorCacheTimeout;
+ _locatorCacheTimeout == rhs->_locatorCacheTimeout;
}
bool
@@ -1838,26 +1838,26 @@ IceInternal::IndirectReference::operator<(const Reference& r) const
if(RoutableReference::operator==(r))
{
const IndirectReference* rhs = dynamic_cast<const IndirectReference*>(&r);
- assert(rhs);
- if(_adapterId < rhs->_adapterId)
- {
- return true;
- }
- else if(rhs->_adapterId < _adapterId)
- {
- return false;
- }
-
- if(_locatorInfo < rhs->_locatorInfo)
- {
- return true;
- }
- else if(rhs->_locatorInfo < _locatorInfo)
- {
- return false;
- }
-
- return _locatorCacheTimeout < rhs->_locatorCacheTimeout;
+ assert(rhs);
+ if(_adapterId < rhs->_adapterId)
+ {
+ return true;
+ }
+ else if(rhs->_adapterId < _adapterId)
+ {
+ return false;
+ }
+
+ if(_locatorInfo < rhs->_locatorInfo)
+ {
+ return true;
+ }
+ else if(rhs->_locatorInfo < _locatorInfo)
+ {
+ return false;
+ }
+
+ return _locatorCacheTimeout < rhs->_locatorCacheTimeout;
}
return false;
}
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index bd88dcc6826..4b9a07c259e 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -35,19 +35,19 @@ public:
enum Type
{
- TypeDirect,
- TypeIndirect,
- TypeFixed
+ TypeDirect,
+ TypeIndirect,
+ TypeFixed
};
enum Mode
{
- ModeTwoway,
- ModeOneway,
- ModeBatchOneway,
- ModeDatagram,
- ModeBatchDatagram,
- ModeLast = ModeBatchDatagram
+ ModeTwoway,
+ ModeOneway,
+ ModeBatchOneway,
+ ModeDatagram,
+ ModeBatchDatagram,
+ ModeLast = ModeBatchDatagram
};
Mode getMode() const { return _mode; }
@@ -125,7 +125,7 @@ public:
protected:
Reference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const SharedContextPtr&,
- const std::string&, Mode);
+ const std::string&, Mode);
Reference(const Reference&);
IceUtil::RecMutex _hashMutex; // For lazy initialization of hash value.
@@ -148,7 +148,7 @@ class FixedReference : public Reference
public:
FixedReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const SharedContextPtr&,
- const std::string&, Mode, const std::vector<Ice::ConnectionIPtr>&);
+ const std::string&, Mode, const std::vector<Ice::ConnectionIPtr>&);
const std::vector<Ice::ConnectionIPtr>& getFixedConnections() const;
@@ -238,7 +238,7 @@ public:
protected:
RoutableReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const SharedContextPtr&,
- const std::string&, Mode, bool, bool, const RouterInfoPtr&, bool, bool,
+ const std::string&, Mode, bool, bool, const RouterInfoPtr&, bool, bool,
Ice::EndpointSelectionType, bool);
RoutableReference(const RoutableReference&);
@@ -267,7 +267,7 @@ class DirectReference : public RoutableReference
public:
DirectReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const SharedContextPtr&,
- const std::string&, Mode, bool, bool, const std::vector<EndpointIPtr>&, const RouterInfoPtr&, bool,
+ const std::string&, Mode, bool, bool, const std::vector<EndpointIPtr>&, const RouterInfoPtr&, bool,
bool, Ice::EndpointSelectionType, bool);
virtual Type getType() const;
@@ -307,8 +307,8 @@ class IndirectReference : public RoutableReference
public:
IndirectReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const SharedContextPtr&,
- const std::string&, Mode, bool, bool, const std::string&, const RouterInfoPtr&,
- const LocatorInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool, int);
+ const std::string&, Mode, bool, bool, const std::string&, const RouterInfoPtr&,
+ const LocatorInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool, int);
virtual LocatorInfoPtr getLocatorInfo() const { return _locatorInfo; }
diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp
index 9e2105beaa7..13348367d9a 100644
--- a/cpp/src/Ice/ReferenceFactory.cpp
+++ b/cpp/src/Ice/ReferenceFactory.cpp
@@ -38,7 +38,7 @@ IceInternal::ReferenceFactory::copy(const Reference* r) const
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
const Ice::Identity& ident = r->getIdentity();
@@ -52,14 +52,14 @@ IceInternal::ReferenceFactory::copy(const Reference* r) const
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const SharedContextPtr& context,
- const string& facet,
- Reference::Mode mode,
- bool secure,
- bool preferSecure,
- const vector<EndpointIPtr>& endpoints,
- const RouterInfoPtr& routerInfo,
- bool collocationOptimization,
+ const SharedContextPtr& context,
+ const string& facet,
+ Reference::Mode mode,
+ bool secure,
+ bool preferSecure,
+ const vector<EndpointIPtr>& endpoints,
+ const RouterInfoPtr& routerInfo,
+ bool collocationOptimization,
bool cacheConnection,
EndpointSelectionType endpointSelection,
bool threadPerConnection)
@@ -68,7 +68,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -80,31 +80,31 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
// Create new reference
//
return new DirectReference(_instance, _communicator, ident, context, facet, mode, secure, preferSecure,
- endpoints, routerInfo, collocationOptimization, cacheConnection, endpointSelection,
+ endpoints, routerInfo, collocationOptimization, cacheConnection, endpointSelection,
threadPerConnection);
}
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const SharedContextPtr& context,
- const string& facet,
- Reference::Mode mode,
- bool secure,
- bool preferSecure,
- const string& adapterId,
- const RouterInfoPtr& routerInfo,
- const LocatorInfoPtr& locatorInfo,
- bool collocationOptimization,
+ const SharedContextPtr& context,
+ const string& facet,
+ Reference::Mode mode,
+ bool secure,
+ bool preferSecure,
+ const string& adapterId,
+ const RouterInfoPtr& routerInfo,
+ const LocatorInfoPtr& locatorInfo,
+ bool collocationOptimization,
bool cacheConnection,
EndpointSelectionType endpointSelection,
bool threadPerConnection,
- int locatorCacheTimeout)
+ int locatorCacheTimeout)
{
IceUtil::Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -116,22 +116,22 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
// Create new reference
//
return new IndirectReference(_instance, _communicator, ident, context, facet, mode, secure, preferSecure,
- adapterId, routerInfo, locatorInfo, collocationOptimization, cacheConnection,
+ adapterId, routerInfo, locatorInfo, collocationOptimization, cacheConnection,
endpointSelection, threadPerConnection, locatorCacheTimeout);
}
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const SharedContextPtr& context,
- const string& facet,
- Reference::Mode mode,
- const vector<Ice::ConnectionIPtr>& fixedConnections)
+ const SharedContextPtr& context,
+ const string& facet,
+ Reference::Mode mode,
+ const vector<Ice::ConnectionIPtr>& fixedConnections)
{
IceUtil::Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -162,9 +162,9 @@ IceInternal::ReferenceFactory::create(const string& str)
beg = s.find_first_not_of(delim, end);
if(beg == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
}
//
@@ -175,9 +175,9 @@ IceInternal::ReferenceFactory::create(const string& str)
end = IceUtil::checkQuote(s, beg);
if(end == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
}
else if(end == 0)
{
@@ -197,9 +197,9 @@ IceInternal::ReferenceFactory::create(const string& str)
if(beg == end)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
}
//
@@ -243,54 +243,54 @@ IceInternal::ReferenceFactory::create(const string& str)
while(true)
{
- beg = s.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
+ beg = s.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
if(s[beg] == ':' || s[beg] == '@')
{
break;
}
- end = s.find_first_of(delim + ":@", beg);
- if(end == string::npos)
- {
- end = s.length();
- }
-
- if(beg == end)
- {
- break;
- }
-
- string option = s.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
+ end = s.find_first_of(delim + ":@", beg);
+ if(end == string::npos)
+ {
+ end = s.length();
+ }
+
+ if(beg == end)
+ {
+ break;
+ }
+
+ string option = s.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
//
// Check for the presence of an option argument. The
// argument may be enclosed in single or double
// quotation marks.
//
- string argument;
- string::size_type argumentBeg = s.find_first_not_of(delim, end);
- if(argumentBeg != string::npos)
- {
+ string argument;
+ string::size_type argumentBeg = s.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos)
+ {
if(s[argumentBeg] != '@' && s[argumentBeg] != ':' && s[argumentBeg] != '-')
{
beg = argumentBeg;
end = IceUtil::checkQuote(s, beg);
if(end == string::npos)
{
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
}
else if(end == 0)
{
@@ -307,122 +307,122 @@ IceInternal::ReferenceFactory::create(const string& str)
argument = s.substr(beg, end - beg);
end++; // Skip trailing quote
}
- }
- }
-
- //
- // If any new options are added here,
- // IceInternal::Reference::toString() and its derived classes must be updated as well.
- //
- switch(option[1])
- {
- case 'f':
- {
- if(argument.empty())
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
-
- if(!IceUtil::unescapeString(argument, 0, argument.size(), facet))
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
-
- if(_instance->initializationData().stringConverter)
- {
- string tmpFacet;
- _instance->initializationData().stringConverter->fromUTF8(
- reinterpret_cast<const Byte*>(facet.data()),
- reinterpret_cast<const Byte*>(facet.data() + facet.size()), tmpFacet);
- facet = tmpFacet;
- }
-
- break;
- }
-
- case 't':
- {
- if(!argument.empty())
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- mode = Reference::ModeTwoway;
- break;
- }
-
- case 'o':
- {
- if(!argument.empty())
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- mode = Reference::ModeOneway;
- break;
- }
-
- case 'O':
- {
- if(!argument.empty())
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- mode = Reference::ModeBatchOneway;
- break;
- }
-
- case 'd':
- {
- if(!argument.empty())
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- mode = Reference::ModeDatagram;
- break;
- }
-
- case 'D':
- {
- if(!argument.empty())
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- mode = Reference::ModeBatchDatagram;
- break;
- }
-
- case 's':
- {
- if(!argument.empty())
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- secure = true;
- break;
- }
-
- default:
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- }
+ }
+ }
+
+ //
+ // If any new options are added here,
+ // IceInternal::Reference::toString() and its derived classes must be updated as well.
+ //
+ switch(option[1])
+ {
+ case 'f':
+ {
+ if(argument.empty())
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+
+ if(!IceUtil::unescapeString(argument, 0, argument.size(), facet))
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+
+ if(_instance->initializationData().stringConverter)
+ {
+ string tmpFacet;
+ _instance->initializationData().stringConverter->fromUTF8(
+ reinterpret_cast<const Byte*>(facet.data()),
+ reinterpret_cast<const Byte*>(facet.data() + facet.size()), tmpFacet);
+ facet = tmpFacet;
+ }
+
+ break;
+ }
+
+ case 't':
+ {
+ if(!argument.empty())
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ mode = Reference::ModeTwoway;
+ break;
+ }
+
+ case 'o':
+ {
+ if(!argument.empty())
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ mode = Reference::ModeOneway;
+ break;
+ }
+
+ case 'O':
+ {
+ if(!argument.empty())
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ mode = Reference::ModeBatchOneway;
+ break;
+ }
+
+ case 'd':
+ {
+ if(!argument.empty())
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ mode = Reference::ModeDatagram;
+ break;
+ }
+
+ case 'D':
+ {
+ if(!argument.empty())
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ mode = Reference::ModeBatchDatagram;
+ break;
+ }
+
+ case 's':
+ {
+ if(!argument.empty())
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ secure = true;
+ break;
+ }
+
+ default:
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ }
}
RouterInfoPtr routerInfo = _instance->routerManager()->get(getDefaultRouter());
@@ -430,9 +430,9 @@ IceInternal::ReferenceFactory::create(const string& str)
if(beg == string::npos)
{
- return create(ident, _instance->getDefaultContext(), facet, mode, secure,
- _instance->defaultsAndOverrides()->defaultPreferSecure, "", routerInfo,
- locatorInfo, _instance->defaultsAndOverrides()->defaultCollocationOptimization,
+ return create(ident, _instance->getDefaultContext(), facet, mode, secure,
+ _instance->defaultsAndOverrides()->defaultPreferSecure, "", routerInfo,
+ locatorInfo, _instance->defaultsAndOverrides()->defaultCollocationOptimization,
true, _instance->defaultsAndOverrides()->defaultEndpointSelection,
_instance->threadPerConnection(), _instance->defaultsAndOverrides()->defaultLocatorCacheTimeout);
}
@@ -441,118 +441,118 @@ IceInternal::ReferenceFactory::create(const string& str)
switch(s[beg])
{
- case ':':
- {
- vector<string> unknownEndpoints;
- end = beg;
-
- while(end < s.length() && s[end] == ':')
- {
- beg = end + 1;
-
- end = s.find(':', beg);
- if(end == string::npos)
- {
- end = s.length();
- }
-
- string es = s.substr(beg, end - beg);
- EndpointIPtr endp = _instance->endpointFactoryManager()->create(es);
- if(endp != 0)
- {
- vector<EndpointIPtr> endps = endp->expand(false);
- endpoints.insert(endpoints.end(), endps.begin(), endps.end());
- }
- else
- {
- unknownEndpoints.push_back(es);
- }
- }
- if(endpoints.size() == 0)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = unknownEndpoints.front();
- throw ex;
- }
- else if(unknownEndpoints.size() != 0 &&
- _instance->initializationData().properties->
- getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
- {
- Warning out(_instance->initializationData().logger);
- out << "Proxy contains unknown endpoints:";
- for(unsigned int idx = 0; idx < unknownEndpoints.size(); ++idx)
- {
- out << " `" << unknownEndpoints[idx] << "'";
- }
- }
-
- return create(ident, _instance->getDefaultContext(), facet, mode, secure,
- _instance->defaultsAndOverrides()->defaultPreferSecure, endpoints, routerInfo,
- _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
+ case ':':
+ {
+ vector<string> unknownEndpoints;
+ end = beg;
+
+ while(end < s.length() && s[end] == ':')
+ {
+ beg = end + 1;
+
+ end = s.find(':', beg);
+ if(end == string::npos)
+ {
+ end = s.length();
+ }
+
+ string es = s.substr(beg, end - beg);
+ EndpointIPtr endp = _instance->endpointFactoryManager()->create(es);
+ if(endp != 0)
+ {
+ vector<EndpointIPtr> endps = endp->expand(false);
+ endpoints.insert(endpoints.end(), endps.begin(), endps.end());
+ }
+ else
+ {
+ unknownEndpoints.push_back(es);
+ }
+ }
+ if(endpoints.size() == 0)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = unknownEndpoints.front();
+ throw ex;
+ }
+ else if(unknownEndpoints.size() != 0 &&
+ _instance->initializationData().properties->
+ getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "Proxy contains unknown endpoints:";
+ for(unsigned int idx = 0; idx < unknownEndpoints.size(); ++idx)
+ {
+ out << " `" << unknownEndpoints[idx] << "'";
+ }
+ }
+
+ return create(ident, _instance->getDefaultContext(), facet, mode, secure,
+ _instance->defaultsAndOverrides()->defaultPreferSecure, endpoints, routerInfo,
+ _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
_instance->defaultsAndOverrides()->defaultEndpointSelection,
_instance->threadPerConnection());
- break;
- }
- case '@':
- {
- beg = s.find_first_not_of(delim, beg + 1);
- if(beg == string::npos)
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
-
- end = IceUtil::checkQuote(s, beg);
- if(end == string::npos)
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
- else if(end == 0)
- {
- end = s.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = s.size();
- }
- }
- else
- {
- beg++; // Skip leading quote
- }
-
-
- if(!IceUtil::unescapeString(s, beg, end, adapter) || adapter.size() == 0)
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
+ break;
+ }
+ case '@':
+ {
+ beg = s.find_first_not_of(delim, beg + 1);
+ if(beg == string::npos)
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+
+ end = IceUtil::checkQuote(s, beg);
+ if(end == string::npos)
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
+ else if(end == 0)
+ {
+ end = s.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = s.size();
+ }
+ }
+ else
+ {
+ beg++; // Skip leading quote
+ }
+
+
+ if(!IceUtil::unescapeString(s, beg, end, adapter) || adapter.size() == 0)
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
if(_instance->initializationData().stringConverter)
{
- string tmpAdapter;
+ string tmpAdapter;
_instance->initializationData().stringConverter->fromUTF8(
- reinterpret_cast<const Byte*>(adapter.data()),
- reinterpret_cast<const Byte*>(adapter.data() + adapter.size()), tmpAdapter);
- adapter = tmpAdapter;
+ reinterpret_cast<const Byte*>(adapter.data()),
+ reinterpret_cast<const Byte*>(adapter.data() + adapter.size()), tmpAdapter);
+ adapter = tmpAdapter;
}
-
- return create(ident, _instance->getDefaultContext(), facet, mode, secure,
- _instance->defaultsAndOverrides()->defaultPreferSecure, adapter, routerInfo, locatorInfo,
- _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
+
+ return create(ident, _instance->getDefaultContext(), facet, mode, secure,
+ _instance->defaultsAndOverrides()->defaultPreferSecure, adapter, routerInfo, locatorInfo,
+ _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
_instance->defaultsAndOverrides()->defaultEndpointSelection, _instance->threadPerConnection(),
- _instance->defaultsAndOverrides()->defaultLocatorCacheTimeout);
- break;
- }
- default:
- {
- ProxyParseException ex(__FILE__, __LINE__);
- ex.str = str;
- throw ex;
- }
+ _instance->defaultsAndOverrides()->defaultLocatorCacheTimeout);
+ break;
+ }
+ default:
+ {
+ ProxyParseException ex(__FILE__, __LINE__);
+ ex.str = str;
+ throw ex;
+ }
}
return 0; // Unreachable, prevents compiler warning.
@@ -573,7 +573,7 @@ IceInternal::ReferenceFactory::createFromProperties(const string& propertyPrefix
if(!properties->getProperty(property).empty())
{
ref = ref->changeLocator(
- LocatorPrx::uncheckedCast(_communicator->propertyToProxy(property)));
+ LocatorPrx::uncheckedCast(_communicator->propertyToProxy(property)));
}
property = propertyPrefix + ".LocatorCacheTimeout";
@@ -586,7 +586,7 @@ IceInternal::ReferenceFactory::createFromProperties(const string& propertyPrefix
if(!properties->getProperty(property).empty())
{
ref = ref->changeRouter(
- RouterPrx::uncheckedCast(_communicator->propertyToProxy(property)));
+ RouterPrx::uncheckedCast(_communicator->propertyToProxy(property)));
}
property = propertyPrefix + ".PreferSecure";
@@ -606,19 +606,19 @@ IceInternal::ReferenceFactory::createFromProperties(const string& propertyPrefix
{
string type = properties->getProperty(property);
if(type == "Random")
- {
- ref = ref->changeEndpointSelection(Random);
- }
- else if(type == "Ordered")
- {
- ref = ref->changeEndpointSelection(Ordered);
- }
- else
- {
- EndpointSelectionTypeParseException ex(__FILE__, __LINE__);
- ex.str = type;
- throw ex;
- }
+ {
+ ref = ref->changeEndpointSelection(Random);
+ }
+ else if(type == "Ordered")
+ {
+ ref = ref->changeEndpointSelection(Ordered);
+ }
+ else
+ {
+ EndpointSelectionTypeParseException ex(__FILE__, __LINE__);
+ ex.str = type;
+ throw ex;
+ }
}
property = propertyPrefix + ".CollocationOptimization";
@@ -646,7 +646,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
if(ident.name.empty() && ident.category.empty())
{
- return 0;
+ return 0;
}
//
@@ -657,10 +657,10 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
string facet;
if(!facetPath.empty())
{
- if(facetPath.size() > 1)
- {
- throw ProxyUnmarshalException(__FILE__, __LINE__);
- }
+ if(facetPath.size() > 1)
+ {
+ throw ProxyUnmarshalException(__FILE__, __LINE__);
+ }
facet.swap(facetPath[0]);
}
@@ -669,7 +669,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
Reference::Mode mode = static_cast<Reference::Mode>(modeAsByte);
if(mode < 0 || mode > Reference::ModeLast)
{
- throw ProxyUnmarshalException(__FILE__, __LINE__);
+ throw ProxyUnmarshalException(__FILE__, __LINE__);
}
bool secure;
@@ -686,25 +686,25 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
if(sz > 0)
{
- endpoints.reserve(sz);
- while(sz--)
- {
- EndpointIPtr endpoint = _instance->endpointFactoryManager()->read(s);
- endpoints.push_back(endpoint);
- }
- return create(ident, _instance->getDefaultContext(), facet, mode, secure,
- _instance->defaultsAndOverrides()->defaultPreferSecure, endpoints, routerInfo,
- _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
- _instance->defaultsAndOverrides()->defaultEndpointSelection, _instance->threadPerConnection());
+ endpoints.reserve(sz);
+ while(sz--)
+ {
+ EndpointIPtr endpoint = _instance->endpointFactoryManager()->read(s);
+ endpoints.push_back(endpoint);
+ }
+ return create(ident, _instance->getDefaultContext(), facet, mode, secure,
+ _instance->defaultsAndOverrides()->defaultPreferSecure, endpoints, routerInfo,
+ _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
+ _instance->defaultsAndOverrides()->defaultEndpointSelection, _instance->threadPerConnection());
}
else
{
- s->read(adapterId);
- return create(ident, _instance->getDefaultContext(), facet, mode, secure,
- _instance->defaultsAndOverrides()->defaultPreferSecure, adapterId, routerInfo, locatorInfo,
- _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
- _instance->defaultsAndOverrides()->defaultEndpointSelection, _instance->threadPerConnection(),
- _instance->defaultsAndOverrides()->defaultLocatorCacheTimeout);
+ s->read(adapterId);
+ return create(ident, _instance->getDefaultContext(), facet, mode, secure,
+ _instance->defaultsAndOverrides()->defaultPreferSecure, adapterId, routerInfo, locatorInfo,
+ _instance->defaultsAndOverrides()->defaultCollocationOptimization, true,
+ _instance->defaultsAndOverrides()->defaultEndpointSelection, _instance->threadPerConnection(),
+ _instance->defaultsAndOverrides()->defaultLocatorCacheTimeout);
}
}
@@ -749,7 +749,7 @@ IceInternal::ReferenceFactory::destroy()
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
_instance = 0;
diff --git a/cpp/src/Ice/ReferenceFactory.h b/cpp/src/Ice/ReferenceFactory.h
index cea63de6757..e687c956255 100644
--- a/cpp/src/Ice/ReferenceFactory.h
+++ b/cpp/src/Ice/ReferenceFactory.h
@@ -32,19 +32,19 @@ public:
// Create a direct reference.
//
ReferencePtr create(const ::Ice::Identity&, const SharedContextPtr&, const ::std::string&,
- Reference::Mode, bool, bool, const ::std::vector<EndpointIPtr>&,
- const RouterInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool);
+ Reference::Mode, bool, bool, const ::std::vector<EndpointIPtr>&,
+ const RouterInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool);
//
// Create an indirect reference.
//
ReferencePtr create(const ::Ice::Identity&, const SharedContextPtr&, const ::std::string&,
- Reference::Mode, bool, bool, const ::std::string&,
- const RouterInfoPtr&, const LocatorInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool, int);
+ Reference::Mode, bool, bool, const ::std::string&,
+ const RouterInfoPtr&, const LocatorInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool, int);
//
// Create a fixed reference.
//
ReferencePtr create(const ::Ice::Identity&, const SharedContextPtr&, const ::std::string&,
- Reference::Mode, const ::std::vector< ::Ice::ConnectionIPtr>&);
+ Reference::Mode, const ::std::vector< ::Ice::ConnectionIPtr>&);
//
// Create a reference from a string.
diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp
index d5294304d2c..8eb60be1bdd 100644
--- a/cpp/src/Ice/RouterInfo.cpp
+++ b/cpp/src/Ice/RouterInfo.cpp
@@ -45,7 +45,7 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
{
if(!rtr)
{
- return 0;
+ return 0;
}
RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
@@ -56,24 +56,24 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
if(_tableHint != _table.end())
{
- if(_tableHint->first == router)
- {
- p = _tableHint;
- }
+ if(_tableHint->first == router)
+ {
+ p = _tableHint;
+ }
}
if(p == _table.end())
{
- p = _table.find(router);
+ p = _table.find(router);
}
if(p == _table.end())
{
- _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router)));
+ _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router)));
}
else
{
- _tableHint = p;
+ _tableHint = p;
}
return _tableHint->second;
@@ -85,26 +85,26 @@ IceInternal::RouterManager::erase(const RouterPrx& rtr)
RouterInfoPtr info;
if(rtr)
{
- RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
- IceUtil::Mutex::Lock sync(*this);
-
- map<RouterPrx, RouterInfoPtr>::iterator p = _table.end();
- if(_tableHint != _table.end() && _tableHint->first == router)
- {
- p = _tableHint;
- _tableHint = _table.end();
- }
-
- if(p == _table.end())
- {
- p = _table.find(router);
- }
-
- if(p != _table.end())
- {
- info = p->second;
- _table.erase(p);
- }
+ RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
+ IceUtil::Mutex::Lock sync(*this);
+
+ map<RouterPrx, RouterInfoPtr>::iterator p = _table.end();
+ if(_tableHint != _table.end() && _tableHint->first == router)
+ {
+ p = _tableHint;
+ _tableHint = _table.end();
+ }
+
+ if(p == _table.end())
+ {
+ p = _table.find(router);
+ }
+
+ if(p != _table.end())
+ {
+ info = p->second;
+ _table.erase(p);
+ }
}
return info;
@@ -161,34 +161,34 @@ IceInternal::RouterInfo::getClientEndpoints()
if(_clientEndpoints.size() == 0) // Lazy initialization.
{
- ObjectPrx clientProxy = _router->getClientProxy();
- if(!clientProxy)
- {
- //
- // If getClientProxy() return nil, use router endpoints.
- //
- _clientEndpoints = _router->__reference()->getEndpoints();
- }
- else
- {
- clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed.
-
- //
- // In order to avoid creating a new connection to the router,
- // we must use the same timeout as the already existing
- // connection.
- //
- try
- {
- clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
- }
- catch(const Ice::CollocationOptimizationException&)
- {
- // Ignore - collocated router
- }
-
- _clientEndpoints = clientProxy->__reference()->getEndpoints();
- }
+ ObjectPrx clientProxy = _router->getClientProxy();
+ if(!clientProxy)
+ {
+ //
+ // If getClientProxy() return nil, use router endpoints.
+ //
+ _clientEndpoints = _router->__reference()->getEndpoints();
+ }
+ else
+ {
+ clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed.
+
+ //
+ // In order to avoid creating a new connection to the router,
+ // we must use the same timeout as the already existing
+ // connection.
+ //
+ try
+ {
+ clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
+ }
+ catch(const Ice::CollocationOptimizationException&)
+ {
+ // Ignore - collocated router
+ }
+
+ _clientEndpoints = clientProxy->__reference()->getEndpoints();
+ }
}
return _clientEndpoints;
@@ -201,15 +201,15 @@ IceInternal::RouterInfo::getServerEndpoints()
if(_serverEndpoints.size() == 0) // Lazy initialization.
{
- ObjectPrx serverProxy = _router->getServerProxy();
- if(!serverProxy)
- {
- throw NoEndpointException(__FILE__, __LINE__);
- }
+ ObjectPrx serverProxy = _router->getServerProxy();
+ if(!serverProxy)
+ {
+ throw NoEndpointException(__FILE__, __LINE__);
+ }
- serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed.
+ serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed.
- _serverEndpoints = serverProxy->__reference()->getEndpoints();
+ _serverEndpoints = serverProxy->__reference()->getEndpoints();
}
return _serverEndpoints;
@@ -226,25 +226,25 @@ IceInternal::RouterInfo::addProxy(const ObjectPrx& proxy)
if(p == _identities.end())
{
- //
- // Only add the proxy to the router if it's not already in our local map.
- //
- ObjectProxySeq proxies;
- proxies.push_back(proxy);
- ObjectProxySeq evictedProxies = _router->addProxies(proxies);
-
- //
- // If we successfully added the proxy to the router, we add it to our local map.
- //
- _identities.insert(_identities.begin(), proxy->ice_getIdentity());
-
- //
- // We also must remove whatever proxies the router evicted.
- //
- for(ObjectProxySeq::iterator q = evictedProxies.begin(); q != evictedProxies.end(); ++q)
- {
- _identities.erase((*q)->ice_getIdentity());
- }
+ //
+ // Only add the proxy to the router if it's not already in our local map.
+ //
+ ObjectProxySeq proxies;
+ proxies.push_back(proxy);
+ ObjectProxySeq evictedProxies = _router->addProxies(proxies);
+
+ //
+ // If we successfully added the proxy to the router, we add it to our local map.
+ //
+ _identities.insert(_identities.begin(), proxy->ice_getIdentity());
+
+ //
+ // We also must remove whatever proxies the router evicted.
+ //
+ for(ObjectProxySeq::iterator q = evictedProxies.begin(); q != evictedProxies.end(); ++q)
+ {
+ _identities.erase((*q)->ice_getIdentity());
+ }
}
}
diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp
index 4f2ad489d1e..0a9a6d010ce 100644
--- a/cpp/src/Ice/ServantManager.cpp
+++ b/cpp/src/Ice/ServantManager.cpp
@@ -35,26 +35,26 @@ IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity&
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end())
{
- p = _servantMapMap.insert(_servantMapMapHint, pair<const Identity, FacetMap>(ident, FacetMap()));
+ p = _servantMapMap.insert(_servantMapMapHint, pair<const Identity, FacetMap>(ident, FacetMap()));
}
else
{
- if(p->second.find(facet) != p->second.end())
- {
- AlreadyRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
- }
+ if(p->second.find(facet) != p->second.end())
+ {
+ AlreadyRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
+ }
}
_servantMapMapHint = p;
@@ -81,19 +81,19 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string&
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end() || (q = p->second.find(facet)) == p->second.end())
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
}
servant = q->second;
@@ -101,15 +101,15 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string&
if(p->second.empty())
{
- if(p == _servantMapMapHint)
- {
- _servantMapMap.erase(p++);
- _servantMapMapHint = p;
- }
- else
- {
- _servantMapMap.erase(p);
- }
+ if(p == _servantMapMapHint)
+ {
+ _servantMapMap.erase(p++);
+ _servantMapMapHint = p;
+ }
+ else
+ {
+ _servantMapMap.erase(p);
+ }
}
return servant;
}
@@ -125,27 +125,27 @@ IceInternal::ServantManager::removeAllFacets(const Identity& ident)
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end())
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ throw ex;
}
FacetMap result = p->second;
if(p == _servantMapMapHint)
{
- _servantMapMap.erase(p++);
- _servantMapMapHint = p;
+ _servantMapMap.erase(p++);
+ _servantMapMapHint = p;
}
else
{
- _servantMapMap.erase(p);
+ _servantMapMap.erase(p);
}
return result;
@@ -171,17 +171,17 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end() || (q = p->second.find(facet)) == p->second.end())
{
- return 0;
+ return 0;
}
else
{
- _servantMapMapHint = p;
- return q->second;
+ _servantMapMapHint = p;
+ return q->second;
}
}
@@ -198,17 +198,17 @@ IceInternal::ServantManager::findAllFacets(const Identity& ident) const
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end())
{
- return FacetMap();
+ return FacetMap();
}
else
{
- _servantMapMapHint = p;
- return p->second;
+ _servantMapMapHint = p;
+ return p->second;
}
}
@@ -230,18 +230,18 @@ IceInternal::ServantManager::hasServant(const Identity& ident) const
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end())
{
- return false;
+ return false;
}
else
{
- _servantMapMapHint = p;
- assert(!p->second.empty());
- return true;
+ _servantMapMapHint = p;
+ assert(!p->second.empty());
+ return true;
}
}
@@ -255,10 +255,10 @@ IceInternal::ServantManager::addServantLocator(const ServantLocatorPtr& locator,
if((_locatorMapHint != _locatorMap.end() && _locatorMapHint->first == category)
|| _locatorMap.find(category) != _locatorMap.end())
{
- AlreadyRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant locator";
- ex.id = IceUtil::escapeString(category, "");
- throw ex;
+ AlreadyRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant locator";
+ ex.id = IceUtil::escapeString(category, "");
+ throw ex;
}
_locatorMapHint = _locatorMap.insert(_locatorMapHint, pair<const string, ServantLocatorPtr>(category, locator));
@@ -278,30 +278,30 @@ IceInternal::ServantManager::findServantLocator(const string& category) const
//assert(_instance); // Must not be called after destruction.
map<string, ServantLocatorPtr>& locatorMap =
- const_cast<map<string, ServantLocatorPtr>&>(_locatorMap);
+ const_cast<map<string, ServantLocatorPtr>&>(_locatorMap);
map<string, ServantLocatorPtr>::iterator p = locatorMap.end();
if(_locatorMapHint != locatorMap.end())
{
- if(_locatorMapHint->first == category)
- {
- p = _locatorMapHint;
- }
+ if(_locatorMapHint->first == category)
+ {
+ p = _locatorMapHint;
+ }
}
if(p == locatorMap.end())
{
- p = locatorMap.find(category);
+ p = locatorMap.find(category);
}
if(p != locatorMap.end())
{
- _locatorMapHint = p;
- return p->second;
+ _locatorMapHint = p;
+ return p->second;
}
else
{
- return 0;
+ return 0;
}
}
@@ -330,40 +330,40 @@ IceInternal::ServantManager::destroy()
map<string, ServantLocatorPtr> locatorMap;
{
- IceUtil::Mutex::Lock sync(*this);
-
- assert(_instance); // Must not be called after destruction.
-
- servantMapMap.swap(_servantMapMap);
- _servantMapMapHint = _servantMapMap.end();
-
- for(map<string, ServantLocatorPtr>::const_iterator p = _locatorMap.begin(); p != _locatorMap.end(); ++p)
- {
- try
- {
- p->second->deactivate(p->first);
- }
- catch(const Exception& ex)
- {
- Error out(_instance->initializationData().logger);
- out << "exception during locator deactivation:\n"
- << "object adapter: `" << _adapterName << "'\n"
- << "locator category: `" << p->first << "'\n"
- << ex;
- }
- catch(...)
- {
- Error out(_instance->initializationData().logger);
- out << "unknown exception during locator deactivation:\n"
- << "object adapter: `" << _adapterName << "'\n"
- << "locator category: `" << p->first << "'";
- }
- }
-
- locatorMap.swap(_locatorMap);
- _locatorMapHint = _locatorMap.end();
-
- _instance = 0;
+ IceUtil::Mutex::Lock sync(*this);
+
+ assert(_instance); // Must not be called after destruction.
+
+ servantMapMap.swap(_servantMapMap);
+ _servantMapMapHint = _servantMapMap.end();
+
+ for(map<string, ServantLocatorPtr>::const_iterator p = _locatorMap.begin(); p != _locatorMap.end(); ++p)
+ {
+ try
+ {
+ p->second->deactivate(p->first);
+ }
+ catch(const Exception& ex)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "exception during locator deactivation:\n"
+ << "object adapter: `" << _adapterName << "'\n"
+ << "locator category: `" << p->first << "'\n"
+ << ex;
+ }
+ catch(...)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "unknown exception during locator deactivation:\n"
+ << "object adapter: `" << _adapterName << "'\n"
+ << "locator category: `" << p->first << "'";
+ }
+ }
+
+ locatorMap.swap(_locatorMap);
+ _locatorMapHint = _locatorMap.end();
+
+ _instance = 0;
}
//
diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp
index 21f6a579eb5..d4232d2aefe 100755
--- a/cpp/src/Ice/Service.cpp
+++ b/cpp/src/Ice/Service.cpp
@@ -107,19 +107,19 @@ private:
{
public:
- StatusThread(ServiceStatusManager* manager) :
- _manager(manager)
- {
- }
+ StatusThread(ServiceStatusManager* manager) :
+ _manager(manager)
+ {
+ }
- virtual void run()
- {
- _manager->run();
- }
+ virtual void run()
+ {
+ _manager->run();
+ }
private:
- ServiceStatusManager* _manager;
+ ServiceStatusManager* _manager;
};
friend class StatusThread;
@@ -159,26 +159,26 @@ Ice::Service::shutdown()
{
if(_communicator)
{
- try
- {
- _communicator->shutdown();
- }
- catch(const CommunicatorDestroyedException&)
- {
- //
- // Expected if the service communicator is being destroyed.
- //
- }
- catch(const Ice::Exception& ex)
- {
- ostringstream ostr;
- ostr << "exception during shutdown:\n" << ex;
- warning(ostr.str());
- }
- catch(...)
- {
- warning("unknown exception during shutdown");
- }
+ try
+ {
+ _communicator->shutdown();
+ }
+ catch(const CommunicatorDestroyedException&)
+ {
+ //
+ // Expected if the service communicator is being destroyed.
+ //
+ }
+ catch(const Ice::Exception& ex)
+ {
+ ostringstream ostr;
+ ostr << "exception during shutdown:\n" << ex;
+ warning(ostr.str());
+ }
+ catch(...)
+ {
+ warning("unknown exception during shutdown");
+ }
}
return true;
}
@@ -204,48 +204,48 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initData)
{
if(strcmp(argv[idx], "--service") == 0)
{
- //
- // When running as a service, we need a logger to use for reporting any
- // failures that occur prior to initializing a communicator. After we have
- // a communicator, we can use the configured logger instead. If a logger
- // is defined in InitializationData, we'll use that. Otherwise, we create
- // a temporary event logger.
- //
- // We postpone the initialization of the communicator until serviceMain so
- // that we can incorporate the executable's arguments and the service's
- // arguments into one vector.
- //
- _logger = initData.logger;
- if(!_logger)
- {
- try
- {
- //
- // Use the executable name as the source for the temporary logger.
- //
- string loggerName = _name;
- transform(loggerName.begin(), loggerName.end(), loggerName.begin(), ::tolower);
- string::size_type pos = loggerName.find_last_of("\\/");
- if(pos != string::npos)
- {
- loggerName.erase(0, pos + 1); // Remove leading path.
- }
- pos = loggerName.rfind(".exe");
- if(pos != string::npos)
- {
- loggerName.erase(pos, loggerName.size() - pos); // Remove .exe extension.
- }
-
- _logger = new EventLoggerI(loggerName);
- }
- catch(const IceUtil::Exception& ex)
- {
- ostringstream ostr;
- ostr << ex;
- error("unable to create EventLogger:\n" + ostr.str());
- return EXIT_FAILURE;
- }
- }
+ //
+ // When running as a service, we need a logger to use for reporting any
+ // failures that occur prior to initializing a communicator. After we have
+ // a communicator, we can use the configured logger instead. If a logger
+ // is defined in InitializationData, we'll use that. Otherwise, we create
+ // a temporary event logger.
+ //
+ // We postpone the initialization of the communicator until serviceMain so
+ // that we can incorporate the executable's arguments and the service's
+ // arguments into one vector.
+ //
+ _logger = initData.logger;
+ if(!_logger)
+ {
+ try
+ {
+ //
+ // Use the executable name as the source for the temporary logger.
+ //
+ string loggerName = _name;
+ transform(loggerName.begin(), loggerName.end(), loggerName.begin(), ::tolower);
+ string::size_type pos = loggerName.find_last_of("\\/");
+ if(pos != string::npos)
+ {
+ loggerName.erase(0, pos + 1); // Remove leading path.
+ }
+ pos = loggerName.rfind(".exe");
+ if(pos != string::npos)
+ {
+ loggerName.erase(pos, loggerName.size() - pos); // Remove .exe extension.
+ }
+
+ _logger = new EventLoggerI(loggerName);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ ostringstream ostr;
+ ostr << ex;
+ error("unable to create EventLogger:\n" + ostr.str());
+ return EXIT_FAILURE;
+ }
+ }
if(idx + 1 >= argc)
{
@@ -439,17 +439,17 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initData)
changeDirectory = false;
}
- else if(strcmp(argv[idx], "--pidfile") == 0)
+ else if(strcmp(argv[idx], "--pidfile") == 0)
{
- if(idx + 1 < argc)
- {
- pidFile = argv[idx + 1];
- }
- else
- {
- cerr << argv[0] << ": --pidfile must be followed by an argument" << endl;
- return EXIT_FAILURE;
- }
+ if(idx + 1 < argc)
+ {
+ pidFile = argv[idx + 1];
+ }
+ else
+ {
+ cerr << argv[0] << ": --pidfile must be followed by an argument" << endl;
+ return EXIT_FAILURE;
+ }
for(int i = idx; i + 2 < argc; ++i)
{
@@ -835,8 +835,8 @@ Ice::Service::startService(const string& name, const vector<string>& args)
}
else
{
- showServiceStatus("Service failed to start.", status);
- return EXIT_FAILURE;
+ showServiceStatus("Service failed to start.", status);
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
@@ -893,8 +893,8 @@ Ice::Service::stopService(const string& name)
}
else
{
- showServiceStatus("Service failed to stop.", status);
- return EXIT_FAILURE;
+ showServiceStatus("Service failed to stop.", status);
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
@@ -1137,11 +1137,11 @@ Ice::Service::terminateService(DWORD exitCode)
status.dwControlsAccepted = 0;
if(exitCode != 0)
{
- status.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
+ status.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
}
else
{
- status.dwWin32ExitCode = 0;
+ status.dwWin32ExitCode = 0;
}
status.dwServiceSpecificExitCode = exitCode;
status.dwCheckPoint = 0;
@@ -1155,7 +1155,7 @@ Ice::Service::waitForServiceState(SC_HANDLE hService, DWORD pendingState, SERVIC
{
if(!QueryServiceStatus(hService, &status))
{
- return false;
+ return false;
}
//
@@ -1226,38 +1226,38 @@ Ice::Service::showServiceStatus(const string& msg, SERVICE_STATUS& status)
switch(status.dwCurrentState)
{
case SERVICE_STOPPED:
- state = "STOPPED";
- break;
+ state = "STOPPED";
+ break;
case SERVICE_START_PENDING:
- state = "START PENDING";
- break;
+ state = "START PENDING";
+ break;
case SERVICE_STOP_PENDING:
- state = "STOP PENDING";
- break;
+ state = "STOP PENDING";
+ break;
case SERVICE_RUNNING:
- state = "RUNNING";
- break;
+ state = "RUNNING";
+ break;
case SERVICE_CONTINUE_PENDING:
- state = "CONTINUE PENDING";
- break;
+ state = "CONTINUE PENDING";
+ break;
case SERVICE_PAUSE_PENDING:
- state = "PAUSE PENDING";
- break;
+ state = "PAUSE PENDING";
+ break;
case SERVICE_PAUSED:
- state = "PAUSED";
- break;
+ state = "PAUSED";
+ break;
default:
- state = "UNKNOWN";
- break;
+ state = "UNKNOWN";
+ break;
}
ostringstream ostr;
ostr << msg << endl
- << " Current state: " << state << endl
- << " Exit code: " << status.dwWin32ExitCode << endl
- << " Service specific exit code: " << status.dwServiceSpecificExitCode << endl
- << " Check point: " << status.dwCheckPoint << endl
- << " Wait hint: " << status.dwWaitHint;
+ << " Current state: " << state << endl
+ << " Exit code: " << status.dwWin32ExitCode << endl
+ << " Service specific exit code: " << status.dwServiceSpecificExitCode << endl
+ << " Check point: " << status.dwCheckPoint << endl
+ << " Wait hint: " << status.dwWaitHint;
trace(ostr.str());
}
@@ -1314,14 +1314,14 @@ Ice::Service::serviceMain(int argc, char* argv[])
ostringstream ostr;
ostr << "exception occurred while initializing a communicator:\n" << ex;
error(ostr.str());
- terminateService(EXIT_FAILURE);
+ terminateService(EXIT_FAILURE);
return;
}
catch(...)
{
delete[] args;
error("unknown exception occurred while initializing a communicator");
- terminateService(EXIT_FAILURE);
+ terminateService(EXIT_FAILURE);
return;
}
@@ -1345,8 +1345,8 @@ Ice::Service::serviceMain(int argc, char* argv[])
//
// Change the current status from START_PENDING to RUNNING.
//
- serviceStatusManager->stopUpdate();
- serviceStatusManager->changeStatus(SERVICE_RUNNING, SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN);
+ serviceStatusManager->stopUpdate();
+ serviceStatusManager->changeStatus(SERVICE_RUNNING, SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN);
//
// Wait for the service to be shut down.
@@ -1396,21 +1396,21 @@ Ice::Service::control(int ctrl)
case SERVICE_CONTROL_SHUTDOWN:
case SERVICE_CONTROL_STOP:
{
- serviceStatusManager->startUpdate(SERVICE_STOP_PENDING);
- shutdown();
- break;
+ serviceStatusManager->startUpdate(SERVICE_STOP_PENDING);
+ shutdown();
+ break;
}
default:
{
- if(ctrl != SERVICE_CONTROL_INTERROGATE)
- {
- ostringstream ostr;
- ostr << "unrecognized service control code " << ctrl;
- error(ostr.str());
- }
+ if(ctrl != SERVICE_CONTROL_INTERROGATE)
+ {
+ ostringstream ostr;
+ ostr << "unrecognized service control code " << ctrl;
+ error(ostr.str());
+ }
- serviceStatusManager->reportStatus();
- break;
+ serviceStatusManager->reportStatus();
+ break;
}
}
}
@@ -1449,20 +1449,20 @@ Ice::ServiceStatusManager::stopUpdate()
IceUtil::ThreadPtr thread;
{
- Lock sync(*this);
+ Lock sync(*this);
- if(_thread)
- {
- _stopped = true;
- notify();
- thread = _thread;
- _thread = 0;
- }
+ if(_thread)
+ {
+ _stopped = true;
+ notify();
+ thread = _thread;
+ _thread = 0;
+ }
}
if(thread)
{
- thread->getThreadControl().join();
+ thread->getThreadControl().join();
}
}
@@ -1581,11 +1581,11 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa
break;
}
cerr << argv[0] << ": failure occurred in daemon";
- if(strlen(msg) > 0)
- {
- cerr << ':' << endl << msg;
- }
- cerr << endl;
+ if(strlen(msg) > 0)
+ {
+ cerr << ':' << endl << msg;
+ }
+ cerr << endl;
_exit(EXIT_FAILURE);
}
@@ -1644,7 +1644,7 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa
}
}
- vector<int> fdsToClose;
+ vector<int> fdsToClose;
if(_closeFiles)
{
//
@@ -1665,13 +1665,13 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa
{
if(fcntl(i, F_GETFL) != -1)
{
- //
- // Don't close the write end of the pipe.
- //
- if(i != fds[1])
- {
- fdsToClose.push_back(i);
- }
+ //
+ // Don't close the write end of the pipe.
+ //
+ if(i != fds[1])
+ {
+ fdsToClose.push_back(i);
+ }
}
}
}
@@ -1694,21 +1694,21 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa
{
//
// Close unnecessary file descriptors.
- //
- PropertiesPtr properties = _communicator->getProperties();
- string stdOut = properties->getProperty("Ice.StdOut");
- string stdErr = properties->getProperty("Ice.StdErr");
+ //
+ PropertiesPtr properties = _communicator->getProperties();
+ string stdOut = properties->getProperty("Ice.StdOut");
+ string stdErr = properties->getProperty("Ice.StdErr");
- vector<int>::const_iterator p;
- for(p = fdsToClose.begin(); p != fdsToClose.end(); ++p)
+ vector<int>::const_iterator p;
+ for(p = fdsToClose.begin(); p != fdsToClose.end(); ++p)
{
- //
- // NOTE: Do not close stdout if Ice.StdOut is defined. Likewise for Ice.StdErr.
- //
- if((*p == 1 && !stdOut.empty()) || (*p == 2 && !stdErr.empty()))
- {
- continue;
- }
+ //
+ // NOTE: Do not close stdout if Ice.StdOut is defined. Likewise for Ice.StdErr.
+ //
+ if((*p == 1 && !stdOut.empty()) || (*p == 2 && !stdErr.empty()))
+ {
+ continue;
+ }
close(*p);
}
@@ -1718,31 +1718,31 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa
int fd;
fd = open("/dev/null", O_RDWR);
assert(fd == 0);
- if(stdOut.empty())
- {
- fd = dup2(0, 1);
- assert(fd == 1);
- }
- if(stdErr.empty())
- {
- fd = dup2(1, 2);
- assert(fd == 2);
- }
+ if(stdOut.empty())
+ {
+ fd = dup2(0, 1);
+ assert(fd == 1);
+ }
+ if(stdErr.empty())
+ {
+ fd = dup2(1, 2);
+ assert(fd == 2);
+ }
+ }
+
+ //
+ // Write PID
+ //
+ if(_pidFile.size() > 0)
+ {
+ ofstream of(_pidFile.c_str());
+ of << getpid() << endl;
+
+ if(!of)
+ {
+ warning("Could not write PID file " + _pidFile);
+ }
}
-
- //
- // Write PID
- //
- if(_pidFile.size() > 0)
- {
- ofstream of(_pidFile.c_str());
- of << getpid() << endl;
-
- if(!of)
- {
- warning("Could not write PID file " + _pidFile);
- }
- }
//
// Use the configured logger.
diff --git a/cpp/src/Ice/SharedContext.h b/cpp/src/Ice/SharedContext.h
index c44858ffb34..1d551f9d406 100644
--- a/cpp/src/Ice/SharedContext.h
+++ b/cpp/src/Ice/SharedContext.h
@@ -32,13 +32,13 @@ public:
}
SharedContext(const Ice::Context& val) :
- _val(val)
+ _val(val)
{
}
inline const Ice::Context& getValue()
{
- return _val;
+ return _val;
}
private:
diff --git a/cpp/src/Ice/SliceChecksums.cpp b/cpp/src/Ice/SliceChecksums.cpp
index eb44bfa5946..98390369e18 100644
--- a/cpp/src/Ice/SliceChecksums.cpp
+++ b/cpp/src/Ice/SliceChecksums.cpp
@@ -22,8 +22,8 @@ public:
~SliceChecksumDictDestroyer()
{
- delete _sliceChecksums;
- _sliceChecksums = 0;
+ delete _sliceChecksums;
+ _sliceChecksums = 0;
}
};
static SliceChecksumDictDestroyer destroyer;
@@ -34,7 +34,7 @@ Ice::sliceChecksums()
IceUtil::StaticMutex::Lock lock(_mutex);
if(_sliceChecksums == 0)
{
- _sliceChecksums = new SliceChecksumDict();
+ _sliceChecksums = new SliceChecksumDict();
}
return *_sliceChecksums;
}
@@ -44,7 +44,7 @@ IceInternal::SliceChecksumInit::SliceChecksumInit(const char* checksums[])
IceUtil::StaticMutex::Lock lock(_mutex);
if(_sliceChecksums == 0)
{
- _sliceChecksums = new SliceChecksumDict();
+ _sliceChecksums = new SliceChecksumDict();
}
for(int i = 0; checksums[i] != 0; i += 2)
diff --git a/cpp/src/Ice/StringConverter.cpp b/cpp/src/Ice/StringConverter.cpp
index 566bfac4abb..985111f9aa9 100755
--- a/cpp/src/Ice/StringConverter.cpp
+++ b/cpp/src/Ice/StringConverter.cpp
@@ -19,8 +19,8 @@ namespace Ice
Byte*
UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart,
- const wchar_t* sourceEnd,
- UTF8Buffer& buffer) const
+ const wchar_t* sourceEnd,
+ UTF8Buffer& buffer) const
{
//
// The "chunk size" is the maximum of the number of characters in the
@@ -34,27 +34,27 @@ UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart,
ConversionResult result;
while((result =
- convertUTFWstringToUTF8(sourceStart, sourceEnd,
- targetStart, targetEnd, lenientConversion))
- == targetExhausted)
+ convertUTFWstringToUTF8(sourceStart, sourceEnd,
+ targetStart, targetEnd, lenientConversion))
+ == targetExhausted)
{
- targetStart = buffer.getMoreBytes(chunkSize, targetStart);
- targetEnd = targetStart + chunkSize;
+ targetStart = buffer.getMoreBytes(chunkSize, targetStart);
+ targetEnd = targetStart + chunkSize;
}
-
+
switch(result)
{
- case conversionOK:
- break;
- case sourceExhausted:
- throw StringConversionException(__FILE__, __LINE__, "wide string source exhausted");
- case sourceIllegal:
- throw StringConversionException(__FILE__, __LINE__, "wide string source illegal");
- default:
- {
- assert(0);
- throw StringConversionException(__FILE__, __LINE__);
- }
+ case conversionOK:
+ break;
+ case sourceExhausted:
+ throw StringConversionException(__FILE__, __LINE__, "wide string source exhausted");
+ case sourceIllegal:
+ throw StringConversionException(__FILE__, __LINE__, "wide string source illegal");
+ default:
+ {
+ assert(0);
+ throw StringConversionException(__FILE__, __LINE__);
+ }
}
return targetStart;
}
@@ -62,24 +62,24 @@ UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart,
void
UnicodeWstringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
- wstring& target) const
+ wstring& target) const
{
ConversionResult result =
- convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, lenientConversion);
+ convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, lenientConversion);
switch(result)
- {
- case conversionOK:
- break;
- case sourceExhausted:
- throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
- case sourceIllegal:
- throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source illegal");
- default:
- {
- assert(0);
- throw StringConversionException(__FILE__, __LINE__);
- }
+ {
+ case conversionOK:
+ break;
+ case sourceExhausted:
+ throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
+ case sourceIllegal:
+ throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source illegal");
+ default:
+ {
+ assert(0);
+ throw StringConversionException(__FILE__, __LINE__);
+ }
}
}
}
diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp
index 3a933042bbd..193aefe8175 100644
--- a/cpp/src/Ice/TcpAcceptor.cpp
+++ b/cpp/src/Ice/TcpAcceptor.cpp
@@ -30,8 +30,8 @@ IceInternal::TcpAcceptor::close()
{
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "stopping to accept tcp connections at " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "stopping to accept tcp connections at " << toString();
}
SOCKET fd = _fd;
@@ -44,18 +44,18 @@ IceInternal::TcpAcceptor::listen()
{
try
{
- doListen(_fd, _backlog);
+ doListen(_fd, _backlog);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "accepting tcp connections at " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "accepting tcp connections at " << toString();
}
}
@@ -67,8 +67,8 @@ IceInternal::TcpAcceptor::accept(int timeout)
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "accepted tcp connection\n" << fdToString(fd);
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "accepted tcp connection\n" << fdToString(fd);
}
return new TcpTransceiver(_instance, fd);
@@ -116,20 +116,20 @@ IceInternal::TcpAcceptor::TcpAcceptor(const InstancePtr& instance, const string&
try
{
- _fd = createSocket(false);
- setBlock(_fd, false);
- getAddress(host, port, _addr);
- if(_traceLevels->network >= 2)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "attempting to bind to tcp socket " << toString();
- }
- doBind(_fd, _addr);
+ _fd = createSocket(false);
+ setBlock(_fd, false);
+ getAddress(host, port, _addr);
+ if(_traceLevels->network >= 2)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "attempting to bind to tcp socket " << toString();
+ }
+ doBind(_fd, _addr);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
}
diff --git a/cpp/src/Ice/TcpConnector.cpp b/cpp/src/Ice/TcpConnector.cpp
index 22ca94ab15d..935aaa9a84a 100644
--- a/cpp/src/Ice/TcpConnector.cpp
+++ b/cpp/src/Ice/TcpConnector.cpp
@@ -24,8 +24,8 @@ IceInternal::TcpConnector::connect(int timeout)
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "trying to establish tcp connection to " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "trying to establish tcp connection to " << toString();
}
SOCKET fd = createSocket(false);
@@ -34,8 +34,8 @@ IceInternal::TcpConnector::connect(int timeout)
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "tcp connection established\n" << fdToString(fd);
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "tcp connection established\n" << fdToString(fd);
}
return new TcpTransceiver(_instance, fd);
diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp
index 817008a0141..6cf54872826 100644
--- a/cpp/src/Ice/TcpEndpointI.cpp
+++ b/cpp/src/Ice/TcpEndpointI.cpp
@@ -22,7 +22,7 @@ using namespace Ice;
using namespace IceInternal;
IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti,
- const string& conId, bool co, bool pub) :
+ const string& conId, bool co, bool pub) :
_instance(instance),
_host(ho),
_port(po),
@@ -47,96 +47,96 @@ IceInternal::TcpEndpointI::TcpEndpointI(const InstancePtr& instance, const strin
while(true)
{
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- string option = str.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
-
- string argument;
- string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if(argumentBeg != string::npos && str[argumentBeg] != '-')
- {
- beg = argumentBeg;
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
- argument = str.substr(beg, end - beg);
- }
-
- switch(option[1])
- {
- case 'h':
- {
- if(argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- const_cast<string&>(_host) = argument;
- break;
- }
-
- case 'p':
- {
- istringstream p(argument);
- if(!(p >> const_cast<Int&>(_port)) || !p.eof() || _port < 0 || _port > 65535)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- break;
- }
-
- case 't':
- {
- istringstream t(argument);
- if(!(t >> const_cast<Int&>(_timeout)) || !t.eof())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- break;
- }
-
- case 'z':
- {
- if(!argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- const_cast<bool&>(_compress) = true;
- break;
- }
-
- default:
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ string option = str.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+
+ string argument;
+ string::size_type argumentBeg = str.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
+ {
+ beg = argumentBeg;
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+ argument = str.substr(beg, end - beg);
+ }
+
+ switch(option[1])
+ {
+ case 'h':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ const_cast<string&>(_host) = argument;
+ break;
+ }
+
+ case 'p':
+ {
+ istringstream p(argument);
+ if(!(p >> const_cast<Int&>(_port)) || !p.eof() || _port < 0 || _port > 65535)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 't':
+ {
+ istringstream t(argument);
+ if(!(t >> const_cast<Int&>(_timeout)) || !t.eof())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 'z':
+ {
+ if(!argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ const_cast<bool&>(_compress) = true;
+ break;
+ }
+
+ default:
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ }
}
}
@@ -181,11 +181,11 @@ IceInternal::TcpEndpointI::toString() const
s << "tcp -h " << _host << " -p " << _port;
if(_timeout != -1)
{
- s << " -t " << _timeout;
+ s << " -t " << _timeout;
}
if(_compress)
{
- s << " -z";
+ s << " -z";
}
return s.str();
}
@@ -207,11 +207,11 @@ IceInternal::TcpEndpointI::timeout(Int timeout) const
{
if(timeout == _timeout)
{
- return const_cast<TcpEndpointI*>(this);
+ return const_cast<TcpEndpointI*>(this);
}
else
{
- return new TcpEndpointI(_instance, _host, _port, timeout, _connectionId, _compress, _publish);
+ return new TcpEndpointI(_instance, _host, _port, timeout, _connectionId, _compress, _publish);
}
}
@@ -220,11 +220,11 @@ IceInternal::TcpEndpointI::connectionId(const string& connectionId) const
{
if(connectionId == _connectionId)
{
- return const_cast<TcpEndpointI*>(this);
+ return const_cast<TcpEndpointI*>(this);
}
else
{
- return new TcpEndpointI(_instance, _host, _port, _timeout, connectionId, _compress, _publish);
+ return new TcpEndpointI(_instance, _host, _port, _timeout, connectionId, _compress, _publish);
}
}
@@ -239,11 +239,11 @@ IceInternal::TcpEndpointI::compress(bool compress) const
{
if(compress == _compress)
{
- return const_cast<TcpEndpointI*>(this);
+ return const_cast<TcpEndpointI*>(this);
}
else
{
- return new TcpEndpointI(_instance, _host, _port, _timeout, _connectionId, compress, _publish);
+ return new TcpEndpointI(_instance, _host, _port, _timeout, _connectionId, compress, _publish);
}
}
@@ -297,18 +297,18 @@ IceInternal::TcpEndpointI::expand(bool server) const
{
if(_host.empty())
{
- const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost;
- if(_host.empty())
- {
- if(server)
- {
- const_cast<string&>(_host) = "0.0.0.0";
- }
- else
- {
- const_cast<string&>(_host) = "127.0.0.1";
- }
- }
+ const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost;
+ if(_host.empty())
+ {
+ if(server)
+ {
+ const_cast<string&>(_host) = "0.0.0.0";
+ }
+ else
+ {
+ const_cast<string&>(_host) = "127.0.0.1";
+ }
+ }
}
else if(_host == "*")
{
@@ -319,11 +319,11 @@ IceInternal::TcpEndpointI::expand(bool server) const
if(_host == "0.0.0.0")
{
vector<string> hosts = getLocalHosts();
- for(unsigned int i = 0; i < hosts.size(); ++i)
- {
- endps.push_back(new TcpEndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress,
- hosts.size() == 1 || hosts[i] != "127.0.0.1"));
- }
+ for(unsigned int i = 0; i < hosts.size(); ++i)
+ {
+ endps.push_back(new TcpEndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress,
+ hosts.size() == 1 || hosts[i] != "127.0.0.1"));
+ }
}
else
{
@@ -350,7 +350,7 @@ IceInternal::TcpEndpointI::equivalent(const AcceptorPtr& acceptor) const
const TcpAcceptor* tcpAcceptor = dynamic_cast<const TcpAcceptor*>(acceptor.get());
if(!tcpAcceptor)
{
- return false;
+ return false;
}
return tcpAcceptor->equivalent(_host, _port);
}
@@ -361,52 +361,52 @@ IceInternal::TcpEndpointI::operator==(const EndpointI& r) const
const TcpEndpointI* p = dynamic_cast<const TcpEndpointI*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_port != p->_port)
{
- return false;
+ return false;
}
if(_timeout != p->_timeout)
{
- return false;
+ return false;
}
if(_connectionId != p->_connectionId)
{
- return false;
+ return false;
}
if(_compress != p->_compress)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- struct sockaddr_in raddr;
- try
- {
- getAddress(_host, _port, laddr);
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ return false;
+ }
- return compareAddress(laddr, raddr);
+ return compareAddress(laddr, raddr);
}
return true;
@@ -429,76 +429,76 @@ IceInternal::TcpEndpointI::operator<(const EndpointI& r) const
if(this == p)
{
- return false;
+ return false;
}
if(_port < p->_port)
{
- return true;
+ return true;
}
else if(p->_port < _port)
{
- return false;
+ return false;
}
if(_timeout < p->_timeout)
{
- return true;
+ return true;
}
else if(p->_timeout < _timeout)
{
- return false;
+ return false;
}
if(_connectionId < p->_connectionId)
{
- return true;
+ return true;
}
else if(p->_connectionId < _connectionId)
{
- return false;
+ return false;
}
if(!_compress && p->_compress)
{
- return true;
+ return true;
}
else if(p->_compress < _compress)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- try
- {
- getAddress(_host, _port, laddr);
- }
- catch(const DNSException&)
- {
- }
-
- struct sockaddr_in raddr;
- try
- {
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- }
-
- if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
- {
- return true;
- }
- else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ {
+ return true;
+ }
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ {
+ return false;
+ }
}
return false;
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp
index 4eb5f54fa02..541843223b7 100644
--- a/cpp/src/Ice/TcpTransceiver.cpp
+++ b/cpp/src/Ice/TcpTransceiver.cpp
@@ -32,20 +32,20 @@ IceInternal::TcpTransceiver::close()
{
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "closing tcp connection\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "closing tcp connection\n" << toString();
}
assert(_fd != INVALID_SOCKET);
try
{
- closeSocket(_fd);
- _fd = INVALID_SOCKET;
+ closeSocket(_fd);
+ _fd = INVALID_SOCKET;
}
catch(const SocketException&)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
}
@@ -54,8 +54,8 @@ IceInternal::TcpTransceiver::shutdownWrite()
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "shutting down tcp connection for writing\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "shutting down tcp connection for writing\n" << toString();
}
assert(_fd != INVALID_SOCKET);
@@ -67,8 +67,8 @@ IceInternal::TcpTransceiver::shutdownReadWrite()
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "shutting down tcp connection for reading and writing\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "shutting down tcp connection for reading and writing\n" << toString();
}
assert(_fd != INVALID_SOCKET);
@@ -87,112 +87,112 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
//
if(_isPeerLocal && packetSize > 64 * 1024)
{
- packetSize = 64 * 1024;
+ packetSize = 64 * 1024;
}
#endif
while(buf.i != buf.b.end())
{
- assert(_fd != INVALID_SOCKET);
- ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&*buf.i), packetSize, 0);
-
- if(ret == 0)
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
-
- if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- continue;
- }
-
- if(noBuffers() && packetSize > 1024)
- {
- packetSize /= 2;
- continue;
- }
-
- if(wouldBlock())
- {
- repeatSelect:
-
- int rs;
- assert(_fd != INVALID_SOCKET);
+ assert(_fd != INVALID_SOCKET);
+ ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&*buf.i), packetSize, 0);
+
+ if(ret == 0)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ continue;
+ }
+
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ continue;
+ }
+
+ if(wouldBlock())
+ {
+ repeatSelect:
+
+ int rs;
+ assert(_fd != INVALID_SOCKET);
#ifdef _WIN32
- FD_SET(_fd, &_wFdSet);
-
- if(timeout >= 0)
- {
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- rs = ::select(static_cast<int>(_fd + 1), 0, &_wFdSet, 0, &tv);
- }
- else
- {
- rs = ::select(static_cast<int>(_fd + 1), 0, &_wFdSet, 0, 0);
- }
+ FD_SET(_fd, &_wFdSet);
+
+ if(timeout >= 0)
+ {
+ struct timeval tv;
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
+ rs = ::select(static_cast<int>(_fd + 1), 0, &_wFdSet, 0, &tv);
+ }
+ else
+ {
+ rs = ::select(static_cast<int>(_fd + 1), 0, &_wFdSet, 0, 0);
+ }
#else
- struct pollfd pollFd[1];
- pollFd[0].fd = _fd;
- pollFd[0].events = POLLOUT;
- rs = ::poll(pollFd, 1, timeout);
-#endif
- if(rs == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatSelect;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- if(rs == 0)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- continue;
- }
-
- if(connectionLost())
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- if(_traceLevels->network >= 3)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "sent " << ret << " of " << packetSize << " bytes via tcp\n" << toString();
- }
-
- if(_stats)
- {
- _stats->bytesSent(type(), static_cast<Int>(ret));
- }
-
- buf.i += ret;
-
- if(packetSize > buf.b.end() - buf.i)
- {
- packetSize = static_cast<int>(buf.b.end() - buf.i);
- }
+ struct pollfd pollFd[1];
+ pollFd[0].fd = _fd;
+ pollFd[0].events = POLLOUT;
+ rs = ::poll(pollFd, 1, timeout);
+#endif
+ if(rs == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatSelect;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ if(rs == 0)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ continue;
+ }
+
+ if(connectionLost())
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ if(_traceLevels->network >= 3)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "sent " << ret << " of " << packetSize << " bytes via tcp\n" << toString();
+ }
+
+ if(_stats)
+ {
+ _stats->bytesSent(type(), static_cast<Int>(ret));
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
+ }
}
}
@@ -204,125 +204,125 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
while(buf.i != buf.b.end())
{
- assert(_fd != INVALID_SOCKET);
- ssize_t ret = ::recv(_fd, reinterpret_cast<char*>(&*buf.i), packetSize, 0);
-
- if(ret == 0)
- {
- //
- // If the connection is lost when reading data, we shut
- // down the write end of the socket. This helps to unblock
- // threads that are stuck in send() or select() while
- // sending data. Note: I don't really understand why
- // send() or select() sometimes don't detect a connection
- // loss. Therefore this helper to make them detect it.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
-
- if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- continue;
- }
-
- if(noBuffers() && packetSize > 1024)
- {
- packetSize /= 2;
- continue;
- }
-
- if(wouldBlock())
- {
- repeatSelect:
-
- int rs;
- assert(_fd != INVALID_SOCKET);
+ assert(_fd != INVALID_SOCKET);
+ ssize_t ret = ::recv(_fd, reinterpret_cast<char*>(&*buf.i), packetSize, 0);
+
+ if(ret == 0)
+ {
+ //
+ // If the connection is lost when reading data, we shut
+ // down the write end of the socket. This helps to unblock
+ // threads that are stuck in send() or select() while
+ // sending data. Note: I don't really understand why
+ // send() or select() sometimes don't detect a connection
+ // loss. Therefore this helper to make them detect it.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ continue;
+ }
+
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ continue;
+ }
+
+ if(wouldBlock())
+ {
+ repeatSelect:
+
+ int rs;
+ assert(_fd != INVALID_SOCKET);
#ifdef _WIN32
- FD_SET(_fd, &_rFdSet);
-
- if(timeout >= 0)
- {
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- rs = ::select(static_cast<int>(_fd + 1), &_rFdSet, 0, 0, &tv);
- }
- else
- {
- rs = ::select(static_cast<int>(_fd + 1), &_rFdSet, 0, 0, 0);
- }
+ FD_SET(_fd, &_rFdSet);
+
+ if(timeout >= 0)
+ {
+ struct timeval tv;
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
+ rs = ::select(static_cast<int>(_fd + 1), &_rFdSet, 0, 0, &tv);
+ }
+ else
+ {
+ rs = ::select(static_cast<int>(_fd + 1), &_rFdSet, 0, 0, 0);
+ }
#else
- struct pollfd pollFd[1];
- pollFd[0].fd = _fd;
- pollFd[0].events = POLLIN;
- rs = ::poll(pollFd, 1, timeout);
+ struct pollfd pollFd[1];
+ pollFd[0].fd = _fd;
+ pollFd[0].events = POLLIN;
+ rs = ::poll(pollFd, 1, timeout);
#endif
- if(rs == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatSelect;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- if(rs == 0)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- continue;
- }
-
- if(connectionLost())
- {
- //
- // See the commment above about shutting down the
- // socket if the connection is lost while reading
- // data.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- if(_traceLevels->network >= 3)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "received " << ret << " of " << packetSize << " bytes via tcp\n" << toString();
- }
-
- if(_stats)
- {
- _stats->bytesReceived(type(), static_cast<Int>(ret));
- }
-
- buf.i += ret;
-
- if(packetSize > buf.b.end() - buf.i)
- {
- packetSize = static_cast<int>(buf.b.end() - buf.i);
- }
+ if(rs == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatSelect;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ if(rs == 0)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ continue;
+ }
+
+ if(connectionLost())
+ {
+ //
+ // See the commment above about shutting down the
+ // socket if the connection is lost while reading
+ // data.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ if(_traceLevels->network >= 3)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "received " << ret << " of " << packetSize << " bytes via tcp\n" << toString();
+ }
+
+ if(_stats)
+ {
+ _stats->bytesReceived(type(), static_cast<Int>(ret));
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
+ }
}
}
@@ -348,7 +348,7 @@ IceInternal::TcpTransceiver::checkSendSize(const Buffer& buf, size_t messageSize
{
if(buf.b.size() > messageSizeMax)
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ throw MemoryLimitException(__FILE__, __LINE__);
}
}
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 87b315b9cba..6e122f575f0 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -61,9 +61,9 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
_epollFd = epoll_create(1);
if(_epollFd < 0)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
_events.resize(1);
epoll_event event;
@@ -71,9 +71,9 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
event.data.fd = _fdIntrRead;
if(epoll_ctl(_epollFd, EPOLL_CTL_ADD, _fdIntrRead, &event) != 0)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
#else
_pollFdSet.resize(1);
@@ -90,8 +90,8 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
if(size < 1)
{
Warning out(_instance->initializationData().logger);
- out << _prefix << ".Size < 1; Size adjusted to 1";
- size = 1;
+ out << _prefix << ".Size < 1; Size adjusted to 1";
+ size = 1;
}
int sizeMax =
@@ -99,17 +99,17 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
if(sizeMax < size)
{
Warning out(_instance->initializationData().logger);
- out << _prefix << ".SizeMax < " << _prefix << ".Size; SizeMax adjusted to Size (" << size << ")";
- sizeMax = size;
- }
+ out << _prefix << ".SizeMax < " << _prefix << ".Size; SizeMax adjusted to Size (" << size << ")";
+ sizeMax = size;
+ }
int sizeWarn = _instance->initializationData().properties->
- getPropertyAsIntWithDefault(_prefix + ".SizeWarn", sizeMax * 80 / 100);
+ getPropertyAsIntWithDefault(_prefix + ".SizeWarn", sizeMax * 80 / 100);
if(sizeWarn > sizeMax)
{
- Warning out(_instance->initializationData().logger);
- out << _prefix << ".SizeWarn > " << _prefix << ".SizeMax; adjusted SizeWarn to SizeMax (" << sizeMax << ")";
- sizeWarn = sizeMax;
+ Warning out(_instance->initializationData().logger);
+ out << _prefix << ".SizeWarn > " << _prefix << ".SizeMax; adjusted SizeWarn to SizeMax (" << sizeMax << ")";
+ sizeWarn = sizeMax;
}
const_cast<int&>(_size) = size;
@@ -120,38 +120,38 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
if(stackSize < 0)
{
Warning out(_instance->initializationData().logger);
- out << _prefix << ".StackSize < 0; Size adjusted to OS default";
- stackSize = 0;
+ out << _prefix << ".StackSize < 0; Size adjusted to OS default";
+ stackSize = 0;
}
const_cast<size_t&>(_stackSize) = static_cast<size_t>(stackSize);
__setNoDelete(true);
try
{
- for(int i = 0 ; i < _size ; ++i)
- {
- IceUtil::ThreadPtr thread = new EventHandlerThread(this);
- thread->start(_stackSize);
- _threads.push_back(thread);
- ++_running;
- }
+ for(int i = 0 ; i < _size ; ++i)
+ {
+ IceUtil::ThreadPtr thread = new EventHandlerThread(this);
+ thread->start(_stackSize);
+ _threads.push_back(thread);
+ ++_running;
+ }
}
catch(const IceUtil::Exception& ex)
{
- {
- Error out(_instance->initializationData().logger);
- out << "cannot create thread for `" << _prefix << "':\n" << ex;
- }
+ {
+ Error out(_instance->initializationData().logger);
+ out << "cannot create thread for `" << _prefix << "':\n" << ex;
+ }
- destroy();
- joinWithAllThreads();
- __setNoDelete(false);
- throw;
+ destroy();
+ joinWithAllThreads();
+ __setNoDelete(false);
+ throw;
}
catch(...)
{
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -162,33 +162,33 @@ IceInternal::ThreadPool::~ThreadPool()
try
{
- closeSocket(_fdIntrWrite);
+ closeSocket(_fdIntrWrite);
}
catch(const LocalException& ex)
{
- Error out(_instance->initializationData().logger);
- out << "exception in `" << _prefix << "' while calling closeSocket():\n" << ex;
+ Error out(_instance->initializationData().logger);
+ out << "exception in `" << _prefix << "' while calling closeSocket():\n" << ex;
}
try
{
- closeSocket(_fdIntrRead);
+ closeSocket(_fdIntrRead);
}
catch(const LocalException& ex)
{
- Error out(_instance->initializationData().logger);
- out << "exception in `" << _prefix << "' while calling closeSocket():\n" << ex;
+ Error out(_instance->initializationData().logger);
+ out << "exception in `" << _prefix << "' while calling closeSocket():\n" << ex;
}
#ifdef __linux
try
{
- closeSocket(_epollFd);
+ closeSocket(_epollFd);
}
catch(const LocalException& ex)
{
- Error out(_instance->initializationData().logger);
- out << "exception in `" << _prefix << "' while calling closeSocket():\n" << ex;
+ Error out(_instance->initializationData().logger);
+ out << "exception in `" << _prefix << "' while calling closeSocket():\n" << ex;
}
#endif
}
@@ -214,15 +214,15 @@ IceInternal::ThreadPool::incFdsInUse()
assert(!_destroyed);
if(_fdsInUse + 1 > FD_SETSIZE)
{
- Warning warn(_instance->initializationData().logger);
- warn << "maximum number of connections exceeded";
+ Warning warn(_instance->initializationData().logger);
+ warn << "maximum number of connections exceeded";
- //
- // No appropriate errno.
- //
- SocketException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
+ //
+ // No appropriate errno.
+ //
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
}
++_fdsInUse;
#endif
@@ -238,8 +238,8 @@ IceInternal::ThreadPool::decFdsInUse()
assert(!_destroyed);
if(_fdsInUse <= 1)
{
- Trace trace(_instance->initializationData().logger, "ThreadPool");
- trace << _prefix << ": about to assert";
+ Trace trace(_instance->initializationData().logger, "ThreadPool");
+ trace << _prefix << ": about to assert";
}
assert(_fdsInUse > 1); // _fdIntrRead is always in use.
--_fdsInUse;
@@ -269,41 +269,41 @@ IceInternal::ThreadPool::promoteFollower()
{
if(_sizeMax > 1)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_promote);
- _promote = true;
- notify();
+ assert(!_promote);
+ _promote = true;
+ notify();
- if(!_destroyed)
- {
- assert(_inUse >= 0);
- ++_inUse;
-
- if(_inUse == _sizeWarn)
- {
- Warning out(_instance->initializationData().logger);
- out << "thread pool `" << _prefix << "' is running low on threads\n"
- << "Size=" << _size << ", " << "SizeMax=" << _sizeMax << ", " << "SizeWarn=" << _sizeWarn;
- }
-
- assert(_inUse <= _running);
- if(_inUse < _sizeMax && _inUse == _running)
- {
- try
- {
- IceUtil::ThreadPtr thread = new EventHandlerThread(this);
- thread->start(_stackSize);
- _threads.push_back(thread);
- ++_running;
- }
- catch(const IceUtil::Exception& ex)
- {
- Error out(_instance->initializationData().logger);
- out << "cannot create thread for `" << _prefix << "':\n" << ex;
- }
- }
- }
+ if(!_destroyed)
+ {
+ assert(_inUse >= 0);
+ ++_inUse;
+
+ if(_inUse == _sizeWarn)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "thread pool `" << _prefix << "' is running low on threads\n"
+ << "Size=" << _size << ", " << "SizeMax=" << _sizeMax << ", " << "SizeWarn=" << _sizeWarn;
+ }
+
+ assert(_inUse <= _running);
+ if(_inUse < _sizeMax && _inUse == _running)
+ {
+ try
+ {
+ IceUtil::ThreadPtr thread = new EventHandlerThread(this);
+ thread->start(_stackSize);
+ _threads.push_back(thread);
+ ++_running;
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "cannot create thread for `" << _prefix << "':\n" << ex;
+ }
+ }
+ }
}
}
@@ -319,7 +319,7 @@ IceInternal::ThreadPool::joinWithAllThreads()
assert(_destroyed);
for(vector<IceUtil::ThreadPtr>::iterator p = _threads.begin(); p != _threads.end(); ++p)
{
- (*p)->getThreadControl().join();
+ (*p)->getThreadControl().join();
}
}
@@ -339,26 +339,26 @@ repeat:
#ifdef _WIN32
if(::recv(_fdIntrRead, &c, 1, 0) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeat;
- }
+ if(interrupted())
+ {
+ goto repeat;
+ }
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
#else
if(::read(_fdIntrRead, &c, 1) == -1)
{
- if(interrupted())
- {
- goto repeat;
- }
+ if(interrupted())
+ {
+ goto repeat;
+ }
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
#endif
}
@@ -373,26 +373,26 @@ repeat:
#ifdef _WIN32
if(::send(_fdIntrWrite, &c, 1, 0) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeat;
- }
+ if(interrupted())
+ {
+ goto repeat;
+ }
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
#else
if(::write(_fdIntrWrite, &c, 1) == -1)
{
- if(interrupted())
- {
- goto repeat;
- }
+ if(interrupted())
+ {
+ goto repeat;
+ }
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
#endif
}
@@ -404,467 +404,467 @@ IceInternal::ThreadPool::run()
if(_sizeMax > 1)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_promote)
- {
- wait();
- }
+ while(!_promote)
+ {
+ wait();
+ }
- _promote = false;
+ _promote = false;
}
while(true)
{
- int ret;
+ int ret;
#if defined(_WIN32)
- fd_set fdSet;
- memcpy(&fdSet, &_fdSet, sizeof(fd_set));
- if(_timeout > 0)
- {
- struct timeval tv;
- tv.tv_sec = _timeout;
- tv.tv_usec = 0;
- ret = ::select(static_cast<int>(_maxFd + 1), &fdSet, 0, 0, &tv);
- }
- else
- {
- ret = ::select(static_cast<int>(_maxFd + 1), &fdSet, 0, 0, 0);
- }
+ fd_set fdSet;
+ memcpy(&fdSet, &_fdSet, sizeof(fd_set));
+ if(_timeout > 0)
+ {
+ struct timeval tv;
+ tv.tv_sec = _timeout;
+ tv.tv_usec = 0;
+ ret = ::select(static_cast<int>(_maxFd + 1), &fdSet, 0, 0, &tv);
+ }
+ else
+ {
+ ret = ::select(static_cast<int>(_maxFd + 1), &fdSet, 0, 0, 0);
+ }
#elif defined(__linux)
- ret = epoll_wait(_epollFd, &_events[0], _events.size(), _timeout > 0 ? _timeout * 1000 : -1);
+ ret = epoll_wait(_epollFd, &_events[0], _events.size(), _timeout > 0 ? _timeout * 1000 : -1);
#else
- ret = poll(&_pollFdSet[0], _pollFdSet.size(), _timeout > 0 ? _timeout * 1000 : -1);
+ ret = poll(&_pollFdSet[0], _pollFdSet.size(), _timeout > 0 ? _timeout * 1000 : -1);
#endif
- if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- continue;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- //throw ex;
- Error out(_instance->initializationData().logger);
- out << "exception in `" << _prefix << "':\n" << ex;
- continue;
- }
-
- EventHandlerPtr handler;
- bool finished = false;
- bool shutdown = false;
+ if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ continue;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ //throw ex;
+ Error out(_instance->initializationData().logger);
+ out << "exception in `" << _prefix << "':\n" << ex;
+ continue;
+ }
+
+ EventHandlerPtr handler;
+ bool finished = false;
+ bool shutdown = false;
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(ret == 0) // We initiate a shutdown if there is a thread pool timeout.
- {
- assert(_timeout > 0);
- _timeout = 0;
- shutdown = true;
- }
- else
- {
- bool interrupted = false;
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(ret == 0) // We initiate a shutdown if there is a thread pool timeout.
+ {
+ assert(_timeout > 0);
+ _timeout = 0;
+ shutdown = true;
+ }
+ else
+ {
+ bool interrupted = false;
#if defined(_WIN32)
- interrupted = FD_ISSET(_fdIntrRead, &fdSet);
+ interrupted = FD_ISSET(_fdIntrRead, &fdSet);
#elif defined(__linux)
for(int i = 0; i < ret; ++i)
- {
- if(_events[i].data.fd == _fdIntrRead)
- {
- interrupted = true;
- break;
- }
- }
+ {
+ if(_events[i].data.fd == _fdIntrRead)
+ {
+ interrupted = true;
+ break;
+ }
+ }
#else
- assert(_pollFdSet[0].fd == _fdIntrRead);
+ assert(_pollFdSet[0].fd == _fdIntrRead);
interrupted = _pollFdSet[0].revents != 0;
#endif
- if(interrupted)
- {
- //
- // There are two possiblities for an interrupt:
- //
- // 1. The thread pool has been destroyed.
- //
- // 2. An event handler was registered or unregistered.
- //
+ if(interrupted)
+ {
+ //
+ // There are two possiblities for an interrupt:
+ //
+ // 1. The thread pool has been destroyed.
+ //
+ // 2. An event handler was registered or unregistered.
+ //
- //
- // Thread pool destroyed?
- //
- if(_destroyed)
- {
- //
- // Don't clear the interrupt if destroyed, so that
- // the other threads exit as well.
- //
- return true;
- }
-
- clearInterrupt();
-
- //
- // An event handler must have been registered or
- // unregistered.
- //
- assert(!_changes.empty());
- pair<SOCKET, EventHandlerPtr> change = _changes.front();
- _changes.pop_front();
-
- if(change.second) // Addition if handler is set.
- {
- _handlerMap.insert(change);
+ //
+ // Thread pool destroyed?
+ //
+ if(_destroyed)
+ {
+ //
+ // Don't clear the interrupt if destroyed, so that
+ // the other threads exit as well.
+ //
+ return true;
+ }
+
+ clearInterrupt();
+
+ //
+ // An event handler must have been registered or
+ // unregistered.
+ //
+ assert(!_changes.empty());
+ pair<SOCKET, EventHandlerPtr> change = _changes.front();
+ _changes.pop_front();
+
+ if(change.second) // Addition if handler is set.
+ {
+ _handlerMap.insert(change);
#if defined(_WIN32)
- FD_SET(change.first, &_fdSet);
+ FD_SET(change.first, &_fdSet);
#elif defined(__linux)
- epoll_event event;
- event.events = EPOLLIN;
- event.data.fd = change.first;
- if(epoll_ctl(_epollFd, EPOLL_CTL_ADD, change.first, &event) != 0)
- {
- Error out(_instance->initializationData().logger);
- out << "error while adding filedescriptor to epoll set:\n";
- out << errorToString(getSocketErrno());
- continue;
- }
- _events.resize(_handlerMap.size() + 1);
+ epoll_event event;
+ event.events = EPOLLIN;
+ event.data.fd = change.first;
+ if(epoll_ctl(_epollFd, EPOLL_CTL_ADD, change.first, &event) != 0)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "error while adding filedescriptor to epoll set:\n";
+ out << errorToString(getSocketErrno());
+ continue;
+ }
+ _events.resize(_handlerMap.size() + 1);
#else
- struct pollfd pollFd;
- pollFd.fd = change.first;
- pollFd.events = POLLIN;
- _pollFdSet.push_back(pollFd);
+ struct pollfd pollFd;
+ pollFd.fd = change.first;
+ pollFd.events = POLLIN;
+ _pollFdSet.push_back(pollFd);
#endif
- _maxFd = max(_maxFd, change.first);
- _minFd = min(_minFd, change.first);
- continue;
- }
- else // Removal if handler is not set.
- {
- map<SOCKET, EventHandlerPtr>::iterator p = _handlerMap.find(change.first);
- assert(p != _handlerMap.end());
- handler = p->second;
- finished = true;
- _handlerMap.erase(p);
+ _maxFd = max(_maxFd, change.first);
+ _minFd = min(_minFd, change.first);
+ continue;
+ }
+ else // Removal if handler is not set.
+ {
+ map<SOCKET, EventHandlerPtr>::iterator p = _handlerMap.find(change.first);
+ assert(p != _handlerMap.end());
+ handler = p->second;
+ finished = true;
+ _handlerMap.erase(p);
#if defined(_WIN32)
- FD_CLR(change.first, &_fdSet);
+ FD_CLR(change.first, &_fdSet);
#elif defined(__linux)
- epoll_event event;
- event.events = 0;
- if(epoll_ctl(_epollFd, EPOLL_CTL_DEL, change.first, &event) != 0)
- {
- Error out(_instance->initializationData().logger);
- out << "error while adding filedescriptor to epoll set:\n";
- out << errorToString(getSocketErrno());
- continue;
- }
- _events.resize(_handlerMap.size() + 1);
+ epoll_event event;
+ event.events = 0;
+ if(epoll_ctl(_epollFd, EPOLL_CTL_DEL, change.first, &event) != 0)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "error while adding filedescriptor to epoll set:\n";
+ out << errorToString(getSocketErrno());
+ continue;
+ }
+ _events.resize(_handlerMap.size() + 1);
#else
- for(vector<struct pollfd>::iterator p = _pollFdSet.begin(); p != _pollFdSet.end(); ++p)
- {
- if(p->fd == change.first)
- {
- _pollFdSet.erase(p);
- break;
- }
- }
+ for(vector<struct pollfd>::iterator p = _pollFdSet.begin(); p != _pollFdSet.end(); ++p)
+ {
+ if(p->fd == change.first)
+ {
+ _pollFdSet.erase(p);
+ break;
+ }
+ }
#endif
- _maxFd = _fdIntrRead;
- _minFd = _fdIntrRead;
- if(!_handlerMap.empty())
- {
- _maxFd = max(_maxFd, (--_handlerMap.end())->first);
- _minFd = min(_minFd, _handlerMap.begin()->first);
- }
- // Don't continue; we have to call
- // finished() on the event handler below, outside
- // the thread synchronization.
- }
- }
- else
- {
- //
- // Round robin for the filedescriptors.
- //
- SOCKET largerFd = _maxFd + 1;
- SOCKET smallestFd = _maxFd + 1;
+ _maxFd = _fdIntrRead;
+ _minFd = _fdIntrRead;
+ if(!_handlerMap.empty())
+ {
+ _maxFd = max(_maxFd, (--_handlerMap.end())->first);
+ _minFd = min(_minFd, _handlerMap.begin()->first);
+ }
+ // Don't continue; we have to call
+ // finished() on the event handler below, outside
+ // the thread synchronization.
+ }
+ }
+ else
+ {
+ //
+ // Round robin for the filedescriptors.
+ //
+ SOCKET largerFd = _maxFd + 1;
+ SOCKET smallestFd = _maxFd + 1;
#if defined(_WIN32)
- if(fdSet.fd_count == 0)
- {
- Error out(_instance->initializationData().logger);
- out << "select() in `" << _prefix << "' returned " << ret
- << " but no filedescriptor is readable";
- continue;
- }
- for(u_short i = 0; i < fdSet.fd_count; ++i)
- {
- SOCKET fd = fdSet.fd_array[i];
+ if(fdSet.fd_count == 0)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "select() in `" << _prefix << "' returned " << ret
+ << " but no filedescriptor is readable";
+ continue;
+ }
+ for(u_short i = 0; i < fdSet.fd_count; ++i)
+ {
+ SOCKET fd = fdSet.fd_array[i];
#elif defined(__linux)
- for(int i = 0; i < ret; ++i)
- {
- SOCKET fd = _events[i].data.fd;
+ for(int i = 0; i < ret; ++i)
+ {
+ SOCKET fd = _events[i].data.fd;
#else
for(vector<struct pollfd>::const_iterator p = _pollFdSet.begin(); p != _pollFdSet.end(); ++p)
- {
- if(p->revents == 0)
- {
- continue;
- }
- SOCKET fd = p->fd;
+ {
+ if(p->revents == 0)
+ {
+ continue;
+ }
+ SOCKET fd = p->fd;
#endif
- assert(fd != INVALID_SOCKET);
- if(fd > _lastFd || _lastFd == INVALID_SOCKET)
- {
- largerFd = min(largerFd, fd);
- }
-
- smallestFd = min(smallestFd, fd);
- }
-
- if(largerFd <= _maxFd)
- {
- assert(largerFd >= _minFd);
- _lastFd = largerFd;
- }
- else
- {
- assert(smallestFd >= _minFd && smallestFd <= _maxFd);
- _lastFd = smallestFd;
- }
- assert(_lastFd != _fdIntrRead);
- map<SOCKET, EventHandlerPtr>::iterator p = _handlerMap.find(_lastFd);
- if(p == _handlerMap.end())
- {
- Error out(_instance->initializationData().logger);
- out << "filedescriptor " << _lastFd << " not registered with `" << _prefix << "'";
- continue;
- }
-
- handler = p->second;
- }
- }
- }
-
- //
- // Now we are outside the thread synchronization.
- //
+ assert(fd != INVALID_SOCKET);
+ if(fd > _lastFd || _lastFd == INVALID_SOCKET)
+ {
+ largerFd = min(largerFd, fd);
+ }
+
+ smallestFd = min(smallestFd, fd);
+ }
+
+ if(largerFd <= _maxFd)
+ {
+ assert(largerFd >= _minFd);
+ _lastFd = largerFd;
+ }
+ else
+ {
+ assert(smallestFd >= _minFd && smallestFd <= _maxFd);
+ _lastFd = smallestFd;
+ }
+ assert(_lastFd != _fdIntrRead);
+ map<SOCKET, EventHandlerPtr>::iterator p = _handlerMap.find(_lastFd);
+ if(p == _handlerMap.end())
+ {
+ Error out(_instance->initializationData().logger);
+ out << "filedescriptor " << _lastFd << " not registered with `" << _prefix << "'";
+ continue;
+ }
+
+ handler = p->second;
+ }
+ }
+ }
+
+ //
+ // Now we are outside the thread synchronization.
+ //
- if(shutdown)
- {
- //
- // Initiate server shutdown.
- //
- ObjectAdapterFactoryPtr factory;
- try
- {
- factory = _instance->objectAdapterFactory();
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- continue;
- }
+ if(shutdown)
+ {
+ //
+ // Initiate server shutdown.
+ //
+ ObjectAdapterFactoryPtr factory;
+ try
+ {
+ factory = _instance->objectAdapterFactory();
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ continue;
+ }
- promoteFollower();
- factory->shutdown();
+ promoteFollower();
+ factory->shutdown();
- //
- // No "continue", because we want shutdown to be done in
- // its own thread from this pool. Therefore we called
- // promoteFollower().
- //
- }
- else
- {
- assert(handler);
-
- if(finished)
- {
- //
- // Notify a handler about it's removal from the thread
- // pool.
- //
- try
- {
- //
- // "self" is faster than "this", as the reference
- // count is not modified.
- //
- handler->finished(self);
- }
- catch(const LocalException& ex)
- {
- Error out(_instance->initializationData().logger);
- out << "exception in `" << _prefix << "' while calling finished():\n"
- << ex << '\n' << handler->toString();
- }
+ //
+ // No "continue", because we want shutdown to be done in
+ // its own thread from this pool. Therefore we called
+ // promoteFollower().
+ //
+ }
+ else
+ {
+ assert(handler);
+
+ if(finished)
+ {
+ //
+ // Notify a handler about it's removal from the thread
+ // pool.
+ //
+ try
+ {
+ //
+ // "self" is faster than "this", as the reference
+ // count is not modified.
+ //
+ handler->finished(self);
+ }
+ catch(const LocalException& ex)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "exception in `" << _prefix << "' while calling finished():\n"
+ << ex << '\n' << handler->toString();
+ }
- //
- // No "continue", because we want finished() to be
- // called in its own thread from this pool. Note that
- // this means that finished() must call
- // promoteFollower().
- //
- }
- else
- {
- //
- // If the handler is "readable", try to read a
- // message.
- //
- BasicStream stream(_instance.get());
- if(handler->readable())
- {
- try
- {
- read(handler);
- }
- catch(const TimeoutException&) // Expected.
- {
- continue;
- }
- catch(const DatagramLimitException&) // Expected.
- {
- continue;
- }
- catch(const SocketException& ex)
- {
- handler->exception(ex);
- continue;
- }
- catch(const LocalException& ex)
- {
- if(handler->datagram())
- {
- if(_instance->initializationData().properties->
- getPropertyAsInt("Ice.Warn.Connections") > 0)
- {
- Warning out(_instance->initializationData().logger);
- out << "datagram connection exception:\n" << ex << '\n' << handler->toString();
- }
- }
- else
- {
- handler->exception(ex);
- }
- continue;
- }
-
- stream.swap(handler->_stream);
- assert(stream.i == stream.b.end());
- }
-
- //
- // Provide a new mesage to the handler.
- //
- try
- {
- //
- // "self" is faster than "this", as the reference
- // count is not modified.
- //
- handler->message(stream, self);
- }
- catch(const LocalException& ex)
- {
- Error out(_instance->initializationData().logger);
- out << "exception in `" << _prefix << "' while calling message():\n"
- << ex << '\n' << handler->toString();
- }
-
- //
- // No "continue", because we want message() to be
- // called in its own thread from this pool. Note that
- // this means that message() must call
- // promoteFollower().
- //
- }
- }
+ //
+ // No "continue", because we want finished() to be
+ // called in its own thread from this pool. Note that
+ // this means that finished() must call
+ // promoteFollower().
+ //
+ }
+ else
+ {
+ //
+ // If the handler is "readable", try to read a
+ // message.
+ //
+ BasicStream stream(_instance.get());
+ if(handler->readable())
+ {
+ try
+ {
+ read(handler);
+ }
+ catch(const TimeoutException&) // Expected.
+ {
+ continue;
+ }
+ catch(const DatagramLimitException&) // Expected.
+ {
+ continue;
+ }
+ catch(const SocketException& ex)
+ {
+ handler->exception(ex);
+ continue;
+ }
+ catch(const LocalException& ex)
+ {
+ if(handler->datagram())
+ {
+ if(_instance->initializationData().properties->
+ getPropertyAsInt("Ice.Warn.Connections") > 0)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "datagram connection exception:\n" << ex << '\n' << handler->toString();
+ }
+ }
+ else
+ {
+ handler->exception(ex);
+ }
+ continue;
+ }
+
+ stream.swap(handler->_stream);
+ assert(stream.i == stream.b.end());
+ }
+
+ //
+ // Provide a new mesage to the handler.
+ //
+ try
+ {
+ //
+ // "self" is faster than "this", as the reference
+ // count is not modified.
+ //
+ handler->message(stream, self);
+ }
+ catch(const LocalException& ex)
+ {
+ Error out(_instance->initializationData().logger);
+ out << "exception in `" << _prefix << "' while calling message():\n"
+ << ex << '\n' << handler->toString();
+ }
+
+ //
+ // No "continue", because we want message() to be
+ // called in its own thread from this pool. Note that
+ // this means that message() must call
+ // promoteFollower().
+ //
+ }
+ }
- if(_sizeMax > 1)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(!_destroyed)
- {
- //
- // First we reap threads that have been destroyed before.
- //
- int sz = static_cast<int>(_threads.size());
- assert(_running <= sz);
- if(_running < sz)
- {
- vector<IceUtil::ThreadPtr>::iterator start =
- partition(_threads.begin(), _threads.end(), IceUtil::constMemFun(&IceUtil::Thread::isAlive));
+ if(_sizeMax > 1)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(!_destroyed)
+ {
+ //
+ // First we reap threads that have been destroyed before.
+ //
+ int sz = static_cast<int>(_threads.size());
+ assert(_running <= sz);
+ if(_running < sz)
+ {
+ vector<IceUtil::ThreadPtr>::iterator start =
+ partition(_threads.begin(), _threads.end(), IceUtil::constMemFun(&IceUtil::Thread::isAlive));
- for(vector<IceUtil::ThreadPtr>::iterator p = start; p != _threads.end(); ++p)
- {
- (*p)->getThreadControl().join();
- }
+ for(vector<IceUtil::ThreadPtr>::iterator p = start; p != _threads.end(); ++p)
+ {
+ (*p)->getThreadControl().join();
+ }
- _threads.erase(start, _threads.end());
- }
-
- //
- // Now we check if this thread can be destroyed, based
- // on a load factor.
- //
+ _threads.erase(start, _threads.end());
+ }
+
+ //
+ // Now we check if this thread can be destroyed, based
+ // on a load factor.
+ //
- //
- // The load factor jumps immediately to the number of
- // threads that are currently in use, but decays
- // exponentially if the number of threads in use is
- // smaller than the load factor. This reflects that we
- // create threads immediately when they are needed,
- // but want the number of threads to slowly decline to
- // the configured minimum.
- //
- double inUse = static_cast<double>(_inUse);
- if(_load < inUse)
- {
- _load = inUse;
- }
- else
- {
- const double loadFactor = 0.05; // TODO: Configurable?
- const double oneMinusLoadFactor = 1 - loadFactor;
- _load = _load * oneMinusLoadFactor + inUse * loadFactor;
- }
-
- if(_running > _size)
- {
- int load = static_cast<int>(_load + 0.5);
+ //
+ // The load factor jumps immediately to the number of
+ // threads that are currently in use, but decays
+ // exponentially if the number of threads in use is
+ // smaller than the load factor. This reflects that we
+ // create threads immediately when they are needed,
+ // but want the number of threads to slowly decline to
+ // the configured minimum.
+ //
+ double inUse = static_cast<double>(_inUse);
+ if(_load < inUse)
+ {
+ _load = inUse;
+ }
+ else
+ {
+ const double loadFactor = 0.05; // TODO: Configurable?
+ const double oneMinusLoadFactor = 1 - loadFactor;
+ _load = _load * oneMinusLoadFactor + inUse * loadFactor;
+ }
+
+ if(_running > _size)
+ {
+ int load = static_cast<int>(_load + 0.5);
- //
- // We add one to the load factor because on
- // additional thread is needed for select().
- //
- if(load + 1 < _running)
- {
- assert(_inUse > 0);
- --_inUse;
-
- assert(_running > 0);
- --_running;
-
- return false;
- }
- }
-
- assert(_inUse > 0);
- --_inUse;
- }
+ //
+ // We add one to the load factor because on
+ // additional thread is needed for select().
+ //
+ if(load + 1 < _running)
+ {
+ assert(_inUse > 0);
+ --_inUse;
+
+ assert(_running > 0);
+ --_running;
+
+ return false;
+ }
+ }
+
+ assert(_inUse > 0);
+ --_inUse;
+ }
- while(!_promote)
- {
- wait();
- }
-
- _promote = false;
- }
+ while(!_promote)
+ {
+ wait();
+ }
+
+ _promote = false;
+ }
}
}
@@ -875,32 +875,32 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
if(stream.b.size() == 0)
{
- stream.b.resize(headerSize);
- stream.i = stream.b.begin();
+ stream.b.resize(headerSize);
+ stream.i = stream.b.begin();
}
if(stream.i != stream.b.end())
{
- handler->read(stream);
- assert(stream.i == stream.b.end());
+ handler->read(stream);
+ assert(stream.i == stream.b.end());
}
ptrdiff_t pos = stream.i - stream.b.begin();
if(pos < headerSize)
{
- //
- // This situation is possible for small UDP packets.
- //
- throw IllegalMessageSizeException(__FILE__, __LINE__);
+ //
+ // This situation is possible for small UDP packets.
+ //
+ throw IllegalMessageSizeException(__FILE__, __LINE__);
}
stream.i = stream.b.begin();
const Byte* m;
stream.readBlob(m, static_cast<Int>(sizeof(magic)));
if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
{
- BadMagicException ex(__FILE__, __LINE__);
- ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic));
- throw ex;
+ BadMagicException ex(__FILE__, __LINE__);
+ ex.badMagic = Ice::ByteSeq(&m[0], &m[0] + sizeof(magic));
+ throw ex;
}
Byte pMajor;
Byte pMinor;
@@ -909,12 +909,12 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
if(pMajor != protocolMajor
|| static_cast<unsigned char>(pMinor) > static_cast<unsigned char>(protocolMinor))
{
- UnsupportedProtocolException ex(__FILE__, __LINE__);
- ex.badMajor = static_cast<unsigned char>(pMajor);
- ex.badMinor = static_cast<unsigned char>(pMinor);
- ex.major = static_cast<unsigned char>(protocolMajor);
- ex.minor = static_cast<unsigned char>(protocolMinor);
- throw ex;
+ UnsupportedProtocolException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(pMajor);
+ ex.badMinor = static_cast<unsigned char>(pMinor);
+ ex.major = static_cast<unsigned char>(protocolMajor);
+ ex.minor = static_cast<unsigned char>(protocolMinor);
+ throw ex;
}
Byte eMajor;
Byte eMinor;
@@ -923,12 +923,12 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
if(eMajor != encodingMajor
|| static_cast<unsigned char>(eMinor) > static_cast<unsigned char>(encodingMinor))
{
- UnsupportedEncodingException ex(__FILE__, __LINE__);
- ex.badMajor = static_cast<unsigned char>(eMajor);
- ex.badMinor = static_cast<unsigned char>(eMinor);
- ex.major = static_cast<unsigned char>(encodingMajor);
- ex.minor = static_cast<unsigned char>(encodingMinor);
- throw ex;
+ UnsupportedEncodingException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(eMajor);
+ ex.badMinor = static_cast<unsigned char>(eMinor);
+ ex.major = static_cast<unsigned char>(encodingMajor);
+ ex.minor = static_cast<unsigned char>(encodingMinor);
+ throw ex;
}
Byte messageType;
stream.read(messageType);
@@ -938,36 +938,36 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
stream.read(size);
if(size < headerSize)
{
- throw IllegalMessageSizeException(__FILE__, __LINE__);
+ throw IllegalMessageSizeException(__FILE__, __LINE__);
}
if(size > static_cast<Int>(_instance->messageSizeMax()))
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ throw MemoryLimitException(__FILE__, __LINE__);
}
if(size > static_cast<Int>(stream.b.size()))
{
- stream.b.resize(size);
+ stream.b.resize(size);
}
stream.i = stream.b.begin() + pos;
if(stream.i != stream.b.end())
{
- if(handler->datagram())
- {
- if(_warnUdp)
- {
- Warning out(_instance->initializationData().logger);
- out << "DatagramLimitException: maximum size of " << pos << " exceeded";
- stream.resize(0);
- stream.i = stream.b.begin();
- }
- throw DatagramLimitException(__FILE__, __LINE__);
- }
- else
- {
- handler->read(stream);
- assert(stream.i == stream.b.end());
- }
+ if(handler->datagram())
+ {
+ if(_warnUdp)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "DatagramLimitException: maximum size of " << pos << " exceeded";
+ stream.resize(0);
+ stream.i = stream.b.begin();
+ }
+ throw DatagramLimitException(__FILE__, __LINE__);
+ }
+ else
+ {
+ handler->read(stream);
+ assert(stream.i == stream.b.end());
+ }
}
}
@@ -988,39 +988,39 @@ IceInternal::ThreadPool::EventHandlerThread::run()
try
{
- promote = _pool->run();
+ promote = _pool->run();
}
catch(const Exception& ex)
- {
- Error out(_pool->_instance->initializationData().logger);
- out << "exception in `" << _pool->_prefix << "':\n" << ex;
- promote = true;
+ {
+ Error out(_pool->_instance->initializationData().logger);
+ out << "exception in `" << _pool->_prefix << "':\n" << ex;
+ promote = true;
}
catch(const std::exception& ex)
{
- Error out(_pool->_instance->initializationData().logger);
- out << "std::exception in `" << _pool->_prefix << "':\n" << ex.what();
- promote = true;
+ Error out(_pool->_instance->initializationData().logger);
+ out << "std::exception in `" << _pool->_prefix << "':\n" << ex.what();
+ promote = true;
}
catch(...)
{
- Error out(_pool->_instance->initializationData().logger);
- out << "unknown exception in `" << _pool->_prefix << "'";
- promote = true;
+ Error out(_pool->_instance->initializationData().logger);
+ out << "unknown exception in `" << _pool->_prefix << "'";
+ promote = true;
}
if(promote && _pool->_sizeMax > 1)
{
- //
- // Promote a follower, but w/o modifying _inUse or creating
- // new threads.
- //
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*_pool.get());
- assert(!_pool->_promote);
- _pool->_promote = true;
- _pool->notify();
- }
+ //
+ // Promote a follower, but w/o modifying _inUse or creating
+ // new threads.
+ //
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*_pool.get());
+ assert(!_pool->_promote);
+ _pool->_promote = true;
+ _pool->notify();
+ }
}
if(_pool->_instance->initializationData().threadHook)
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h
index a0ecc923a46..6cda824ee5e 100644
--- a/cpp/src/Ice/ThreadPool.h
+++ b/cpp/src/Ice/ThreadPool.h
@@ -94,13 +94,13 @@ private:
class EventHandlerThread : public IceUtil::Thread
{
public:
-
- EventHandlerThread(const ThreadPoolPtr&);
- virtual void run();
+
+ EventHandlerThread(const ThreadPoolPtr&);
+ virtual void run();
private:
- ThreadPoolPtr _pool;
+ ThreadPoolPtr _pool;
};
friend class EventHandlerThread;
diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp
index 6dfc11c029c..cc89bf153ee 100644
--- a/cpp/src/Ice/TraceUtil.cpp
+++ b/cpp/src/Ice/TraceUtil.cpp
@@ -53,29 +53,29 @@ printRequestHeader(ostream& s, BasicStream& stream)
s << "\nmode = " << static_cast<int>(mode) << ' ';
switch(mode)
{
- case Normal:
- {
- s << "(normal)";
- break;
- }
-
- case Nonmutating:
- {
- s << "(nonmutating)";
- break;
- }
-
- case Idempotent:
- {
- s << "(idempotent)";
- break;
- }
-
- default:
- {
- s << "(unknown)";
- break;
- }
+ case Normal:
+ {
+ s << "(normal)";
+ break;
+ }
+
+ case Nonmutating:
+ {
+ s << "(nonmutating)";
+ break;
+ }
+
+ case Idempotent:
+ {
+ s << "(idempotent)";
+ break;
+ }
+
+ default:
+ {
+ s << "(unknown)";
+ break;
+ }
}
Int sz;
@@ -83,14 +83,14 @@ printRequestHeader(ostream& s, BasicStream& stream)
s << "\ncontext = ";
while(sz--)
{
- pair<string, string> pair;
- stream.read(pair.first);
- stream.read(pair.second);
- s << pair.first << '/' << pair.second;
- if(sz)
- {
- s << ", ";
- }
+ pair<string, string> pair;
+ stream.read(pair.first);
+ stream.read(pair.second);
+ s << pair.first << '/' << pair.second;
+ if(sz)
+ {
+ s << ", ";
+ }
}
}
@@ -98,7 +98,7 @@ static void
printHeader(ostream& s, BasicStream& stream)
{
Byte magicNumber;
- stream.read(magicNumber); // Don't bother printing the magic number
+ stream.read(magicNumber); // Don't bother printing the magic number
stream.read(magicNumber);
stream.read(magicNumber);
stream.read(magicNumber);
@@ -123,41 +123,41 @@ printHeader(ostream& s, BasicStream& stream)
switch(type)
{
- case requestMsg:
- {
- s << "(request)";
- break;
- }
-
- case requestBatchMsg:
- {
- s << "(batch request)";
- break;
- }
-
- case replyMsg:
- {
- s << "(reply)";
- break;
- }
-
- case closeConnectionMsg:
- {
- s << "(close connection)";
- break;
- }
-
- case validateConnectionMsg:
- {
- s << "(validate connection)";
- break;
- }
-
- default:
- {
- s << "(unknown)";
- break;
- }
+ case requestMsg:
+ {
+ s << "(request)";
+ break;
+ }
+
+ case requestBatchMsg:
+ {
+ s << "(batch request)";
+ break;
+ }
+
+ case replyMsg:
+ {
+ s << "(reply)";
+ break;
+ }
+
+ case closeConnectionMsg:
+ {
+ s << "(close connection)";
+ break;
+ }
+
+ case validateConnectionMsg:
+ {
+ s << "(validate connection)";
+ break;
+ }
+
+ default:
+ {
+ s << "(unknown)";
+ break;
+ }
}
Byte compress;
@@ -166,29 +166,29 @@ printHeader(ostream& s, BasicStream& stream)
switch(compress)
{
- case 0:
- {
- s << "(not compressed; do not compress response, if any)";
- break;
- }
-
- case 1:
- {
- s << "(not compressed; compress response, if any)";
- break;
- }
-
- case 2:
- {
- s << "(compressed; compress response, if any)";
- break;
- }
-
- default:
- {
- s << "(unknown)";
- break;
- }
+ case 0:
+ {
+ s << "(not compressed; do not compress response, if any)";
+ break;
+ }
+
+ case 1:
+ {
+ s << "(not compressed; compress response, if any)";
+ break;
+ }
+
+ case 2:
+ {
+ s << "(compressed; compress response, if any)";
+ break;
+ }
+
+ default:
+ {
+ s << "(unknown)";
+ break;
+ }
}
Int size;
@@ -198,198 +198,198 @@ printHeader(ostream& s, BasicStream& stream)
void
IceInternal::traceHeader(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
if(tl->protocol >= 1)
{
- BasicStream& stream = const_cast<BasicStream&>(str);
- BasicStream::Container::iterator p = stream.i;
- stream.i = stream.b.begin();
+ BasicStream& stream = const_cast<BasicStream&>(str);
+ BasicStream::Container::iterator p = stream.i;
+ stream.i = stream.b.begin();
- ostringstream s;
- s << heading;
- printHeader(s, stream);
+ ostringstream s;
+ s << heading;
+ printHeader(s, stream);
- logger->trace(tl->protocolCat, s.str());
- stream.i = p;
+ logger->trace(tl->protocolCat, s.str());
+ stream.i = p;
}
}
void
IceInternal::traceRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
if(tl->protocol >= 1)
{
- BasicStream& stream = const_cast<BasicStream&>(str);
- BasicStream::Container::iterator p = stream.i;
- stream.i = stream.b.begin();
-
- ostringstream s;
- s << heading;
- printHeader(s, stream);
-
- Int requestId;
- stream.read(requestId);
- s << "\nrequest id = " << requestId;
- if(requestId == 0)
- {
- s << " (oneway)";
- }
-
- printRequestHeader(s, stream);
-
- logger->trace(tl->protocolCat, s.str());
- stream.i = p;
+ BasicStream& stream = const_cast<BasicStream&>(str);
+ BasicStream::Container::iterator p = stream.i;
+ stream.i = stream.b.begin();
+
+ ostringstream s;
+ s << heading;
+ printHeader(s, stream);
+
+ Int requestId;
+ stream.read(requestId);
+ s << "\nrequest id = " << requestId;
+ if(requestId == 0)
+ {
+ s << " (oneway)";
+ }
+
+ printRequestHeader(s, stream);
+
+ logger->trace(tl->protocolCat, s.str());
+ stream.i = p;
}
}
void
IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
if(tl->protocol >= 1)
{
- BasicStream& stream = const_cast<BasicStream&>(str);
- BasicStream::Container::iterator p = stream.i;
- stream.i = stream.b.begin();
-
- ostringstream s;
- s << heading;
- printHeader(s, stream);
-
- int batchRequestNum;
- stream.read(batchRequestNum);
- s << "\nnumber of requests = " << batchRequestNum;
-
- for(int i = 0; i < batchRequestNum; ++i)
- {
- s << "\nrequest #" << i << ':';
- printRequestHeader(s, stream);
- stream.skipEncaps();
- }
-
- logger->trace(tl->protocolCat, s.str());
- stream.i = p;
+ BasicStream& stream = const_cast<BasicStream&>(str);
+ BasicStream::Container::iterator p = stream.i;
+ stream.i = stream.b.begin();
+
+ ostringstream s;
+ s << heading;
+ printHeader(s, stream);
+
+ int batchRequestNum;
+ stream.read(batchRequestNum);
+ s << "\nnumber of requests = " << batchRequestNum;
+
+ for(int i = 0; i < batchRequestNum; ++i)
+ {
+ s << "\nrequest #" << i << ':';
+ printRequestHeader(s, stream);
+ stream.skipEncaps();
+ }
+
+ logger->trace(tl->protocolCat, s.str());
+ stream.i = p;
}
}
void
IceInternal::traceReply(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
if(tl->protocol >= 1)
{
- BasicStream& stream = const_cast<BasicStream&>(str);
- BasicStream::Container::iterator p = stream.i;
- stream.i = stream.b.begin();
-
- ostringstream s;
- s << heading;
- printHeader(s, stream);
-
- Int requestId;
- stream.read(requestId);
- s << "\nrequest id = " << requestId;
-
- Byte status;
- stream.read(status);
- s << "\nreply status = " << static_cast<int>(status) << ' ';
- switch(static_cast<DispatchStatus>(status))
- {
- case DispatchOK:
- {
- s << "(ok)";
- break;
- }
-
- case DispatchUserException:
- {
- s << "(user exception)";
- break;
- }
-
- case DispatchObjectNotExist:
- case DispatchFacetNotExist:
- case DispatchOperationNotExist:
- {
- switch(static_cast<DispatchStatus>(status))
- {
- case DispatchObjectNotExist:
- {
- s << "(object not exist)";
- break;
- }
-
- case DispatchFacetNotExist:
- {
- s << "(facet not exist)";
- break;
- }
-
- case DispatchOperationNotExist:
- {
- s << "(operation not exist)";
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- printIdentityFacetOperation(s, stream);
- break;
- }
-
- case DispatchUnknownException:
- case DispatchUnknownLocalException:
- case DispatchUnknownUserException:
- {
- switch(static_cast<DispatchStatus>(status))
- {
- case DispatchUnknownException:
- {
- s << "(unknown exception)";
- break;
- }
-
- case DispatchUnknownLocalException:
- {
- s << "(unknown local exception)";
- break;
- }
-
- case DispatchUnknownUserException:
- {
- s << "(unknown user exception)";
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- string unknown;
- stream.read(unknown, false);
- s << "\nunknown = " << unknown;
- break;
- }
-
- default:
- {
- s << "(unknown)";
- break;
- }
- }
-
- logger->trace(tl->protocolCat, s.str());
- stream.i = p;
+ BasicStream& stream = const_cast<BasicStream&>(str);
+ BasicStream::Container::iterator p = stream.i;
+ stream.i = stream.b.begin();
+
+ ostringstream s;
+ s << heading;
+ printHeader(s, stream);
+
+ Int requestId;
+ stream.read(requestId);
+ s << "\nrequest id = " << requestId;
+
+ Byte status;
+ stream.read(status);
+ s << "\nreply status = " << static_cast<int>(status) << ' ';
+ switch(static_cast<DispatchStatus>(status))
+ {
+ case DispatchOK:
+ {
+ s << "(ok)";
+ break;
+ }
+
+ case DispatchUserException:
+ {
+ s << "(user exception)";
+ break;
+ }
+
+ case DispatchObjectNotExist:
+ case DispatchFacetNotExist:
+ case DispatchOperationNotExist:
+ {
+ switch(static_cast<DispatchStatus>(status))
+ {
+ case DispatchObjectNotExist:
+ {
+ s << "(object not exist)";
+ break;
+ }
+
+ case DispatchFacetNotExist:
+ {
+ s << "(facet not exist)";
+ break;
+ }
+
+ case DispatchOperationNotExist:
+ {
+ s << "(operation not exist)";
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ printIdentityFacetOperation(s, stream);
+ break;
+ }
+
+ case DispatchUnknownException:
+ case DispatchUnknownLocalException:
+ case DispatchUnknownUserException:
+ {
+ switch(static_cast<DispatchStatus>(status))
+ {
+ case DispatchUnknownException:
+ {
+ s << "(unknown exception)";
+ break;
+ }
+
+ case DispatchUnknownLocalException:
+ {
+ s << "(unknown local exception)";
+ break;
+ }
+
+ case DispatchUnknownUserException:
+ {
+ s << "(unknown user exception)";
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ string unknown;
+ stream.read(unknown, false);
+ s << "\nunknown = " << unknown;
+ break;
+ }
+
+ default:
+ {
+ s << "(unknown)";
+ break;
+ }
+ }
+
+ logger->trace(tl->protocolCat, s.str());
+ stream.i = p;
}
}
@@ -402,9 +402,9 @@ IceInternal::traceSlicing(const char* kind, const string& typeId, const char* sl
static set<string> slicingIds;
if(slicingIds.insert(typeId).second)
{
- string s("unknown ");
- s += kind;
- s += " type `" + typeId + "'";
- logger->trace(slicingCat, s);
+ string s("unknown ");
+ s += kind;
+ s += " type `" + typeId + "'";
+ logger->trace(slicingCat, s);
}
}
diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp
index d3ca4a84719..6681e8becbf 100644
--- a/cpp/src/Ice/UdpEndpointI.cpp
+++ b/cpp/src/Ice/UdpEndpointI.cpp
@@ -21,7 +21,7 @@ using namespace Ice;
using namespace IceInternal;
IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const string& ho, Int po, bool conn,
- const string& conId, bool co, bool pub) :
+ const string& conId, bool co, bool pub) :
_instance(instance),
_host(ho),
_port(po),
@@ -54,209 +54,209 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin
while(true)
{
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- string option = str.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- string argument;
- string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if(argumentBeg != string::npos && str[argumentBeg] != '-')
- {
- beg = argumentBeg;
- end = str.find_first_of(delim + ":", beg);
- if(end == string::npos)
- {
- end = str.length();
- }
- argument = str.substr(beg, end - beg);
- }
-
- switch(option[1])
- {
- case 'v':
- {
- if(argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- string::size_type pos = argument.find('.');
- if(pos == string::npos)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
- string majorStr = argument.substr(0, pos);
- string minorStr = argument.substr(pos + 1, string::npos);
-
- istringstream majStr(majorStr);
- Int majVersion;
- if(!(majStr >> majVersion) || !majStr.eof())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- istringstream minStr(minorStr);
- Int minVersion;
- if(!(minStr >> minVersion) || !minStr.eof())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- if(majVersion < 1 || majVersion > 255 || minVersion < 0 || minVersion > 255)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- if(majVersion != protocolMajor)
- {
- UnsupportedProtocolException ex(__FILE__, __LINE__);
- ex.badMajor = majVersion;
- ex.badMinor = minVersion;
- ex.major = static_cast<unsigned char>(protocolMajor);
- ex.minor = static_cast<unsigned char>(protocolMinor);
- throw ex;
- }
-
- const_cast<Byte&>(_protocolMajor) = majVersion;
- const_cast<Byte&>(_protocolMinor) = minVersion;
-
- break;
- }
-
- case 'e':
- {
- if(argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
- string::size_type pos = argument.find('.');
- string majorStr = argument.substr(0, pos);
- string minorStr = argument.substr(pos + 1, string::npos);
-
- istringstream majStr(majorStr);
- Int majVersion;
- if(!(majStr >> majVersion) || !majStr.eof())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- istringstream minStr(minorStr);
- Int minVersion;
- if(!(minStr >> minVersion) || !minStr.eof())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- if(majVersion < 1 || majVersion > 255 || minVersion < 0 || minVersion > 255)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
-
- if(majVersion != static_cast<unsigned char>(encodingMajor))
- {
- UnsupportedEncodingException ex(__FILE__, __LINE__);
- ex.badMajor = majVersion;
- ex.badMinor = minVersion;
- ex.major = static_cast<unsigned char>(encodingMajor);
- ex.minor = static_cast<unsigned char>(encodingMinor);
- throw ex;
- }
-
- const_cast<Byte&>(_encodingMajor) = majVersion;
- const_cast<Byte&>(_encodingMinor) = minVersion;
-
- break;
- }
-
- case 'h':
- {
- if(argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
- const_cast<string&>(_host) = argument;
- break;
- }
-
- case 'p':
- {
- istringstream p(argument);
- if(!(p >> const_cast<Int&>(_port)) || !p.eof() || _port < 0 || _port > 65535)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
- break;
- }
-
- case 'c':
- {
- if(!argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
- const_cast<bool&>(_connect) = true;
- break;
- }
-
- case 'z':
- {
- if(!argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
- const_cast<bool&>(_compress) = true;
- break;
- }
-
- default:
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "udp " + str;
- throw ex;
- }
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ string option = str.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ string argument;
+ string::size_type argumentBeg = str.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
+ {
+ beg = argumentBeg;
+ end = str.find_first_of(delim + ":", beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+ argument = str.substr(beg, end - beg);
+ }
+
+ switch(option[1])
+ {
+ case 'v':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ string::size_type pos = argument.find('.');
+ if(pos == string::npos)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+ string majorStr = argument.substr(0, pos);
+ string minorStr = argument.substr(pos + 1, string::npos);
+
+ istringstream majStr(majorStr);
+ Int majVersion;
+ if(!(majStr >> majVersion) || !majStr.eof())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ istringstream minStr(minorStr);
+ Int minVersion;
+ if(!(minStr >> minVersion) || !minStr.eof())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ if(majVersion < 1 || majVersion > 255 || minVersion < 0 || minVersion > 255)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ if(majVersion != protocolMajor)
+ {
+ UnsupportedProtocolException ex(__FILE__, __LINE__);
+ ex.badMajor = majVersion;
+ ex.badMinor = minVersion;
+ ex.major = static_cast<unsigned char>(protocolMajor);
+ ex.minor = static_cast<unsigned char>(protocolMinor);
+ throw ex;
+ }
+
+ const_cast<Byte&>(_protocolMajor) = majVersion;
+ const_cast<Byte&>(_protocolMinor) = minVersion;
+
+ break;
+ }
+
+ case 'e':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+ string::size_type pos = argument.find('.');
+ string majorStr = argument.substr(0, pos);
+ string minorStr = argument.substr(pos + 1, string::npos);
+
+ istringstream majStr(majorStr);
+ Int majVersion;
+ if(!(majStr >> majVersion) || !majStr.eof())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ istringstream minStr(minorStr);
+ Int minVersion;
+ if(!(minStr >> minVersion) || !minStr.eof())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ if(majVersion < 1 || majVersion > 255 || minVersion < 0 || minVersion > 255)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+
+ if(majVersion != static_cast<unsigned char>(encodingMajor))
+ {
+ UnsupportedEncodingException ex(__FILE__, __LINE__);
+ ex.badMajor = majVersion;
+ ex.badMinor = minVersion;
+ ex.major = static_cast<unsigned char>(encodingMajor);
+ ex.minor = static_cast<unsigned char>(encodingMinor);
+ throw ex;
+ }
+
+ const_cast<Byte&>(_encodingMajor) = majVersion;
+ const_cast<Byte&>(_encodingMinor) = minVersion;
+
+ break;
+ }
+
+ case 'h':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+ const_cast<string&>(_host) = argument;
+ break;
+ }
+
+ case 'p':
+ {
+ istringstream p(argument);
+ if(!(p >> const_cast<Int&>(_port)) || !p.eof() || _port < 0 || _port > 65535)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 'c':
+ {
+ if(!argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+ const_cast<bool&>(_connect) = true;
+ break;
+ }
+
+ case 'z':
+ {
+ if(!argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+ const_cast<bool&>(_compress) = true;
+ break;
+ }
+
+ default:
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "udp " + str;
+ throw ex;
+ }
+ }
}
}
@@ -280,21 +280,21 @@ IceInternal::UdpEndpointI::UdpEndpointI(BasicStream* s) :
s->read(const_cast<Byte&>(_encodingMinor));
if(_protocolMajor != protocolMajor)
{
- UnsupportedProtocolException ex(__FILE__, __LINE__);
- ex.badMajor = _protocolMajor;
- ex.badMinor = _protocolMinor;
- ex.major = static_cast<unsigned char>(protocolMajor);
- ex.minor = static_cast<unsigned char>(protocolMinor);
- throw ex;
+ UnsupportedProtocolException ex(__FILE__, __LINE__);
+ ex.badMajor = _protocolMajor;
+ ex.badMinor = _protocolMinor;
+ ex.major = static_cast<unsigned char>(protocolMajor);
+ ex.minor = static_cast<unsigned char>(protocolMinor);
+ throw ex;
}
if(_encodingMajor != encodingMajor)
{
- UnsupportedEncodingException ex(__FILE__, __LINE__);
- ex.badMajor = _encodingMajor;
- ex.badMinor = _encodingMinor;
- ex.major = static_cast<unsigned char>(encodingMajor);
- ex.minor = static_cast<unsigned char>(encodingMinor);
- throw ex;
+ UnsupportedEncodingException ex(__FILE__, __LINE__);
+ ex.badMajor = _encodingMajor;
+ ex.badMinor = _encodingMinor;
+ ex.major = static_cast<unsigned char>(encodingMajor);
+ ex.minor = static_cast<unsigned char>(encodingMinor);
+ throw ex;
}
// Not transmitted.
//s->read(const_cast<bool&>(_connect));
@@ -335,28 +335,28 @@ IceInternal::UdpEndpointI::toString() const
if(_protocolMajor != Byte(1) || _protocolMinor != Byte(0))
{
- s << " -v "
- << static_cast<unsigned>(static_cast<unsigned char>(_protocolMajor)) << "."
- << static_cast<unsigned>(static_cast<unsigned char>(_protocolMinor));
+ s << " -v "
+ << static_cast<unsigned>(static_cast<unsigned char>(_protocolMajor)) << "."
+ << static_cast<unsigned>(static_cast<unsigned char>(_protocolMinor));
}
if(_encodingMajor != Byte(1) || _encodingMinor != Byte(0))
{
- s << " -e "
- << static_cast<unsigned>(static_cast<unsigned char>(_encodingMajor)) << "."
- << static_cast<unsigned>(static_cast<unsigned char>(_encodingMinor));
+ s << " -e "
+ << static_cast<unsigned>(static_cast<unsigned char>(_encodingMajor)) << "."
+ << static_cast<unsigned>(static_cast<unsigned char>(_encodingMinor));
}
s << " -h " << _host << " -p " << _port;
if(_connect)
{
- s << " -c";
+ s << " -c";
}
if(_compress)
{
- s << " -z";
+ s << " -z";
}
return s.str();
@@ -385,11 +385,11 @@ IceInternal::UdpEndpointI::connectionId(const string& connectionId) const
{
if(connectionId == _connectionId)
{
- return const_cast<UdpEndpointI*>(this);
+ return const_cast<UdpEndpointI*>(this);
}
else
{
- return new UdpEndpointI(_instance, _host, _port, _connect, connectionId, _compress, _publish);
+ return new UdpEndpointI(_instance, _host, _port, _connect, connectionId, _compress, _publish);
}
}
@@ -404,11 +404,11 @@ IceInternal::UdpEndpointI::compress(bool compress) const
{
if(compress == _compress)
{
- return const_cast<UdpEndpointI*>(this);
+ return const_cast<UdpEndpointI*>(this);
}
else
{
- return new UdpEndpointI(_instance, _host, _port, _connect, _connectionId, compress, _publish);
+ return new UdpEndpointI(_instance, _host, _port, _connect, _connectionId, compress, _publish);
}
}
@@ -487,7 +487,7 @@ IceInternal::UdpEndpointI::expand(bool server) const
for(unsigned int i = 0; i < hosts.size(); ++i)
{
endps.push_back(new UdpEndpointI(_instance, hosts[i], _port, _connect, _connectionId, _compress,
- hosts.size() == 1 || hosts[i] != "127.0.0.1"));
+ hosts.size() == 1 || hosts[i] != "127.0.0.1"));
}
}
else
@@ -509,7 +509,7 @@ IceInternal::UdpEndpointI::equivalent(const TransceiverPtr& transceiver) const
const UdpTransceiver* udpTransceiver = dynamic_cast<const UdpTransceiver*>(transceiver.get());
if(!udpTransceiver)
{
- return false;
+ return false;
}
return udpTransceiver->equivalent(_host, _port);
}
@@ -526,72 +526,72 @@ IceInternal::UdpEndpointI::operator==(const EndpointI& r) const
const UdpEndpointI* p = dynamic_cast<const UdpEndpointI*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_port != p->_port)
{
- return false;
+ return false;
}
if(_compress != p->_compress)
{
- return false;
+ return false;
}
if(_connectionId != p->_connectionId)
{
- return false;
+ return false;
}
if(_connect != p->_connect)
{
- return false;
+ return false;
}
if(_protocolMajor != p->_protocolMajor)
{
- return false;
+ return false;
}
if(_protocolMinor != p->_protocolMinor)
{
- return false;
+ return false;
}
if(_encodingMajor != p->_encodingMajor)
{
- return false;
+ return false;
}
if(_encodingMinor != p->_encodingMinor)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- struct sockaddr_in raddr;
- try
- {
- getAddress(_host, _port, laddr);
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ return false;
+ }
- return compareAddress(laddr, raddr);
+ return compareAddress(laddr, raddr);
}
return true;
@@ -614,112 +614,112 @@ IceInternal::UdpEndpointI::operator<(const EndpointI& r) const
if(this == p)
{
- return false;
+ return false;
}
if(_port < p->_port)
{
- return true;
+ return true;
}
else if(p->_port < _port)
{
- return false;
+ return false;
}
if(_connectionId < p->_connectionId)
{
- return true;
+ return true;
}
else if(p->_connectionId < _connectionId)
{
- return false;
+ return false;
}
if(!_compress && p->_compress)
{
- return true;
+ return true;
}
else if(p->_compress < _compress)
{
- return false;
+ return false;
}
if(!_connect && p->_connect)
{
- return true;
+ return true;
}
else if(!p->_connect && _connect)
{
- return false;
+ return false;
}
if(_protocolMajor < p->_protocolMajor)
{
- return true;
+ return true;
}
else if(p->_protocolMajor < _protocolMajor)
{
- return false;
+ return false;
}
if(_protocolMinor < p->_protocolMinor)
{
- return true;
+ return true;
}
else if(p->_protocolMinor < _protocolMinor)
{
- return false;
+ return false;
}
if(_encodingMajor < p->_encodingMajor)
{
- return true;
+ return true;
}
else if(p->_encodingMajor < _encodingMajor)
{
- return false;
+ return false;
}
if(_encodingMinor < p->_encodingMinor)
{
- return true;
+ return true;
}
else if(p->_encodingMinor < _encodingMinor)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- try
- {
- getAddress(_host, _port, laddr);
- }
- catch(const DNSException&)
- {
- }
-
- struct sockaddr_in raddr;
- try
- {
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- }
-
- if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
- {
- return true;
- }
- else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ {
+ return true;
+ }
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ {
+ return false;
+ }
}
return false;
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index f7e26883e38..4853d98aaa9 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -33,8 +33,8 @@ IceInternal::UdpTransceiver::close()
{
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "closing udp connection\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "closing udp connection\n" << toString();
}
assert(_fd != INVALID_SOCKET);
@@ -52,8 +52,8 @@ IceInternal::UdpTransceiver::shutdownReadWrite()
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "shutting down udp connection for reading and writing\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "shutting down udp connection for reading and writing\n" << toString();
}
//
@@ -84,10 +84,10 @@ IceInternal::UdpTransceiver::shutdownReadWrite()
//
if(!_connect)
{
- struct sockaddr_in unspec;
- memset(&unspec, 0, sizeof(unspec));
- unspec.sin_family = AF_UNSPEC;
- ::connect(_fd, reinterpret_cast<struct sockaddr*>(&unspec), int(sizeof(unspec)));
+ struct sockaddr_in unspec;
+ memset(&unspec, 0, sizeof(unspec));
+ unspec.sin_family = AF_UNSPEC;
+ ::connect(_fd, reinterpret_cast<struct sockaddr*>(&unspec), int(sizeof(unspec)));
}
//
@@ -117,10 +117,10 @@ IceInternal::UdpTransceiver::write(Buffer& buf, int)
const int packetSize = min(_maxPacketSize, _sndSize - _udpOverhead);
if(packetSize < static_cast<int>(buf.b.size()))
{
- //
- // We don't log a warning here because the client gets an exception anyway.
- //
- throw DatagramLimitException(__FILE__, __LINE__);
+ //
+ // We don't log a warning here because the client gets an exception anyway.
+ //
+ throw DatagramLimitException(__FILE__, __LINE__);
}
repeat:
@@ -128,62 +128,62 @@ repeat:
assert(_fd != INVALID_SOCKET);
#ifdef _WIN32
ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]),
- static_cast<int>(buf.b.size()), 0);
+ static_cast<int>(buf.b.size()), 0);
#else
ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]),
- buf.b.size(), 0);
+ buf.b.size(), 0);
#endif
if(ret == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeat;
- }
+ if(interrupted())
+ {
+ goto repeat;
+ }
- if(wouldBlock())
- {
- repeatSelect:
+ if(wouldBlock())
+ {
+ repeatSelect:
- assert(_fd != INVALID_SOCKET);
+ assert(_fd != INVALID_SOCKET);
#ifdef _WIN32
- FD_SET(_fd, &_wFdSet);
- int rs = ::select(static_cast<int>(_fd + 1), 0, &_wFdSet, 0, 0);
+ FD_SET(_fd, &_wFdSet);
+ int rs = ::select(static_cast<int>(_fd + 1), 0, &_wFdSet, 0, 0);
#else
- struct pollfd fdSet[1];
- fdSet[0].fd = _fd;
- fdSet[0].events = POLLOUT;
- int rs = ::poll(fdSet, 1, -1);
+ struct pollfd fdSet[1];
+ fdSet[0].fd = _fd;
+ fdSet[0].events = POLLOUT;
+ int rs = ::poll(fdSet, 1, -1);
#endif
- if(rs == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatSelect;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- goto repeat;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ if(rs == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatSelect;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ goto repeat;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
if(_traceLevels->network >= 3)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "sent " << ret << " bytes via udp\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "sent " << ret << " bytes via udp\n" << toString();
}
if(_stats)
{
- _stats->bytesSent(type(), static_cast<Int>(ret));
+ _stats->bytesSent(type(), static_cast<Int>(ret));
}
assert(ret == static_cast<ssize_t>(buf.b.size()));
@@ -203,16 +203,16 @@ IceInternal::UdpTransceiver::read(Buffer& buf, int)
const int packetSize = min(_maxPacketSize, _rcvSize - _udpOverhead);
if(packetSize < static_cast<int>(buf.b.size()))
{
- //
- // We log a warning here because this is the server side -- without the
- // the warning, there would only be silence.
- //
- if(_warn)
- {
- Warning out(_logger);
- out << "DatagramLimitException: maximum size of " << packetSize << " exceeded";
- }
- throw DatagramLimitException(__FILE__, __LINE__);
+ //
+ // We log a warning here because this is the server side -- without the
+ // the warning, there would only be silence.
+ //
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "DatagramLimitException: maximum size of " << packetSize << " exceeded";
+ }
+ throw DatagramLimitException(__FILE__, __LINE__);
}
buf.b.resize(packetSize);
buf.i = buf.b.begin();
@@ -223,107 +223,107 @@ repeat:
// Check the shutdown flag.
//
{
- IceUtil::Mutex::Lock sync(_shutdownReadWriteMutex);
- if(_shutdownReadWrite)
- {
- throw ConnectionLostException(__FILE__, __LINE__);
- }
+ IceUtil::Mutex::Lock sync(_shutdownReadWriteMutex);
+ if(_shutdownReadWrite)
+ {
+ throw ConnectionLostException(__FILE__, __LINE__);
+ }
}
ssize_t ret;
if(_connect)
{
- //
- // If we must connect, then we connect to the first peer that
- // sends us a packet.
- //
- struct sockaddr_in peerAddr;
- memset(&peerAddr, 0, sizeof(struct sockaddr_in));
- socklen_t len = static_cast<socklen_t>(sizeof(peerAddr));
- assert(_fd != INVALID_SOCKET);
- ret = recvfrom(_fd, reinterpret_cast<char*>(&buf.b[0]), packetSize,
- 0, reinterpret_cast<struct sockaddr*>(&peerAddr), &len);
- if(ret != SOCKET_ERROR)
- {
- doConnect(_fd, peerAddr, -1);
- _connect = false; // We are connected now.
-
- if(_traceLevels->network >= 1)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "connected udp socket\n" << toString();
- }
- }
+ //
+ // If we must connect, then we connect to the first peer that
+ // sends us a packet.
+ //
+ struct sockaddr_in peerAddr;
+ memset(&peerAddr, 0, sizeof(struct sockaddr_in));
+ socklen_t len = static_cast<socklen_t>(sizeof(peerAddr));
+ assert(_fd != INVALID_SOCKET);
+ ret = recvfrom(_fd, reinterpret_cast<char*>(&buf.b[0]), packetSize,
+ 0, reinterpret_cast<struct sockaddr*>(&peerAddr), &len);
+ if(ret != SOCKET_ERROR)
+ {
+ doConnect(_fd, peerAddr, -1);
+ _connect = false; // We are connected now.
+
+ if(_traceLevels->network >= 1)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "connected udp socket\n" << toString();
+ }
+ }
}
else
{
- assert(_fd != INVALID_SOCKET);
- ret = ::recv(_fd, reinterpret_cast<char*>(&buf.b[0]), packetSize, 0);
+ assert(_fd != INVALID_SOCKET);
+ ret = ::recv(_fd, reinterpret_cast<char*>(&buf.b[0]), packetSize, 0);
}
if(ret == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeat;
- }
-
- if(wouldBlock())
- {
- repeatSelect:
-
- assert(_fd != INVALID_SOCKET);
+ if(interrupted())
+ {
+ goto repeat;
+ }
+
+ if(wouldBlock())
+ {
+ repeatSelect:
+
+ assert(_fd != INVALID_SOCKET);
#ifdef _WIN32
- FD_SET(_fd, &_rFdSet);
- int rs = ::select(static_cast<int>(_fd + 1), &_rFdSet, 0, 0, 0);
+ FD_SET(_fd, &_rFdSet);
+ int rs = ::select(static_cast<int>(_fd + 1), &_rFdSet, 0, 0, 0);
#else
- struct pollfd fdSet[1];
- fdSet[0].fd = _fd;
- fdSet[0].events = POLLIN;
- int rs = ::poll(fdSet, 1, -1);
+ struct pollfd fdSet[1];
+ fdSet[0].fd = _fd;
+ fdSet[0].events = POLLIN;
+ int rs = ::poll(fdSet, 1, -1);
#endif
- if(rs == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatSelect;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- goto repeat;
- }
-
- if(recvTruncated())
- {
- DatagramLimitException ex(__FILE__, __LINE__);
- if(_warn)
- {
- Warning out(_logger);
- out << "DatagramLimitException: maximum size of " << packetSize << " exceeded";
- }
- throw ex;
-
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ if(rs == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatSelect;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ goto repeat;
+ }
+
+ if(recvTruncated())
+ {
+ DatagramLimitException ex(__FILE__, __LINE__);
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "DatagramLimitException: maximum size of " << packetSize << " exceeded";
+ }
+ throw ex;
+
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
if(_traceLevels->network >= 3)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "received " << ret << " bytes via udp\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "received " << ret << " bytes via udp\n" << toString();
}
if(_stats)
{
- _stats->bytesReceived(type(), static_cast<Int>(ret));
+ _stats->bytesReceived(type(), static_cast<Int>(ret));
}
buf.b.resize(ret);
@@ -352,12 +352,12 @@ IceInternal::UdpTransceiver::checkSendSize(const Buffer& buf, size_t messageSize
{
if(buf.b.size() > messageSizeMax)
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ throw MemoryLimitException(__FILE__, __LINE__);
}
const int packetSize = min(_maxPacketSize, _sndSize - _udpOverhead);
if(packetSize < static_cast<int>(buf.b.size()))
{
- throw DatagramLimitException(__FILE__, __LINE__);
+ throw DatagramLimitException(__FILE__, __LINE__);
}
}
@@ -386,23 +386,23 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
{
try
{
- _fd = createSocket(true);
- setBufSize(instance);
- setBlock(_fd, false);
- getAddress(host, port, _addr);
- doConnect(_fd, _addr, -1);
- _connect = false; // We're connected now
-
- if(_traceLevels->network >= 1)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "starting to send udp packets\n" << toString();
- }
+ _fd = createSocket(true);
+ setBufSize(instance);
+ setBlock(_fd, false);
+ getAddress(host, port, _addr);
+ doConnect(_fd, _addr, -1);
+ _connect = false; // We're connected now
+
+ if(_traceLevels->network >= 1)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "starting to send udp packets\n" << toString();
+ }
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
#ifdef _WIN32
@@ -422,27 +422,27 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
{
try
{
- _fd = createSocket(true);
- setBufSize(instance);
- setBlock(_fd, false);
- getAddress(host, port, _addr);
- if(_traceLevels->network >= 2)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "attempting to bind to udp socket " << addrToString(_addr);
- }
- doBind(_fd, _addr);
-
- if(_traceLevels->network >= 1)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "starting to receive udp packets\n" << toString();
- }
+ _fd = createSocket(true);
+ setBufSize(instance);
+ setBlock(_fd, false);
+ getAddress(host, port, _addr);
+ if(_traceLevels->network >= 2)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "attempting to bind to udp socket " << addrToString(_addr);
+ }
+ doBind(_fd, _addr);
+
+ if(_traceLevels->network >= 1)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "starting to receive udp packets\n" << toString();
+ }
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
#ifdef _WIN32
@@ -467,66 +467,66 @@ IceInternal::UdpTransceiver::setBufSize(const InstancePtr& instance)
for(int i = 0; i < 2; ++i)
{
- string direction;
- string prop;
- int* addr;
- int dfltSize;
- if(i == 0)
- {
- direction = "receive";
- prop = "Ice.UDP.RcvSize";
- addr = &_rcvSize;
- dfltSize = getRecvBufferSize(_fd);
- _rcvSize = dfltSize;
- }
- else
- {
- direction = "send";
- prop = "Ice.UDP.SndSize";
- addr = &_sndSize;
- dfltSize = getSendBufferSize(_fd);
- _sndSize = dfltSize;
- }
-
- //
- // Get property for buffer size and check for sanity.
- //
- Int sizeRequested = instance->initializationData().properties->getPropertyAsIntWithDefault(prop, dfltSize);
- if(sizeRequested < _udpOverhead)
- {
- Warning out(_logger);
- out << "Invalid " << prop << " value of " << sizeRequested << " adjusted to " << dfltSize;
- sizeRequested = dfltSize;
- }
-
- if(sizeRequested != dfltSize)
- {
- //
- // Try to set the buffer size. The kernel will silently adjust
- // the size to an acceptable value. Then read the size back to
- // get the size that was actually set.
- //
- if(i == 0)
- {
- setRecvBufferSize(_fd, sizeRequested);
- *addr = getRecvBufferSize(_fd);
- }
- else
- {
- setSendBufferSize(_fd, sizeRequested);
- *addr = getSendBufferSize(_fd);
- }
-
- //
- // Warn if the size that was set is less than the requested size.
- //
- if(*addr < sizeRequested)
- {
- Warning out(_logger);
- out << "UDP " << direction << " buffer size: requested size of "
- << sizeRequested << " adjusted to " << *addr;
- }
- }
+ string direction;
+ string prop;
+ int* addr;
+ int dfltSize;
+ if(i == 0)
+ {
+ direction = "receive";
+ prop = "Ice.UDP.RcvSize";
+ addr = &_rcvSize;
+ dfltSize = getRecvBufferSize(_fd);
+ _rcvSize = dfltSize;
+ }
+ else
+ {
+ direction = "send";
+ prop = "Ice.UDP.SndSize";
+ addr = &_sndSize;
+ dfltSize = getSendBufferSize(_fd);
+ _sndSize = dfltSize;
+ }
+
+ //
+ // Get property for buffer size and check for sanity.
+ //
+ Int sizeRequested = instance->initializationData().properties->getPropertyAsIntWithDefault(prop, dfltSize);
+ if(sizeRequested < _udpOverhead)
+ {
+ Warning out(_logger);
+ out << "Invalid " << prop << " value of " << sizeRequested << " adjusted to " << dfltSize;
+ sizeRequested = dfltSize;
+ }
+
+ if(sizeRequested != dfltSize)
+ {
+ //
+ // Try to set the buffer size. The kernel will silently adjust
+ // the size to an acceptable value. Then read the size back to
+ // get the size that was actually set.
+ //
+ if(i == 0)
+ {
+ setRecvBufferSize(_fd, sizeRequested);
+ *addr = getRecvBufferSize(_fd);
+ }
+ else
+ {
+ setSendBufferSize(_fd, sizeRequested);
+ *addr = getSendBufferSize(_fd);
+ }
+
+ //
+ // Warn if the size that was set is less than the requested size.
+ //
+ if(*addr < sizeRequested)
+ {
+ Warning out(_logger);
+ out << "UDP " << direction << " buffer size: requested size of "
+ << sizeRequested << " adjusted to " << *addr;
+ }
+ }
}
}
diff --git a/cpp/src/Ice/UnknownEndpointI.cpp b/cpp/src/Ice/UnknownEndpointI.cpp
index 80a3b5c5b1d..12a46a347dc 100644
--- a/cpp/src/Ice/UnknownEndpointI.cpp
+++ b/cpp/src/Ice/UnknownEndpointI.cpp
@@ -153,12 +153,12 @@ IceInternal::UnknownEndpointI::operator==(const EndpointI& r) const
const UnknownEndpointI* p = dynamic_cast<const UnknownEndpointI*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_type != p->_type)
@@ -168,7 +168,7 @@ IceInternal::UnknownEndpointI::operator==(const EndpointI& r) const
if(_rawBytes != p->_rawBytes)
{
- return false;
+ return false;
}
return true;
@@ -191,25 +191,25 @@ IceInternal::UnknownEndpointI::operator<(const EndpointI& r) const
if(this == p)
{
- return false;
+ return false;
}
if(_type < p->_type)
{
- return true;
+ return true;
}
else if(p->_type < _type)
{
- return false;
+ return false;
}
if(_rawBytes < p->_rawBytes)
{
- return true;
+ return true;
}
else if(p->_rawBytes < _rawBytes)
{
- return false;
+ return false;
}
return false;
diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp
index 777f6bc0054..74234008973 100644
--- a/cpp/src/IceBox/Admin.cpp
+++ b/cpp/src/IceBox/Admin.cpp
@@ -58,24 +58,24 @@ Client::run(int argc, char* argv[])
vector<string> commands;
try
{
- commands = opts.parse(argc, (const char**)argv);
+ commands = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
cerr << e.reason << endl;
- usage();
- return EXIT_FAILURE;
+ usage();
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage();
- return EXIT_SUCCESS;
+ usage();
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
if(commands.empty())
@@ -93,34 +93,34 @@ Client::run(int argc, char* argv[])
if(properties->getProperty("Ice.Default.Locator").empty())
{
//
- // DEPRECATED PROPERTY: Remove extra code in future release.
- //
- string managerEndpoints =
- properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.Endpoints",
- properties->getProperty("IceBox.ServiceManager.Endpoints"));
- if(managerEndpoints.empty())
- {
- cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.Endpoints' is not set" << endl;
- return EXIT_FAILURE;
- }
-
- managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" :" + managerEndpoints;
+ // DEPRECATED PROPERTY: Remove extra code in future release.
+ //
+ string managerEndpoints =
+ properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.Endpoints",
+ properties->getProperty("IceBox.ServiceManager.Endpoints"));
+ if(managerEndpoints.empty())
+ {
+ cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.Endpoints' is not set" << endl;
+ return EXIT_FAILURE;
+ }
+
+ managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" :" + managerEndpoints;
}
else
{
//
- // DEPRECATED PROPERTY: Remove extra code in future release.
- //
- string managerAdapterId =
- properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.AdapterId",
- properties->getProperty("IceBox.ServiceManager.AdapterId"));
- if(managerAdapterId.empty())
- {
- cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.AdapterId' is not set" << endl;
- return EXIT_FAILURE;
- }
-
- managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" @" + managerAdapterId;
+ // DEPRECATED PROPERTY: Remove extra code in future release.
+ //
+ string managerAdapterId =
+ properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.AdapterId",
+ properties->getProperty("IceBox.ServiceManager.AdapterId"));
+ if(managerAdapterId.empty())
+ {
+ cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.AdapterId' is not set" << endl;
+ return EXIT_FAILURE;
+ }
+
+ managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" @" + managerAdapterId;
}
ObjectPrx base = communicator()->stringToProxy(managerProxy);
@@ -154,48 +154,48 @@ Client::run(int argc, char* argv[])
{
manager->shutdown();
}
- else if((*r) == "start")
- {
- if(++r == commands.end())
- {
+ else if((*r) == "start")
+ {
+ if(++r == commands.end())
+ {
cerr << appName() << ": no service name specified." << endl;
return EXIT_FAILURE;
- }
-
- try
- {
- manager->startService(*r);
- }
- catch(const IceBox::NoSuchServiceException&)
- {
+ }
+
+ try
+ {
+ manager->startService(*r);
+ }
+ catch(const IceBox::NoSuchServiceException&)
+ {
cerr << appName() << ": unknown service `" << *r << "'" << endl;
- }
- catch(const IceBox::AlreadyStartedException&)
- {
+ }
+ catch(const IceBox::AlreadyStartedException&)
+ {
cerr << appName() << ": service already started." << endl;
- }
- }
- else if((*r) == "stop")
- {
- if(++r == commands.end())
- {
+ }
+ }
+ else if((*r) == "stop")
+ {
+ if(++r == commands.end())
+ {
cerr << appName() << ": no service name specified." << endl;
return EXIT_FAILURE;
- }
-
- try
- {
- manager->stopService(*r);
- }
- catch(const IceBox::NoSuchServiceException&)
- {
+ }
+
+ try
+ {
+ manager->stopService(*r);
+ }
+ catch(const IceBox::NoSuchServiceException&)
+ {
cerr << appName() << ": unknown service `" << *r << "'" << endl;
- }
- catch(const IceBox::AlreadyStoppedException&)
- {
+ }
+ catch(const IceBox::AlreadyStoppedException&)
+ {
cerr << appName() << ": service already stopped." << endl;
- }
- }
+ }
+ }
else
{
cerr << appName() << ": unknown command `" << *r << "'" << endl;
diff --git a/cpp/src/IceBox/Service.cpp b/cpp/src/IceBox/Service.cpp
index 881c263fe25..295d0c45817 100644
--- a/cpp/src/IceBox/Service.cpp
+++ b/cpp/src/IceBox/Service.cpp
@@ -88,7 +88,7 @@ IceBox::IceBoxService::stop()
if(_serviceManager)
{
_serviceManager->stop();
- _serviceManager = 0;
+ _serviceManager = 0;
}
return true;
}
@@ -129,8 +129,8 @@ IceBox::IceBoxService::usage(const string& appName)
"\n"
"--daemon Run as a daemon.\n"
"--noclose Do not close open file descriptors.\n"
- "--nochdir Do not change the current working directory.\n"
- "--pidfile <file> Write process ID to <file>."
+ "--nochdir Do not change the current working directory.\n"
+ "--pidfile <file> Write process ID to <file>."
);
#endif
print("Usage: " + appName + " [options]\n" + options);
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index c3097d5b99e..047be74601b 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -53,33 +53,33 @@ IceBox::ServiceManagerI::startService(const string& name, const Current&)
vector<ServiceInfo>::iterator p;
for(p = _services.begin(); p != _services.end(); ++p)
{
- ServiceInfo& info = *p;
- if(info.name == name)
- {
- if(info.active)
- {
- throw AlreadyStartedException();
- }
-
- try
- {
- info.service->start(name, info.communicator == 0 ? _communicator : info.communicator, info.args);
- info.active = true;
- }
- catch(const Ice::Exception& ex)
- {
+ ServiceInfo& info = *p;
+ if(info.name == name)
+ {
+ if(info.active)
+ {
+ throw AlreadyStartedException();
+ }
+
+ try
+ {
+ info.service->start(name, info.communicator == 0 ? _communicator : info.communicator, info.args);
+ info.active = true;
+ }
+ catch(const Ice::Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: exception in start for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in start for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in start for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in start for service " << info.name;
+ }
- return;
- }
+ return;
+ }
}
throw NoSuchServiceException();
@@ -97,33 +97,33 @@ IceBox::ServiceManagerI::stopService(const string& name, const Current&)
vector<ServiceInfo>::iterator p;
for(p = _services.begin(); p != _services.end(); ++p)
{
- ServiceInfo& info = *p;
- if(info.name == name)
- {
- if(!info.active)
- {
- throw AlreadyStoppedException();
- }
-
- try
- {
- info.service->stop();
- info.active = false;
- }
- catch(const Ice::Exception& ex)
- {
+ ServiceInfo& info = *p;
+ if(info.name == name)
+ {
+ if(!info.active)
+ {
+ throw AlreadyStoppedException();
+ }
+
+ try
+ {
+ info.service->stop();
+ info.active = false;
+ }
+ catch(const Ice::Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
- return;
- }
+ return;
+ }
}
throw NoSuchServiceException();
@@ -149,10 +149,10 @@ IceBox::ServiceManagerI::start()
//
ObjectAdapterPtr adapter = _communicator->createObjectAdapter("IceBox.ServiceManager");
- PropertiesPtr properties = _communicator->getProperties();
+ PropertiesPtr properties = _communicator->getProperties();
Identity identity;
- identity.category = properties->getPropertyWithDefault("IceBox.InstanceName", "IceBox");
- identity.name = "ServiceManager";
+ identity.category = properties->getPropertyWithDefault("IceBox.InstanceName", "IceBox");
+ identity.name = "ServiceManager";
adapter->add(obj, identity);
//
@@ -191,7 +191,7 @@ IceBox::ServiceManagerI::start()
//
const string prefix = "IceBox.Service.";
PropertyDict services = properties->getPropertiesForPrefix(prefix);
- PropertyDict::iterator p;
+ PropertyDict::iterator p;
for(StringSeq::const_iterator q = loadOrder.begin(); q != loadOrder.end(); ++q)
{
p = services.find(prefix + *q);
@@ -204,8 +204,8 @@ IceBox::ServiceManagerI::start()
load(*q, p->second);
services.erase(p);
}
- for(p = services.begin(); p != services.end(); ++p)
- {
+ for(p = services.begin(); p != services.end(); ++p)
+ {
string name = p->first.substr(prefix.size());
load(name, p->second);
}
@@ -228,16 +228,16 @@ IceBox::ServiceManagerI::start()
cout << bundleName << " ready" << endl;
}
- try
- {
- adapter->activate();
- }
- catch(const ObjectAdapterDeactivatedException&)
- {
- //
- // Expected if the communicator has been shutdown.
- //
- }
+ try
+ {
+ adapter->activate();
+ }
+ catch(const ObjectAdapterDeactivatedException&)
+ {
+ //
+ // Expected if the communicator has been shutdown.
+ //
+ }
}
catch(const FailureException& ex)
{
@@ -279,16 +279,16 @@ IceBox::ServiceManagerI::load(const string& name, const string& value)
else
{
entryPoint = value.substr(0, pos);
- try
- {
- args = IceUtil::Options::split(value.substr(pos + 1));
- }
- catch(const IceUtil::BadOptException& ex)
- {
- FailureException e(__FILE__, __LINE__);
- e.reason = "ServiceManager: invalid arguments for service `" + name + "':\n" + ex.reason;
- throw e;
- }
+ try
+ {
+ args = IceUtil::Options::split(value.substr(pos + 1));
+ }
+ catch(const IceUtil::BadOptException& ex)
+ {
+ FailureException e(__FILE__, __LINE__);
+ e.reason = "ServiceManager: invalid arguments for service `" + name + "':\n" + ex.reason;
+ throw e;
+ }
}
start(name, entryPoint, args);
}
@@ -363,148 +363,148 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
//
try
{
- //
- // If Ice.UseSharedCommunicator.<name> is not defined, create
- // a communicator for the service. The communicator inherits
- // from the shared communicator properties. If it's defined
- // add the service properties to the shared commnunicator
- // property set.
- //
- PropertiesPtr properties = _communicator->getProperties();
-
-
- if(properties->getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0)
- {
- PropertiesPtr serviceProperties = createProperties(info.args, properties);
-
- //
- // Erase properties in 'properties'
- //
- PropertyDict allProps = properties->getPropertiesForPrefix("");
- for(PropertyDict::iterator p = allProps.begin(); p != allProps.end(); ++p)
- {
- if(serviceProperties->getProperty(p->first) == "")
- {
- properties->setProperty(p->first, "");
- }
- }
-
- //
- // Put all serviceProperties into 'properties'
- //
- properties->parseCommandLineOptions("", serviceProperties->getCommandLineOptions());
-
- //
- // Parse <service>.* command line options
- // (the Ice command line options were parse by the createProperties above)
- //
- info.args = properties->parseCommandLineOptions(service, info.args);
- }
- else
- {
- string name = properties->getProperty("Ice.ProgramName");
- PropertiesPtr serviceProperties;
- if(properties->getPropertyAsInt("IceBox.InheritContainerProperties") > 0)
- {
- serviceProperties = createProperties(info.args, properties);
- }
- else
- {
- serviceProperties = createProperties(info.args);
- }
-
- if(name == serviceProperties->getProperty("Ice.ProgramName"))
- {
- //
- // If the service did not set its own program-name, and
- // the icebox program-name != service, append the service name to the
- // program name.
- //
- if(name != service)
- {
- name = name.empty() ? service : name + "-" + service;
- }
- serviceProperties->setProperty("Ice.ProgramName", name);
- }
-
- //
- // Parse <service>.* command line options
- // (the Ice command line options were parsed by the createProperties above)
- //
- info.args = serviceProperties->parseCommandLineOptions(service, info.args);
-
- //
- // Remaining command line options are passed to the
- // communicator with argc/argv. This is necessary for Ice
- // plugin properties (e.g.: IceSSL).
- //
- int argc = static_cast<int>(info.args.size());
- char** argv = new char*[argc + 1];
- int i = 0;
- for(Ice::StringSeq::const_iterator p = info.args.begin(); p != info.args.end(); ++p, ++i)
- {
- argv[i] = strdup(p->c_str());
- }
- argv[argc] = 0;
-
- InitializationData initData;
- initData.properties = serviceProperties;
- info.communicator = initialize(argc, argv, initData);
-
- for(i = 0; i < argc + 1; ++i)
- {
- free(argv[i]);
- }
- delete[] argv;
- }
-
- CommunicatorPtr communicator = info.communicator ? info.communicator : _communicator;
-
- //
- // Start the service.
- //
- try
- {
- info.service->start(service, communicator, info.args);
- info.active = true;
- }
- catch(...)
- {
- if(info.communicator)
- {
- try
- {
- info.communicator->shutdown();
- info.communicator->waitForShutdown();
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- //
- // Ignore, the service might have already destroyed
- // the communicator for its own reasons.
- //
- }
- catch(const Ice::Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
- out << ex;
- }
-
- try
- {
- info.communicator->destroy();
- info.communicator = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
- out << ex;
- }
- }
- throw;
- }
+ //
+ // If Ice.UseSharedCommunicator.<name> is not defined, create
+ // a communicator for the service. The communicator inherits
+ // from the shared communicator properties. If it's defined
+ // add the service properties to the shared commnunicator
+ // property set.
+ //
+ PropertiesPtr properties = _communicator->getProperties();
+
+
+ if(properties->getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0)
+ {
+ PropertiesPtr serviceProperties = createProperties(info.args, properties);
+
+ //
+ // Erase properties in 'properties'
+ //
+ PropertyDict allProps = properties->getPropertiesForPrefix("");
+ for(PropertyDict::iterator p = allProps.begin(); p != allProps.end(); ++p)
+ {
+ if(serviceProperties->getProperty(p->first) == "")
+ {
+ properties->setProperty(p->first, "");
+ }
+ }
+
+ //
+ // Put all serviceProperties into 'properties'
+ //
+ properties->parseCommandLineOptions("", serviceProperties->getCommandLineOptions());
+
+ //
+ // Parse <service>.* command line options
+ // (the Ice command line options were parse by the createProperties above)
+ //
+ info.args = properties->parseCommandLineOptions(service, info.args);
+ }
+ else
+ {
+ string name = properties->getProperty("Ice.ProgramName");
+ PropertiesPtr serviceProperties;
+ if(properties->getPropertyAsInt("IceBox.InheritContainerProperties") > 0)
+ {
+ serviceProperties = createProperties(info.args, properties);
+ }
+ else
+ {
+ serviceProperties = createProperties(info.args);
+ }
+
+ if(name == serviceProperties->getProperty("Ice.ProgramName"))
+ {
+ //
+ // If the service did not set its own program-name, and
+ // the icebox program-name != service, append the service name to the
+ // program name.
+ //
+ if(name != service)
+ {
+ name = name.empty() ? service : name + "-" + service;
+ }
+ serviceProperties->setProperty("Ice.ProgramName", name);
+ }
+
+ //
+ // Parse <service>.* command line options
+ // (the Ice command line options were parsed by the createProperties above)
+ //
+ info.args = serviceProperties->parseCommandLineOptions(service, info.args);
+
+ //
+ // Remaining command line options are passed to the
+ // communicator with argc/argv. This is necessary for Ice
+ // plugin properties (e.g.: IceSSL).
+ //
+ int argc = static_cast<int>(info.args.size());
+ char** argv = new char*[argc + 1];
+ int i = 0;
+ for(Ice::StringSeq::const_iterator p = info.args.begin(); p != info.args.end(); ++p, ++i)
+ {
+ argv[i] = strdup(p->c_str());
+ }
+ argv[argc] = 0;
+
+ InitializationData initData;
+ initData.properties = serviceProperties;
+ info.communicator = initialize(argc, argv, initData);
+
+ for(i = 0; i < argc + 1; ++i)
+ {
+ free(argv[i]);
+ }
+ delete[] argv;
+ }
+
+ CommunicatorPtr communicator = info.communicator ? info.communicator : _communicator;
+
+ //
+ // Start the service.
+ //
+ try
+ {
+ info.service->start(service, communicator, info.args);
+ info.active = true;
+ }
+ catch(...)
+ {
+ if(info.communicator)
+ {
+ try
+ {
+ info.communicator->shutdown();
+ info.communicator->waitForShutdown();
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ //
+ // Ignore, the service might have already destroyed
+ // the communicator for its own reasons.
+ //
+ }
+ catch(const Ice::Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
+ out << ex;
+ }
+
+ try
+ {
+ info.communicator->destroy();
+ info.communicator = 0;
+ }
+ catch(const Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
+ out << ex;
+ }
+ }
+ throw;
+ }
info.library = library;
_services.push_back(info);
@@ -515,12 +515,12 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
}
catch(const Exception& ex)
{
- ostringstream s;
- s << "ServiceManager: exception while starting service " << service << ":\n";
- s << ex;
+ ostringstream s;
+ s << "ServiceManager: exception while starting service " << service << ":\n";
+ s << ex;
- FailureException e(__FILE__, __LINE__);
- e.reason = s.str();
+ FailureException e(__FILE__, __LINE__);
+ e.reason = s.str();
throw e;
}
}
@@ -541,103 +541,103 @@ IceBox::ServiceManagerI::stopAll()
//
for(p = _services.rbegin(); p != _services.rend(); ++p)
{
- ServiceInfo& info = *p;
- try
- {
- info.service->stop();
- info.active = false;
- }
- catch(const Ice::Exception& ex)
- {
+ ServiceInfo& info = *p;
+ try
+ {
+ info.service->stop();
+ info.active = false;
+ }
+ catch(const Ice::Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
}
for(p = _services.rbegin(); p != _services.rend(); ++p)
{
- ServiceInfo& info = *p;
-
- if(info.communicator)
- {
- try
- {
- info.communicator->shutdown();
- info.communicator->waitForShutdown();
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- //
- // Ignore, the service might have already destroyed
- // the communicator for its own reasons.
- //
- }
- catch(const Ice::Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- }
-
- //
- // Release the service, the service communicator and then the library. The order is important,
- // the service must be released before destroying the communicator so that the communicator
- // leak detector doesn't report potential leaks, and the communicator must be destroyed before
- // the library is released since the library will destroy its global state.
- //
- try
- {
- info.service = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ ServiceInfo& info = *p;
+
+ if(info.communicator)
+ {
+ try
+ {
+ info.communicator->shutdown();
+ info.communicator->waitForShutdown();
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ //
+ // Ignore, the service might have already destroyed
+ // the communicator for its own reasons.
+ //
+ }
+ catch(const Ice::Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ }
+
+ //
+ // Release the service, the service communicator and then the library. The order is important,
+ // the service must be released before destroying the communicator so that the communicator
+ // leak detector doesn't report potential leaks, and the communicator must be destroyed before
+ // the library is released since the library will destroy its global state.
+ //
+ try
+ {
+ info.service = 0;
+ }
+ catch(const Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
-
- if(info.communicator)
- {
- try
- {
- info.communicator->destroy();
- info.communicator = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- }
-
- try
- {
- info.library = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
+
+ if(info.communicator)
+ {
+ try
+ {
+ info.communicator->destroy();
+ info.communicator = 0;
+ }
+ catch(const Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ }
+
+ try
+ {
+ info.library = 0;
+ }
+ catch(const Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
}
_services.clear();
diff --git a/cpp/src/IceBox/ServiceManagerI.h b/cpp/src/IceBox/ServiceManagerI.h
index 95a12ad6096..5484aa7b3fa 100644
--- a/cpp/src/IceBox/ServiceManagerI.h
+++ b/cpp/src/IceBox/ServiceManagerI.h
@@ -39,10 +39,10 @@ public:
::std::string name;
ServicePtr service;
::IceInternal::DynamicLibraryPtr library;
- ::Ice::CommunicatorPtr communicator;
- ::std::string envName;
- bool active;
- Ice::StringSeq args;
+ ::Ice::CommunicatorPtr communicator;
+ ::std::string envName;
+ bool active;
+ Ice::StringSeq args;
};
bool start();
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp
index c9535ba7814..8d6c04aa3ca 100644
--- a/cpp/src/IceGrid/Activator.cpp
+++ b/cpp/src/IceGrid/Activator.cpp
@@ -41,14 +41,14 @@ class TerminationListenerThread : public IceUtil::Thread
public:
TerminationListenerThread(Activator& activator) :
- _activator(activator)
+ _activator(activator)
{
}
virtual
void run()
{
- _activator.runTerminationListener();
+ _activator.runTerminationListener();
}
private:
@@ -81,8 +81,8 @@ reportChildError(int err, int fd, const char* cannot, const char* name)
strcat(msg, "'");
if(err)
{
- strcat(msg, ": ");
- strcat(msg, strerror(err));
+ strcat(msg, ": ");
+ strcat(msg, strerror(err));
}
write(fd, msg, strlen(msg));
close(fd);
@@ -102,68 +102,68 @@ signalToString(int signal)
{
switch(signal)
{
- case SIGHUP:
- {
- return ICE_STRING(SIGHUP);
- }
- case SIGINT:
- {
- return ICE_STRING(SIGINT);
- }
- case SIGQUIT:
- {
- return ICE_STRING(SIGQUIT);
- }
- case SIGILL:
- {
- return ICE_STRING(SIGILL);
- }
- case SIGTRAP:
- {
- return ICE_STRING(SIGTRAP);
- }
- case SIGABRT:
- {
- return ICE_STRING(SIGABRT);
- }
- case SIGBUS:
- {
- return ICE_STRING(SIGBUS);
- }
- case SIGFPE:
- {
- return ICE_STRING(SIGFPE);
- }
- case SIGKILL:
- {
- return ICE_STRING(SIGKILL);
- }
- case SIGUSR1:
- {
- return ICE_STRING(SIGUSR1);
- }
- case SIGSEGV:
- {
- return ICE_STRING(SIGSEGV);
- }
- case SIGPIPE:
- {
- return ICE_STRING(SIGPIPE);
- }
- case SIGALRM:
- {
- return ICE_STRING(SIGALRM);
- }
- case SIGTERM:
- {
- return ICE_STRING(SIGTERM);
- }
- default:
- {
- ostringstream os;
- os << "signal " << signal;
- return os.str();
- }
+ case SIGHUP:
+ {
+ return ICE_STRING(SIGHUP);
+ }
+ case SIGINT:
+ {
+ return ICE_STRING(SIGINT);
+ }
+ case SIGQUIT:
+ {
+ return ICE_STRING(SIGQUIT);
+ }
+ case SIGILL:
+ {
+ return ICE_STRING(SIGILL);
+ }
+ case SIGTRAP:
+ {
+ return ICE_STRING(SIGTRAP);
+ }
+ case SIGABRT:
+ {
+ return ICE_STRING(SIGABRT);
+ }
+ case SIGBUS:
+ {
+ return ICE_STRING(SIGBUS);
+ }
+ case SIGFPE:
+ {
+ return ICE_STRING(SIGFPE);
+ }
+ case SIGKILL:
+ {
+ return ICE_STRING(SIGKILL);
+ }
+ case SIGUSR1:
+ {
+ return ICE_STRING(SIGUSR1);
+ }
+ case SIGSEGV:
+ {
+ return ICE_STRING(SIGSEGV);
+ }
+ case SIGPIPE:
+ {
+ return ICE_STRING(SIGPIPE);
+ }
+ case SIGALRM:
+ {
+ return ICE_STRING(SIGALRM);
+ }
+ case SIGTERM:
+ {
+ return ICE_STRING(SIGTERM);
+ }
+ default:
+ {
+ ostringstream os;
+ os << "signal " << signal;
+ return os.str();
+ }
}
#endif
}
@@ -177,77 +177,77 @@ stringToSignal(const string& str)
if(str == ICE_STRING(SIGHUP))
{
- return SIGHUP;
+ return SIGHUP;
}
else if(str == ICE_STRING(SIGINT))
{
- return SIGINT;
+ return SIGINT;
}
else if(str == ICE_STRING(SIGQUIT))
{
- return SIGQUIT;
+ return SIGQUIT;
}
else if(str == ICE_STRING(SIGILL))
{
- return SIGILL;
+ return SIGILL;
}
else if(str == ICE_STRING(SIGTRAP))
{
- return SIGTRAP;
+ return SIGTRAP;
}
else if(str == ICE_STRING(SIGABRT))
{
- return SIGABRT;
+ return SIGABRT;
}
else if(str == ICE_STRING(SIGBUS))
{
- return SIGBUS;
+ return SIGBUS;
}
else if(str == ICE_STRING(SIGFPE))
{
- return SIGFPE;
+ return SIGFPE;
}
else if(str == ICE_STRING(SIGKILL))
{
- return SIGKILL;
+ return SIGKILL;
}
else if(str == ICE_STRING(SIGUSR1))
{
- return SIGUSR1;
+ return SIGUSR1;
}
else if(str == ICE_STRING(SIGSEGV))
{
- return SIGSEGV;
+ return SIGSEGV;
}
else if(str == ICE_STRING(SIGUSR2))
{
- return SIGUSR2;
+ return SIGUSR2;
}
else if(str == ICE_STRING(SIGPIPE))
{
- return SIGPIPE;
+ return SIGPIPE;
}
else if(str == ICE_STRING(SIGALRM))
{
- return SIGALRM;
+ return SIGALRM;
}
else if(str == ICE_STRING(SIGTERM))
{
- return SIGTERM;
+ return SIGTERM;
}
else
{
- if(str != "")
- {
- char* end;
- long int signal = strtol(str.c_str(), &end, 10);
- if(*end == '\0' && signal > 0 && signal < 64)
- {
- return static_cast<int>(signal);
- }
- }
- throw BadSignalException("unknown signal `" + str + "'");
- return SIGTERM; // Keep the compiler happy.
+ if(str != "")
+ {
+ char* end;
+ long int signal = strtol(str.c_str(), &end, 10);
+ if(*end == '\0' && signal > 0 && signal < 64)
+ {
+ return static_cast<int>(signal);
+ }
+ }
+ throw BadSignalException("unknown signal `" + str + "'");
+ return SIGTERM; // Keep the compiler happy.
}
}
#endif
@@ -268,17 +268,17 @@ Activator::Activator(const TraceLevelsPtr& traceLevels) :
if(_hIntr == NULL)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
#else
int fds[2];
if(pipe(fds) != 0)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
_fdIntrRead = fds[0];
_fdIntrWrite = fds[1];
@@ -307,56 +307,56 @@ Activator::~Activator()
int
Activator::activate(const string& name,
- const string& exePath,
- const string& pwdPath,
+ const string& exePath,
+ const string& pwdPath,
#ifndef _WIN32
- uid_t uid,
- gid_t gid,
+ uid_t uid,
+ gid_t gid,
#endif
- const Ice::StringSeq& options,
- const Ice::StringSeq& envs,
- const ServerIPtr& server)
+ const Ice::StringSeq& options,
+ const Ice::StringSeq& envs,
+ const ServerIPtr& server)
{
IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
if(_deactivating)
{
- throw string("The node is being shutdown.");
+ throw string("The node is being shutdown.");
}
string path = exePath;
if(path.empty())
{
- throw string("The server executable path is empty.");
+ throw string("The server executable path is empty.");
}
string pwd = IcePatch2::simplify(pwdPath);
#ifdef _WIN32
if(!IcePatch2::isAbsolute(path))
{
- if(path.find('/') == string::npos)
- {
- //
- // Get the absolute pathname of the executable.
- //
- char absbuf[_MAX_PATH];
- char* filePart;
- string ext = path.size() <= 4 || path[path.size() - 4] != '.' ? ".exe" : "";
- if(SearchPath(NULL, path.c_str(), ext.c_str(), _MAX_PATH, absbuf, &filePart) == 0)
- {
- if(_traceLevels->activator > 0)
- {
- Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "cannot convert `" << path << "' into an absolute path";
- }
- throw string("The server executable path `" + path + "' can't be converted into an absolute path.");
- }
- path = absbuf;
- }
- else if(!pwd.empty())
- {
- path = pwd + "/" + path;
- }
+ if(path.find('/') == string::npos)
+ {
+ //
+ // Get the absolute pathname of the executable.
+ //
+ char absbuf[_MAX_PATH];
+ char* filePart;
+ string ext = path.size() <= 4 || path[path.size() - 4] != '.' ? ".exe" : "";
+ if(SearchPath(NULL, path.c_str(), ext.c_str(), _MAX_PATH, absbuf, &filePart) == 0)
+ {
+ if(_traceLevels->activator > 0)
+ {
+ Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "cannot convert `" << path << "' into an absolute path";
+ }
+ throw string("The server executable path `" + path + "' can't be converted into an absolute path.");
+ }
+ path = absbuf;
+ }
+ else if(!pwd.empty())
+ {
+ path = pwd + "/" + path;
+ }
}
//
@@ -364,17 +364,17 @@ Activator::activate(const string& name,
//
if(!pwd.empty())
{
- char absbuf[_MAX_PATH];
- if(_fullpath(absbuf, pwd.c_str(), _MAX_PATH) == NULL)
- {
- if(_traceLevels->activator > 0)
- {
- Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "cannot convert `" << pwd << "' into an absolute path";
- }
- throw string("The server working directory path `" + pwd + "' can't be converted into an absolute path.");
- }
- pwd = absbuf;
+ char absbuf[_MAX_PATH];
+ if(_fullpath(absbuf, pwd.c_str(), _MAX_PATH) == NULL)
+ {
+ if(_traceLevels->activator > 0)
+ {
+ Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "cannot convert `" << pwd << "' into an absolute path";
+ }
+ throw string("The server working directory path `" + pwd + "' can't be converted into an absolute path.");
+ }
+ pwd = absbuf;
}
#endif
@@ -387,41 +387,41 @@ Activator::activate(const string& name,
if(_traceLevels->activator > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "activating server `" << name << "'";
- if(_traceLevels->activator > 1)
- {
- out << "\n";
- out << "path = " << path << "\n";
- if(pwd.empty())
- {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "activating server `" << name << "'";
+ if(_traceLevels->activator > 1)
+ {
+ out << "\n";
+ out << "path = " << path << "\n";
+ if(pwd.empty())
+ {
#ifdef _WIN32
- char cwd[_MAX_PATH];
- if(_getcwd(cwd, _MAX_PATH) != NULL)
+ char cwd[_MAX_PATH];
+ if(_getcwd(cwd, _MAX_PATH) != NULL)
#else
- char cwd[PATH_MAX];
- if(getcwd(cwd, PATH_MAX) != NULL)
+ char cwd[PATH_MAX];
+ if(getcwd(cwd, PATH_MAX) != NULL)
#endif
- {
- out << "pwd = " << string(cwd) << "\n";
- }
- }
- else
- {
- out << "pwd = " << pwd << "\n";
- }
+ {
+ out << "pwd = " << string(cwd) << "\n";
+ }
+ }
+ else
+ {
+ out << "pwd = " << pwd << "\n";
+ }
#ifndef _WIN32
- out << "uid/gid = " << uid << "/" << gid << "\n";
+ out << "uid/gid = " << uid << "/" << gid << "\n";
#endif
- if(!envs.empty())
- {
- out << "envs = " << toString(envs, ", ") << "\n";
- }
- if(!args.empty())
- {
- out << "args = " << toString(args);
- }
- }
+ if(!envs.empty())
+ {
+ out << "envs = " << toString(envs, ", ") << "\n";
+ }
+ if(!args.empty())
+ {
+ out << "args = " << toString(args);
+ }
+ }
}
//
@@ -500,8 +500,8 @@ Activator::activate(const string& name,
string::size_type pos = s.find('=');
if(pos != string::npos)
{
- string key = s.substr(0, pos);
- std::transform(key.begin(), key.end(), key.begin(), toupper);
+ string key = s.substr(0, pos);
+ std::transform(key.begin(), key.end(), key.begin(), toupper);
envMap.insert(map<string, string>::value_type(key, s.substr(pos + 1)));
}
var += s.size();
@@ -514,9 +514,9 @@ Activator::activate(const string& name,
string::size_type pos = s.find('=');
if(pos != string::npos)
{
- string key = s.substr(0, pos);
- std::transform(key.begin(), key.end(), key.begin(), toupper);
- envMap.erase(key);
+ string key = s.substr(0, pos);
+ std::transform(key.begin(), key.end(), key.begin(), toupper);
+ envMap.erase(key);
envMap.insert(map<string, string>::value_type(key, s.substr(pos + 1)));
}
}
@@ -591,9 +591,9 @@ Activator::activate(const string& name,
int fds[2];
if(pipe(fds) != 0)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
//
@@ -604,8 +604,8 @@ Activator::activate(const string& name,
int i = 0;
for(StringSeq::const_iterator p = args.begin(); p != args.end(); ++p, ++i)
{
- assert(i < argc);
- argv[i] = strdup(p->c_str());
+ assert(i < argc);
+ argv[i] = strdup(p->c_str());
}
assert(i == argc);
argv[argc] = 0;
@@ -615,7 +615,7 @@ Activator::activate(const string& name,
i = 0;
for(StringSeq::const_iterator q = envs.begin(); q != envs.end(); ++q)
{
- envArray[i++] = strdup(q->c_str());
+ envArray[i++] = strdup(q->c_str());
}
//
@@ -626,118 +626,118 @@ Activator::activate(const string& name,
pid_t pid = fork();
if(pid == -1)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
if(pid == 0) // Child process.
{
- //
- // Until exec, we can only use async-signal safe functions
- //
-
- //
- // Change the uid/gid under which the process will run.
- //
- if(setgid(gid) == -1)
- {
- ostringstream os;
- os << gid;
- reportChildError(getSystemErrno(), fds[1], "cannot set process group id", os.str().c_str());
- }
-
- if(setuid(uid) == -1)
- {
- ostringstream os;
- os << uid;
- reportChildError(getSystemErrno(), fds[1], "cannot set process user id", os.str().c_str());
- }
-
- //
- // Assign a new process group for this process.
- //
- setpgid(0, 0);
-
- //
- // Close all file descriptors, except for standard input,
- // standard output, standard error, and the write side
- // of the newly created pipe.
- //
- int maxFd = static_cast<int>(sysconf(_SC_OPEN_MAX));
- for(int fd = 3; fd < maxFd; ++fd)
- {
- if(fd != fds[1])
- {
- close(fd);
- }
- }
-
- for(i = 0; i < envCount; i++)
- {
- if(putenv(envArray[i]) != 0)
- {
- reportChildError(errno, fds[1], "cannot set environment variable", envArray[i]);
- }
- }
- //
- // Each env is leaked on purpose ... see man putenv().
- //
- delete[] envArray;
-
- //
- // Change working directory.
- //
- if(strlen(pwdCStr) != 0)
- {
- if(chdir(pwdCStr) == -1)
- {
- reportChildError(errno, fds[1], "cannot change working directory to", pwdCStr);
- }
- }
-
- if(execvp(argv[0], argv) == -1)
- {
- reportChildError(errno, fds[1], "cannot execute", argv[0]);
- }
+ //
+ // Until exec, we can only use async-signal safe functions
+ //
+
+ //
+ // Change the uid/gid under which the process will run.
+ //
+ if(setgid(gid) == -1)
+ {
+ ostringstream os;
+ os << gid;
+ reportChildError(getSystemErrno(), fds[1], "cannot set process group id", os.str().c_str());
+ }
+
+ if(setuid(uid) == -1)
+ {
+ ostringstream os;
+ os << uid;
+ reportChildError(getSystemErrno(), fds[1], "cannot set process user id", os.str().c_str());
+ }
+
+ //
+ // Assign a new process group for this process.
+ //
+ setpgid(0, 0);
+
+ //
+ // Close all file descriptors, except for standard input,
+ // standard output, standard error, and the write side
+ // of the newly created pipe.
+ //
+ int maxFd = static_cast<int>(sysconf(_SC_OPEN_MAX));
+ for(int fd = 3; fd < maxFd; ++fd)
+ {
+ if(fd != fds[1])
+ {
+ close(fd);
+ }
+ }
+
+ for(i = 0; i < envCount; i++)
+ {
+ if(putenv(envArray[i]) != 0)
+ {
+ reportChildError(errno, fds[1], "cannot set environment variable", envArray[i]);
+ }
+ }
+ //
+ // Each env is leaked on purpose ... see man putenv().
+ //
+ delete[] envArray;
+
+ //
+ // Change working directory.
+ //
+ if(strlen(pwdCStr) != 0)
+ {
+ if(chdir(pwdCStr) == -1)
+ {
+ reportChildError(errno, fds[1], "cannot change working directory to", pwdCStr);
+ }
+ }
+
+ if(execvp(argv[0], argv) == -1)
+ {
+ reportChildError(errno, fds[1], "cannot execute", argv[0]);
+ }
}
else // Parent process.
{
- close(fds[1]);
-
- for(i = 0; argv[i]; i++)
- {
- free(argv[i]);
- }
- free(argv);
-
- for(i = 0; i < envCount; ++i)
- {
- free(envArray[i]);
- }
- delete[] envArray;
-
- Process process;
- process.pid = pid;
- process.pipeFd = fds[0];
- process.server = server;
- _processes.insert(make_pair(name, process));
-
- int flags = fcntl(process.pipeFd, F_GETFL);
- flags |= O_NONBLOCK;
- fcntl(process.pipeFd, F_SETFL, flags);
-
- setInterrupt();
+ close(fds[1]);
+
+ for(i = 0; argv[i]; i++)
+ {
+ free(argv[i]);
+ }
+ free(argv);
+
+ for(i = 0; i < envCount; ++i)
+ {
+ free(envArray[i]);
+ }
+ delete[] envArray;
+
+ Process process;
+ process.pid = pid;
+ process.pipeFd = fds[0];
+ process.server = server;
+ _processes.insert(make_pair(name, process));
+
+ int flags = fcntl(process.pipeFd, F_GETFL);
+ flags |= O_NONBLOCK;
+ fcntl(process.pipeFd, F_SETFL, flags);
+
+ setInterrupt();
//
// Don't print the following trace, this might interfere with the
// output of the started process if it fails with an error message.
//
-// if(_traceLevels->activator > 0)
-// {
-// Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
-// out << "activated server `" << name << "' (pid = " << pid << ")";
-// }
+// if(_traceLevels->activator > 0)
+// {
+// Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+// out << "activated server `" << name << "' (pid = " << pid << ")";
+// }
}
return pid;
@@ -751,10 +751,10 @@ Activator::deactivate(const string& name, const Ice::ProcessPrx& process)
Ice::Int pid = getServerPid(name);
if(pid == 0)
{
- //
- // Server is already deactivated.
- //
- return;
+ //
+ // Server is already deactivated.
+ //
+ return;
}
#endif
@@ -763,21 +763,21 @@ Activator::deactivate(const string& name, const Ice::ProcessPrx& process)
//
if(process)
{
- if(_traceLevels->activator > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "deactivating `" << name << "' using process proxy";
- }
- try
- {
- process->shutdown();
- return;
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_traceLevels->logger);
- out << "exception occurred while deactivating `" << name << "' using process proxy:\n" << ex;
- }
+ if(_traceLevels->activator > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "deactivating `" << name << "' using process proxy";
+ }
+ try
+ {
+ process->shutdown();
+ return;
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_traceLevels->logger);
+ out << "exception occurred while deactivating `" << name << "' using process proxy:\n" << ex;
+ }
}
if(_traceLevels->activator > 1)
@@ -820,10 +820,10 @@ Activator::kill(const string& name)
Ice::Int pid = getServerPid(name);
if(pid == 0)
{
- //
- // Server is already deactivated.
- //
- return;
+ //
+ // Server is already deactivated.
+ //
+ return;
}
HANDLE hnd = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
@@ -840,8 +840,8 @@ Activator::kill(const string& name)
if(_traceLevels->activator > 1)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "terminating server `" << name << "' (pid = " << pid << ")";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "terminating server `" << name << "' (pid = " << pid << ")";
}
#else
@@ -869,24 +869,24 @@ Activator::sendSignal(const string& name, int signal)
Ice::Int pid = getServerPid(name);
if(pid == 0)
{
- //
- // Server is already deactivated.
- //
- return;
+ //
+ // Server is already deactivated.
+ //
+ return;
}
int ret = ::kill(static_cast<pid_t>(pid), signal);
if(ret != 0 && getSystemErrno() != ESRCH)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
if(_traceLevels->activator > 1)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "sent " << signalToString(signal) << " to server `" << name << "' (pid = " << pid << ")";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "sent " << signalToString(signal) << " to server `" << name << "' (pid = " << pid << ")";
}
#endif
}
@@ -899,7 +899,7 @@ Activator::getServerPid(const string& name)
map<string, Process>::const_iterator p = _processes.find(name);
if(p == _processes.end())
{
- return 0;
+ return 0;
}
return static_cast<Ice::Int>(p->second.pid);
@@ -921,7 +921,7 @@ Activator::waitForShutdown()
IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
while(!_deactivating)
{
- wait();
+ wait();
}
}
@@ -945,9 +945,9 @@ Activator::destroy()
{
map<string, Process> processes;
{
- IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
- assert(_deactivating);
- processes = _processes;
+ IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
+ assert(_deactivating);
+ processes = _processes;
}
//
@@ -955,30 +955,30 @@ Activator::destroy()
//
for(map<string, Process>::iterator p = processes.begin(); p != processes.end(); ++p)
{
- //
- // Stop the server. The listener thread should detect the
- // process deactivation and remove it from the activator's
- // list of active processes.
- //
- try
- {
- p->second.server->stop_async(0);
- }
- catch(const ServerStopException&)
- {
- // Server already stopped or destroyed.
- }
- catch(const ObjectNotExistException&)
- {
- //
- // Expected if the server was in the process of being destroyed.
- //
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_traceLevels->logger);
- out << "unexpected exception raised by server `" << p->first << "' stop:\n" << ex;
- }
+ //
+ // Stop the server. The listener thread should detect the
+ // process deactivation and remove it from the activator's
+ // list of active processes.
+ //
+ try
+ {
+ p->second.server->stop_async(0);
+ }
+ catch(const ServerStopException&)
+ {
+ // Server already stopped or destroyed.
+ }
+ catch(const ObjectNotExistException&)
+ {
+ //
+ // Expected if the server was in the process of being destroyed.
+ //
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_traceLevels->logger);
+ out << "unexpected exception raised by server `" << p->first << "' stop:\n" << ex;
+ }
}
//
@@ -996,21 +996,21 @@ Activator::runTerminationListener()
{
while(true)
{
- try
- {
- terminationListener();
- break;
- }
- catch(const Exception& ex)
- {
- Error out(_traceLevels->logger);
- out << "exception in process termination listener:\n" << ex;
- }
- catch(...)
- {
- Error out(_traceLevels->logger);
- out << "unknown exception in process termination listener";
- }
+ try
+ {
+ terminationListener();
+ break;
+ }
+ catch(const Exception& ex)
+ {
+ Error out(_traceLevels->logger);
+ out << "exception in process termination listener:\n" << ex;
+ }
+ catch(...)
+ {
+ Error out(_traceLevels->logger);
+ out << "unknown exception in process termination listener";
+ }
}
}
@@ -1051,60 +1051,60 @@ Activator::terminationListener()
assert(pos < handles.size());
HANDLE hnd = handles[pos];
- vector<Process> terminated;
- bool deactivated = false;
- {
- IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
-
- if(hnd == _hIntr)
- {
- clearInterrupt();
- }
- else
- {
- for(map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
- {
- if(p->second.hnd == hnd)
- {
- terminated.push_back(p->second);
- _processes.erase(p);
- break;
- }
- }
+ vector<Process> terminated;
+ bool deactivated = false;
+ {
+ IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
+
+ if(hnd == _hIntr)
+ {
+ clearInterrupt();
+ }
+ else
+ {
+ for(map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
+ {
+ if(p->second.hnd == hnd)
+ {
+ terminated.push_back(p->second);
+ _processes.erase(p);
+ break;
+ }
+ }
+ }
+
+ deactivated = _deactivating && _processes.empty();
+ }
+
+ for(vector<Process>::const_iterator p = terminated.begin(); p != terminated.end(); ++p)
+ {
+ DWORD status;
+ GetExitCodeProcess(p->hnd, &status);
+ CloseHandle(p->hnd);
+ assert(status != STILL_ACTIVE);
+
+ if(_traceLevels->activator > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "detected termination of server `" << p->server->getId() << "'";
+ if(status != 0)
+ {
+ out << "\nexit code = " << status;
+ }
+ }
+
+ try
+ {
+ p->server->terminated("", status);
}
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_traceLevels->logger);
+ out << "unexpected exception raised by server `" << p->server->getId() << "' termination:\n" << ex;
+ }
+ }
- deactivated = _deactivating && _processes.empty();
- }
-
- for(vector<Process>::const_iterator p = terminated.begin(); p != terminated.end(); ++p)
- {
- DWORD status;
- GetExitCodeProcess(p->hnd, &status);
- CloseHandle(p->hnd);
- assert(status != STILL_ACTIVE);
-
- if(_traceLevels->activator > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "detected termination of server `" << p->server->getId() << "'";
- if(status != 0)
- {
- out << "\nexit code = " << status;
- }
- }
-
- try
- {
- p->server->terminated("", status);
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_traceLevels->logger);
- out << "unexpected exception raised by server `" << p->server->getId() << "' termination:\n" << ex;
- }
- }
-
- if(deactivated)
+ if(deactivated)
{
return;
}
@@ -1112,197 +1112,197 @@ Activator::terminationListener()
#else
while(true)
{
- fd_set fdSet;
- int maxFd = _fdIntrRead;
- FD_ZERO(&fdSet);
- FD_SET(_fdIntrRead, &fdSet);
-
- {
- IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
-
- for(map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
- {
- int fd = p->second.pipeFd;
- FD_SET(fd, &fdSet);
- if(maxFd < fd)
- {
- maxFd = fd;
- }
- }
- }
-
+ fd_set fdSet;
+ int maxFd = _fdIntrRead;
+ FD_ZERO(&fdSet);
+ FD_SET(_fdIntrRead, &fdSet);
+
+ {
+ IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
+
+ for(map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
+ {
+ int fd = p->second.pipeFd;
+ FD_SET(fd, &fdSet);
+ if(maxFd < fd)
+ {
+ maxFd = fd;
+ }
+ }
+ }
+
repeatSelect:
- int ret = ::select(maxFd + 1, &fdSet, 0, 0, 0);
- assert(ret != 0);
-
- if(ret == -1)
- {
+ int ret = ::select(maxFd + 1, &fdSet, 0, 0, 0);
+ assert(ret != 0);
+
+ if(ret == -1)
+ {
#ifdef EPROTO
- if(errno == EINTR || errno == EPROTO)
- {
- goto repeatSelect;
- }
+ if(errno == EINTR || errno == EPROTO)
+ {
+ goto repeatSelect;
+ }
#else
- if(errno == EINTR)
- {
- goto repeatSelect;
- }
+ if(errno == EINTR)
+ {
+ goto repeatSelect;
+ }
#endif
-
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- vector<Process> terminated;
- bool deactivated = false;
- {
- IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
-
- if(FD_ISSET(_fdIntrRead, &fdSet))
- {
- clearInterrupt();
-
- if(_deactivating && _processes.empty())
+
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ vector<Process> terminated;
+ bool deactivated = false;
+ {
+ IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this);
+
+ if(FD_ISSET(_fdIntrRead, &fdSet))
+ {
+ clearInterrupt();
+
+ if(_deactivating && _processes.empty())
{
return;
}
- }
-
- map<string, Process>::iterator p = _processes.begin();
- while(p != _processes.end())
- {
- int fd = p->second.pipeFd;
- if(!FD_ISSET(fd, &fdSet))
- {
- ++p;
- continue;
- }
-
- char s[16];
- ssize_t rs;
- string message;
-
- //
- // Read the message over the pipe.
- //
- while((rs = read(fd, &s, 16)) > 0)
- {
- message.append(s, rs);
- }
-
- //
- // Keep the received message.
- //
- if(!message.empty())
- {
- p->second.msg += message;
- }
-
- if(rs == -1)
- {
- if(errno != EAGAIN || message.empty())
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- ++p;
- }
- else if(rs == 0)
- {
- //
- // If the pipe was closed, the process has terminated.
- //
-
- terminated.push_back(p->second);
+ }
+
+ map<string, Process>::iterator p = _processes.begin();
+ while(p != _processes.end())
+ {
+ int fd = p->second.pipeFd;
+ if(!FD_ISSET(fd, &fdSet))
+ {
+ ++p;
+ continue;
+ }
+
+ char s[16];
+ ssize_t rs;
+ string message;
+
+ //
+ // Read the message over the pipe.
+ //
+ while((rs = read(fd, &s, 16)) > 0)
+ {
+ message.append(s, rs);
+ }
+
+ //
+ // Keep the received message.
+ //
+ if(!message.empty())
+ {
+ p->second.msg += message;
+ }
+
+ if(rs == -1)
+ {
+ if(errno != EAGAIN || message.empty())
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ ++p;
+ }
+ else if(rs == 0)
+ {
+ //
+ // If the pipe was closed, the process has terminated.
+ //
+
+ terminated.push_back(p->second);
- close(p->second.pipeFd);
- _processes.erase(p++);
- }
- }
-
- //
- // We are deactivating and there's no more active processes.
- //
- deactivated = _deactivating && _processes.empty();
- }
-
- for(vector<Process>::const_iterator p = terminated.begin(); p != terminated.end(); ++p)
- {
- int status;
+ close(p->second.pipeFd);
+ _processes.erase(p++);
+ }
+ }
+
+ //
+ // We are deactivating and there's no more active processes.
+ //
+ deactivated = _deactivating && _processes.empty();
+ }
+
+ for(vector<Process>::const_iterator p = terminated.begin(); p != terminated.end(); ++p)
+ {
+ int status;
#if defined(__linux)
- int nRetry = 0;
- while(true) // The while loop is necessary for the linux workaround.
- {
- pid_t pid = waitpid(p->pid, &status, 0);
- if(pid < 0)
- {
- //
- // Some Linux distribution have a bogus waitpid() (e.g.: CentOS 4.x). It doesn't
- // block and reports an incorrect ECHILD error on the first call. We sleep a
- // little and retry to work around this issue (it appears from testing that a
- // single retry is enough but to make sure we retry up to 10 times before to throw.)
- //
- if(errno == ECHILD && nRetry < 10)
- {
- // Wait 1ms, 11ms, 21ms, etc.
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(nRetry * 10 + 1));
- ++nRetry;
- continue;
- }
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- assert(pid == p->pid);
- break;
- }
+ int nRetry = 0;
+ while(true) // The while loop is necessary for the linux workaround.
+ {
+ pid_t pid = waitpid(p->pid, &status, 0);
+ if(pid < 0)
+ {
+ //
+ // Some Linux distribution have a bogus waitpid() (e.g.: CentOS 4.x). It doesn't
+ // block and reports an incorrect ECHILD error on the first call. We sleep a
+ // little and retry to work around this issue (it appears from testing that a
+ // single retry is enough but to make sure we retry up to 10 times before to throw.)
+ //
+ if(errno == ECHILD && nRetry < 10)
+ {
+ // Wait 1ms, 11ms, 21ms, etc.
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(nRetry * 10 + 1));
+ ++nRetry;
+ continue;
+ }
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ assert(pid == p->pid);
+ break;
+ }
#else
- pid_t pid = waitpid(p->pid, &status, 0);
- if(pid < 0)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- assert(pid == p->pid);
+ pid_t pid = waitpid(p->pid, &status, 0);
+ if(pid < 0)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ assert(pid == p->pid);
#endif
- if(_traceLevels->activator > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
- out << "detected termination of server `" << p->server->getId() << "'";
- if(!p->msg.empty())
- {
- out << "\nreason = " << p->msg;
- }
- if(WIFEXITED(status) && status != 0)
- {
- out << "\nexit code = " << WEXITSTATUS(status);
- }
- else if(WIFSIGNALED(status))
- {
- out << "\nsignal = " << signalToString(WTERMSIG(status));
- }
- }
-
- try
- {
- p->server->terminated(p->msg, status);
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_traceLevels->logger);
- out << "unexpected exception raised by server `" << p->server->getId() << "' termination:\n" << ex;
- }
- }
-
- if(deactivated)
- {
- return;
- }
+ if(_traceLevels->activator > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
+ out << "detected termination of server `" << p->server->getId() << "'";
+ if(!p->msg.empty())
+ {
+ out << "\nreason = " << p->msg;
+ }
+ if(WIFEXITED(status) && status != 0)
+ {
+ out << "\nexit code = " << WEXITSTATUS(status);
+ }
+ else if(WIFSIGNALED(status))
+ {
+ out << "\nsignal = " << signalToString(WTERMSIG(status));
+ }
+ }
+
+ try
+ {
+ p->server->terminated(p->msg, status);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_traceLevels->logger);
+ out << "unexpected exception raised by server `" << p->server->getId() << "' termination:\n" << ex;
+ }
+ }
+
+ if(deactivated)
+ {
+ return;
+ }
}
#endif
}
diff --git a/cpp/src/IceGrid/Activator.h b/cpp/src/IceGrid/Activator.h
index 40c7a9b3878..24a2b60f800 100644
--- a/cpp/src/IceGrid/Activator.h
+++ b/cpp/src/IceGrid/Activator.h
@@ -37,9 +37,9 @@ public:
virtual int activate(const std::string&, const std::string&, const std::string&,
#ifndef _WIN32
- uid_t, gid_t,
+ uid_t, gid_t,
#endif
- const Ice::StringSeq&, const Ice::StringSeq&, const ServerIPtr&);
+ const Ice::StringSeq&, const Ice::StringSeq&, const ServerIPtr&);
virtual void deactivate(const std::string&, const Ice::ProcessPrx&);
virtual void kill(const std::string&);
virtual void sendSignal(const std::string&, const std::string&);
@@ -67,11 +67,11 @@ private:
DWORD pid;
HANDLE hnd;
#else
- pid_t pid;
- int pipeFd;
- std::string msg;
+ pid_t pid;
+ int pipeFd;
+ std::string msg;
#endif
- ServerIPtr server;
+ ServerIPtr server;
};
TraceLevelsPtr _traceLevels;
diff --git a/cpp/src/IceGrid/AdapterCache.cpp b/cpp/src/IceGrid/AdapterCache.cpp
index 5ebd4ba6c8d..64d235bacea 100644
--- a/cpp/src/IceGrid/AdapterCache.cpp
+++ b/cpp/src/IceGrid/AdapterCache.cpp
@@ -28,7 +28,7 @@ struct ReplicaLoadComp : binary_function<ServerAdapterEntryPtr&, ServerAdapterEn
{
bool operator()(const pair<float, ServerAdapterEntryPtr>& lhs, const pair<float, ServerAdapterEntryPtr>& rhs)
{
- return lhs.first < rhs.first;
+ return lhs.first < rhs.first;
}
};
@@ -36,12 +36,12 @@ struct ReplicaPriorityComp : binary_function<ServerAdapterEntryPtr&, ServerAdapt
{
bool operator()(const ServerAdapterEntryPtr& lhs, const ServerAdapterEntryPtr& rhs)
{
- return lhs->getPriority() < rhs->getPriority();
+ return lhs->getPriority() < rhs->getPriority();
}
};
struct TransformToReplicaLoad :
- public unary_function<const ServerAdapterEntryPtr&, pair<float, ServerAdapterEntryPtr> >
+ public unary_function<const ServerAdapterEntryPtr&, pair<float, ServerAdapterEntryPtr> >
{
public:
@@ -50,7 +50,7 @@ public:
pair<float, ServerAdapterEntryPtr>
operator()(const ServerAdapterEntryPtr& value)
{
- return make_pair(value->getLeastLoadedNodeLoad(_loadSample), value);
+ return make_pair(value->getLeastLoadedNodeLoad(_loadSample), value);
}
LoadSample _loadSample;
@@ -61,7 +61,7 @@ struct TransformToReplica : public unary_function<const pair<string, ServerAdapt
ServerAdapterEntryPtr
operator()(const pair<float, ServerAdapterEntryPtr>& value)
{
- return value.second;
+ return value.second;
}
};
@@ -82,9 +82,9 @@ AdapterCache::addServerAdapter(const AdapterDescriptor& desc, const ServerEntryP
if(!desc.replicaGroupId.empty())
{
- ReplicaGroupEntryPtr repEntry = ReplicaGroupEntryPtr::dynamicCast(getImpl(desc.replicaGroupId));
- assert(repEntry);
- repEntry->addReplica(desc.id, entry);
+ ReplicaGroupEntryPtr repEntry = ReplicaGroupEntryPtr::dynamicCast(getImpl(desc.replicaGroupId));
+ assert(repEntry);
+ repEntry->addReplica(desc.id, entry);
}
return entry;
@@ -107,7 +107,7 @@ AdapterCache::get(const string& id) const
AdapterEntryPtr entry = getImpl(id);
if(!entry)
{
- throw AdapterNotExistException(id);
+ throw AdapterNotExistException(id);
}
return entry;
}
@@ -124,9 +124,9 @@ AdapterCache::removeServerAdapter(const string& id)
string replicaGroupId = entry->getReplicaGroupId();
if(!replicaGroupId.empty())
{
- ReplicaGroupEntryPtr repEntry = ReplicaGroupEntryPtr::dynamicCast(getImpl(replicaGroupId));
- assert(repEntry);
- repEntry->removeReplica(id);
+ ReplicaGroupEntryPtr repEntry = ReplicaGroupEntryPtr::dynamicCast(getImpl(replicaGroupId));
+ assert(repEntry);
+ repEntry->removeReplica(id);
}
}
@@ -142,8 +142,8 @@ AdapterCache::addImpl(const string& id, const AdapterEntryPtr& entry)
{
if(_traceLevels && _traceLevels->adapter > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
- out << "added adapter `" << id << "'";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
+ out << "added adapter `" << id << "'";
}
return Cache<string, AdapterEntry>::addImpl(id, entry);
}
@@ -153,8 +153,8 @@ AdapterCache::removeImpl(const string& id)
{
if(_traceLevels && _traceLevels->adapter > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
- out << "removed adapter `" << id << "'";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
+ out << "removed adapter `" << id << "'";
}
Cache<string, AdapterEntry>::removeImpl(id);
}
@@ -185,11 +185,11 @@ AdapterEntry::getApplication() const
}
ServerAdapterEntry::ServerAdapterEntry(AdapterCache& cache,
- const string& id,
- const string& application,
- const string& replicaGroupId,
- int priority,
- const ServerEntryPtr& server) :
+ const string& id,
+ const string& application,
+ const string& replicaGroupId,
+ int priority,
+ const ServerEntryPtr& server) :
AdapterEntry(cache, id, application),
_replicaGroupId(replicaGroupId),
_priority(priority),
@@ -213,23 +213,23 @@ ServerAdapterEntry::getLeastLoadedNodeLoad(LoadSample loadSample) const
{
try
{
- return _server->getLoad(loadSample);
+ return _server->getLoad(loadSample);
}
catch(const ServerNotExistException&)
{
- // This might happen if the application is updated concurrently.
+ // This might happen if the application is updated concurrently.
}
catch(const NodeNotExistException&)
{
- // This might happen if the application is updated concurrently.
+ // This might happen if the application is updated concurrently.
}
catch(const NodeUnreachableException&)
{
}
catch(const Ice::Exception& ex)
{
- Ice::Error error(_cache.getTraceLevels()->logger);
- error << "unexpected exception while getting node load:\n" << ex;
+ Ice::Error error(_cache.getTraceLevels()->logger);
+ error << "unexpected exception while getting node load:\n" << ex;
}
return 999.9f;
}
@@ -242,7 +242,7 @@ ServerAdapterEntry::getAdapterInfo() const
info.replicaGroupId = _replicaGroupId;
try
{
- info.proxy = _server->getAdapter(_id, true)->getDirectProxy();
+ info.proxy = _server->getAdapter(_id, true)->getDirectProxy();
}
catch(const Ice::Exception&)
{
@@ -257,15 +257,15 @@ ServerAdapterEntry::getProxy(const string& replicaGroupId, bool upToDate) const
{
if(replicaGroupId.empty())
{
- return _server->getAdapter(_id, upToDate);
+ return _server->getAdapter(_id, upToDate);
}
else
{
- if(_replicaGroupId != replicaGroupId) // Validate the replica group.
- {
- throw Ice::InvalidReplicaGroupIdException();
- }
- return _server->getAdapter(_id, upToDate);
+ if(_replicaGroupId != replicaGroupId) // Validate the replica group.
+ {
+ throw Ice::InvalidReplicaGroupIdException();
+ }
+ return _server->getAdapter(_id, upToDate);
}
}
@@ -276,9 +276,9 @@ ServerAdapterEntry::getPriority() const
}
ReplicaGroupEntry::ReplicaGroupEntry(AdapterCache& cache,
- const string& id,
- const string& application,
- const LoadBalancingPolicyPtr& policy) :
+ const string& id,
+ const string& application,
+ const LoadBalancingPolicyPtr& policy) :
AdapterEntry(cache, id, application),
_lastReplica(0)
{
@@ -298,13 +298,13 @@ ReplicaGroupEntry::removeReplica(const string& replicaId)
Lock sync(*this);
for(vector<ServerAdapterEntryPtr>::iterator p = _replicas.begin(); p != _replicas.end(); ++p)
{
- if(replicaId == (*p)->getId())
- {
- _replicas.erase(p);
- // Make sure _lastReplica is still within the bounds.
- _lastReplica = _replicas.empty() ? 0 : _lastReplica % static_cast<int>(_replicas.size());
- break;
- }
+ if(replicaId == (*p)->getId())
+ {
+ _replicas.erase(p);
+ // Make sure _lastReplica is still within the bounds.
+ _lastReplica = _replicas.empty() ? 0 : _lastReplica % static_cast<int>(_replicas.size());
+ break;
+ }
}
}
@@ -323,22 +323,22 @@ ReplicaGroupEntry::update(const LoadBalancingPolicyPtr& policy)
AdaptiveLoadBalancingPolicyPtr alb = AdaptiveLoadBalancingPolicyPtr::dynamicCast(_loadBalancing);
if(alb)
{
- if(alb->loadSample == "1")
- {
- _loadSample = LoadSample1;
- }
- else if(alb->loadSample == "5")
- {
- _loadSample = LoadSample5;
- }
- else if(alb->loadSample == "15")
- {
- _loadSample = LoadSample15;
- }
- else
- {
- _loadSample = LoadSample1;
- }
+ if(alb->loadSample == "1")
+ {
+ _loadSample = LoadSample1;
+ }
+ else if(alb->loadSample == "5")
+ {
+ _loadSample = LoadSample5;
+ }
+ else if(alb->loadSample == "15")
+ {
+ _loadSample = LoadSample15;
+ }
+ else
+ {
+ _loadSample = LoadSample1;
+ }
}
}
@@ -349,59 +349,59 @@ ReplicaGroupEntry::getLocatorAdapterInfo(LocatorAdapterInfoSeq& adapters, int& n
bool adaptive = false;
LoadSample loadSample = LoadSample1;
{
- Lock sync(*this);
- replicaGroup = true;
- nReplicas = _loadBalancingNReplicas > 0 ? _loadBalancingNReplicas : static_cast<int>(_replicas.size());
-
- if(_replicas.empty())
- {
- return;
- }
-
- replicas.reserve(_replicas.size());
- if(RoundRobinLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
- {
- for(unsigned int i = 0; i < _replicas.size(); ++i)
- {
- replicas.push_back(_replicas[(_lastReplica + i) % _replicas.size()]);
- }
- _lastReplica = (_lastReplica + 1) % static_cast<int>(_replicas.size());
- }
- else if(AdaptiveLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
- {
- replicas = _replicas;
- RandomNumberGenerator rng;
- random_shuffle(replicas.begin(), replicas.end(), rng);
- loadSample = _loadSample;
- adaptive = true;
- }
- else if(OrderedLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
- {
- replicas = _replicas;
- sort(replicas.begin(), replicas.end(), ReplicaPriorityComp());
- }
- else if(RandomLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
- {
- replicas = _replicas;
- RandomNumberGenerator rng;
- random_shuffle(replicas.begin(), replicas.end(), rng);
- }
+ Lock sync(*this);
+ replicaGroup = true;
+ nReplicas = _loadBalancingNReplicas > 0 ? _loadBalancingNReplicas : static_cast<int>(_replicas.size());
+
+ if(_replicas.empty())
+ {
+ return;
+ }
+
+ replicas.reserve(_replicas.size());
+ if(RoundRobinLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
+ {
+ for(unsigned int i = 0; i < _replicas.size(); ++i)
+ {
+ replicas.push_back(_replicas[(_lastReplica + i) % _replicas.size()]);
+ }
+ _lastReplica = (_lastReplica + 1) % static_cast<int>(_replicas.size());
+ }
+ else if(AdaptiveLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
+ {
+ replicas = _replicas;
+ RandomNumberGenerator rng;
+ random_shuffle(replicas.begin(), replicas.end(), rng);
+ loadSample = _loadSample;
+ adaptive = true;
+ }
+ else if(OrderedLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
+ {
+ replicas = _replicas;
+ sort(replicas.begin(), replicas.end(), ReplicaPriorityComp());
+ }
+ else if(RandomLoadBalancingPolicyPtr::dynamicCast(_loadBalancing))
+ {
+ replicas = _replicas;
+ RandomNumberGenerator rng;
+ random_shuffle(replicas.begin(), replicas.end(), rng);
+ }
}
if(adaptive)
{
- //
- // This must be done outside the synchronization block since
- // the trasnform() might call and lock each server adapter
- // entry. We also can't sort directly as the load of each
- // server adapter is not stable so we first take a snapshot of
- // each adapter and sort the snapshot.
- //
- vector<pair<float, ServerAdapterEntryPtr> > rl;
- transform(replicas.begin(), replicas.end(), back_inserter(rl), TransformToReplicaLoad(loadSample));
- sort(rl.begin(), rl.end(), ReplicaLoadComp());
- replicas.clear();
- transform(rl.begin(), rl.end(), back_inserter(replicas), TransformToReplica());
+ //
+ // This must be done outside the synchronization block since
+ // the trasnform() might call and lock each server adapter
+ // entry. We also can't sort directly as the load of each
+ // server adapter is not stable so we first take a snapshot of
+ // each adapter and sort the snapshot.
+ //
+ vector<pair<float, ServerAdapterEntryPtr> > rl;
+ transform(replicas.begin(), replicas.end(), back_inserter(rl), TransformToReplicaLoad(loadSample));
+ sort(rl.begin(), rl.end(), ReplicaLoadComp());
+ replicas.clear();
+ transform(rl.begin(), rl.end(), back_inserter(replicas), TransformToReplica());
}
//
@@ -411,21 +411,21 @@ ReplicaGroupEntry::getLocatorAdapterInfo(LocatorAdapterInfoSeq& adapters, int& n
//
for(vector<ServerAdapterEntryPtr>::const_iterator p = replicas.begin(); p != replicas.end(); ++p)
{
- try
- {
- int dummy;
- bool dummy2;
- (*p)->getLocatorAdapterInfo(adapters, dummy, dummy2);
- }
- catch(const AdapterNotExistException&)
- {
- }
- catch(const NodeUnreachableException&)
- {
- }
- catch(const DeploymentException&)
- {
- }
+ try
+ {
+ int dummy;
+ bool dummy2;
+ (*p)->getLocatorAdapterInfo(adapters, dummy, dummy2);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ catch(const NodeUnreachableException&)
+ {
+ }
+ catch(const DeploymentException&)
+ {
+ }
}
}
@@ -434,25 +434,25 @@ ReplicaGroupEntry::getLeastLoadedNodeLoad(LoadSample loadSample) const
{
vector<ServerAdapterEntryPtr> replicas;
{
- Lock sync(*this);
- replicas = _replicas;
+ Lock sync(*this);
+ replicas = _replicas;
}
if(replicas.empty())
{
- return 999.9f;
+ return 999.9f;
}
else if(replicas.size() == 1)
{
- return replicas.back()->getLeastLoadedNodeLoad(loadSample);
+ return replicas.back()->getLeastLoadedNodeLoad(loadSample);
}
else
{
- RandomNumberGenerator rng;
- random_shuffle(replicas.begin(), replicas.end(), rng);
- vector<pair<float, ServerAdapterEntryPtr> > rl;
- transform(replicas.begin(), replicas.end(), back_inserter(rl), TransformToReplicaLoad(loadSample));
- return min_element(rl.begin(), rl.end(), ReplicaLoadComp())->first;
+ RandomNumberGenerator rng;
+ random_shuffle(replicas.begin(), replicas.end(), rng);
+ vector<pair<float, ServerAdapterEntryPtr> > rl;
+ transform(replicas.begin(), replicas.end(), back_inserter(rl), TransformToReplicaLoad(loadSample));
+ return min_element(rl.begin(), rl.end(), ReplicaLoadComp())->first;
}
}
@@ -461,16 +461,16 @@ ReplicaGroupEntry::getAdapterInfo() const
{
vector<ServerAdapterEntryPtr> replicas;
{
- Lock sync(*this);
- replicas = _replicas;
+ Lock sync(*this);
+ replicas = _replicas;
}
AdapterInfoSeq infos;
for(vector<ServerAdapterEntryPtr>::const_iterator p = replicas.begin(); p != replicas.end(); ++p)
{
- AdapterInfoSeq infs = (*p)->getAdapterInfo();
- assert(infs.size() == 1);
- infos.push_back(infs[0]);
+ AdapterInfoSeq infs = (*p)->getAdapterInfo();
+ assert(infs.size() == 1);
+ infos.push_back(infs[0]);
}
return infos;
}
diff --git a/cpp/src/IceGrid/AdapterCache.h b/cpp/src/IceGrid/AdapterCache.h
index 14debc9838d..8e45f5b186e 100644
--- a/cpp/src/IceGrid/AdapterCache.h
+++ b/cpp/src/IceGrid/AdapterCache.h
@@ -65,7 +65,7 @@ class ServerAdapterEntry : public AdapterEntry
public:
ServerAdapterEntry(AdapterCache&, const std::string&, const std::string&, const std::string&, int,
- const ServerEntryPtr&);
+ const ServerEntryPtr&);
virtual void getLocatorAdapterInfo(LocatorAdapterInfoSeq&, int&, bool&);
virtual float getLeastLoadedNodeLoad(LoadSample) const;
diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp
index 70a95368cd4..cf2d752f6b9 100644
--- a/cpp/src/IceGrid/AdminI.cpp
+++ b/cpp/src/IceGrid/AdminI.cpp
@@ -36,48 +36,48 @@ public:
ServerProxyWrapper(const DatabasePtr& database, const string& id) : _id(id)
{
- _proxy = database->getServer(_id)->getProxy(_activationTimeout, _deactivationTimeout, _node);
+ _proxy = database->getServer(_id)->getProxy(_activationTimeout, _deactivationTimeout, _node);
}
void
useActivationTimeout()
{
- _proxy = ServerPrx::uncheckedCast(_proxy->ice_timeout(_activationTimeout * 1000));
+ _proxy = ServerPrx::uncheckedCast(_proxy->ice_timeout(_activationTimeout * 1000));
}
void
useDeactivationTimeout()
{
- _proxy = ServerPrx::uncheckedCast(_proxy->ice_timeout(_deactivationTimeout * 1000));
+ _proxy = ServerPrx::uncheckedCast(_proxy->ice_timeout(_deactivationTimeout * 1000));
}
IceProxy::IceGrid::Server*
operator->() const
{
- return _proxy.get();
+ return _proxy.get();
}
void
handleException(const Ice::Exception& ex)
{
- try
- {
- ex.ice_throw();
- }
- catch(const Ice::UserException&)
- {
- throw;
- }
- catch(const Ice::ObjectNotExistException&)
- {
- throw ServerNotExistException(_id);
- }
- catch(const Ice::LocalException& e)
- {
- ostringstream os;
- os << e;
- throw NodeUnreachableException(_node, os.str());
- }
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const Ice::UserException&)
+ {
+ throw;
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ throw ServerNotExistException(_id);
+ }
+ catch(const Ice::LocalException& e)
+ {
+ ostringstream os;
+ os << e;
+ throw NodeUnreachableException(_node, os.str());
+ }
}
private:
@@ -95,13 +95,13 @@ class AMDPatcherFeedbackAggregator : public PatcherFeedbackAggregator
public:
AMDPatcherFeedbackAggregator(const AmdCB& cb,
- Ice::Identity id,
- const TraceLevelsPtr& traceLevels,
- const string& type,
- const string& name,
- int nodeCount) :
- PatcherFeedbackAggregator(id, traceLevels, type, name, nodeCount),
- _cb(cb)
+ Ice::Identity id,
+ const TraceLevelsPtr& traceLevels,
+ const string& type,
+ const string& name,
+ int nodeCount) :
+ PatcherFeedbackAggregator(id, traceLevels, type, name, nodeCount),
+ _cb(cb)
{
}
@@ -110,13 +110,13 @@ private:
void
response()
{
- _cb->ice_response();
+ _cb->ice_response();
}
void
exception(const Ice::Exception& ex)
{
- _cb->ice_exception(ex);
+ _cb->ice_exception(ex);
}
const AmdCB _cb;
@@ -125,11 +125,11 @@ private:
template<typename AmdCB> PatcherFeedbackAggregatorPtr
static newPatcherFeedback(const AmdCB& cb,
- Ice::Identity id,
- const TraceLevelsPtr& traceLevels,
- const string& type,
- const string& name,
- int nodeCount)
+ Ice::Identity id,
+ const TraceLevelsPtr& traceLevels,
+ const string& type,
+ const string& name,
+ int nodeCount)
{
return new AMDPatcherFeedbackAggregator<AmdCB>(cb, id, traceLevels, type, name, nodeCount);
}
@@ -200,9 +200,9 @@ AdminI::instantiateServer(const string& app, const string& node, const ServerIns
void
AdminI::patchApplication_async(const AMD_Admin_patchApplicationPtr& amdCB,
- const string& name,
- bool shutdown,
- const Current& current)
+ const string& name,
+ bool shutdown,
+ const Current& current)
{
ApplicationHelper helper(current.adapter->getCommunicator(), _database->getApplicationInfo(name).descriptor);
DistributionDescriptor appDistrib;
@@ -211,8 +211,8 @@ AdminI::patchApplication_async(const AMD_Admin_patchApplicationPtr& amdCB,
if(nodes.empty())
{
- amdCB->ice_response();
- return;
+ amdCB->ice_response();
+ return;
}
Ice::Identity id;
@@ -220,39 +220,39 @@ AdminI::patchApplication_async(const AMD_Admin_patchApplicationPtr& amdCB,
id.name = IceUtil::generateUUID();
PatcherFeedbackAggregatorPtr feedback =
- newPatcherFeedback(amdCB, id, _traceLevels, "application", name, static_cast<int>(nodes.size()));
+ newPatcherFeedback(amdCB, id, _traceLevels, "application", name, static_cast<int>(nodes.size()));
for(vector<string>::const_iterator p = nodes.begin(); p != nodes.end(); ++p)
{
- try
- {
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << "started patching of application `" << name << "' on node `" << *p << "'";
- }
-
- NodeEntryPtr node = _database->getNode(*p);
- Resolver resolve(node->getInfo(), _database->getCommunicator());
- DistributionDescriptor desc = resolve(appDistrib);
- InternalDistributionDescriptorPtr intAppDistrib = new InternalDistributionDescriptor(desc.icepatch,
- desc.directories);
- node->getSession()->patch(feedback, name, "", intAppDistrib, shutdown);
- }
- catch(const NodeNotExistException&)
- {
- feedback->failed(*p, "node doesn't exist");
- }
- catch(const NodeUnreachableException& e)
- {
- feedback->failed(*p, "node is unreachable: " + e.reason);
- }
- catch(const Ice::Exception& e)
- {
- ostringstream os;
- os << e;
- feedback->failed(*p, "node is unreachable:\n" + os.str());
- }
+ try
+ {
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << "started patching of application `" << name << "' on node `" << *p << "'";
+ }
+
+ NodeEntryPtr node = _database->getNode(*p);
+ Resolver resolve(node->getInfo(), _database->getCommunicator());
+ DistributionDescriptor desc = resolve(appDistrib);
+ InternalDistributionDescriptorPtr intAppDistrib = new InternalDistributionDescriptor(desc.icepatch,
+ desc.directories);
+ node->getSession()->patch(feedback, name, "", intAppDistrib, shutdown);
+ }
+ catch(const NodeNotExistException&)
+ {
+ feedback->failed(*p, "node doesn't exist");
+ }
+ catch(const NodeUnreachableException& e)
+ {
+ feedback->failed(*p, "node is unreachable: " + e.reason);
+ }
+ catch(const Ice::Exception& e)
+ {
+ ostringstream os;
+ os << e;
+ feedback->failed(*p, "node is unreachable:\n" + os.str());
+ }
}
}
@@ -269,49 +269,49 @@ AdminI::getDefaultApplicationDescriptor(const Current& current) const
string path = properties->getProperty("IceGrid.Registry.DefaultTemplates");
if(path.empty())
{
- throw DeploymentException("no default templates configured, you need to set "
- "IceGrid.Registry.DefaultTemplates in the IceGrid registry configuration.");
+ throw DeploymentException("no default templates configured, you need to set "
+ "IceGrid.Registry.DefaultTemplates in the IceGrid registry configuration.");
}
ApplicationDescriptor desc;
try
{
- desc = DescriptorParser::parseDescriptor(path, current.adapter->getCommunicator());
+ desc = DescriptorParser::parseDescriptor(path, current.adapter->getCommunicator());
}
catch(const IceXML::ParserException& ex)
{
- throw DeploymentException("can't parse default templates:\n" + ex.reason());
+ throw DeploymentException("can't parse default templates:\n" + ex.reason());
}
desc.name = "";
if(!desc.nodes.empty())
{
- Ice::Warning warn(_traceLevels->logger);
- warn << "default application descriptor:\nnode definitions are not allowed.";
- desc.nodes.clear();
+ Ice::Warning warn(_traceLevels->logger);
+ warn << "default application descriptor:\nnode definitions are not allowed.";
+ desc.nodes.clear();
}
if(!desc.distrib.icepatch.empty() || !desc.distrib.directories.empty())
{
- Ice::Warning warn(_traceLevels->logger);
- warn << "default application descriptor:\ndistribution is not allowed.";
- desc.distrib = DistributionDescriptor();
+ Ice::Warning warn(_traceLevels->logger);
+ warn << "default application descriptor:\ndistribution is not allowed.";
+ desc.distrib = DistributionDescriptor();
}
if(!desc.replicaGroups.empty())
{
- Ice::Warning warn(_traceLevels->logger);
- warn << "default application descriptor:\nreplica group definitions are not allowed.";
- desc.replicaGroups.clear();
+ Ice::Warning warn(_traceLevels->logger);
+ warn << "default application descriptor:\nreplica group definitions are not allowed.";
+ desc.replicaGroups.clear();
}
if(!desc.description.empty())
{
- Ice::Warning warn(_traceLevels->logger);
- warn << "default application descriptor:\ndescription is not allowed.";
- desc.description = "";
+ Ice::Warning warn(_traceLevels->logger);
+ warn << "default application descriptor:\ndescription is not allowed.";
+ desc.description = "";
}
if(!desc.variables.empty())
{
- Ice::Warning warn(_traceLevels->logger);
- warn << "default application descriptor:\nvariable definitions are not allowed.";
- desc.variables.clear();
+ Ice::Warning warn(_traceLevels->logger);
+ warn << "default application descriptor:\nvariable definitions are not allowed.";
+ desc.variables.clear();
}
return desc;
}
@@ -334,12 +334,12 @@ AdminI::getServerState(const string& id, const Current&) const
ServerProxyWrapper proxy(_database, id);
try
{
- return proxy->getState();
+ return proxy->getState();
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
- return Inactive;
+ proxy.handleException(ex);
+ return Inactive;
}
}
@@ -349,12 +349,12 @@ AdminI::getServerPid(const string& id, const Current&) const
ServerProxyWrapper proxy(_database, id);
try
{
- return proxy->getPid();
+ return proxy->getPid();
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
- return 0;
+ proxy.handleException(ex);
+ return 0;
}
}
@@ -365,11 +365,11 @@ AdminI::startServer(const string& id, const Current&)
proxy.useActivationTimeout();
try
{
- proxy->start();
+ proxy->start();
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
+ proxy.handleException(ex);
}
}
@@ -380,20 +380,20 @@ AdminI::stopServer(const string& id, const Current&)
proxy.useDeactivationTimeout();
try
{
- proxy->stop();
+ proxy->stop();
}
catch(const Ice::TimeoutException&)
{
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
+ proxy.handleException(ex);
}
}
void
AdminI::patchServer_async(const AMD_Admin_patchServerPtr& amdCB, const string& id, bool shutdown,
- const Current& current)
+ const Current& current)
{
ServerInfo info = _database->getServer(id)->getInfo();
ApplicationInfo appInfo = _database->getApplicationInfo(info.application);
@@ -404,8 +404,8 @@ AdminI::patchServer_async(const AMD_Admin_patchServerPtr& amdCB, const string& i
if(appDistrib.icepatch.empty() && nodes.empty())
{
- amdCB->ice_response();
- return;
+ amdCB->ice_response();
+ return;
}
assert(nodes.size() == 1);
@@ -415,37 +415,37 @@ AdminI::patchServer_async(const AMD_Admin_patchServerPtr& amdCB, const string& i
identity.name = IceUtil::generateUUID();
PatcherFeedbackAggregatorPtr feedback =
- newPatcherFeedback(amdCB, identity, _traceLevels, "server", id, static_cast<int>(nodes.size()));
+ newPatcherFeedback(amdCB, identity, _traceLevels, "server", id, static_cast<int>(nodes.size()));
vector<string>::const_iterator p = nodes.begin();
try
{
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << "started patching of server `" << id << "' on node `" << *p << "'";
- }
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << "started patching of server `" << id << "' on node `" << *p << "'";
+ }
- NodeEntryPtr node = _database->getNode(*p);
- Resolver resolve(node->getInfo(), _database->getCommunicator());
- DistributionDescriptor desc = resolve(appDistrib);
- InternalDistributionDescriptorPtr intAppDistrib = new InternalDistributionDescriptor(desc.icepatch,
- desc.directories);
- node->getSession()->patch(feedback, info.application, id, intAppDistrib, shutdown);
+ NodeEntryPtr node = _database->getNode(*p);
+ Resolver resolve(node->getInfo(), _database->getCommunicator());
+ DistributionDescriptor desc = resolve(appDistrib);
+ InternalDistributionDescriptorPtr intAppDistrib = new InternalDistributionDescriptor(desc.icepatch,
+ desc.directories);
+ node->getSession()->patch(feedback, info.application, id, intAppDistrib, shutdown);
}
catch(const NodeNotExistException&)
{
- feedback->failed(*p, "node doesn't exist");
+ feedback->failed(*p, "node doesn't exist");
}
catch(const NodeUnreachableException& e)
{
- feedback->failed(*p, "node is unreachable: " + e.reason);
+ feedback->failed(*p, "node is unreachable: " + e.reason);
}
catch(const Ice::Exception& e)
{
- ostringstream os;
- os << e;
- feedback->failed(*p, "node is unreachable:\n" + os.str());
+ ostringstream os;
+ os << e;
+ feedback->failed(*p, "node is unreachable:\n" + os.str());
}
}
@@ -455,11 +455,11 @@ AdminI::sendSignal(const string& id, const string& signal, const Current&)
ServerProxyWrapper proxy(_database, id);
try
{
- proxy->sendSignal(signal);
+ proxy->sendSignal(signal);
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
+ proxy.handleException(ex);
}
}
@@ -469,11 +469,11 @@ AdminI::writeMessage(const string& id, const string& message, Int fd, const Curr
ServerProxyWrapper proxy(_database, id);
try
{
- proxy->writeMessage(message, fd);
+ proxy->writeMessage(message, fd);
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
+ proxy.handleException(ex);
}
}
@@ -489,11 +489,11 @@ AdminI::enableServer(const string& id, bool enable, const Ice::Current&)
ServerProxyWrapper proxy(_database, id);
try
{
- proxy->setEnabled(enable);
+ proxy->setEnabled(enable);
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
+ proxy.handleException(ex);
}
}
@@ -503,12 +503,12 @@ AdminI::isServerEnabled(const ::std::string& id, const Ice::Current&) const
ServerProxyWrapper proxy(_database, id);
try
{
- return proxy->isEnabled();
+ return proxy->isEnabled();
}
catch(const Ice::Exception& ex)
{
- proxy.handleException(ex);
- return true; // Keeps the compiler happy.
+ proxy.handleException(ex);
+ return true; // Keeps the compiler happy.
}
}
@@ -537,15 +537,15 @@ AdminI::addObject(const Ice::ObjectPrx& proxy, const ::Ice::Current& current)
checkIsMaster();
try
{
- addObjectWithType(proxy, proxy->ice_id(), current);
+ addObjectWithType(proxy, proxy->ice_id(), current);
}
catch(const Ice::LocalException& e)
{
- ostringstream os;
+ ostringstream os;
- os << "failed to invoke ice_id() on proxy `" + current.adapter->getCommunicator()->proxyToString(proxy);
- os << "':\n" << e;
- throw DeploymentException(os.str());
+ os << "failed to invoke ice_id() on proxy `" + current.adapter->getCommunicator()->proxyToString(proxy);
+ os << "':\n" << e;
+ throw DeploymentException(os.str());
}
}
@@ -556,9 +556,9 @@ AdminI::updateObject(const Ice::ObjectPrx& proxy, const ::Ice::Current& current)
const Ice::Identity id = proxy->ice_getIdentity();
if(id.category == _database->getInstanceName())
{
- DeploymentException ex;
- ex.reason ="updating object `" + _database->getCommunicator()->identityToString(id) + "' is not allowed";
- throw ex;
+ DeploymentException ex;
+ ex.reason ="updating object `" + _database->getCommunicator()->identityToString(id) + "' is not allowed";
+ throw ex;
}
_database->updateObject(proxy);
}
@@ -570,9 +570,9 @@ AdminI::addObjectWithType(const Ice::ObjectPrx& proxy, const string& type, const
const Ice::Identity id = proxy->ice_getIdentity();
if(id.category == _database->getInstanceName())
{
- DeploymentException ex;
- ex.reason = "adding object `" + _database->getCommunicator()->identityToString(id) + "' is not allowed";
- throw ex;
+ DeploymentException ex;
+ ex.reason = "adding object `" + _database->getCommunicator()->identityToString(id) + "' is not allowed";
+ throw ex;
}
ObjectInfo info;
@@ -587,9 +587,9 @@ AdminI::removeObject(const Ice::Identity& id, const Ice::Current& current)
checkIsMaster();
if(id.category == _database->getInstanceName())
{
- DeploymentException ex;
- ex.reason = "removing object `" + _database->getCommunicator()->identityToString(id) + "' is not allowed";
- throw ex;
+ DeploymentException ex;
+ ex.reason = "removing object `" + _database->getCommunicator()->identityToString(id) + "' is not allowed";
+ throw ex;
}
_database->removeObject(id);
}
@@ -623,20 +623,20 @@ AdminI::pingNode(const string& name, const Current&) const
{
try
{
- _database->getNode(name)->getProxy()->ice_ping();
- return true;
+ _database->getNode(name)->getProxy()->ice_ping();
+ return true;
}
catch(const NodeUnreachableException&)
{
- return false;
+ return false;
}
catch(const Ice::ObjectNotExistException&)
{
- throw NodeNotExistException();
+ throw NodeNotExistException();
}
catch(const Ice::LocalException&)
{
- return false;
+ return false;
}
}
@@ -645,17 +645,17 @@ AdminI::getNodeLoad(const string& name, const Current&) const
{
try
{
- return _database->getNode(name)->getProxy()->getLoad();
+ return _database->getNode(name)->getProxy()->getLoad();
}
catch(const Ice::ObjectNotExistException&)
{
- throw NodeNotExistException();
+ throw NodeNotExistException();
}
catch(const Ice::LocalException& ex)
{
- ostringstream os;
- os << ex;
- throw NodeUnreachableException(name, os.str());
+ ostringstream os;
+ os << ex;
+ throw NodeUnreachableException(name, os.str());
}
return LoadInfo(); // Keep the compiler happy.
}
@@ -665,17 +665,17 @@ AdminI::shutdownNode(const string& name, const Current&)
{
try
{
- _database->getNode(name)->getProxy()->shutdown();
+ _database->getNode(name)->getProxy()->shutdown();
}
catch(const Ice::ObjectNotExistException&)
{
- throw NodeNotExistException(name);
+ throw NodeNotExistException(name);
}
catch(const Ice::LocalException& ex)
{
- ostringstream os;
- os << ex;
- throw NodeUnreachableException(name, os.str());
+ ostringstream os;
+ os << ex;
+ throw NodeUnreachableException(name, os.str());
}
}
@@ -684,18 +684,18 @@ AdminI::getNodeHostname(const string& name, const Current&) const
{
try
{
- return _database->getNode(name)->getInfo()->hostname;
+ return _database->getNode(name)->getInfo()->hostname;
}
catch(const Ice::ObjectNotExistException&)
{
- throw NodeNotExistException(name);
+ throw NodeNotExistException(name);
}
catch(const Ice::LocalException& ex)
{
- ostringstream os;
- os << ex;
- throw NodeUnreachableException(name, os.str());
- return ""; // Keep the compiler happy.
+ ostringstream os;
+ os << ex;
+ throw NodeUnreachableException(name, os.str());
+ return ""; // Keep the compiler happy.
}
}
@@ -711,11 +711,11 @@ AdminI::getRegistryInfo(const string& name, const Ice::Current&) const
{
if(name == _registry->getName())
{
- return _registry->getInfo();
+ return _registry->getInfo();
}
else
{
- return toRegistryInfo(_database->getReplica(name)->getInfo());
+ return toRegistryInfo(_database->getReplica(name)->getInfo());
}
}
@@ -724,21 +724,21 @@ AdminI::pingRegistry(const string& name, const Current&) const
{
if(name == _registry->getName())
{
- return true;
+ return true;
}
try
{
- _database->getReplica(name)->getProxy()->ice_ping();
- return true;
+ _database->getReplica(name)->getProxy()->ice_ping();
+ return true;
}
catch(const Ice::ObjectNotExistException&)
{
- throw RegistryNotExistException();
+ throw RegistryNotExistException();
}
catch(const Ice::LocalException&)
{
- return false;
+ return false;
}
return false;
}
@@ -748,23 +748,23 @@ AdminI::shutdownRegistry(const string& name, const Current&)
{
if(name == _registry->getName())
{
- _registry->shutdown();
- return;
+ _registry->shutdown();
+ return;
}
try
{
- _database->getReplica(name)->getProxy()->shutdown();
+ _database->getReplica(name)->getProxy()->shutdown();
}
catch(const Ice::ObjectNotExistException&)
{
- throw RegistryNotExistException(name);
+ throw RegistryNotExistException(name);
}
catch(const Ice::LocalException& ex)
{
- ostringstream os;
- os << ex;
- throw RegistryUnreachableException(name, os.str());
+ ostringstream os;
+ os << ex;
+ throw RegistryUnreachableException(name, os.str());
}
}
@@ -793,9 +793,9 @@ AdminI::checkIsMaster() const
{
if(!_database->isMaster())
{
- DeploymentException ex;
- ex.reason = "this operation is only allowed on the master registry.";
- throw ex;
+ DeploymentException ex;
+ ex.reason = "this operation is only allowed on the master registry.";
+ throw ex;
}
}
diff --git a/cpp/src/IceGrid/AdminI.h b/cpp/src/IceGrid/AdminI.h
index bce347df242..a5c63735ad9 100644
--- a/cpp/src/IceGrid/AdminI.h
+++ b/cpp/src/IceGrid/AdminI.h
@@ -39,9 +39,9 @@ public:
virtual void updateApplication(const ApplicationUpdateDescriptor&, const Ice::Current&);
virtual void removeApplication(const std::string&, const Ice::Current&);
virtual void instantiateServer(const std::string&, const std::string&, const ServerInstanceDescriptor&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void patchApplication_async(const AMD_Admin_patchApplicationPtr&, const std::string&, bool,
- const Ice::Current&);
+ const Ice::Current&);
virtual ApplicationInfo getApplicationInfo(const ::std::string&, const Ice::Current&) const;
virtual ApplicationDescriptor getDefaultApplicationDescriptor(const Ice::Current&) const;
virtual Ice::StringSeq getAllApplicationNames(const Ice::Current&) const;
diff --git a/cpp/src/IceGrid/AdminSessionI.cpp b/cpp/src/IceGrid/AdminSessionI.cpp
index 44a634abd5d..8422018e210 100644
--- a/cpp/src/IceGrid/AdminSessionI.cpp
+++ b/cpp/src/IceGrid/AdminSessionI.cpp
@@ -20,10 +20,10 @@ using namespace std;
using namespace IceGrid;
FileIteratorI::FileIteratorI(const AdminSessionIPtr& session,
- const FileReaderPrx& reader,
- const string& filename,
- Ice::Long offset,
- int messageSizeMax) :
+ const FileReaderPrx& reader,
+ const string& filename,
+ Ice::Long offset,
+ int messageSizeMax) :
_session(session),
_reader(reader),
_filename(filename),
@@ -37,13 +37,13 @@ FileIteratorI::read(int size, Ice::StringSeq& lines, const Ice::Current& current
{
try
{
- return _reader->read(_filename, _offset, size > _messageSizeMax ? _messageSizeMax : size, _offset, lines);
+ return _reader->read(_filename, _offset, size > _messageSizeMax ? _messageSizeMax : size, _offset, lines);
}
catch(const Ice::LocalException& ex)
{
- ostringstream os;
- os << ex;
- throw FileNotAvailableException(os.str());
+ ostringstream os;
+ os << ex;
+ throw FileNotAvailableException(os.str());
}
return false; // Keep the compiler happy.
}
@@ -67,8 +67,8 @@ AdminSessionI::~AdminSessionI()
Ice::ObjectPrx
AdminSessionI::registerWithServantLocator(const SessionServantLocatorIPtr& servantLoc,
- const Ice::ConnectionPtr& con,
- const RegistryIPtr& registry)
+ const Ice::ConnectionPtr& con,
+ const RegistryIPtr& registry)
{
Ice::ObjectPrx proxy = BaseSessionI::registerWithServantLocator(servantLoc, con);
_admin = AdminPrx::uncheckedCast(servantLoc->add(new AdminI(_database, registry, this), con));
@@ -94,18 +94,18 @@ AdminSessionI::getAdmin(const Ice::Current& current) const
void
AdminSessionI::setObservers(const RegistryObserverPrx& registryObserver,
- const NodeObserverPrx& nodeObserver,
- const ApplicationObserverPrx& appObserver,
- const AdapterObserverPrx& adapterObserver,
- const ObjectObserverPrx& objectObserver,
- const Ice::Current& current)
+ const NodeObserverPrx& nodeObserver,
+ const ApplicationObserverPrx& appObserver,
+ const AdapterObserverPrx& adapterObserver,
+ const ObjectObserverPrx& objectObserver,
+ const Ice::Current& current)
{
Lock sync(*this);
if(_destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = current.id;
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
}
if(registryObserver)
@@ -114,7 +114,7 @@ AdminSessionI::setObservers(const RegistryObserverPrx& registryObserver,
}
else
{
- setupObserverSubscription(RegistryObserverTopicName, Ice::ObjectPrx());
+ setupObserverSubscription(RegistryObserverTopicName, Ice::ObjectPrx());
}
if(nodeObserver)
@@ -156,18 +156,18 @@ AdminSessionI::setObservers(const RegistryObserverPrx& registryObserver,
void
AdminSessionI::setObserversByIdentity(const Ice::Identity& registryObserver,
- const Ice::Identity& nodeObserver,
- const Ice::Identity& appObserver,
- const Ice::Identity& adapterObserver,
- const Ice::Identity& objectObserver,
- const Ice::Current& current)
+ const Ice::Identity& nodeObserver,
+ const Ice::Identity& appObserver,
+ const Ice::Identity& adapterObserver,
+ const Ice::Identity& objectObserver,
+ const Ice::Current& current)
{
Lock sync(*this);
if(_destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = current.id;
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
}
setupObserverSubscription(RegistryObserverTopicName, toProxy(registryObserver, current.con));
@@ -184,9 +184,9 @@ AdminSessionI::startUpdate(const Ice::Current& current)
Lock sync(*this);
if(_destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = current.id;
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
}
int serial = _database->lock(this, _id);
@@ -199,9 +199,9 @@ AdminSessionI::finishUpdate(const Ice::Current& current)
Lock sync(*this);
if(_destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = current.id;
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
}
_database->unlock(this);
@@ -249,11 +249,11 @@ AdminSessionI::openRegistryStdOut(const string& name, int nLines, const Ice::Cur
FileReaderPrx reader;
if(name == _replicaName)
{
- reader = _database->getReplicaCache().getInternalRegistry();
+ reader = _database->getReplicaCache().getInternalRegistry();
}
else
{
- reader = _database->getReplica(name)->getProxy();
+ reader = _database->getReplica(name)->getProxy();
}
return addFileIterator(reader, "stdout", nLines, current);
}
@@ -264,11 +264,11 @@ AdminSessionI::openRegistryStdErr(const string& name, int nLines, const Ice::Cur
FileReaderPrx reader;
if(name == _replicaName)
{
- reader = _database->getReplicaCache().getInternalRegistry();
+ reader = _database->getReplicaCache().getInternalRegistry();
}
else
{
- reader = _database->getReplica(name)->getProxy();
+ reader = _database->getReplica(name)->getProxy();
}
return addFileIterator(reader, "stderr", nLines, current);
}
@@ -284,14 +284,14 @@ AdminSessionI::setupObserverSubscription(TopicName name, const Ice::ObjectPrx& o
{
if(_observers[name] && _observers[name] != observer)
{
- _database->getObserverTopic(name)->unsubscribe(_observers[name]);
- _observers[name] = 0;
+ _database->getObserverTopic(name)->unsubscribe(_observers[name]);
+ _observers[name] = 0;
}
if(observer)
{
- _observers[name] = observer;
- _database->getObserverTopic(name)->subscribe(_observers[name]);
+ _observers[name] = observer;
+ _database->getObserverTopic(name)->subscribe(_observers[name]);
}
}
@@ -303,16 +303,16 @@ AdminSessionI::toProxy(const Ice::Identity& id, const Ice::ConnectionPtr& connec
FileIteratorPrx
AdminSessionI::addFileIterator(const FileReaderPrx& reader,
- const string& filename,
- int nLines,
- const Ice::Current& current)
+ const string& filename,
+ int nLines,
+ const Ice::Current& current)
{
Lock sync(*this);
if(_destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = current.id;
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
}
//
@@ -338,12 +338,12 @@ AdminSessionI::addFileIterator(const FileReaderPrx& reader,
Ice::ObjectPtr servant = new FileIteratorI(this, reader, filename, offset, messageSizeMax);
if(_servantLocator)
{
- obj = _servantLocator->add(servant, current.con);
+ obj = _servantLocator->add(servant, current.con);
}
else
{
- assert(_adapter);
- obj = _adapter->addWithUUID(servant);
+ assert(_adapter);
+ obj = _adapter->addWithUUID(servant);
}
_iterators.insert(obj->ice_getIdentity());
return FileIteratorPrx::uncheckedCast(obj);
@@ -355,18 +355,18 @@ AdminSessionI::removeFileIterator(const Ice::Identity& id, const Ice::Current& c
Lock sync(*this);
if(_servantLocator)
{
- _servantLocator->remove(id);
+ _servantLocator->remove(id);
}
else
{
- try
- {
- assert(_adapter);
- _adapter->remove(id);
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- }
+ try
+ {
+ assert(_adapter);
+ _adapter->remove(id);
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ }
}
_iterators.erase(id);
}
@@ -378,7 +378,7 @@ AdminSessionI::destroyImpl(bool shutdown)
try
{
- _database->unlock(this);
+ _database->unlock(this);
}
catch(AccessDeniedException&)
{
@@ -390,58 +390,58 @@ AdminSessionI::destroyImpl(bool shutdown)
//
if(!shutdown)
{
- if(_servantLocator)
- {
- _servantLocator->remove(_admin->ice_getIdentity());
- }
- else if(_adapter)
- {
- try
- {
- _adapter->remove(_admin->ice_getIdentity());
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- }
- }
-
- //
- // Unregister the iterators from the session servant locator or
- // object adapter.
- //
- for(set<Ice::Identity>::const_iterator p = _iterators.begin(); p != _iterators.end(); ++p)
- {
- if(_servantLocator)
- {
- _servantLocator->remove(*p);
- }
- else if(_adapter)
- {
- try
- {
- _adapter->remove(*p);
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- }
- }
- }
-
- //
- // Unsubscribe from the topics.
- //
- setupObserverSubscription(RegistryObserverTopicName, 0);
- setupObserverSubscription(NodeObserverTopicName, 0);
- setupObserverSubscription(ApplicationObserverTopicName, 0);
- setupObserverSubscription(AdapterObserverTopicName, 0);
- setupObserverSubscription(ObjectObserverTopicName, 0);
+ if(_servantLocator)
+ {
+ _servantLocator->remove(_admin->ice_getIdentity());
+ }
+ else if(_adapter)
+ {
+ try
+ {
+ _adapter->remove(_admin->ice_getIdentity());
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ }
+ }
+
+ //
+ // Unregister the iterators from the session servant locator or
+ // object adapter.
+ //
+ for(set<Ice::Identity>::const_iterator p = _iterators.begin(); p != _iterators.end(); ++p)
+ {
+ if(_servantLocator)
+ {
+ _servantLocator->remove(*p);
+ }
+ else if(_adapter)
+ {
+ try
+ {
+ _adapter->remove(*p);
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ }
+ }
+ }
+
+ //
+ // Unsubscribe from the topics.
+ //
+ setupObserverSubscription(RegistryObserverTopicName, 0);
+ setupObserverSubscription(NodeObserverTopicName, 0);
+ setupObserverSubscription(ApplicationObserverTopicName, 0);
+ setupObserverSubscription(AdapterObserverTopicName, 0);
+ setupObserverSubscription(ObjectObserverTopicName, 0);
}
}
AdminSessionFactory::AdminSessionFactory(const Ice::ObjectAdapterPtr& adapter,
- const DatabasePtr& database,
- const ReapThreadPtr& reaper,
- const RegistryIPtr& registry) :
+ const DatabasePtr& database,
+ const ReapThreadPtr& reaper,
+ const RegistryIPtr& registry) :
_adapter(adapter),
_database(database),
_timeout(registry->getSessionTimeout()),
@@ -470,21 +470,21 @@ AdminSessionFactory::createGlacier2Session(const string& sessionId, const Glacie
int timeout = 0;
if(ctl)
{
- try
- {
- ctl->identities()->add(ids);
- }
- catch(const Ice::LocalException&)
- {
- session->destroy(Ice::Current());
- return 0;
- }
- timeout = ctl->getSessionTimeout();
+ try
+ {
+ ctl->identities()->add(ids);
+ }
+ catch(const Ice::LocalException&)
+ {
+ session->destroy(Ice::Current());
+ return 0;
+ }
+ timeout = ctl->getSessionTimeout();
}
if(timeout > 0)
{
- _reaper->add(new SessionReapable<AdminSessionI>(_database->getTraceLevels()->logger, session), timeout);
+ _reaper->add(new SessionReapable<AdminSessionI>(_database->getTraceLevels()->logger, session), timeout);
}
return Glacier2::SessionPrx::uncheckedCast(proxy);
@@ -518,24 +518,24 @@ AdminSSLSessionManagerI::AdminSSLSessionManagerI(const AdminSessionFactoryPtr& f
Glacier2::SessionPrx
AdminSSLSessionManagerI::create(const Glacier2::SSLInfo& info,
- const Glacier2::SessionControlPrx& ctl,
- const Ice::Current& current)
+ const Glacier2::SessionControlPrx& ctl,
+ const Ice::Current& current)
{
string userDN;
if(!info.certs.empty()) // TODO: Require userDN?
{
- try
- {
- IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
- userDN = cert->getSubjectDN();
- }
- catch(const Ice::Exception& ex)
- {
- // This shouldn't happen, the SSLInfo is supposed to be encoded by Glacier2.
- Ice::Error out(_factory->getTraceLevels()->logger);
- out << "SSL session manager couldn't decode SSL certificates:\n" << ex;
- return 0;
- }
+ try
+ {
+ IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
+ userDN = cert->getSubjectDN();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ // This shouldn't happen, the SSLInfo is supposed to be encoded by Glacier2.
+ Ice::Error out(_factory->getTraceLevels()->logger);
+ out << "SSL session manager couldn't decode SSL certificates:\n" << ex;
+ return 0;
+ }
}
return _factory->createGlacier2Session(userDN, ctl);
diff --git a/cpp/src/IceGrid/AdminSessionI.h b/cpp/src/IceGrid/AdminSessionI.h
index 0f0ec222c72..7fc506b7cc9 100644
--- a/cpp/src/IceGrid/AdminSessionI.h
+++ b/cpp/src/IceGrid/AdminSessionI.h
@@ -32,7 +32,7 @@ public:
virtual ~AdminSessionI();
virtual Ice::ObjectPrx registerWithServantLocator(const SessionServantLocatorIPtr&, const Ice::ConnectionPtr&,
- const RegistryIPtr&);
+ const RegistryIPtr&);
virtual Ice::ObjectPrx registerWithObjectAdapter(const Ice::ObjectAdapterPtr&, const RegistryIPtr&);
virtual void keepAlive(const Ice::Current& current) { BaseSessionI::keepAlive(current); }
@@ -40,10 +40,10 @@ public:
virtual AdminPrx getAdmin(const Ice::Current& = Ice::Current()) const;
virtual void setObservers(const RegistryObserverPrx&, const NodeObserverPrx&, const ApplicationObserverPrx&,
- const AdapterObserverPrx&, const ObjectObserverPrx&, const Ice::Current&);
+ const AdapterObserverPrx&, const ObjectObserverPrx&, const Ice::Current&);
virtual void setObserversByIdentity(const Ice::Identity&, const Ice::Identity&, const Ice::Identity&,
- const Ice::Identity&, const Ice::Identity&, const Ice::Current&);
+ const Ice::Identity&, const Ice::Identity&, const Ice::Current&);
virtual int startUpdate(const Ice::Current&);
virtual void finishUpdate(const Ice::Current&);
@@ -121,7 +121,7 @@ public:
AdminSSLSessionManagerI(const AdminSessionFactoryPtr&);
virtual Glacier2::SessionPrx create(const Glacier2::SSLInfo&, const Glacier2::SessionControlPrx&,
- const Ice::Current&);
+ const Ice::Current&);
private:
diff --git a/cpp/src/IceGrid/Allocatable.cpp b/cpp/src/IceGrid/Allocatable.cpp
index 428bed9d086..5d05acda6b8 100644
--- a/cpp/src/IceGrid/Allocatable.cpp
+++ b/cpp/src/IceGrid/Allocatable.cpp
@@ -25,20 +25,20 @@ AllocationRequest::pending()
if(_timeout == 0)
{
- _state = Canceled;
- canceled(AllocationTimeoutException());
- return false;
+ _state = Canceled;
+ canceled(AllocationTimeoutException());
+ return false;
}
else if(!_session->addAllocationRequest(this))
{
- _state = Canceled;
- canceled(AllocationException("session destroyed"));
- return false;
+ _state = Canceled;
+ canceled(AllocationException("session destroyed"));
+ return false;
}
if(_timeout > 0)
{
- _session->getWaitQueue()->add(this, IceUtil::Time::milliSeconds(_timeout));
+ _session->getWaitQueue()->add(this, IceUtil::Time::milliSeconds(_timeout));
}
_state = Pending;
return true;
@@ -51,19 +51,19 @@ AllocationRequest::allocate(const AllocatablePtr& allocatable, const SessionIPtr
switch(_state)
{
case Initial:
- break;
+ break;
case Canceled:
- return false;
+ return false;
case Pending:
- if(_timeout > 0)
- {
- _session->getWaitQueue()->remove(this);
- }
- _session->removeAllocationRequest(this);
- break;
+ if(_timeout > 0)
+ {
+ _session->getWaitQueue()->remove(this);
+ }
+ _session->removeAllocationRequest(this);
+ break;
case Allocated:
- assert(false);
- break;
+ assert(false);
+ break;
}
//
@@ -71,14 +71,14 @@ AllocationRequest::allocate(const AllocatablePtr& allocatable, const SessionIPtr
//
if(_session == session)
{
- _state = Canceled;
- canceled(AllocationException("already allocated by the session"));
- return false;
+ _state = Canceled;
+ canceled(AllocationException("already allocated by the session"));
+ return false;
}
else
{
- _state = Allocated;
- return true;
+ _state = Allocated;
+ return true;
}
}
@@ -89,17 +89,17 @@ AllocationRequest::cancel(const AllocationException& ex)
switch(_state)
{
case Initial:
- break;
+ break;
case Canceled:
case Allocated:
- return;
+ return;
case Pending:
- if(_timeout > 0)
- {
- _session->getWaitQueue()->remove(this);
- }
- _session->removeAllocationRequest(this);
- break;
+ if(_timeout > 0)
+ {
+ _session->getWaitQueue()->remove(this);
+ }
+ _session->removeAllocationRequest(this);
+ break;
}
_state = Canceled;
@@ -113,13 +113,13 @@ AllocationRequest::expired(bool destroyed)
switch(_state)
{
case Initial:
- assert(false);
+ assert(false);
case Canceled:
case Allocated:
- return;
+ return;
case Pending:
- _session->removeAllocationRequest(this);
- break;
+ _session->removeAllocationRequest(this);
+ break;
}
_state = Canceled;
@@ -175,7 +175,7 @@ Allocatable::checkAllocatable()
{
if(!isAllocatable())
{
- throw AllocationException("not allocatable");
+ throw AllocationException("not allocatable");
}
}
@@ -184,11 +184,11 @@ Allocatable::allocate(const AllocationRequestPtr& request, bool fromRelease)
{
try
{
- return allocate(request, false, fromRelease);
+ return allocate(request, false, fromRelease);
}
catch(const SessionDestroyedException&)
{
- return false; // The session was destroyed
+ return false; // The session was destroyed
}
}
@@ -197,11 +197,11 @@ Allocatable::tryAllocate(const AllocationRequestPtr& request, bool fromRelease)
{
try
{
- return allocate(request, true, fromRelease);
+ return allocate(request, true, fromRelease);
}
catch(const AllocationException&)
{
- return false; // Not allocatable
+ return false; // Not allocatable
}
}
@@ -211,117 +211,117 @@ Allocatable::release(const SessionIPtr& session, bool fromRelease)
bool isReleased = false;
bool hasRequests = false;
{
- Lock sync(*this);
- if(!fromRelease)
- {
- while(_releasing)
- {
- wait();
- }
- assert(!_releasing);
- }
-
- if(!_session || _session != session)
- {
- throw AllocationException("can't release object which is not allocated");
- }
-
- if(--_count == 0)
- {
- _session = 0;
-
- released(session);
-
- isReleased = true;
-
- if(!fromRelease && !_requests.empty())
- {
- assert(!_parent);
- _releasing = true; // Prevent new allocations.
- hasRequests = true;
- }
- }
+ Lock sync(*this);
+ if(!fromRelease)
+ {
+ while(_releasing)
+ {
+ wait();
+ }
+ assert(!_releasing);
+ }
+
+ if(!_session || _session != session)
+ {
+ throw AllocationException("can't release object which is not allocated");
+ }
+
+ if(--_count == 0)
+ {
+ _session = 0;
+
+ released(session);
+
+ isReleased = true;
+
+ if(!fromRelease && !_requests.empty())
+ {
+ assert(!_parent);
+ _releasing = true; // Prevent new allocations.
+ hasRequests = true;
+ }
+ }
}
if(isReleased)
{
- releasedNoSync(session);
+ releasedNoSync(session);
}
if(_parent)
{
- _parent->release(session, fromRelease);
+ _parent->release(session, fromRelease);
}
else if(!fromRelease)
{
- if(hasRequests)
- {
- while(true)
- {
- AllocationRequestPtr request;
- AllocatablePtr allocatable;
- {
- Lock sync(*this);
- allocatable = dequeueAllocationAttempt(request);
- if(!allocatable)
- {
- assert(_count == 0 && _requests.empty());
- _releasing = false;
- notifyAll();
- return;
- }
- }
-
- //
- // Try to allocate the allocatable with the request or if
- // there's no request, just notify the allocatable that it can
- // be allocated again.
- //
- if(request && allocatable->allocate(request, true) || !request && allocatable->canTryAllocate())
- {
- while(true)
- {
- {
- Lock sync(*this);
- assert(_count);
-
- allocatable = 0;
- request = 0;
-
- //
- // Check if there's other requests from the session
- // waiting to allocate this allocatable.
- //
- list<pair<AllocatablePtr, AllocationRequestPtr> >::iterator p = _requests.begin();
- while(p != _requests.end())
- {
- if(p->second && p->second->getSession() == _session)
- {
- allocatable = p->first;
- request = p->second;
- _requests.erase(p);
- break;
- }
- ++p;
- }
- if(!allocatable)
- {
- _releasing = false;
- notifyAll();
- return; // We're done, the allocatable was released (but is allocated again)!
- }
- }
-
- assert(allocatable && request);
- allocatable->allocate(request, true);
- }
- }
- }
- }
- else if(isReleased)
- {
- canTryAllocate(); // Notify that this allocatable can be allocated.
- }
+ if(hasRequests)
+ {
+ while(true)
+ {
+ AllocationRequestPtr request;
+ AllocatablePtr allocatable;
+ {
+ Lock sync(*this);
+ allocatable = dequeueAllocationAttempt(request);
+ if(!allocatable)
+ {
+ assert(_count == 0 && _requests.empty());
+ _releasing = false;
+ notifyAll();
+ return;
+ }
+ }
+
+ //
+ // Try to allocate the allocatable with the request or if
+ // there's no request, just notify the allocatable that it can
+ // be allocated again.
+ //
+ if(request && allocatable->allocate(request, true) || !request && allocatable->canTryAllocate())
+ {
+ while(true)
+ {
+ {
+ Lock sync(*this);
+ assert(_count);
+
+ allocatable = 0;
+ request = 0;
+
+ //
+ // Check if there's other requests from the session
+ // waiting to allocate this allocatable.
+ //
+ list<pair<AllocatablePtr, AllocationRequestPtr> >::iterator p = _requests.begin();
+ while(p != _requests.end())
+ {
+ if(p->second && p->second->getSession() == _session)
+ {
+ allocatable = p->first;
+ request = p->second;
+ _requests.erase(p);
+ break;
+ }
+ ++p;
+ }
+ if(!allocatable)
+ {
+ _releasing = false;
+ notifyAll();
+ return; // We're done, the allocatable was released (but is allocated again)!
+ }
+ }
+
+ assert(allocatable && request);
+ allocatable->allocate(request, true);
+ }
+ }
+ }
+ }
+ else if(isReleased)
+ {
+ canTryAllocate(); // Notify that this allocatable can be allocated.
+ }
}
}
@@ -340,20 +340,20 @@ Allocatable::operator<(const Allocatable& r) const
void
Allocatable::queueAllocationAttempt(const AllocatablePtr& allocatable,
- const AllocationRequestPtr& request,
- bool tryAllocate)
+ const AllocationRequestPtr& request,
+ bool tryAllocate)
{
assert(!_parent);
if(!tryAllocate)
{
- if(request->pending())
- {
- _requests.push_back(make_pair(allocatable, request));
- }
+ if(request->pending())
+ {
+ _requests.push_back(make_pair(allocatable, request));
+ }
}
else
{
- _requests.push_back(make_pair(allocatable, AllocationRequestPtr()));
+ _requests.push_back(make_pair(allocatable, AllocationRequestPtr()));
}
}
@@ -362,8 +362,8 @@ Allocatable::queueAllocationAttemptFromChild(const AllocatablePtr& allocatable)
{
if(_parent)
{
- _parent->queueAllocationAttemptFromChild(allocatable);
- return;
+ _parent->queueAllocationAttemptFromChild(allocatable);
+ return;
}
Lock sync(*this);
@@ -375,14 +375,14 @@ Allocatable::dequeueAllocationAttempt(AllocationRequestPtr& request)
{
if(_requests.empty())
{
- return 0;
+ return 0;
}
pair<AllocatablePtr, AllocationRequestPtr> alloc = _requests.front();
_requests.pop_front();
if(alloc.second)
{
- request = alloc.second;
+ request = alloc.second;
}
return alloc.first;
}
@@ -392,130 +392,130 @@ Allocatable::allocate(const AllocationRequestPtr& request, bool tryAllocate, boo
{
if(_parent && !_parent->allocateFromChild(request, this, tryAllocate, fromRelease))
{
- return false;
+ return false;
}
bool queueWithParent = false;
int allocationCount = 0;
try
{
- Lock sync(*this);
- checkAllocatable();
-
- if(!_session && (fromRelease || !_releasing))
- {
- if(request->allocate(this, _session))
- {
- try
- {
- allocated(request->getSession()); // This might throw SessionDestroyedException
- }
- catch(const SessionDestroyedException&)
- {
- request->canceled(AllocationException("session destroyed"));
- throw;
- }
- assert(_count == 0);
- _session = request->getSession();
- request->allocated(this, request->getSession());
- ++_count;
- allocationCount = _count;
- }
- }
- else if(_session == request->getSession())
- {
- if(!tryAllocate)
- {
- if(request->allocate(this, _session))
- {
- assert(_count > 0);
- ++_count;
- request->allocated(this, _session);
- allocationCount = _count;
- }
- }
- else
- {
- queueWithParent = true;
- }
- }
- else
- {
- queueAllocationAttempt(this, request, tryAllocate);
- }
+ Lock sync(*this);
+ checkAllocatable();
+
+ if(!_session && (fromRelease || !_releasing))
+ {
+ if(request->allocate(this, _session))
+ {
+ try
+ {
+ allocated(request->getSession()); // This might throw SessionDestroyedException
+ }
+ catch(const SessionDestroyedException&)
+ {
+ request->canceled(AllocationException("session destroyed"));
+ throw;
+ }
+ assert(_count == 0);
+ _session = request->getSession();
+ request->allocated(this, request->getSession());
+ ++_count;
+ allocationCount = _count;
+ }
+ }
+ else if(_session == request->getSession())
+ {
+ if(!tryAllocate)
+ {
+ if(request->allocate(this, _session))
+ {
+ assert(_count > 0);
+ ++_count;
+ request->allocated(this, _session);
+ allocationCount = _count;
+ }
+ }
+ else
+ {
+ queueWithParent = true;
+ }
+ }
+ else
+ {
+ queueAllocationAttempt(this, request, tryAllocate);
+ }
}
catch(const SessionDestroyedException& ex)
{
- if(_parent)
- {
- _parent->release(request->getSession(), fromRelease);
- }
- throw ex;
+ if(_parent)
+ {
+ _parent->release(request->getSession(), fromRelease);
+ }
+ throw ex;
}
catch(const AllocationException& ex)
{
- if(_parent)
- {
- _parent->release(request->getSession(), fromRelease);
- }
- throw ex;
+ if(_parent)
+ {
+ _parent->release(request->getSession(), fromRelease);
+ }
+ throw ex;
}
if(allocationCount == 1)
{
- allocatedNoSync(request->getSession());
+ allocatedNoSync(request->getSession());
}
else if(allocationCount == 0 && _parent)
{
- if(queueWithParent)
- {
- _parent->queueAllocationAttemptFromChild(this);
- }
- _parent->release(request->getSession(), fromRelease);
+ if(queueWithParent)
+ {
+ _parent->queueAllocationAttemptFromChild(this);
+ }
+ _parent->release(request->getSession(), fromRelease);
}
return allocationCount > 0;
}
bool
Allocatable::allocateFromChild(const AllocationRequestPtr& request,
- const AllocatablePtr& child,
- bool tryAllocate,
- bool fromRelease)
+ const AllocatablePtr& child,
+ bool tryAllocate,
+ bool fromRelease)
{
if(_parent && !_parent->allocateFromChild(request, child, tryAllocate, fromRelease))
{
- return false;
+ return false;
}
int allocationCount = 0;
{
- Lock sync(*this);
- if((!_session || _session == request->getSession()) && (fromRelease || !_releasing))
- {
- if(!_session)
- {
- try
- {
- allocated(request->getSession());
- }
- catch(const SessionDestroyedException&)
- {
- // Ignore
- }
- }
- _session = request->getSession();
- ++_count;
- allocationCount = _count;
- }
- else
- {
- queueAllocationAttempt(child, request, tryAllocate);
- }
+ Lock sync(*this);
+ if((!_session || _session == request->getSession()) && (fromRelease || !_releasing))
+ {
+ if(!_session)
+ {
+ try
+ {
+ allocated(request->getSession());
+ }
+ catch(const SessionDestroyedException&)
+ {
+ // Ignore
+ }
+ }
+ _session = request->getSession();
+ ++_count;
+ allocationCount = _count;
+ }
+ else
+ {
+ queueAllocationAttempt(child, request, tryAllocate);
+ }
}
if(allocationCount == 1)
{
- allocatedNoSync(request->getSession());
+ allocatedNoSync(request->getSession());
}
return allocationCount > 0;
}
diff --git a/cpp/src/IceGrid/Allocatable.h b/cpp/src/IceGrid/Allocatable.h
index 325cfeb6bd7..11543ffc426 100644
--- a/cpp/src/IceGrid/Allocatable.h
+++ b/cpp/src/IceGrid/Allocatable.h
@@ -58,10 +58,10 @@ private:
enum State
{
- Initial,
- Pending,
- Canceled,
- Allocated
+ Initial,
+ Pending,
+ Canceled,
+ Allocated
};
const SessionIPtr _session;
diff --git a/cpp/src/IceGrid/AllocatableObjectCache.cpp b/cpp/src/IceGrid/AllocatableObjectCache.cpp
index 97484f85949..7df3a45afc3 100644
--- a/cpp/src/IceGrid/AllocatableObjectCache.cpp
+++ b/cpp/src/IceGrid/AllocatableObjectCache.cpp
@@ -26,7 +26,7 @@ struct AllocatableObjectEntryCI : binary_function<AllocatableObjectEntryPtr&, Al
bool
operator()(const AllocatableObjectEntryPtr& lhs, const AllocatableObjectEntryPtr& rhs)
{
- return ::Ice::proxyIdentityLess(lhs->getProxy(), rhs->getProxy());
+ return ::Ice::proxyIdentityLess(lhs->getProxy(), rhs->getProxy());
}
};
@@ -45,7 +45,7 @@ AllocatableObjectCache::TypeEntry::add(const AllocatableObjectEntryPtr& obj)
_objects.insert(lower_bound(_objects.begin(), _objects.end(), obj, AllocatableObjectEntryCI()), obj);
if(!_requests.empty())
{
- canTryAllocate(obj, false);
+ canTryAllocate(obj, false);
}
}
@@ -62,10 +62,10 @@ AllocatableObjectCache::TypeEntry::remove(const AllocatableObjectEntryPtr& obj)
if(!_requests.empty() && _objects.empty())
{
- for(list<ObjectAllocationRequestPtr>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
- {
- (*p)->cancel(AllocationException("no allocatable objects with type `" + obj->getType() + "' registered"));
- }
+ for(list<ObjectAllocationRequestPtr>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
+ {
+ (*p)->cancel(AllocationException("no allocatable objects with type `" + obj->getType() + "' registered"));
+ }
}
return _objects.empty();
}
@@ -78,7 +78,7 @@ AllocatableObjectCache::TypeEntry::addAllocationRequest(const ObjectAllocationRe
//
if(request->pending())
{
- _requests.push_back(request);
+ _requests.push_back(request);
}
}
@@ -91,31 +91,31 @@ AllocatableObjectCache::TypeEntry::canTryAllocate(const AllocatableObjectEntryPt
list<ObjectAllocationRequestPtr>::iterator p = _requests.begin();
while(p != _requests.end())
{
- AllocationRequestPtr request = *p;
- try
- {
- if(request->isCanceled()) // If the request has been canceled, we just remove it.
- {
- p = _requests.erase(p);
- }
- else if(entry->tryAllocate(request, fromRelease))
- {
- p = _requests.erase(p);
- return true; // The request successfully allocated the entry!
- }
- else if(entry->getSession()) // If entry is allocated, we're done
- {
- return false;
- }
- else
- {
- ++p;
- }
- }
- catch(const SessionDestroyedException&)
- {
- p = _requests.erase(p);
- }
+ AllocationRequestPtr request = *p;
+ try
+ {
+ if(request->isCanceled()) // If the request has been canceled, we just remove it.
+ {
+ p = _requests.erase(p);
+ }
+ else if(entry->tryAllocate(request, fromRelease))
+ {
+ p = _requests.erase(p);
+ return true; // The request successfully allocated the entry!
+ }
+ else if(entry->getSession()) // If entry is allocated, we're done
+ {
+ return false;
+ }
+ else
+ {
+ ++p;
+ }
+ }
+ catch(const SessionDestroyedException&)
+ {
+ p = _requests.erase(p);
+ }
}
return false;
}
@@ -139,14 +139,14 @@ AllocatableObjectCache::add(const ObjectInfo& info, const AllocatablePtr& parent
map<string, TypeEntry>::iterator p = _types.find(entry->getType());
if(p == _types.end())
{
- p = _types.insert(p, map<string, TypeEntry>::value_type(entry->getType(), TypeEntry()));
+ p = _types.insert(p, map<string, TypeEntry>::value_type(entry->getType(), TypeEntry()));
}
p->second.add(entry);
if(_traceLevels && _traceLevels->object > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << "added allocatable object `" << _communicator->identityToString(id) << "'";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << "added allocatable object `" << _communicator->identityToString(id) << "'";
}
}
@@ -157,7 +157,7 @@ AllocatableObjectCache::get(const Ice::Identity& id) const
AllocatableObjectEntryPtr entry = getImpl(id);
if(!entry)
{
- throw ObjectNotRegisteredException(id);
+ throw ObjectNotRegisteredException(id);
}
return entry;
}
@@ -167,23 +167,23 @@ AllocatableObjectCache::remove(const Ice::Identity& id)
{
AllocatableObjectEntryPtr entry;
{
- Lock sync(*this);
- entry = getImpl(id);
- assert(entry);
- removeImpl(id);
-
- map<string, TypeEntry>::iterator p = _types.find(entry->getType());
- assert(p != _types.end());
- if(p->second.remove(entry))
- {
- _types.erase(p);
- }
-
- if(_traceLevels && _traceLevels->object > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << "removed allocatable object `" << _communicator->identityToString(id) << "'";
- }
+ Lock sync(*this);
+ entry = getImpl(id);
+ assert(entry);
+ removeImpl(id);
+
+ map<string, TypeEntry>::iterator p = _types.find(entry->getType());
+ assert(p != _types.end());
+ if(p->second.remove(entry))
+ {
+ _types.erase(p);
+ }
+
+ if(_traceLevels && _traceLevels->object > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << "removed allocatable object `" << _communicator->identityToString(id) << "'";
+ }
}
//
@@ -202,7 +202,7 @@ AllocatableObjectCache::allocateByType(const string& type, const ObjectAllocatio
map<string, TypeEntry>::iterator p = _types.find(type);
if(p == _types.end())
{
- throw AllocationException("no allocatable objects with type `" + type + "' registered");
+ throw AllocationException("no allocatable objects with type `" + type + "' registered");
}
vector<AllocatableObjectEntryPtr> objects = p->second.getObjects();
@@ -210,17 +210,17 @@ AllocatableObjectCache::allocateByType(const string& type, const ObjectAllocatio
random_shuffle(objects.begin(), objects.end(), rng); // TODO: OPTIMIZE
try
{
- for(vector<AllocatableObjectEntryPtr>::const_iterator q = objects.begin(); q != objects.end(); ++q)
- {
- if((*q)->tryAllocate(request))
- {
- return;
- }
- }
+ for(vector<AllocatableObjectEntryPtr>::const_iterator q = objects.begin(); q != objects.end(); ++q)
+ {
+ if((*q)->tryAllocate(request))
+ {
+ return;
+ }
+ }
}
catch(const SessionDestroyedException&)
{
- return; // The request has been answered already, no need to throw here.
+ return; // The request has been answered already, no need to throw here.
}
p->second.addAllocationRequest(request);
@@ -236,14 +236,14 @@ AllocatableObjectCache::canTryAllocate(const AllocatableObjectEntryPtr& entry)
map<string, TypeEntry>::iterator p = _types.find(entry->getType());
if(p == _types.end())
{
- return false;
+ return false;
}
return p->second.canTryAllocate(entry, true);
}
AllocatableObjectEntry::AllocatableObjectEntry(AllocatableObjectCache& cache,
- const ObjectInfo& info,
- const AllocatablePtr& parent) :
+ const ObjectInfo& info,
+ const AllocatablePtr& parent) :
Allocatable(true, parent),
_cache(cache),
_info(info),
@@ -281,29 +281,29 @@ AllocatableObjectEntry::allocated(const SessionIPtr& session)
TraceLevelsPtr traceLevels = _cache.getTraceLevels();
if(traceLevels && traceLevels->object > 1)
{
- Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
- out << "object `" << _info.proxy->ice_toString() << "' allocated by `" << session->getId() << "' (" << _count
- << ")";
+ Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
+ out << "object `" << _info.proxy->ice_toString() << "' allocated by `" << session->getId() << "' (" << _count
+ << ")";
}
Glacier2::SessionControlPrx ctl = session->getSessionControl();
if(ctl)
{
- try
- {
- Ice::IdentitySeq seq(1);
- seq.push_back(_info.proxy->ice_getIdentity());
- ctl->identities()->add(seq);
- }
- catch(const Ice::LocalException& ex)
- {
- if(traceLevels && traceLevels->object > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
- out << "couldn't add Glacier2 filter for object `" << _info.proxy->ice_toString();
- out << "' allocated by `" << session->getId() << "':\n" << ex;
- }
- }
+ try
+ {
+ Ice::IdentitySeq seq(1);
+ seq.push_back(_info.proxy->ice_getIdentity());
+ ctl->identities()->add(seq);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ if(traceLevels && traceLevels->object > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
+ out << "couldn't add Glacier2 filter for object `" << _info.proxy->ice_toString();
+ out << "' allocated by `" << session->getId() << "':\n" << ex;
+ }
+ }
}
}
@@ -320,28 +320,28 @@ AllocatableObjectEntry::released(const SessionIPtr& session)
Glacier2::SessionControlPrx ctl = session->getSessionControl();
if(ctl)
{
- try
- {
- Ice::IdentitySeq seq(1);
- seq.push_back(_info.proxy->ice_getIdentity());
- ctl->identities()->remove(seq);
- }
- catch(const Ice::LocalException& ex)
- {
- if(traceLevels && traceLevels->object > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
- out << "couldn't remove Glacier2 filter for object `" << _info.proxy->ice_toString();
- out << "' allocated by `" << session->getId() << "':\n" << ex;
- }
- }
+ try
+ {
+ Ice::IdentitySeq seq(1);
+ seq.push_back(_info.proxy->ice_getIdentity());
+ ctl->identities()->remove(seq);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ if(traceLevels && traceLevels->object > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
+ out << "couldn't remove Glacier2 filter for object `" << _info.proxy->ice_toString();
+ out << "' allocated by `" << session->getId() << "':\n" << ex;
+ }
+ }
}
if(traceLevels && traceLevels->object > 1)
{
- Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
- out << "object `" << _info.proxy->ice_toString() << "' released by `" << session->getId() << "' (" << _count
- << ")";
+ Ice::Trace out(traceLevels->logger, traceLevels->objectCat);
+ out << "object `" << _info.proxy->ice_toString() << "' released by `" << session->getId() << "' (" << _count
+ << ")";
}
}
@@ -350,19 +350,19 @@ AllocatableObjectEntry::destroy()
{
SessionIPtr session;
{
- Lock sync(*this);
- _destroyed = true;
- session = _session;
+ Lock sync(*this);
+ _destroyed = true;
+ session = _session;
}
if(session)
{
- try
- {
- release(session);
- }
- catch(const AllocationException&)
- {
- }
+ try
+ {
+ release(session);
+ }
+ catch(const AllocationException&)
+ {
+ }
}
}
@@ -371,7 +371,7 @@ AllocatableObjectEntry::checkAllocatable()
{
if(_destroyed)
{
- throw ObjectNotRegisteredException(_info.proxy->ice_getIdentity());
+ throw ObjectNotRegisteredException(_info.proxy->ice_getIdentity());
}
Allocatable::checkAllocatable();
diff --git a/cpp/src/IceGrid/AllocatableObjectCache.h b/cpp/src/IceGrid/AllocatableObjectCache.h
index a46279e04e1..8c794a1f91f 100644
--- a/cpp/src/IceGrid/AllocatableObjectCache.h
+++ b/cpp/src/IceGrid/AllocatableObjectCache.h
@@ -59,12 +59,12 @@ private:
virtual void allocated(const AllocatablePtr& allocatable, const SessionIPtr& session)
{
- response(AllocatableObjectEntryPtr::dynamicCast(allocatable)->getProxy());
+ response(AllocatableObjectEntryPtr::dynamicCast(allocatable)->getProxy());
}
virtual void canceled(const AllocationException& ex)
{
- exception(ex);
+ exception(ex);
}
};
typedef IceUtil::Handle<ObjectAllocationRequest> ObjectAllocationRequestPtr;
@@ -92,20 +92,20 @@ private:
{
public:
- TypeEntry();
+ TypeEntry();
- void add(const AllocatableObjectEntryPtr&);
- bool remove(const AllocatableObjectEntryPtr&);
-
- void addAllocationRequest(const ObjectAllocationRequestPtr&);
- bool canTryAllocate(const AllocatableObjectEntryPtr&, bool);
+ void add(const AllocatableObjectEntryPtr&);
+ bool remove(const AllocatableObjectEntryPtr&);
+
+ void addAllocationRequest(const ObjectAllocationRequestPtr&);
+ bool canTryAllocate(const AllocatableObjectEntryPtr&, bool);
- const std::vector<AllocatableObjectEntryPtr>& getObjects() const { return _objects; }
+ const std::vector<AllocatableObjectEntryPtr>& getObjects() const { return _objects; }
private:
-
- std::vector<AllocatableObjectEntryPtr> _objects;
- std::list<ObjectAllocationRequestPtr> _requests;
+
+ std::vector<AllocatableObjectEntryPtr> _objects;
+ std::list<ObjectAllocationRequestPtr> _requests;
};
const Ice::CommunicatorPtr _communicator;
diff --git a/cpp/src/IceGrid/Cache.h b/cpp/src/IceGrid/Cache.h
index 284ba6953d0..295aa4a55b4 100644
--- a/cpp/src/IceGrid/Cache.h
+++ b/cpp/src/IceGrid/Cache.h
@@ -38,21 +38,21 @@ public:
bool
has(const Key& key) const
{
- Lock sync(*this);
- return getImpl(key);
+ Lock sync(*this);
+ return getImpl(key);
}
void
remove(const Key& key)
{
- Lock sync(*this);
- removeImpl(key);
+ Lock sync(*this);
+ removeImpl(key);
}
void
setTraceLevels(const TraceLevelsPtr& traceLevels)
{
- _traceLevels = traceLevels;
+ _traceLevels = traceLevels;
}
const TraceLevelsPtr& getTraceLevels() const { return _traceLevels; }
@@ -62,66 +62,66 @@ protected:
virtual ValuePtr
getImpl(const Key& key) const
{
- typename ValueMap::iterator p = const_cast<ValueMap&>(_entries).end();
- if(_entriesHint != p)
- {
- if(_entriesHint->first == key)
- {
- p = _entriesHint;
- }
- }
-
- if(p == const_cast<ValueMap&>(_entries).end())
- {
- p = const_cast<ValueMap&>(_entries).find(key);
- }
-
- if(p != const_cast<ValueMap&>(_entries).end())
- {
- const_cast<typename ValueMap::iterator&>(_entriesHint) = p;
- return p->second;
- }
- else
- {
- return 0;
- }
+ typename ValueMap::iterator p = const_cast<ValueMap&>(_entries).end();
+ if(_entriesHint != p)
+ {
+ if(_entriesHint->first == key)
+ {
+ p = _entriesHint;
+ }
+ }
+
+ if(p == const_cast<ValueMap&>(_entries).end())
+ {
+ p = const_cast<ValueMap&>(_entries).find(key);
+ }
+
+ if(p != const_cast<ValueMap&>(_entries).end())
+ {
+ const_cast<typename ValueMap::iterator&>(_entriesHint) = p;
+ return p->second;
+ }
+ else
+ {
+ return 0;
+ }
}
virtual ValuePtr
addImpl(const Key& key, const ValuePtr& entry)
{
- typename ValueMap::value_type v(key, entry);
- _entriesHint = _entries.insert(_entriesHint, v);
- return entry;
+ typename ValueMap::value_type v(key, entry);
+ _entriesHint = _entries.insert(_entriesHint, v);
+ return entry;
}
virtual void
removeImpl(const Key& key)
{
- typename ValueMap::iterator p = _entries.end();
- if(_entriesHint != _entries.end())
- {
- if(_entriesHint->first == key)
- {
- p = _entriesHint;
- }
- }
-
- if(p == _entries.end())
- {
- p = _entries.find(key);
- }
-
- assert(p != _entries.end());
- if(p->second->canRemove())
- {
- _entries.erase(p);
- _entriesHint = _entries.end();
- }
- else
- {
- _entriesHint = p;
- }
+ typename ValueMap::iterator p = _entries.end();
+ if(_entriesHint != _entries.end())
+ {
+ if(_entriesHint->first == key)
+ {
+ p = _entriesHint;
+ }
+ }
+
+ if(p == _entries.end())
+ {
+ p = _entries.find(key);
+ }
+
+ assert(p != _entries.end());
+ if(p->second->canRemove())
+ {
+ _entries.erase(p);
+ _entriesHint = _entries.end();
+ }
+ else
+ {
+ _entriesHint = p;
+ }
}
TraceLevelsPtr _traceLevels;
@@ -139,8 +139,8 @@ public:
virtual std::vector<std::string>
getAll(const std::string& expr)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- return getMatchingKeys<std::map<std::string,TPtr> >(Cache<std::string, T>::_entries, expr);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ return getMatchingKeys<std::map<std::string,TPtr> >(Cache<std::string, T>::_entries, expr);
}
};
diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp
index 965fc931a3b..08f1b384dd1 100644
--- a/cpp/src/IceGrid/Client.cpp
+++ b/cpp/src/IceGrid/Client.cpp
@@ -33,7 +33,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -48,15 +48,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -103,7 +103,7 @@ static void interruptCallback(int signal)
IceUtil::StaticMutex::Lock lock(_staticMutex);
if(_globalClient)
{
- _globalClient->interrupted();
+ _globalClient->interrupted();
}
}
@@ -118,23 +118,23 @@ void
Client::usage()
{
cerr << "Usage: " << appName() << " [options] [file...]\n";
- cerr <<
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.\n"
- "-DNAME Define NAME as 1.\n"
- "-DNAME=DEF Define NAME as DEF.\n"
- "-UNAME Remove any definition for NAME.\n"
- "-IDIR Put DIR in the include file search path.\n"
- "-e COMMANDS Execute COMMANDS.\n"
- "-d, --debug Print debug messages.\n"
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-DNAME Define NAME as 1.\n"
+ "-DNAME=DEF Define NAME as DEF.\n"
+ "-UNAME Remove any definition for NAME.\n"
+ "-IDIR Put DIR in the include file search path.\n"
+ "-e COMMANDS Execute COMMANDS.\n"
+ "-d, --debug Print debug messages.\n"
"-s, --server Start icegridadmin as a server (to parse XML files).\n"
"-u, --username Login with the given username.\n"
"-p, --password Login with the given password.\n"
"-s, --ssl Authenticate through SSL.\n"
"-r, --routed Login through a Glacier2 router.\n"
"-R, --replica NAME Connect to the replica NAME.\n"
- ;
+ ;
}
int
@@ -144,74 +144,74 @@ Client::main(int argc, char* argv[])
try
{
- _appName = argv[0];
- _communicator = Ice::initialize(argc, argv);
-
- {
- IceUtil::StaticMutex::Lock sync(_staticMutex);
- _globalClient = this;
- }
- _ctrlCHandler.setCallback(interruptCallback);
-
- try
- {
- run(argc, argv);
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- // Expected if the client is interrupted during the initialization.
- }
+ _appName = argv[0];
+ _communicator = Ice::initialize(argc, argv);
+
+ {
+ IceUtil::StaticMutex::Lock sync(_staticMutex);
+ _globalClient = this;
+ }
+ _ctrlCHandler.setCallback(interruptCallback);
+
+ try
+ {
+ run(argc, argv);
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ // Expected if the client is interrupted during the initialization.
+ }
}
catch(const IceUtil::Exception& ex)
{
- cerr << _appName << ": " << ex << endl;
- status = EXIT_FAILURE;
+ cerr << _appName << ": " << ex << endl;
+ status = EXIT_FAILURE;
}
catch(const std::exception& ex)
{
- cerr << _appName << ": std::exception: " << ex.what() << endl;
- status = EXIT_FAILURE;
+ cerr << _appName << ": std::exception: " << ex.what() << endl;
+ status = EXIT_FAILURE;
}
catch(const std::string& msg)
{
- cerr << _appName << ": " << msg << endl;
- status = EXIT_FAILURE;
+ cerr << _appName << ": " << msg << endl;
+ status = EXIT_FAILURE;
}
catch(const char* msg)
{
- cerr << _appName << ": " << msg << endl;
- status = EXIT_FAILURE;
+ cerr << _appName << ": " << msg << endl;
+ status = EXIT_FAILURE;
}
catch(...)
{
- cerr << _appName << ": unknown exception" << endl;
- status = EXIT_FAILURE;
+ cerr << _appName << ": unknown exception" << endl;
+ status = EXIT_FAILURE;
}
if(_communicator)
{
- try
- {
- _communicator->destroy();
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ _communicator->destroy();
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
_ctrlCHandler.setCallback(0);
{
- IceUtil::StaticMutex::Lock sync(_staticMutex);
- _globalClient = 0;
+ IceUtil::StaticMutex::Lock sync(_staticMutex);
+ _globalClient = 0;
}
return status;
-
+
}
void
@@ -220,21 +220,21 @@ Client::interrupted()
Lock sync(*this);
if(_parser) // If there's an interactive parser, notify the parser.
{
- _parser->interrupt();
+ _parser->interrupt();
}
else
{
- //
- // Otherwise, destroy the communicator.
- //
- assert(_communicator);
- try
- {
- _communicator->destroy();
- }
- catch(const Ice::Exception&)
- {
- }
+ //
+ // Otherwise, destroy the communicator.
+ //
+ assert(_communicator);
+ try
+ {
+ _communicator->destroy();
+ }
+ catch(const Ice::Exception&)
+ {
+ }
}
}
@@ -263,103 +263,103 @@ Client::run(int argc, char* argv[])
vector<string> args;
try
{
- args = opts.parse(argc, (const char**)argv);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
cerr << e.reason << endl;
- usage();
- return EXIT_FAILURE;
+ usage();
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage();
- return EXIT_SUCCESS;
+ usage();
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
if(opts.isSet("server"))
{
- ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("FileParser", "tcp -h localhost");
- adapter->activate();
- ObjectPrx proxy = adapter->add(new FileParserI, communicator()->stringToIdentity("FileParser"));
- cout << proxy << endl;
+ ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("FileParser", "tcp -h localhost");
+ adapter->activate();
+ ObjectPrx proxy = adapter->add(new FileParserI, communicator()->stringToIdentity("FileParser"));
+ cout << proxy << endl;
- communicator()->waitForShutdown();
- return EXIT_SUCCESS;
+ communicator()->waitForShutdown();
+ return EXIT_SUCCESS;
}
if(opts.isSet("D"))
{
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -D" + *i;
- }
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cpp += " -D" + *i;
+ }
}
if(opts.isSet("U"))
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -U" + *i;
- }
+ vector<string> optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cpp += " -U" + *i;
+ }
}
if(opts.isSet("I"))
{
- vector<string> optargs = opts.argVec("I");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -I" + *i;
- }
+ vector<string> optargs = opts.argVec("I");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cpp += " -I" + *i;
+ }
}
if(opts.isSet("e"))
{
- vector<string> optargs = opts.argVec("e");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- commands += *i + ";";
- }
+ vector<string> optargs = opts.argVec("e");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ commands += *i + ";";
+ }
}
debug = opts.isSet("debug");
if(!args.empty() && !commands.empty())
{
- cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
- usage();
- return EXIT_FAILURE;
+ cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
+ usage();
+ return EXIT_FAILURE;
}
string instanceName;
if(communicator()->getDefaultLocator())
{
- instanceName = communicator()->getDefaultLocator()->ice_getIdentity().category;
+ instanceName = communicator()->getDefaultLocator()->ice_getIdentity().category;
}
else
{
- instanceName = communicator()->getProperties()->getPropertyWithDefault("IceGrid.InstanceName", "IceGrid");
+ instanceName = communicator()->getProperties()->getPropertyWithDefault("IceGrid.InstanceName", "IceGrid");
}
bool ssl = communicator()->getProperties()->getPropertyAsInt("IceGridAdmin.AuthenticateUsingSSL");
if(opts.isSet("ssl"))
{
- ssl = true;
+ ssl = true;
}
string id = communicator()->getProperties()->getProperty("IceGridAdmin.Username");
if(!opts.optArg("username").empty())
{
- id = opts.optArg("username");
+ id = opts.optArg("username");
}
string password = communicator()->getProperties()->getProperty("IceGridAdmin.Password");
if(!opts.optArg("password").empty())
{
- password = opts.optArg("password");
+ password = opts.optArg("password");
}
//
@@ -370,12 +370,12 @@ Client::run(int argc, char* argv[])
bool routed = properties->getPropertyAsIntWithDefault("IceGridAdmin.Routed", communicator()->getDefaultRouter());
if(opts.isSet("routed"))
{
- routed = true;
+ routed = true;
}
string replica = properties->getProperty("IceGridAdmin.Replica");
if(!opts.optArg("replica").empty())
{
- replica = opts.optArg("replica");
+ replica = opts.optArg("replica");
}
AdminSessionPrx session;
@@ -383,227 +383,227 @@ Client::run(int argc, char* argv[])
int status = EXIT_SUCCESS;
try
{
- int timeout;
- if(routed)
- {
- Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(communicator()->getDefaultRouter());
- if(!router)
- {
- cerr << argv[0] << ": configured router is not a Glacier2 router" << endl;
- return EXIT_FAILURE;
- }
-
- // Use SSL if available.
- try
- {
- router = Glacier2::RouterPrx::checkedCast(router->ice_secure(true));
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- if(ssl)
- {
- session = AdminSessionPrx::uncheckedCast(router->createSessionFromSecureConnection());
- if(!session)
- {
- cerr << argv[0]
- << ": Glacier2 returned a null session, please set the Glacier2.SSLSessionManager property"
- << endl;
- return EXIT_FAILURE;
- }
- }
- else
- {
- while(id.empty())
- {
- cout << "user id: " << flush;
- getline(cin, id);
- id = trim(id);
- }
-
- if(password.empty())
- {
- cout << "password: " << flush;
- getline(cin, password);
- password = trim(password);
- }
-
- session = AdminSessionPrx::uncheckedCast(router->createSession(id, password));
- if(!session)
- {
- cerr << argv[0]
- << ": Glacier2 returned a null session, please set the Glacier2.SessionManager property"
- << endl;
- return EXIT_FAILURE;
- }
- }
- timeout = static_cast<int>(router->getSessionTimeout());
- }
- else
- {
- Identity registryId;
- registryId.category = instanceName;
- registryId.name = "Registry";
- if(!replica.empty() && replica != "Master")
- {
- registryId.name += "-" + replica;
- }
-
- RegistryPrx registry;
- try
- {
- registry = RegistryPrx::checkedCast(
- communicator()->stringToProxy("\"" + communicator()->identityToString(registryId) + "\""));
- if(!registry)
- {
- cerr << argv[0] << ": could not contact registry" << endl;
- return EXIT_FAILURE;
- }
- }
- catch(const Ice::NotRegisteredException&)
- {
- cerr << argv[0] << ": no active registry replica named `" << replica << "'" << endl;
- return EXIT_FAILURE;
- }
-
- // Use SSL if available.
- try
- {
- registry = RegistryPrx::checkedCast(registry->ice_secure(true));
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- if(ssl)
- {
- session = registry->createAdminSessionFromSecureConnection();
- }
- else
- {
- while(id.empty())
- {
- cout << "user id: " << flush;
- getline(cin, id);
- id = trim(id);
- }
-
- if(password.empty())
- {
- cout << "password: " << flush;
- getline(cin, password);
- password = trim(password);
- }
-
- session = registry->createAdminSession(id, password);
- }
- assert(session);
- timeout = registry->getSessionTimeout();
- }
-
- keepAlive = new SessionKeepAliveThread(session, timeout / 2);
- keepAlive->start();
-
- AdminPrx admin = session->getAdmin();
-
- Ice::SliceChecksumDict serverChecksums = admin->getSliceChecksums();
- Ice::SliceChecksumDict localChecksums = Ice::sliceChecksums();
-
- //
- // The following slice types are only used by the admin CLI.
- //
- localChecksums.erase("::IceGrid::FileParser");
- localChecksums.erase("::IceGrid::ParseException");
-
- for(Ice::SliceChecksumDict::const_iterator q = localChecksums.begin(); q != localChecksums.end(); ++q)
- {
- Ice::SliceChecksumDict::const_iterator r = serverChecksums.find(q->first);
- if(r == serverChecksums.end())
- {
- cerr << appName() << ": server is using unknown Slice type `" << q->first << "'" << endl;
- }
- else if(q->second != r->second)
- {
- cerr << appName() << ": server is using a different Slice definition of `" << q->first << "'" << endl;
- }
- }
-
- {
- Lock sync(*this);
- _parser = Parser::createParser(communicator(), session, admin, args.empty() && commands.empty());
- }
-
- if(!args.empty()) // Files given
- {
- // Process files given on the command line
- for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
- {
- ifstream test(i->c_str());
- if(!test)
- {
- cerr << appName() << ": can't open `" << *i << "' for reading: " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
- test.close();
-
- string cmd = cpp + " " + *i;
+ int timeout;
+ if(routed)
+ {
+ Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(communicator()->getDefaultRouter());
+ if(!router)
+ {
+ cerr << argv[0] << ": configured router is not a Glacier2 router" << endl;
+ return EXIT_FAILURE;
+ }
+
+ // Use SSL if available.
+ try
+ {
+ router = Glacier2::RouterPrx::checkedCast(router->ice_secure(true));
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ if(ssl)
+ {
+ session = AdminSessionPrx::uncheckedCast(router->createSessionFromSecureConnection());
+ if(!session)
+ {
+ cerr << argv[0]
+ << ": Glacier2 returned a null session, please set the Glacier2.SSLSessionManager property"
+ << endl;
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ while(id.empty())
+ {
+ cout << "user id: " << flush;
+ getline(cin, id);
+ id = trim(id);
+ }
+
+ if(password.empty())
+ {
+ cout << "password: " << flush;
+ getline(cin, password);
+ password = trim(password);
+ }
+
+ session = AdminSessionPrx::uncheckedCast(router->createSession(id, password));
+ if(!session)
+ {
+ cerr << argv[0]
+ << ": Glacier2 returned a null session, please set the Glacier2.SessionManager property"
+ << endl;
+ return EXIT_FAILURE;
+ }
+ }
+ timeout = static_cast<int>(router->getSessionTimeout());
+ }
+ else
+ {
+ Identity registryId;
+ registryId.category = instanceName;
+ registryId.name = "Registry";
+ if(!replica.empty() && replica != "Master")
+ {
+ registryId.name += "-" + replica;
+ }
+
+ RegistryPrx registry;
+ try
+ {
+ registry = RegistryPrx::checkedCast(
+ communicator()->stringToProxy("\"" + communicator()->identityToString(registryId) + "\""));
+ if(!registry)
+ {
+ cerr << argv[0] << ": could not contact registry" << endl;
+ return EXIT_FAILURE;
+ }
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ cerr << argv[0] << ": no active registry replica named `" << replica << "'" << endl;
+ return EXIT_FAILURE;
+ }
+
+ // Use SSL if available.
+ try
+ {
+ registry = RegistryPrx::checkedCast(registry->ice_secure(true));
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ if(ssl)
+ {
+ session = registry->createAdminSessionFromSecureConnection();
+ }
+ else
+ {
+ while(id.empty())
+ {
+ cout << "user id: " << flush;
+ getline(cin, id);
+ id = trim(id);
+ }
+
+ if(password.empty())
+ {
+ cout << "password: " << flush;
+ getline(cin, password);
+ password = trim(password);
+ }
+
+ session = registry->createAdminSession(id, password);
+ }
+ assert(session);
+ timeout = registry->getSessionTimeout();
+ }
+
+ keepAlive = new SessionKeepAliveThread(session, timeout / 2);
+ keepAlive->start();
+
+ AdminPrx admin = session->getAdmin();
+
+ Ice::SliceChecksumDict serverChecksums = admin->getSliceChecksums();
+ Ice::SliceChecksumDict localChecksums = Ice::sliceChecksums();
+
+ //
+ // The following slice types are only used by the admin CLI.
+ //
+ localChecksums.erase("::IceGrid::FileParser");
+ localChecksums.erase("::IceGrid::ParseException");
+
+ for(Ice::SliceChecksumDict::const_iterator q = localChecksums.begin(); q != localChecksums.end(); ++q)
+ {
+ Ice::SliceChecksumDict::const_iterator r = serverChecksums.find(q->first);
+ if(r == serverChecksums.end())
+ {
+ cerr << appName() << ": server is using unknown Slice type `" << q->first << "'" << endl;
+ }
+ else if(q->second != r->second)
+ {
+ cerr << appName() << ": server is using a different Slice definition of `" << q->first << "'" << endl;
+ }
+ }
+
+ {
+ Lock sync(*this);
+ _parser = Parser::createParser(communicator(), session, admin, args.empty() && commands.empty());
+ }
+
+ if(!args.empty()) // Files given
+ {
+ // Process files given on the command line
+ for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
+ {
+ ifstream test(i->c_str());
+ if(!test)
+ {
+ cerr << appName() << ": can't open `" << *i << "' for reading: " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+ test.close();
+
+ string cmd = cpp + " " + *i;
#ifdef _WIN32
- FILE* cppHandle = _popen(cmd.c_str(), "r");
+ FILE* cppHandle = _popen(cmd.c_str(), "r");
#else
- FILE* cppHandle = popen(cmd.c_str(), "r");
+ FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if(cppHandle == NULL)
- {
- cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
-
- int parseStatus = _parser->parse(cppHandle, debug);
-
+ if(cppHandle == NULL)
+ {
+ cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+
+ int parseStatus = _parser->parse(cppHandle, debug);
+
#ifdef _WIN32
- _pclose(cppHandle);
+ _pclose(cppHandle);
#else
- pclose(cppHandle);
+ pclose(cppHandle);
#endif
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
- }
- else if(!commands.empty()) // Commands were given
- {
- int parseStatus = _parser->parse(commands, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
- else // No commands, let's use standard input
- {
- _parser->showBanner();
-
- int parseStatus = _parser->parse(stdin, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ }
+ else if(!commands.empty()) // Commands were given
+ {
+ int parseStatus = _parser->parse(commands, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ else // No commands, let's use standard input
+ {
+ _parser->showBanner();
+
+ int parseStatus = _parser->parse(stdin, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
}
catch(const IceGrid::PermissionDeniedException& ex)
{
- cout << "permission denied:\n" << ex.reason << endl;
- return EXIT_FAILURE;
+ cout << "permission denied:\n" << ex.reason << endl;
+ return EXIT_FAILURE;
}
catch(...)
{
- if(keepAlive)
- {
- keepAlive->destroy();
- keepAlive->getThreadControl().join();
- }
+ if(keepAlive)
+ {
+ keepAlive->destroy();
+ keepAlive->getThreadControl().join();
+ }
if(session)
{
@@ -615,7 +615,7 @@ Client::run(int argc, char* argv[])
{
}
}
- throw;
+ throw;
}
keepAlive->destroy();
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp
index aa4803f9269..15dafc7bf4d 100644
--- a/cpp/src/IceGrid/Database.cpp
+++ b/cpp/src/IceGrid/Database.cpp
@@ -38,17 +38,17 @@ struct ObjectLoadCI : binary_function<pair<Ice::ObjectPrx, float>&, pair<Ice::Ob
{
bool operator()(const pair<Ice::ObjectPrx, float>& lhs, const pair<Ice::ObjectPrx, float>& rhs)
{
- return lhs.second < rhs.second;
+ return lhs.second < rhs.second;
}
};
}
Database::Database(const Ice::ObjectAdapterPtr& registryAdapter,
- const IceStorm::TopicManagerPrx& topicManager,
- const string& instanceName,
- const TraceLevelsPtr& traceLevels,
- const RegistryInfo& info) :
+ const IceStorm::TopicManagerPrx& topicManager,
+ const string& instanceName,
+ const TraceLevelsPtr& traceLevels,
+ const RegistryInfo& info) :
_communicator(registryAdapter->getCommunicator()),
_internalAdapter(registryAdapter),
_topicManager(topicManager),
@@ -72,31 +72,31 @@ Database::Database(const Ice::ObjectAdapterPtr& registryAdapter,
ServerEntrySeq entries;
for(StringApplicationInfoDict::iterator p = _applications.begin(); p != _applications.end(); ++p)
{
- try
- {
- //
- // Create an application helper for the application
- // without instantiating. The application might be invalid
- // if we need to upgrade it.
- //
- ApplicationInfo info = p->second;
-
- ApplicationHelper helper(_communicator, p->second.descriptor, false, false);
- if(helper.upgrade(info.descriptor))
- {
- ++info.revision;
- info.updateUser = "IceGrid Registry (database upgrade)";
- info.updateTime = IceUtil::Time::now().toMilliSeconds();
- p.set(info);
- }
-
- load(ApplicationHelper(_communicator, info.descriptor), entries, info.uuid, info.revision);
- }
- catch(const DeploymentException& ex)
- {
- Ice::Error err(_traceLevels->logger);
- err << "invalid application `" << p->first << "':\n" << ex.reason;
- }
+ try
+ {
+ //
+ // Create an application helper for the application
+ // without instantiating. The application might be invalid
+ // if we need to upgrade it.
+ //
+ ApplicationInfo info = p->second;
+
+ ApplicationHelper helper(_communicator, p->second.descriptor, false, false);
+ if(helper.upgrade(info.descriptor))
+ {
+ ++info.revision;
+ info.updateUser = "IceGrid Registry (database upgrade)";
+ info.updateTime = IceUtil::Time::now().toMilliSeconds();
+ p.set(info);
+ }
+
+ load(ApplicationHelper(_communicator, info.descriptor), entries, info.uuid, info.revision);
+ }
+ catch(const DeploymentException& ex)
+ {
+ Ice::Error err(_traceLevels->logger);
+ err << "invalid application `" << p->first << "':\n" << ex.reason;
+ }
}
_serverCache.setTraceLevels(_traceLevels);
@@ -141,17 +141,17 @@ Database::getObserverTopic(TopicName name) const
switch(name)
{
case RegistryObserverTopicName:
- return _registryObserverTopic;
+ return _registryObserverTopic;
case NodeObserverTopicName:
- return _nodeObserverTopic;
+ return _nodeObserverTopic;
case ApplicationObserverTopicName:
- return _applicationObserverTopic;
+ return _applicationObserverTopic;
case AdapterObserverTopicName:
- return _adapterObserverTopic;
+ return _adapterObserverTopic;
case ObjectObserverTopicName:
- return _objectObserverTopic;
+ return _objectObserverTopic;
default:
- break;
+ break;
}
return 0;
}
@@ -161,7 +161,7 @@ Database::checkSessionLock(AdminSessionI* session)
{
if(_lock != 0 && session != _lock)
{
- throw AccessDeniedException(_lockUserId); // Lock held by another session.
+ throw AccessDeniedException(_lockUserId); // Lock held by another session.
}
}
@@ -172,7 +172,7 @@ Database::lock(AdminSessionI* session, const string& userId)
if(_lock != 0 && session != _lock)
{
- throw AccessDeniedException(_lockUserId); // Lock held by another session.
+ throw AccessDeniedException(_lockUserId); // Lock held by another session.
}
assert(_lock == 0 || _lock == session);
@@ -188,7 +188,7 @@ Database::unlock(AdminSessionI* session)
Lock sync(*this);
if(_lock != session)
{
- throw AccessDeniedException();
+ throw AccessDeniedException();
}
_lock = 0;
@@ -200,54 +200,54 @@ Database::syncApplications(const ApplicationInfoSeq& applications)
{
int serial;
{
- Lock sync(*this);
+ Lock sync(*this);
- Freeze::TransactionHolder txHolder(_connection);
- ServerEntrySeq entries;
- set<string> names;
- for(ApplicationInfoSeq::const_iterator p = applications.begin(); p != applications.end(); ++p)
- {
- try
- {
- StringApplicationInfoDict::const_iterator s = _applications.find(p->descriptor.name);
- if(s != _applications.end())
- {
- ApplicationHelper previous(_communicator, s->second.descriptor);
- ApplicationHelper helper(_communicator, p->descriptor);
- reload(previous, helper, entries, p->uuid, p->revision);
- }
- else
- {
- load(ApplicationHelper(_communicator, p->descriptor), entries, p->uuid, p->revision);
- }
- }
- catch(const DeploymentException& ex)
- {
- Ice::Warning warn(_traceLevels->logger);
- warn << "invalid application `" << p->descriptor.name << "':\n" << ex.reason;
- }
- _applications.put(StringApplicationInfoDict::value_type(p->descriptor.name, *p));
- names.insert(p->descriptor.name);
- }
-
- StringApplicationInfoDict::iterator s = _applications.begin();
- while(s != _applications.end())
- {
- if(names.find(s->first) == names.end())
- {
- unload(ApplicationHelper(_communicator, s->second.descriptor), entries);
- _applications.erase(s++);
- }
- else
- {
- ++s;
- }
- }
- ++_applicationSerial;
+ Freeze::TransactionHolder txHolder(_connection);
+ ServerEntrySeq entries;
+ set<string> names;
+ for(ApplicationInfoSeq::const_iterator p = applications.begin(); p != applications.end(); ++p)
+ {
+ try
+ {
+ StringApplicationInfoDict::const_iterator s = _applications.find(p->descriptor.name);
+ if(s != _applications.end())
+ {
+ ApplicationHelper previous(_communicator, s->second.descriptor);
+ ApplicationHelper helper(_communicator, p->descriptor);
+ reload(previous, helper, entries, p->uuid, p->revision);
+ }
+ else
+ {
+ load(ApplicationHelper(_communicator, p->descriptor), entries, p->uuid, p->revision);
+ }
+ }
+ catch(const DeploymentException& ex)
+ {
+ Ice::Warning warn(_traceLevels->logger);
+ warn << "invalid application `" << p->descriptor.name << "':\n" << ex.reason;
+ }
+ _applications.put(StringApplicationInfoDict::value_type(p->descriptor.name, *p));
+ names.insert(p->descriptor.name);
+ }
+
+ StringApplicationInfoDict::iterator s = _applications.begin();
+ while(s != _applications.end())
+ {
+ if(names.find(s->first) == names.end())
+ {
+ unload(ApplicationHelper(_communicator, s->second.descriptor), entries);
+ _applications.erase(s++);
+ }
+ else
+ {
+ ++s;
+ }
+ }
+ ++_applicationSerial;
- serial = _applicationObserverTopic->applicationInit(_applicationSerial, applications);
+ serial = _applicationObserverTopic->applicationInit(_applicationSerial, applications);
- txHolder.commit();
+ txHolder.commit();
}
_applicationObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -257,15 +257,15 @@ Database::syncAdapters(const AdapterInfoSeq& adapters)
{
int serial;
{
- Lock sync(*this);
- Freeze::TransactionHolder txHolder(_connection);
- _adapters.clear();
- for(AdapterInfoSeq::const_iterator r = adapters.begin(); r != adapters.end(); ++r)
- {
- _adapters.put(StringAdapterInfoDict::value_type(r->id, *r));
- }
- serial = _adapterObserverTopic->adapterInit(adapters);
- txHolder.commit();
+ Lock sync(*this);
+ Freeze::TransactionHolder txHolder(_connection);
+ _adapters.clear();
+ for(AdapterInfoSeq::const_iterator r = adapters.begin(); r != adapters.end(); ++r)
+ {
+ _adapters.put(StringAdapterInfoDict::value_type(r->id, *r));
+ }
+ serial = _adapterObserverTopic->adapterInit(adapters);
+ txHolder.commit();
}
_adapterObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -275,15 +275,15 @@ Database::syncObjects(const ObjectInfoSeq& objects)
{
int serial;
{
- Lock sync(*this);
- Freeze::TransactionHolder txHolder(_connection);
- _objects.clear();
- for(ObjectInfoSeq::const_iterator q = objects.begin(); q != objects.end(); ++q)
- {
- _objects.put(IdentityObjectInfoDict::value_type(q->proxy->ice_getIdentity(), *q));
- }
- serial = _objectObserverTopic->objectInit(objects);
- txHolder.commit();
+ Lock sync(*this);
+ Freeze::TransactionHolder txHolder(_connection);
+ _objects.clear();
+ for(ObjectInfoSeq::const_iterator q = objects.begin(); q != objects.end(); ++q)
+ {
+ _objects.put(IdentityObjectInfoDict::value_type(q->proxy->ice_getIdentity(), *q));
+ }
+ serial = _objectObserverTopic->objectInit(objects);
+ txHolder.commit();
}
_objectObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -293,62 +293,62 @@ Database::addApplication(const ApplicationInfo& info, AdminSessionI* session)
{
ServerEntrySeq entries;
{
- Lock sync(*this);
- checkSessionLock(session);
+ Lock sync(*this);
+ checkSessionLock(session);
- while(_updating.find(info.descriptor.name) != _updating.end())
- {
- wait();
- }
+ while(_updating.find(info.descriptor.name) != _updating.end())
+ {
+ wait();
+ }
- if(_applications.find(info.descriptor.name) != _applications.end())
- {
- throw DeploymentException("application `" + info.descriptor.name + "' already exists");
- }
+ if(_applications.find(info.descriptor.name) != _applications.end())
+ {
+ throw DeploymentException("application `" + info.descriptor.name + "' already exists");
+ }
- ApplicationHelper helper(_communicator, info.descriptor, true);
- checkForAddition(helper);
- load(helper, entries, info.uuid, info.revision);
- startUpdating(info.descriptor.name);
+ ApplicationHelper helper(_communicator, info.descriptor, true);
+ checkForAddition(helper);
+ load(helper, entries, info.uuid, info.revision);
+ startUpdating(info.descriptor.name);
}
if(_master)
{
- try
- {
- for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::syncAndWait));
- }
- catch(const DeploymentException& ex)
- {
- try
- {
- Lock sync(*this);
- entries.clear();
- unload(ApplicationHelper(_communicator, info.descriptor), entries);
- }
- catch(const DeploymentException& ex)
- {
- Ice::Error err(_traceLevels->logger);
- err << "failed to rollback previous application `" << info.descriptor.name << "':\n" << ex.reason;
- }
- finishUpdating(info.descriptor.name);
- throw ex;
- }
+ try
+ {
+ for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::syncAndWait));
+ }
+ catch(const DeploymentException& ex)
+ {
+ try
+ {
+ Lock sync(*this);
+ entries.clear();
+ unload(ApplicationHelper(_communicator, info.descriptor), entries);
+ }
+ catch(const DeploymentException& ex)
+ {
+ Ice::Error err(_traceLevels->logger);
+ err << "failed to rollback previous application `" << info.descriptor.name << "':\n" << ex.reason;
+ }
+ finishUpdating(info.descriptor.name);
+ throw ex;
+ }
}
int serial;
{
- Lock sync(*this);
- ++_applicationSerial;
- _applications.put(StringApplicationInfoDict::value_type(info.descriptor.name, info));
+ Lock sync(*this);
+ ++_applicationSerial;
+ _applications.put(StringApplicationInfoDict::value_type(info.descriptor.name, info));
- serial = _applicationObserverTopic->applicationAdded(_applicationSerial, info);
+ serial = _applicationObserverTopic->applicationAdded(_applicationSerial, info);
- if(_traceLevels->application > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat);
- out << "added application `" << info.descriptor.name << "'";
- }
+ if(_traceLevels->application > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat);
+ out << "added application `" << info.descriptor.name << "'";
+ }
}
_applicationObserverTopic->waitForSyncedSubscribers(serial);
@@ -364,35 +364,35 @@ Database::updateApplication(const ApplicationUpdateInfo& updt, AdminSessionI* se
ApplicationDescriptor newDesc;
ApplicationUpdateInfo update = updt;
{
- Lock sync(*this);
- checkSessionLock(session);
+ Lock sync(*this);
+ checkSessionLock(session);
- while(_updating.find(update.descriptor.name) != _updating.end())
- {
- wait();
- }
+ while(_updating.find(update.descriptor.name) != _updating.end())
+ {
+ wait();
+ }
- StringApplicationInfoDict::const_iterator p = _applications.find(update.descriptor.name);
- if(p == _applications.end())
- {
- throw ApplicationNotExistException(update.descriptor.name);
- }
- oldApp = p->second;
+ StringApplicationInfoDict::const_iterator p = _applications.find(update.descriptor.name);
+ if(p == _applications.end())
+ {
+ throw ApplicationNotExistException(update.descriptor.name);
+ }
+ oldApp = p->second;
- if(update.revision < 0)
- {
- update.revision = oldApp.revision + 1;
- }
+ if(update.revision < 0)
+ {
+ update.revision = oldApp.revision + 1;
+ }
- ApplicationHelper previous(_communicator, oldApp.descriptor);
- ApplicationHelper helper(_communicator, previous.update(update.descriptor), true);
+ ApplicationHelper previous(_communicator, oldApp.descriptor);
+ ApplicationHelper helper(_communicator, previous.update(update.descriptor), true);
- checkForUpdate(previous, helper);
- reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1);
+ checkForUpdate(previous, helper);
+ reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1);
- newDesc = helper.getDefinition();
+ newDesc = helper.getDefinition();
- startUpdating(update.descriptor.name);
+ startUpdating(update.descriptor.name);
}
finishApplicationUpdate(entries, update, oldApp, newDesc, session);
@@ -405,33 +405,33 @@ Database::syncApplicationDescriptor(const ApplicationDescriptor& newDesc, AdminS
ApplicationUpdateInfo update;
ApplicationInfo oldApp;
{
- Lock sync(*this);
- checkSessionLock(session);
+ Lock sync(*this);
+ checkSessionLock(session);
- while(_updating.find(update.descriptor.name) != _updating.end())
- {
- wait();
- }
+ while(_updating.find(update.descriptor.name) != _updating.end())
+ {
+ wait();
+ }
- StringApplicationInfoDict::const_iterator p = _applications.find(newDesc.name);
- if(p == _applications.end())
- {
- throw ApplicationNotExistException(newDesc.name);
- }
- oldApp = p->second;
+ StringApplicationInfoDict::const_iterator p = _applications.find(newDesc.name);
+ if(p == _applications.end())
+ {
+ throw ApplicationNotExistException(newDesc.name);
+ }
+ oldApp = p->second;
- ApplicationHelper previous(_communicator, oldApp.descriptor);
- ApplicationHelper helper(_communicator, newDesc, true);
+ ApplicationHelper previous(_communicator, oldApp.descriptor);
+ ApplicationHelper helper(_communicator, newDesc, true);
- update.updateTime = IceUtil::Time::now().toMilliSeconds();
- update.updateUser = _lockUserId;
- update.revision = oldApp.revision + 1;
- update.descriptor = helper.diff(previous);
-
- checkForUpdate(previous, helper);
- reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1);
+ update.updateTime = IceUtil::Time::now().toMilliSeconds();
+ update.updateUser = _lockUserId;
+ update.revision = oldApp.revision + 1;
+ update.descriptor = helper.diff(previous);
+
+ checkForUpdate(previous, helper);
+ reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1);
- startUpdating(update.descriptor.name);
+ startUpdating(update.descriptor.name);
}
finishApplicationUpdate(entries, update, oldApp, newDesc, session);
@@ -439,44 +439,44 @@ Database::syncApplicationDescriptor(const ApplicationDescriptor& newDesc, AdminS
void
Database::instantiateServer(const string& application,
- const string& node,
- const ServerInstanceDescriptor& instance,
- AdminSessionI* session)
+ const string& node,
+ const ServerInstanceDescriptor& instance,
+ AdminSessionI* session)
{
ServerEntrySeq entries;
ApplicationUpdateInfo update;
ApplicationInfo oldApp;
ApplicationDescriptor newDesc;
{
- Lock sync(*this);
- checkSessionLock(session);
+ Lock sync(*this);
+ checkSessionLock(session);
- while(_updating.find(application) != _updating.end())
- {
- wait();
- }
+ while(_updating.find(application) != _updating.end())
+ {
+ wait();
+ }
- StringApplicationInfoDict::const_iterator p = _applications.find(application);
- if(p == _applications.end())
- {
- throw ApplicationNotExistException(application);
- }
- oldApp = p->second;
+ StringApplicationInfoDict::const_iterator p = _applications.find(application);
+ if(p == _applications.end())
+ {
+ throw ApplicationNotExistException(application);
+ }
+ oldApp = p->second;
- ApplicationHelper previous(_communicator, oldApp.descriptor);
- ApplicationHelper helper(_communicator, previous.instantiateServer(node, instance), true);
+ ApplicationHelper previous(_communicator, oldApp.descriptor);
+ ApplicationHelper helper(_communicator, previous.instantiateServer(node, instance), true);
- update.updateTime = IceUtil::Time::now().toMilliSeconds();
- update.updateUser = _lockUserId;
- update.revision = oldApp.revision + 1;
- update.descriptor = helper.diff(previous);
+ update.updateTime = IceUtil::Time::now().toMilliSeconds();
+ update.updateUser = _lockUserId;
+ update.revision = oldApp.revision + 1;
+ update.descriptor = helper.diff(previous);
- checkForUpdate(previous, helper);
- reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1);
+ checkForUpdate(previous, helper);
+ reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1);
- newDesc = helper.getDefinition();
+ newDesc = helper.getDefinition();
- startUpdating(update.descriptor.name);
+ startUpdating(update.descriptor.name);
}
finishApplicationUpdate(entries, update, oldApp, newDesc, session);
@@ -488,55 +488,55 @@ Database::removeApplication(const string& name, AdminSessionI* session)
ServerEntrySeq entries;
int serial;
{
- Lock sync(*this);
- checkSessionLock(session);
-
- while(_updating.find(name) != _updating.end())
- {
- wait();
- }
-
- StringApplicationInfoDict::iterator p = _applications.find(name);
- if(p == _applications.end())
- {
- throw ApplicationNotExistException(name);
- }
-
- try
- {
- ApplicationHelper helper(_communicator, p->second.descriptor);
- unload(helper, entries);
- }
- catch(const DeploymentException&)
- {
- //
- // For some reasons the application became invalid. If
- // it's invalid, it's most likely not loaded either. So we
- // ignore the error and erase the descriptor.
- //
- }
-
- startUpdating(name);
+ Lock sync(*this);
+ checkSessionLock(session);
+
+ while(_updating.find(name) != _updating.end())
+ {
+ wait();
+ }
+
+ StringApplicationInfoDict::iterator p = _applications.find(name);
+ if(p == _applications.end())
+ {
+ throw ApplicationNotExistException(name);
+ }
+
+ try
+ {
+ ApplicationHelper helper(_communicator, p->second.descriptor);
+ unload(helper, entries);
+ }
+ catch(const DeploymentException&)
+ {
+ //
+ // For some reasons the application became invalid. If
+ // it's invalid, it's most likely not loaded either. So we
+ // ignore the error and erase the descriptor.
+ //
+ }
+
+ startUpdating(name);
}
if(_master)
{
- for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync));
- for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitNoThrow));
+ for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync));
+ for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitNoThrow));
}
{
- Lock sync(*this);
- _applications.erase(name);
- ++_applicationSerial;
+ Lock sync(*this);
+ _applications.erase(name);
+ ++_applicationSerial;
- serial = _applicationObserverTopic->applicationRemoved(_applicationSerial, name);
+ serial = _applicationObserverTopic->applicationRemoved(_applicationSerial, name);
- if(_traceLevels->application > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat);
- out << "removed application `" << name << "'";
- }
+ if(_traceLevels->application > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat);
+ out << "removed application `" << name << "'";
+ }
}
_applicationObserverTopic->waitForSyncedSubscribers(serial);
@@ -553,7 +553,7 @@ Database::getApplicationInfo(const std::string& name)
StringApplicationInfoDict::const_iterator p = descriptors.find(name);
if(p == descriptors.end())
{
- throw ApplicationNotExistException(name);
+ throw ApplicationNotExistException(name);
}
return p->second;
@@ -569,18 +569,18 @@ Database::getAllApplications(const string& expression)
void
Database::waitForApplicationUpdate(const AMD_NodeSession_waitForApplicationUpdatePtr& cb,
- const string& application,
- int revision)
+ const string& application,
+ int revision)
{
Lock sync(*this);
map<string, vector<AMD_NodeSession_waitForApplicationUpdatePtr> >::iterator p = _updating.find(application);
if(p != _updating.end())
{
- p->second.push_back(cb);
+ p->second.push_back(cb);
}
else
{
- cb->ice_response();
+ cb->ice_response();
}
}
@@ -637,67 +637,67 @@ Database::setAdapterDirectProxy(const string& adapterId, const string& replicaGr
{
int serial;
{
- Lock sync(*this);
- if(_adapterCache.has(adapterId))
- {
- throw AdapterExistsException(adapterId);
- }
-
- StringAdapterInfoDict::iterator p = _adapters.find(adapterId);
- AdapterInfo info;
- bool updated = false;
- if(proxy)
- {
- if(p != _adapters.end())
- {
- info = p->second;
- info.proxy = proxy;
- info.replicaGroupId = replicaGroupId;
- p.set(info);
- updated = true;
- }
- else
- {
- info.id = adapterId;
- info.proxy = proxy;
- info.replicaGroupId = replicaGroupId;
- _adapters.put(StringAdapterInfoDict::value_type(adapterId, info));
- }
- }
- else
- {
- if(p == _adapters.end())
- {
- return;
- }
- _adapters.erase(p);
- }
-
- if(_traceLevels->adapter > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
- out << (proxy ? (updated ? "updated" : "added") : "removed") << " adapter `" << adapterId << "'";
- if(!replicaGroupId.empty())
- {
- out << " with replica group `" << replicaGroupId << "'";
- }
- }
+ Lock sync(*this);
+ if(_adapterCache.has(adapterId))
+ {
+ throw AdapterExistsException(adapterId);
+ }
+
+ StringAdapterInfoDict::iterator p = _adapters.find(adapterId);
+ AdapterInfo info;
+ bool updated = false;
+ if(proxy)
+ {
+ if(p != _adapters.end())
+ {
+ info = p->second;
+ info.proxy = proxy;
+ info.replicaGroupId = replicaGroupId;
+ p.set(info);
+ updated = true;
+ }
+ else
+ {
+ info.id = adapterId;
+ info.proxy = proxy;
+ info.replicaGroupId = replicaGroupId;
+ _adapters.put(StringAdapterInfoDict::value_type(adapterId, info));
+ }
+ }
+ else
+ {
+ if(p == _adapters.end())
+ {
+ return;
+ }
+ _adapters.erase(p);
+ }
+
+ if(_traceLevels->adapter > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
+ out << (proxy ? (updated ? "updated" : "added") : "removed") << " adapter `" << adapterId << "'";
+ if(!replicaGroupId.empty())
+ {
+ out << " with replica group `" << replicaGroupId << "'";
+ }
+ }
- if(proxy)
- {
- if(updated)
- {
- serial = _adapterObserverTopic->adapterUpdated(info);
- }
- else
- {
- serial = _adapterObserverTopic->adapterAdded(info);
- }
- }
- else
- {
- serial = _adapterObserverTopic->adapterRemoved(adapterId);
- }
+ if(proxy)
+ {
+ if(updated)
+ {
+ serial = _adapterObserverTopic->adapterUpdated(info);
+ }
+ else
+ {
+ serial = _adapterObserverTopic->adapterAdded(info);
+ }
+ }
+ else
+ {
+ serial = _adapterObserverTopic->adapterRemoved(adapterId);
+ }
}
_adapterObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -710,18 +710,18 @@ Database::getAdapterDirectProxy(const string& id)
StringAdapterInfoDict::const_iterator p = adapters.find(id);
if(p != adapters.end())
{
- return p->second.proxy;
+ return p->second.proxy;
}
Ice::EndpointSeq endpoints;
for(p = adapters.findByReplicaGroupId(id, true); p != adapters.end(); ++p)
{
- Ice::EndpointSeq edpts = p->second.proxy->ice_getEndpoints();
- endpoints.insert(endpoints.end(), edpts.begin(), edpts.end());
+ Ice::EndpointSeq edpts = p->second.proxy->ice_getEndpoints();
+ endpoints.insert(endpoints.end(), edpts.begin(), edpts.end());
}
if(!endpoints.empty())
{
- return _communicator->stringToProxy("dummy:default")->ice_endpoints(endpoints);
+ return _communicator->stringToProxy("dummy:default")->ice_endpoints(endpoints);
}
throw AdapterNotExistException(id);
@@ -732,61 +732,61 @@ Database::removeAdapter(const string& adapterId)
{
int serial;
{
- Lock sync(*this);
- if(_adapterCache.has(adapterId))
- {
- AdapterEntryPtr adpt = _adapterCache.get(adapterId);
- DeploymentException ex;
- ex.reason = "removing adapter `" + adapterId + "' is not allowed:\n";
- ex.reason += "the adapter was added with the application descriptor `" + adpt->getApplication() + "'";
- throw ex;
- }
-
- Freeze::TransactionHolder txHolder(_connection); // Required because of the iterator
-
- StringAdapterInfoDict::iterator p = _adapters.find(adapterId);
- AdapterInfoSeq infos;
- if(p != _adapters.end())
- {
- _adapters.erase(p);
- }
- else
- {
- p = _adapters.findByReplicaGroupId(adapterId, true);
- if(p == _adapters.end())
- {
- throw AdapterNotExistException(adapterId);
- }
-
- while(p != _adapters.end())
- {
- AdapterInfo info = p->second;
- info.replicaGroupId = "";
- infos.push_back(info);
- _adapters.put(StringAdapterInfoDict::value_type(p->first, info));
- ++p;
- }
- }
-
- if(_traceLevels->adapter > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
- out << "removed " << (infos.empty() ? "adapter" : "replica group") << " `" << adapterId << "'";
- }
-
- if(infos.empty())
- {
- serial = _adapterObserverTopic->adapterRemoved(adapterId);
- }
- else
- {
- for(AdapterInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p)
- {
- serial = _adapterObserverTopic->adapterUpdated(*p);
- }
- }
-
- txHolder.commit();
+ Lock sync(*this);
+ if(_adapterCache.has(adapterId))
+ {
+ AdapterEntryPtr adpt = _adapterCache.get(adapterId);
+ DeploymentException ex;
+ ex.reason = "removing adapter `" + adapterId + "' is not allowed:\n";
+ ex.reason += "the adapter was added with the application descriptor `" + adpt->getApplication() + "'";
+ throw ex;
+ }
+
+ Freeze::TransactionHolder txHolder(_connection); // Required because of the iterator
+
+ StringAdapterInfoDict::iterator p = _adapters.find(adapterId);
+ AdapterInfoSeq infos;
+ if(p != _adapters.end())
+ {
+ _adapters.erase(p);
+ }
+ else
+ {
+ p = _adapters.findByReplicaGroupId(adapterId, true);
+ if(p == _adapters.end())
+ {
+ throw AdapterNotExistException(adapterId);
+ }
+
+ while(p != _adapters.end())
+ {
+ AdapterInfo info = p->second;
+ info.replicaGroupId = "";
+ infos.push_back(info);
+ _adapters.put(StringAdapterInfoDict::value_type(p->first, info));
+ ++p;
+ }
+ }
+
+ if(_traceLevels->adapter > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->adapterCat);
+ out << "removed " << (infos.empty() ? "adapter" : "replica group") << " `" << adapterId << "'";
+ }
+
+ if(infos.empty())
+ {
+ serial = _adapterObserverTopic->adapterRemoved(adapterId);
+ }
+ else
+ {
+ for(AdapterInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p)
+ {
+ serial = _adapterObserverTopic->adapterUpdated(*p);
+ }
+ }
+
+ txHolder.commit();
}
_adapterObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -807,7 +807,7 @@ Database::getAdapterInfo(const string& id)
//
try
{
- return _adapterCache.get(id)->getAdapterInfo();
+ return _adapterCache.get(id)->getAdapterInfo();
}
catch(AdapterNotExistException&)
{
@@ -822,9 +822,9 @@ Database::getAdapterInfo(const string& id)
StringAdapterInfoDict::const_iterator p = adapters.find(id);
if(p != adapters.end())
{
- AdapterInfoSeq infos;
- infos.push_back(p->second);
- return infos;
+ AdapterInfoSeq infos;
+ infos.push_back(p->second);
+ return infos;
}
//
@@ -834,13 +834,13 @@ Database::getAdapterInfo(const string& id)
p = adapters.findByReplicaGroupId(id, true);
if(p != adapters.end())
{
- AdapterInfoSeq infos;
- while(p != adapters.end())
- {
- infos.push_back(p->second);
- ++p;
- }
- return infos;
+ AdapterInfoSeq infos;
+ while(p != adapters.end())
+ {
+ infos.push_back(p->second);
+ ++p;
+ }
+ return infos;
}
throw AdapterNotExistException(id);
@@ -857,15 +857,15 @@ Database::getAllAdapters(const string& expression)
set<string> groups;
for(StringAdapterInfoDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
- if(expression.empty() || IceUtil::match(p->first, expression, true))
- {
- result.push_back(p->first);
- }
- string replicaGroupId = p->second.replicaGroupId;
- if(!replicaGroupId.empty() && (expression.empty() || IceUtil::match(replicaGroupId, expression, true)))
- {
- groups.insert(replicaGroupId);
- }
+ if(expression.empty() || IceUtil::match(p->first, expression, true))
+ {
+ result.push_back(p->first);
+ }
+ string replicaGroupId = p->second.replicaGroupId;
+ if(!replicaGroupId.empty() && (expression.empty() || IceUtil::match(replicaGroupId, expression, true)))
+ {
+ groups.insert(replicaGroupId);
+ }
}
//
// COMPILERFIX: We're not using result.insert() here, this doesn't compile on Sun.
@@ -873,7 +873,7 @@ Database::getAllAdapters(const string& expression)
//result.insert(result.end(), groups.begin(), groups.end())
for(set<string>::const_iterator q = groups.begin(); q != groups.end(); ++q)
{
- result.push_back(*q);
+ result.push_back(*q);
}
return result;
}
@@ -883,27 +883,27 @@ Database::addObject(const ObjectInfo& info)
{
int serial;
{
- Lock sync(*this);
- const Ice::Identity id = info.proxy->ice_getIdentity();
-
- if(_objectCache.has(id))
- {
- throw ObjectExistsException(id);
- }
-
- if(_objects.find(id) != _objects.end())
- {
- throw ObjectExistsException(id);
- }
- _objects.put(IdentityObjectInfoDict::value_type(id, info));
-
- serial = _objectObserverTopic->objectAdded(info);
-
- if(_traceLevels->object > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << "added object `" << _communicator->identityToString(id) << "'";
- }
+ Lock sync(*this);
+ const Ice::Identity id = info.proxy->ice_getIdentity();
+
+ if(_objectCache.has(id))
+ {
+ throw ObjectExistsException(id);
+ }
+
+ if(_objects.find(id) != _objects.end())
+ {
+ throw ObjectExistsException(id);
+ }
+ _objects.put(IdentityObjectInfoDict::value_type(id, info));
+
+ serial = _objectObserverTopic->objectAdded(info);
+
+ if(_traceLevels->object > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << "added object `" << _communicator->identityToString(id) << "'";
+ }
}
_objectObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -913,31 +913,31 @@ Database::addOrUpdateObject(const ObjectInfo& info)
{
int serial;
{
- Lock sync(*this);
- const Ice::Identity id = info.proxy->ice_getIdentity();
-
- if(_objectCache.has(id))
- {
- throw ObjectExistsException(id);
- }
-
- bool update = _objects.find(id) != _objects.end();
- _objects.put(IdentityObjectInfoDict::value_type(id, info));
-
- if(update)
- {
- serial = _objectObserverTopic->objectUpdated(info);
- }
- else
- {
- serial = _objectObserverTopic->objectAdded(info);
- }
-
- if(_traceLevels->object > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << (!update ? "added" : "updated") << " object `" << _communicator->identityToString(id) << "'";
- }
+ Lock sync(*this);
+ const Ice::Identity id = info.proxy->ice_getIdentity();
+
+ if(_objectCache.has(id))
+ {
+ throw ObjectExistsException(id);
+ }
+
+ bool update = _objects.find(id) != _objects.end();
+ _objects.put(IdentityObjectInfoDict::value_type(id, info));
+
+ if(update)
+ {
+ serial = _objectObserverTopic->objectUpdated(info);
+ }
+ else
+ {
+ serial = _objectObserverTopic->objectAdded(info);
+ }
+
+ if(_traceLevels->object > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << (!update ? "added" : "updated") << " object `" << _communicator->identityToString(id) << "'";
+ }
}
_objectObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -947,33 +947,33 @@ Database::removeObject(const Ice::Identity& id)
{
int serial;
{
- Lock sync(*this);
- if(_objectCache.has(id))
- {
- DeploymentException ex;
- ex.reason = "removing object `" + _communicator->identityToString(id) + "' is not allowed:\n";
- ex.reason += "the object was added with the application descriptor `";
- ex.reason += _objectCache.get(id)->getApplication();
- ex.reason += "'";
- throw ex;
- }
-
- IdentityObjectInfoDict::iterator p = _objects.find(id);
- if(p == _objects.end())
- {
- ObjectNotRegisteredException ex;
- ex.id = id;
- throw ex;
- }
- _objects.erase(p);
-
- serial = _objectObserverTopic->objectRemoved(id);
-
- if(_traceLevels->object > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << "removed object `" << _communicator->identityToString(id) << "'";
- }
+ Lock sync(*this);
+ if(_objectCache.has(id))
+ {
+ DeploymentException ex;
+ ex.reason = "removing object `" + _communicator->identityToString(id) + "' is not allowed:\n";
+ ex.reason += "the object was added with the application descriptor `";
+ ex.reason += _objectCache.get(id)->getApplication();
+ ex.reason += "'";
+ throw ex;
+ }
+
+ IdentityObjectInfoDict::iterator p = _objects.find(id);
+ if(p == _objects.end())
+ {
+ ObjectNotRegisteredException ex;
+ ex.id = id;
+ throw ex;
+ }
+ _objects.erase(p);
+
+ serial = _objectObserverTopic->objectRemoved(id);
+
+ if(_traceLevels->object > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << "removed object `" << _communicator->identityToString(id) << "'";
+ }
}
_objectObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -983,39 +983,39 @@ Database::updateObject(const Ice::ObjectPrx& proxy)
{
int serial;
{
- Lock sync(*this);
-
- const Ice::Identity id = proxy->ice_getIdentity();
- if(_objectCache.has(id))
- {
- DeploymentException ex;
- ex.reason = "updating object `" + _communicator->identityToString(id) + "' is not allowed:\n";
- ex.reason += "the object was added with the application descriptor `";
- ex.reason += _objectCache.get(id)->getApplication();
- ex.reason += "'";
- throw ex;
- }
+ Lock sync(*this);
+
+ const Ice::Identity id = proxy->ice_getIdentity();
+ if(_objectCache.has(id))
+ {
+ DeploymentException ex;
+ ex.reason = "updating object `" + _communicator->identityToString(id) + "' is not allowed:\n";
+ ex.reason += "the object was added with the application descriptor `";
+ ex.reason += _objectCache.get(id)->getApplication();
+ ex.reason += "'";
+ throw ex;
+ }
- IdentityObjectInfoDict::iterator p = _objects.find(id);
- if(p == _objects.end())
- {
- ObjectNotRegisteredException ex;
- ex.id = id;
- throw ex;
- }
-
- ObjectInfo info;
- info = p->second;
- info.proxy = proxy;
- p.set(info);
+ IdentityObjectInfoDict::iterator p = _objects.find(id);
+ if(p == _objects.end())
+ {
+ ObjectNotRegisteredException ex;
+ ex.id = id;
+ throw ex;
+ }
+
+ ObjectInfo info;
+ info = p->second;
+ info.proxy = proxy;
+ p.set(info);
- serial = _objectObserverTopic->objectUpdated(info);
-
- if(_traceLevels->object > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << "updated object `" << _communicator->identityToString(id) << "'";
- }
+ serial = _objectObserverTopic->objectUpdated(info);
+
+ if(_traceLevels->object > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << "updated object `" << _communicator->identityToString(id) << "'";
+ }
}
_objectObserverTopic->waitForSyncedSubscribers(serial);
}
@@ -1027,7 +1027,7 @@ Database::addOrUpdateObjectsInDatabase(const ObjectInfoSeq& objects)
Freeze::TransactionHolder txHolder(_connection);
for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
{
- _objects.put(IdentityObjectInfoDict::value_type(p->proxy->ice_getIdentity(), *p));
+ _objects.put(IdentityObjectInfoDict::value_type(p->proxy->ice_getIdentity(), *p));
}
int serial = _objectObserverTopic->objectsAddedOrUpdated(objects);
txHolder.commit();
@@ -1041,7 +1041,7 @@ Database::removeObjectsInDatabase(const ObjectInfoSeq& objects)
Freeze::TransactionHolder txHolder(_connection);
for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
{
- _objects.erase(p->proxy->ice_getIdentity());
+ _objects.erase(p->proxy->ice_getIdentity());
}
_objectObserverTopic->objectsRemoved(objects);
txHolder.commit();
@@ -1052,10 +1052,10 @@ Database::getObjectProxy(const Ice::Identity& id)
{
try
{
- //
- // Only return proxies for non allocatable objects.
- //
- return _objectCache.get(id)->getProxy();
+ //
+ // Only return proxies for non allocatable objects.
+ //
+ return _objectCache.get(id)->getProxy();
}
catch(ObjectNotRegisteredException&)
{
@@ -1066,9 +1066,9 @@ Database::getObjectProxy(const Ice::Identity& id)
IdentityObjectInfoDict::const_iterator p = objects.find(id);
if(p == objects.end())
{
- ObjectNotRegisteredException ex;
- ex.id = id;
- throw ex;
+ ObjectNotRegisteredException ex;
+ ex.id = id;
+ throw ex;
}
return p->second.proxy;
}
@@ -1079,7 +1079,7 @@ Database::getObjectByType(const string& type)
Ice::ObjectProxySeq objs = getObjectsByType(type);
if(objs.empty())
{
- return 0;
+ return 0;
}
return objs[IceUtil::random(static_cast<int>(objs.size()))];
}
@@ -1090,7 +1090,7 @@ Database::getObjectByTypeOnLeastLoadedNode(const string& type, LoadSample sample
Ice::ObjectProxySeq objs = getObjectsByType(type);
if(objs.empty())
{
- return 0;
+ return 0;
}
RandomNumberGenerator rng;
@@ -1099,18 +1099,18 @@ Database::getObjectByTypeOnLeastLoadedNode(const string& type, LoadSample sample
objectsWithLoad.reserve(objs.size());
for(Ice::ObjectProxySeq::const_iterator p = objs.begin(); p != objs.end(); ++p)
{
- float load = 1.0f;
- if(!(*p)->ice_getAdapterId().empty())
- {
- try
- {
- load = _adapterCache.get((*p)->ice_getAdapterId())->getLeastLoadedNodeLoad(sample);
- }
- catch(const AdapterNotExistException&)
- {
- }
- }
- objectsWithLoad.push_back(make_pair(*p, load));
+ float load = 1.0f;
+ if(!(*p)->ice_getAdapterId().empty())
+ {
+ try
+ {
+ load = _adapterCache.get((*p)->ice_getAdapterId())->getLeastLoadedNodeLoad(sample);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ }
+ objectsWithLoad.push_back(make_pair(*p, load));
}
return min_element(objectsWithLoad.begin(), objectsWithLoad.end(), ObjectLoadCI())->first;
}
@@ -1124,7 +1124,7 @@ Database::getObjectsByType(const string& type)
IdentityObjectInfoDict objects(connection, _objectDbName);
for(IdentityObjectInfoDict::const_iterator p = objects.findByType(type); p != objects.end(); ++p)
{
- proxies.push_back(p->second.proxy);
+ proxies.push_back(p->second.proxy);
}
return proxies;
}
@@ -1134,8 +1134,8 @@ Database::getObjectInfo(const Ice::Identity& id)
{
try
{
- ObjectEntryPtr object = _objectCache.get(id);
- return object->getObjectInfo();
+ ObjectEntryPtr object = _objectCache.get(id);
+ return object->getObjectInfo();
}
catch(ObjectNotRegisteredException&)
{
@@ -1146,7 +1146,7 @@ Database::getObjectInfo(const Ice::Identity& id)
IdentityObjectInfoDict::const_iterator p = objects.find(id);
if(p == objects.end())
{
- throw ObjectNotRegisteredException(id);
+ throw ObjectNotRegisteredException(id);
}
return p->second;
}
@@ -1159,10 +1159,10 @@ Database::getAllObjectInfos(const string& expression)
IdentityObjectInfoDict objects(connection, _objectDbName);
for(IdentityObjectInfoDict::const_iterator p = objects.begin(); p != objects.end(); ++p)
{
- if(expression.empty() || IceUtil::match(_communicator->identityToString(p->first), expression, true))
- {
- infos.push_back(p->second);
- }
+ if(expression.empty() || IceUtil::match(_communicator->identityToString(p->first), expression, true))
+ {
+ infos.push_back(p->second);
+ }
}
return infos;
}
@@ -1175,7 +1175,7 @@ Database::getObjectInfosByType(const string& type)
IdentityObjectInfoDict objects(connection, _objectDbName);
for(IdentityObjectInfoDict::const_iterator p = objects.findByType(type); p != objects.end(); ++p)
{
- infos.push_back(p->second);
+ infos.push_back(p->second);
}
return infos;
}
@@ -1183,11 +1183,11 @@ Database::getObjectInfosByType(const string& type)
void
Database::addInternalObject(const ObjectInfo& info, bool replace)
{
- Lock sync(*this);
+ Lock sync(*this);
const Ice::Identity id = info.proxy->ice_getIdentity();
if(!replace && _internalObjects.find(id) != _internalObjects.end())
{
- throw ObjectExistsException(id);
+ throw ObjectExistsException(id);
}
_internalObjects.put(IdentityObjectInfoDict::value_type(id, info));
}
@@ -1199,9 +1199,9 @@ Database::removeInternalObject(const Ice::Identity& id)
IdentityObjectInfoDict::iterator p = _internalObjects.find(id);
if(p == _internalObjects.end())
{
- ObjectNotRegisteredException ex;
- ex.id = id;
- throw ex;
+ ObjectNotRegisteredException ex;
+ ex.id = id;
+ throw ex;
}
_internalObjects.erase(p);
}
@@ -1214,7 +1214,7 @@ Database::getInternalObjectsByType(const string& type)
Ice::ObjectProxySeq proxies;
for(IdentityObjectInfoDict::const_iterator p = internalObjects.findByType(type); p != internalObjects.end(); ++p)
{
- proxies.push_back(p->second.proxy);
+ proxies.push_back(p->second.proxy);
}
return proxies;
}
@@ -1261,9 +1261,9 @@ Database::checkServerForAddition(const string& id)
{
if(_serverCache.has(id))
{
- DeploymentException ex;
- ex.reason = "server `" + id + "' is already registered";
- throw ex;
+ DeploymentException ex;
+ ex.reason = "server `" + id + "' is already registered";
+ throw ex;
}
}
@@ -1274,9 +1274,9 @@ Database::checkAdapterForAddition(const string& id)
_adapters.find(id) != _adapters.end() ||
_adapters.findByReplicaGroupId(id) != _adapters.end())
{
- DeploymentException ex;
- ex.reason = "adapter `" + id + "' is already registered";
- throw ex;
+ DeploymentException ex;
+ ex.reason = "adapter `" + id + "' is already registered";
+ throw ex;
}
}
@@ -1287,9 +1287,9 @@ Database::checkObjectForAddition(const Ice::Identity& objectId)
_allocatableObjectCache.has(objectId) ||
_objects.find(objectId) != _objects.end())
{
- DeploymentException ex;
- ex.reason = "object `" + _communicator->identityToString(objectId) + "' is already registered";
- throw ex;
+ DeploymentException ex;
+ ex.reason = "object `" + _communicator->identityToString(objectId) + "' is already registered";
+ throw ex;
}
}
@@ -1300,27 +1300,27 @@ Database::load(const ApplicationHelper& app, ServerEntrySeq& entries, const stri
const string application = app.getInstance().name;
for(NodeDescriptorDict::const_iterator n = nodes.begin(); n != nodes.end(); ++n)
{
- _nodeCache.get(n->first, true)->addDescriptor(application, n->second);
+ _nodeCache.get(n->first, true)->addDescriptor(application, n->second);
}
const ReplicaGroupDescriptorSeq& adpts = app.getInstance().replicaGroups;
for(ReplicaGroupDescriptorSeq::const_iterator r = adpts.begin(); r != adpts.end(); ++r)
{
- assert(!r->id.empty());
- _adapterCache.addReplicaGroup(*r, application);
- for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
- {
- ObjectInfo info;
- info.type = o->type;
- info.proxy = _communicator->stringToProxy("\"" + _communicator->identityToString(o->id) + "\" @ " + r->id);
- _objectCache.add(info, application);
- }
+ assert(!r->id.empty());
+ _adapterCache.addReplicaGroup(*r, application);
+ for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
+ {
+ ObjectInfo info;
+ info.type = o->type;
+ info.proxy = _communicator->stringToProxy("\"" + _communicator->identityToString(o->id) + "\" @ " + r->id);
+ _objectCache.add(info, application);
+ }
}
map<string, ServerInfo> servers = app.getServerInfos(uuid, revision);
for(map<string, ServerInfo>::const_iterator p = servers.begin(); p != servers.end(); ++p)
{
- entries.push_back(_serverCache.add(p->second));
+ entries.push_back(_serverCache.add(p->second));
}
}
@@ -1330,33 +1330,33 @@ Database::unload(const ApplicationHelper& app, ServerEntrySeq& entries)
map<string, ServerInfo> servers = app.getServerInfos("", 0);
for(map<string, ServerInfo>::const_iterator p = servers.begin(); p != servers.end(); ++p)
{
- entries.push_back(_serverCache.remove(p->first));
+ entries.push_back(_serverCache.remove(p->first));
}
const ReplicaGroupDescriptorSeq& adpts = app.getInstance().replicaGroups;
for(ReplicaGroupDescriptorSeq::const_iterator r = adpts.begin(); r != adpts.end(); ++r)
{
- for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
- {
- _objectCache.remove(o->id);
- }
- _adapterCache.removeReplicaGroup(r->id);
+ for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
+ {
+ _objectCache.remove(o->id);
+ }
+ _adapterCache.removeReplicaGroup(r->id);
}
const NodeDescriptorDict& nodes = app.getInstance().nodes;
const string application = app.getInstance().name;
for(NodeDescriptorDict::const_iterator n = nodes.begin(); n != nodes.end(); ++n)
{
- _nodeCache.get(n->first)->removeDescriptor(application);
+ _nodeCache.get(n->first)->removeDescriptor(application);
}
}
void
Database::reload(const ApplicationHelper& oldApp,
- const ApplicationHelper& newApp,
- ServerEntrySeq& entries,
- const string& uuid,
- int revision)
+ const ApplicationHelper& newApp,
+ ServerEntrySeq& entries,
+ const string& uuid,
+ int revision)
{
const string application = oldApp.getInstance().name;
@@ -1369,24 +1369,24 @@ Database::reload(const ApplicationHelper& oldApp,
map<string, ServerInfo>::const_iterator p;
for(p = newServers.begin(); p != newServers.end(); ++p)
{
- map<string, ServerInfo>::const_iterator q = oldServers.find(p->first);
- if(q == oldServers.end())
- {
- load.push_back(p->second);
- }
- else
- {
- _serverCache.remove(p->first, false); // Don't destroy the server if it was updated.
- load.push_back(p->second);
- }
+ map<string, ServerInfo>::const_iterator q = oldServers.find(p->first);
+ if(q == oldServers.end())
+ {
+ load.push_back(p->second);
+ }
+ else
+ {
+ _serverCache.remove(p->first, false); // Don't destroy the server if it was updated.
+ load.push_back(p->second);
+ }
}
for(p = oldServers.begin(); p != oldServers.end(); ++p)
{
- map<string, ServerInfo>::const_iterator q = newServers.find(p->first);
- if(q == newServers.end())
- {
- entries.push_back(_serverCache.remove(p->first));
- }
+ map<string, ServerInfo>::const_iterator q = newServers.find(p->first);
+ if(q == newServers.end())
+ {
+ entries.push_back(_serverCache.remove(p->first));
+ }
}
//
@@ -1397,22 +1397,22 @@ Database::reload(const ApplicationHelper& oldApp,
ReplicaGroupDescriptorSeq::const_iterator r;
for(r = oldAdpts.begin(); r != oldAdpts.end(); ++r)
{
- ReplicaGroupDescriptorSeq::const_iterator t;
- for(t = newAdpts.begin(); t != newAdpts.end(); ++t)
- {
- if(t->id == r->id)
- {
- break;
- }
- }
- for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
- {
- _objectCache.remove(o->id);
- }
- if(t == newAdpts.end())
- {
- _adapterCache.removeReplicaGroup(r->id);
- }
+ ReplicaGroupDescriptorSeq::const_iterator t;
+ for(t = newAdpts.begin(); t != newAdpts.end(); ++t)
+ {
+ if(t->id == r->id)
+ {
+ break;
+ }
+ }
+ for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
+ {
+ _objectCache.remove(o->id);
+ }
+ if(t == newAdpts.end())
+ {
+ _adapterCache.removeReplicaGroup(r->id);
+ }
}
//
@@ -1422,7 +1422,7 @@ Database::reload(const ApplicationHelper& oldApp,
NodeDescriptorDict::const_iterator n;
for(n = oldNodes.begin(); n != oldNodes.end(); ++n)
{
- _nodeCache.get(n->first)->removeDescriptor(application);
+ _nodeCache.get(n->first)->removeDescriptor(application);
}
//
@@ -1431,7 +1431,7 @@ Database::reload(const ApplicationHelper& oldApp,
const NodeDescriptorDict& newNodes = newApp.getInstance().nodes;
for(n = newNodes.begin(); n != newNodes.end(); ++n)
{
- _nodeCache.get(n->first, true)->addDescriptor(application, n->second);
+ _nodeCache.get(n->first, true)->addDescriptor(application, n->second);
}
//
@@ -1439,24 +1439,24 @@ Database::reload(const ApplicationHelper& oldApp,
//
for(r = newAdpts.begin(); r != newAdpts.end(); ++r)
{
- try
- {
- ReplicaGroupEntryPtr entry = ReplicaGroupEntryPtr::dynamicCast(_adapterCache.get(r->id));
- assert(entry);
- entry->update(r->loadBalancing);
- }
- catch(const AdapterNotExistException&)
- {
- _adapterCache.addReplicaGroup(*r, application);
- }
-
- for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
- {
- ObjectInfo info;
- info.type = o->type;
- info.proxy = _communicator->stringToProxy(_communicator->identityToString(o->id) + "@" + r->id);
- _objectCache.add(info, application);
- }
+ try
+ {
+ ReplicaGroupEntryPtr entry = ReplicaGroupEntryPtr::dynamicCast(_adapterCache.get(r->id));
+ assert(entry);
+ entry->update(r->loadBalancing);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ _adapterCache.addReplicaGroup(*r, application);
+ }
+
+ for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
+ {
+ ObjectInfo info;
+ info.type = o->type;
+ info.proxy = _communicator->stringToProxy(_communicator->identityToString(o->id) + "@" + r->id);
+ _objectCache.add(info, application);
+ }
}
//
@@ -1464,51 +1464,51 @@ Database::reload(const ApplicationHelper& oldApp,
//
for(vector<ServerInfo>::const_iterator q = load.begin(); q != load.end(); ++q)
{
- entries.push_back(_serverCache.add(*q));
+ entries.push_back(_serverCache.add(*q));
}
}
void
Database::finishApplicationUpdate(ServerEntrySeq& entries,
- const ApplicationUpdateInfo& update,
- const ApplicationInfo& oldApp,
- const ApplicationDescriptor& newDesc,
- AdminSessionI* session)
+ const ApplicationUpdateInfo& update,
+ const ApplicationInfo& oldApp,
+ const ApplicationDescriptor& newDesc,
+ AdminSessionI* session)
{
if(_master)
{
- //
- // Load the servers on the nodes. If a server couldn't be
- // deployed we unload the application and throw.
- //
- try
- {
- for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::syncAndWait));
- }
- catch(const DeploymentException& ex)
- {
- ApplicationUpdateInfo newUpdate;
- {
- Lock sync(*this);
- entries.clear();
- ApplicationHelper previous(_communicator, newDesc);
- ApplicationHelper helper(_communicator, oldApp.descriptor);
- reload(previous, helper, entries, oldApp.uuid, oldApp.revision);
- }
-
- try
- {
- for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::syncAndWait));
- }
- catch(const DeploymentException& ex)
- {
- Ice::Error err(_traceLevels->logger);
- err << "failed to rollback previous application `" << oldApp.descriptor.name << "':\n" << ex.reason;
- }
-
- finishUpdating(newDesc.name);
- throw ex;
- }
+ //
+ // Load the servers on the nodes. If a server couldn't be
+ // deployed we unload the application and throw.
+ //
+ try
+ {
+ for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::syncAndWait));
+ }
+ catch(const DeploymentException& ex)
+ {
+ ApplicationUpdateInfo newUpdate;
+ {
+ Lock sync(*this);
+ entries.clear();
+ ApplicationHelper previous(_communicator, newDesc);
+ ApplicationHelper helper(_communicator, oldApp.descriptor);
+ reload(previous, helper, entries, oldApp.uuid, oldApp.revision);
+ }
+
+ try
+ {
+ for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::syncAndWait));
+ }
+ catch(const DeploymentException& ex)
+ {
+ Ice::Error err(_traceLevels->logger);
+ err << "failed to rollback previous application `" << oldApp.descriptor.name << "':\n" << ex.reason;
+ }
+
+ finishUpdating(newDesc.name);
+ throw ex;
+ }
}
//
@@ -1516,24 +1516,24 @@ Database::finishApplicationUpdate(ServerEntrySeq& entries,
//
int serial;
{
- Lock sync(*this);
-
- ApplicationInfo info = oldApp;
- info.updateTime = update.updateTime;
- info.updateUser = update.updateUser;
- info.revision = update.revision;
- info.descriptor = newDesc;
-
- _applications.put(StringApplicationInfoDict::value_type(update.descriptor.name, info));
- ++_applicationSerial;
+ Lock sync(*this);
+
+ ApplicationInfo info = oldApp;
+ info.updateTime = update.updateTime;
+ info.updateUser = update.updateUser;
+ info.revision = update.revision;
+ info.descriptor = newDesc;
+
+ _applications.put(StringApplicationInfoDict::value_type(update.descriptor.name, info));
+ ++_applicationSerial;
- if(_traceLevels->application > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat);
- out << "updated application `" << update.descriptor.name << "'";
- }
-
- serial = _applicationObserverTopic->applicationUpdated(_applicationSerial, update);
+ if(_traceLevels->application > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat);
+ out << "updated application `" << update.descriptor.name << "'";
+ }
+
+ serial = _applicationObserverTopic->applicationUpdated(_applicationSerial, update);
}
_applicationObserverTopic->waitForSyncedSubscribers(serial);
@@ -1556,9 +1556,9 @@ Database::finishUpdating(const string& name)
map<string, vector<AMD_NodeSession_waitForApplicationUpdatePtr> >::iterator p = _updating.find(name);
assert(p != _updating.end());
for(vector<AMD_NodeSession_waitForApplicationUpdatePtr>::const_iterator q = p->second.begin();
- q != p->second.end(); ++q)
+ q != p->second.end(); ++q)
{
- (*q)->ice_response();
+ (*q)->ice_response();
}
_updating.erase(p);
diff --git a/cpp/src/IceGrid/Database.h b/cpp/src/IceGrid/Database.h
index 339d52722e8..a02bbe02eb2 100644
--- a/cpp/src/IceGrid/Database.h
+++ b/cpp/src/IceGrid/Database.h
@@ -51,7 +51,7 @@ class Database : public IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
public:
Database(const Ice::ObjectAdapterPtr&, const IceStorm::TopicManagerPrx&, const std::string&, const TraceLevelsPtr&,
- const RegistryInfo&);
+ const RegistryInfo&);
virtual ~Database();
std::string getInstanceName() const;
@@ -133,7 +133,7 @@ private:
void unload(const ApplicationHelper&, ServerEntrySeq&);
void reload(const ApplicationHelper&, const ApplicationHelper&, ServerEntrySeq&, const std::string&, int);
void finishApplicationUpdate(ServerEntrySeq&, const ApplicationUpdateInfo&, const ApplicationInfo&,
- const ApplicationDescriptor&, AdminSessionI*);
+ const ApplicationDescriptor&, AdminSessionI*);
void checkSessionLock(AdminSessionI*);
diff --git a/cpp/src/IceGrid/DescriptorBuilder.cpp b/cpp/src/IceGrid/DescriptorBuilder.cpp
index a5405ad18c9..eeb0c11c723 100644
--- a/cpp/src/IceGrid/DescriptorBuilder.cpp
+++ b/cpp/src/IceGrid/DescriptorBuilder.cpp
@@ -16,9 +16,9 @@ using namespace std;
using namespace IceGrid;
XmlAttributesHelper::XmlAttributesHelper(const IceXML::Attributes& attrs,
- const Ice::LoggerPtr& logger,
- const string& filename,
- int line) :
+ const Ice::LoggerPtr& logger,
+ const string& filename,
+ int line) :
_attributes(attrs),
_logger(logger),
_filename(filename),
@@ -32,17 +32,17 @@ XmlAttributesHelper::checkUnknownAttributes()
vector<string> notUsed;
for(map<string, string>::const_iterator p = _attributes.begin(); p != _attributes.end(); ++p)
{
- if(_used.find(p->first) == _used.end())
- {
- notUsed.push_back(p->first);
- }
+ if(_used.find(p->first) == _used.end())
+ {
+ notUsed.push_back(p->first);
+ }
}
if(!notUsed.empty())
{
- ostringstream os;
- os << "unknown attributes in <" << _filename << "> descriptor, line " << _line << ":\n" << toString(notUsed);
- throw os.str();
+ ostringstream os;
+ os << "unknown attributes in <" << _filename << "> descriptor, line " << _line << ":\n" << toString(notUsed);
+ throw os.str();
}
}
@@ -60,12 +60,12 @@ XmlAttributesHelper::operator()(const string& name) const
IceXML::Attributes::const_iterator p = _attributes.find(name);
if(p == _attributes.end())
{
- throw "missing attribute '" + name + "'";
+ throw "missing attribute '" + name + "'";
}
string v = p->second;
if(v.empty())
{
- throw "attribute '" + name + "' is empty";
+ throw "attribute '" + name + "' is empty";
}
return v;
}
@@ -77,11 +77,11 @@ XmlAttributesHelper::operator()(const string& name, const string& def) const
IceXML::Attributes::const_iterator p = _attributes.find(name);
if(p == _attributes.end())
{
- return def;
+ return def;
}
else
{
- return p->second;
+ return p->second;
}
}
@@ -90,7 +90,7 @@ XmlAttributesHelper::asMap() const
{
for(map<string, string>::const_iterator p = _attributes.begin(); p != _attributes.end(); ++p)
{
- _used.insert(p->first);
+ _used.insert(p->first);
}
return _attributes;
}
@@ -102,21 +102,21 @@ XmlAttributesHelper::asBool(const string& name) const
IceXML::Attributes::const_iterator p = _attributes.find(name);
if(p == _attributes.end())
{
- throw "missing attribute '" + name + "'";
- return true; // Keep the compiler happy.
+ throw "missing attribute '" + name + "'";
+ return true; // Keep the compiler happy.
}
else if(p->second == "true")
{
- return true;
+ return true;
}
else if(p->second == "false")
{
- return false;
+ return false;
}
else
{
- throw "invalid attribute `" + name + "': value is not 'false' or 'true'";
- return true; // Keep the compiler happy.
+ throw "invalid attribute `" + name + "': value is not 'false' or 'true'";
+ return true; // Keep the compiler happy.
}
}
@@ -127,20 +127,20 @@ XmlAttributesHelper::asBool(const string& name, bool def) const
IceXML::Attributes::const_iterator p = _attributes.find(name);
if(p == _attributes.end())
{
- return def;
+ return def;
}
else if(p->second == "true")
{
- return true;
+ return true;
}
else if(p->second == "false")
{
- return false;
+ return false;
}
else
{
- throw "invalid attribute `" + name + "': value is not 'false' or 'true'";
- return true; // Keep the compiler happy.
+ throw "invalid attribute `" + name + "': value is not 'false' or 'true'";
+ return true; // Keep the compiler happy.
}
}
@@ -206,11 +206,11 @@ PropertySetDescriptorBuilder::addPropertySet(const XmlAttributesHelper& attrs)
{
if(attrs.contains("id") || !attrs.contains("refid"))
{
- throw "only <properties refid=\"\"> can be a child of a <properties> element";
+ throw "only <properties refid=\"\"> can be a child of a <properties> element";
}
if(!_descriptor.properties.empty())
{
- throw "<properties refid=\"\"> can't be defined after a <property> element";
+ throw "<properties refid=\"\"> can't be defined after a <property> element";
}
_descriptor.references.push_back(attrs("refid"));
_inPropertySetRef = true;
@@ -221,15 +221,15 @@ PropertySetDescriptorBuilder::finish()
{
if(_inPropertySetRef)
{
- _inPropertySetRef = false;
- return false;
+ _inPropertySetRef = false;
+ return false;
}
return true;
}
ApplicationDescriptorBuilder::ApplicationDescriptorBuilder(const Ice::CommunicatorPtr& communicator,
- const XmlAttributesHelper& attrs,
- const map<string, string>& overrides) :
+ const XmlAttributesHelper& attrs,
+ const map<string, string>& overrides) :
_communicator(communicator),
_overrides(overrides)
{
@@ -238,9 +238,9 @@ ApplicationDescriptorBuilder::ApplicationDescriptorBuilder(const Ice::Communicat
}
ApplicationDescriptorBuilder::ApplicationDescriptorBuilder(const Ice::CommunicatorPtr& communicator,
- const ApplicationDescriptor& app,
- const XmlAttributesHelper& attrs,
- const map<string, string>& overrides) :
+ const ApplicationDescriptor& app,
+ const XmlAttributesHelper& attrs,
+ const map<string, string>& overrides) :
_communicator(communicator),
_descriptor(app),
_overrides(overrides)
@@ -274,8 +274,8 @@ ApplicationDescriptorBuilder::finishReplicaGroup()
{
if(!_descriptor.replicaGroups.back().loadBalancing)
{
- _descriptor.replicaGroups.back().loadBalancing = new RandomLoadBalancingPolicy();
- _descriptor.replicaGroups.back().loadBalancing->nReplicas = "0";
+ _descriptor.replicaGroups.back().loadBalancing = new RandomLoadBalancingPolicy();
+ _descriptor.replicaGroups.back().loadBalancing->nReplicas = "0";
}
}
@@ -286,25 +286,25 @@ ApplicationDescriptorBuilder::setLoadBalancing(const XmlAttributesHelper& attrs)
string type = attrs("type");
if(type == "random")
{
- policy = new RandomLoadBalancingPolicy();
+ policy = new RandomLoadBalancingPolicy();
}
else if(type == "ordered")
{
- policy = new OrderedLoadBalancingPolicy();
+ policy = new OrderedLoadBalancingPolicy();
}
else if(type == "round-robin")
{
- policy = new RoundRobinLoadBalancingPolicy();
+ policy = new RoundRobinLoadBalancingPolicy();
}
else if(type == "adaptive")
{
- AdaptiveLoadBalancingPolicyPtr alb = new AdaptiveLoadBalancingPolicy();
- alb->loadSample = attrs("load-sample", "1");
- policy = alb;
+ AdaptiveLoadBalancingPolicyPtr alb = new AdaptiveLoadBalancingPolicy();
+ alb->loadSample = attrs("load-sample", "1");
+ policy = alb;
}
else
{
- throw "invalid load balancing policy `" + type + "'";
+ throw "invalid load balancing policy `" + type + "'";
}
policy->nReplicas = attrs("n-replicas", "1");
_descriptor.replicaGroups.back().loadBalancing = policy;
@@ -324,7 +324,7 @@ ApplicationDescriptorBuilder::addObject(const XmlAttributesHelper& attrs)
object.id = _communicator->stringToIdentity(attrs("identity"));
if(attrs.contains("property"))
{
- throw "property attribute is not allowed in object descriptors from a replica group";
+ throw "property attribute is not allowed in object descriptors from a replica group";
}
_descriptor.replicaGroups.back().objects.push_back(object);
}
@@ -334,11 +334,11 @@ ApplicationDescriptorBuilder::addVariable(const XmlAttributesHelper& attrs)
{
if(!isOverride(attrs("name")))
{
- _descriptor.variables[attrs("name")] = attrs("value", "");
+ _descriptor.variables[attrs("name")] = attrs("value", "");
}
else
{
- attrs.contains("value"); // NOTE: prevents warning about "value" not being used.
+ attrs.contains("value"); // NOTE: prevents warning about "value" not being used.
}
}
@@ -381,11 +381,11 @@ ApplicationDescriptorBuilder::addServerTemplate(const string& id, const Template
{
if(!templ.descriptor)
{
- throw "invalid server template `" + id + "': server definition is missing";
+ throw "invalid server template `" + id + "': server definition is missing";
}
if(!_descriptor.serverTemplates.insert(make_pair(id, templ)).second)
{
- throw "duplicate server template `" + id + "'";
+ throw "duplicate server template `" + id + "'";
}
}
@@ -394,11 +394,11 @@ ApplicationDescriptorBuilder::addServiceTemplate(const string& id, const Templat
{
if(!templ.descriptor)
{
- throw "invalid service template `" + id + "': service definition is missing";
+ throw "invalid service template `" + id + "': service definition is missing";
}
if(!_descriptor.serviceTemplates.insert(make_pair(id, templ)).second)
{
- throw "duplicate service template `" + id + "'";
+ throw "duplicate service template `" + id + "'";
}
}
@@ -407,7 +407,7 @@ ApplicationDescriptorBuilder::addPropertySet(const string& id, const PropertySet
{
if(!_descriptor.propertySets.insert(make_pair(id, desc)).second)
{
- throw "duplicate property set `" + id + "'";
+ throw "duplicate property set `" + id + "'";
}
}
@@ -442,7 +442,7 @@ ServerInstanceDescriptorBuilder::createPropertySet(const XmlAttributesHelper& at
string service;
if(attrs.contains("service"))
{
- service = attrs("service"); // Can't be empty.
+ service = attrs("service"); // Can't be empty.
}
PropertySetDescriptorBuilder* builder = new PropertySetDescriptorBuilder();
@@ -462,8 +462,8 @@ ServerInstanceDescriptorBuilder::addPropertySet(const string& service, const Pro
}
NodeDescriptorBuilder::NodeDescriptorBuilder(ApplicationDescriptorBuilder& app,
- const NodeDescriptor& desc,
- const XmlAttributesHelper& attrs) :
+ const NodeDescriptor& desc,
+ const XmlAttributesHelper& attrs) :
_application(app),
_descriptor(desc)
{
@@ -504,11 +504,11 @@ NodeDescriptorBuilder::addVariable(const XmlAttributesHelper& attrs)
{
if(!_application.isOverride(attrs("name")))
{
- _descriptor.variables[attrs("name")] = attrs("value", "");
+ _descriptor.variables[attrs("name")] = attrs("value", "");
}
else
{
- attrs.contains("value"); // NOTE: prevents warning about "value" not being used.
+ attrs.contains("value"); // NOTE: prevents warning about "value" not being used.
}
}
@@ -529,7 +529,7 @@ NodeDescriptorBuilder::addPropertySet(const string& id, const PropertySetDescrip
{
if(!_descriptor.propertySets.insert(make_pair(id, desc)).second)
{
- throw "duplicate property set `" + id + "'";
+ throw "duplicate property set `" + id + "'";
}
}
@@ -540,8 +540,8 @@ NodeDescriptorBuilder::setDescription(const string& description)
}
TemplateDescriptorBuilder::TemplateDescriptorBuilder(ApplicationDescriptorBuilder& application,
- const XmlAttributesHelper& attrs,
- bool serviceTemplate) :
+ const XmlAttributesHelper& attrs,
+ bool serviceTemplate) :
_application(application),
_serviceTemplate(serviceTemplate),
_id(attrs("id"))
@@ -554,13 +554,13 @@ TemplateDescriptorBuilder::addParameter(const XmlAttributesHelper& attrs)
if(find(_descriptor.parameters.begin(), _descriptor.parameters.end(), attrs("name")) !=
_descriptor.parameters.end())
{
- throw "duplicate parameter `" + attrs("name") + "'";
+ throw "duplicate parameter `" + attrs("name") + "'";
}
_descriptor.parameters.push_back(attrs("name"));
if(attrs.contains("default"))
{
- _descriptor.parameterDefaults.insert(make_pair(attrs("name"), attrs("default", "")));
+ _descriptor.parameterDefaults.insert(make_pair(attrs("name"), attrs("default", "")));
}
}
@@ -575,7 +575,7 @@ TemplateDescriptorBuilder::createServer(const XmlAttributesHelper& attrs)
{
if(_serviceTemplate)
{
- throw "<server> element can't be a child of <service-template>";
+ throw "<server> element can't be a child of <service-template>";
}
return new ServerDescriptorBuilder(_application.getCommunicator(), attrs);
}
@@ -585,7 +585,7 @@ TemplateDescriptorBuilder::createIceBox(const XmlAttributesHelper& attrs)
{
if(_serviceTemplate)
{
- throw "<icebox> element can't be a child of <service-template>";
+ throw "<icebox> element can't be a child of <service-template>";
}
return new IceBoxDescriptorBuilder(_application.getCommunicator(), attrs);
}
@@ -595,7 +595,7 @@ TemplateDescriptorBuilder::createService(const XmlAttributesHelper& attrs)
{
if(!_serviceTemplate)
{
- throw "<service> element can't be a child of <server-template>";
+ throw "<service> element can't be a child of <server-template>";
}
return new ServiceDescriptorBuilder(_application.getCommunicator(), attrs);
}
@@ -621,7 +621,7 @@ CommunicatorDescriptorBuilder::finish()
// before references to property sets.
//
_descriptor->propertySet.properties.insert(_descriptor->propertySet.properties.begin(),
- _hiddenProperties.begin(), _hiddenProperties.end());
+ _hiddenProperties.begin(), _hiddenProperties.end());
}
void
@@ -660,23 +660,23 @@ CommunicatorDescriptorBuilder::addAdapter(const XmlAttributesHelper& attrs)
desc.name = attrs("name");
if(attrs.contains("id"))
{
- desc.id = attrs("id");
+ desc.id = attrs("id");
}
else
{
- string fqn = "${server}";
- if(ServiceDescriptorPtr::dynamicCast(_descriptor))
- {
- fqn += ".${service}";
- }
- desc.id = fqn + "." + desc.name;
+ string fqn = "${server}";
+ if(ServiceDescriptorPtr::dynamicCast(_descriptor))
+ {
+ fqn += ".${service}";
+ }
+ desc.id = fqn + "." + desc.name;
}
desc.replicaGroupId = attrs("replica-group", "");
desc.priority = attrs("priority", "");
desc.registerProcess = attrs.asBool("register-process", false);
if(desc.id == "")
{
- throw "empty `id' for adapter `" + desc.name + "'";
+ throw "empty `id' for adapter `" + desc.name + "'";
}
desc.serverLifetime = attrs.asBool("server-lifetime", true);
_descriptor->adapters.push_back(desc);
@@ -698,7 +698,7 @@ CommunicatorDescriptorBuilder::addObject(const XmlAttributesHelper& attrs)
object.id = _communicator->stringToIdentity(attrs("identity"));
if(attrs.contains("property"))
{
- addProperty(_hiddenProperties, attrs("property"), attrs("identity"));
+ addProperty(_hiddenProperties, attrs("property"), attrs("identity"));
}
_descriptor->adapters.back().objects.push_back(object);
}
@@ -711,7 +711,7 @@ CommunicatorDescriptorBuilder::addAllocatable(const XmlAttributesHelper& attrs)
object.id = _communicator->stringToIdentity(attrs("identity"));
if(attrs.contains("property"))
{
- addProperty(_hiddenProperties, attrs("property"), attrs("identity"));
+ addProperty(_hiddenProperties, attrs("property"), attrs("identity"));
}
_descriptor->adapters.back().allocatables.push_back(object);
}
@@ -726,28 +726,28 @@ CommunicatorDescriptorBuilder::addDbEnv(const XmlAttributesHelper& attrs)
DbEnvDescriptorSeq::iterator p;
for(p = _descriptor->dbEnvs.begin(); p != _descriptor->dbEnvs.end(); ++p)
{
- //
- // We are re-opening the dbenv element to define more properties.
- //
- if(p->name == desc.name)
- {
- break;
- }
+ //
+ // We are re-opening the dbenv element to define more properties.
+ //
+ if(p->name == desc.name)
+ {
+ break;
+ }
}
if(p != _descriptor->dbEnvs.end())
{
- //
- // Remove the previously defined dbenv, we'll add it back again when
- // the dbenv element end tag is reached.
- //
- desc = *p;
- _descriptor->dbEnvs.erase(p);
- }
+ //
+ // Remove the previously defined dbenv, we'll add it back again when
+ // the dbenv element end tag is reached.
+ //
+ desc = *p;
+ _descriptor->dbEnvs.erase(p);
+ }
if(desc.dbHome.empty())
{
- desc.dbHome = attrs("home", "");
+ desc.dbHome = attrs("home", "");
}
_descriptor->dbEnvs.push_back(desc);
@@ -758,9 +758,9 @@ CommunicatorDescriptorBuilder::addDbEnvProperty(const XmlAttributesHelper& attrs
{
if(!_descriptor->dbEnvs.back().dbHome.empty())
{
- throw "can't add property to the database environment:\n"
- "properties are only allowed if the database\n"
- "environment home directory is managed by the node";
+ throw "can't add property to the database environment:\n"
+ "properties are only allowed if the database\n"
+ "environment home directory is managed by the node";
}
PropertyDescriptor prop;
@@ -780,7 +780,7 @@ CommunicatorDescriptorBuilder::addLog(const XmlAttributesHelper& attrs)
{
if(attrs.contains("property"))
{
- addProperty(_hiddenProperties, attrs("property"), attrs("path"));
+ addProperty(_hiddenProperties, attrs("property"), attrs("path"));
}
_descriptor->logs.push_back(attrs("path"));
}
@@ -819,7 +819,7 @@ ServiceInstanceDescriptorBuilder::addPropertySet(const PropertySetDescriptor& de
}
ServerDescriptorBuilder::ServerDescriptorBuilder(const Ice::CommunicatorPtr& communicator,
- const XmlAttributesHelper& attrs) :
+ const XmlAttributesHelper& attrs) :
CommunicatorDescriptorBuilder(communicator)
{
init(new ServerDescriptor(), attrs);
@@ -898,7 +898,7 @@ ServerDescriptorBuilder::addDistributionDirectory(const string& directory)
}
IceBoxDescriptorBuilder::IceBoxDescriptorBuilder(const Ice::CommunicatorPtr& communicator,
- const XmlAttributesHelper& attrs) :
+ const XmlAttributesHelper& attrs) :
ServerDescriptorBuilder(communicator)
{
init(new IceBoxDescriptor(), attrs);
@@ -916,18 +916,18 @@ IceBoxDescriptorBuilder::finish()
{
if(getProperty(_descriptor->propertySet.properties, "IceBox.InstanceName").empty())
{
- _hiddenProperties.push_back(createProperty("IceBox.InstanceName", "${server}"));
+ _hiddenProperties.push_back(createProperty("IceBox.InstanceName", "${server}"));
}
if(_descriptor->adapters.empty())
{
- if(getProperty(_descriptor->propertySet.properties, "Ice.OA.IceBox.ServiceManager.Endpoints").empty())
- {
- _hiddenProperties.push_back(createProperty("Ice.OA.IceBox.ServiceManager.Endpoints", "tcp -h 127.0.0.1"));
- }
- if(getProperty(_descriptor->propertySet.properties, "Ice.OA.IceBox.ServiceManager.RegisterProcess").empty())
- {
- _hiddenProperties.push_back(createProperty("Ice.OA.IceBox.ServiceManager.RegisterProcess", "1"));
- }
+ if(getProperty(_descriptor->propertySet.properties, "Ice.OA.IceBox.ServiceManager.Endpoints").empty())
+ {
+ _hiddenProperties.push_back(createProperty("Ice.OA.IceBox.ServiceManager.Endpoints", "tcp -h 127.0.0.1"));
+ }
+ if(getProperty(_descriptor->propertySet.properties, "Ice.OA.IceBox.ServiceManager.RegisterProcess").empty())
+ {
+ _hiddenProperties.push_back(createProperty("Ice.OA.IceBox.ServiceManager.RegisterProcess", "1"));
+ }
}
ServerDescriptorBuilder::finish();
@@ -950,7 +950,7 @@ IceBoxDescriptorBuilder::addAdapter(const XmlAttributesHelper& attrs)
{
if(attrs("name") != "IceBox.ServiceManager")
{
- throw "<adapter> element can't be a child of an <icebox> element";
+ throw "<adapter> element can't be a child of an <icebox> element";
}
ServerDescriptorBuilder::addAdapter(attrs);
@@ -978,7 +978,7 @@ IceBoxDescriptorBuilder::addService(const ServiceDescriptorPtr& desc)
}
ServiceDescriptorBuilder::ServiceDescriptorBuilder(const Ice::CommunicatorPtr& communicator,
- const XmlAttributesHelper& attrs) :
+ const XmlAttributesHelper& attrs) :
CommunicatorDescriptorBuilder(communicator)
{
init(new ServiceDescriptor(), attrs);
diff --git a/cpp/src/IceGrid/DescriptorBuilder.h b/cpp/src/IceGrid/DescriptorBuilder.h
index 04f0ca60d4e..532df9e61df 100644
--- a/cpp/src/IceGrid/DescriptorBuilder.h
+++ b/cpp/src/IceGrid/DescriptorBuilder.h
@@ -89,9 +89,9 @@ class ApplicationDescriptorBuilder : public DescriptorBuilder
public:
ApplicationDescriptorBuilder(const Ice::CommunicatorPtr&, const XmlAttributesHelper&,
- const std::map<std::string, std::string>&);
+ const std::map<std::string, std::string>&);
ApplicationDescriptorBuilder(const Ice::CommunicatorPtr&, const ApplicationDescriptor&, const XmlAttributesHelper&,
- const std::map<std::string, std::string>&);
+ const std::map<std::string, std::string>&);
const ApplicationDescriptor& getDescriptor() const;
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp
index 1e540b5938f..f1cf78d4367 100644
--- a/cpp/src/IceGrid/DescriptorHelper.cpp
+++ b/cpp/src/IceGrid/DescriptorHelper.cpp
@@ -25,7 +25,7 @@ struct GetReplicaGroupId : unary_function<ReplicaGroupDescriptor&, const string&
const string&
operator()(const ReplicaGroupDescriptor& desc)
{
- return desc.id;
+ return desc.id;
}
};
@@ -34,42 +34,42 @@ struct TemplateDescriptorEqual : std::binary_function<TemplateDescriptor&, Templ
bool
operator()(const TemplateDescriptor& lhs, const TemplateDescriptor& rhs)
{
- if(lhs.parameters != rhs.parameters)
- {
- return false;
- }
-
- if(lhs.parameterDefaults != rhs.parameterDefaults)
- {
- return false;
- }
-
- {
- IceBoxDescriptorPtr slhs = IceBoxDescriptorPtr::dynamicCast(lhs.descriptor);
- IceBoxDescriptorPtr srhs = IceBoxDescriptorPtr::dynamicCast(rhs.descriptor);
- if(slhs && srhs)
- {
- return IceBoxHelper(slhs) == IceBoxHelper(srhs);
- }
- }
- {
- ServerDescriptorPtr slhs = ServerDescriptorPtr::dynamicCast(lhs.descriptor);
- ServerDescriptorPtr srhs = ServerDescriptorPtr::dynamicCast(rhs.descriptor);
- if(slhs && srhs)
- {
- return ServerHelper(slhs) == ServerHelper(srhs);
- }
- }
- {
- ServiceDescriptorPtr slhs = ServiceDescriptorPtr::dynamicCast(lhs.descriptor);
- ServiceDescriptorPtr srhs = ServiceDescriptorPtr::dynamicCast(rhs.descriptor);
- if(slhs && srhs)
- {
- return ServiceHelper(slhs) == ServiceHelper(srhs);
- }
- }
-
- return false;
+ if(lhs.parameters != rhs.parameters)
+ {
+ return false;
+ }
+
+ if(lhs.parameterDefaults != rhs.parameterDefaults)
+ {
+ return false;
+ }
+
+ {
+ IceBoxDescriptorPtr slhs = IceBoxDescriptorPtr::dynamicCast(lhs.descriptor);
+ IceBoxDescriptorPtr srhs = IceBoxDescriptorPtr::dynamicCast(rhs.descriptor);
+ if(slhs && srhs)
+ {
+ return IceBoxHelper(slhs) == IceBoxHelper(srhs);
+ }
+ }
+ {
+ ServerDescriptorPtr slhs = ServerDescriptorPtr::dynamicCast(lhs.descriptor);
+ ServerDescriptorPtr srhs = ServerDescriptorPtr::dynamicCast(rhs.descriptor);
+ if(slhs && srhs)
+ {
+ return ServerHelper(slhs) == ServerHelper(srhs);
+ }
+ }
+ {
+ ServiceDescriptorPtr slhs = ServiceDescriptorPtr::dynamicCast(lhs.descriptor);
+ ServiceDescriptorPtr srhs = ServiceDescriptorPtr::dynamicCast(rhs.descriptor);
+ if(slhs && srhs)
+ {
+ return ServiceHelper(slhs) == ServiceHelper(srhs);
+ }
+ }
+
+ return false;
}
};
@@ -78,38 +78,38 @@ struct ReplicaGroupEq : std::binary_function<ReplicaGroupDescriptor&, ReplicaGro
bool
operator()(const ReplicaGroupDescriptor& lhs, const ReplicaGroupDescriptor& rhs)
{
- if(lhs.id != rhs.id)
- {
- return false;
- }
- if(set<ObjectDescriptor>(lhs.objects.begin(), lhs.objects.end()) !=
- set<ObjectDescriptor>(rhs.objects.begin(), rhs.objects.end()))
- {
- return false;
- }
- if(lhs.loadBalancing && rhs.loadBalancing)
- {
- if(lhs.loadBalancing->ice_id() != rhs.loadBalancing->ice_id())
- {
- return false;
- }
- if(lhs.loadBalancing->nReplicas != rhs.loadBalancing->nReplicas)
- {
- return false;
- }
- AdaptiveLoadBalancingPolicyPtr alhs = AdaptiveLoadBalancingPolicyPtr::dynamicCast(lhs.loadBalancing);
- AdaptiveLoadBalancingPolicyPtr arhs = AdaptiveLoadBalancingPolicyPtr::dynamicCast(rhs.loadBalancing);
- if(alhs && arhs && alhs->loadSample != arhs->loadSample)
- {
- return false;
- }
- }
- else if(lhs.loadBalancing || rhs.loadBalancing)
- {
- return false;
- }
-
- return true;
+ if(lhs.id != rhs.id)
+ {
+ return false;
+ }
+ if(set<ObjectDescriptor>(lhs.objects.begin(), lhs.objects.end()) !=
+ set<ObjectDescriptor>(rhs.objects.begin(), rhs.objects.end()))
+ {
+ return false;
+ }
+ if(lhs.loadBalancing && rhs.loadBalancing)
+ {
+ if(lhs.loadBalancing->ice_id() != rhs.loadBalancing->ice_id())
+ {
+ return false;
+ }
+ if(lhs.loadBalancing->nReplicas != rhs.loadBalancing->nReplicas)
+ {
+ return false;
+ }
+ AdaptiveLoadBalancingPolicyPtr alhs = AdaptiveLoadBalancingPolicyPtr::dynamicCast(lhs.loadBalancing);
+ AdaptiveLoadBalancingPolicyPtr arhs = AdaptiveLoadBalancingPolicyPtr::dynamicCast(rhs.loadBalancing);
+ if(alhs && arhs && alhs->loadSample != arhs->loadSample)
+ {
+ return false;
+ }
+ }
+ else if(lhs.loadBalancing || rhs.loadBalancing)
+ {
+ return false;
+ }
+
+ return true;
}
};
@@ -133,18 +133,18 @@ getSeqUpdatedEltsWithEq(const Seq& lseq, const Seq& rseq, GetKeyFunc func, EqFun
Seq result;
for(typename Seq::const_iterator p = rseq.begin(); p != rseq.end(); ++p)
{
- typename Seq::const_iterator q = lseq.begin();
- for(; q != lseq.end(); ++q)
- {
- if(func(*p) == func(*q))
- {
- break;
- }
- }
- if(q == lseq.end() || !eq(*p, *q))
- {
- result.push_back(*p);
- }
+ typename Seq::const_iterator q = lseq.begin();
+ for(; q != lseq.end(); ++q)
+ {
+ if(func(*p) == func(*q))
+ {
+ break;
+ }
+ }
+ if(q == lseq.end() || !eq(*p, *q))
+ {
+ result.push_back(*p);
+ }
}
return result;
}
@@ -155,18 +155,18 @@ getSeqRemovedElts(const Seq& lseq, const Seq& rseq, GetKeyFunc func)
Ice::StringSeq removed;
for(typename Seq::const_iterator p = lseq.begin(); p != lseq.end(); ++p)
{
- typename Seq::const_iterator q;
- for(q = rseq.begin(); q != rseq.end(); ++q)
- {
- if(func(*p) == func(*q))
- {
- break;
- }
- }
- if(q == rseq.end())
- {
- removed.push_back(func(*p));
- }
+ typename Seq::const_iterator q;
+ for(q = rseq.begin(); q != rseq.end(); ++q)
+ {
+ if(func(*p) == func(*q))
+ {
+ break;
+ }
+ }
+ if(q == rseq.end())
+ {
+ removed.push_back(func(*p));
+ }
}
return removed;
}
@@ -178,21 +178,21 @@ updateSeqElts(const Seq& seq, const Seq& update, const Ice::StringSeq& remove, G
set<string> removed(remove.begin(), remove.end());
for(typename Seq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
- if(removed.find(func(*p)) == removed.end())
- {
- typename Seq::const_iterator q = update.begin();
- for(; q != update.end(); ++q)
- {
- if(func(*p) == func(*q))
- {
- break;
- }
- }
- if(q == update.end())
- {
- result.push_back(*p);
- }
- }
+ if(removed.find(func(*p)) == removed.end())
+ {
+ typename Seq::const_iterator q = update.begin();
+ for(; q != update.end(); ++q)
+ {
+ if(func(*p) == func(*q))
+ {
+ break;
+ }
+ }
+ if(q == update.end())
+ {
+ result.push_back(*p);
+ }
+ }
}
return result;
}
@@ -213,11 +213,11 @@ getDictUpdatedEltsWithEq(const Dict& ldict, const Dict& rdict, EqFunc eq)
Dict result;
for(typename Dict::const_iterator p = rdict.begin(); p != rdict.end(); ++p)
{
- typename Dict::const_iterator q = ldict.find(p->first);
- if(q == ldict.end() || !eq(p->second, q->second))
- {
- result.insert(*p);
- }
+ typename Dict::const_iterator q = ldict.find(p->first);
+ if(q == ldict.end() || !eq(p->second, q->second))
+ {
+ result.insert(*p);
+ }
}
return result;
}
@@ -228,10 +228,10 @@ getDictRemovedElts(const Dict& ldict, const Dict& rdict)
Ice::StringSeq removed;
for(typename Dict::const_iterator p = ldict.begin(); p != ldict.end(); ++p)
{
- if(rdict.find(p->first) == rdict.end())
- {
- removed.push_back(p->first);
- }
+ if(rdict.find(p->first) == rdict.end())
+ {
+ removed.push_back(p->first);
+ }
}
return removed;
}
@@ -242,11 +242,11 @@ updateDictElts(const Dict& dict, const Dict& update, const Ice::StringSeq& remov
Dict result = dict;
for(Ice::StringSeq::const_iterator p = remove.begin(); p != remove.end(); ++p)
{
- result.erase(*p);
+ result.erase(*p);
}
for(typename Dict::const_iterator q = update.begin(); q != update.end(); ++q)
{
- result[q->first] = q->second;
+ result[q->first] = q->second;
}
return result;
}
@@ -281,63 +281,63 @@ Resolver::Resolver(const ApplicationDescriptor& app, const Ice::CommunicatorPtr&
for(StringStringDict::const_iterator v = _variables.begin(); v != _variables.end(); ++v)
{
- if(v->first == "")
- {
- exception("empty variable name");
- }
+ if(v->first == "")
+ {
+ exception("empty variable name");
+ }
}
TemplateDescriptorDict::const_iterator t;
for(t = _application->serverTemplates.begin(); t != _application->serverTemplates.end(); ++t)
{
- if(t->first == "")
- {
- exception("empty server template id");
- }
- if(!t->second.descriptor)
- {
- exception("invalid server template `" + t->first + "': server definition is empty");
- }
-
- Ice::StringSeq params = t->second.parameters;
- sort(params.begin(), params.end());
- Ice::StringSeq wdups = params;
- Ice::StringSeq dups;
- set_difference(wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()),
- back_inserter(dups));
- if(!dups.empty())
- {
- dups.erase(unique(dups.begin(), dups.end()), dups.end());
- exception("invalid server template `" + t->first + "': duplicate parameters " + toString(dups));
- }
+ if(t->first == "")
+ {
+ exception("empty server template id");
+ }
+ if(!t->second.descriptor)
+ {
+ exception("invalid server template `" + t->first + "': server definition is empty");
+ }
+
+ Ice::StringSeq params = t->second.parameters;
+ sort(params.begin(), params.end());
+ Ice::StringSeq wdups = params;
+ Ice::StringSeq dups;
+ set_difference(wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()),
+ back_inserter(dups));
+ if(!dups.empty())
+ {
+ dups.erase(unique(dups.begin(), dups.end()), dups.end());
+ exception("invalid server template `" + t->first + "': duplicate parameters " + toString(dups));
+ }
}
for(t = _application->serviceTemplates.begin(); t != _application->serviceTemplates.end(); ++t)
{
- if(t->first == "")
- {
- exception("empty service template id");
- }
- if(!t->second.descriptor)
- {
- exception("invalid service template `" + t->first + "': service definition is empty");
- }
- Ice::StringSeq params = t->second.parameters;
- sort(params.begin(), params.end());
- Ice::StringSeq wdups = params;
- Ice::StringSeq dups;
- set_difference(wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()),
- back_inserter(dups));
- if(!dups.empty())
- {
- dups.erase(unique(dups.begin(), dups.end()), dups.end());
- exception("invalid server template `" + t->first + "': duplicate parameters " + toString(dups));
- }
+ if(t->first == "")
+ {
+ exception("empty service template id");
+ }
+ if(!t->second.descriptor)
+ {
+ exception("invalid service template `" + t->first + "': service definition is empty");
+ }
+ Ice::StringSeq params = t->second.parameters;
+ sort(params.begin(), params.end());
+ Ice::StringSeq wdups = params;
+ Ice::StringSeq dups;
+ set_difference(wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()),
+ back_inserter(dups));
+ if(!dups.empty())
+ {
+ dups.erase(unique(dups.begin(), dups.end()), dups.end());
+ exception("invalid server template `" + t->first + "': duplicate parameters " + toString(dups));
+ }
}
}
Resolver::Resolver(const Resolver& resolve,
- const map<string, string>& values,
- bool params) :
+ const map<string, string>& values,
+ bool params) :
_application(resolve._application),
_communicator(resolve._communicator),
_escape(resolve._escape),
@@ -351,20 +351,20 @@ Resolver::Resolver(const Resolver& resolve,
{
if(params)
{
- checkReserved("parameter", values);
+ checkReserved("parameter", values);
}
else
{
- _variables.insert(resolve._variables.begin(), resolve._variables.end());
- checkReserved("variable", values);
+ _variables.insert(resolve._variables.begin(), resolve._variables.end());
+ checkReserved("variable", values);
}
for(StringStringDict::const_iterator v = _variables.begin(); v != _variables.end(); ++v)
{
- if(v->first == "")
- {
- exception("empty variable name");
- }
+ if(v->first == "")
+ {
+ exception("empty variable name");
+ }
}
}
@@ -390,40 +390,40 @@ Resolver::operator()(const string& value, const string& name, bool allowEmpty) c
{
try
{
- string val;
- try
- {
- val = substitute(value, true, true);
- }
- catch(const string& reason)
- {
- throw "invalid variable `" + value + "': " + reason;
- }
- catch(const char* reason)
- {
- throw "invalid variable `" + value + "': " + reason;
- }
-
- if(!allowEmpty)
- {
- if(value.empty())
- {
- throw "empty string";
- }
- else if(val.empty())
- {
- throw "the value of `" + value + "' is an empty string";
- }
- }
- return val;
+ string val;
+ try
+ {
+ val = substitute(value, true, true);
+ }
+ catch(const string& reason)
+ {
+ throw "invalid variable `" + value + "': " + reason;
+ }
+ catch(const char* reason)
+ {
+ throw "invalid variable `" + value + "': " + reason;
+ }
+
+ if(!allowEmpty)
+ {
+ if(value.empty())
+ {
+ throw "empty string";
+ }
+ else if(val.empty())
+ {
+ throw "the value of `" + value + "' is an empty string";
+ }
+ }
+ return val;
}
catch(const string& reason)
{
- exception("invalid value for attribute `" + name + "':\n" + reason);
+ exception("invalid value for attribute `" + name + "':\n" + reason);
}
catch(const char* reason)
{
- exception("invalid value for attribute `" + name + "':\n" + reason);
+ exception("invalid value for attribute `" + name + "':\n" + reason);
}
return ""; // To prevent compiler warning.
}
@@ -434,7 +434,7 @@ Resolver::operator()(const Ice::StringSeq& values, const string& name) const
Ice::StringSeq result;
for(Ice::StringSeq::const_iterator p = values.begin(); p != values.end(); ++p)
{
- result.push_back(operator()(*p, name));
+ result.push_back(operator()(*p, name));
}
return result;
}
@@ -454,10 +454,10 @@ Resolver::operator()(const PropertyDescriptorSeq& properties, const string& name
PropertyDescriptorSeq result;
for(PropertyDescriptorSeq::const_iterator q = properties.begin(); q != properties.end(); ++q)
{
- PropertyDescriptor prop;
- prop.name = operator()(q->name, name + " name");
- prop.value = operator()(q->value, name + " value");
- result.push_back(prop);
+ PropertyDescriptor prop;
+ prop.name = operator()(q->name, name + " name");
+ prop.value = operator()(q->value, name + " value");
+ result.push_back(prop);
}
return result;
}
@@ -469,10 +469,10 @@ Resolver::operator()(const PropertySetDescriptorDict& propertySets) const
PropertySetDescriptorDict::const_iterator ps;
for(ps = propertySets.begin(); ps != propertySets.end(); ++ps)
{
- PropertySetDescriptor desc;
- desc.references = operator()(ps->second.references, "property set `" + ps->first + "' reference");
- desc.properties = operator()(ps->second.properties, "property set `" + ps->first + "' property");
- result.insert(make_pair(ps->first, desc));
+ PropertySetDescriptor desc;
+ desc.references = operator()(ps->second.references, "property set `" + ps->first + "' reference");
+ desc.properties = operator()(ps->second.properties, "property set `" + ps->first + "' property");
+ result.insert(make_pair(ps->first, desc));
}
return result;
}
@@ -483,10 +483,10 @@ Resolver::operator()(const ObjectDescriptorSeq& objects, const string& type) con
ObjectDescriptorSeq result;
for(ObjectDescriptorSeq::const_iterator q = objects.begin(); q != objects.end(); ++q)
{
- ObjectDescriptor obj;
- obj.type = operator()(q->type, type + " object type");
- obj.id = operator()(q->id, type + " object identity");
- result.push_back(obj);
+ ObjectDescriptor obj;
+ obj.type = operator()(q->type, type + " object type");
+ obj.id = operator()(q->id, type + " object identity");
+ result.push_back(obj);
}
return result;
}
@@ -499,7 +499,7 @@ Resolver::operator()(const Ice::Identity& value, const string& name) const
Ice::Identity id = _communicator->stringToIdentity(str);
if(id.name.empty())
{
- exception("invalid object identity `" + _communicator->identityToString(value) + "': name empty");
+ exception("invalid object identity `" + _communicator->identityToString(value) + "': name empty");
}
return id;
}
@@ -520,20 +520,20 @@ Resolver::asInt(const string& value, const string& name) const
string v = operator()(value, name);
if(!v.empty())
{
- string::size_type beg = v.find_first_not_of(' ');
- string::size_type end = v.find_last_not_of(' ');
- v = v.substr(beg == string::npos ? 0 : beg, end == string::npos ? v.length() - 1 : end - beg + 1);
+ string::size_type beg = v.find_first_not_of(' ');
+ string::size_type end = v.find_last_not_of(' ');
+ v = v.substr(beg == string::npos ? 0 : beg, end == string::npos ? v.length() - 1 : end - beg + 1);
- int val;
- istringstream is(v);
- if(!(is >> val) || !is.eof())
- {
- exception("invalid value `" + value + "' for `" + name + "':\nnot an integer");
- }
+ int val;
+ istringstream is(v);
+ if(!(is >> val) || !is.eof())
+ {
+ exception("invalid value `" + value + "' for `" + name + "':\nnot an integer");
+ }
- ostringstream os;
- os << val;
- v = os.str();
+ ostringstream os;
+ os << val;
+ v = os.str();
}
return v;
}
@@ -544,16 +544,16 @@ Resolver::asFloat(const string& value, const string& name) const
string v = operator()(value, name);
if(!v.empty())
{
- string::size_type beg = v.find_first_not_of(' ');
- string::size_type end = v.find_last_not_of(' ');
- v = v.substr(beg == string::npos ? 0 : beg, end == string::npos ? v.length() - 1 : end - beg + 1);
+ string::size_type beg = v.find_first_not_of(' ');
+ string::size_type end = v.find_last_not_of(' ');
+ v = v.substr(beg == string::npos ? 0 : beg, end == string::npos ? v.length() - 1 : end - beg + 1);
- float val;
- istringstream is(v);
- if(!(is >> val) || !is.eof())
- {
- exception("invalid value `" + value + "' for `" + name + "':\nnot a float");
- }
+ float val;
+ istringstream is(v);
+ if(!(is >> val) || !is.eof())
+ {
+ exception("invalid value `" + value + "' for `" + name + "':\nnot a float");
+ }
}
return v;
}
@@ -563,38 +563,38 @@ Resolver::asId(const string& value, const string& name, bool allowEmpty) const
{
try
{
- if(!allowEmpty && value.empty())
- {
- throw "empty string";
- }
-
- string val;
- try
- {
- val = substitute(value, true, false);
- }
- catch(const string& reason)
- {
- throw "invalid variable `" + value + "':\n" + reason;
- }
- catch(const char* reason)
- {
- throw "invalid variable `" + value + "':\n" + reason;
- }
-
- if(!allowEmpty && val.empty())
- {
- throw "the value of `" + value + "' is an empty string";
- }
- return val;
+ if(!allowEmpty && value.empty())
+ {
+ throw "empty string";
+ }
+
+ string val;
+ try
+ {
+ val = substitute(value, true, false);
+ }
+ catch(const string& reason)
+ {
+ throw "invalid variable `" + value + "':\n" + reason;
+ }
+ catch(const char* reason)
+ {
+ throw "invalid variable `" + value + "':\n" + reason;
+ }
+
+ if(!allowEmpty && val.empty())
+ {
+ throw "the value of `" + value + "' is an empty string";
+ }
+ return val;
}
catch(const string& reason)
{
- exception("invalid value for attribute `" + name + "':\n" + reason);
+ exception("invalid value for attribute `" + name + "':\n" + reason);
}
catch(const char* reason)
{
- exception("invalid value for attribute `" + name + "':\n" + reason);
+ exception("invalid value for attribute `" + name + "':\n" + reason);
}
return ""; // To prevent compiler warning.
}
@@ -611,15 +611,15 @@ Resolver::setContext(const string& context)
{
try
{
- _context = substitute(context, true, true);
+ _context = substitute(context, true, true);
}
catch(const string& reason)
{
- exception(reason);
+ exception(reason);
}
catch(const char* reason)
{
- exception(reason);
+ exception(reason);
}
}
@@ -631,10 +631,10 @@ Resolver::addPropertySets(const PropertySetDescriptorDict& propertySets)
PropertySetDescriptorDict::const_iterator p;
for(p = propertySets.begin(); p != propertySets.end(); ++p)
{
- if(!_propertySets.insert(*p).second)
- {
- exception("property set with id `" + p->first + "' is already defined at this scope");
- }
+ if(!_propertySets.insert(*p).second)
+ {
+ exception("property set with id `" + p->first + "' is already defined at this scope");
+ }
}
_propertySets.insert(oldPropertySets.begin(), oldPropertySets.end());
@@ -643,7 +643,7 @@ Resolver::addPropertySets(const PropertySetDescriptorDict& propertySets)
//
for(p = propertySets.begin(); p != propertySets.end(); ++p)
{
- getProperties(p->second.references);
+ getProperties(p->second.references);
}
}
@@ -653,7 +653,7 @@ Resolver::getPropertySet(const string& id) const
PropertySetDescriptorDict::const_iterator p = _propertySets.find(id);
if(p == _propertySets.end())
{
- exception("invalid reference to property set, property set `" + id + "' doesn't exist");
+ exception("invalid reference to property set, property set `" + id + "' doesn't exist");
}
return p->second;
}
@@ -684,7 +684,7 @@ Resolver::getServerTemplate(const string& tmpl) const
TemplateDescriptorDict::const_iterator p = _application->serverTemplates.find(tmpl);
if(p == _application->serverTemplates.end())
{
- throw DeploymentException("unknown server template `" + tmpl + "'");
+ throw DeploymentException("unknown server template `" + tmpl + "'");
}
return p->second;
}
@@ -696,7 +696,7 @@ Resolver::getServiceTemplate(const string& tmpl) const
TemplateDescriptorDict::const_iterator p = _application->serviceTemplates.find(tmpl);
if(p == _application->serviceTemplates.end())
{
- throw DeploymentException("unknown service template `" + tmpl + "'");
+ throw DeploymentException("unknown service template `" + tmpl + "'");
}
return p->second;
}
@@ -706,22 +706,22 @@ Resolver::hasReplicaGroup(const string& id) const
{
if(!_application)
{
- //
- // If we don't know the application descrpitor we assume that
- // the replica group exists (this is possible if the resolver
- // wasn't built from an application helper, that's the case if
- // it's built from NodeCache just to resolve ${node.*} and
- // ${session.*} variables.
- //
- return true;
+ //
+ // If we don't know the application descrpitor we assume that
+ // the replica group exists (this is possible if the resolver
+ // wasn't built from an application helper, that's the case if
+ // it's built from NodeCache just to resolve ${node.*} and
+ // ${session.*} variables.
+ //
+ return true;
}
ReplicaGroupDescriptorSeq::const_iterator p;
for(p = _application->replicaGroups.begin(); p != _application->replicaGroups.end(); ++p)
{
- if(p->id == id)
- {
- return true;
- }
+ if(p->id == id)
+ {
+ return true;
+ }
}
return false;
}
@@ -735,66 +735,66 @@ Resolver::substitute(const string& v, bool useParams, bool useIgnored) const
while((beg = value.find("${", beg)) != string::npos)
{
- if(beg > 0 && value[beg - 1] == '$')
- {
- string::size_type escape = beg - 1;
- while(escape > 0 && value[escape - 1] == '$')
- {
- --escape;
- }
-
- if((beg - escape) % 2)
- {
- if(_escape)
- {
- value.replace(escape, beg - escape, (beg - escape) / 2, '$');
- }
- ++beg;
- continue;
- }
- else
- {
- value.replace(escape, beg - escape, (beg - escape) / 2, '$');
- beg -= (beg - escape) / 2;
- }
- }
-
- end = value.find("}", beg);
- if(end == string::npos)
- {
- throw "malformed variable name `" + value + "'";
- }
-
- //
- // Get the name of the variable and get its value if the
- // variable is not currently ignored (in which case we do
- // nothing, the variable will be substituted later). If the
- // name refered to a parameter we don't do any recursive
- // substitution: the parameter value is computed at the point
- // of definition.
- //
- string name = value.substr(beg + 2, end - beg - 2);
- if(_ignore.find(name) != _ignore.end())
- {
- if(useIgnored)
- {
- ++beg;
- continue;
- }
- else
- {
- throw "use of the `" + name + "' variable is now allowed here";
- }
- }
-
- bool param;
- string val = getVariable(name, useParams, param);
- if(!param)
- {
- val = substitute(val, false, useIgnored); // Recursive resolution
- }
- value.replace(beg, end - beg + 1, val);
- beg += val.length();
+ if(beg > 0 && value[beg - 1] == '$')
+ {
+ string::size_type escape = beg - 1;
+ while(escape > 0 && value[escape - 1] == '$')
+ {
+ --escape;
+ }
+
+ if((beg - escape) % 2)
+ {
+ if(_escape)
+ {
+ value.replace(escape, beg - escape, (beg - escape) / 2, '$');
+ }
+ ++beg;
+ continue;
+ }
+ else
+ {
+ value.replace(escape, beg - escape, (beg - escape) / 2, '$');
+ beg -= (beg - escape) / 2;
+ }
+ }
+
+ end = value.find("}", beg);
+ if(end == string::npos)
+ {
+ throw "malformed variable name `" + value + "'";
+ }
+
+ //
+ // Get the name of the variable and get its value if the
+ // variable is not currently ignored (in which case we do
+ // nothing, the variable will be substituted later). If the
+ // name refered to a parameter we don't do any recursive
+ // substitution: the parameter value is computed at the point
+ // of definition.
+ //
+ string name = value.substr(beg + 2, end - beg - 2);
+ if(_ignore.find(name) != _ignore.end())
+ {
+ if(useIgnored)
+ {
+ ++beg;
+ continue;
+ }
+ else
+ {
+ throw "use of the `" + name + "' variable is now allowed here";
+ }
+ }
+
+ bool param;
+ string val = getVariable(name, useParams, param);
+ if(!param)
+ {
+ val = substitute(val, false, useIgnored); // Recursive resolution
+ }
+ value.replace(beg, end - beg + 1, val);
+ beg += val.length();
}
return value;
}
@@ -810,25 +810,25 @@ Resolver::getVariable(const string& name, bool checkParams, bool& param) const
map<string, string>::const_iterator p = _reserved.find(name);
if(p != _reserved.end())
{
- if(p->second.empty())
- {
- throw "undefined variable `" + name + "'";
- }
- return p->second;
+ if(p->second.empty())
+ {
+ throw "undefined variable `" + name + "'";
+ }
+ return p->second;
}
if(checkParams)
{
- p = _parameters.find(name);
- if(p != _parameters.end())
- {
- param = true;
- return p->second;
- }
+ p = _parameters.find(name);
+ if(p != _parameters.end())
+ {
+ param = true;
+ return p->second;
+ }
}
p = _variables.find(name);
if(p != _variables.end())
{
- return p->second;
+ return p->second;
}
throw "undefined variable `" + name + "'";
@@ -841,21 +841,21 @@ Resolver::getProperties(const Ice::StringSeq& references, set<string>& resolved)
PropertyDescriptorSeq properties;
for(Ice::StringSeq::const_iterator p = references.begin(); p != references.end(); ++p)
{
- if(resolved.find(*p) != resolved.end())
- {
- exception("detected circular dependency with property reference `" + *p + "'");
- }
-
- PropertySetDescriptor desc = getPropertySet(*p);
- if(!desc.references.empty())
- {
- resolved.insert(*p);
- PropertyDescriptorSeq p = getProperties(desc.references, resolved);
- properties.insert(properties.end(), p.begin(), p.end());
- }
-
- PropertyDescriptorSeq pds = operator()(desc.properties);
- properties.insert(properties.end(), pds.begin(), pds.end());
+ if(resolved.find(*p) != resolved.end())
+ {
+ exception("detected circular dependency with property reference `" + *p + "'");
+ }
+
+ PropertySetDescriptor desc = getPropertySet(*p);
+ if(!desc.references.empty())
+ {
+ resolved.insert(*p);
+ PropertyDescriptorSeq p = getProperties(desc.references, resolved);
+ properties.insert(properties.end(), p.begin(), p.end());
+ }
+
+ PropertyDescriptorSeq pds = operator()(desc.properties);
+ properties.insert(properties.end(), pds.begin(), pds.end());
}
return properties;
}
@@ -890,10 +890,10 @@ Resolver::checkReserved(const string& type, const map<string, string>& values) c
{
for(map<string, string>::const_iterator p = values.begin(); p != values.end(); ++p)
{
- if(_reserved.find(p->first) != _reserved.end())
- {
- exception("invalid " + type + " `" + p->first + "': reserved variable name");
- }
+ if(_reserved.find(p->first) != _reserved.end())
+ {
+ exception("invalid " + type + " `" + p->first + "': reserved variable name");
+ }
}
}
@@ -907,34 +907,34 @@ CommunicatorHelper::operator==(const CommunicatorHelper& helper) const
{
if(_desc->ice_id() != helper._desc->ice_id())
{
- return false;
+ return false;
}
if(_desc->description != helper._desc->description)
{
- return false;
+ return false;
}
if(set<AdapterDescriptor>(_desc->adapters.begin(), _desc->adapters.end()) !=
set<AdapterDescriptor>(helper._desc->adapters.begin(), helper._desc->adapters.end()))
{
- return false;
+ return false;
}
if(_desc->propertySet != helper._desc->propertySet)
{
- return false;
+ return false;
}
if(set<DbEnvDescriptor>(_desc->dbEnvs.begin(), _desc->dbEnvs.end()) !=
set<DbEnvDescriptor>(helper._desc->dbEnvs.begin(), helper._desc->dbEnvs.end()))
{
- return false;
+ return false;
}
if(_desc->logs != helper._desc->logs)
{
- return false;
+ return false;
}
return true;
@@ -950,23 +950,23 @@ void
CommunicatorHelper::getIds(multiset<string>& adapterIds, multiset<Ice::Identity>& objectIds) const
{
for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p)
- {
- if(!p->id.empty())
- {
- adapterIds.insert(p->id);
- }
-
- set<Ice::Identity> ids;
- ObjectDescriptorSeq::const_iterator q;
- for(q = p->objects.begin(); q != p->objects.end(); ++q)
- {
- ids.insert(q->id);
- }
- for(q = p->allocatables.begin(); q != p->allocatables.end(); ++q)
- {
- ids.insert(q->id);
- }
- objectIds.insert(ids.begin(), ids.end());
+ {
+ if(!p->id.empty())
+ {
+ adapterIds.insert(p->id);
+ }
+
+ set<Ice::Identity> ids;
+ ObjectDescriptorSeq::const_iterator q;
+ for(q = p->objects.begin(); q != p->objects.end(); ++q)
+ {
+ ids.insert(q->id);
+ }
+ for(q = p->allocatables.begin(); q != p->allocatables.end(); ++q)
+ {
+ ids.insert(q->id);
+ }
+ objectIds.insert(ids.begin(), ids.end());
}
}
@@ -978,44 +978,44 @@ CommunicatorHelper::instantiateImpl(const CommunicatorDescriptorPtr& instance, c
for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p)
{
- AdapterDescriptor adapter;
- adapter.name = resolve(p->name, "object adapter name", false);
- adapter.description = resolve(p->description, "object adapter description");
- adapter.id = resolve.asId(p->id, "object adapter id");
- adapter.registerProcess = p->registerProcess;
- adapter.serverLifetime = p->serverLifetime;
- adapter.replicaGroupId = resolve.asId(p->replicaGroupId, "object adapter replica group id", true);
- if(!adapter.replicaGroupId.empty() && !resolve.hasReplicaGroup(adapter.replicaGroupId))
- {
- resolve.exception("unknown replica group `" + adapter.replicaGroupId + "'");
- }
- adapter.priority = resolve.asInt(p->priority, "object adapter priority");
- adapter.objects = resolve(p->objects, "well-known");
- adapter.allocatables = resolve(p->allocatables, "allocatable");
- instance->adapters.push_back(adapter);
-
- //
- // Make sure the endpoints are defined.
- //
- if(IceGrid::getProperty(instance->propertySet.properties, "Ice.OA." + adapter.name + ".Endpoints").empty())
- {
- resolve.exception("invalid endpoints for adapter `" + adapter.name + "': empty string");
- }
+ AdapterDescriptor adapter;
+ adapter.name = resolve(p->name, "object adapter name", false);
+ adapter.description = resolve(p->description, "object adapter description");
+ adapter.id = resolve.asId(p->id, "object adapter id");
+ adapter.registerProcess = p->registerProcess;
+ adapter.serverLifetime = p->serverLifetime;
+ adapter.replicaGroupId = resolve.asId(p->replicaGroupId, "object adapter replica group id", true);
+ if(!adapter.replicaGroupId.empty() && !resolve.hasReplicaGroup(adapter.replicaGroupId))
+ {
+ resolve.exception("unknown replica group `" + adapter.replicaGroupId + "'");
+ }
+ adapter.priority = resolve.asInt(p->priority, "object adapter priority");
+ adapter.objects = resolve(p->objects, "well-known");
+ adapter.allocatables = resolve(p->allocatables, "allocatable");
+ instance->adapters.push_back(adapter);
+
+ //
+ // Make sure the endpoints are defined.
+ //
+ if(IceGrid::getProperty(instance->propertySet.properties, "Ice.OA." + adapter.name + ".Endpoints").empty())
+ {
+ resolve.exception("invalid endpoints for adapter `" + adapter.name + "': empty string");
+ }
}
for(DbEnvDescriptorSeq::const_iterator s = _desc->dbEnvs.begin(); s != _desc->dbEnvs.end(); ++s)
{
- DbEnvDescriptor dbEnv;
- dbEnv.name = resolve(s->name, "database environment name", false);
- dbEnv.description = resolve(s->description, "database environment description");
- dbEnv.dbHome = resolve(s->dbHome, "database environment home directory");
- dbEnv.properties = resolve(s->properties, "database environment property");
- instance->dbEnvs.push_back(dbEnv);
+ DbEnvDescriptor dbEnv;
+ dbEnv.name = resolve(s->name, "database environment name", false);
+ dbEnv.description = resolve(s->description, "database environment description");
+ dbEnv.dbHome = resolve(s->dbHome, "database environment home directory");
+ dbEnv.properties = resolve(s->properties, "database environment property");
+ instance->dbEnvs.push_back(dbEnv);
}
for(Ice::StringSeq::const_iterator l = _desc->logs.begin(); l != _desc->logs.end(); ++l)
{
- instance->logs.push_back(resolve(*l, "log path", false));
+ instance->logs.push_back(resolve(*l, "log path", false));
}
}
@@ -1039,17 +1039,17 @@ CommunicatorHelper::upgrade(CommunicatorDescriptorPtr& desc) const
bool upgraded = false;
for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p)
{
- const string oaPrefix = p->name + ".";
- for(PropertyDescriptorSeq::iterator q = properties.begin(); q != properties.end(); ++q)
- {
- if(q->name.find(oaPrefix) == 0 &&
- q->name.size() > oaPrefix.size() &&
- oaProperties.find(q->name.substr(oaPrefix.size())) != oaProperties.end())
- {
- q->name = "Ice.OA." + q->name;
- upgraded = true;
- }
- }
+ const string oaPrefix = p->name + ".";
+ for(PropertyDescriptorSeq::iterator q = properties.begin(); q != properties.end(); ++q)
+ {
+ if(q->name.find(oaPrefix) == 0 &&
+ q->name.size() > oaPrefix.size() &&
+ oaProperties.find(q->name.substr(oaPrefix.size())) != oaProperties.end())
+ {
+ q->name = "Ice.OA." + q->name;
+ upgraded = true;
+ }
+ }
}
return upgraded;
}
@@ -1059,48 +1059,48 @@ CommunicatorHelper::print(const Ice::CommunicatorPtr& communicator, Output& out)
{
if(!_desc->description.empty())
{
- out << nl << "description";
- out << sb;
- out << nl << _desc->description;
- out << eb;
+ out << nl << "description";
+ out << sb;
+ out << nl << _desc->description;
+ out << eb;
}
set<string> hiddenProperties;
{
- for(DbEnvDescriptorSeq::const_iterator p = _desc->dbEnvs.begin(); p != _desc->dbEnvs.end(); ++p)
- {
- printDbEnv(out, *p);
- }
+ for(DbEnvDescriptorSeq::const_iterator p = _desc->dbEnvs.begin(); p != _desc->dbEnvs.end(); ++p)
+ {
+ printDbEnv(out, *p);
+ }
}
{
- for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p)
- {
- hiddenProperties.insert("Ice.OA." + p->name + ".Endpoints");
- printObjectAdapter(communicator, out, *p);
- }
+ for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p)
+ {
+ hiddenProperties.insert("Ice.OA." + p->name + ".Endpoints");
+ printObjectAdapter(communicator, out, *p);
+ }
}
{
- for(Ice::StringSeq::const_iterator p = _desc->logs.begin(); p != _desc->logs.end(); ++p)
- {
- out << nl << "log `" << *p << "'";
- }
+ for(Ice::StringSeq::const_iterator p = _desc->logs.begin(); p != _desc->logs.end(); ++p)
+ {
+ out << nl << "log `" << *p << "'";
+ }
}
if(!_desc->propertySet.properties.empty() || !_desc->propertySet.references.empty())
{
- out << nl << "properties";
- out << sb;
- if(!_desc->propertySet.references.empty())
- {
- out << nl << "references = " << toString(_desc->propertySet.references);
- }
- PropertyDescriptorSeq::const_iterator q;
- for(q = _desc->propertySet.properties.begin(); q != _desc->propertySet.properties.end(); ++q)
- {
- if(hiddenProperties.find(q->name) == hiddenProperties.end())
- {
- out << nl << q->name << " = `" << q->value << "'";
- }
- }
- out << eb;
+ out << nl << "properties";
+ out << sb;
+ if(!_desc->propertySet.references.empty())
+ {
+ out << nl << "references = " << toString(_desc->propertySet.references);
+ }
+ PropertyDescriptorSeq::const_iterator q;
+ for(q = _desc->propertySet.properties.begin(); q != _desc->propertySet.properties.end(); ++q)
+ {
+ if(hiddenProperties.find(q->name) == hiddenProperties.end())
+ {
+ out << nl << q->name << " = `" << q->value << "'";
+ }
+ }
+ out << eb;
}
}
@@ -1110,82 +1110,82 @@ CommunicatorHelper::printDbEnv(Output& out, const DbEnvDescriptor& dbEnv) const
out << nl << "database environment `" << dbEnv.name << "'";
if(!dbEnv.dbHome.empty() || !dbEnv.properties.empty() || !dbEnv.description.empty())
{
- out << sb;
- if(!dbEnv.dbHome.empty())
- {
- out << nl << "home = `" << dbEnv.dbHome << "'";
- }
- if(!dbEnv.description.empty())
- {
- out << nl << "description = `" << dbEnv.description << "'";
- }
- if(!dbEnv.properties.empty())
- {
- out << nl << "properties";
- out << sb;
- for(PropertyDescriptorSeq::const_iterator p = dbEnv.properties.begin(); p != dbEnv.properties.end(); ++p)
- {
- out << nl << p->name << " = `" << p->value << "'";
- }
- out << eb;
- }
- out << eb;
+ out << sb;
+ if(!dbEnv.dbHome.empty())
+ {
+ out << nl << "home = `" << dbEnv.dbHome << "'";
+ }
+ if(!dbEnv.description.empty())
+ {
+ out << nl << "description = `" << dbEnv.description << "'";
+ }
+ if(!dbEnv.properties.empty())
+ {
+ out << nl << "properties";
+ out << sb;
+ for(PropertyDescriptorSeq::const_iterator p = dbEnv.properties.begin(); p != dbEnv.properties.end(); ++p)
+ {
+ out << nl << p->name << " = `" << p->value << "'";
+ }
+ out << eb;
+ }
+ out << eb;
}
}
void
CommunicatorHelper::printObjectAdapter(const Ice::CommunicatorPtr& communicator,
- Output& out,
- const AdapterDescriptor& adapter) const
+ Output& out,
+ const AdapterDescriptor& adapter) const
{
out << nl << "adapter `" << adapter.name << "'";
out << sb;
if(!adapter.id.empty())
{
- out << nl << "id = `" << adapter.id << "'";
+ out << nl << "id = `" << adapter.id << "'";
}
if(!adapter.replicaGroupId.empty())
{
- out << nl << "replica group id = `" << adapter.replicaGroupId << "'";
+ out << nl << "replica group id = `" << adapter.replicaGroupId << "'";
}
if(!adapter.priority.empty())
{
- out << nl << "priority = `" << adapter.priority << "'";
+ out << nl << "priority = `" << adapter.priority << "'";
}
string endpoints = getProperty("Ice.OA." + adapter.name + ".Endpoints");
if(!endpoints.empty())
{
- out << nl << "endpoints = `" << endpoints << "'";
+ out << nl << "endpoints = `" << endpoints << "'";
}
out << nl << "register process = `" << (adapter.registerProcess ? "true" : "false") << "'";
out << nl << "server lifetime = `" << (adapter.serverLifetime ? "true" : "false") << "'";
ObjectDescriptorSeq::const_iterator p;
for(p = adapter.objects.begin(); p != adapter.objects.end(); ++p)
{
- out << nl << "well-known object";
- out << sb;
- out << nl << "identity = `" << communicator->identityToString(p->id) << "' ";
- if(!p->type.empty())
- {
- out << nl << "type = `" << p->type << "'";
- }
- out << eb;
+ out << nl << "well-known object";
+ out << sb;
+ out << nl << "identity = `" << communicator->identityToString(p->id) << "' ";
+ if(!p->type.empty())
+ {
+ out << nl << "type = `" << p->type << "'";
+ }
+ out << eb;
}
for(p = adapter.allocatables.begin(); p != adapter.allocatables.end(); ++p)
{
- out << nl << "allocatable";
- out << sb;
- out << nl << "identity = `" << communicator->identityToString(p->id) << "' ";
- if(!p->type.empty())
- {
- out << nl << "type = `" << p->type << "'";
- }
- out << eb;
+ out << nl << "allocatable";
+ out << sb;
+ out << nl << "identity = `" << communicator->identityToString(p->id) << "' ";
+ if(!p->type.empty())
+ {
+ out << nl << "type = `" << p->type << "'";
+ }
+ out << eb;
}
if(!adapter.description.empty())
{
- out << nl << "description = `" << adapter.description << "'";
+ out << nl << "description = `" << adapter.description << "'";
}
out << eb;
}
@@ -1207,17 +1207,17 @@ ServiceHelper::operator==(const ServiceHelper& helper) const
{
if(!CommunicatorHelper::operator==(helper))
{
- return false;
+ return false;
}
if(_desc->name != helper._desc->name)
{
- return false;
+ return false;
}
if(_desc->entry != helper._desc->entry)
{
- return false;
+ return false;
}
return true;
@@ -1237,7 +1237,7 @@ ServiceHelper::getDescriptor() const
ServiceDescriptorPtr
ServiceHelper::instantiate(const Resolver& resolver, const PropertyDescriptorSeq& props,
- const PropertySetDescriptorDict& serviceProps) const
+ const PropertySetDescriptorDict& serviceProps) const
{
ServiceDescriptorPtr service = new ServiceDescriptor();
instantiateImpl(service, resolver, props, serviceProps);
@@ -1246,9 +1246,9 @@ ServiceHelper::instantiate(const Resolver& resolver, const PropertyDescriptorSeq
void
ServiceHelper::instantiateImpl(const ServiceDescriptorPtr& instance,
- const Resolver& resolve,
- const PropertyDescriptorSeq& props,
- const PropertySetDescriptorDict& serviceProps) const
+ const Resolver& resolve,
+ const PropertyDescriptorSeq& props,
+ const PropertySetDescriptorDict& serviceProps) const
{
CommunicatorHelper::instantiateImpl(instance, resolve);
instance->name = resolve(_desc->name, "name", false);
@@ -1257,9 +1257,9 @@ ServiceHelper::instantiateImpl(const ServiceDescriptorPtr& instance,
PropertySetDescriptorDict::const_iterator p = serviceProps.find(instance->name);
if(p != serviceProps.end())
{
- instance->propertySet.properties.insert(instance->propertySet.properties.end(),
- p->second.properties.begin(),
- p->second.properties.end());
+ instance->propertySet.properties.insert(instance->propertySet.properties.end(),
+ p->second.properties.begin(),
+ p->second.properties.end());
}
}
@@ -1284,69 +1284,69 @@ ServerHelper::operator==(const ServerHelper& helper) const
{
if(!CommunicatorHelper::operator==(helper))
{
- return false;
+ return false;
}
if(_desc->id != helper._desc->id)
{
- return false;
+ return false;
}
if(_desc->exe != helper._desc->exe)
{
- return false;
+ return false;
}
if(_desc->pwd != helper._desc->pwd)
{
- return false;
+ return false;
}
if(set<string>(_desc->options.begin(), _desc->options.end()) !=
set<string>(helper._desc->options.begin(), helper._desc->options.end()))
{
- return false;
+ return false;
}
if(set<string>(_desc->envs.begin(), _desc->envs.end()) !=
set<string>(helper._desc->envs.begin(), helper._desc->envs.end()))
{
- return false;
+ return false;
}
if(_desc->activation != helper._desc->activation)
{
- return false;
+ return false;
}
if(_desc->activationTimeout != helper._desc->activationTimeout)
{
- return false;
+ return false;
}
if(_desc->deactivationTimeout != helper._desc->deactivationTimeout)
{
- return false;
+ return false;
}
if(_desc->distrib != helper._desc->distrib)
{
- return false;
+ return false;
}
if(_desc->allocatable != helper._desc->allocatable)
{
- return false;
+ return false;
}
if(_desc->user != helper._desc->user)
{
- return false;
+ return false;
}
if(_desc->iceVersion != helper._desc->iceVersion)
{
- return false;
+ return false;
}
return true;
@@ -1366,12 +1366,12 @@ ServerHelper::getDescriptor() const
ServerDescriptorPtr
ServerHelper::instantiate(const Resolver& resolver,
- const PropertyDescriptorSeq& props,
- const PropertySetDescriptorDict& serviceProps) const
+ const PropertyDescriptorSeq& props,
+ const PropertySetDescriptorDict& serviceProps) const
{
if(!serviceProps.empty())
{
- resolver.exception("service property sets are only allowed in IceBox server instances");
+ resolver.exception("service property sets are only allowed in IceBox server instances");
}
ServerDescriptorPtr server = new ServerDescriptor();
@@ -1399,70 +1399,70 @@ ServerHelper::printImpl(const Ice::CommunicatorPtr& communicator, Output& out, c
{
if(!info.application.empty())
{
- out << nl << "application = `" << info.application << "'";
- out << nl << "application uuid = `" << info.uuid << "'";
- out << nl << "application revision = `" << info.revision << "'";
+ out << nl << "application = `" << info.application << "'";
+ out << nl << "application uuid = `" << info.uuid << "'";
+ out << nl << "application revision = `" << info.revision << "'";
}
if(!info.node.empty())
{
- out << nl << "node = `" << info.node << "'";
+ out << nl << "node = `" << info.node << "'";
}
if(!info.sessionId.empty())
{
- out << nl << "session id = `" << info.sessionId << "'";
+ out << nl << "session id = `" << info.sessionId << "'";
}
out << nl << "exe = `" << _desc->exe << "'";
if(!_desc->pwd.empty())
{
- out << nl << "pwd = `" << _desc->pwd << "'";
+ out << nl << "pwd = `" << _desc->pwd << "'";
}
out << nl << "activation = `" << _desc->activation << "'";
if(!_desc->activationTimeout.empty() && _desc->activationTimeout != "0")
{
- out << nl << "activationTimeout = `" << _desc->activationTimeout << "'";
+ out << nl << "activationTimeout = `" << _desc->activationTimeout << "'";
}
if(!_desc->deactivationTimeout.empty() && _desc->deactivationTimeout != "0")
{
- out << nl << "deactivationTimeout = `" << _desc->deactivationTimeout << "'";
+ out << nl << "deactivationTimeout = `" << _desc->deactivationTimeout << "'";
}
if(!_desc->user.empty())
{
- out << nl << "user = `" << _desc->user << "'";
+ out << nl << "user = `" << _desc->user << "'";
}
if(!_desc->iceVersion.empty())
{
- out << nl << "ice version = `" << _desc->iceVersion << "'";
+ out << nl << "ice version = `" << _desc->iceVersion << "'";
}
if(!_desc->applicationDistrib)
{
- out << nl << "application distribution = `false'";
+ out << nl << "application distribution = `false'";
}
if(!_desc->options.empty())
{
- out << nl << "options = `" << toString(_desc->options) << "'";
+ out << nl << "options = `" << toString(_desc->options) << "'";
}
if(!_desc->envs.empty())
{
- out << nl << "envs = `" << toString(_desc->envs) << "'";
+ out << nl << "envs = `" << toString(_desc->envs) << "'";
}
if(!_desc->distrib.icepatch.empty())
{
- out << nl << "distribution";
- out << sb;
- out << nl << "proxy = `" << _desc->distrib.icepatch << "'";
- if(!_desc->distrib.directories.empty())
- {
- out << nl << "directories = `" << toString(_desc->distrib.directories) << "'";
- }
- out << eb;
+ out << nl << "distribution";
+ out << sb;
+ out << nl << "proxy = `" << _desc->distrib.icepatch << "'";
+ if(!_desc->distrib.directories.empty())
+ {
+ out << nl << "directories = `" << toString(_desc->distrib.directories) << "'";
+ }
+ out << eb;
}
CommunicatorHelper::print(communicator, out);
}
void
ServerHelper::instantiateImpl(const ServerDescriptorPtr& instance,
- const Resolver& resolve,
- const PropertyDescriptorSeq& props) const
+ const Resolver& resolve,
+ const PropertyDescriptorSeq& props) const
{
CommunicatorHelper::instantiateImpl(instance, resolve);
@@ -1476,22 +1476,22 @@ ServerHelper::instantiateImpl(const ServerDescriptorPtr& instance,
instance->iceVersion = resolve(_desc->iceVersion, "ice version");
if(!instance->iceVersion.empty())
{
- int version = getMMVersion(instance->iceVersion);
- if(version < 0)
- {
- resolve.exception("invalid ice version: " + instance->iceVersion);
- }
- else if(version > ICE_INT_VERSION)
- {
- //resolve.exception("invalid ice version: " + instance->iceVersion + " is superior to the IceGrid \n"
- //"registry version (" + ICE_STRING_VERSION + ")");
- if(resolve.warningEnabled())
- {
- Ice::Warning out(resolve.getCommunicator()->getLogger());
- out << "invalid ice version: " << instance->iceVersion << " is superior to the IceGrid ";
- out << "registry version (" << ICE_STRING_VERSION << ")";
- }
- }
+ int version = getMMVersion(instance->iceVersion);
+ if(version < 0)
+ {
+ resolve.exception("invalid ice version: " + instance->iceVersion);
+ }
+ else if(version > ICE_INT_VERSION)
+ {
+ //resolve.exception("invalid ice version: " + instance->iceVersion + " is superior to the IceGrid \n"
+ //"registry version (" + ICE_STRING_VERSION + ")");
+ if(resolve.warningEnabled())
+ {
+ Ice::Warning out(resolve.getCommunicator()->getLogger());
+ out << "invalid ice version: " << instance->iceVersion << " is superior to the IceGrid ";
+ out << "registry version (" << ICE_STRING_VERSION << ")";
+ }
+ }
}
if(!instance->activation.empty() &&
instance->activation != "manual" &&
@@ -1499,7 +1499,7 @@ ServerHelper::instantiateImpl(const ServerDescriptorPtr& instance,
instance->activation != "always" &&
instance->activation != "session")
{
- resolve.exception("unknown activation `" + instance->activation + "'");
+ resolve.exception("unknown activation `" + instance->activation + "'");
}
instance->activationTimeout = resolve.asInt(_desc->activationTimeout, "activation timeout");
instance->deactivationTimeout = resolve.asInt(_desc->deactivationTimeout, "deactivation timeout");
@@ -1515,7 +1515,7 @@ IceBoxHelper::IceBoxHelper(const IceBoxDescriptorPtr& descriptor) :
{
for(ServiceInstanceDescriptorSeq::const_iterator p = _desc->services.begin(); p != _desc->services.end(); ++p)
{
- _services.push_back(ServiceInstanceHelper(*p));
+ _services.push_back(ServiceInstanceHelper(*p));
}
}
@@ -1524,12 +1524,12 @@ IceBoxHelper::operator==(const IceBoxHelper& helper) const
{
if(!ServerHelper::operator==(helper))
{
- return false;
+ return false;
}
-
+
if(_services != helper._services)
{
- return false;
+ return false;
}
return true;
@@ -1543,8 +1543,8 @@ IceBoxHelper::operator!=(const IceBoxHelper& helper) const
ServerDescriptorPtr
IceBoxHelper::instantiate(const Resolver& resolver,
- const PropertyDescriptorSeq& props,
- const PropertySetDescriptorDict& serviceProps) const
+ const PropertyDescriptorSeq& props,
+ const PropertySetDescriptorDict& serviceProps) const
{
IceBoxDescriptorPtr iceBox = new IceBoxDescriptor();
instantiateImpl(iceBox, resolver, props, serviceProps);
@@ -1557,7 +1557,7 @@ IceBoxHelper::getIds(multiset<string>& adapterIds, multiset<Ice::Identity>& obje
CommunicatorHelper::getIds(adapterIds, objectIds);
for(vector<ServiceInstanceHelper>::const_iterator p = _services.begin(); p != _services.end(); ++p)
{
- p->getIds(adapterIds, objectIds);
+ p->getIds(adapterIds, objectIds);
}
}
@@ -1568,16 +1568,16 @@ IceBoxHelper::upgrade(CommunicatorDescriptorPtr& communicator) const
IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(communicator);
for(ServiceInstanceDescriptorSeq::iterator p = iceBox->services.begin(); p != iceBox->services.end(); ++p)
{
- if(p->descriptor)
- {
- CommunicatorDescriptorPtr com;
- if(ServiceHelper(p->descriptor).upgrade(com))
- {
- upgraded = true;
- p->descriptor = ServiceDescriptorPtr::dynamicCast(com);
- assert(p->descriptor);
- }
- }
+ if(p->descriptor)
+ {
+ CommunicatorDescriptorPtr com;
+ if(ServiceHelper(p->descriptor).upgrade(com))
+ {
+ upgraded = true;
+ p->descriptor = ServiceDescriptorPtr::dynamicCast(com);
+ assert(p->descriptor);
+ }
+ }
}
return upgraded;
}
@@ -1599,42 +1599,42 @@ IceBoxHelper::print(const Ice::CommunicatorPtr& communicator, Output& out, const
printImpl(communicator, out, info);
for(vector<ServiceInstanceHelper>::const_iterator p = _services.begin(); p != _services.end(); ++p)
{
- out << nl;
- p->print(communicator, out);
+ out << nl;
+ p->print(communicator, out);
}
out << eb;
}
void
IceBoxHelper::instantiateImpl(const IceBoxDescriptorPtr& instance,
- const Resolver& resolver,
- const PropertyDescriptorSeq& props,
- const PropertySetDescriptorDict& serviceProps) const
+ const Resolver& resolver,
+ const PropertyDescriptorSeq& props,
+ const PropertySetDescriptorDict& serviceProps) const
{
ServerHelper::instantiateImpl(instance, resolver, props);
set<string> serviceNames;
for(vector<ServiceInstanceHelper>::const_iterator p = _services.begin(); p != _services.end(); ++p)
{
- ServiceInstanceDescriptor desc = p->instantiate(resolver, serviceProps);
- assert(desc.descriptor);
- serviceNames.insert(desc.descriptor->name);
- instance->services.push_back(desc);
+ ServiceInstanceDescriptor desc = p->instantiate(resolver, serviceProps);
+ assert(desc.descriptor);
+ serviceNames.insert(desc.descriptor->name);
+ instance->services.push_back(desc);
}
for(PropertySetDescriptorDict::const_iterator q = serviceProps.begin(); q != serviceProps.end(); ++q)
{
- if(serviceNames.find(q->first) == serviceNames.end())
- {
- resolver.exception("invalid service property set: service `" + q->first + "' doesn't exist");
- }
+ if(serviceNames.find(q->first) == serviceNames.end())
+ {
+ resolver.exception("invalid service property set: service `" + q->first + "' doesn't exist");
+ }
}
}
map<string, string>
InstanceHelper::instantiateParams(const Resolver& resolve,
- const string& tmpl,
- const map<string, string>& parameters,
- const vector<string>& requiredParameters,
- const map<string, string>& defaults) const
+ const string& tmpl,
+ const map<string, string>& parameters,
+ const vector<string>& requiredParameters,
+ const map<string, string>& defaults) const
{
map<string, string> params;
@@ -1642,42 +1642,42 @@ InstanceHelper::instantiateParams(const Resolver& resolve,
set<string> unknown;
for(map<string, string>::const_iterator p = parameters.begin(); p != parameters.end(); ++p)
{
- if(required.find(p->first) == required.end())
- {
- unknown.insert(p->first);
- }
- params.insert(make_pair(p->first, resolve(p->second, "parameter `" + p->first + "'")));
+ if(required.find(p->first) == required.end())
+ {
+ unknown.insert(p->first);
+ }
+ params.insert(make_pair(p->first, resolve(p->second, "parameter `" + p->first + "'")));
}
if(!unknown.empty())
{
- ostringstream os;
- os << "unknown parameters when instantiating `" + tmpl + "' template: ";
- copy(unknown.begin(), unknown.end(), ostream_iterator<string>(os, " "));
- resolve.exception(os.str());
+ ostringstream os;
+ os << "unknown parameters when instantiating `" + tmpl + "' template: ";
+ copy(unknown.begin(), unknown.end(), ostream_iterator<string>(os, " "));
+ resolve.exception(os.str());
}
set<string> missingParams;
for(set<string>::const_iterator q = required.begin(); q != required.end(); ++q)
{
- if(params.find(*q) == params.end())
- {
- map<string, string>::const_iterator r = defaults.find(*q);
- if(r == defaults.end())
- {
- missingParams.insert(*q);
- }
- else
- {
- params.insert(make_pair(r->first, resolve(r->second, "default parameter `" + r->first + "'")));
- }
- }
+ if(params.find(*q) == params.end())
+ {
+ map<string, string>::const_iterator r = defaults.find(*q);
+ if(r == defaults.end())
+ {
+ missingParams.insert(*q);
+ }
+ else
+ {
+ params.insert(make_pair(r->first, resolve(r->second, "default parameter `" + r->first + "'")));
+ }
+ }
}
if(!missingParams.empty())
{
- ostringstream os;
- os << "undefined parameters when instantiating `" + tmpl + "' template: ";
- copy(missingParams.begin(), missingParams.end(), ostream_iterator<string>(os, " "));
- resolve.exception(os.str());
+ ostringstream os;
+ os << "undefined parameters when instantiating `" + tmpl + "' template: ";
+ copy(missingParams.begin(), missingParams.end(), ostream_iterator<string>(os, " "));
+ resolve.exception(os.str());
}
return params;
@@ -1693,12 +1693,12 @@ ServiceInstanceHelper::ServiceInstanceHelper(const ServiceInstanceDescriptor& de
//
if(_def._cpp_template.empty() && !_def.descriptor)
{
- throw DeploymentException("invalid service instance: no template defined");
+ throw DeploymentException("invalid service instance: no template defined");
}
if(_def.descriptor)
{
- _service = ServiceHelper(_def.descriptor);
+ _service = ServiceHelper(_def.descriptor);
}
}
@@ -1707,13 +1707,13 @@ ServiceInstanceHelper::operator==(const ServiceInstanceHelper& helper) const
{
if(_def._cpp_template.empty())
{
- return _service == helper._service;
+ return _service == helper._service;
}
else
{
- return _def._cpp_template == helper._def._cpp_template &&
- _def.parameterValues == helper._def.parameterValues &&
- _def.propertySet == helper._def.propertySet;
+ return _def._cpp_template == helper._def._cpp_template &&
+ _def.parameterValues == helper._def.parameterValues &&
+ _def.propertySet == helper._def.propertySet;
}
}
@@ -1730,14 +1730,14 @@ ServiceInstanceHelper::instantiate(const Resolver& resolve, const PropertySetDes
std::map<std::string, std::string> parameterValues;
if(!def.getDescriptor())
{
- assert(!_def._cpp_template.empty());
- TemplateDescriptor tmpl = resolve.getServiceTemplate(_def._cpp_template);
- def = ServiceHelper(ServiceDescriptorPtr::dynamicCast(tmpl.descriptor));
- parameterValues = instantiateParams(resolve,
- _def._cpp_template,
- _def.parameterValues,
- tmpl.parameters,
- tmpl.parameterDefaults);
+ assert(!_def._cpp_template.empty());
+ TemplateDescriptor tmpl = resolve.getServiceTemplate(_def._cpp_template);
+ def = ServiceHelper(ServiceDescriptorPtr::dynamicCast(tmpl.descriptor));
+ parameterValues = instantiateParams(resolve,
+ _def._cpp_template,
+ _def.parameterValues,
+ tmpl.parameters,
+ tmpl.parameterDefaults);
}
//
@@ -1776,36 +1776,36 @@ ServiceInstanceHelper::print(const Ice::CommunicatorPtr& communicator, Output& o
{
if(_service.getDescriptor())
{
- _service.print(communicator, out);
+ _service.print(communicator, out);
}
else
{
- assert(!_def._cpp_template.empty());
- out << "service instance";
- out << sb;
- out << nl << "template = `" << _def._cpp_template << "'";
- out << nl << "parameters";
- out << sb;
- for(StringStringDict::const_iterator p = _def.parameterValues.begin(); p != _def.parameterValues.end(); ++p)
- {
- out << nl << p->first << " = `" << p->second << "'";
- }
- out << eb;
- out << eb;
+ assert(!_def._cpp_template.empty());
+ out << "service instance";
+ out << sb;
+ out << nl << "template = `" << _def._cpp_template << "'";
+ out << nl << "parameters";
+ out << sb;
+ for(StringStringDict::const_iterator p = _def.parameterValues.begin(); p != _def.parameterValues.end(); ++p)
+ {
+ out << nl << p->first << " = `" << p->second << "'";
+ }
+ out << eb;
+ out << eb;
}
}
ServerInstanceHelper::ServerInstanceHelper(const ServerInstanceDescriptor& desc,
- const Resolver& resolve,
- bool instantiate) :
+ const Resolver& resolve,
+ bool instantiate) :
_def(desc)
{
init(0, resolve, instantiate);
}
ServerInstanceHelper::ServerInstanceHelper(const ServerDescriptorPtr& definition,
- const Resolver& resolve,
- bool instantiate) :
+ const Resolver& resolve,
+ bool instantiate) :
_def(ServerInstanceDescriptor())
{
init(definition, resolve, instantiate);
@@ -1821,21 +1821,21 @@ ServerInstanceHelper::init(const ServerDescriptorPtr& definition, const Resolver
std::map<std::string, std::string> parameterValues;
if(!def)
{
- if(_def._cpp_template.empty())
- {
- resolve.exception("invalid server instance: template is not defined");
- }
-
- //
- // Get the server definition and the template property sets.
- //
- TemplateDescriptor tmpl = resolve.getServerTemplate(_def._cpp_template);
- def = ServerDescriptorPtr::dynamicCast(tmpl.descriptor);
- parameterValues = instantiateParams(resolve,
- _def._cpp_template,
- _def.parameterValues,
- tmpl.parameters,
- tmpl.parameterDefaults);
+ if(_def._cpp_template.empty())
+ {
+ resolve.exception("invalid server instance: template is not defined");
+ }
+
+ //
+ // Get the server definition and the template property sets.
+ //
+ TemplateDescriptor tmpl = resolve.getServerTemplate(_def._cpp_template);
+ def = ServerDescriptorPtr::dynamicCast(tmpl.descriptor);
+ parameterValues = instantiateParams(resolve,
+ _def._cpp_template,
+ _def.parameterValues,
+ tmpl.parameters,
+ tmpl.parameterDefaults);
}
assert(def);
@@ -1854,7 +1854,7 @@ ServerInstanceHelper::init(const ServerDescriptorPtr& definition, const Resolver
if(!instantiate)
{
- return; // We're done.
+ return; // We're done.
}
//
@@ -1863,30 +1863,30 @@ ServerInstanceHelper::init(const ServerDescriptorPtr& definition, const Resolver
//
if(svrResolve(def->activation, "server activation", true) == "session")
{
- svrResolve.addIgnored("session.id");
+ svrResolve.addIgnored("session.id");
}
-
+
//
// Instantiate the server instance definition (we use the server
// resolver above, so using parameters in properties is possible).
//
if(!_def._cpp_template.empty())
{
- _instance._cpp_template = _def._cpp_template;
- _instance.parameterValues = parameterValues;
- _instance.propertySet = svrResolve(_def.propertySet);
- for(PropertySetDescriptorDict::const_iterator p = _def.servicePropertySets.begin();
- p != _def.servicePropertySets.end(); ++p)
- {
- _instance.servicePropertySets.insert(make_pair(svrResolve(p->first), svrResolve(p->second)));
- }
+ _instance._cpp_template = _def._cpp_template;
+ _instance.parameterValues = parameterValues;
+ _instance.propertySet = svrResolve(_def.propertySet);
+ for(PropertySetDescriptorDict::const_iterator p = _def.servicePropertySets.begin();
+ p != _def.servicePropertySets.end(); ++p)
+ {
+ _instance.servicePropertySets.insert(make_pair(svrResolve(p->first), svrResolve(p->second)));
+ }
}
//
// Instantiate the server definition.
//
ServerDescriptorPtr inst = _serverDefinition->instantiate(svrResolve, _instance.propertySet.properties,
- _instance.servicePropertySets);
+ _instance.servicePropertySets);
_serverInstance = createHelper(inst);
}
@@ -1895,14 +1895,14 @@ ServerInstanceHelper::operator==(const ServerInstanceHelper& helper) const
{
if(_def._cpp_template.empty())
{
- return *_serverDefinition == *helper._serverDefinition;
+ return *_serverDefinition == *helper._serverDefinition;
}
else
{
- return _def._cpp_template == helper._def._cpp_template &&
- _def.parameterValues == helper._def.parameterValues &&
- _def.propertySet == helper._def.propertySet &&
- _def.servicePropertySets == helper._def.servicePropertySets;
+ return _def._cpp_template == helper._def._cpp_template &&
+ _def.parameterValues == helper._def.parameterValues &&
+ _def.propertySet == helper._def.propertySet &&
+ _def.servicePropertySets == helper._def.servicePropertySets;
}
}
@@ -1954,16 +1954,16 @@ ServerInstanceHelper::getIds(multiset<string>& adapterIds, multiset<Ice::Identit
}
NodeHelper::NodeHelper(const string& name,
- const NodeDescriptor& descriptor,
- const Resolver& appResolve,
- bool instantiate) :
+ const NodeDescriptor& descriptor,
+ const Resolver& appResolve,
+ bool instantiate) :
_name(name),
_def(descriptor),
_instantiated(instantiate)
{
if(_name.empty())
{
- appResolve.exception("invalid node: empty name");
+ appResolve.exception("invalid node: empty name");
}
Resolver resolve(appResolve, _def.variables, false);
@@ -1972,48 +1972,48 @@ NodeHelper::NodeHelper(const string& name,
if(instantiate)
{
- //
- // Instantiate the node definition.
- //
- _instance.variables = _def.variables;
- _instance.loadFactor = resolve.asFloat(_def.loadFactor, "load factor");
- _instance.description = resolve(_def.description, "description");
- _instance.propertySets = resolve(_def.propertySets);
+ //
+ // Instantiate the node definition.
+ //
+ _instance.variables = _def.variables;
+ _instance.loadFactor = resolve.asFloat(_def.loadFactor, "load factor");
+ _instance.description = resolve(_def.description, "description");
+ _instance.propertySets = resolve(_def.propertySets);
- //
- // Set the named property sets on the resolver. We use the
- // instantiated named property sets here -- named property sets
- // must be fully definied at the node level.
- //
- resolve.addPropertySets(_instance.propertySets);
+ //
+ // Set the named property sets on the resolver. We use the
+ // instantiated named property sets here -- named property sets
+ // must be fully definied at the node level.
+ //
+ resolve.addPropertySets(_instance.propertySets);
}
ServerInstanceDescriptorSeq::const_iterator p;
for(p = _def.serverInstances.begin(); p != _def.serverInstances.end(); ++p)
{
- ServerInstanceHelper helper(*p, resolve, instantiate);
- if(!_serverInstances.insert(make_pair(helper.getId(), helper)).second)
- {
- resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
- }
- if(instantiate)
- {
- _instance.serverInstances.push_back(helper.getInstance());
- }
+ ServerInstanceHelper helper(*p, resolve, instantiate);
+ if(!_serverInstances.insert(make_pair(helper.getId(), helper)).second)
+ {
+ resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
+ }
+ if(instantiate)
+ {
+ _instance.serverInstances.push_back(helper.getInstance());
+ }
}
ServerDescriptorSeq::const_iterator q;
for(q = _def.servers.begin(); q != _def.servers.end(); ++q)
{
- ServerInstanceHelper helper(*q, resolve, instantiate);
- if(!_servers.insert(make_pair(helper.getId(), helper)).second)
- {
- resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
- }
- if(instantiate)
- {
- _instance.servers.push_back(helper.getServerInstance());
- }
+ ServerInstanceHelper helper(*q, resolve, instantiate);
+ if(!_servers.insert(make_pair(helper.getId(), helper)).second)
+ {
+ resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
+ }
+ if(instantiate)
+ {
+ _instance.servers.push_back(helper.getServerInstance());
+ }
}
}
@@ -2022,32 +2022,32 @@ NodeHelper::operator==(const NodeHelper& helper) const
{
if(_def.variables != helper._def.variables)
{
- return false;
+ return false;
}
if(_serverInstances != helper._serverInstances)
{
- return false;
+ return false;
}
if(_servers != helper._servers)
{
- return false;
+ return false;
}
if(_def.loadFactor != helper._def.loadFactor)
{
- return false;
+ return false;
}
if(_def.description != helper._def.description)
{
- return false;
+ return false;
}
if(_def.propertySets != helper._def.propertySets)
{
- return false;
+ return false;
}
return true;
@@ -2069,12 +2069,12 @@ NodeHelper::diff(const NodeHelper& helper) const
update.name = _name;
if(_def.loadFactor != helper._def.loadFactor)
{
- update.loadFactor = new BoxedString(_def.loadFactor);
+ update.loadFactor = new BoxedString(_def.loadFactor);
}
if(_def.description != helper._def.description)
{
- update.description = new BoxedString(_def.description);
+ update.description = new BoxedString(_def.description);
}
update.variables = getDictUpdatedElts(helper._def.variables, _def.variables);
@@ -2086,14 +2086,14 @@ NodeHelper::diff(const NodeHelper& helper) const
ServerInstanceHelperDict updated = getDictUpdatedElts(helper._serverInstances, _serverInstances);
for(ServerInstanceHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
{
- update.serverInstances.push_back(p->second.getDefinition());
+ update.serverInstances.push_back(p->second.getDefinition());
}
update.removeServers = getDictRemovedElts(helper._serverInstances, _serverInstances);
updated = getDictUpdatedElts(helper._servers, _servers);
for(ServerInstanceHelperDict::const_iterator q = updated.begin(); q != updated.end(); ++q)
{
- update.servers.push_back(q->second.getServerDefinition());
+ update.servers.push_back(q->second.getServerDefinition());
}
Ice::StringSeq removed = getDictRemovedElts(helper._servers, _servers);
update.removeServers.insert(update.removeServers.end(), removed.begin(), removed.end());
@@ -2137,63 +2137,63 @@ NodeHelper::update(const NodeUpdateDescriptor& update, const Resolver& appResolv
ServerInstanceDescriptorSeq::const_iterator q;
for(q = update.serverInstances.begin(); q != update.serverInstances.end(); ++q)
{
- ServerInstanceHelper helper(*q, resolve, false);
- if(!added.insert(helper.getId()).second)
- {
- resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
- }
- def.serverInstances.push_back(helper.getDefinition());
+ ServerInstanceHelper helper(*q, resolve, false);
+ if(!added.insert(helper.getId()).second)
+ {
+ resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
+ }
+ def.serverInstances.push_back(helper.getDefinition());
}
for(r = _serverInstances.begin(); r != _serverInstances.end(); ++r)
{
- if(removed.find(r->first) != removed.end() || added.find(r->first) != added.end())
- {
- continue;
- }
-
- //
- // Re-instantiate the server. Make sure the server ID didn't
- // change, if the ID of a server changes the update descriptor
- // has to remove the server and add an update entry for it.
- //
- ServerInstanceHelper helper(r->second.getDefinition(), resolve, false);
- if(helper.getId() != r->first)
- {
- resolve.exception("invalid update in node `" + _name + "':\n" + "server instance id `" + r->first +
- "' changed to `" + helper.getId() + "'");
- }
- def.serverInstances.push_back(helper.getDefinition());
+ if(removed.find(r->first) != removed.end() || added.find(r->first) != added.end())
+ {
+ continue;
+ }
+
+ //
+ // Re-instantiate the server. Make sure the server ID didn't
+ // change, if the ID of a server changes the update descriptor
+ // has to remove the server and add an update entry for it.
+ //
+ ServerInstanceHelper helper(r->second.getDefinition(), resolve, false);
+ if(helper.getId() != r->first)
+ {
+ resolve.exception("invalid update in node `" + _name + "':\n" + "server instance id `" + r->first +
+ "' changed to `" + helper.getId() + "'");
+ }
+ def.serverInstances.push_back(helper.getDefinition());
}
added.clear();
for(ServerDescriptorSeq::const_iterator s = update.servers.begin(); s != update.servers.end(); ++s)
{
- ServerInstanceHelper helper(*s, resolve, false);
- if(!added.insert(helper.getId()).second)
- {
- resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
- }
- def.servers.push_back(helper.getServerDefinition());
+ ServerInstanceHelper helper(*s, resolve, false);
+ if(!added.insert(helper.getId()).second)
+ {
+ resolve.exception("duplicate server `" + helper.getId() + "' in node `" + _name + "'");
+ }
+ def.servers.push_back(helper.getServerDefinition());
}
for(r = _servers.begin(); r != _servers.end(); ++r)
{
- if(removed.find(r->first) != removed.end() || added.find(r->first) != added.end())
- {
- continue;
- }
-
- //
- // Re-instantiate the server. Make sure the server ID didn't
- // change, if the ID of a server changes the update descriptor
- // has to remove the server and add an update entry for it.
- //
- ServerInstanceHelper helper(r->second.getServerDefinition(), resolve, false);
- if(helper.getId() != r->first)
- {
- resolve.exception("invalid update in node `" + _name + "':\nserver instance id `" + r->first +
- "' changed to `" + helper.getId() + "'");
- }
- def.servers.push_back(helper.getServerDefinition());
+ if(removed.find(r->first) != removed.end() || added.find(r->first) != added.end())
+ {
+ continue;
+ }
+
+ //
+ // Re-instantiate the server. Make sure the server ID didn't
+ // change, if the ID of a server changes the update descriptor
+ // has to remove the server and add an update entry for it.
+ //
+ ServerInstanceHelper helper(r->second.getServerDefinition(), resolve, false);
+ if(helper.getId() != r->first)
+ {
+ resolve.exception("invalid update in node `" + _name + "':\nserver instance id `" + r->first +
+ "' changed to `" + helper.getId() + "'");
+ }
+ def.servers.push_back(helper.getServerDefinition());
}
return def;
}
@@ -2206,12 +2206,12 @@ NodeHelper::upgrade(NodeDescriptor& desc) const
bool upgraded = false;
for(ServerDescriptorSeq::iterator j = desc.servers.begin(); j != desc.servers.end(); ++j)
{
- CommunicatorDescriptorPtr com;
- if(createHelper(*j)->upgrade(com))
- {
- *j = ServerDescriptorPtr::dynamicCast(com);
- upgraded = true;
- }
+ CommunicatorDescriptorPtr com;
+ if(createHelper(*j)->upgrade(com))
+ {
+ *j = ServerDescriptorPtr::dynamicCast(com);
+ upgraded = true;
+ }
}
return upgraded;
@@ -2224,13 +2224,13 @@ NodeHelper::getIds(multiset<string>& serverIds, multiset<string>& adapterIds, mu
ServerInstanceHelperDict::const_iterator p;
for(p = _serverInstances.begin(); p != _serverInstances.end(); ++p)
{
- serverIds.insert(p->first);
- p->second.getIds(adapterIds, objectIds);
+ serverIds.insert(p->first);
+ p->second.getIds(adapterIds, objectIds);
}
for(p = _servers.begin(); p != _servers.end(); ++p)
{
- serverIds.insert(p->first);
- p->second.getIds(adapterIds, objectIds);
+ serverIds.insert(p->first);
+ p->second.getIds(adapterIds, objectIds);
}
}
@@ -2255,23 +2255,23 @@ NodeHelper::getServerInfos(const string& app, const string& uuid, int revision,
ServerInstanceHelperDict::const_iterator p;
for(p = _serverInstances.begin(); p != _serverInstances.end(); ++p)
{
- ServerInfo info;
- info.node = _name;
- info.application = app;
- info.uuid = uuid;
- info.revision = revision;
- info.descriptor = p->second.getServerInstance();
- servers.insert(make_pair(p->second.getId(), info));
+ ServerInfo info;
+ info.node = _name;
+ info.application = app;
+ info.uuid = uuid;
+ info.revision = revision;
+ info.descriptor = p->second.getServerInstance();
+ servers.insert(make_pair(p->second.getId(), info));
}
for(p = _servers.begin(); p != _servers.end(); ++p)
{
- ServerInfo info;
- info.node = _name;
- info.application = app;
- info.uuid = uuid;
- info.revision = revision;
- info.descriptor = p->second.getServerInstance();
- servers.insert(make_pair(p->second.getId(), info));
+ ServerInfo info;
+ info.node = _name;
+ info.application = app;
+ info.uuid = uuid;
+ info.revision = revision;
+ info.descriptor = p->second.getServerInstance();
+ servers.insert(make_pair(p->second.getId(), info));
}
}
@@ -2285,38 +2285,38 @@ NodeHelper::hasDistributions(const string& server) const
//
if(server.empty())
{
- ServerInstanceHelperDict::const_iterator p;
- for(p = _serverInstances.begin(); p != _serverInstances.end(); ++p)
- {
- if(!p->second.getServerInstance()->distrib.icepatch.empty())
- {
- return true;
- }
- }
- for(p = _servers.begin(); p != _servers.end(); ++p)
- {
- if(!p->second.getServerInstance()->distrib.icepatch.empty())
- {
- return true;
- }
- }
+ ServerInstanceHelperDict::const_iterator p;
+ for(p = _serverInstances.begin(); p != _serverInstances.end(); ++p)
+ {
+ if(!p->second.getServerInstance()->distrib.icepatch.empty())
+ {
+ return true;
+ }
+ }
+ for(p = _servers.begin(); p != _servers.end(); ++p)
+ {
+ if(!p->second.getServerInstance()->distrib.icepatch.empty())
+ {
+ return true;
+ }
+ }
}
else
{
- ServerInstanceHelperDict::const_iterator p = _serverInstances.find(server);
- if(p == _serverInstances.end())
- {
- p = _servers.find(server);
- if(p == _servers.end())
- {
- return false;
- }
- }
+ ServerInstanceHelperDict::const_iterator p = _serverInstances.find(server);
+ if(p == _serverInstances.end())
+ {
+ p = _servers.find(server);
+ if(p == _servers.end())
+ {
+ return false;
+ }
+ }
- if(!p->second.getServerInstance()->distrib.icepatch.empty())
- {
- return true;
- }
+ if(!p->second.getServerInstance()->distrib.icepatch.empty())
+ {
+ return true;
+ }
}
return false;
@@ -2343,45 +2343,45 @@ NodeHelper::print(Output& out) const
out << sb;
if(!_instance.loadFactor.empty())
{
- out << nl << "load factor = `" << _instance.loadFactor << "'";
+ out << nl << "load factor = `" << _instance.loadFactor << "'";
}
if(!_instance.description.empty())
{
- out << nl << "description = `" << _instance.description << "'";
+ out << nl << "description = `" << _instance.description << "'";
}
if(!_instance.variables.empty())
{
- out << nl << "variables";
- out << sb;
- for(StringStringDict::const_iterator q = _instance.variables.begin(); q != _instance.variables.end(); ++q)
- {
- out << nl << q->first << " = `" << q->second << "'";
- }
- out << eb;
+ out << nl << "variables";
+ out << sb;
+ for(StringStringDict::const_iterator q = _instance.variables.begin(); q != _instance.variables.end(); ++q)
+ {
+ out << nl << q->first << " = `" << q->second << "'";
+ }
+ out << eb;
}
if(!_instance.propertySets.empty())
{
- PropertySetDescriptorDict::const_iterator q;
- for(q = _instance.propertySets.begin(); q != _instance.propertySets.end(); ++q)
- {
- out << nl << "properties `" << q->first << "'";
- out << sb;
- if(!q->second.references.empty())
- {
- out << nl << "references = " << toString(q->second.references);
- }
- PropertyDescriptorSeq::const_iterator r;
- for(r = q->second.properties.begin(); r != q->second.properties.end(); ++r)
- {
- out << nl << r->name << " = `" << r->value << "'";
- }
- out << eb;
- }
+ PropertySetDescriptorDict::const_iterator q;
+ for(q = _instance.propertySets.begin(); q != _instance.propertySets.end(); ++q)
+ {
+ out << nl << "properties `" << q->first << "'";
+ out << sb;
+ if(!q->second.references.empty())
+ {
+ out << nl << "references = " << toString(q->second.references);
+ }
+ PropertyDescriptorSeq::const_iterator r;
+ for(r = q->second.properties.begin(); r != q->second.properties.end(); ++r)
+ {
+ out << nl << r->name << " = `" << r->value << "'";
+ }
+ out << eb;
+ }
}
if(_serverInstances.empty() && _servers.empty())
{
- return;
+ return;
}
out << nl << "servers";
@@ -2389,11 +2389,11 @@ NodeHelper::print(Output& out) const
ServerInstanceHelperDict::const_iterator p;
for(p = _serverInstances.begin(); p != _serverInstances.end(); ++p)
{
- out << nl << p->first;
+ out << nl << p->first;
}
for(p = _servers.begin(); p != _servers.end(); ++p)
{
- out << nl << p->first;
+ out << nl << p->first;
}
out << eb;
out << eb;
@@ -2428,7 +2428,7 @@ NodeHelper::printDiff(Output& out, const NodeHelper& helper) const
_def.loadFactor == helper._def.loadFactor &&
_def.description == helper._def.description)
{
- return;
+ return;
}
//
@@ -2440,116 +2440,116 @@ NodeHelper::printDiff(Output& out, const NodeHelper& helper) const
if(_def.loadFactor != helper._def.loadFactor)
{
- out << nl << "load factor udpated";
+ out << nl << "load factor udpated";
}
if(_def.description != helper._def.description)
{
- out << nl << "description udpated";
+ out << nl << "description udpated";
}
if(!updatedPs.empty() || !removedPs.empty())
{
- out << nl << "property sets udpated";
+ out << nl << "property sets udpated";
}
if(!variables.empty() || !removeVariables.empty())
{
- out << nl << "variables udpated";
+ out << nl << "variables udpated";
}
if(!updated.empty() || !removed.empty())
{
- out << nl << "servers";
- out << sb;
- ServerInstanceHelperDict::const_iterator p;
- for(p = updated.begin(); p != updated.end(); ++p)
- {
- if(helper._serverInstances.find(p->first) == helper._serverInstances.end() &&
- helper._servers.find(p->first) == helper._servers.end())
- {
- out << nl << "server `" << p->first << "' added";
- }
- }
- for(p = updated.begin(); p != updated.end(); ++p)
- {
- if(helper._serverInstances.find(p->first) != helper._serverInstances.end() ||
- helper._servers.find(p->first) != helper._servers.end())
- {
- out << nl << "server `" << p->first << "' updated";
- }
- }
- for(Ice::StringSeq::const_iterator q = removed.begin(); q != removed.end(); ++q)
- {
- out << nl << "server `" << *q << "' removed";
- }
- out << eb;
+ out << nl << "servers";
+ out << sb;
+ ServerInstanceHelperDict::const_iterator p;
+ for(p = updated.begin(); p != updated.end(); ++p)
+ {
+ if(helper._serverInstances.find(p->first) == helper._serverInstances.end() &&
+ helper._servers.find(p->first) == helper._servers.end())
+ {
+ out << nl << "server `" << p->first << "' added";
+ }
+ }
+ for(p = updated.begin(); p != updated.end(); ++p)
+ {
+ if(helper._serverInstances.find(p->first) != helper._serverInstances.end() ||
+ helper._servers.find(p->first) != helper._servers.end())
+ {
+ out << nl << "server `" << p->first << "' updated";
+ }
+ }
+ for(Ice::StringSeq::const_iterator q = removed.begin(); q != removed.end(); ++q)
+ {
+ out << nl << "server `" << *q << "' removed";
+ }
+ out << eb;
}
out << eb;
}
ApplicationHelper::ApplicationHelper(const Ice::CommunicatorPtr& communicator,
- const ApplicationDescriptor& desc,
- bool enableWarning,
- bool instantiate) :
+ const ApplicationDescriptor& desc,
+ bool enableWarning,
+ bool instantiate) :
_communicator(communicator),
_def(desc)
{
if(_def.name.empty())
{
- throw DeploymentException("invalid application: empty name");
+ throw DeploymentException("invalid application: empty name");
}
Resolver resolve(_def, communicator, enableWarning);
if(instantiate)
{
- //
- // Instantiate the application definition.
- //
- _instance.name = _def.name;
- _instance.variables = _def.variables;
- _instance.serverTemplates = _def.serverTemplates;
- _instance.serviceTemplates = _def.serviceTemplates;
- _instance.description = resolve(_def.description, "description");
- _instance.distrib = resolve(_def.distrib);
- _instance.propertySets = resolve(_def.propertySets);
-
- for(ReplicaGroupDescriptorSeq::iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r)
- {
- ReplicaGroupDescriptor desc;
- desc.id = resolve.asId(r->id, "replica group id", false);
- desc.description = resolve(r->description, "replica group description");
- desc.objects = resolve(r->objects, "replica group well-known");
- if(!r->loadBalancing)
- {
- resolve.exception("replica group load balancing is not set");
- }
- desc.loadBalancing = LoadBalancingPolicyPtr::dynamicCast(r->loadBalancing->ice_clone());
- desc.loadBalancing->nReplicas =
- resolve.asInt(r->loadBalancing->nReplicas, "replica group number of replicas");
- if(desc.loadBalancing->nReplicas.empty())
- {
- resolve.exception("invalid replica group load balancing number of replicas value: empty value");
- }
- else if(desc.loadBalancing->nReplicas[0] == '-')
- {
- resolve.exception("invalid replica group load balancing number of replicas value: inferior to 0");
- }
- AdaptiveLoadBalancingPolicyPtr al = AdaptiveLoadBalancingPolicyPtr::dynamicCast(desc.loadBalancing);
- if(al)
- {
- al->loadSample = resolve(al->loadSample, "replica group load sample");
- if(al->loadSample != "" && al->loadSample != "1" && al->loadSample != "5" && al->loadSample != "15")
- {
- resolve.exception("invalid load sample value (allowed values are 1, 5 or 15)");
- }
- }
- _instance.replicaGroups.push_back(desc);
- }
-
- //
- // Set the named property sets on the resolver. We use the
- // instantiated named property sets here -- named property sets
- // must be fully definied at the application level.
- //
- resolve.addPropertySets(_instance.propertySets);
+ //
+ // Instantiate the application definition.
+ //
+ _instance.name = _def.name;
+ _instance.variables = _def.variables;
+ _instance.serverTemplates = _def.serverTemplates;
+ _instance.serviceTemplates = _def.serviceTemplates;
+ _instance.description = resolve(_def.description, "description");
+ _instance.distrib = resolve(_def.distrib);
+ _instance.propertySets = resolve(_def.propertySets);
+
+ for(ReplicaGroupDescriptorSeq::iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r)
+ {
+ ReplicaGroupDescriptor desc;
+ desc.id = resolve.asId(r->id, "replica group id", false);
+ desc.description = resolve(r->description, "replica group description");
+ desc.objects = resolve(r->objects, "replica group well-known");
+ if(!r->loadBalancing)
+ {
+ resolve.exception("replica group load balancing is not set");
+ }
+ desc.loadBalancing = LoadBalancingPolicyPtr::dynamicCast(r->loadBalancing->ice_clone());
+ desc.loadBalancing->nReplicas =
+ resolve.asInt(r->loadBalancing->nReplicas, "replica group number of replicas");
+ if(desc.loadBalancing->nReplicas.empty())
+ {
+ resolve.exception("invalid replica group load balancing number of replicas value: empty value");
+ }
+ else if(desc.loadBalancing->nReplicas[0] == '-')
+ {
+ resolve.exception("invalid replica group load balancing number of replicas value: inferior to 0");
+ }
+ AdaptiveLoadBalancingPolicyPtr al = AdaptiveLoadBalancingPolicyPtr::dynamicCast(desc.loadBalancing);
+ if(al)
+ {
+ al->loadSample = resolve(al->loadSample, "replica group load sample");
+ if(al->loadSample != "" && al->loadSample != "1" && al->loadSample != "5" && al->loadSample != "15")
+ {
+ resolve.exception("invalid load sample value (allowed values are 1, 5 or 15)");
+ }
+ }
+ _instance.replicaGroups.push_back(desc);
+ }
+
+ //
+ // Set the named property sets on the resolver. We use the
+ // instantiated named property sets here -- named property sets
+ // must be fully definied at the application level.
+ //
+ resolve.addPropertySets(_instance.propertySets);
}
//
@@ -2558,11 +2558,11 @@ ApplicationHelper::ApplicationHelper(const Ice::CommunicatorPtr& communicator,
NodeHelperDict::const_iterator n;
for(NodeDescriptorDict::const_iterator p = _def.nodes.begin(); p != _def.nodes.end(); ++p)
{
- n = _nodes.insert(make_pair(p->first, NodeHelper(p->first, p->second, resolve, instantiate))).first;
- if(instantiate)
- {
- _instance.nodes.insert(make_pair(n->first, n->second.getInstance()));
- }
+ n = _nodes.insert(make_pair(p->first, NodeHelper(p->first, p->second, resolve, instantiate))).first;
+ if(instantiate)
+ {
+ _instance.nodes.insert(make_pair(n->first, n->second.getInstance()));
+ }
}
//
@@ -2571,52 +2571,52 @@ ApplicationHelper::ApplicationHelper(const Ice::CommunicatorPtr& communicator,
//
if(instantiate)
{
- multiset<string> serverIds;
- multiset<string> adapterIds;
- multiset<Ice::Identity> objectIds;
- for(n = _nodes.begin(); n != _nodes.end(); ++n)
- {
- n->second.getIds(serverIds, adapterIds, objectIds);
- }
-
- for(ReplicaGroupDescriptorSeq::iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r)
- {
- if(r->id.empty())
- {
- throw DeploymentException("replica group id is empty");
- }
- if(adapterIds.find(r->id) != adapterIds.end())
- {
- throw DeploymentException("duplicate replica group `" + r->id + "'");
- }
- adapterIds.insert(r->id);
- for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
- {
- objectIds.insert(o->id);
- }
- }
-
- for(multiset<string>::const_iterator s = serverIds.begin(); s != serverIds.end(); ++s)
- {
- if(serverIds.count(*s) > 1)
- {
- resolve.exception("duplicate server `" + *s + "'");
- }
- }
- for(multiset<string>::const_iterator a = adapterIds.begin(); a != adapterIds.end(); ++a)
- {
- if(adapterIds.count(*a) > 1)
- {
- resolve.exception("duplicate adapter `" + *a + "'");
- }
- }
- for(multiset<Ice::Identity>::const_iterator o = objectIds.begin(); o != objectIds.end(); ++o)
- {
- if(objectIds.count(*o) > 1)
- {
- resolve.exception("duplicate object `" + _communicator->identityToString(*o) + "'");
- }
- }
+ multiset<string> serverIds;
+ multiset<string> adapterIds;
+ multiset<Ice::Identity> objectIds;
+ for(n = _nodes.begin(); n != _nodes.end(); ++n)
+ {
+ n->second.getIds(serverIds, adapterIds, objectIds);
+ }
+
+ for(ReplicaGroupDescriptorSeq::iterator r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r)
+ {
+ if(r->id.empty())
+ {
+ throw DeploymentException("replica group id is empty");
+ }
+ if(adapterIds.find(r->id) != adapterIds.end())
+ {
+ throw DeploymentException("duplicate replica group `" + r->id + "'");
+ }
+ adapterIds.insert(r->id);
+ for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
+ {
+ objectIds.insert(o->id);
+ }
+ }
+
+ for(multiset<string>::const_iterator s = serverIds.begin(); s != serverIds.end(); ++s)
+ {
+ if(serverIds.count(*s) > 1)
+ {
+ resolve.exception("duplicate server `" + *s + "'");
+ }
+ }
+ for(multiset<string>::const_iterator a = adapterIds.begin(); a != adapterIds.end(); ++a)
+ {
+ if(adapterIds.count(*a) > 1)
+ {
+ resolve.exception("duplicate adapter `" + *a + "'");
+ }
+ }
+ for(multiset<Ice::Identity>::const_iterator o = objectIds.begin(); o != objectIds.end(); ++o)
+ {
+ if(objectIds.count(*o) > 1)
+ {
+ resolve.exception("duplicate object `" + _communicator->identityToString(*o) + "'");
+ }
+ }
}
}
@@ -2629,7 +2629,7 @@ ApplicationHelper::diff(const ApplicationHelper& helper) const
updt.name = _def.name;
if(_def.description != helper._def.description)
{
- updt.description = new BoxedString(_def.description);
+ updt.description = new BoxedString(_def.description);
}
updt.variables = getDictUpdatedElts(helper._def.variables, _def.variables);
@@ -2640,7 +2640,7 @@ ApplicationHelper::diff(const ApplicationHelper& helper) const
if(_def.distrib != helper._def.distrib)
{
- updt.distrib = new BoxedDistributionDescriptor(_def.distrib);
+ updt.distrib = new BoxedDistributionDescriptor(_def.distrib);
}
GetReplicaGroupId rk;
@@ -2657,23 +2657,23 @@ ApplicationHelper::diff(const ApplicationHelper& helper) const
NodeHelperDict updated = getDictUpdatedElts(helper._nodes, _nodes);
for(NodeHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
{
- NodeHelperDict::const_iterator q = helper._nodes.find(p->first);
- if(q == helper._nodes.end())
- {
- NodeUpdateDescriptor nodeUpdate;
- const NodeDescriptor& node = p->second.getDefinition();
- nodeUpdate.name = p->first;
- nodeUpdate.variables = node.variables;
- nodeUpdate.servers = node.servers;
- nodeUpdate.serverInstances = node.serverInstances;
- nodeUpdate.loadFactor = new BoxedString(node.loadFactor);
- nodeUpdate.description = new BoxedString(node.description);
- updt.nodes.push_back(nodeUpdate);
- }
- else
- {
- updt.nodes.push_back(p->second.diff(q->second));
- }
+ NodeHelperDict::const_iterator q = helper._nodes.find(p->first);
+ if(q == helper._nodes.end())
+ {
+ NodeUpdateDescriptor nodeUpdate;
+ const NodeDescriptor& node = p->second.getDefinition();
+ nodeUpdate.name = p->first;
+ nodeUpdate.variables = node.variables;
+ nodeUpdate.servers = node.servers;
+ nodeUpdate.serverInstances = node.serverInstances;
+ nodeUpdate.loadFactor = new BoxedString(node.loadFactor);
+ nodeUpdate.description = new BoxedString(node.description);
+ updt.nodes.push_back(nodeUpdate);
+ }
+ else
+ {
+ updt.nodes.push_back(p->second.diff(q->second));
+ }
}
updt.removeNodes = getDictRemovedElts(helper._nodes, _nodes);
@@ -2698,50 +2698,50 @@ ApplicationHelper::update(const ApplicationUpdateDescriptor& updt) const
Resolver resolve(def, _communicator, false); // A resolver based on the *updated* application descriptor.
for(NodeUpdateDescriptorSeq::const_iterator p = updt.nodes.begin(); p != updt.nodes.end(); ++p)
{
- NodeHelperDict::const_iterator q = _nodes.find(p->name);
- if(q != _nodes.end()) // Updated node
- {
- //
- // COMPILERBUG: AIX xlC (Visual Age 6, 64bit builds)
- // requires the `desc' temporary here. We can't do the
- // update call in the make_pair call directly (this
- // results in a SEGFAULT at runtime).
- //
- NodeDescriptor desc = q->second.update(*p, resolve);
- def.nodes.insert(make_pair(p->name, desc));
- }
- else // New node
- {
- NodeDescriptor desc;
- desc.variables = p->variables;
- if(!p->removeVariables.empty())
- {
- resolve.exception("can't remove variables for node `" + p->name + "': node doesn't exist");
- }
- desc.propertySets = p->propertySets;
- if(!p->removePropertySets.empty())
- {
- resolve.exception("can't remove property sets for node `" + p->name + "': node doesn't exist");
- }
- desc.servers = p->servers;
- desc.serverInstances = p->serverInstances;
- if(!p->removeServers.empty())
- {
- resolve.exception("can't remove servers for node `" + p->name + "': node doesn't exist");
- }
- desc.loadFactor = p->loadFactor ? p->loadFactor->value : string("");
- desc.description = p->description ? p->description->value : string("");
- def.nodes.insert(make_pair(p->name, desc));
- }
+ NodeHelperDict::const_iterator q = _nodes.find(p->name);
+ if(q != _nodes.end()) // Updated node
+ {
+ //
+ // COMPILERBUG: AIX xlC (Visual Age 6, 64bit builds)
+ // requires the `desc' temporary here. We can't do the
+ // update call in the make_pair call directly (this
+ // results in a SEGFAULT at runtime).
+ //
+ NodeDescriptor desc = q->second.update(*p, resolve);
+ def.nodes.insert(make_pair(p->name, desc));
+ }
+ else // New node
+ {
+ NodeDescriptor desc;
+ desc.variables = p->variables;
+ if(!p->removeVariables.empty())
+ {
+ resolve.exception("can't remove variables for node `" + p->name + "': node doesn't exist");
+ }
+ desc.propertySets = p->propertySets;
+ if(!p->removePropertySets.empty())
+ {
+ resolve.exception("can't remove property sets for node `" + p->name + "': node doesn't exist");
+ }
+ desc.servers = p->servers;
+ desc.serverInstances = p->serverInstances;
+ if(!p->removeServers.empty())
+ {
+ resolve.exception("can't remove servers for node `" + p->name + "': node doesn't exist");
+ }
+ desc.loadFactor = p->loadFactor ? p->loadFactor->value : string("");
+ desc.description = p->description ? p->description->value : string("");
+ def.nodes.insert(make_pair(p->name, desc));
+ }
}
set<string> removedNodes(updt.removeNodes.begin(), updt.removeNodes.end());
for(NodeHelperDict::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n)
{
- if(removedNodes.find(n->first) != removedNodes.end() || def.nodes.find(n->first) != def.nodes.end())
- {
- continue; // Node was removed or updated.
- }
- def.nodes.insert(make_pair(n->first, n->second.getDefinition()));
+ if(removedNodes.find(n->first) != removedNodes.end() || def.nodes.find(n->first) != def.nodes.end())
+ {
+ continue; // Node was removed or updated.
+ }
+ def.nodes.insert(make_pair(n->first, n->second.getDefinition()));
}
return def;
@@ -2754,24 +2754,24 @@ ApplicationHelper::upgrade(ApplicationDescriptor& desc) const
bool upgraded = false;
for(NodeHelperDict::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n)
{
- NodeDescriptor nodeDesc;
- if(n->second.upgrade(nodeDesc))
- {
- desc.nodes[n->first] = nodeDesc;
- upgraded = true;
- }
+ NodeDescriptor nodeDesc;
+ if(n->second.upgrade(nodeDesc))
+ {
+ desc.nodes[n->first] = nodeDesc;
+ upgraded = true;
+ }
}
TemplateDescriptorDict::iterator t;
for(t = desc.serverTemplates.begin(); t != desc.serverTemplates.end(); ++t)
{
- ServerDescriptorPtr desc = ServerDescriptorPtr::dynamicCast(t->second.descriptor);
- upgraded |= createHelper(desc)->upgrade(t->second.descriptor);
+ ServerDescriptorPtr desc = ServerDescriptorPtr::dynamicCast(t->second.descriptor);
+ upgraded |= createHelper(desc)->upgrade(t->second.descriptor);
}
for(t = desc.serviceTemplates.begin(); t != desc.serviceTemplates.end(); ++t)
{
- ServiceDescriptorPtr desc = ServiceDescriptorPtr::dynamicCast(t->second.descriptor);
- upgraded |= ServiceHelper(desc).upgrade(t->second.descriptor);
+ ServiceDescriptorPtr desc = ServiceDescriptorPtr::dynamicCast(t->second.descriptor);
+ upgraded |= ServiceHelper(desc).upgrade(t->second.descriptor);
}
return upgraded;
@@ -2790,13 +2790,13 @@ ApplicationHelper::instantiateServer(const string& node, const ServerInstanceDes
NodeDescriptorDict::iterator q = def.nodes.find(node);
if(q == def.nodes.end())
{
- NodeDescriptor desc;
- desc.serverInstances.push_back(instance);
- def.nodes.insert(make_pair(node, desc));
+ NodeDescriptor desc;
+ desc.serverInstances.push_back(instance);
+ def.nodes.insert(make_pair(node, desc));
}
else
{
- q->second.serverInstances.push_back(instance);
+ q->second.serverInstances.push_back(instance);
}
return def;
}
@@ -2810,16 +2810,16 @@ ApplicationHelper::getIds(set<string>& serverIds, set<string>& adapterIds, set<I
for(NodeHelperDict::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p)
{
- p->second.getIds(sIds, aIds, oIds);
+ p->second.getIds(sIds, aIds, oIds);
}
ReplicaGroupDescriptorSeq::const_iterator r;
for(r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r)
{
- aIds.insert(r->id);
- for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
- {
- oIds.insert(o->id);
- }
+ aIds.insert(r->id);
+ for(ObjectDescriptorSeq::const_iterator o = r->objects.begin(); o != r->objects.end(); ++o)
+ {
+ oIds.insert(o->id);
+ }
}
copy(sIds.begin(), sIds.end(), inserter(serverIds, serverIds.begin()));
@@ -2848,34 +2848,34 @@ ApplicationHelper::getServerInfos(const string& uuid, int revision) const
map<string, ServerInfo> servers;
for(NodeHelperDict::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n)
{
- n->second.getServerInfos(_def.name, uuid, revision, servers);
+ n->second.getServerInfos(_def.name, uuid, revision, servers);
}
return servers;
}
void
ApplicationHelper::getDistributions(DistributionDescriptor& distribution,
- vector<string>& nodes,
- const string& server) const
+ vector<string>& nodes,
+ const string& server) const
{
assert(!_instance.name.empty());
distribution = _instance.distrib;
for(NodeHelperDict::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n)
{
- if(n->second.hasDistributions(server))
- {
- nodes.push_back(n->first);
- if(!server.empty())
- {
- break;
- }
- }
- else if(!_instance.distrib.icepatch.empty() &&
- (server.empty() && n->second.hasServers() || n->second.hasServer(server)))
- {
- nodes.push_back(n->first);
- }
+ if(n->second.hasDistributions(server))
+ {
+ nodes.push_back(n->first);
+ if(!server.empty())
+ {
+ break;
+ }
+ }
+ else if(!_instance.distrib.icepatch.empty() &&
+ (server.empty() && n->second.hasServers() || n->second.hasServer(server)))
+ {
+ nodes.push_back(n->first);
+ }
}
}
@@ -2895,109 +2895,109 @@ ApplicationHelper::print(Output& out, const ApplicationInfo& info) const
if(!_instance.description.empty())
{
- out << nl << "description = `" << _instance.description << "'";
+ out << nl << "description = `" << _instance.description << "'";
}
if(!_instance.variables.empty())
{
- out << nl << "variables";
- out << sb;
- for(StringStringDict::const_iterator p = _instance.variables.begin(); p != _instance.variables.end();
- ++p)
- {
- out << nl << p->first << " = `" << p->second << "'";
- }
- out << eb;
+ out << nl << "variables";
+ out << sb;
+ for(StringStringDict::const_iterator p = _instance.variables.begin(); p != _instance.variables.end();
+ ++p)
+ {
+ out << nl << p->first << " = `" << p->second << "'";
+ }
+ out << eb;
}
if(!_instance.propertySets.empty())
{
- PropertySetDescriptorDict::const_iterator q;
- for(q = _instance.propertySets.begin(); q != _instance.propertySets.end(); ++q)
- {
- out << nl << "properties `" << q->first << "'";
- out << sb;
- if(!q->second.references.empty())
- {
- out << nl << "references = " << toString(q->second.references);
- }
- PropertyDescriptorSeq::const_iterator r;
- for(r = q->second.properties.begin(); r != q->second.properties.end(); ++r)
- {
- out << nl << r->name << " = `" << r->value << "'";
- }
- out << eb;
- }
+ PropertySetDescriptorDict::const_iterator q;
+ for(q = _instance.propertySets.begin(); q != _instance.propertySets.end(); ++q)
+ {
+ out << nl << "properties `" << q->first << "'";
+ out << sb;
+ if(!q->second.references.empty())
+ {
+ out << nl << "references = " << toString(q->second.references);
+ }
+ PropertyDescriptorSeq::const_iterator r;
+ for(r = q->second.properties.begin(); r != q->second.properties.end(); ++r)
+ {
+ out << nl << r->name << " = `" << r->value << "'";
+ }
+ out << eb;
+ }
}
if(!_instance.distrib.icepatch.empty())
{
- out << nl << "distribution";
- out << sb;
- out << nl << "proxy = `" << _instance.distrib.icepatch << "'";
- if(!_instance.distrib.directories.empty())
- {
- out << nl << "directories = `" << toString(_instance.distrib.directories) << "'";
- }
- out << eb;
+ out << nl << "distribution";
+ out << sb;
+ out << nl << "proxy = `" << _instance.distrib.icepatch << "'";
+ if(!_instance.distrib.directories.empty())
+ {
+ out << nl << "directories = `" << toString(_instance.distrib.directories) << "'";
+ }
+ out << eb;
}
if(!_instance.replicaGroups.empty())
{
- out << nl << "replica groups";
- out << sb;
- ReplicaGroupDescriptorSeq::const_iterator p;
- for(p = _instance.replicaGroups.begin(); p != _instance.replicaGroups.end(); ++p)
- {
- out << nl << "id = `" << p->id << "' load balancing = `";
- if(!p->loadBalancing)
- {
- out << "default (return all endpoints)";
- }
- else if(RandomLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing))
- {
- out << "random";
- }
- else if(RoundRobinLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing))
- {
- out << "round-robin";
- }
- else if(AdaptiveLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing))
- {
- out << "adaptive" ;
- }
- else
- {
- out << "<unknown load balancing policy>";
- }
- out << "'";
- }
- out << eb;
+ out << nl << "replica groups";
+ out << sb;
+ ReplicaGroupDescriptorSeq::const_iterator p;
+ for(p = _instance.replicaGroups.begin(); p != _instance.replicaGroups.end(); ++p)
+ {
+ out << nl << "id = `" << p->id << "' load balancing = `";
+ if(!p->loadBalancing)
+ {
+ out << "default (return all endpoints)";
+ }
+ else if(RandomLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing))
+ {
+ out << "random";
+ }
+ else if(RoundRobinLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing))
+ {
+ out << "round-robin";
+ }
+ else if(AdaptiveLoadBalancingPolicyPtr::dynamicCast(p->loadBalancing))
+ {
+ out << "adaptive" ;
+ }
+ else
+ {
+ out << "<unknown load balancing policy>";
+ }
+ out << "'";
+ }
+ out << eb;
}
if(!_instance.serverTemplates.empty())
{
- out << nl << "server templates";
- out << sb;
- TemplateDescriptorDict::const_iterator p;
- for(p = _instance.serverTemplates.begin(); p != _instance.serverTemplates.end(); ++p)
- {
- out << nl << p->first;
- }
- out << eb;
+ out << nl << "server templates";
+ out << sb;
+ TemplateDescriptorDict::const_iterator p;
+ for(p = _instance.serverTemplates.begin(); p != _instance.serverTemplates.end(); ++p)
+ {
+ out << nl << p->first;
+ }
+ out << eb;
}
if(!_instance.serviceTemplates.empty())
{
- out << nl << "service templates";
- out << sb;
- TemplateDescriptorDict::const_iterator p;
- for(p = _instance.serviceTemplates.begin(); p != _instance.serviceTemplates.end(); ++p)
- {
- out << nl << p->first;
- }
- out << eb;
+ out << nl << "service templates";
+ out << sb;
+ TemplateDescriptorDict::const_iterator p;
+ for(p = _instance.serviceTemplates.begin(); p != _instance.serviceTemplates.end(); ++p)
+ {
+ out << nl << p->first;
+ }
+ out << eb;
}
if(!_nodes.empty())
{
- for(NodeHelperDict::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p)
- {
- p->second.print(out);
- }
+ for(NodeHelperDict::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p)
+ {
+ p->second.print(out);
+ }
}
out << eb;
}
@@ -3011,157 +3011,157 @@ ApplicationHelper::printDiff(Output& out, const ApplicationHelper& helper) const
out << sb;
{
- map<string, string> variables = getDictUpdatedElts(helper._def.variables, _def.variables);
- Ice::StringSeq removeVariables = getDictRemovedElts(helper._def.variables, _def.variables);
- if(!variables.empty() || !removeVariables.empty())
- {
- out << nl << "variables udpated";
- }
- }
- {
- if(_def.distrib != helper._def.distrib)
- {
- out << nl << "distribution updated";
- }
- }
- {
- PropertySetDescriptorDict updt = getDictUpdatedElts(helper._def.propertySets, _def.propertySets);
- Ice::StringSeq removed = getDictRemovedElts(helper._def.propertySets, _def.propertySets);
- if(!updt.empty() || !removed.empty())
- {
- out << nl << "property sets udpated";
- }
- }
- {
- GetReplicaGroupId rk;
- ReplicaGroupEq req;
- ReplicaGroupDescriptorSeq updated =
- getSeqUpdatedEltsWithEq(helper._def.replicaGroups, _def.replicaGroups, rk, req);
- Ice::StringSeq removed = getSeqRemovedElts(helper._def.replicaGroups, _def.replicaGroups, rk);
- if(!updated.empty() || !removed.empty())
- {
- out << nl << "replica groups";
- out << sb;
- ReplicaGroupDescriptorSeq::iterator p = updated.begin();
- while(p != updated.end())
- {
- ReplicaGroupDescriptorSeq::const_iterator r;
- for(r = helper._def.replicaGroups.begin(); r != helper._def.replicaGroups.end();
- ++r)
- {
- if(p->id == r->id)
- {
- out << nl << "replica group `" << r->id << "' updated";
- p = updated.erase(p);
- break;
- }
- }
- if(r == helper._def.replicaGroups.end())
- {
- ++p;
- }
- }
- for(p = updated.begin(); p != updated.end(); ++p)
- {
- out << nl << "replica group `" << p->id << "' added";
- }
- for(Ice::StringSeq::const_iterator q = removed.begin(); q != removed.end(); ++q)
- {
- out << nl << "replica group `" << *q << "' removed";
- }
- out << eb;
- }
- }
-
- {
- TemplateDescriptorEqual eq;
- TemplateDescriptorDict updated;
- updated = getDictUpdatedEltsWithEq(helper._def.serverTemplates, _def.serverTemplates, eq);
- Ice::StringSeq removed = getDictRemovedElts(helper._def.serverTemplates, _def.serverTemplates);
- if(!updated.empty() || !removed.empty())
- {
- out << nl << "server templates";
- out << sb;
- for(TemplateDescriptorDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
- {
- if(helper._def.serverTemplates.find(p->first) == helper._def.serverTemplates.end())
- {
- out << nl << "server template `" << p->first << "' added";
- }
- }
- for(TemplateDescriptorDict::const_iterator q = updated.begin(); q != updated.end(); ++q)
- {
- if(helper._def.serverTemplates.find(q->first) != helper._def.serverTemplates.end())
- {
- out << nl << "server template `" << q->first << "' updated";
- }
- }
- for(Ice::StringSeq::const_iterator r = removed.begin(); r != removed.end(); ++r)
- {
- out << nl << "server template `" << *r << "' removed";
- }
- out << eb;
- }
- }
- {
- TemplateDescriptorEqual eq;
- TemplateDescriptorDict updated;
- updated = getDictUpdatedEltsWithEq(helper._def.serviceTemplates, _def.serviceTemplates, eq);
- Ice::StringSeq removed = getDictRemovedElts(helper._def.serviceTemplates, _def.serviceTemplates);
- if(!updated.empty() || !removed.empty())
- {
- out << nl << "service templates";
- out << sb;
- for(TemplateDescriptorDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
- {
- if(helper._def.serviceTemplates.find(p->first) == helper._def.serviceTemplates.end())
- {
- out << nl << "service template `" << p->first << "' added";
- }
- }
- for(TemplateDescriptorDict::const_iterator q = updated.begin(); q != updated.end(); ++q)
- {
- if(helper._def.serviceTemplates.find(q->first) != helper._def.serviceTemplates.end())
- {
- out << nl << "service template `" << q->first << "' updated";
- }
- }
- for(Ice::StringSeq::const_iterator r = removed.begin(); r != removed.end(); ++r)
- {
- out << nl << "service template `" << *r << "' removed";
- }
- out << eb;
- }
- }
- {
- NodeHelperDict updated = getDictUpdatedElts(helper._nodes, _nodes);
- Ice::StringSeq removed = getDictRemovedElts(helper._nodes, _nodes);
- if(!updated.empty() || !removed.empty())
- {
- out << nl << "nodes";
- out << sb;
- for(NodeHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
- {
- NodeHelperDict::const_iterator q = helper._nodes.find(p->first);
- if(q == helper._nodes.end())
- {
- p->second.print(out);
- }
- }
- for(NodeHelperDict::const_iterator r = updated.begin(); r != updated.end(); ++r)
- {
- NodeHelperDict::const_iterator q = helper._nodes.find(r->first);
- if(q != helper._nodes.end())
- {
- r->second.printDiff(out, q->second);
- }
- }
- for(Ice::StringSeq::const_iterator s = removed.begin(); s != removed.end(); ++s)
- {
- out << nl << "node `" << *s << "' removed";
- }
- out << eb;
- }
+ map<string, string> variables = getDictUpdatedElts(helper._def.variables, _def.variables);
+ Ice::StringSeq removeVariables = getDictRemovedElts(helper._def.variables, _def.variables);
+ if(!variables.empty() || !removeVariables.empty())
+ {
+ out << nl << "variables udpated";
+ }
+ }
+ {
+ if(_def.distrib != helper._def.distrib)
+ {
+ out << nl << "distribution updated";
+ }
+ }
+ {
+ PropertySetDescriptorDict updt = getDictUpdatedElts(helper._def.propertySets, _def.propertySets);
+ Ice::StringSeq removed = getDictRemovedElts(helper._def.propertySets, _def.propertySets);
+ if(!updt.empty() || !removed.empty())
+ {
+ out << nl << "property sets udpated";
+ }
+ }
+ {
+ GetReplicaGroupId rk;
+ ReplicaGroupEq req;
+ ReplicaGroupDescriptorSeq updated =
+ getSeqUpdatedEltsWithEq(helper._def.replicaGroups, _def.replicaGroups, rk, req);
+ Ice::StringSeq removed = getSeqRemovedElts(helper._def.replicaGroups, _def.replicaGroups, rk);
+ if(!updated.empty() || !removed.empty())
+ {
+ out << nl << "replica groups";
+ out << sb;
+ ReplicaGroupDescriptorSeq::iterator p = updated.begin();
+ while(p != updated.end())
+ {
+ ReplicaGroupDescriptorSeq::const_iterator r;
+ for(r = helper._def.replicaGroups.begin(); r != helper._def.replicaGroups.end();
+ ++r)
+ {
+ if(p->id == r->id)
+ {
+ out << nl << "replica group `" << r->id << "' updated";
+ p = updated.erase(p);
+ break;
+ }
+ }
+ if(r == helper._def.replicaGroups.end())
+ {
+ ++p;
+ }
+ }
+ for(p = updated.begin(); p != updated.end(); ++p)
+ {
+ out << nl << "replica group `" << p->id << "' added";
+ }
+ for(Ice::StringSeq::const_iterator q = removed.begin(); q != removed.end(); ++q)
+ {
+ out << nl << "replica group `" << *q << "' removed";
+ }
+ out << eb;
+ }
+ }
+
+ {
+ TemplateDescriptorEqual eq;
+ TemplateDescriptorDict updated;
+ updated = getDictUpdatedEltsWithEq(helper._def.serverTemplates, _def.serverTemplates, eq);
+ Ice::StringSeq removed = getDictRemovedElts(helper._def.serverTemplates, _def.serverTemplates);
+ if(!updated.empty() || !removed.empty())
+ {
+ out << nl << "server templates";
+ out << sb;
+ for(TemplateDescriptorDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
+ {
+ if(helper._def.serverTemplates.find(p->first) == helper._def.serverTemplates.end())
+ {
+ out << nl << "server template `" << p->first << "' added";
+ }
+ }
+ for(TemplateDescriptorDict::const_iterator q = updated.begin(); q != updated.end(); ++q)
+ {
+ if(helper._def.serverTemplates.find(q->first) != helper._def.serverTemplates.end())
+ {
+ out << nl << "server template `" << q->first << "' updated";
+ }
+ }
+ for(Ice::StringSeq::const_iterator r = removed.begin(); r != removed.end(); ++r)
+ {
+ out << nl << "server template `" << *r << "' removed";
+ }
+ out << eb;
+ }
+ }
+ {
+ TemplateDescriptorEqual eq;
+ TemplateDescriptorDict updated;
+ updated = getDictUpdatedEltsWithEq(helper._def.serviceTemplates, _def.serviceTemplates, eq);
+ Ice::StringSeq removed = getDictRemovedElts(helper._def.serviceTemplates, _def.serviceTemplates);
+ if(!updated.empty() || !removed.empty())
+ {
+ out << nl << "service templates";
+ out << sb;
+ for(TemplateDescriptorDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
+ {
+ if(helper._def.serviceTemplates.find(p->first) == helper._def.serviceTemplates.end())
+ {
+ out << nl << "service template `" << p->first << "' added";
+ }
+ }
+ for(TemplateDescriptorDict::const_iterator q = updated.begin(); q != updated.end(); ++q)
+ {
+ if(helper._def.serviceTemplates.find(q->first) != helper._def.serviceTemplates.end())
+ {
+ out << nl << "service template `" << q->first << "' updated";
+ }
+ }
+ for(Ice::StringSeq::const_iterator r = removed.begin(); r != removed.end(); ++r)
+ {
+ out << nl << "service template `" << *r << "' removed";
+ }
+ out << eb;
+ }
+ }
+ {
+ NodeHelperDict updated = getDictUpdatedElts(helper._nodes, _nodes);
+ Ice::StringSeq removed = getDictRemovedElts(helper._nodes, _nodes);
+ if(!updated.empty() || !removed.empty())
+ {
+ out << nl << "nodes";
+ out << sb;
+ for(NodeHelperDict::const_iterator p = updated.begin(); p != updated.end(); ++p)
+ {
+ NodeHelperDict::const_iterator q = helper._nodes.find(p->first);
+ if(q == helper._nodes.end())
+ {
+ p->second.print(out);
+ }
+ }
+ for(NodeHelperDict::const_iterator r = updated.begin(); r != updated.end(); ++r)
+ {
+ NodeHelperDict::const_iterator q = helper._nodes.find(r->first);
+ if(q != helper._nodes.end())
+ {
+ r->second.printDiff(out, q->second);
+ }
+ }
+ for(Ice::StringSeq::const_iterator s = removed.begin(); s != removed.end(); ++s)
+ {
+ out << nl << "node `" << *s << "' removed";
+ }
+ out << eb;
+ }
}
out << eb;
}
@@ -3173,15 +3173,15 @@ IceGrid::descriptorEqual(const ServerDescriptorPtr& lhs, const ServerDescriptorP
IceBoxDescriptorPtr rhsIceBox = IceBoxDescriptorPtr::dynamicCast(rhs);
if(lhsIceBox && rhsIceBox)
{
- return IceBoxHelper(lhsIceBox) == IceBoxHelper(rhsIceBox);
+ return IceBoxHelper(lhsIceBox) == IceBoxHelper(rhsIceBox);
}
else if(!lhsIceBox && !rhsIceBox)
{
- return ServerHelper(lhs) == ServerHelper(rhs);
+ return ServerHelper(lhs) == ServerHelper(rhs);
}
else
{
- return false;
+ return false;
}
}
@@ -3191,10 +3191,10 @@ IceGrid::createHelper(const ServerDescriptorPtr& desc)
IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(desc);
if(iceBox)
{
- return new IceBoxHelper(iceBox);
+ return new IceBoxHelper(iceBox);
}
else
{
- return new ServerHelper(desc);
+ return new ServerHelper(desc);
}
}
diff --git a/cpp/src/IceGrid/DescriptorHelper.h b/cpp/src/IceGrid/DescriptorHelper.h
index 6ca60f0a170..2564d68d18d 100644
--- a/cpp/src/IceGrid/DescriptorHelper.h
+++ b/cpp/src/IceGrid/DescriptorHelper.h
@@ -120,14 +120,14 @@ public:
ServiceDescriptorPtr getDescriptor() const;
ServiceDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&,
- const PropertySetDescriptorDict&) const;
+ const PropertySetDescriptorDict&) const;
void print(const Ice::CommunicatorPtr&, IceUtil::Output&) const;
protected:
void instantiateImpl(const ServiceDescriptorPtr&, const Resolver&, const PropertyDescriptorSeq&,
- const PropertySetDescriptorDict&) const;
+ const PropertySetDescriptorDict&) const;
private:
@@ -146,7 +146,7 @@ public:
ServerDescriptorPtr getDescriptor() const;
virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&,
- const PropertySetDescriptorDict&) const;
+ const PropertySetDescriptorDict&) const;
void print(const Ice::CommunicatorPtr&, IceUtil::Output&) const;
void print(const Ice::CommunicatorPtr&, IceUtil::Output&, const ServerInfo&) const;
@@ -167,10 +167,10 @@ class InstanceHelper
protected:
std::map<std::string, std::string> instantiateParams(const Resolver&,
- const std::string&,
- const std::map<std::string, std::string>&,
- const std::vector<std::string>&,
- const std::map<std::string, std::string>&) const;
+ const std::string&,
+ const std::map<std::string, std::string>&,
+ const std::vector<std::string>&,
+ const std::map<std::string, std::string>&) const;
};
@@ -206,7 +206,7 @@ public:
bool operator!=(const IceBoxHelper&) const;
virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&,
- const PropertySetDescriptorDict&) const;
+ const PropertySetDescriptorDict&) const;
virtual void getIds(std::multiset<std::string>&, std::multiset<Ice::Identity>&) const;
@@ -218,7 +218,7 @@ public:
protected:
void instantiateImpl(const IceBoxDescriptorPtr&, const Resolver&, const PropertyDescriptorSeq&,
- const PropertySetDescriptorDict&) const;
+ const PropertySetDescriptorDict&) const;
private:
diff --git a/cpp/src/IceGrid/DescriptorParser.cpp b/cpp/src/IceGrid/DescriptorParser.cpp
index 4fd68f57a7f..fac00758c70 100644
--- a/cpp/src/IceGrid/DescriptorParser.cpp
+++ b/cpp/src/IceGrid/DescriptorParser.cpp
@@ -114,366 +114,366 @@ DescriptorHandler::startElement(const string& name, const IceXML::Attributes& at
try
{
- if(name == "icegrid")
- {
- if(!_isTopLevel)
- {
- error("element <icegrid> is a top level element");
- }
- _isTopLevel = false;
- }
- else if(_isTopLevel)
- {
- error("only the <icegrid> element is allowed at the top-level");
- }
- else if(name == "target")
- {
- if(!_isCurrentTargetDeployable)
- {
- ++_targetCounter;
- }
- else
- {
- _isCurrentTargetDeployable = isTargetDeployable(attributes("name"));
- _targetCounter = 1;
- return;
- }
- }
- else if(!isCurrentTargetDeployable())
- {
- //
- // We don't bother to parse the elements if the elements are enclosed in a target element
- // which won't be deployed.
- //
- attributes.asMap();
- return;
- }
- else if(name == "include")
- {
- string targets = attributes("targets", "");
- string file = attributes("file");
- if(file[0] != '/')
- {
- string::size_type end = _filename.find_last_of('/');
- if(end != string::npos)
- {
- file = _filename.substr(0, end) + "/" + file;
- }
- }
-
- string oldFileName = _filename;
- vector<string> oldTargets = _targets;
- _isTopLevel = true;
- _filename = file;
- _targets = getTargets(targets);
-
- IceXML::Parser::parse(file, *this);
-
- _filename = oldFileName;
- _targets = oldTargets;
- }
- else if(name == "application")
- {
- if(_currentApplication.get())
- {
- error("only one <application> element is allowed");
- }
-
- bool importTemplates = attributes.asBool("import-default-templates", false);
-
- //
- // TODO: is ignoring importTemplates the desired behavior when _admin == 0?
- //
- if(importTemplates && _admin != 0)
- {
- try
- {
- ApplicationDescriptor application = _admin->getDefaultApplicationDescriptor();
- _currentApplication.reset(new ApplicationDescriptorBuilder(_communicator, application,
- attributes, _overrides));
- }
- catch(const DeploymentException& ex)
- {
- throw ex.reason;
- }
- }
- else
- {
- _currentApplication.reset(new ApplicationDescriptorBuilder(_communicator, attributes, _overrides));
- }
- }
- else if(name == "node")
- {
- if(!_currentApplication.get())
- {
- error("the <node> element can only be a child of an <application> element");
- }
- _currentNode.reset(_currentApplication->createNode(attributes));
- }
- else if(name == "server-instance")
- {
- if(!_currentNode.get() || _currentServer.get())
- {
- error("the <server-instance> element can only be a child of a <node> element");
- }
- _currentServerInstance.reset(_currentNode->createServerInstance(attributes));
- }
- else if(name == "server")
- {
- if(!_currentNode.get() && !_currentTemplate.get() || _currentServer.get())
- {
- error("the <server> element can only be a child of a <node> or <server-template> element");
- }
- if(_currentNode.get())
- {
- _currentServer.reset(_currentNode->createServer(attributes));
- }
- else
- {
- _currentServer.reset(_currentTemplate->createServer(attributes));
- }
- _currentCommunicator = _currentServer.get();
- }
- else if(name == "icebox")
- {
- if(!_currentNode.get() && !_currentTemplate.get() || _currentServer.get())
- {
- error("the <icebox> element can only be a child of a <node> or <server-template> element");
- }
- if(_currentNode.get())
- {
- _currentServer.reset(_currentNode->createIceBox(attributes));
- }
- else
- {
- _currentServer.reset(_currentTemplate->createIceBox(attributes));
- }
- _currentCommunicator = _currentServer.get();
- }
- else if(name == "server-template")
- {
- if(!_currentApplication.get() || _currentTemplate.get() || _currentNode.get())
- {
- error("the <server-template> element can only be a child of an <application> element");
- }
- _currentTemplate.reset(_currentApplication->createServerTemplate(attributes));
- }
- else if(name == "service-instance")
- {
- if(!_currentServer.get())
- {
- error("the <service-instance> element can only be a child of an <icebox> element");
- }
- _currentServiceInstance.reset(_currentServer->createServiceInstance(attributes));
- }
- else if(name == "service")
- {
- if(!_currentServer.get() && !_currentTemplate.get() || _currentService.get())
- {
- error("the <service> element can only be a child of an <icebox> or <service-template> element");
- }
-
- if(_currentServer.get())
- {
- _currentService.reset(_currentServer->createService(attributes));
- }
- else
- {
- _currentService.reset(_currentTemplate->createService(attributes));
- }
- _currentCommunicator = _currentService.get();
- }
- else if(name == "service-template")
- {
- if(!_currentApplication.get() || _currentNode.get() || _currentTemplate.get())
- {
- error("the <service-template> element can only be a child of an <application> element");
- }
-
- _currentTemplate.reset(_currentApplication->createServiceTemplate(attributes));
- }
- else if(name == "replica-group")
- {
- if(!_currentApplication.get())
- {
- error("the <replica-group> element can only be a child of an <application> element");
- }
- _currentApplication->addReplicaGroup(attributes);
- _inReplicaGroup = true;
- }
- else if(name == "load-balancing")
- {
- if(!_inReplicaGroup)
- {
- error("the <load-balancing> element can only be a child of a <replica-group> element");
- }
- _currentApplication->setLoadBalancing(attributes);
- }
- else if(name == "variable")
- {
- if(_currentNode.get())
- {
- _currentNode->addVariable(attributes);
- }
- else if(_currentApplication.get())
- {
- _currentApplication->addVariable(attributes);
- }
- else
- {
- error("the <variable> element can only be a child of an <application> or <node> element");
- }
- }
- else if(name == "parameter")
- {
- if(!_currentTemplate.get())
- {
- error("the <parameter> element can only be a child of a <template> element");
- }
- _currentTemplate->addParameter(attributes);
- }
- else if(name == "properties")
- {
- if(_currentPropertySet.get())
- {
- _currentPropertySet->addPropertySet(attributes);
- }
- else if(_currentServiceInstance.get())
- {
- _currentPropertySet.reset(_currentServiceInstance->createPropertySet());
- }
- else if(_currentServerInstance.get())
- {
- _currentPropertySet.reset(_currentServerInstance->createPropertySet(attributes));
- }
- else if(_currentCommunicator)
- {
- _currentPropertySet.reset(_currentCommunicator->createPropertySet());
- }
- else if(_currentNode.get())
- {
- _currentPropertySet.reset(_currentNode->createPropertySet(attributes));
- }
- else if(_currentApplication.get() && !_currentTemplate.get())
- {
- _currentPropertySet.reset(_currentApplication->createPropertySet(attributes));
- }
- else
- {
- error("the <properties> element is not allowed here");
- }
- }
- else if(name == "property")
- {
- if(_currentPropertySet.get())
- {
- _currentPropertySet->addProperty(attributes);
- }
- else if(_currentCommunicator)
- {
- _currentCommunicator->addProperty(attributes);
- }
- else
- {
- error("the <property> element can only be a child of a <properties>, <icebox>, <server> or <service> "
- "element");
- }
- }
- else if(name == "adapter")
- {
- if(!_currentCommunicator)
- {
- error("the <adapter> element can only be a child of a <server> or <service> element");
- }
- _currentCommunicator->addAdapter(attributes);
- _inAdapter = true;
- }
- else if(name == "object")
- {
- if(!_inAdapter && !_inReplicaGroup)
- {
- error("the <object> element can only be a child of an <adapter> or <replica-group> element");
- }
- if(_inReplicaGroup)
- {
- _currentApplication->addObject(attributes);
- }
- else
- {
- _currentCommunicator->addObject(attributes);
- }
- }
- else if(name == "allocatable")
- {
- if(!_inAdapter)
- {
- error("the <allocatable> element can only be a child of an <adapter> element");
- }
- _currentCommunicator->addAllocatable(attributes);
- }
- else if(name == "distrib")
- {
- if(!_currentApplication.get() ||
- (_currentNode.get() || _currentTemplate.get()) && !_currentServer.get() ||
- _currentServer.get() != _currentCommunicator)
- {
- error("the <distrib> element can only be a child of an <application>, <server> or <icebox> element");
- }
- if(!_currentServer.get())
- {
- _currentApplication->addDistribution(attributes);
- }
- else
- {
- _currentServer->addDistribution(attributes);
- }
- _inDistrib = true;
- }
- else if(name == "dbenv")
- {
- if(!_currentCommunicator)
- {
- error("the <dbenv> element can only be a child of a <server> or <service> element");
- }
- _currentCommunicator->addDbEnv(attributes);
- _inDbEnv = true;
- }
- else if(name == "log")
- {
- if(!_currentCommunicator)
- {
- error("the <log> element can only be a child of a <server> or <service> element");
- }
- _currentCommunicator->addLog(attributes);
- }
- else if(name == "dbproperty")
- {
- if(!_inDbEnv)
- {
- error("the <dbproperty> element can only be a child of a <dbenv> element");
- }
- _currentCommunicator->addDbEnvProperty(attributes);
- }
- else if(name == "description" || name == "option" || name == "env" || name == "directory")
- {
- //
- // Nothing to do.
- //
- }
- else
- {
- error("unknown element `" + name + "'");
- }
-
- attributes.checkUnknownAttributes();
+ if(name == "icegrid")
+ {
+ if(!_isTopLevel)
+ {
+ error("element <icegrid> is a top level element");
+ }
+ _isTopLevel = false;
+ }
+ else if(_isTopLevel)
+ {
+ error("only the <icegrid> element is allowed at the top-level");
+ }
+ else if(name == "target")
+ {
+ if(!_isCurrentTargetDeployable)
+ {
+ ++_targetCounter;
+ }
+ else
+ {
+ _isCurrentTargetDeployable = isTargetDeployable(attributes("name"));
+ _targetCounter = 1;
+ return;
+ }
+ }
+ else if(!isCurrentTargetDeployable())
+ {
+ //
+ // We don't bother to parse the elements if the elements are enclosed in a target element
+ // which won't be deployed.
+ //
+ attributes.asMap();
+ return;
+ }
+ else if(name == "include")
+ {
+ string targets = attributes("targets", "");
+ string file = attributes("file");
+ if(file[0] != '/')
+ {
+ string::size_type end = _filename.find_last_of('/');
+ if(end != string::npos)
+ {
+ file = _filename.substr(0, end) + "/" + file;
+ }
+ }
+
+ string oldFileName = _filename;
+ vector<string> oldTargets = _targets;
+ _isTopLevel = true;
+ _filename = file;
+ _targets = getTargets(targets);
+
+ IceXML::Parser::parse(file, *this);
+
+ _filename = oldFileName;
+ _targets = oldTargets;
+ }
+ else if(name == "application")
+ {
+ if(_currentApplication.get())
+ {
+ error("only one <application> element is allowed");
+ }
+
+ bool importTemplates = attributes.asBool("import-default-templates", false);
+
+ //
+ // TODO: is ignoring importTemplates the desired behavior when _admin == 0?
+ //
+ if(importTemplates && _admin != 0)
+ {
+ try
+ {
+ ApplicationDescriptor application = _admin->getDefaultApplicationDescriptor();
+ _currentApplication.reset(new ApplicationDescriptorBuilder(_communicator, application,
+ attributes, _overrides));
+ }
+ catch(const DeploymentException& ex)
+ {
+ throw ex.reason;
+ }
+ }
+ else
+ {
+ _currentApplication.reset(new ApplicationDescriptorBuilder(_communicator, attributes, _overrides));
+ }
+ }
+ else if(name == "node")
+ {
+ if(!_currentApplication.get())
+ {
+ error("the <node> element can only be a child of an <application> element");
+ }
+ _currentNode.reset(_currentApplication->createNode(attributes));
+ }
+ else if(name == "server-instance")
+ {
+ if(!_currentNode.get() || _currentServer.get())
+ {
+ error("the <server-instance> element can only be a child of a <node> element");
+ }
+ _currentServerInstance.reset(_currentNode->createServerInstance(attributes));
+ }
+ else if(name == "server")
+ {
+ if(!_currentNode.get() && !_currentTemplate.get() || _currentServer.get())
+ {
+ error("the <server> element can only be a child of a <node> or <server-template> element");
+ }
+ if(_currentNode.get())
+ {
+ _currentServer.reset(_currentNode->createServer(attributes));
+ }
+ else
+ {
+ _currentServer.reset(_currentTemplate->createServer(attributes));
+ }
+ _currentCommunicator = _currentServer.get();
+ }
+ else if(name == "icebox")
+ {
+ if(!_currentNode.get() && !_currentTemplate.get() || _currentServer.get())
+ {
+ error("the <icebox> element can only be a child of a <node> or <server-template> element");
+ }
+ if(_currentNode.get())
+ {
+ _currentServer.reset(_currentNode->createIceBox(attributes));
+ }
+ else
+ {
+ _currentServer.reset(_currentTemplate->createIceBox(attributes));
+ }
+ _currentCommunicator = _currentServer.get();
+ }
+ else if(name == "server-template")
+ {
+ if(!_currentApplication.get() || _currentTemplate.get() || _currentNode.get())
+ {
+ error("the <server-template> element can only be a child of an <application> element");
+ }
+ _currentTemplate.reset(_currentApplication->createServerTemplate(attributes));
+ }
+ else if(name == "service-instance")
+ {
+ if(!_currentServer.get())
+ {
+ error("the <service-instance> element can only be a child of an <icebox> element");
+ }
+ _currentServiceInstance.reset(_currentServer->createServiceInstance(attributes));
+ }
+ else if(name == "service")
+ {
+ if(!_currentServer.get() && !_currentTemplate.get() || _currentService.get())
+ {
+ error("the <service> element can only be a child of an <icebox> or <service-template> element");
+ }
+
+ if(_currentServer.get())
+ {
+ _currentService.reset(_currentServer->createService(attributes));
+ }
+ else
+ {
+ _currentService.reset(_currentTemplate->createService(attributes));
+ }
+ _currentCommunicator = _currentService.get();
+ }
+ else if(name == "service-template")
+ {
+ if(!_currentApplication.get() || _currentNode.get() || _currentTemplate.get())
+ {
+ error("the <service-template> element can only be a child of an <application> element");
+ }
+
+ _currentTemplate.reset(_currentApplication->createServiceTemplate(attributes));
+ }
+ else if(name == "replica-group")
+ {
+ if(!_currentApplication.get())
+ {
+ error("the <replica-group> element can only be a child of an <application> element");
+ }
+ _currentApplication->addReplicaGroup(attributes);
+ _inReplicaGroup = true;
+ }
+ else if(name == "load-balancing")
+ {
+ if(!_inReplicaGroup)
+ {
+ error("the <load-balancing> element can only be a child of a <replica-group> element");
+ }
+ _currentApplication->setLoadBalancing(attributes);
+ }
+ else if(name == "variable")
+ {
+ if(_currentNode.get())
+ {
+ _currentNode->addVariable(attributes);
+ }
+ else if(_currentApplication.get())
+ {
+ _currentApplication->addVariable(attributes);
+ }
+ else
+ {
+ error("the <variable> element can only be a child of an <application> or <node> element");
+ }
+ }
+ else if(name == "parameter")
+ {
+ if(!_currentTemplate.get())
+ {
+ error("the <parameter> element can only be a child of a <template> element");
+ }
+ _currentTemplate->addParameter(attributes);
+ }
+ else if(name == "properties")
+ {
+ if(_currentPropertySet.get())
+ {
+ _currentPropertySet->addPropertySet(attributes);
+ }
+ else if(_currentServiceInstance.get())
+ {
+ _currentPropertySet.reset(_currentServiceInstance->createPropertySet());
+ }
+ else if(_currentServerInstance.get())
+ {
+ _currentPropertySet.reset(_currentServerInstance->createPropertySet(attributes));
+ }
+ else if(_currentCommunicator)
+ {
+ _currentPropertySet.reset(_currentCommunicator->createPropertySet());
+ }
+ else if(_currentNode.get())
+ {
+ _currentPropertySet.reset(_currentNode->createPropertySet(attributes));
+ }
+ else if(_currentApplication.get() && !_currentTemplate.get())
+ {
+ _currentPropertySet.reset(_currentApplication->createPropertySet(attributes));
+ }
+ else
+ {
+ error("the <properties> element is not allowed here");
+ }
+ }
+ else if(name == "property")
+ {
+ if(_currentPropertySet.get())
+ {
+ _currentPropertySet->addProperty(attributes);
+ }
+ else if(_currentCommunicator)
+ {
+ _currentCommunicator->addProperty(attributes);
+ }
+ else
+ {
+ error("the <property> element can only be a child of a <properties>, <icebox>, <server> or <service> "
+ "element");
+ }
+ }
+ else if(name == "adapter")
+ {
+ if(!_currentCommunicator)
+ {
+ error("the <adapter> element can only be a child of a <server> or <service> element");
+ }
+ _currentCommunicator->addAdapter(attributes);
+ _inAdapter = true;
+ }
+ else if(name == "object")
+ {
+ if(!_inAdapter && !_inReplicaGroup)
+ {
+ error("the <object> element can only be a child of an <adapter> or <replica-group> element");
+ }
+ if(_inReplicaGroup)
+ {
+ _currentApplication->addObject(attributes);
+ }
+ else
+ {
+ _currentCommunicator->addObject(attributes);
+ }
+ }
+ else if(name == "allocatable")
+ {
+ if(!_inAdapter)
+ {
+ error("the <allocatable> element can only be a child of an <adapter> element");
+ }
+ _currentCommunicator->addAllocatable(attributes);
+ }
+ else if(name == "distrib")
+ {
+ if(!_currentApplication.get() ||
+ (_currentNode.get() || _currentTemplate.get()) && !_currentServer.get() ||
+ _currentServer.get() != _currentCommunicator)
+ {
+ error("the <distrib> element can only be a child of an <application>, <server> or <icebox> element");
+ }
+ if(!_currentServer.get())
+ {
+ _currentApplication->addDistribution(attributes);
+ }
+ else
+ {
+ _currentServer->addDistribution(attributes);
+ }
+ _inDistrib = true;
+ }
+ else if(name == "dbenv")
+ {
+ if(!_currentCommunicator)
+ {
+ error("the <dbenv> element can only be a child of a <server> or <service> element");
+ }
+ _currentCommunicator->addDbEnv(attributes);
+ _inDbEnv = true;
+ }
+ else if(name == "log")
+ {
+ if(!_currentCommunicator)
+ {
+ error("the <log> element can only be a child of a <server> or <service> element");
+ }
+ _currentCommunicator->addLog(attributes);
+ }
+ else if(name == "dbproperty")
+ {
+ if(!_inDbEnv)
+ {
+ error("the <dbproperty> element can only be a child of a <dbenv> element");
+ }
+ _currentCommunicator->addDbEnvProperty(attributes);
+ }
+ else if(name == "description" || name == "option" || name == "env" || name == "directory")
+ {
+ //
+ // Nothing to do.
+ //
+ }
+ else
+ {
+ error("unknown element `" + name + "'");
+ }
+
+ attributes.checkUnknownAttributes();
}
catch(const string& reason)
{
- error(reason);
+ error(reason);
}
catch(const char* reason)
{
- error(reason);
+ error(reason);
}
//
@@ -483,7 +483,7 @@ DescriptorHandler::startElement(const string& name, const IceXML::Attributes& at
string value = elementValue();
if(!value.empty() && value.find_first_not_of(" \t\r\n") != string::npos)
{
- error("invalid element value for element `" + _previousElementName + "'");
+ error("invalid element value for element `" + _previousElementName + "'");
}
_previousElementName = name;
}
@@ -496,206 +496,206 @@ DescriptorHandler::endElement(const string& name, int line, int column)
try
{
- if(name == "target")
- {
- if(!_isCurrentTargetDeployable && --_targetCounter == 0)
- {
- _isCurrentTargetDeployable = true;
- _targetCounter = 0;
- }
- return;
- }
- else if(!isCurrentTargetDeployable())
- {
- //
- // We don't bother to parse the elements if the elements are enclosed in a target element
- // which won't be deployed.
- //
- return;
- }
- else if(name == "node")
- {
- _currentApplication->addNode(_currentNode->getName(), _currentNode->getDescriptor());
- _currentNode.reset(0);
- }
- else if(name == "server" || name == "icebox")
- {
- assert(_currentServer.get());
- if(_currentTemplate.get())
- {
- _currentTemplate->setDescriptor(_currentServer->getDescriptor());
- }
- else
- {
- assert(_currentNode.get());
- _currentNode->addServer(_currentServer->getDescriptor());
- }
- _currentServer->finish();
- _currentServer.reset(0);
- _currentCommunicator = 0;
- }
- else if(name == "server-template")
- {
- assert(_currentApplication.get());
- _currentApplication->addServerTemplate(_currentTemplate->getId(), _currentTemplate->getDescriptor());
- _currentTemplate.reset(0);
- }
- else if(name == "service")
- {
- assert(_currentService.get());
- if(_currentServer.get())
- {
- _currentServer->addService(_currentService->getDescriptor());
- }
- else
- {
- _currentTemplate->setDescriptor(_currentService->getDescriptor());
- }
- _currentService->finish();
- _currentService.reset(0);
- _currentCommunicator = _currentServer.get();
- }
- else if(name == "service-template")
- {
- assert(_currentTemplate.get());
- _currentApplication->addServiceTemplate(_currentTemplate->getId(), _currentTemplate->getDescriptor());
- _currentTemplate.reset(0);
- }
- else if(name == "server-instance")
- {
- assert(_currentNode.get() && _currentServerInstance.get());
- _currentNode->addServerInstance(_currentServerInstance->getDescriptor());
- _currentServerInstance.reset(0);
- }
- else if(name == "service-instance")
- {
- assert(_currentServer.get() && _currentServiceInstance.get());
- _currentServer->addServiceInstance(_currentServiceInstance->getDescriptor());
- _currentServiceInstance.reset(0);
- }
- else if(name == "properties")
- {
- assert(_currentPropertySet.get());
- if(_currentPropertySet->finish())
- {
- if(_currentServiceInstance.get())
- {
- _currentServiceInstance->addPropertySet(_currentPropertySet->getDescriptor());
- }
- else if(_currentServerInstance.get())
- {
- _currentServerInstance->addPropertySet(_currentPropertySet->getService(),
- _currentPropertySet->getDescriptor());
- }
- else if(_currentCommunicator)
- {
- _currentCommunicator->addPropertySet(_currentPropertySet->getDescriptor());
- }
- else if(_currentNode.get())
- {
- _currentNode->addPropertySet(_currentPropertySet->getId(),
- _currentPropertySet->getDescriptor());
- }
- else if(_currentApplication.get())
- {
- _currentApplication->addPropertySet(_currentPropertySet->getId(),
- _currentPropertySet->getDescriptor());
- }
- else
- {
- assert(false);
- }
- _currentPropertySet.reset(0);
- }
- }
- else if(name == "description")
- {
- if(_inAdapter)
- {
- _currentCommunicator->setAdapterDescription(elementValue());
- }
- else if(_inReplicaGroup)
- {
- _currentApplication->setReplicaGroupDescription(elementValue());
- }
- else if(_inDbEnv)
- {
- assert(_currentCommunicator);
- _currentCommunicator->setDbEnvDescription(elementValue());
- }
- else if(_currentCommunicator)
- {
- _currentCommunicator->setDescription(elementValue());
- }
- else if(_currentNode.get())
- {
- _currentNode->setDescription(elementValue());
- }
- else if(_currentApplication.get())
- {
- _currentApplication->setDescription(elementValue());
- }
- else
- {
- error("element <description> is not allowed here");
- }
- }
- else if(name == "option")
- {
- if(!_currentServer.get())
- {
- error("element <option> can only be the child of a <server> element");
- }
- _currentServer->addOption(elementValue());
- }
- else if(name == "env")
- {
- if(!_currentServer.get())
- {
- error("element <env> can only be the child of a <server> element");
- }
- _currentServer->addEnv(elementValue());
- }
- else if(name == "directory")
- {
- if(!_inDistrib)
- {
- error("the <directory> element can only be a child of a <distrib> element");
- }
- if(!_currentServer.get())
- {
- _currentApplication->addDistributionDirectory(elementValue());
- }
- else
- {
- _currentServer->addDistributionDirectory(elementValue());
- }
- }
- else if(name == "adapter")
- {
- _inAdapter = false;
- }
- else if(name == "replica-group")
- {
- _currentApplication->finishReplicaGroup();
- _inReplicaGroup = false;
- }
- else if(name == "dbenv")
- {
- _inDbEnv = false;
- }
- else if(name == "distrib")
- {
- _inDistrib = false;
- }
+ if(name == "target")
+ {
+ if(!_isCurrentTargetDeployable && --_targetCounter == 0)
+ {
+ _isCurrentTargetDeployable = true;
+ _targetCounter = 0;
+ }
+ return;
+ }
+ else if(!isCurrentTargetDeployable())
+ {
+ //
+ // We don't bother to parse the elements if the elements are enclosed in a target element
+ // which won't be deployed.
+ //
+ return;
+ }
+ else if(name == "node")
+ {
+ _currentApplication->addNode(_currentNode->getName(), _currentNode->getDescriptor());
+ _currentNode.reset(0);
+ }
+ else if(name == "server" || name == "icebox")
+ {
+ assert(_currentServer.get());
+ if(_currentTemplate.get())
+ {
+ _currentTemplate->setDescriptor(_currentServer->getDescriptor());
+ }
+ else
+ {
+ assert(_currentNode.get());
+ _currentNode->addServer(_currentServer->getDescriptor());
+ }
+ _currentServer->finish();
+ _currentServer.reset(0);
+ _currentCommunicator = 0;
+ }
+ else if(name == "server-template")
+ {
+ assert(_currentApplication.get());
+ _currentApplication->addServerTemplate(_currentTemplate->getId(), _currentTemplate->getDescriptor());
+ _currentTemplate.reset(0);
+ }
+ else if(name == "service")
+ {
+ assert(_currentService.get());
+ if(_currentServer.get())
+ {
+ _currentServer->addService(_currentService->getDescriptor());
+ }
+ else
+ {
+ _currentTemplate->setDescriptor(_currentService->getDescriptor());
+ }
+ _currentService->finish();
+ _currentService.reset(0);
+ _currentCommunicator = _currentServer.get();
+ }
+ else if(name == "service-template")
+ {
+ assert(_currentTemplate.get());
+ _currentApplication->addServiceTemplate(_currentTemplate->getId(), _currentTemplate->getDescriptor());
+ _currentTemplate.reset(0);
+ }
+ else if(name == "server-instance")
+ {
+ assert(_currentNode.get() && _currentServerInstance.get());
+ _currentNode->addServerInstance(_currentServerInstance->getDescriptor());
+ _currentServerInstance.reset(0);
+ }
+ else if(name == "service-instance")
+ {
+ assert(_currentServer.get() && _currentServiceInstance.get());
+ _currentServer->addServiceInstance(_currentServiceInstance->getDescriptor());
+ _currentServiceInstance.reset(0);
+ }
+ else if(name == "properties")
+ {
+ assert(_currentPropertySet.get());
+ if(_currentPropertySet->finish())
+ {
+ if(_currentServiceInstance.get())
+ {
+ _currentServiceInstance->addPropertySet(_currentPropertySet->getDescriptor());
+ }
+ else if(_currentServerInstance.get())
+ {
+ _currentServerInstance->addPropertySet(_currentPropertySet->getService(),
+ _currentPropertySet->getDescriptor());
+ }
+ else if(_currentCommunicator)
+ {
+ _currentCommunicator->addPropertySet(_currentPropertySet->getDescriptor());
+ }
+ else if(_currentNode.get())
+ {
+ _currentNode->addPropertySet(_currentPropertySet->getId(),
+ _currentPropertySet->getDescriptor());
+ }
+ else if(_currentApplication.get())
+ {
+ _currentApplication->addPropertySet(_currentPropertySet->getId(),
+ _currentPropertySet->getDescriptor());
+ }
+ else
+ {
+ assert(false);
+ }
+ _currentPropertySet.reset(0);
+ }
+ }
+ else if(name == "description")
+ {
+ if(_inAdapter)
+ {
+ _currentCommunicator->setAdapterDescription(elementValue());
+ }
+ else if(_inReplicaGroup)
+ {
+ _currentApplication->setReplicaGroupDescription(elementValue());
+ }
+ else if(_inDbEnv)
+ {
+ assert(_currentCommunicator);
+ _currentCommunicator->setDbEnvDescription(elementValue());
+ }
+ else if(_currentCommunicator)
+ {
+ _currentCommunicator->setDescription(elementValue());
+ }
+ else if(_currentNode.get())
+ {
+ _currentNode->setDescription(elementValue());
+ }
+ else if(_currentApplication.get())
+ {
+ _currentApplication->setDescription(elementValue());
+ }
+ else
+ {
+ error("element <description> is not allowed here");
+ }
+ }
+ else if(name == "option")
+ {
+ if(!_currentServer.get())
+ {
+ error("element <option> can only be the child of a <server> element");
+ }
+ _currentServer->addOption(elementValue());
+ }
+ else if(name == "env")
+ {
+ if(!_currentServer.get())
+ {
+ error("element <env> can only be the child of a <server> element");
+ }
+ _currentServer->addEnv(elementValue());
+ }
+ else if(name == "directory")
+ {
+ if(!_inDistrib)
+ {
+ error("the <directory> element can only be a child of a <distrib> element");
+ }
+ if(!_currentServer.get())
+ {
+ _currentApplication->addDistributionDirectory(elementValue());
+ }
+ else
+ {
+ _currentServer->addDistributionDirectory(elementValue());
+ }
+ }
+ else if(name == "adapter")
+ {
+ _inAdapter = false;
+ }
+ else if(name == "replica-group")
+ {
+ _currentApplication->finishReplicaGroup();
+ _inReplicaGroup = false;
+ }
+ else if(name == "dbenv")
+ {
+ _inDbEnv = false;
+ }
+ else if(name == "distrib")
+ {
+ _inDistrib = false;
+ }
}
catch(const string& reason)
{
- error(reason);
+ error(reason);
}
catch(const char* reason)
{
- error(reason);
+ error(reason);
}
//
@@ -705,7 +705,7 @@ DescriptorHandler::endElement(const string& name, int line, int column)
string value = elementValue();
if(!value.empty() && value.find_first_not_of(" \t\r\n") != string::npos)
{
- error("invalid element value for element `" + name + "'");
+ error("invalid element value for element `" + name + "'");
}
}
@@ -714,7 +714,7 @@ DescriptorHandler::characters(const string& chars, int, int)
{
if(isCurrentTargetDeployable())
{
- _data += chars;
+ _data += chars;
}
}
@@ -731,7 +731,7 @@ DescriptorHandler::getApplicationDescriptor() const
{
if(!_currentApplication.get())
{
- error("no application descriptor defined in this file");
+ error("no application descriptor defined in this file");
}
return _currentApplication->getDescriptor();
}
@@ -749,22 +749,22 @@ DescriptorHandler::getTargets(const string& targets) const
if(!targets.empty())
{
- const string delim = " \t\n\r";
-
- string::size_type beg = 0;
- string::size_type end = 0;
- do
- {
- end = targets.find_first_of(delim, end);
- if(end == string::npos)
- {
- end = targets.size();
- }
-
- result.push_back(targets.substr(beg, end - beg));
- beg = ++end;
- }
- while(end < targets.size());
+ const string delim = " \t\n\r";
+
+ string::size_type beg = 0;
+ string::size_type end = 0;
+ do
+ {
+ end = targets.find_first_of(delim, end);
+ if(end == string::npos)
+ {
+ end = targets.size();
+ }
+
+ result.push_back(targets.substr(beg, end - beg));
+ beg = ++end;
+ }
+ while(end < targets.size());
}
copy(_targets.begin(), _targets.end(), back_inserter(result));
@@ -803,19 +803,19 @@ DescriptorHandler::isTargetDeployable(const string& target) const
string fqn;
if(!application.empty())
{
- fqn += (fqn.empty() ? "" : ".") + application;
+ fqn += (fqn.empty() ? "" : ".") + application;
}
if(!node.empty())
{
- fqn += (fqn.empty() ? "" : ".") + node;
+ fqn += (fqn.empty() ? "" : ".") + node;
}
if(!server.empty())
{
- fqn += (fqn.empty() ? "" : ".") + server;
+ fqn += (fqn.empty() ? "" : ".") + server;
}
if(!service.empty())
{
- fqn += (fqn.empty() ? "" : ".") + service;
+ fqn += (fqn.empty() ? "" : ".") + service;
}
//
@@ -823,40 +823,40 @@ DescriptorHandler::isTargetDeployable(const string& target) const
//
for(vector<string>::const_iterator p = _targets.begin(); p != _targets.end(); ++p)
{
- if((*p) == target)
- {
- //
- // A supplied target without any communicator prefix is matching the target.
- //
- return true;
- }
- else
- {
- string communicatorTarget;
- string::size_type end = 0;
- while(end != string::npos)
- {
- //
- // Add the first communicator name from the communicator fully qualified name to the
- // target and see if matches.
- //
- end = fqn.find('.', end);
- if(end == string::npos)
- {
- communicatorTarget = fqn + "." + target;
- }
- else
- {
- communicatorTarget = fqn.substr(0, end) + "." + target;
- ++end;
- }
-
- if((*p) == communicatorTarget)
- {
- return true;
- }
- }
- }
+ if((*p) == target)
+ {
+ //
+ // A supplied target without any communicator prefix is matching the target.
+ //
+ return true;
+ }
+ else
+ {
+ string communicatorTarget;
+ string::size_type end = 0;
+ while(end != string::npos)
+ {
+ //
+ // Add the first communicator name from the communicator fully qualified name to the
+ // target and see if matches.
+ //
+ end = fqn.find('.', end);
+ if(end == string::npos)
+ {
+ communicatorTarget = fqn + "." + target;
+ }
+ else
+ {
+ communicatorTarget = fqn.substr(0, end) + "." + target;
+ ++end;
+ }
+
+ if((*p) == communicatorTarget)
+ {
+ return true;
+ }
+ }
+ }
}
return false;
@@ -864,10 +864,10 @@ DescriptorHandler::isTargetDeployable(const string& target) const
ApplicationDescriptor
DescriptorParser::parseDescriptor(const string& descriptor,
- const Ice::StringSeq& targets,
- const map<string, string>& variables,
- const Ice::CommunicatorPtr& communicator,
- const IceGrid::AdminPrx& admin)
+ const Ice::StringSeq& targets,
+ const map<string, string>& variables,
+ const Ice::CommunicatorPtr& communicator,
+ const IceGrid::AdminPrx& admin)
{
string filename = IcePatch2::simplify(descriptor);
DescriptorHandler handler(filename, communicator);
diff --git a/cpp/src/IceGrid/DescriptorParser.h b/cpp/src/IceGrid/DescriptorParser.h
index c1187f29949..f5a801225e1 100644
--- a/cpp/src/IceGrid/DescriptorParser.h
+++ b/cpp/src/IceGrid/DescriptorParser.h
@@ -18,10 +18,10 @@ class DescriptorParser
public:
static ApplicationDescriptor parseDescriptor(const std::string&,
- const Ice::StringSeq&,
- const std::map<std::string, std::string>&,
- const Ice::CommunicatorPtr&,
- const IceGrid::AdminPrx&);
+ const Ice::StringSeq&,
+ const std::map<std::string, std::string>&,
+ const Ice::CommunicatorPtr&,
+ const IceGrid::AdminPrx&);
static ApplicationDescriptor parseDescriptor(const std::string&, const Ice::CommunicatorPtr&);
diff --git a/cpp/src/IceGrid/FileCache.cpp b/cpp/src/IceGrid/FileCache.cpp
index b09b5dcbf9f..fa06add4ca7 100644
--- a/cpp/src/IceGrid/FileCache.cpp
+++ b/cpp/src/IceGrid/FileCache.cpp
@@ -30,7 +30,7 @@ FileCache::getOffsetFromEnd(const string& file, int originalCount)
ifstream is(file.c_str());
if(is.fail())
{
- throw FileNotAvailableException("failed to open file `" + file + "'");
+ throw FileNotAvailableException("failed to open file `" + file + "'");
}
if(originalCount < 0)
@@ -54,64 +54,64 @@ FileCache::getOffsetFromEnd(const string& file, int originalCount)
{
lines.clear();
- //
- // Move the current position of the stream to the new block to
- // read.
- //
- is.clear();
- if(lastBlockOffset - blockSize > streamoff(0))
- {
- is.seekg(lastBlockOffset - blockSize);
- getline(is, line); // Ignore the first line as it's most likely not complete.
- }
- else
- {
- is.seekg(0, ios::beg); // We've reach the begining of the file.
- }
-
- //
- // Read the block and count the number of lines in the block
- // If we found the "first last N lines", we start throwing out
- // the lines read at the begining of the file.
- //
- int count = originalCount - totalCount; // Number of lines left to find.
- while(is.good() && is.tellg() <= streamoff(lastBlockOffset))
- {
+ //
+ // Move the current position of the stream to the new block to
+ // read.
+ //
+ is.clear();
+ if(lastBlockOffset - blockSize > streamoff(0))
+ {
+ is.seekg(lastBlockOffset - blockSize);
+ getline(is, line); // Ignore the first line as it's most likely not complete.
+ }
+ else
+ {
+ is.seekg(0, ios::beg); // We've reach the begining of the file.
+ }
+
+ //
+ // Read the block and count the number of lines in the block
+ // If we found the "first last N lines", we start throwing out
+ // the lines read at the begining of the file.
+ //
+ int count = originalCount - totalCount; // Number of lines left to find.
+ while(is.good() && is.tellg() <= streamoff(lastBlockOffset))
+ {
streampos beg = is.tellg();
- getline(is, line);
- if(is.eof() && line.empty()) // Don't count the last line if it's empty.
- {
- continue;
- }
-
- lines.push_back(make_pair(beg, line));
- ++totalCount;
- if(lines.size() == static_cast<unsigned int>(count + 1))
- {
- --totalCount;
- lines.pop_front();
- }
- }
-
- if(lastBlockOffset - blockSize < streamoff(0))
- {
- break; // We're done if the block started at the begining of the file.
- }
- else if(totalCount < originalCount)
- {
- //
- // Otherwise, it we still didn't find the required number of lines,
- // read another block of text before this block.
- //
- lastBlockOffset -= blockSize; // Position of the block we just read.
- blockSize *= 2; // Read a bigger block.
- }
+ getline(is, line);
+ if(is.eof() && line.empty()) // Don't count the last line if it's empty.
+ {
+ continue;
+ }
+
+ lines.push_back(make_pair(beg, line));
+ ++totalCount;
+ if(lines.size() == static_cast<unsigned int>(count + 1))
+ {
+ --totalCount;
+ lines.pop_front();
+ }
+ }
+
+ if(lastBlockOffset - blockSize < streamoff(0))
+ {
+ break; // We're done if the block started at the begining of the file.
+ }
+ else if(totalCount < originalCount)
+ {
+ //
+ // Otherwise, it we still didn't find the required number of lines,
+ // read another block of text before this block.
+ //
+ lastBlockOffset -= blockSize; // Position of the block we just read.
+ blockSize *= 2; // Read a bigger block.
+ }
}
while(totalCount < originalCount && !is.bad());
if(is.bad())
{
- throw FileNotAvailableException("unrecoverable error occured while reading file `" + file + "'");
+ throw FileNotAvailableException("unrecoverable error occured while reading file `" + file + "'");
}
if(lines.empty())
@@ -131,18 +131,18 @@ FileCache::read(const string& file, Ice::Long offset, int size, Ice::Long& newOf
if(size > _messageSizeMax)
{
- size = _messageSizeMax;
+ size = _messageSizeMax;
}
if(size <= 5)
{
- throw FileNotAvailableException("maximum bytes per read request is too low");
+ throw FileNotAvailableException("maximum bytes per read request is too low");
}
ifstream is(file.c_str());
if(is.fail())
{
- throw FileNotAvailableException("failed to open file `" + file + "'");
+ throw FileNotAvailableException("failed to open file `" + file + "'");
}
//
@@ -153,9 +153,9 @@ FileCache::read(const string& file, Ice::Long offset, int size, Ice::Long& newOf
is.seekg(0, ios::end);
if(offset >= is.tellg())
{
- newOffset = is.tellg();
- lines = Ice::StringSeq();
- return true;
+ newOffset = is.tellg();
+ lines = Ice::StringSeq();
+ return true;
}
//
@@ -173,44 +173,44 @@ FileCache::read(const string& file, Ice::Long offset, int size, Ice::Long& newOf
for(int i = 0; is.good(); ++i)
{
- getline(is, line);
+ getline(is, line);
- int lineSize = static_cast<int>(line.size()) + 5; // 5 bytes for the encoding of the string size (worst case)
- if(lineSize + totalSize > size)
- {
- if(totalSize + 5 < size)
- {
+ int lineSize = static_cast<int>(line.size()) + 5; // 5 bytes for the encoding of the string size (worst case)
+ if(lineSize + totalSize > size)
+ {
+ if(totalSize + 5 < size)
+ {
// There's some room left for a part of the string, return a partial string
line = line.substr(0, size - totalSize - 5);
- lines.push_back(line);
- newOffset += line.size();
- }
- else
- {
- lines.push_back("");
- }
+ lines.push_back(line);
+ newOffset += line.size();
+ }
+ else
+ {
+ lines.push_back("");
+ }
return false; // We didn't reach the end of file, we've just reached the size limit!
- }
+ }
- totalSize += lineSize;
- lines.push_back(line);
+ totalSize += lineSize;
+ lines.push_back(line);
#if defined(_MSC_VER) && (_MSC_VER < 1300)
- if(is.eof())
- {
- newOffset += line.size();
- }
- else
+ if(is.eof())
+ {
+ newOffset += line.size();
+ }
+ else
#else
- if(!is.fail())
+ if(!is.fail())
#endif
- {
- newOffset = is.tellg();
- }
+ {
+ newOffset = is.tellg();
+ }
}
if(is.bad())
{
- throw FileNotAvailableException("unrecoverable error occured while reading file `" + file + "'");
+ throw FileNotAvailableException("unrecoverable error occured while reading file `" + file + "'");
}
return is.eof();
diff --git a/cpp/src/IceGrid/FileParserI.cpp b/cpp/src/IceGrid/FileParserI.cpp
index f2e33fbb69b..9e71dd0b55d 100755
--- a/cpp/src/IceGrid/FileParserI.cpp
+++ b/cpp/src/IceGrid/FileParserI.cpp
@@ -20,12 +20,12 @@ FileParserI::parse(const string& file, const AdminPrx& admin, const Ice::Current
{
try
{
- return DescriptorParser::parseDescriptor(file, Ice::StringSeq(), map<string, string>(),
- current.adapter->getCommunicator(), admin);
+ return DescriptorParser::parseDescriptor(file, Ice::StringSeq(), map<string, string>(),
+ current.adapter->getCommunicator(), admin);
}
catch(const IceXML::ParserException& e)
{
- throw ParseException(e.reason());
+ throw ParseException(e.reason());
return ApplicationDescriptor();
}
}
diff --git a/cpp/src/IceGrid/FileUserAccountMapperI.cpp b/cpp/src/IceGrid/FileUserAccountMapperI.cpp
index b57b57af61a..0ab37bed844 100644
--- a/cpp/src/IceGrid/FileUserAccountMapperI.cpp
+++ b/cpp/src/IceGrid/FileUserAccountMapperI.cpp
@@ -20,55 +20,55 @@ FileUserAccountMapperI::FileUserAccountMapperI(const string& filename)
ifstream file(filename.c_str());
if(!file)
{
- throw "cannot open `" + filename + "' for reading: " + strerror(errno);
+ throw "cannot open `" + filename + "' for reading: " + strerror(errno);
}
-
+
const string delim = " \t\r\n";
while(true)
{
- string line;
- getline(file, line);
- if(!file)
- {
- break;
- }
+ string line;
+ getline(file, line);
+ if(!file)
+ {
+ break;
+ }
- string::size_type idx = line.find('#');
- if(idx != string::npos)
- {
- line.erase(idx);
- }
-
- idx = line.find_last_not_of(delim);
- if(idx != string::npos && idx + 1 < line.length())
- {
- line.erase(idx + 1);
- }
+ string::size_type idx = line.find('#');
+ if(idx != string::npos)
+ {
+ line.erase(idx);
+ }
+
+ idx = line.find_last_not_of(delim);
+ if(idx != string::npos && idx + 1 < line.length())
+ {
+ line.erase(idx + 1);
+ }
- string::size_type beg = line.find_first_not_of(delim);
- if(beg == string::npos)
- {
- continue;
- }
+ string::size_type beg = line.find_first_not_of(delim);
+ if(beg == string::npos)
+ {
+ continue;
+ }
- string::size_type end = line.find_first_of(delim, beg);
- if(end == string::npos || end <= beg)
- {
- continue;
- }
- string account = line.substr(beg, end - beg);
+ string::size_type end = line.find_first_of(delim, beg);
+ if(end == string::npos || end <= beg)
+ {
+ continue;
+ }
+ string account = line.substr(beg, end - beg);
- beg = line.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- continue;
- }
- string user = line.substr(beg);
-
- assert(!user.empty());
- assert(!account.empty());
+ beg = line.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ continue;
+ }
+ string user = line.substr(beg);
+
+ assert(!user.empty());
+ assert(!account.empty());
- _accounts[user] = account;
+ _accounts[user] = account;
}
}
@@ -78,7 +78,7 @@ FileUserAccountMapperI::getUserAccount(const string& user, const Ice::Current&)
map<string, string>::const_iterator p = _accounts.find(user);
if(p == _accounts.end())
{
- throw UserAccountNotFoundException();
+ throw UserAccountNotFoundException();
}
return p->second;
}
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index 012e35f8333..3f38c508056 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -132,16 +132,16 @@ ProcessI::writeMessage(const string& message, Int fd, const Current&)
{
switch(fd)
{
- case 1:
- {
- cout << message << endl;
- break;
- }
- case 2:
- {
- cerr << message << endl;
- break;
- }
+ case 1:
+ {
+ cout << message << endl;
+ break;
+ }
+ case 2:
+ {
+ cerr << message << endl;
+ break;
+ }
}
}
@@ -196,12 +196,12 @@ NodeService::start(int argc, char* argv[])
targets.push_back(argv[i]);
}
}
- else
- {
- error("invalid option: `" + string(argv[i]) + "'");
- usage(argv[0]);
- return false;
- }
+ else
+ {
+ error("invalid option: `" + string(argv[i]) + "'");
+ usage(argv[0]);
+ return false;
+ }
}
PropertiesPtr properties = communicator()->getProperties();
@@ -222,59 +222,59 @@ NodeService::start(int argc, char* argv[])
//
if(!nowarn && properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 0) > 0)
{
- Warning out(communicator()->getLogger());
- out << "setting `Ice.ThreadPool.Server.Size' is not useful,\n";
- out << "you should set individual adapter thread pools instead.";
+ Warning out(communicator()->getLogger());
+ out << "setting `Ice.ThreadPool.Server.Size' is not useful,\n";
+ out << "you should set individual adapter thread pools instead.";
}
//
// DEPRECATED PROPERTY: Remove extra code in future release
//
int size = properties->getPropertyAsIntWithDefault("Ice.OA.IceGrid.Node.ThreadPool.Size",
- properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.Size", 0));
+ properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.Size", 0));
if(size <= 0)
{
- properties->setProperty("Ice.OA.IceGrid.Node.ThreadPool.Size", "1");
- size = 1;
+ properties->setProperty("Ice.OA.IceGrid.Node.ThreadPool.Size", "1");
+ size = 1;
}
//
// DEPRECATED PROPERTY: Remove extra code in future release
//
int sizeMax = properties->getPropertyAsIntWithDefault("Ice.OA.IceGrid.Node.ThreadPool.SizeMax",
- properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.SizeMax", 0));
+ properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.SizeMax", 0));
if(sizeMax <= 0)
{
- if(size >= sizeMax)
- {
- sizeMax = size * 10;
- }
-
- ostringstream os;
- os << sizeMax;
- properties->setProperty("Ice.OA.IceGrid.Node.ThreadPool.SizeMax", os.str());
+ if(size >= sizeMax)
+ {
+ sizeMax = size * 10;
+ }
+
+ ostringstream os;
+ os << sizeMax;
+ properties->setProperty("Ice.OA.IceGrid.Node.ThreadPool.SizeMax", os.str());
}
size = properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Client.Size", 0);
if(size <= 0)
{
- properties->setProperty("Ice.ThreadPool.Client.Size", "1");
- size = 1;
+ properties->setProperty("Ice.ThreadPool.Client.Size", "1");
+ size = 1;
}
sizeMax = properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Client.SizeMax", 0);
if(sizeMax <= 0)
{
- if(size >= sizeMax)
- {
- sizeMax = size * 10;
- }
- if(sizeMax < 100)
- {
- sizeMax = 100;
- }
- ostringstream os;
- os << sizeMax;
- properties->setProperty("Ice.ThreadPool.Client.SizeMax", os.str());
+ if(size >= sizeMax)
+ {
+ sizeMax = size * 10;
+ }
+ if(sizeMax < 100)
+ {
+ sizeMax = 100;
+ }
+ ostringstream os;
+ os << sizeMax;
+ properties->setProperty("Ice.ThreadPool.Client.SizeMax", os.str());
}
//
@@ -294,27 +294,27 @@ NodeService::start(int argc, char* argv[])
return false;
}
- //
- // Set the default locator property to point to the collocated
- // locator (this property is passed by the activator to each
- // activated server). The default locator is also needed by
- // the node session manager.
//
- if(properties->getProperty("Ice.Default.Locator").empty())
- {
- Identity locatorId;
- locatorId.category = properties->getPropertyWithDefault("IceGrid.InstanceName", "IceGrid");
- locatorId.name = "Locator";
- //
- // DEPRECATED PROPERTY: Remove extra code in future release
- //
- string endpoints =
- properties->getPropertyWithDefault("Ice.OA.IceGrid.Registry.Client.Endpoints",
- properties->getProperty("IceGrid.Registry.Client.Endpoints"));
- string locatorPrx = "\"" + communicator()->identityToString(locatorId) + "\" :" + endpoints;
- communicator()->setDefaultLocator(LocatorPrx::uncheckedCast(communicator()->stringToProxy(locatorPrx)));
- properties->setProperty("Ice.Default.Locator", locatorPrx);
- }
+ // Set the default locator property to point to the collocated
+ // locator (this property is passed by the activator to each
+ // activated server). The default locator is also needed by
+ // the node session manager.
+ //
+ if(properties->getProperty("Ice.Default.Locator").empty())
+ {
+ Identity locatorId;
+ locatorId.category = properties->getPropertyWithDefault("IceGrid.InstanceName", "IceGrid");
+ locatorId.name = "Locator";
+ //
+ // DEPRECATED PROPERTY: Remove extra code in future release
+ //
+ string endpoints =
+ properties->getPropertyWithDefault("Ice.OA.IceGrid.Registry.Client.Endpoints",
+ properties->getProperty("IceGrid.Registry.Client.Endpoints"));
+ string locatorPrx = "\"" + communicator()->identityToString(locatorId) + "\" :" + endpoints;
+ communicator()->setDefaultLocator(LocatorPrx::uncheckedCast(communicator()->stringToProxy(locatorPrx)));
+ properties->setProperty("Ice.Default.Locator", locatorPrx);
+ }
}
else if(properties->getProperty("Ice.Default.Locator").empty())
{
@@ -338,25 +338,25 @@ NodeService::start(int argc, char* argv[])
struct _stat filestat;
if(::_stat(dataPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
{
- ostringstream os;
- FileException ex(__FILE__, __LINE__);
- ex.path = dataPath;
- ex.error = getSystemErrno();
- os << ex;
+ ostringstream os;
+ FileException ex(__FILE__, __LINE__);
+ ex.path = dataPath;
+ ex.error = getSystemErrno();
+ os << ex;
error("property `IceGrid.Node.Data' is set to an invalid path:\n" + os.str());
- return false;
+ return false;
}
#else
struct stat filestat;
if(::stat(dataPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
{
- ostringstream os;
- FileException ex(__FILE__, __LINE__);
- ex.path = dataPath;
- ex.error = getSystemErrno();
- os << ex;
+ ostringstream os;
+ FileException ex(__FILE__, __LINE__);
+ ex.path = dataPath;
+ ex.error = getSystemErrno();
+ os << ex;
error("property `IceGrid.Node.Data' is set to an invalid path:\n" + os.str());
- return false;
+ return false;
}
#endif
@@ -368,9 +368,9 @@ NodeService::start(int argc, char* argv[])
dataPath += "/";
}
- IcePatch2::createDirectory(dataPath + "servers");
- IcePatch2::createDirectory(dataPath + "tmp");
- IcePatch2::createDirectory(dataPath + "distrib");
+ IcePatch2::createDirectory(dataPath + "servers");
+ IcePatch2::createDirectory(dataPath + "tmp");
+ IcePatch2::createDirectory(dataPath + "distrib");
}
//
@@ -388,8 +388,8 @@ NodeService::start(int argc, char* argv[])
string name = properties->getProperty("IceGrid.Node.Name");
if(name.empty())
{
- error("property `IceGrid.Node.Name' is not set");
- return false;
+ error("property `IceGrid.Node.Name' is not set");
+ return false;
}
//
@@ -416,35 +416,35 @@ NodeService::start(int argc, char* argv[])
UserAccountMapperPrx mapper;
if(!mapperProperty.empty())
{
- try
- {
- mapper = UserAccountMapperPrx::uncheckedCast(communicator()->stringToProxy(mapperProperty));
- }
- catch(const Ice::LocalException& ex)
- {
- ostringstream os;
- os << "user account mapper `" << mapperProperty << "' is invalid:\n" << ex;
- error(os.str());
- return false;
- }
+ try
+ {
+ mapper = UserAccountMapperPrx::uncheckedCast(communicator()->stringToProxy(mapperProperty));
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ ostringstream os;
+ os << "user account mapper `" << mapperProperty << "' is invalid:\n" << ex;
+ error(os.str());
+ return false;
+ }
}
else
{
- string userAccountFileProperty = properties->getProperty("IceGrid.Node.UserAccounts");
- if(!userAccountFileProperty.empty())
- {
- try
- {
- Ice::ObjectPrx object = _adapter->addWithUUID(new FileUserAccountMapperI(userAccountFileProperty));
- object = object->ice_collocationOptimized(true);
- mapper = UserAccountMapperPrx::uncheckedCast(object);
- }
- catch(const std::string& msg)
- {
- error(msg);
- return false;
- }
- }
+ string userAccountFileProperty = properties->getProperty("IceGrid.Node.UserAccounts");
+ if(!userAccountFileProperty.empty())
+ {
+ try
+ {
+ Ice::ObjectPrx object = _adapter->addWithUUID(new FileUserAccountMapperI(userAccountFileProperty));
+ object = object->ice_collocationOptimized(true);
+ mapper = UserAccountMapperPrx::uncheckedCast(object);
+ }
+ catch(const std::string& msg)
+ {
+ error(msg);
+ return false;
+ }
+ }
}
//
@@ -479,18 +479,18 @@ NodeService::start(int argc, char* argv[])
//
if(!properties->getProperty("Ice.ServerId").empty() && communicator()->getDefaultLocator())
{
- try
- {
- ProcessPrx proxy = ProcessPrx::uncheckedCast(_adapter->addWithUUID(new ProcessI(_activator)));
- LocatorRegistryPrx locatorRegistry = communicator()->getDefaultLocator()->getRegistry();
- locatorRegistry->setServerProcessProxy(properties->getProperty("Ice.ServerId"), proxy);
- }
- catch(const ServerNotFoundException&)
- {
- }
- catch(const LocalException&)
- {
- }
+ try
+ {
+ ProcessPrx proxy = ProcessPrx::uncheckedCast(_adapter->addWithUUID(new ProcessI(_activator)));
+ LocatorRegistryPrx locatorRegistry = communicator()->getDefaultLocator()->getRegistry();
+ locatorRegistry->setServerProcessProxy(properties->getProperty("Ice.ServerId"), proxy);
+ }
+ catch(const ServerNotFoundException&)
+ {
+ }
+ catch(const LocalException&)
+ {
+ }
}
//
@@ -512,16 +512,16 @@ NodeService::start(int argc, char* argv[])
string bundleName = properties->getProperty("IceGrid.Node.PrintServersReady");
if(!bundleName.empty() || !desc.empty())
{
- enableInterrupt();
- if(!_sessions.waitForCreate())
- {
- //
- // Create was interrupted, return true as if the service was
- // correctly initiliazed to make sure it's properly stopped.
- //
- return true;
- }
- disableInterrupt();
+ enableInterrupt();
+ if(!_sessions.waitForCreate())
+ {
+ //
+ // Create was interrupted, return true as if the service was
+ // correctly initiliazed to make sure it's properly stopped.
+ //
+ return true;
+ }
+ disableInterrupt();
}
//
@@ -529,100 +529,100 @@ NodeService::start(int argc, char* argv[])
//
if(!desc.empty())
{
- try
- {
- Ice::Identity registryId;
- registryId.category = instanceName;
- registryId.name = "Registry";
-
- RegistryPrx registry = RegistryPrx::checkedCast(
- communicator()->stringToProxy("\"" + communicator()->identityToString(registryId) + "\""));
- if(!registry)
- {
- throw "invalid registry";
- }
-
- //
- // Use SSL if available.
- //
- try
- {
- registry = RegistryPrx::checkedCast(registry->ice_secure(true));
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- IceGrid::AdminSessionPrx session;
- if(communicator()->getProperties()->getPropertyAsInt("IceGridAdmin.AuthenticateUsingSSL"))
- {
- session = registry->createAdminSessionFromSecureConnection();
- }
- else
- {
- string id = communicator()->getProperties()->getProperty("IceGridAdmin.Username");
- string password = communicator()->getProperties()->getProperty("IceGridAdmin.Password");
- while(id.empty())
- {
- cout << "user id: " << flush;
- getline(cin, id);
- id = trim(id);
- }
-
- if(password.empty())
- {
- cout << "password: " << flush;
- getline(cin, password);
- password = trim(password);
- }
-
- session = registry->createAdminSession(id, password);
- }
- assert(session);
-
- AdminPrx admin = session->getAdmin();
- map<string, string> vars;
- ApplicationDescriptor app = DescriptorParser::parseDescriptor(desc, targets, vars, communicator(), admin);
-
- try
- {
- admin->syncApplication(app);
- }
- catch(const ApplicationNotExistException&)
- {
- admin->addApplication(app);
- }
- }
- catch(const DeploymentException& ex)
- {
- ostringstream ostr;
- ostr << "failed to deploy application `" << desc << "':\n" << ex << ": " << ex.reason;
- warning(ostr.str());
- }
- catch(const AccessDeniedException& ex)
- {
- ostringstream ostr;
- ostr << "failed to deploy application `" << desc << "':\n"
- << "registry database is locked by `" << ex.lockUserId << "'";
- warning(ostr.str());
- }
- catch(const LocalException& ex)
- {
- ostringstream ostr;
- ostr << "failed to deploy application `" << desc << "':\n" << ex;
- warning(ostr.str());
- }
- catch(const string& reason)
- {
- ostringstream ostr;
- ostr << "failed to deploy application `" << desc << "':\n" << reason;
- warning(ostr.str());
- }
+ try
+ {
+ Ice::Identity registryId;
+ registryId.category = instanceName;
+ registryId.name = "Registry";
+
+ RegistryPrx registry = RegistryPrx::checkedCast(
+ communicator()->stringToProxy("\"" + communicator()->identityToString(registryId) + "\""));
+ if(!registry)
+ {
+ throw "invalid registry";
+ }
+
+ //
+ // Use SSL if available.
+ //
+ try
+ {
+ registry = RegistryPrx::checkedCast(registry->ice_secure(true));
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ IceGrid::AdminSessionPrx session;
+ if(communicator()->getProperties()->getPropertyAsInt("IceGridAdmin.AuthenticateUsingSSL"))
+ {
+ session = registry->createAdminSessionFromSecureConnection();
+ }
+ else
+ {
+ string id = communicator()->getProperties()->getProperty("IceGridAdmin.Username");
+ string password = communicator()->getProperties()->getProperty("IceGridAdmin.Password");
+ while(id.empty())
+ {
+ cout << "user id: " << flush;
+ getline(cin, id);
+ id = trim(id);
+ }
+
+ if(password.empty())
+ {
+ cout << "password: " << flush;
+ getline(cin, password);
+ password = trim(password);
+ }
+
+ session = registry->createAdminSession(id, password);
+ }
+ assert(session);
+
+ AdminPrx admin = session->getAdmin();
+ map<string, string> vars;
+ ApplicationDescriptor app = DescriptorParser::parseDescriptor(desc, targets, vars, communicator(), admin);
+
+ try
+ {
+ admin->syncApplication(app);
+ }
+ catch(const ApplicationNotExistException&)
+ {
+ admin->addApplication(app);
+ }
+ }
+ catch(const DeploymentException& ex)
+ {
+ ostringstream ostr;
+ ostr << "failed to deploy application `" << desc << "':\n" << ex << ": " << ex.reason;
+ warning(ostr.str());
+ }
+ catch(const AccessDeniedException& ex)
+ {
+ ostringstream ostr;
+ ostr << "failed to deploy application `" << desc << "':\n"
+ << "registry database is locked by `" << ex.lockUserId << "'";
+ warning(ostr.str());
+ }
+ catch(const LocalException& ex)
+ {
+ ostringstream ostr;
+ ostr << "failed to deploy application `" << desc << "':\n" << ex;
+ warning(ostr.str());
+ }
+ catch(const string& reason)
+ {
+ ostringstream ostr;
+ ostr << "failed to deploy application `" << desc << "':\n" << reason;
+ warning(ostr.str());
+ }
}
if(!bundleName.empty())
{
- print(bundleName + " ready");
+ print(bundleName + " ready");
}
return true;
@@ -649,7 +649,7 @@ NodeService::stop()
}
catch(...)
{
- assert(false);
+ assert(false);
}
//
@@ -659,11 +659,11 @@ NodeService::stop()
try
{
_waitQueue->destroy();
- _waitQueue = 0;
+ _waitQueue = 0;
}
catch(...)
{
- assert(false);
+ assert(false);
}
_activator = 0;
@@ -673,14 +673,14 @@ NodeService::stop()
//
try
{
- _adapter->deactivate();
- _adapter = 0;
+ _adapter->deactivate();
+ _adapter = 0;
}
catch(const Ice::LocalException& ex)
{
- ostringstream ostr;
- ostr << "unexpected exception while shutting down node:\n" << ex;
- warning(ostr.str());
+ ostringstream ostr;
+ ostr << "unexpected exception while shutting down node:\n" << ex;
+ warning(ostr.str());
}
//
@@ -704,9 +704,9 @@ NodeService::stop()
}
catch(const Ice::LocalException& ex)
{
- ostringstream ostr;
- ostr << "unexpected exception while shutting down node:\n" << ex;
- warning(ostr.str());
+ ostringstream ostr;
+ ostr << "unexpected exception while shutting down node:\n" << ex;
+ warning(ostr.str());
}
//
@@ -714,8 +714,8 @@ NodeService::stop()
//
if(_registry)
{
- _registry->stop();
- _registry = 0;
+ _registry->stop();
+ _registry = 0;
}
return true;
@@ -723,7 +723,7 @@ NodeService::stop()
CommunicatorPtr
NodeService::initializeCommunicator(int& argc, char* argv[],
- const InitializationData& initializationData)
+ const InitializationData& initializationData)
{
InitializationData initData = initializationData;
initData.properties = createProperties(argc, argv, initData.properties);
@@ -742,35 +742,35 @@ void
NodeService::usage(const string& appName)
{
string options =
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.\n"
- "--nowarn Don't print any security warnings.\n"
- "\n"
- "--deploy DESCRIPTOR [TARGET1 [TARGET2 ...]]\n"
- " Add or update descriptor in file DESCRIPTOR, with\n"
- " optional targets.\n";
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "--nowarn Don't print any security warnings.\n"
+ "\n"
+ "--deploy DESCRIPTOR [TARGET1 [TARGET2 ...]]\n"
+ " Add or update descriptor in file DESCRIPTOR, with\n"
+ " optional targets.\n";
#ifdef _WIN32
if(checkSystem())
{
options.append(
- "\n"
- "\n"
- "--service NAME Run as the Windows service NAME.\n"
- "\n"
- "--install NAME [--display DISP] [--executable EXEC] [args]\n"
- " Install as Windows service NAME. If DISP is\n"
- " provided, use it as the display name,\n"
- " otherwise NAME is used. If EXEC is provided,\n"
- " use it as the service executable, otherwise\n"
- " this executable is used. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service at startup.\n"
- "--uninstall NAME Uninstall Windows service NAME.\n"
- "--start NAME [args] Start Windows service NAME. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service.\n"
- "--stop NAME Stop Windows service NAME."
+ "\n"
+ "\n"
+ "--service NAME Run as the Windows service NAME.\n"
+ "\n"
+ "--install NAME [--display DISP] [--executable EXEC] [args]\n"
+ " Install as Windows service NAME. If DISP is\n"
+ " provided, use it as the display name,\n"
+ " otherwise NAME is used. If EXEC is provided,\n"
+ " use it as the service executable, otherwise\n"
+ " this executable is used. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service at startup.\n"
+ "--uninstall NAME Uninstall Windows service NAME.\n"
+ "--start NAME [args] Start Windows service NAME. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service.\n"
+ "--stop NAME Stop Windows service NAME."
);
}
#else
@@ -780,7 +780,7 @@ NodeService::usage(const string& appName)
"--daemon Run as a daemon.\n"
"--noclose Do not close open file descriptors.\n"
"--nochdir Do not change the current working directory.\n"
- "--pidfile <file> Write process ID to <file>."
+ "--pidfile <file> Write process ID to <file>."
);
#endif
print("Usage: " + appName + " [options]\n" + options);
diff --git a/cpp/src/IceGrid/IceGridRegistry.cpp b/cpp/src/IceGrid/IceGridRegistry.cpp
index 825dc50bd4a..413a0264fd7 100644
--- a/cpp/src/IceGrid/IceGridRegistry.cpp
+++ b/cpp/src/IceGrid/IceGridRegistry.cpp
@@ -76,31 +76,31 @@ RegistryService::start(int argc, char* argv[])
vector<string> args;
try
{
- args = opts.parse(argc, (const char**)argv);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
error(e.reason);
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
if(opts.isSet("version"))
{
- print(ICE_STRING_VERSION);
- return false;
+ print(ICE_STRING_VERSION);
+ return false;
}
nowarn = opts.isSet("nowarn");
if(!args.empty())
{
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
Ice::PropertiesPtr properties = communicator()->getProperties();
@@ -110,9 +110,9 @@ RegistryService::start(int argc, char* argv[])
//
if(!nowarn && properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 0) > 0)
{
- Warning out(communicator()->getLogger());
- out << "setting `Ice.ThreadPool.Server.Size' is not useful,\n";
- out << "you should set individual adapter thread pools instead.";
+ Warning out(communicator()->getLogger());
+ out << "setting `Ice.ThreadPool.Server.Size' is not useful,\n";
+ out << "you should set individual adapter thread pools instead.";
}
TraceLevelsPtr traceLevels = new TraceLevels(communicator(), "IceGrid.Registry");
@@ -120,7 +120,7 @@ RegistryService::start(int argc, char* argv[])
_registry = new RegistryI(communicator(), traceLevels);
if(!_registry->start(nowarn))
{
- return false;
+ return false;
}
return true;
@@ -147,7 +147,7 @@ RegistryService::stop()
CommunicatorPtr
RegistryService::initializeCommunicator(int& argc, char* argv[],
- const InitializationData& initializationData)
+ const InitializationData& initializationData)
{
InitializationData initData = initializationData;
initData.properties = createProperties(argc, argv, initData.properties);
@@ -166,31 +166,31 @@ void
RegistryService::usage(const string& appName)
{
string options =
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.\n"
- "--nowarn Don't print any security warnings.";
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "--nowarn Don't print any security warnings.";
#ifdef _WIN32
if(checkSystem())
{
options.append(
- "\n"
- "\n"
- "--service NAME Run as the Windows service NAME.\n"
- "\n"
- "--install NAME [--display DISP] [--executable EXEC] [args]\n"
- " Install as Windows service NAME. If DISP is\n"
- " provided, use it as the display name,\n"
- " otherwise NAME is used. If EXEC is provided,\n"
- " use it as the service executable, otherwise\n"
- " this executable is used. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service at startup.\n"
- "--uninstall NAME Uninstall Windows service NAME.\n"
- "--start NAME [args] Start Windows service NAME. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service.\n"
- "--stop NAME Stop Windows service NAME."
+ "\n"
+ "\n"
+ "--service NAME Run as the Windows service NAME.\n"
+ "\n"
+ "--install NAME [--display DISP] [--executable EXEC] [args]\n"
+ " Install as Windows service NAME. If DISP is\n"
+ " provided, use it as the display name,\n"
+ " otherwise NAME is used. If EXEC is provided,\n"
+ " use it as the service executable, otherwise\n"
+ " this executable is used. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service at startup.\n"
+ "--uninstall NAME Uninstall Windows service NAME.\n"
+ "--start NAME [args] Start Windows service NAME. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service.\n"
+ "--stop NAME Stop Windows service NAME."
);
}
#else
@@ -199,8 +199,8 @@ RegistryService::usage(const string& appName)
"\n"
"--daemon Run as a daemon.\n"
"--noclose Do not close open file descriptors.\n"
- "--nochdir Do not change the current working directory.\n"
- "--pidfile <file> Write process ID to <file>."
+ "--nochdir Do not change the current working directory.\n"
+ "--pidfile <file> Write process ID to <file>."
);
#endif
print("Usage: " + appName + " [options]\n" + options);
diff --git a/cpp/src/IceGrid/Internal.ice b/cpp/src/IceGrid/Internal.ice
index da569db2803..ed516ff5822 100644
--- a/cpp/src/IceGrid/Internal.ice
+++ b/cpp/src/IceGrid/Internal.ice
@@ -159,7 +159,7 @@ interface Adapter
*
**/
["ami", "nonmutating", "cpp:const"] idempotent Object* getDirectProxy()
- throws AdapterNotActiveException;
+ throws AdapterNotActiveException;
/**
*
@@ -175,7 +175,7 @@ interface Adapter
*
**/
["ami"] void setDirectProxy(Object* proxy)
- throws AdapterActiveException;
+ throws AdapterActiveException;
};
/**
@@ -200,7 +200,7 @@ interface FileReader
*
**/
["cpp:const"] idempotent long getOffsetFromEnd(string filename, int lines)
- throws FileNotAvailableException;
+ throws FileNotAvailableException;
/**
*
@@ -208,7 +208,7 @@ interface FileReader
*
**/
["cpp:const"] idempotent bool read(string filename, long pos, int size, out long newPos, out Ice::StringSeq lines)
- throws FileNotAvailableException;
+ throws FileNotAvailableException;
};
interface Server extends FileReader
@@ -222,7 +222,7 @@ interface Server extends FileReader
*
**/
["amd"] void start()
- throws ServerStartException;
+ throws ServerStartException;
/**
*
@@ -232,7 +232,7 @@ interface Server extends FileReader
*
**/
["amd"] void stop()
- throws ServerStopException;
+ throws ServerStopException;
/**
*
@@ -254,7 +254,7 @@ interface Server extends FileReader
*
**/
void sendSignal(string signal)
- throws BadSignalException;
+ throws BadSignalException;
/**
*
@@ -348,11 +348,11 @@ interface Node extends FileReader, ReplicaObserver
*
**/
["amd", "ami"] idempotent Server* loadServer(InternalServerDescriptor svr,
- string replicaName,
- out AdapterPrxDict adapters,
- out int actTimeout,
- out int deactTimeout)
- throws DeploymentException;
+ string replicaName,
+ out AdapterPrxDict adapters,
+ out int actTimeout,
+ out int deactTimeout)
+ throws DeploymentException;
/**
*
@@ -360,7 +360,7 @@ interface Node extends FileReader, ReplicaObserver
*
**/
["amd", "ami"] idempotent void destroyServer(string name, string uuid, int revision, string replicaName)
- throws DeploymentException;
+ throws DeploymentException;
/**
*
@@ -371,10 +371,10 @@ interface Node extends FileReader, ReplicaObserver
*
**/
["amd"] idempotent void patch(PatcherFeedback* feedback,
- string application,
- string server,
- InternalDistributionDescriptor appDistrib,
- bool shutdown);
+ string application,
+ string server,
+ InternalDistributionDescriptor appDistrib,
+ bool shutdown);
/**
*
@@ -562,7 +562,7 @@ interface ReplicaSession
*
**/
["ami"] idempotent void setAdapterDirectProxy(string adapterId, string replicaGroupId, Object* proxy)
- throws AdapterNotExistException, AdapterExistsException;
+ throws AdapterNotExistException, AdapterExistsException;
/**
*
@@ -690,7 +690,7 @@ interface InternalRegistry extends FileReader
*
**/
NodeSession* registerNode(InternalNodeInfo info, Node* prx, LoadInfo loadInf)
- throws NodeActiveException;
+ throws NodeActiveException;
/**
*
@@ -709,7 +709,7 @@ interface InternalRegistry extends FileReader
*
**/
ReplicaSession* registerReplica(InternalReplicaInfo info, InternalRegistry* prx)
- throws ReplicaActiveException;
+ throws ReplicaActiveException;
/**
*
diff --git a/cpp/src/IceGrid/InternalRegistryI.cpp b/cpp/src/IceGrid/InternalRegistryI.cpp
index 997d2b1769a..ae54ddda0cf 100644
--- a/cpp/src/IceGrid/InternalRegistryI.cpp
+++ b/cpp/src/IceGrid/InternalRegistryI.cpp
@@ -24,10 +24,10 @@ using namespace std;
using namespace IceGrid;
InternalRegistryI::InternalRegistryI(const RegistryIPtr& registry,
- const DatabasePtr& database,
- const ReapThreadPtr& reaper,
- const WellKnownObjectsManagerPtr& wellKnownObjects,
- ReplicaSessionManager& session) :
+ const DatabasePtr& database,
+ const ReapThreadPtr& reaper,
+ const WellKnownObjectsManagerPtr& wellKnownObjects,
+ ReplicaSessionManager& session) :
_registry(registry),
_database(database),
_reaper(reaper),
@@ -46,38 +46,38 @@ InternalRegistryI::~InternalRegistryI()
NodeSessionPrx
InternalRegistryI::registerNode(const InternalNodeInfoPtr& info,
- const NodePrx& node,
- const LoadInfo& load,
- const Ice::Current& current)
+ const NodePrx& node,
+ const LoadInfo& load,
+ const Ice::Current& current)
{
const Ice::LoggerPtr logger = _database->getTraceLevels()->logger;
try
{
- NodeSessionIPtr session = new NodeSessionI(_database, node, info, _nodeSessionTimeout, load);
- _reaper->add(new SessionReapable<NodeSessionI>(logger, session), _nodeSessionTimeout);
- return session->getProxy();
+ NodeSessionIPtr session = new NodeSessionI(_database, node, info, _nodeSessionTimeout, load);
+ _reaper->add(new SessionReapable<NodeSessionI>(logger, session), _nodeSessionTimeout);
+ return session->getProxy();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
}
}
ReplicaSessionPrx
InternalRegistryI::registerReplica(const InternalReplicaInfoPtr& info,
- const InternalRegistryPrx& prx,
- const Ice::Current& current)
+ const InternalRegistryPrx& prx,
+ const Ice::Current& current)
{
const Ice::LoggerPtr logger = _database->getTraceLevels()->logger;
try
{
- ReplicaSessionIPtr s = new ReplicaSessionI(_database, _wellKnownObjects, info, prx, _replicaSessionTimeout);
- _reaper->add(new SessionReapable<ReplicaSessionI>(logger, s), _replicaSessionTimeout);
- return s->getProxy();
+ ReplicaSessionIPtr s = new ReplicaSessionI(_database, _wellKnownObjects, info, prx, _replicaSessionTimeout);
+ _reaper->add(new SessionReapable<ReplicaSessionI>(logger, s), _replicaSessionTimeout);
+ return s->getProxy();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
}
}
@@ -94,7 +94,7 @@ InternalRegistryI::getNodes(const Ice::Current&) const
Ice::ObjectProxySeq proxies = _database->getInternalObjectsByType(Node::ice_staticId());
for(Ice::ObjectProxySeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p)
{
- nodes.push_back(NodePrx::uncheckedCast(*p));
+ nodes.push_back(NodePrx::uncheckedCast(*p));
}
return nodes;
}
@@ -106,7 +106,7 @@ InternalRegistryI::getReplicas(const Ice::Current&) const
Ice::ObjectProxySeq proxies = _database->getObjectsByType(InternalRegistry::ice_staticId());
for(Ice::ObjectProxySeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p)
{
- replicas.push_back(InternalRegistryPrx::uncheckedCast(*p));
+ replicas.push_back(InternalRegistryPrx::uncheckedCast(*p));
}
return replicas;
}
@@ -125,7 +125,7 @@ InternalRegistryI::getOffsetFromEnd(const string& filename, int count, const Ice
bool
InternalRegistryI::read(const string& filename, Ice::Long pos, int size, Ice::Long& newPos, Ice::StringSeq& lines,
- const Ice::Current&) const
+ const Ice::Current&) const
{
return _fileCache->read(getFilePath(filename), pos, size, newPos, lines);
}
@@ -136,23 +136,23 @@ InternalRegistryI::getFilePath(const string& filename) const
string file;
if(filename == "stderr")
{
- file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdErr");
- if(file.empty())
- {
- throw FileNotAvailableException("Ice.StdErr configuration property is not set");
- }
+ file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdErr");
+ if(file.empty())
+ {
+ throw FileNotAvailableException("Ice.StdErr configuration property is not set");
+ }
}
else if(filename == "stdout")
{
- file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdOut");
- if(file.empty())
- {
- throw FileNotAvailableException("Ice.StdOut configuration property is not set");
- }
+ file = _database->getCommunicator()->getProperties()->getProperty("Ice.StdOut");
+ if(file.empty())
+ {
+ throw FileNotAvailableException("Ice.StdOut configuration property is not set");
+ }
}
else
{
- throw FileNotAvailableException("unknown file");
+ throw FileNotAvailableException("unknown file");
}
return file;
}
diff --git a/cpp/src/IceGrid/InternalRegistryI.h b/cpp/src/IceGrid/InternalRegistryI.h
index d528e8ce088..e13e292b8e9 100644
--- a/cpp/src/IceGrid/InternalRegistryI.h
+++ b/cpp/src/IceGrid/InternalRegistryI.h
@@ -38,13 +38,13 @@ class InternalRegistryI : public InternalRegistry
public:
InternalRegistryI(const RegistryIPtr&, const DatabasePtr&, const ReapThreadPtr&,
- const WellKnownObjectsManagerPtr&, ReplicaSessionManager&);
+ const WellKnownObjectsManagerPtr&, ReplicaSessionManager&);
virtual ~InternalRegistryI();
virtual NodeSessionPrx registerNode(const InternalNodeInfoPtr&, const NodePrx&, const LoadInfo&,
- const Ice::Current&);
+ const Ice::Current&);
virtual ReplicaSessionPrx registerReplica(const InternalReplicaInfoPtr&, const InternalRegistryPrx&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void registerWithReplica(const InternalRegistryPrx&, const Ice::Current&);
diff --git a/cpp/src/IceGrid/LocatorI.cpp b/cpp/src/IceGrid/LocatorI.cpp
index 58cd8503f7a..9158def55ff 100644
--- a/cpp/src/IceGrid/LocatorI.cpp
+++ b/cpp/src/IceGrid/LocatorI.cpp
@@ -27,19 +27,19 @@ class AMI_Adapter_getDirectProxyI : public AMI_Adapter_getDirectProxy
public:
AMI_Adapter_getDirectProxyI(const LocatorIPtr& locator, const string& id, const LocatorAdapterInfo& adapter) :
- _locator(locator), _id(id), _adapter(adapter)
+ _locator(locator), _id(id), _adapter(adapter)
{
}
virtual void ice_response(const ::Ice::ObjectPrx& obj)
{
- assert(obj);
- _locator->getDirectProxyCallback(_adapter.proxy->ice_getIdentity(), obj);
+ assert(obj);
+ _locator->getDirectProxyCallback(_adapter.proxy->ice_getIdentity(), obj);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- _locator->getDirectProxyException(_adapter, _id, ex);
+ _locator->getDirectProxyException(_adapter, _id, ex);
}
private:
@@ -54,18 +54,18 @@ class AMI_Adapter_activateI : public AMI_Adapter_activate
public:
AMI_Adapter_activateI(const LocatorIPtr& locator, const string& id, const LocatorAdapterInfo& adapter) :
- _locator(locator), _id(id), _adapter(adapter)
+ _locator(locator), _id(id), _adapter(adapter)
{
}
virtual void ice_response(const ::Ice::ObjectPrx& obj)
{
- _locator->getDirectProxyCallback(_adapter.proxy->ice_getIdentity(), obj);
+ _locator->getDirectProxyCallback(_adapter.proxy->ice_getIdentity(), obj);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- _locator->getDirectProxyException(_adapter, _id, ex);
+ _locator->getDirectProxyException(_adapter, _id, ex);
}
private:
@@ -84,66 +84,66 @@ class AMD_Locator_findAdapterByIdI : public Ice::AMD_Locator_findAdapterById
public:
AMD_Locator_findAdapterByIdI(const Ice::AMD_Locator_findObjectByIdPtr& cb, const Ice::ObjectPrx& obj) :
- _cb(cb),
- _obj(obj)
+ _cb(cb),
+ _obj(obj)
{
}
virtual void ice_response(const ::Ice::ObjectPrx& obj)
{
- //
- // If the adapter dummy direct proxy is not null, return a
- // proxy containing the identity we were looking for and the
- // endpoints of the adapter.
- //
- // If null, return the proxy registered with the object
- // registry.
- //
- if(obj)
- {
- _cb->ice_response(obj->ice_identity(_obj->ice_getIdentity()));
- }
- else
- {
- _cb->ice_response(_obj);
- }
+ //
+ // If the adapter dummy direct proxy is not null, return a
+ // proxy containing the identity we were looking for and the
+ // endpoints of the adapter.
+ //
+ // If null, return the proxy registered with the object
+ // registry.
+ //
+ if(obj)
+ {
+ _cb->ice_response(obj->ice_identity(_obj->ice_getIdentity()));
+ }
+ else
+ {
+ _cb->ice_response(_obj);
+ }
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- try
- {
- ex.ice_throw();
- }
- catch(Ice::AdapterNotFoundException&)
- {
- //
- // We couldn't find the adapter, we ignore and return the
- // original proxy containing the adapter id.
- //
- _cb->ice_response(_obj);
- return;
- }
- catch(const Ice::Exception& ex)
- {
- //
- // Rethrow unexpected exception.
- //
- _cb->ice_exception(ex);
- return;
- }
-
- assert(false);
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(Ice::AdapterNotFoundException&)
+ {
+ //
+ // We couldn't find the adapter, we ignore and return the
+ // original proxy containing the adapter id.
+ //
+ _cb->ice_response(_obj);
+ return;
+ }
+ catch(const Ice::Exception& ex)
+ {
+ //
+ // Rethrow unexpected exception.
+ //
+ _cb->ice_exception(ex);
+ return;
+ }
+
+ assert(false);
}
virtual void ice_exception(const std::exception& ex)
{
- _cb->ice_exception(ex);
+ _cb->ice_exception(ex);
}
virtual void ice_exception()
{
- _cb->ice_exception();
+ _cb->ice_exception();
}
private:
@@ -155,12 +155,12 @@ private:
}
LocatorI::Request::Request(const Ice::AMD_Locator_findAdapterByIdPtr& amdCB,
- const LocatorIPtr& locator,
- const string& id,
- bool replicaGroup,
- const LocatorAdapterInfoSeq& adapters,
- int count,
- const TraceLevelsPtr& traceLevels) :
+ const LocatorIPtr& locator,
+ const string& id,
+ bool replicaGroup,
+ const LocatorAdapterInfoSeq& adapters,
+ int count,
+ const TraceLevelsPtr& traceLevels) :
_amdCB(amdCB),
_locator(locator),
_id(id),
@@ -182,8 +182,8 @@ LocatorI::Request::execute()
//
if(_adapters.empty())
{
- sendResponse();
- return;
+ sendResponse();
+ return;
}
//
@@ -191,24 +191,24 @@ LocatorI::Request::execute()
//
LocatorAdapterInfoSeq adapters;
{
- Lock sync(*this);
- assert(_count > 0 && _lastAdapter != _adapters.end());
- for(unsigned int i = 0; i < _count; ++i)
- {
- if(_lastAdapter == _adapters.end())
- {
- _count = i;
- break;
- }
- assert(_lastAdapter->proxy);
- adapters.push_back(*_lastAdapter);
- ++_lastAdapter;
- }
+ Lock sync(*this);
+ assert(_count > 0 && _lastAdapter != _adapters.end());
+ for(unsigned int i = 0; i < _count; ++i)
+ {
+ if(_lastAdapter == _adapters.end())
+ {
+ _count = i;
+ break;
+ }
+ assert(_lastAdapter->proxy);
+ adapters.push_back(*_lastAdapter);
+ ++_lastAdapter;
+ }
}
assert(!adapters.empty());
for(LocatorAdapterInfoSeq::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- requestAdapter(*p);
+ requestAdapter(*p);
}
}
@@ -217,32 +217,32 @@ LocatorI::Request::exception(const Ice::Exception& ex)
{
LocatorAdapterInfo adapter;
{
- Lock sync(*this);
-
- if(!_exception.get())
- {
- _exception.reset(ex.ice_clone());
- }
-
- if(_lastAdapter == _adapters.end())
- {
- --_count; // Expect one less adapter proxy if there's no more adapters to query.
-
- //
- // If we received all the required proxies, it's time to send the
- // answer back to the client.
- //
- if(_count == _proxies.size())
- {
- sendResponse();
- }
- return;
- }
- else
- {
- adapter = *_lastAdapter;
- ++_lastAdapter;
- }
+ Lock sync(*this);
+
+ if(!_exception.get())
+ {
+ _exception.reset(ex.ice_clone());
+ }
+
+ if(_lastAdapter == _adapters.end())
+ {
+ --_count; // Expect one less adapter proxy if there's no more adapters to query.
+
+ //
+ // If we received all the required proxies, it's time to send the
+ // answer back to the client.
+ //
+ if(_count == _proxies.size())
+ {
+ sendResponse();
+ }
+ return;
+ }
+ else
+ {
+ adapter = *_lastAdapter;
+ ++_lastAdapter;
+ }
}
requestAdapter(adapter);
}
@@ -261,7 +261,7 @@ LocatorI::Request::response(const Ice::ObjectPrx& proxy)
//
if(_proxies.size() == _count)
{
- sendResponse();
+ sendResponse();
}
}
@@ -271,8 +271,8 @@ LocatorI::Request::requestAdapter(const LocatorAdapterInfo& adapter)
assert(adapter.proxy);
if(_locator->getDirectProxyRequest(this, adapter))
{
- AMI_Adapter_getDirectProxyPtr amiCB = new AMI_Adapter_getDirectProxyI(_locator, _id, adapter);
- adapter.proxy->getDirectProxy_async(amiCB);
+ AMI_Adapter_getDirectProxyPtr amiCB = new AMI_Adapter_getDirectProxyI(_locator, _id, adapter);
+ adapter.proxy->getDirectProxy_async(amiCB);
}
}
@@ -281,45 +281,45 @@ LocatorI::Request::sendResponse()
{
if(_proxies.size() == 1)
{
- _amdCB->ice_response(_proxies.back());
+ _amdCB->ice_response(_proxies.back());
}
else if(_proxies.empty())
{
- //
- // If there's no proxies, it's either because we couldn't
- // contact the adapters or because the replica group has
- // no members.
- //
- assert(_exception.get() || _replicaGroup && _adapters.empty());
-
- if(_traceLevels->locator > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
- out << "couldn't resolve " << (_replicaGroup ? "replica group `" : "adapter `") << _id << "' endpoints:\n";
- out << (_exception.get() ? toString(*_exception) : string("replica group is empty"));
- }
- _amdCB->ice_response(0);
+ //
+ // If there's no proxies, it's either because we couldn't
+ // contact the adapters or because the replica group has
+ // no members.
+ //
+ assert(_exception.get() || _replicaGroup && _adapters.empty());
+
+ if(_traceLevels->locator > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
+ out << "couldn't resolve " << (_replicaGroup ? "replica group `" : "adapter `") << _id << "' endpoints:\n";
+ out << (_exception.get() ? toString(*_exception) : string("replica group is empty"));
+ }
+ _amdCB->ice_response(0);
}
else if(_proxies.size() > 1)
{
- Ice::EndpointSeq endpoints;
- endpoints.reserve(_proxies.size());
- for(vector<Ice::ObjectPrx>::const_iterator p = _proxies.begin(); p != _proxies.end(); ++p)
- {
- Ice::EndpointSeq edpts = (*p)->ice_getEndpoints();
- endpoints.insert(endpoints.end(), edpts.begin(), edpts.end());
- }
+ Ice::EndpointSeq endpoints;
+ endpoints.reserve(_proxies.size());
+ for(vector<Ice::ObjectPrx>::const_iterator p = _proxies.begin(); p != _proxies.end(); ++p)
+ {
+ Ice::EndpointSeq edpts = (*p)->ice_getEndpoints();
+ endpoints.insert(endpoints.end(), edpts.begin(), edpts.end());
+ }
- Ice::ObjectPrx proxy = _locator->getCommunicator()->stringToProxy("dummy:default");
- _amdCB->ice_response(proxy->ice_endpoints(endpoints));
+ Ice::ObjectPrx proxy = _locator->getCommunicator()->stringToProxy("dummy:default");
+ _amdCB->ice_response(proxy->ice_endpoints(endpoints));
}
}
LocatorI::LocatorI(const Ice::CommunicatorPtr& communicator,
- const DatabasePtr& database,
- const Ice::LocatorRegistryPrx& locatorRegistry,
- const RegistryPrx& registry,
- const QueryPrx& query) :
+ const DatabasePtr& database,
+ const Ice::LocatorRegistryPrx& locatorRegistry,
+ const RegistryPrx& registry,
+ const QueryPrx& query) :
_communicator(communicator),
_database(database),
_locatorRegistry(locatorRegistry),
@@ -334,17 +334,17 @@ LocatorI::LocatorI(const Ice::CommunicatorPtr& communicator,
//
void
LocatorI::findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr& cb,
- const Ice::Identity& id,
- const Ice::Current& current) const
+ const Ice::Identity& id,
+ const Ice::Current& current) const
{
Ice::ObjectPrx proxy;
try
{
- proxy = _database->getObjectProxy(id);
+ proxy = _database->getObjectProxy(id);
}
catch(const ObjectNotRegisteredException&)
{
- throw Ice::ObjectNotFoundException();
+ throw Ice::ObjectNotFoundException();
}
assert(proxy);
@@ -358,12 +358,12 @@ LocatorI::findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr& cb,
const string adapterId = proxy->ice_getAdapterId();
if(!adapterId.empty())
{
- Ice::AMD_Locator_findAdapterByIdPtr amiCB = new AMD_Locator_findAdapterByIdI(cb, proxy);
- findAdapterById_async(amiCB, adapterId, current);
+ Ice::AMD_Locator_findAdapterByIdPtr amiCB = new AMD_Locator_findAdapterByIdI(cb, proxy);
+ findAdapterById_async(amiCB, adapterId, current);
}
else
{
- cb->ice_response(proxy);
+ cb->ice_response(proxy);
}
}
@@ -373,54 +373,54 @@ LocatorI::findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr& cb,
//
void
LocatorI::findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr& cb,
- const string& id,
- const Ice::Current&) const
+ const string& id,
+ const Ice::Current&) const
{
bool replicaGroup = false;
try
{
- //
- // NOTE: getProxies() might throw if the adapter is a server
- // adapter and the node is unreachable (it doesn't throw for
- // replica groups).
- //
- int count;
- LocatorAdapterInfoSeq adapters;
- _database->getAdapter(id)->getLocatorAdapterInfo(adapters, count, replicaGroup);
+ //
+ // NOTE: getProxies() might throw if the adapter is a server
+ // adapter and the node is unreachable (it doesn't throw for
+ // replica groups).
+ //
+ int count;
+ LocatorAdapterInfoSeq adapters;
+ _database->getAdapter(id)->getLocatorAdapterInfo(adapters, count, replicaGroup);
- LocatorIPtr self = const_cast<LocatorI*>(this);
- RequestPtr request = new Request(cb, self, id, replicaGroup, adapters, count, _database->getTraceLevels());
- request->execute();
+ LocatorIPtr self = const_cast<LocatorI*>(this);
+ RequestPtr request = new Request(cb, self, id, replicaGroup, adapters, count, _database->getTraceLevels());
+ request->execute();
}
catch(const AdapterNotExistException&)
{
- try
- {
- cb->ice_response(_database->getAdapterDirectProxy(id));
- }
- catch(const AdapterNotExistException&)
- {
- cb->ice_exception(Ice::AdapterNotFoundException());
- }
- return;
+ try
+ {
+ cb->ice_response(_database->getAdapterDirectProxy(id));
+ }
+ catch(const AdapterNotExistException&)
+ {
+ cb->ice_exception(Ice::AdapterNotFoundException());
+ }
+ return;
}
catch(const Ice::Exception& ex)
{
- const TraceLevelsPtr traceLevels = _database->getTraceLevels();
- if(traceLevels->locator > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
- if(replicaGroup)
- {
- out << "couldn't resolve replica group `" << id << "' endpoints:\n" << toString(ex);
- }
- else
- {
- out << "couldn't resolve adapter `" << id << "' endpoints:\n" << toString(ex);
- }
- }
- cb->ice_response(0);
- return;
+ const TraceLevelsPtr traceLevels = _database->getTraceLevels();
+ if(traceLevels->locator > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
+ if(replicaGroup)
+ {
+ out << "couldn't resolve replica group `" << id << "' endpoints:\n" << toString(ex);
+ }
+ else
+ {
+ out << "couldn't resolve adapter `" << id << "' endpoints:\n" << toString(ex);
+ }
+ }
+ cb->ice_response(0);
+ return;
}
}
@@ -463,24 +463,24 @@ LocatorI::getDirectProxyException(const LocatorAdapterInfo& adpt, const string&
{
try
{
- ex.ice_throw();
+ ex.ice_throw();
}
catch(const AdapterNotActiveException& ex)
{
- if(ex.activatable)
- {
- //
- // Activate the adapter if it can be activated on demand.
- //
- // NOTE: we use a timeout large enough to ensure that the
- // activate() call won't timeout if the server hangs in
- // deactivation and/or activation.
- //
- AMI_Adapter_activatePtr amiCB = new AMI_Adapter_activateI(this, id, adpt);
- int timeout = adpt.activationTimeout + adpt.deactivationTimeout;
- AdapterPrx::uncheckedCast(adpt.proxy->ice_timeout(timeout * 1000))->activate_async(amiCB);
- return;
- }
+ if(ex.activatable)
+ {
+ //
+ // Activate the adapter if it can be activated on demand.
+ //
+ // NOTE: we use a timeout large enough to ensure that the
+ // activate() call won't timeout if the server hangs in
+ // deactivation and/or activation.
+ //
+ AMI_Adapter_activatePtr amiCB = new AMI_Adapter_activateI(this, id, adpt);
+ int timeout = adpt.activationTimeout + adpt.deactivationTimeout;
+ AdapterPrx::uncheckedCast(adpt.proxy->ice_timeout(timeout * 1000))->activate_async(amiCB);
+ return;
+ }
}
catch(const Ice::Exception&)
{
@@ -488,16 +488,16 @@ LocatorI::getDirectProxyException(const LocatorAdapterInfo& adpt, const string&
PendingRequests requests;
{
- Lock sync(*this);
- PendingRequestsMap::iterator p = _pendingRequests.find(adpt.proxy->ice_getIdentity());
- assert(p != _pendingRequests.end());
- requests.swap(p->second);
- _pendingRequests.erase(p);
+ Lock sync(*this);
+ PendingRequestsMap::iterator p = _pendingRequests.find(adpt.proxy->ice_getIdentity());
+ assert(p != _pendingRequests.end());
+ requests.swap(p->second);
+ _pendingRequests.erase(p);
}
for(PendingRequests::iterator q = requests.begin(); q != requests.end(); ++q)
{
- (*q)->exception(ex);
+ (*q)->exception(ex);
}
}
@@ -506,26 +506,26 @@ LocatorI::getDirectProxyCallback(const Ice::Identity& adapterId, const Ice::Obje
{
PendingRequests requests;
{
- Lock sync(*this);
- PendingRequestsMap::iterator p = _pendingRequests.find(adapterId);
- assert(p != _pendingRequests.end());
- requests.swap(p->second);
- _pendingRequests.erase(p);
+ Lock sync(*this);
+ PendingRequestsMap::iterator p = _pendingRequests.find(adapterId);
+ assert(p != _pendingRequests.end());
+ requests.swap(p->second);
+ _pendingRequests.erase(p);
}
if(proxy)
{
- for(PendingRequests::const_iterator q = requests.begin(); q != requests.end(); ++q)
- {
- (*q)->response(proxy);
- }
+ for(PendingRequests::const_iterator q = requests.begin(); q != requests.end(); ++q)
+ {
+ (*q)->response(proxy);
+ }
}
else
{
- for(PendingRequests::const_iterator q = requests.begin(); q != requests.end(); ++q)
- {
- (*q)->exception(AdapterNotActiveException());
- }
+ for(PendingRequests::const_iterator q = requests.begin(); q != requests.end(); ++q)
+ {
+ (*q)->exception(AdapterNotActiveException());
+ }
}
}
diff --git a/cpp/src/IceGrid/LocatorI.h b/cpp/src/IceGrid/LocatorI.h
index 96cd6a96d37..e36741631f9 100644
--- a/cpp/src/IceGrid/LocatorI.h
+++ b/cpp/src/IceGrid/LocatorI.h
@@ -34,41 +34,41 @@ class LocatorI : public Locator, public IceUtil::Mutex
{
public:
- Request(const Ice::AMD_Locator_findAdapterByIdPtr&, const LocatorIPtr&, const std::string&, bool,
- const LocatorAdapterInfoSeq&, int, const TraceLevelsPtr&);
+ Request(const Ice::AMD_Locator_findAdapterByIdPtr&, const LocatorIPtr&, const std::string&, bool,
+ const LocatorAdapterInfoSeq&, int, const TraceLevelsPtr&);
- void execute();
- void response(const Ice::ObjectPrx&);
- void exception(const Ice::Exception&);
+ void execute();
+ void response(const Ice::ObjectPrx&);
+ void exception(const Ice::Exception&);
private:
- void requestAdapter(const LocatorAdapterInfo&);
- void sendResponse();
-
- const Ice::AMD_Locator_findAdapterByIdPtr _amdCB;
- const LocatorIPtr _locator;
- const std::string _id;
- const bool _replicaGroup;
- LocatorAdapterInfoSeq _adapters;
- const TraceLevelsPtr _traceLevels;
- unsigned int _count;
- LocatorAdapterInfoSeq::const_iterator _lastAdapter;
- std::vector<Ice::ObjectPrx> _proxies;
- std::auto_ptr<Ice::Exception> _exception;
+ void requestAdapter(const LocatorAdapterInfo&);
+ void sendResponse();
+
+ const Ice::AMD_Locator_findAdapterByIdPtr _amdCB;
+ const LocatorIPtr _locator;
+ const std::string _id;
+ const bool _replicaGroup;
+ LocatorAdapterInfoSeq _adapters;
+ const TraceLevelsPtr _traceLevels;
+ unsigned int _count;
+ LocatorAdapterInfoSeq::const_iterator _lastAdapter;
+ std::vector<Ice::ObjectPrx> _proxies;
+ std::auto_ptr<Ice::Exception> _exception;
};
typedef IceUtil::Handle<Request> RequestPtr;
public:
LocatorI(const Ice::CommunicatorPtr&, const DatabasePtr&, const Ice::LocatorRegistryPrx&, const RegistryPrx&,
- const QueryPrx&);
+ const QueryPrx&);
virtual void findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr&, const Ice::Identity&,
- const Ice::Current&) const;
+ const Ice::Current&) const;
virtual void findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr&, const ::std::string&,
- const Ice::Current&) const;
+ const Ice::Current&) const;
virtual Ice::LocatorRegistryPrx getRegistry(const Ice::Current&) const;
virtual RegistryPrx getLocalRegistry(const Ice::Current&) const;
diff --git a/cpp/src/IceGrid/LocatorRegistryI.cpp b/cpp/src/IceGrid/LocatorRegistryI.cpp
index c4958152f20..01b01795192 100644
--- a/cpp/src/IceGrid/LocatorRegistryI.cpp
+++ b/cpp/src/IceGrid/LocatorRegistryI.cpp
@@ -25,53 +25,53 @@ class SetDirectProxyCB : public AMI_Adapter_setDirectProxy
public:
SetDirectProxyCB(const AmdCB& cb,
- const TraceLevelsPtr& traceLevels,
- const string& id,
- const Ice::ObjectPrx& proxy) :
- _cb(cb), _traceLevels(traceLevels), _id(id), _proxy(proxy)
+ const TraceLevelsPtr& traceLevels,
+ const string& id,
+ const Ice::ObjectPrx& proxy) :
+ _cb(cb), _traceLevels(traceLevels), _id(id), _proxy(proxy)
{
}
virtual void ice_response()
{
- if(_traceLevels->locator > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
- out << "registered adapter `" << _id << "' endpoints: `";
- out << (_proxy ? _proxy->ice_toString() : string("")) << "'";
- }
- _cb->ice_response();
+ if(_traceLevels->locator > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
+ out << "registered adapter `" << _id << "' endpoints: `";
+ out << (_proxy ? _proxy->ice_toString() : string("")) << "'";
+ }
+ _cb->ice_response();
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- if(_traceLevels->locator > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
- out << "failed to register adapter `" << _id << "' endpoints:\n" << ex;
- }
-
- try
- {
- ex.ice_throw();
- }
- catch(const AdapterActiveException&)
- {
- _cb->ice_exception(Ice::AdapterAlreadyActiveException());
- return;
- }
- catch(const Ice::ObjectNotExistException&)
- {
- _cb->ice_exception(Ice::AdapterNotFoundException()); // Expected if the adapter was destroyed.
- return;
- }
- catch(const Ice::LocalException&)
- {
- _cb->ice_exception(Ice::AdapterNotFoundException());
- return;
- }
+ if(_traceLevels->locator > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
+ out << "failed to register adapter `" << _id << "' endpoints:\n" << ex;
+ }
+
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const AdapterActiveException&)
+ {
+ _cb->ice_exception(Ice::AdapterAlreadyActiveException());
+ return;
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ _cb->ice_exception(Ice::AdapterNotFoundException()); // Expected if the adapter was destroyed.
+ return;
+ }
+ catch(const Ice::LocalException&)
+ {
+ _cb->ice_exception(Ice::AdapterNotFoundException());
+ return;
+ }
- assert(false);
+ assert(false);
}
private:
@@ -93,49 +93,49 @@ class AMI_Server_setProcessI : public AMI_Server_setProcess
public:
AMI_Server_setProcessI(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr& cb,
- const TraceLevelsPtr& traceLevels,
- const string& id,
- const Ice::ObjectPrx& proxy) :
- _cb(cb), _traceLevels(traceLevels), _id(id), _proxy(proxy)
+ const TraceLevelsPtr& traceLevels,
+ const string& id,
+ const Ice::ObjectPrx& proxy) :
+ _cb(cb), _traceLevels(traceLevels), _id(id), _proxy(proxy)
{
}
virtual void ice_response()
{
- if(_traceLevels->locator > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
- out << "registered server `" << _id << "' process proxy: `";
- out << (_proxy ? _proxy->ice_toString() : string("")) << "'";
- }
- _cb->ice_response();
+ if(_traceLevels->locator > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
+ out << "registered server `" << _id << "' process proxy: `";
+ out << (_proxy ? _proxy->ice_toString() : string("")) << "'";
+ }
+ _cb->ice_response();
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- if(_traceLevels->locator > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
- out << "failed to register server process proxy `" << _id << "':\n" << ex;
- }
+ if(_traceLevels->locator > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->locatorCat);
+ out << "failed to register server process proxy `" << _id << "':\n" << ex;
+ }
- try
- {
- ex.ice_throw();
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected if the server was destroyed.
- _cb->ice_exception(Ice::ServerNotFoundException());
- return;
- }
- catch(const Ice::LocalException&)
- {
- _cb->ice_exception(Ice::ServerNotFoundException());
- return;
- }
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected if the server was destroyed.
+ _cb->ice_exception(Ice::ServerNotFoundException());
+ return;
+ }
+ catch(const Ice::LocalException&)
+ {
+ _cb->ice_exception(Ice::ServerNotFoundException());
+ return;
+ }
- assert(false);
+ assert(false);
}
private:
@@ -149,9 +149,9 @@ private:
};
LocatorRegistryI::LocatorRegistryI(const DatabasePtr& database,
- bool dynamicRegistration,
- bool master,
- ReplicaSessionManager& session) :
+ bool dynamicRegistration,
+ bool master,
+ ReplicaSessionManager& session) :
_database(database),
_dynamicRegistration(dynamicRegistration),
_master(master),
@@ -161,14 +161,14 @@ LocatorRegistryI::LocatorRegistryI(const DatabasePtr& database,
void
LocatorRegistryI::setAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setAdapterDirectProxyPtr& cb,
- const string& adapterId,
- const Ice::ObjectPrx& proxy,
- const Ice::Current&)
+ const string& adapterId,
+ const Ice::ObjectPrx& proxy,
+ const Ice::Current&)
{
setAdapterDirectProxy(newSetDirectProxyCB(cb, _database->getTraceLevels(), adapterId, proxy),
- adapterId,
- "",
- proxy);
+ adapterId,
+ "",
+ proxy);
}
void
@@ -180,140 +180,140 @@ LocatorRegistryI::setReplicatedAdapterDirectProxy_async(
const Ice::Current&)
{
setAdapterDirectProxy(newSetDirectProxyCB(cb, _database->getTraceLevels(), adapterId, proxy),
- adapterId,
- replicaGroupId,
- proxy);
+ adapterId,
+ replicaGroupId,
+ proxy);
}
void
LocatorRegistryI::setServerProcessProxy_async(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr& cb,
- const string& id,
- const Ice::ProcessPrx& proxy,
- const Ice::Current&)
+ const string& id,
+ const Ice::ProcessPrx& proxy,
+ const Ice::Current&)
{
try
{
//
// Get the server from the registry and set its process proxy.
//
- // NOTE: We pass false to the getServer call to indicate that
- // we don't necessarily want an up-to-date adapter proxy. This
- // is needed for the session activation mode for cases where
- // the server is released during the server startup.
- //
- AMI_Server_setProcessPtr amiCB = new AMI_Server_setProcessI(cb, _database->getTraceLevels(), id, proxy);
+ // NOTE: We pass false to the getServer call to indicate that
+ // we don't necessarily want an up-to-date adapter proxy. This
+ // is needed for the session activation mode for cases where
+ // the server is released during the server startup.
+ //
+ AMI_Server_setProcessPtr amiCB = new AMI_Server_setProcessI(cb, _database->getTraceLevels(), id, proxy);
_database->getServer(id)->getProxy(false)->setProcess_async(amiCB, proxy);
}
catch(const ServerNotExistException&)
{
- cb->ice_exception(Ice::ServerNotFoundException());
+ cb->ice_exception(Ice::ServerNotFoundException());
}
catch(const Ice::Exception& ex)
{
- const TraceLevelsPtr traceLevels = _database->getTraceLevels();
- if(traceLevels->locator > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
- out << "couldn't register server `" << id << "' process proxy:\n" << toString(ex);
- }
- cb->ice_exception(Ice::ServerNotFoundException());
+ const TraceLevelsPtr traceLevels = _database->getTraceLevels();
+ if(traceLevels->locator > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
+ out << "couldn't register server `" << id << "' process proxy:\n" << toString(ex);
+ }
+ cb->ice_exception(Ice::ServerNotFoundException());
}
}
void
LocatorRegistryI::setAdapterDirectProxy(const AMI_Adapter_setDirectProxyPtr& amiCB,
- const string& adapterId,
- const string& replicaGroupId,
- const Ice::ObjectPrx& proxy)
+ const string& adapterId,
+ const string& replicaGroupId,
+ const Ice::ObjectPrx& proxy)
{
int nRetry = 5;
do
{
- try
- {
- //
- // Get the adapter from the registry and set its direct proxy.
- //
- ServerAdapterEntryPtr adapter = ServerAdapterEntryPtr::dynamicCast(_database->getAdapter(adapterId));
- if(!adapter)
- {
- throw Ice::AdapterNotFoundException();
- }
- adapter->getProxy(replicaGroupId, false)->setDirectProxy_async(amiCB, proxy);
- return;
- }
- catch(const AdapterNotExistException&)
- {
- if(!_dynamicRegistration)
- {
- throw Ice::AdapterNotFoundException();
- }
- }
- catch(const Ice::Exception& ex)
- {
- const TraceLevelsPtr traceLevels = _database->getTraceLevels();
- if(traceLevels->locator > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
- out << "couldn't register adapter `" << adapterId << "' endpoints:\n" << toString(ex);
- }
- throw Ice::AdapterNotFoundException();
- }
-
- assert(_dynamicRegistration);
- if(_master)
- {
- try
- {
- _database->setAdapterDirectProxy(adapterId, replicaGroupId, proxy);
- amiCB->ice_response();
- return;
- }
- catch(const AdapterExistsException&)
- {
- // Continue
- }
- }
- else
- {
- ReplicaSessionPrx session = _session.getSession();
- if(!session)
- {
- const TraceLevelsPtr traceLevels = _database->getTraceLevels();
- if(traceLevels->locator > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
- out << "couldn't register adapter `" << adapterId << "' endpoints with master:\n";
- out << "no session established with the master";
- }
- throw Ice::AdapterNotFoundException();
- }
+ try
+ {
+ //
+ // Get the adapter from the registry and set its direct proxy.
+ //
+ ServerAdapterEntryPtr adapter = ServerAdapterEntryPtr::dynamicCast(_database->getAdapter(adapterId));
+ if(!adapter)
+ {
+ throw Ice::AdapterNotFoundException();
+ }
+ adapter->getProxy(replicaGroupId, false)->setDirectProxy_async(amiCB, proxy);
+ return;
+ }
+ catch(const AdapterNotExistException&)
+ {
+ if(!_dynamicRegistration)
+ {
+ throw Ice::AdapterNotFoundException();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ const TraceLevelsPtr traceLevels = _database->getTraceLevels();
+ if(traceLevels->locator > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
+ out << "couldn't register adapter `" << adapterId << "' endpoints:\n" << toString(ex);
+ }
+ throw Ice::AdapterNotFoundException();
+ }
+
+ assert(_dynamicRegistration);
+ if(_master)
+ {
+ try
+ {
+ _database->setAdapterDirectProxy(adapterId, replicaGroupId, proxy);
+ amiCB->ice_response();
+ return;
+ }
+ catch(const AdapterExistsException&)
+ {
+ // Continue
+ }
+ }
+ else
+ {
+ ReplicaSessionPrx session = _session.getSession();
+ if(!session)
+ {
+ const TraceLevelsPtr traceLevels = _database->getTraceLevels();
+ if(traceLevels->locator > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
+ out << "couldn't register adapter `" << adapterId << "' endpoints with master:\n";
+ out << "no session established with the master";
+ }
+ throw Ice::AdapterNotFoundException();
+ }
- try
- {
- session->setAdapterDirectProxy(adapterId, replicaGroupId, proxy);
- amiCB->ice_response();
- return;
- }
- catch(const AdapterExistsException&)
- {
- // Continue
- }
- catch(const AdapterNotExistException&)
- {
- throw Ice::AdapterNotFoundException(); // Dynamic registration not allowed on the master.
- }
- catch(const Ice::LocalException& ex)
- {
- const TraceLevelsPtr traceLevels = _database->getTraceLevels();
- if(traceLevels->locator > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
- out << "couldn't register adapter `" << adapterId << "' endpoints with master:\n" << toString(ex);
- }
- throw Ice::AdapterNotFoundException();
- }
- }
+ try
+ {
+ session->setAdapterDirectProxy(adapterId, replicaGroupId, proxy);
+ amiCB->ice_response();
+ return;
+ }
+ catch(const AdapterExistsException&)
+ {
+ // Continue
+ }
+ catch(const AdapterNotExistException&)
+ {
+ throw Ice::AdapterNotFoundException(); // Dynamic registration not allowed on the master.
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ const TraceLevelsPtr traceLevels = _database->getTraceLevels();
+ if(traceLevels->locator > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->locatorCat);
+ out << "couldn't register adapter `" << adapterId << "' endpoints with master:\n" << toString(ex);
+ }
+ throw Ice::AdapterNotFoundException();
+ }
+ }
}
while(nRetry-- > 0);
throw Ice::AdapterNotFoundException();
diff --git a/cpp/src/IceGrid/LocatorRegistryI.h b/cpp/src/IceGrid/LocatorRegistryI.h
index 51ed4319109..58139160106 100644
--- a/cpp/src/IceGrid/LocatorRegistryI.h
+++ b/cpp/src/IceGrid/LocatorRegistryI.h
@@ -28,19 +28,19 @@ public:
LocatorRegistryI(const DatabasePtr&, bool, bool, ReplicaSessionManager&);
virtual void setAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setAdapterDirectProxyPtr&,
- const std::string&, const Ice::ObjectPrx&, const Ice::Current&);
+ const std::string&, const Ice::ObjectPrx&, const Ice::Current&);
virtual void setReplicatedAdapterDirectProxy_async(
- const Ice::AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr&, const std::string&, const std::string&,
- const Ice::ObjectPrx&, const Ice::Current&);
+ const Ice::AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr&, const std::string&, const std::string&,
+ const Ice::ObjectPrx&, const Ice::Current&);
virtual void setServerProcessProxy_async(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr&,
- const ::std::string&, const ::Ice::ProcessPrx&, const ::Ice::Current&);
+ const ::std::string&, const ::Ice::ProcessPrx&, const ::Ice::Current&);
private:
void setAdapterDirectProxy(const AMI_Adapter_setDirectProxyPtr&, const std::string&, const std::string&,
- const Ice::ObjectPrx&);
+ const Ice::ObjectPrx&);
const DatabasePtr _database;
const bool _dynamicRegistration;
diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp
index 63e23ea919c..a431b527712 100644
--- a/cpp/src/IceGrid/NodeCache.cpp
+++ b/cpp/src/IceGrid/NodeCache.cpp
@@ -29,107 +29,107 @@ namespace IceGrid
struct ToInternalServerDescriptor : std::unary_function<CommunicatorDescriptorPtr&, void>
{
ToInternalServerDescriptor(const InternalServerDescriptorPtr& descriptor, const InternalNodeInfoPtr& node) :
- _desc(descriptor),
- _node(node)
+ _desc(descriptor),
+ _node(node)
{
}
void
operator()(const CommunicatorDescriptorPtr& desc)
{
- //
- // Figure out the configuration file name for the communicator
- // (if it's a service, it's "config_<service name>", if it's
- // the server, it's just "config").
- //
- string filename = "config";
- ServiceDescriptorPtr svc = ServiceDescriptorPtr::dynamicCast(desc);
- if(svc)
- {
- filename += "_" + svc->name;
- }
- PropertyDescriptorSeq& props = _desc->properties[filename];
-
- PropertyDescriptorSeq communicatorProps = desc->propertySet.properties;
-
- //
- // Add the adapters and their configuration.
- //
- for(AdapterDescriptorSeq::const_iterator q = desc->adapters.begin(); q != desc->adapters.end(); ++q)
- {
- _desc->adapters.push_back(new InternalAdapterDescriptor(q->id, q->serverLifetime));
-
- props.push_back(createProperty("# Object adapter " + q->name));
- PropertyDescriptor prop = removeProperty(communicatorProps, "Ice.OA." + q->name + ".Endpoints");
- prop.name = "Ice.OA." + q->name + ".Endpoints";
- props.push_back(prop);
- props.push_back(createProperty("Ice.OA." + q->name + ".AdapterId", q->id));
- if(!q->replicaGroupId.empty())
- {
- props.push_back(createProperty("Ice.OA." + q->name + ".ReplicaGroupId", q->replicaGroupId));
- }
- if(q->registerProcess)
- {
- props.push_back(createProperty("Ice.OA." + q->name + ".RegisterProcess", "1"));
- _desc->processRegistered = true;
- }
- }
-
- _desc->logs.insert(_desc->logs.end(), desc->logs.begin(), desc->logs.end());
-
- const string dbsPath = _node->dataDir + "/servers/" + _desc->id + "/dbs/";
- for(DbEnvDescriptorSeq::const_iterator p = desc->dbEnvs.begin(); p != desc->dbEnvs.end(); ++p)
- {
- props.push_back(createProperty("# Database environment " + p->name));
- if(p->dbHome.empty())
- {
- _desc->dbEnvs.push_back(new InternalDbEnvDescriptor(p->name, p->properties));
- props.push_back(createProperty("Freeze.DbEnv." + p->name + ".DbHome", dbsPath + p->name));
- }
- else
- {
- props.push_back(createProperty("Freeze.DbEnv." + p->name + ".DbHome", p->dbHome));
- }
- }
-
- //
- // Copy the communicator descriptor properties.
- //
- if(!communicatorProps.empty())
- {
- if(svc)
- {
- props.push_back(createProperty("# Service descriptor properties"));
- }
- else
- {
- props.push_back(createProperty("# Server descriptor properties"));
- }
- copy(communicatorProps.begin(), communicatorProps.end(), back_inserter(props));
- }
+ //
+ // Figure out the configuration file name for the communicator
+ // (if it's a service, it's "config_<service name>", if it's
+ // the server, it's just "config").
+ //
+ string filename = "config";
+ ServiceDescriptorPtr svc = ServiceDescriptorPtr::dynamicCast(desc);
+ if(svc)
+ {
+ filename += "_" + svc->name;
+ }
+ PropertyDescriptorSeq& props = _desc->properties[filename];
+
+ PropertyDescriptorSeq communicatorProps = desc->propertySet.properties;
+
+ //
+ // Add the adapters and their configuration.
+ //
+ for(AdapterDescriptorSeq::const_iterator q = desc->adapters.begin(); q != desc->adapters.end(); ++q)
+ {
+ _desc->adapters.push_back(new InternalAdapterDescriptor(q->id, q->serverLifetime));
+
+ props.push_back(createProperty("# Object adapter " + q->name));
+ PropertyDescriptor prop = removeProperty(communicatorProps, "Ice.OA." + q->name + ".Endpoints");
+ prop.name = "Ice.OA." + q->name + ".Endpoints";
+ props.push_back(prop);
+ props.push_back(createProperty("Ice.OA." + q->name + ".AdapterId", q->id));
+ if(!q->replicaGroupId.empty())
+ {
+ props.push_back(createProperty("Ice.OA." + q->name + ".ReplicaGroupId", q->replicaGroupId));
+ }
+ if(q->registerProcess)
+ {
+ props.push_back(createProperty("Ice.OA." + q->name + ".RegisterProcess", "1"));
+ _desc->processRegistered = true;
+ }
+ }
+
+ _desc->logs.insert(_desc->logs.end(), desc->logs.begin(), desc->logs.end());
+
+ const string dbsPath = _node->dataDir + "/servers/" + _desc->id + "/dbs/";
+ for(DbEnvDescriptorSeq::const_iterator p = desc->dbEnvs.begin(); p != desc->dbEnvs.end(); ++p)
+ {
+ props.push_back(createProperty("# Database environment " + p->name));
+ if(p->dbHome.empty())
+ {
+ _desc->dbEnvs.push_back(new InternalDbEnvDescriptor(p->name, p->properties));
+ props.push_back(createProperty("Freeze.DbEnv." + p->name + ".DbHome", dbsPath + p->name));
+ }
+ else
+ {
+ props.push_back(createProperty("Freeze.DbEnv." + p->name + ".DbHome", p->dbHome));
+ }
+ }
+
+ //
+ // Copy the communicator descriptor properties.
+ //
+ if(!communicatorProps.empty())
+ {
+ if(svc)
+ {
+ props.push_back(createProperty("# Service descriptor properties"));
+ }
+ else
+ {
+ props.push_back(createProperty("# Server descriptor properties"));
+ }
+ copy(communicatorProps.begin(), communicatorProps.end(), back_inserter(props));
+ }
}
PropertyDescriptor
removeProperty(PropertyDescriptorSeq& properties, const string& name)
{
- string value;
- PropertyDescriptorSeq::iterator p = properties.begin();
- while(p != properties.end())
- {
- if(p->name == name)
- {
- value = p->value;
- p = properties.erase(p);
- }
- else
- {
- ++p;
- }
- }
- PropertyDescriptor desc;
- desc.name = name;
- desc.value = value;
- return desc;
+ string value;
+ PropertyDescriptorSeq::iterator p = properties.begin();
+ while(p != properties.end())
+ {
+ if(p->name == name)
+ {
+ value = p->value;
+ p = properties.erase(p);
+ }
+ else
+ {
+ ++p;
+ }
+ }
+ PropertyDescriptor desc;
+ desc.name = name;
+ desc.value = value;
+ return desc;
}
InternalServerDescriptorPtr _desc;
@@ -141,60 +141,60 @@ class LoadCB : public AMI_Node_loadServer
public:
LoadCB(const TraceLevelsPtr& traceLevels,
- const ServerEntryPtr& server,
- const string& node,
- int timeout) :
- _traceLevels(traceLevels), _server(server), _id(server->getId()), _node(node), _timeout(timeout)
+ const ServerEntryPtr& server,
+ const string& node,
+ int timeout) :
+ _traceLevels(traceLevels), _server(server), _id(server->getId()), _node(node), _timeout(timeout)
{
}
void
ice_response(const ServerPrx& server, const AdapterPrxDict& adapters, int at, int dt)
{
- if(_traceLevels && _traceLevels->server > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "loaded `" << _id << "' on node `" << _node << "'";
- }
+ if(_traceLevels && _traceLevels->server > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ out << "loaded `" << _id << "' on node `" << _node << "'";
+ }
- //
- // Add the node session timeout on the proxies to ensure the
- // timeout is large enough.
- //
- _server->loadCallback(server, adapters, at + _timeout, dt + _timeout);
+ //
+ // Add the node session timeout on the proxies to ensure the
+ // timeout is large enough.
+ //
+ _server->loadCallback(server, adapters, at + _timeout, dt + _timeout);
}
void
ice_exception(const Ice::Exception& ex)
{
- try
- {
- ex.ice_throw();
- }
- catch(const DeploymentException& ex)
- {
- if(_traceLevels && _traceLevels->server > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "couldn't load `" << _id << "' on node `" << _node << "':\n" << ex.reason;
- }
-
- ostringstream os;
- os << "couldn't load `" << _id << "' on node `" << _node << "':\n" << ex.reason;
- _server->exception(DeploymentException(os.str()));
- }
- catch(const Ice::Exception& ex)
- {
- if(_traceLevels && _traceLevels->server > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "couldn't load `" << _id << "' on node `" << _node << "':\n" << ex;
- }
-
- ostringstream os;
- os << ex;
- _server->exception(NodeUnreachableException(_node, os.str()));
- }
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const DeploymentException& ex)
+ {
+ if(_traceLevels && _traceLevels->server > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ out << "couldn't load `" << _id << "' on node `" << _node << "':\n" << ex.reason;
+ }
+
+ ostringstream os;
+ os << "couldn't load `" << _id << "' on node `" << _node << "':\n" << ex.reason;
+ _server->exception(DeploymentException(os.str()));
+ }
+ catch(const Ice::Exception& ex)
+ {
+ if(_traceLevels && _traceLevels->server > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ out << "couldn't load `" << _id << "' on node `" << _node << "':\n" << ex;
+ }
+
+ ostringstream os;
+ os << ex;
+ _server->exception(NodeUnreachableException(_node, os.str()));
+ }
}
private:
@@ -211,51 +211,51 @@ class DestroyCB : public AMI_Node_destroyServer
public:
DestroyCB(const TraceLevelsPtr& traceLevels, const ServerEntryPtr& server, const string& node) :
- _traceLevels(traceLevels), _server(server), _id(server->getId()), _node(node)
+ _traceLevels(traceLevels), _server(server), _id(server->getId()), _node(node)
{
}
void
ice_response()
{
- if(_traceLevels && _traceLevels->server > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "unloaded `" << _id << "' on node `" << _node << "'";
- }
- _server->destroyCallback();
+ if(_traceLevels && _traceLevels->server > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ out << "unloaded `" << _id << "' on node `" << _node << "'";
+ }
+ _server->destroyCallback();
}
void
ice_exception(const Ice::Exception& ex)
{
- try
- {
- ex.ice_throw();
- }
- catch(const DeploymentException& ex)
- {
- if(_traceLevels && _traceLevels->server > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex.reason;
- }
-
- ostringstream os;
- os << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex.reason;
- _server->exception(DeploymentException(os.str()));
- }
- catch(const Ice::Exception& ex)
- {
- if(_traceLevels && _traceLevels->server > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex;
- }
- ostringstream os;
- os << ex;
- _server->exception(NodeUnreachableException(_node, os.str()));
- }
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const DeploymentException& ex)
+ {
+ if(_traceLevels && _traceLevels->server > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ out << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex.reason;
+ }
+
+ ostringstream os;
+ os << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex.reason;
+ _server->exception(DeploymentException(os.str()));
+ }
+ catch(const Ice::Exception& ex)
+ {
+ if(_traceLevels && _traceLevels->server > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ out << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex;
+ }
+ ostringstream os;
+ os << ex;
+ _server->exception(NodeUnreachableException(_node, os.str()));
+ }
}
private:
@@ -277,13 +277,13 @@ public:
void
ice_response()
{
- _node->finishedRegistration();
+ _node->finishedRegistration();
}
void
ice_exception(const Ice::Exception& ex)
{
- _node->finishedRegistration(ex);
+ _node->finishedRegistration(ex);
}
private:
@@ -306,15 +306,15 @@ NodeCache::get(const string& name, bool create) const
NodeEntryPtr entry = getImpl(name);
if(!entry && create)
{
- NodeCache& self = const_cast<NodeCache&>(*this);
- entry = new NodeEntry(self, name);
- self.addImpl(name, entry);
+ NodeCache& self = const_cast<NodeCache&>(*this);
+ entry = new NodeEntry(self, name);
+ self.addImpl(name, entry);
}
if(!entry)
{
- NodeNotExistException ex;
- ex.name = name;
- throw ex;
+ NodeNotExistException ex;
+ ex.name = name;
+ throw ex;
}
return entry;
}
@@ -366,50 +366,50 @@ NodeEntry::setSession(const NodeSessionIPtr& session)
if(session)
{
- while(_session)
- {
- if(_session->isDestroyed())
- {
- // If the current session has just been destroyed, wait for the setSession(0) call.
- assert(session != _session);
- wait();
- }
- else
- {
- NodeSessionIPtr session = _session;
- sync.release();
- try
- {
- session->getNode()->ice_ping();
- throw NodeActiveException();
- }
- catch(const Ice::LocalException&)
- {
- try
- {
- session->destroy();
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- }
- sync.acquire();
- }
- }
-
- //
- // Clear the saved proxy, the node has established a session
- // so we won't need anymore to try to register it with this
- // registry.
- //
- _proxy = 0;
+ while(_session)
+ {
+ if(_session->isDestroyed())
+ {
+ // If the current session has just been destroyed, wait for the setSession(0) call.
+ assert(session != _session);
+ wait();
+ }
+ else
+ {
+ NodeSessionIPtr session = _session;
+ sync.release();
+ try
+ {
+ session->getNode()->ice_ping();
+ throw NodeActiveException();
+ }
+ catch(const Ice::LocalException&)
+ {
+ try
+ {
+ session->destroy();
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ }
+ sync.acquire();
+ }
+ }
+
+ //
+ // Clear the saved proxy, the node has established a session
+ // so we won't need anymore to try to register it with this
+ // registry.
+ //
+ _proxy = 0;
}
else
{
- if(!_session)
- {
- return;
- }
+ if(!_session)
+ {
+ return;
+ }
}
_session = session;
@@ -417,25 +417,25 @@ NodeEntry::setSession(const NodeSessionIPtr& session)
if(_registering)
{
- _registering = false;
- notifyAll();
+ _registering = false;
+ notifyAll();
}
if(session)
{
- if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
- {
- Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
- out << "node `" << _name << "' up";
- }
+ if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
+ {
+ Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
+ out << "node `" << _name << "' up";
+ }
}
else
{
- if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
- {
- Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
- out << "node `" << _name << "' down";
- }
+ if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
+ {
+ Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
+ out << "node `" << _name << "' down";
+ }
}
}
@@ -462,7 +462,7 @@ NodeEntry::getServers() const
ServerEntrySeq entries;
for(map<string, ServerEntryPtr>::const_iterator p = _servers.begin(); p != _servers.end(); ++p)
{
- entries.push_back(p->second);
+ entries.push_back(p->second);
}
return entries;
}
@@ -476,7 +476,7 @@ NodeEntry::getLoadInfoAndLoadFactor(const string& application, float& loadFactor
map<string, NodeDescriptor>::const_iterator p = _descriptors.find(application);
if(p == _descriptors.end())
{
- throw NodeNotExistException(); // The node doesn't exist in the given application.
+ throw NodeNotExistException(); // The node doesn't exist in the given application.
}
//
@@ -486,30 +486,30 @@ NodeEntry::getLoadInfoAndLoadFactor(const string& application, float& loadFactor
loadFactor = -1.0f;
if(!p->second.loadFactor.empty())
{
- istringstream is(p->second.loadFactor);
- is >> loadFactor;
+ istringstream is(p->second.loadFactor);
+ is >> loadFactor;
}
if(loadFactor < 0.0f)
{
- if(_session->getInfo()->os != "Windows")
- {
- //
- // On Unix platforms, we divide the load averages by the
- // number of processors. A load of 2 on a dual processor
- // machine is the same as a load of 1 on a single process
- // machine.
- //
- loadFactor = 1.0f / _session->getInfo()->nProcessors;
- }
- else
- {
- //
- // On Windows, load1, load5 and load15 are the average of
- // the CPU utilization (all CPUs). We don't need to divide
- // by the number of CPU.
- //
- loadFactor = 1.0f;
- }
+ if(_session->getInfo()->os != "Windows")
+ {
+ //
+ // On Unix platforms, we divide the load averages by the
+ // number of processors. A load of 2 on a dual processor
+ // machine is the same as a load of 1 on a single process
+ // machine.
+ //
+ loadFactor = 1.0f / _session->getInfo()->nProcessors;
+ }
+ else
+ {
+ //
+ // On Windows, load1, load5 and load15 are the average of
+ // the CPU utilization (all CPUs). We don't need to divide
+ // by the number of CPU.
+ //
+ loadFactor = 1.0f;
+ }
}
return _session->getLoadInfo();
@@ -535,60 +535,60 @@ NodeEntry::loadServer(const ServerEntryPtr& entry, const ServerInfo& server, con
{
try
{
- NodePrx node;
- int sessionTimeout;
- InternalServerDescriptorPtr desc;
- {
- Lock sync(*this);
- checkSession();
- node = _session->getNode();
- sessionTimeout = _session->getTimeout();
-
- //
- // Check if we should use a specific timeout (the load
- // call can deactivate the server and it can take some
- // time to deactivate, up to "deactivation-timeout"
- // seconds).
- //
- if(timeout > 0)
- {
- node = NodePrx::uncheckedCast(node->ice_timeout(timeout * 1000));
- }
-
- ServerInfo info = server;
- try
- {
- info.descriptor = getServerDescriptor(server, session);
- }
- catch(const DeploymentException&)
- {
- //
- // We ignore the deployment error for now (which can
- // only be caused in theory by session variables not
- // being defined because the server isn't
- // allocated...)
- //
- }
- desc = getInternalServerDescriptor(info);
- }
- assert(desc);
-
- if(_cache.getTraceLevels() && _cache.getTraceLevels()->server > 2)
- {
- Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->serverCat);
- out << "loading `" << desc->id << "' on node `" << _name << "'";
- if(session)
- {
- out << " for session `" << session->getId() << "'";
- }
- }
-
- AMI_Node_loadServerPtr amiCB = new LoadCB(_cache.getTraceLevels(), entry, _name, sessionTimeout);
- node->loadServer_async(amiCB, desc, _cache.getReplicaName());
+ NodePrx node;
+ int sessionTimeout;
+ InternalServerDescriptorPtr desc;
+ {
+ Lock sync(*this);
+ checkSession();
+ node = _session->getNode();
+ sessionTimeout = _session->getTimeout();
+
+ //
+ // Check if we should use a specific timeout (the load
+ // call can deactivate the server and it can take some
+ // time to deactivate, up to "deactivation-timeout"
+ // seconds).
+ //
+ if(timeout > 0)
+ {
+ node = NodePrx::uncheckedCast(node->ice_timeout(timeout * 1000));
+ }
+
+ ServerInfo info = server;
+ try
+ {
+ info.descriptor = getServerDescriptor(server, session);
+ }
+ catch(const DeploymentException&)
+ {
+ //
+ // We ignore the deployment error for now (which can
+ // only be caused in theory by session variables not
+ // being defined because the server isn't
+ // allocated...)
+ //
+ }
+ desc = getInternalServerDescriptor(info);
+ }
+ assert(desc);
+
+ if(_cache.getTraceLevels() && _cache.getTraceLevels()->server > 2)
+ {
+ Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->serverCat);
+ out << "loading `" << desc->id << "' on node `" << _name << "'";
+ if(session)
+ {
+ out << " for session `" << session->getId() << "'";
+ }
+ }
+
+ AMI_Node_loadServerPtr amiCB = new LoadCB(_cache.getTraceLevels(), entry, _name, sessionTimeout);
+ node->loadServer_async(amiCB, desc, _cache.getReplicaName());
}
catch(const NodeUnreachableException& ex)
{
- entry->exception(ex);
+ entry->exception(ex);
}
}
@@ -597,36 +597,36 @@ NodeEntry::destroyServer(const ServerEntryPtr& entry, const ServerInfo& info, in
{
try
{
- NodePrx node;
- {
- Lock sync(*this);
- checkSession();
- node = _session->getNode();
-
- //
- // Check if we should use a specific timeout (the load
- // call can deactivate the server and it can take some
- // time to deactivate, up to "deactivation-timeout"
- // seconds).
- //
- if(timeout > 0)
- {
- node = NodePrx::uncheckedCast(node->ice_timeout(timeout * 1000));
- }
- }
-
- if(_cache.getTraceLevels() && _cache.getTraceLevels()->server > 2)
- {
- Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->serverCat);
- out << "unloading `" << info.descriptor->id << "' on node `" << _name << "'";
- }
-
- AMI_Node_destroyServerPtr amiCB = new DestroyCB(_cache.getTraceLevels(), entry, _name);
- node->destroyServer_async(amiCB, info.descriptor->id, info.uuid, info.revision, _cache.getReplicaName());
+ NodePrx node;
+ {
+ Lock sync(*this);
+ checkSession();
+ node = _session->getNode();
+
+ //
+ // Check if we should use a specific timeout (the load
+ // call can deactivate the server and it can take some
+ // time to deactivate, up to "deactivation-timeout"
+ // seconds).
+ //
+ if(timeout > 0)
+ {
+ node = NodePrx::uncheckedCast(node->ice_timeout(timeout * 1000));
+ }
+ }
+
+ if(_cache.getTraceLevels() && _cache.getTraceLevels()->server > 2)
+ {
+ Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->serverCat);
+ out << "unloading `" << info.descriptor->id << "' on node `" << _name << "'";
+ }
+
+ AMI_Node_destroyServerPtr amiCB = new DestroyCB(_cache.getTraceLevels(), entry, _name);
+ node->destroyServer_async(amiCB, info.descriptor->id, info.uuid, info.revision, _cache.getReplicaName());
}
catch(const NodeUnreachableException& ex)
{
- entry->exception(ex);
+ entry->exception(ex);
}
}
@@ -654,18 +654,18 @@ NodeEntry::getServerDescriptor(const ServerInfo& server, const SessionIPtr& sess
if(session)
{
- resolve.setReserved("session.id", session->getId());
+ resolve.setReserved("session.id", session->getId());
}
IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(server.descriptor);
if(iceBox)
{
- return IceBoxHelper(iceBox).instantiate(resolve, PropertyDescriptorSeq(), PropertySetDescriptorDict());
+ return IceBoxHelper(iceBox).instantiate(resolve, PropertyDescriptorSeq(), PropertySetDescriptorDict());
}
else
{
- return ServerHelper(server.descriptor).instantiate(resolve, PropertyDescriptorSeq(),
- PropertySetDescriptorDict());
+ return ServerHelper(server.descriptor).instantiate(resolve, PropertyDescriptorSeq(),
+ PropertySetDescriptorDict());
}
}
@@ -691,28 +691,28 @@ NodeEntry::__decRef()
bool doRemove = false;
bool doDelete = false;
{
- Lock sync(*this); // We use a recursive mutex so it's fine to
- // create Ptr with the mutex locked.
- assert(_ref > 0);
- --_ref;
-
- if(_ref == 1)
- {
- doRemove = canRemove();
- }
- else if(_ref == 0)
- {
- doDelete = true;
- }
+ Lock sync(*this); // We use a recursive mutex so it's fine to
+ // create Ptr with the mutex locked.
+ assert(_ref > 0);
+ --_ref;
+
+ if(_ref == 1)
+ {
+ doRemove = canRemove();
+ }
+ else if(_ref == 0)
+ {
+ doDelete = true;
+ }
}
if(doRemove)
{
- _cache.remove(_name);
+ _cache.remove(_name);
}
else if(doDelete)
{
- delete this;
+ delete this;
}
}
@@ -721,45 +721,45 @@ NodeEntry::checkSession() const
{
if(_session && !_session->isDestroyed())
{
- return;
+ return;
}
else if(!_proxy && !_registering)
{
- throw NodeUnreachableException(_name, "the node is not active");
+ throw NodeUnreachableException(_name, "the node is not active");
}
else if(_proxy)
{
- //
- // If the node proxy is set, we attempt to get the node to
- // register with this registry.
- //
- assert(!_registering);
-
- if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
- {
- Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
- out << "creating node `" << _name << "' session";
- }
-
- //
- // NOTE: setting _registering to true must be done before the
- // call otherwise if the callback is call immediately we'll
- // hang in the while loop.
- //
- _registering = true;
- NodeEntry* self = const_cast<NodeEntry*>(this);
- _proxy->registerWithReplica_async(new RegisterCB(self), _cache.getReplicaCache().getInternalRegistry());
- _proxy = 0; // Registration with the proxy is only attempted once.
+ //
+ // If the node proxy is set, we attempt to get the node to
+ // register with this registry.
+ //
+ assert(!_registering);
+
+ if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
+ {
+ Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
+ out << "creating node `" << _name << "' session";
+ }
+
+ //
+ // NOTE: setting _registering to true must be done before the
+ // call otherwise if the callback is call immediately we'll
+ // hang in the while loop.
+ //
+ _registering = true;
+ NodeEntry* self = const_cast<NodeEntry*>(this);
+ _proxy->registerWithReplica_async(new RegisterCB(self), _cache.getReplicaCache().getInternalRegistry());
+ _proxy = 0; // Registration with the proxy is only attempted once.
}
while(_registering)
{
- wait();
+ wait();
}
if(!_session)
{
- throw NodeUnreachableException(_name, "the node is not active");
+ throw NodeUnreachableException(_name, "the node is not active");
}
}
@@ -776,7 +776,7 @@ NodeEntry::setProxy(const NodePrx& node)
//
if(!_session)
{
- _proxy = node;
+ _proxy = node;
}
}
@@ -786,21 +786,21 @@ NodeEntry::finishedRegistration()
Lock sync(*this);
if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
{
- Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
- if(_session)
- {
- out << "node `" << _name << "' session created";
- }
- else
- {
- out << "node `" << _name << "' session creation failed";
- }
+ Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
+ if(_session)
+ {
+ out << "node `" << _name << "' session created";
+ }
+ else
+ {
+ out << "node `" << _name << "' session creation failed";
+ }
}
if(_registering)
{
- _registering = false;
- notifyAll();
+ _registering = false;
+ notifyAll();
}
}
@@ -810,14 +810,14 @@ NodeEntry::finishedRegistration(const Ice::Exception& ex)
Lock sync(*this);
if(_cache.getTraceLevels() && _cache.getTraceLevels()->node > 0)
{
- Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
- out << "node `" << _name << "' session creation failed:\n" << ex;
+ Ice::Trace out(_cache.getTraceLevels()->logger, _cache.getTraceLevels()->nodeCat);
+ out << "node `" << _name << "' session creation failed:\n" << ex;
}
if(_registering)
{
- _registering = false;
- notifyAll();
+ _registering = false;
+ notifyAll();
}
}
@@ -840,17 +840,17 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const
server->deactivationTimeout = info.descriptor->deactivationTimeout;
if(!info.descriptor->iceVersion.empty())
{
- server->iceVersion = info.descriptor->iceVersion;
+ server->iceVersion = info.descriptor->iceVersion;
}
else
{
- server->iceVersion = string(ICE_STRING_VERSION);
+ server->iceVersion = string(ICE_STRING_VERSION);
}
server->applicationDistrib = info.descriptor->applicationDistrib;
if(!info.descriptor->distrib.icepatch.empty())
{
- server->distrib = new InternalDistributionDescriptor(info.descriptor->distrib.icepatch,
- info.descriptor->distrib.directories);
+ server->distrib = new InternalDistributionDescriptor(info.descriptor->distrib.icepatch,
+ info.descriptor->distrib.directories);
}
server->options = info.descriptor->options;
server->envs = info.descriptor->envs;
@@ -875,15 +875,15 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const
IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(info.descriptor);
if(iceBox)
{
- for(ServiceInstanceDescriptorSeq::const_iterator p = iceBox->services.begin(); p != iceBox->services.end();++p)
- {
- ServiceDescriptorPtr s = p->descriptor;
- const string path = _session->getInfo()->dataDir + "/servers/" + server->id + "/config/config_" + s->name;
- props.push_back(
- createProperty("IceBox.Service." + s->name, s->entry + " --Ice.Config=\"" + path + "\""));
- servicesStr += s->name + " ";
- }
- props.push_back(createProperty("IceBox.LoadOrder", servicesStr));
+ for(ServiceInstanceDescriptorSeq::const_iterator p = iceBox->services.begin(); p != iceBox->services.end();++p)
+ {
+ ServiceDescriptorPtr s = p->descriptor;
+ const string path = _session->getInfo()->dataDir + "/servers/" + server->id + "/config/config_" + s->name;
+ props.push_back(
+ createProperty("IceBox.Service." + s->name, s->entry + " --Ice.Config=\"" + path + "\""));
+ servicesStr += s->name + " ";
+ }
+ props.push_back(createProperty("IceBox.LoadOrder", servicesStr));
}
//
@@ -899,17 +899,17 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const
//
if(getMMVersion(server->iceVersion) < 30200)
{
- const string oaPrefix = "Ice.OA.";
- for(PropertyDescriptorSeqDict::iterator p = server->properties.begin(); p != server->properties.end(); ++p)
- {
- for(PropertyDescriptorSeq::iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- if(q->name.find(oaPrefix) == 0)
- {
- q->name = q->name.substr(oaPrefix.size());
- }
- }
- }
+ const string oaPrefix = "Ice.OA.";
+ for(PropertyDescriptorSeqDict::iterator p = server->properties.begin(); p != server->properties.end(); ++p)
+ {
+ for(PropertyDescriptorSeq::iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ if(q->name.find(oaPrefix) == 0)
+ {
+ q->name = q->name.substr(oaPrefix.size());
+ }
+ }
+ }
}
return server;
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp
index a1131fcae4c..4c3ca5c8c45 100644
--- a/cpp/src/IceGrid/NodeI.cpp
+++ b/cpp/src/IceGrid/NodeI.cpp
@@ -31,151 +31,151 @@ class LogPatcherFeedback : public IcePatch2::PatcherFeedback
public:
LogPatcherFeedback(const TraceLevelsPtr& traceLevels, const string& dest) :
- _traceLevels(traceLevels),
- _startedPatch(false),
- _lastProgress(0),
- _dest(dest)
+ _traceLevels(traceLevels),
+ _startedPatch(false),
+ _lastProgress(0),
+ _dest(dest)
{
}
void
setPatchingPath(const string& path)
{
- _path = path;
- _startedPatch = false;
- _lastProgress = 0;
+ _path = path;
+ _startedPatch = false;
+ _lastProgress = 0;
}
virtual bool
noFileSummary(const string& reason)
{
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": can't load summary file (will perform a thorough patch):\n" << reason;
- }
- return true;
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": can't load summary file (will perform a thorough patch):\n" << reason;
+ }
+ return true;
}
virtual bool
checksumStart()
{
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": started checksum calculation";
- }
- return true;
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": started checksum calculation";
+ }
+ return true;
}
virtual bool
checksumProgress(const string& path)
{
- if(_traceLevels->patch > 2)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": calculating checksum for " << getBasename(path);
- }
- return true;
+ if(_traceLevels->patch > 2)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": calculating checksum for " << getBasename(path);
+ }
+ return true;
}
virtual bool
checksumEnd()
{
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": finished checksum calculation";
- }
- return true;
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": finished checksum calculation";
+ }
+ return true;
}
virtual bool
fileListStart()
{
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": getting list of file to patch";
- }
- return true;
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": getting list of file to patch";
+ }
+ return true;
}
virtual bool
fileListProgress(Ice::Int percent)
{
- return true;
+ return true;
}
virtual bool
fileListEnd()
{
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": getting list of file to patch completed";
- }
- return true;
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": getting list of file to patch completed";
+ }
+ return true;
}
virtual bool
patchStart(const string& path, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize)
{
- if(_traceLevels->patch > 1 && totalSize > (1024 * 1024))
- {
- int progress = static_cast<int>(static_cast<double>(totalProgress) / totalSize * 100.0);
- progress /= 5;
- progress *= 5;
- if(progress != _lastProgress)
- {
- _lastProgress = progress;
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": downloaded " << progress << "% (" << totalProgress << '/' << totalSize << ')';
- if(!_path.empty())
- {
- out << " of " << _path;
- }
- }
- }
- else if(_traceLevels->patch > 0)
- {
- if(!_startedPatch)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- int roundedSize = static_cast<int>(static_cast<double>(totalSize) / 1024);
- if(roundedSize == 0 && totalSize > 0)
- {
- roundedSize = 1;
- }
- out << _dest << ": downloading " << (_path.empty() ? string("") : (_path + " ")) << roundedSize
- << "KB ";
- _startedPatch = true;
- }
- }
-
- return true;
+ if(_traceLevels->patch > 1 && totalSize > (1024 * 1024))
+ {
+ int progress = static_cast<int>(static_cast<double>(totalProgress) / totalSize * 100.0);
+ progress /= 5;
+ progress *= 5;
+ if(progress != _lastProgress)
+ {
+ _lastProgress = progress;
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": downloaded " << progress << "% (" << totalProgress << '/' << totalSize << ')';
+ if(!_path.empty())
+ {
+ out << " of " << _path;
+ }
+ }
+ }
+ else if(_traceLevels->patch > 0)
+ {
+ if(!_startedPatch)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ int roundedSize = static_cast<int>(static_cast<double>(totalSize) / 1024);
+ if(roundedSize == 0 && totalSize > 0)
+ {
+ roundedSize = 1;
+ }
+ out << _dest << ": downloading " << (_path.empty() ? string("") : (_path + " ")) << roundedSize
+ << "KB ";
+ _startedPatch = true;
+ }
+ }
+
+ return true;
}
virtual bool
patchProgress(Ice::Long progress, Ice::Long size, Ice::Long totalProgress, Ice::Long totalSize)
{
- return true;
+ return true;
}
virtual bool
patchEnd()
- {
- return true;
+ {
+ return true;
}
void
finishPatch()
{
- if(_traceLevels->patch > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << _dest << ": downloading completed";
- }
+ if(_traceLevels->patch > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << _dest << ": downloading completed";
+ }
}
private:
@@ -190,13 +190,13 @@ private:
}
NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter,
- NodeSessionManager& sessions,
- const ActivatorPtr& activator,
- const WaitQueuePtr& waitQueue,
- const TraceLevelsPtr& traceLevels,
- const NodePrx& proxy,
- const string& name,
- const UserAccountMapperPrx& mapper) :
+ NodeSessionManager& sessions,
+ const ActivatorPtr& activator,
+ const WaitQueuePtr& waitQueue,
+ const TraceLevelsPtr& traceLevels,
+ const NodePrx& proxy,
+ const string& name,
+ const UserAccountMapperPrx& mapper) :
_communicator(adapter->getCommunicator()),
_adapter(adapter),
_sessions(sessions),
@@ -229,32 +229,32 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter,
Ice::StringSeq propsAsArgs;
if(!props.empty())
{
- string::size_type end = 0;
- while(end != string::npos)
- {
- const string delim = " \t\r\n";
-
- string::size_type beg = props.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = props.find_first_of(delim, beg);
- string arg;
- if(end == string::npos)
- {
- arg = props.substr(beg);
- }
- else
- {
- arg = props.substr(beg, end - beg);
- }
-
- if(arg.find("--") == 0)
- {
- arg = arg.substr(2);
- }
+ string::size_type end = 0;
+ while(end != string::npos)
+ {
+ const string delim = " \t\r\n";
+
+ string::size_type beg = props.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = props.find_first_of(delim, beg);
+ string arg;
+ if(end == string::npos)
+ {
+ arg = props.substr(beg);
+ }
+ else
+ {
+ arg = props.substr(beg, end - beg);
+ }
+
+ if(arg.find("--") == 0)
+ {
+ arg = arg.substr(2);
+ }
//
// Extract the key/value
@@ -283,7 +283,7 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter,
}
_propertiesOverride.push_back(createProperty(key, value));
- }
+ }
}
}
@@ -293,274 +293,274 @@ NodeI::~NodeI()
void
NodeI::loadServer_async(const AMD_Node_loadServerPtr& amdCB,
- const InternalServerDescriptorPtr& descriptor,
- const string& replicaName,
- const Ice::Current& current)
+ const InternalServerDescriptorPtr& descriptor,
+ const string& replicaName,
+ const Ice::Current& current)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- ++_serial;
-
- Ice::Identity id = createServerIdentity(descriptor->id);
-
- //
- // Check if we already have a servant for this server. If that's
- // the case, the server is already loaded and we just need to
- // update it.
- //
- while(true)
- {
- bool added = false;
- ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(id));
- if(!server)
- {
- ServerPrx proxy = ServerPrx::uncheckedCast(_adapter->createProxy(id));
- server = new ServerI(this, proxy, _serversDir, descriptor->id, _waitTime);
- _adapter->add(server, id);
- added = true;
- }
-
- try
- {
- command = server->load(amdCB, descriptor, replicaName);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- assert(!added);
- continue;
- }
- catch(const Ice::Exception&)
- {
- if(added)
- {
- _adapter->remove(id);
- }
- throw;
- }
- break;
- }
+ Lock sync(*this);
+ ++_serial;
+
+ Ice::Identity id = createServerIdentity(descriptor->id);
+
+ //
+ // Check if we already have a servant for this server. If that's
+ // the case, the server is already loaded and we just need to
+ // update it.
+ //
+ while(true)
+ {
+ bool added = false;
+ ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(id));
+ if(!server)
+ {
+ ServerPrx proxy = ServerPrx::uncheckedCast(_adapter->createProxy(id));
+ server = new ServerI(this, proxy, _serversDir, descriptor->id, _waitTime);
+ _adapter->add(server, id);
+ added = true;
+ }
+
+ try
+ {
+ command = server->load(amdCB, descriptor, replicaName);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ assert(!added);
+ continue;
+ }
+ catch(const Ice::Exception&)
+ {
+ if(added)
+ {
+ _adapter->remove(id);
+ }
+ throw;
+ }
+ break;
+ }
}
if(command)
{
- command->execute();
+ command->execute();
}
}
void
NodeI::destroyServer_async(const AMD_Node_destroyServerPtr& amdCB,
- const string& serverId,
- const string& uuid,
- int revision,
- const string& replicaName,
- const Ice::Current& current)
+ const string& serverId,
+ const string& uuid,
+ int revision,
+ const string& replicaName,
+ const Ice::Current& current)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- ++_serial;
-
- ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(serverId)));
- if(!server)
- {
- server = new ServerI(this, 0, _serversDir, serverId, _waitTime);
- }
-
- //
- // Destroy the server object if it's loaded.
- //
- try
- {
- command = server->destroy(amdCB, uuid, revision, replicaName);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
+ Lock sync(*this);
+ ++_serial;
+
+ ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(serverId)));
+ if(!server)
+ {
+ server = new ServerI(this, 0, _serversDir, serverId, _waitTime);
+ }
+
+ //
+ // Destroy the server object if it's loaded.
+ //
+ try
+ {
+ command = server->destroy(amdCB, uuid, revision, replicaName);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
}
if(command)
{
- command->execute();
+ command->execute();
}
}
void
NodeI::patch_async(const AMD_Node_patchPtr& amdCB,
- const PatcherFeedbackPrx& feedback,
- const string& application,
- const string& server,
- const InternalDistributionDescriptorPtr& appDistrib,
- bool shutdown,
- const Ice::Current&)
+ const PatcherFeedbackPrx& feedback,
+ const string& application,
+ const string& server,
+ const InternalDistributionDescriptorPtr& appDistrib,
+ bool shutdown,
+ const Ice::Current&)
{
amdCB->ice_response();
{
- Lock sync(*this);
- while(_patchInProgress.find(application) != _patchInProgress.end())
- {
- wait();
- }
- _patchInProgress.insert(application);
+ Lock sync(*this);
+ while(_patchInProgress.find(application) != _patchInProgress.end())
+ {
+ wait();
+ }
+ _patchInProgress.insert(application);
}
set<ServerIPtr> servers;
if(!appDistrib->icepatch.empty())
{
- //
- // Get all the application servers (even the ones which
- // don't have a distribution since they depend on the
- // application distribution).
- //
- servers = getApplicationServers(application);
+ //
+ // Get all the application servers (even the ones which
+ // don't have a distribution since they depend on the
+ // application distribution).
+ //
+ servers = getApplicationServers(application);
}
else if(server.empty())
{
- //
- // Get all the application servers which have a distribution.
- //
- servers = getApplicationServers(application);
- set<ServerIPtr>::iterator s = servers.begin();
- while(s != servers.end())
- {
- if((*s)->getDistribution())
- {
- ++s;
- }
- else
- {
- servers.erase(s++);
- }
- }
+ //
+ // Get all the application servers which have a distribution.
+ //
+ servers = getApplicationServers(application);
+ set<ServerIPtr>::iterator s = servers.begin();
+ while(s != servers.end())
+ {
+ if((*s)->getDistribution())
+ {
+ ++s;
+ }
+ else
+ {
+ servers.erase(s++);
+ }
+ }
}
else
{
- //
- // Get the given server.
- //
- Ice::Identity id = createServerIdentity(server);
- ServerIPtr svr = ServerIPtr::dynamicCast(_adapter->find(id));
- if(svr)
- {
- servers.insert(svr);
- }
+ //
+ // Get the given server.
+ //
+ Ice::Identity id = createServerIdentity(server);
+ ServerIPtr svr = ServerIPtr::dynamicCast(_adapter->find(id));
+ if(svr)
+ {
+ servers.insert(svr);
+ }
}
string failure;
try
{
- set<ServerIPtr>::iterator s = servers.begin();
- vector<string> running;
- while(s != servers.end())
- {
- try
- {
- if(!(*s)->startPatch(shutdown))
- {
- running.push_back((*s)->getId());
- servers.erase(s++);
- }
- else
- {
- ++s;
- }
- }
- catch(const Ice::ObjectNotExistException&)
- {
- servers.erase(s++);
- }
- }
-
- if((servers.empty() || !appDistrib->icepatch.empty()) && !running.empty())
- {
- if(running.size() == 1)
- {
- throw "server `" + toString(running) + "' is active";
- }
- else
- {
- throw "servers `" + toString(running, ", ") + "' are active";
- }
- }
-
- for(s = servers.begin(); s != servers.end(); ++s)
- {
- (*s)->waitForPatch();
- }
-
- //
- // Patch the application.
- //
- FileServerPrx icepatch;
- if(!appDistrib->icepatch.empty())
- {
- icepatch = FileServerPrx::checkedCast(_communicator->stringToProxy(appDistrib->icepatch));
- if(!icepatch)
- {
- throw "proxy `" + appDistrib->icepatch + "' is not a file server.";
- }
- patch(icepatch, "distrib/" + application, appDistrib->directories);
- }
-
- //
- // Patch the server(s).
- //
- for(s = servers.begin(); s != servers.end(); ++s)
- {
- InternalDistributionDescriptorPtr dist = (*s)->getDistribution();
- if(!dist || (!server.empty() && (*s)->getId() != server))
- {
- continue;
- }
-
- icepatch = FileServerPrx::checkedCast(_communicator->stringToProxy(dist->icepatch));
- if(!icepatch)
- {
- throw "proxy `" + dist->icepatch + "' is not a file server.";
- }
- patch(icepatch, "servers/" + (*s)->getId() + "/distrib", dist->directories);
-
- if(!server.empty())
- {
- break;
- }
- }
+ set<ServerIPtr>::iterator s = servers.begin();
+ vector<string> running;
+ while(s != servers.end())
+ {
+ try
+ {
+ if(!(*s)->startPatch(shutdown))
+ {
+ running.push_back((*s)->getId());
+ servers.erase(s++);
+ }
+ else
+ {
+ ++s;
+ }
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ servers.erase(s++);
+ }
+ }
+
+ if((servers.empty() || !appDistrib->icepatch.empty()) && !running.empty())
+ {
+ if(running.size() == 1)
+ {
+ throw "server `" + toString(running) + "' is active";
+ }
+ else
+ {
+ throw "servers `" + toString(running, ", ") + "' are active";
+ }
+ }
+
+ for(s = servers.begin(); s != servers.end(); ++s)
+ {
+ (*s)->waitForPatch();
+ }
+
+ //
+ // Patch the application.
+ //
+ FileServerPrx icepatch;
+ if(!appDistrib->icepatch.empty())
+ {
+ icepatch = FileServerPrx::checkedCast(_communicator->stringToProxy(appDistrib->icepatch));
+ if(!icepatch)
+ {
+ throw "proxy `" + appDistrib->icepatch + "' is not a file server.";
+ }
+ patch(icepatch, "distrib/" + application, appDistrib->directories);
+ }
+
+ //
+ // Patch the server(s).
+ //
+ for(s = servers.begin(); s != servers.end(); ++s)
+ {
+ InternalDistributionDescriptorPtr dist = (*s)->getDistribution();
+ if(!dist || (!server.empty() && (*s)->getId() != server))
+ {
+ continue;
+ }
+
+ icepatch = FileServerPrx::checkedCast(_communicator->stringToProxy(dist->icepatch));
+ if(!icepatch)
+ {
+ throw "proxy `" + dist->icepatch + "' is not a file server.";
+ }
+ patch(icepatch, "servers/" + (*s)->getId() + "/distrib", dist->directories);
+
+ if(!server.empty())
+ {
+ break;
+ }
+ }
}
catch(const Ice::LocalException& e)
{
- ostringstream os;
- os << e;
- failure = os.str();
+ ostringstream os;
+ os << e;
+ failure = os.str();
}
catch(const string& e)
{
- failure = e;
+ failure = e;
}
catch(const char* e)
{
- failure = e;
+ failure = e;
}
for(set<ServerIPtr>::const_iterator s = servers.begin(); s != servers.end(); ++s)
{
- (*s)->finishPatch();
+ (*s)->finishPatch();
}
{
- Lock sync(*this);
- _patchInProgress.erase(application);
- notifyAll();
+ Lock sync(*this);
+ _patchInProgress.erase(application);
+ notifyAll();
}
try
{
- if(failure.empty())
- {
- feedback->finished();
- }
- else
- {
- feedback->failed(failure);
- }
+ if(failure.empty())
+ {
+ feedback->finished();
+ }
+ else
+ {
+ feedback->failed(failure);
+ }
}
catch(const Ice::LocalException&)
{
@@ -623,7 +623,7 @@ NodeI::getOffsetFromEnd(const string& filename, int count, const Ice::Current&)
bool
NodeI::read(const string& filename, Ice::Long pos, int size, Ice::Long& newPos, Ice::StringSeq& lines,
- const Ice::Current&) const
+ const Ice::Current&) const
{
return _fileCache->read(getFilePath(filename), pos, size, newPos, lines);
}
@@ -731,26 +731,26 @@ NodeI::checkConsistency(const NodeSessionPrx& session)
vector<ServerCommandPtr> commands;
while(true)
{
- {
- Lock sync(*this);
- if(serial == _serial)
- {
- _serial = 1; // We can reset the serial number.
- commands = checkConsistencyNoSync(servers);
- break;
- }
- serial = _serial;
- }
- assert(session);
- try
- {
- servers = session->getServers();
- }
- catch(const Ice::LocalException&)
- {
- return; // The connection with the session was lost.
- }
- sort(servers.begin(), servers.end());
+ {
+ Lock sync(*this);
+ if(serial == _serial)
+ {
+ _serial = 1; // We can reset the serial number.
+ commands = checkConsistencyNoSync(servers);
+ break;
+ }
+ serial = _serial;
+ }
+ assert(session);
+ try
+ {
+ servers = session->getServers();
+ }
+ catch(const Ice::LocalException&)
+ {
+ return; // The connection with the session was lost.
+ }
+ sort(servers.begin(), servers.end());
}
for_each(commands.begin(), commands.end(), IceUtil::voidMemFun(&ServerCommand::execute));
@@ -766,31 +766,31 @@ NodeI::addObserver(const NodeSessionPrx& session, const NodeObserverPrx& observe
ServerDynamicInfoSeq serverInfos;
AdapterDynamicInfoSeq adapterInfos;
for(map<string, ServerDynamicInfo>::const_iterator p = _serversDynamicInfo.begin();
- p != _serversDynamicInfo.end(); ++p)
+ p != _serversDynamicInfo.end(); ++p)
{
- assert(p->second.state != Destroyed && (p->second.state != Inactive || !p->second.enabled));
- serverInfos.push_back(p->second);
+ assert(p->second.state != Destroyed && (p->second.state != Inactive || !p->second.enabled));
+ serverInfos.push_back(p->second);
}
for(map<string, AdapterDynamicInfo>::const_iterator q = _adaptersDynamicInfo.begin();
- q != _adaptersDynamicInfo.end(); ++q)
+ q != _adaptersDynamicInfo.end(); ++q)
{
- assert(q->second.proxy);
- adapterInfos.push_back(q->second);
+ assert(q->second.proxy);
+ adapterInfos.push_back(q->second);
}
try
{
- NodeDynamicInfo info;
- info.info = _platform.getNodeInfo();
- info.servers = serverInfos;
- info.adapters = adapterInfos;
- observer->nodeUp(info);
+ NodeDynamicInfo info;
+ info.info = _platform.getNodeInfo();
+ info.servers = serverInfos;
+ info.adapters = adapterInfos;
+ observer->nodeUp(info);
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_traceLevels->logger);
- out << "unexpected observer exception:\n" << ex;
+ Ice::Warning out(_traceLevels->logger);
+ out << "unexpected observer exception:\n" << ex;
}
}
@@ -808,11 +808,11 @@ NodeI::observerUpdateServer(const ServerDynamicInfo& info)
if(info.state == Destroyed || info.state == Inactive && info.enabled)
{
- _serversDynamicInfo.erase(info.id);
+ _serversDynamicInfo.erase(info.id);
}
else
{
- _serversDynamicInfo[info.id] = info;
+ _serversDynamicInfo[info.id] = info;
}
//
@@ -824,18 +824,18 @@ NodeI::observerUpdateServer(const ServerDynamicInfo& info)
set<NodeObserverPrx> sent;
for(map<NodeSessionPrx, NodeObserverPrx>::const_iterator p = _observers.begin(); p != _observers.end(); ++p)
{
- if(sent.find(p->second) == sent.end())
- {
- try
- {
- p->second->updateServer(_name, info);
- sent.insert(p->second);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
- }
+ if(sent.find(p->second) == sent.end())
+ {
+ try
+ {
+ p->second->updateServer(_name, info);
+ sent.insert(p->second);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+ }
}
}
@@ -846,11 +846,11 @@ NodeI::observerUpdateAdapter(const AdapterDynamicInfo& info)
if(info.proxy)
{
- _adaptersDynamicInfo[info.id] = info;
+ _adaptersDynamicInfo[info.id] = info;
}
else
{
- _adaptersDynamicInfo.erase(info.id);
+ _adaptersDynamicInfo.erase(info.id);
}
//
@@ -862,17 +862,17 @@ NodeI::observerUpdateAdapter(const AdapterDynamicInfo& info)
set<NodeObserverPrx> sent;
for(map<NodeSessionPrx, NodeObserverPrx>::const_iterator p = _observers.begin(); p != _observers.end(); ++p)
{
- if(sent.find(p->second) == sent.end())
- {
- try
- {
- p->second->updateAdapter(_name, info);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
- }
+ if(sent.find(p->second) == sent.end())
+ {
+ try
+ {
+ p->second->updateAdapter(_name, info);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+ }
}
}
@@ -883,13 +883,13 @@ NodeI::addServer(const ServerIPtr& server, const string& application, bool depen
if(dependsOnApplicationDistrib)
{
- map<string, set<ServerIPtr> >::iterator p = _serversByApplication.find(application);
- if(p == _serversByApplication.end())
- {
- map<string, set<ServerIPtr> >::value_type v(application, set<ServerIPtr>());
- p = _serversByApplication.insert(p, v);
- }
- p->second.insert(server);
+ map<string, set<ServerIPtr> >::iterator p = _serversByApplication.find(application);
+ if(p == _serversByApplication.end())
+ {
+ map<string, set<ServerIPtr> >::value_type v(application, set<ServerIPtr>());
+ p = _serversByApplication.insert(p, v);
+ }
+ p->second.insert(server);
}
}
@@ -900,15 +900,15 @@ NodeI::removeServer(const ServerIPtr& server, const std::string& application, bo
if(dependsOnApplicationDistrib)
{
- map<string, set<ServerIPtr> >::iterator p = _serversByApplication.find(application);
- if(p != _serversByApplication.end())
- {
- p->second.erase(server);
- if(p->second.empty())
- {
- _serversByApplication.erase(p);
- }
- }
+ map<string, set<ServerIPtr> >::iterator p = _serversByApplication.find(application);
+ if(p != _serversByApplication.end())
+ {
+ p->second.erase(server);
+ if(p->second.empty())
+ {
+ _serversByApplication.erase(p);
+ }
+ }
}
}
@@ -924,78 +924,78 @@ NodeI::checkConsistencyNoSync(const Ice::StringSeq& servers)
Ice::StringSeq contents;
try
{
- contents = readDirectory(_serversDir);
+ contents = readDirectory(_serversDir);
}
catch(const string& msg)
{
- Ice::Error out(_traceLevels->logger);
- out << "couldn't read directory `" << _serversDir << "':" << msg;
- return commands;
+ Ice::Error out(_traceLevels->logger);
+ out << "couldn't read directory `" << _serversDir << "':" << msg;
+ return commands;
}
vector<string> remove;
set_difference(contents.begin(), contents.end(), servers.begin(), servers.end(), back_inserter(remove));
-
+
//
// Remove the extra servers if possible.
//
{
- vector<string>::iterator p = remove.begin();
- while(p != remove.end())
- {
- ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(*p)));
- if(server)
- {
- //
- // If the server is loaded, we invoke on it to destroy it.
- //
- try
- {
- ServerCommandPtr command = server->destroy(0, "", 0, "Master");
- if(command)
- {
- commands.push_back(command);
- }
- p = remove.erase(p);
- continue;
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Error out(_traceLevels->logger);
- out << "server `" << *p << "' destroy failed:" << ex;
- }
- catch(const string&)
- {
- assert(false);
- }
- }
-
- try
- {
- if(canRemoveServerDirectory(*p))
- {
- //
- // If the server directory can be removed and we
- // either remove it or back it up before to remove it.
- //
- removeRecursive(_serversDir + "/" + *p);
- p = remove.erase(p);
- continue;
- }
- }
- catch(const string& msg)
- {
- Ice::Warning out(_traceLevels->logger);
- out << "removing server directory `" << _serversDir << "/" << *p << "' failed:" << msg;
- }
-
- ++p;
- }
+ vector<string>::iterator p = remove.begin();
+ while(p != remove.end())
+ {
+ ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(createServerIdentity(*p)));
+ if(server)
+ {
+ //
+ // If the server is loaded, we invoke on it to destroy it.
+ //
+ try
+ {
+ ServerCommandPtr command = server->destroy(0, "", 0, "Master");
+ if(command)
+ {
+ commands.push_back(command);
+ }
+ p = remove.erase(p);
+ continue;
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Error out(_traceLevels->logger);
+ out << "server `" << *p << "' destroy failed:" << ex;
+ }
+ catch(const string&)
+ {
+ assert(false);
+ }
+ }
+
+ try
+ {
+ if(canRemoveServerDirectory(*p))
+ {
+ //
+ // If the server directory can be removed and we
+ // either remove it or back it up before to remove it.
+ //
+ removeRecursive(_serversDir + "/" + *p);
+ p = remove.erase(p);
+ continue;
+ }
+ }
+ catch(const string& msg)
+ {
+ Ice::Warning out(_traceLevels->logger);
+ out << "removing server directory `" << _serversDir << "/" << *p << "' failed:" << msg;
+ }
+
+ ++p;
+ }
}
-
+
if(remove.empty())
{
- return commands;
+ return commands;
}
//
@@ -1005,54 +1005,54 @@ NodeI::checkConsistencyNoSync(const Ice::StringSeq& servers)
//
try
{
- contents.clear();
- contents = readDirectory(_tmpDir);
+ contents.clear();
+ contents = readDirectory(_tmpDir);
}
catch(const string& msg)
{
- Ice::Error out(_traceLevels->logger);
- out << "couldn't read directory `" << _tmpDir << "':" << msg;
- return commands;
+ Ice::Error out(_traceLevels->logger);
+ out << "couldn't read directory `" << _tmpDir << "':" << msg;
+ return commands;
}
if(contents.size() < 10)
{
- ostringstream os;
- os << "servers-" << contents.size();
- contents.push_back(os.str());
- sort(contents.begin(), contents.end(), greater<string>());
+ ostringstream os;
+ os << "servers-" << contents.size();
+ contents.push_back(os.str());
+ sort(contents.begin(), contents.end(), greater<string>());
}
else if(contents.size() == 10)
{
- sort(contents.begin(), contents.end(), greater<string>());
- try
- {
- removeRecursive(_tmpDir + "/" + *contents.begin());
- }
- catch(const string& msg)
- {
- Ice::Warning out(_traceLevels->logger);
- out << msg;
- }
+ sort(contents.begin(), contents.end(), greater<string>());
+ try
+ {
+ removeRecursive(_tmpDir + "/" + *contents.begin());
+ }
+ catch(const string& msg)
+ {
+ Ice::Warning out(_traceLevels->logger);
+ out << msg;
+ }
}
try
{
- Ice::StringSeq::const_iterator p;
- for(p = contents.begin(); p != (contents.end() - 1); ++p)
- {
- rename(_tmpDir + "/" + *(p + 1), _tmpDir + "/" + *p);
- }
- createDirectoryRecursive(_tmpDir + "/servers-0");
- for(p = remove.begin(); p != remove.end(); ++p)
- {
- rename(_serversDir + "/" + *p, _tmpDir + "/servers-0/" + *p);
- }
+ Ice::StringSeq::const_iterator p;
+ for(p = contents.begin(); p != (contents.end() - 1); ++p)
+ {
+ rename(_tmpDir + "/" + *(p + 1), _tmpDir + "/" + *p);
+ }
+ createDirectoryRecursive(_tmpDir + "/servers-0");
+ for(p = remove.begin(); p != remove.end(); ++p)
+ {
+ rename(_serversDir + "/" + *p, _tmpDir + "/servers-0/" + *p);
+ }
}
catch(const string& msg)
{
- Ice::Warning out(_traceLevels->logger);
- out << "rotation failed: " << msg;
+ Ice::Warning out(_traceLevels->logger);
+ out << "rotation failed: " << msg;
}
return commands;
@@ -1076,7 +1076,7 @@ NodeI::canRemoveServerDirectory(const string& name)
remove(contents.begin(), contents.end(), "distrib");
if(!contents.empty())
{
- return false;
+ return false;
}
contents = readDirectory(_serversDir + "/" + name + "/config");
@@ -1084,21 +1084,21 @@ NodeI::canRemoveServerDirectory(const string& name)
Ice::StringSeq::const_iterator p;
for(p = contents.begin() ; p != contents.end(); ++p)
{
- if(p->find("config") != 0)
- {
- return false;
- }
+ if(p->find("config") != 0)
+ {
+ return false;
+ }
}
contents = readDirectory(_serversDir + "/" + name + "/dbs");
for(p = contents.begin() ; p != contents.end(); ++p)
{
- Ice::StringSeq files = readDirectory(_serversDir + "/" + name + "/dbs/" + *p);
- remove(files.begin(), files.end(), "DB_CONFIG");
- if(!files.empty())
- {
- return false;
- }
+ Ice::StringSeq files = readDirectory(_serversDir + "/" + name + "/dbs/" + *p);
+ remove(files.begin(), files.end(), "DB_CONFIG");
+ if(!files.empty())
+ {
+ return false;
+ }
}
return true;
@@ -1113,28 +1113,28 @@ NodeI::patch(const FileServerPrx& icepatch, const string& dest, const vector<str
bool aborted = !patcher->prepare();
if(!aborted)
{
- if(directories.empty())
- {
- aborted = !patcher->patch("");
- dynamic_cast<LogPatcherFeedback*>(feedback.get())->finishPatch();
- }
- else
- {
- for(vector<string>::const_iterator p = directories.begin(); p != directories.end(); ++p)
- {
- dynamic_cast<LogPatcherFeedback*>(feedback.get())->setPatchingPath(*p);
- if(!patcher->patch(*p))
- {
- aborted = true;
- break;
- }
- dynamic_cast<LogPatcherFeedback*>(feedback.get())->finishPatch();
- }
- }
+ if(directories.empty())
+ {
+ aborted = !patcher->patch("");
+ dynamic_cast<LogPatcherFeedback*>(feedback.get())->finishPatch();
+ }
+ else
+ {
+ for(vector<string>::const_iterator p = directories.begin(); p != directories.end(); ++p)
+ {
+ dynamic_cast<LogPatcherFeedback*>(feedback.get())->setPatchingPath(*p);
+ if(!patcher->patch(*p))
+ {
+ aborted = true;
+ break;
+ }
+ dynamic_cast<LogPatcherFeedback*>(feedback.get())->finishPatch();
+ }
+ }
}
if(!aborted)
{
- patcher->finish();
+ patcher->finish();
}
//
@@ -1150,7 +1150,7 @@ NodeI::getApplicationServers(const string& application) const
map<string, set<ServerIPtr> >::const_iterator p = _serversByApplication.find(application);
if(p != _serversByApplication.end())
{
- servers = p->second;
+ servers = p->second;
}
return servers;
}
@@ -1170,23 +1170,23 @@ NodeI::getFilePath(const string& filename) const
string file;
if(filename == "stderr")
{
- file = _communicator->getProperties()->getProperty("Ice.StdErr");
- if(file.empty())
- {
- throw FileNotAvailableException("Ice.StdErr configuration property is not set");
- }
+ file = _communicator->getProperties()->getProperty("Ice.StdErr");
+ if(file.empty())
+ {
+ throw FileNotAvailableException("Ice.StdErr configuration property is not set");
+ }
}
else if(filename == "stdout")
{
- file = _communicator->getProperties()->getProperty("Ice.StdOut");
- if(file.empty())
- {
- throw FileNotAvailableException("Ice.StdOut configuration property is not set");
- }
+ file = _communicator->getProperties()->getProperty("Ice.StdOut");
+ if(file.empty())
+ {
+ throw FileNotAvailableException("Ice.StdOut configuration property is not set");
+ }
}
else
{
- throw FileNotAvailableException("unknown file");
+ throw FileNotAvailableException("unknown file");
}
return file;
}
diff --git a/cpp/src/IceGrid/NodeI.h b/cpp/src/IceGrid/NodeI.h
index 7572a0b648c..0f472f0bdbe 100644
--- a/cpp/src/IceGrid/NodeI.h
+++ b/cpp/src/IceGrid/NodeI.h
@@ -41,23 +41,23 @@ class NodeI : public Node, public IceUtil::Monitor<IceUtil::Mutex>
public:
NodeI(const Ice::ObjectAdapterPtr&, NodeSessionManager&, const ActivatorPtr&, const WaitQueuePtr&,
- const TraceLevelsPtr&, const NodePrx&, const std::string&, const UserAccountMapperPrx&);
+ const TraceLevelsPtr&, const NodePrx&, const std::string&, const UserAccountMapperPrx&);
virtual ~NodeI();
virtual void loadServer_async(const AMD_Node_loadServerPtr&,
- const InternalServerDescriptorPtr&,
- const std::string&,
- const Ice::Current&);
+ const InternalServerDescriptorPtr&,
+ const std::string&,
+ const Ice::Current&);
virtual void destroyServer_async(const AMD_Node_destroyServerPtr&,
- const std::string&,
- const std::string&,
- int,
- const std::string&,
- const Ice::Current&);
+ const std::string&,
+ const std::string&,
+ int,
+ const std::string&,
+ const Ice::Current&);
virtual void patch_async(const AMD_Node_patchPtr&, const PatcherFeedbackPrx&, const std::string&,
- const std::string&, const InternalDistributionDescriptorPtr&, bool, const Ice::Current&);
+ const std::string&, const InternalDistributionDescriptorPtr&, bool, const Ice::Current&);
virtual void registerWithReplica(const InternalRegistryPrx&, const Ice::Current&);
diff --git a/cpp/src/IceGrid/NodeSessionI.cpp b/cpp/src/IceGrid/NodeSessionI.cpp
index afc5619c2d5..6d12869379e 100644
--- a/cpp/src/IceGrid/NodeSessionI.cpp
+++ b/cpp/src/IceGrid/NodeSessionI.cpp
@@ -24,26 +24,26 @@ class PatcherFeedbackI : public PatcherFeedback
public:
PatcherFeedbackI(const string& node,
- const NodeSessionIPtr& session,
- const Ice::Identity id,
- const PatcherFeedbackAggregatorPtr& aggregator) :
- _node(node),
- _session(session),
- _id(id),
- _aggregator(aggregator)
+ const NodeSessionIPtr& session,
+ const Ice::Identity id,
+ const PatcherFeedbackAggregatorPtr& aggregator) :
+ _node(node),
+ _session(session),
+ _id(id),
+ _aggregator(aggregator)
{
}
void finished(const Ice::Current&)
{
- _aggregator->finished(_node);
- _session->removeFeedback(this, _id);
+ _aggregator->finished(_node);
+ _session->removeFeedback(this, _id);
}
virtual void failed(const string& reason, const Ice::Current& = Ice::Current())
{
- _aggregator->failed(_node, reason);
- _session->removeFeedback(this, _id);
+ _aggregator->failed(_node, reason);
+ _session->removeFeedback(this, _id);
}
private:
@@ -57,10 +57,10 @@ private:
};
PatcherFeedbackAggregator::PatcherFeedbackAggregator(Ice::Identity id,
- const TraceLevelsPtr& traceLevels,
- const string& type,
- const string& name,
- int nodeCount) :
+ const TraceLevelsPtr& traceLevels,
+ const string& type,
+ const string& name,
+ int nodeCount) :
_id(id),
_traceLevels(traceLevels),
_type(type),
@@ -79,13 +79,13 @@ PatcherFeedbackAggregator::finished(const string& node)
Lock sync(*this);
if(_successes.find(node) != _successes.end() || _failures.find(node) != _failures.end())
{
- return;
+ return;
}
if(_traceLevels->patch > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << "finished patching of " << _type << " `" << _name << "' on node `" << node << "'";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << "finished patching of " << _type << " `" << _name << "' on node `" << node << "'";
}
_successes.insert(node);
@@ -98,13 +98,13 @@ PatcherFeedbackAggregator::failed(const string& node, const string& failure)
Lock sync(*this);
if(_successes.find(node) != _successes.end() || _failures.find(node) != _failures.end())
{
- return;
+ return;
}
if(_traceLevels->patch > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
- out << "patching of " << _type << " `" << _name << "' on node `" << node <<"' failed:\n" << failure;
+ Ice::Trace out(_traceLevels->logger, _traceLevels->patchCat);
+ out << "patching of " << _type << " `" << _name << "' on node `" << node <<"' failed:\n" << failure;
}
_failures.insert(node);
@@ -117,25 +117,25 @@ PatcherFeedbackAggregator::checkIfDone()
{
if(static_cast<int>(_successes.size() + _failures.size()) == _count)
{
- if(!_failures.empty())
- {
- sort(_reasons.begin(), _reasons.end());
- PatchException ex;
- ex.reasons = _reasons;
- exception(ex);
- }
- else
- {
- response();
- }
+ if(!_failures.empty())
+ {
+ sort(_reasons.begin(), _reasons.end());
+ PatchException ex;
+ ex.reasons = _reasons;
+ exception(ex);
+ }
+ else
+ {
+ response();
+ }
}
}
NodeSessionI::NodeSessionI(const DatabasePtr& database,
- const NodePrx& node,
- const InternalNodeInfoPtr& info,
- int timeout,
- const LoadInfo& load) :
+ const NodePrx& node,
+ const InternalNodeInfoPtr& info,
+ int timeout,
+ const LoadInfo& load) :
_database(database),
_traceLevels(database->getTraceLevels()),
_node(node),
@@ -148,34 +148,34 @@ NodeSessionI::NodeSessionI(const DatabasePtr& database,
__setNoDelete(true);
try
{
- _database->getNode(info->name, true)->setSession(this);
+ _database->getNode(info->name, true)->setSession(this);
- ObjectInfo objInfo;
- objInfo.type = Node::ice_staticId();
- objInfo.proxy = _node;
- _database->addInternalObject(objInfo, true); // Add or update previous node proxy.
+ ObjectInfo objInfo;
+ objInfo.type = Node::ice_staticId();
+ objInfo.proxy = _node;
+ _database->addInternalObject(objInfo, true); // Add or update previous node proxy.
- _proxy = NodeSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this));
+ _proxy = NodeSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this));
}
catch(const NodeActiveException&)
{
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
catch(...)
{
- try
- {
- _database->removeInternalObject(_node->ice_getIdentity());
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- _database->getNode(info->name)->setSession(0);
-
- __setNoDelete(false);
- throw;
+ try
+ {
+ _database->removeInternalObject(_node->ice_getIdentity());
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ _database->getNode(info->name)->setSession(0);
+
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -186,7 +186,7 @@ NodeSessionI::keepAlive(const LoadInfo& load, const Ice::Current& current)
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
_timestamp = IceUtil::Time::now();
@@ -194,9 +194,9 @@ NodeSessionI::keepAlive(const LoadInfo& load, const Ice::Current& current)
if(_traceLevels->node > 2)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->nodeCat);
- out << "node `" << _info->name << "' keep alive ";
- out << "(load = " << _load.avg1 << ", " << _load.avg5 << ", " << _load.avg15 << ")";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->nodeCat);
+ out << "node `" << _info->name << "' keep alive ";
+ out << "(load = " << _load.avg1 << ", " << _load.avg5 << ", " << _load.avg15 << ")";
}
}
@@ -206,12 +206,12 @@ NodeSessionI::setReplicaObserver(const ReplicaObserverPrx& observer, const Ice::
Lock sync(*this);
if(_destroy)
{
- return;
+ return;
}
else if(_replicaObserver) // This might happen on activation of the node.
{
- assert(_replicaObserver == observer);
- return;
+ assert(_replicaObserver == observer);
+ return;
}
_replicaObserver = observer;
@@ -255,16 +255,16 @@ NodeSessionI::getServers(const Ice::Current& current) const
Ice::StringSeq names;
for(ServerEntrySeq::const_iterator p = servers.begin(); p != servers.end(); ++p)
{
- names.push_back((*p)->getId());
+ names.push_back((*p)->getId());
}
return names;
}
void
NodeSessionI::waitForApplicationUpdate_async(const AMD_NodeSession_waitForApplicationUpdatePtr& cb,
- const std::string& application,
- int revision,
- const Ice::Current&) const
+ const std::string& application,
+ int revision,
+ const Ice::Current&) const
{
_database->waitForApplicationUpdate(cb, application, revision);
}
@@ -281,7 +281,7 @@ NodeSessionI::timestamp() const
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
return _timestamp;
}
@@ -294,10 +294,10 @@ NodeSessionI::shutdown()
void
NodeSessionI::patch(const PatcherFeedbackAggregatorPtr& aggregator,
- const string& application,
- const string& server,
- const InternalDistributionDescriptorPtr& dist,
- bool shutdown)
+ const string& application,
+ const string& server,
+ const InternalDistributionDescriptorPtr& dist,
+ bool shutdown)
{
Ice::Identity id;
id.category = _database->getInstanceName();
@@ -306,21 +306,21 @@ NodeSessionI::patch(const PatcherFeedbackAggregatorPtr& aggregator,
PatcherFeedbackPtr obj = new PatcherFeedbackI(_info->name, this, id, aggregator);
try
{
- PatcherFeedbackPrx feedback = PatcherFeedbackPrx::uncheckedCast(_database->getInternalAdapter()->add(obj, id));
- _node->patch(feedback, application, server, dist, shutdown);
-
- Lock sync(*this);
- if(_destroy)
- {
- throw NodeUnreachableException(_info->name, "node is down");
- }
- _feedbacks.insert(obj);
+ PatcherFeedbackPrx feedback = PatcherFeedbackPrx::uncheckedCast(_database->getInternalAdapter()->add(obj, id));
+ _node->patch(feedback, application, server, dist, shutdown);
+
+ Lock sync(*this);
+ if(_destroy)
+ {
+ throw NodeUnreachableException(_info->name, "node is down");
+ }
+ _feedbacks.insert(obj);
}
catch(const Ice::LocalException& ex)
{
- ostringstream os;
- os << "node unreachable:\n" << ex;
- obj->failed(os.str());
+ ostringstream os;
+ os << "node unreachable:\n" << ex;
+ obj->failed(os.str());
}
}
@@ -360,12 +360,12 @@ void
NodeSessionI::destroyImpl(bool shutdown)
{
{
- Lock sync(*this);
- if(_destroy)
- {
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
- }
- _destroy = true;
+ Lock sync(*this);
+ if(_destroy)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+ _destroy = true;
}
ServerEntrySeq servers = _database->getNode(_info->name)->getServers();
@@ -377,7 +377,7 @@ NodeSessionI::destroyImpl(bool shutdown)
//
if(!shutdown)
{
- _database->removeInternalObject(_node->ice_getIdentity());
+ _database->removeInternalObject(_node->ice_getIdentity());
}
//
@@ -390,8 +390,8 @@ NodeSessionI::destroyImpl(bool shutdown)
//
if(_replicaObserver)
{
- _database->getReplicaCache().unsubscribe(_replicaObserver);
- _replicaObserver = 0;
+ _database->getReplicaCache().unsubscribe(_replicaObserver);
+ _replicaObserver = 0;
}
//
@@ -409,18 +409,18 @@ NodeSessionI::destroyImpl(bool shutdown)
_feedbacks.swap(feedbacks);
for(set<PatcherFeedbackPtr>::const_iterator p = feedbacks.begin(); p != feedbacks.end(); ++p)
{
- (*p)->failed("node is down");
+ (*p)->failed("node is down");
}
if(!shutdown)
{
- try
- {
- _database->getInternalAdapter()->remove(_proxy->ice_getIdentity());
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- }
+ try
+ {
+ _database->getInternalAdapter()->remove(_proxy->ice_getIdentity());
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ }
}
}
@@ -429,14 +429,14 @@ NodeSessionI::removeFeedback(const PatcherFeedbackPtr& feedback, const Ice::Iden
{
try
{
- _database->getInternalAdapter()->remove(id);
+ _database->getInternalAdapter()->remove(id);
}
catch(const Ice::LocalException&)
{
}
{
- Lock sync(*this);
- _feedbacks.erase(feedback);
+ Lock sync(*this);
+ _feedbacks.erase(feedback);
}
}
diff --git a/cpp/src/IceGrid/NodeSessionI.h b/cpp/src/IceGrid/NodeSessionI.h
index a9653203ad1..50bf000e513 100644
--- a/cpp/src/IceGrid/NodeSessionI.h
+++ b/cpp/src/IceGrid/NodeSessionI.h
@@ -65,13 +65,13 @@ public:
virtual void loadServers_async(const AMD_NodeSession_loadServersPtr&, const Ice::Current&) const;
virtual Ice::StringSeq getServers(const Ice::Current&) const;
virtual void waitForApplicationUpdate_async(const AMD_NodeSession_waitForApplicationUpdatePtr&,
- const std::string&, int, const Ice::Current&) const;
+ const std::string&, int, const Ice::Current&) const;
virtual void destroy(const Ice::Current& = Ice::Current());
virtual IceUtil::Time timestamp() const;
virtual void shutdown();
void patch(const PatcherFeedbackAggregatorPtr&, const std::string&, const std::string&,
- const InternalDistributionDescriptorPtr&, bool);
+ const InternalDistributionDescriptorPtr&, bool);
const NodePrx& getNode() const;
const InternalNodeInfoPtr& getInfo() const;
diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp
index ff522a1a58e..f723134a0a5 100644
--- a/cpp/src/IceGrid/NodeSessionManager.cpp
+++ b/cpp/src/IceGrid/NodeSessionManager.cpp
@@ -17,8 +17,8 @@ using namespace std;
using namespace IceGrid;
NodeSessionKeepAliveThread::NodeSessionKeepAliveThread(const InternalRegistryPrx& registry,
- const NodeIPtr& node,
- const vector<QueryPrx>& queryObjects) :
+ const NodeIPtr& node,
+ const vector<QueryPrx>& queryObjects) :
SessionKeepAliveThread<NodeSessionPrx>(registry),
_node(node),
_queryObjects(queryObjects)
@@ -29,7 +29,7 @@ NodeSessionKeepAliveThread::NodeSessionKeepAliveThread(const InternalRegistryPrx
string::size_type pos = name.find(prefix);
if(pos != string::npos)
{
- name = name.substr(prefix.size());
+ name = name.substr(prefix.size());
}
const_cast<string&>(_name) = name;
}
@@ -42,90 +42,90 @@ NodeSessionKeepAliveThread::createSession(InternalRegistryPrx& registry, IceUtil
TraceLevelsPtr traceLevels = _node->getTraceLevels();
try
{
- if(traceLevels && traceLevels->replica > 1)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->replicaCat);
- out << "trying to establish session with replica `" << _name << "'";
- }
-
- set<InternalRegistryPrx> used;
- if(!registry->ice_getEndpoints().empty())
- {
- try
- {
- session = createSessionImpl(registry, timeout);
- }
- catch(const Ice::LocalException& ex)
- {
- exception.reset(ex.ice_clone());
- used.insert(registry);
- registry = InternalRegistryPrx::uncheckedCast(registry->ice_endpoints(Ice::EndpointSeq()));
- }
- }
-
- if(!session)
- {
- for(vector<QueryPrx>::const_iterator p = _queryObjects.begin(); p != _queryObjects.end(); ++p)
- {
- InternalRegistryPrx newRegistry;
- try
- {
- Ice::ObjectPrx obj = (*p)->findObjectById(registry->ice_getIdentity());
- newRegistry = InternalRegistryPrx::uncheckedCast(obj);
- if(newRegistry && used.find(newRegistry) == used.end())
- {
- session = createSessionImpl(newRegistry, timeout);
- registry = newRegistry;
- break;
- }
- }
- catch(const Ice::LocalException& ex)
- {
- exception.reset(ex.ice_clone());
- if(newRegistry)
- {
- used.insert(newRegistry);
- }
- }
- }
- }
+ if(traceLevels && traceLevels->replica > 1)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->replicaCat);
+ out << "trying to establish session with replica `" << _name << "'";
+ }
+
+ set<InternalRegistryPrx> used;
+ if(!registry->ice_getEndpoints().empty())
+ {
+ try
+ {
+ session = createSessionImpl(registry, timeout);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ exception.reset(ex.ice_clone());
+ used.insert(registry);
+ registry = InternalRegistryPrx::uncheckedCast(registry->ice_endpoints(Ice::EndpointSeq()));
+ }
+ }
+
+ if(!session)
+ {
+ for(vector<QueryPrx>::const_iterator p = _queryObjects.begin(); p != _queryObjects.end(); ++p)
+ {
+ InternalRegistryPrx newRegistry;
+ try
+ {
+ Ice::ObjectPrx obj = (*p)->findObjectById(registry->ice_getIdentity());
+ newRegistry = InternalRegistryPrx::uncheckedCast(obj);
+ if(newRegistry && used.find(newRegistry) == used.end())
+ {
+ session = createSessionImpl(newRegistry, timeout);
+ registry = newRegistry;
+ break;
+ }
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ exception.reset(ex.ice_clone());
+ if(newRegistry)
+ {
+ used.insert(newRegistry);
+ }
+ }
+ }
+ }
}
catch(const NodeActiveException& ex)
{
- if(traceLevels)
- {
- traceLevels->logger->error("a node with the same name is already active with the replica `" + _name + "'");
- }
- exception.reset(ex.ice_clone());
+ if(traceLevels)
+ {
+ traceLevels->logger->error("a node with the same name is already active with the replica `" + _name + "'");
+ }
+ exception.reset(ex.ice_clone());
}
catch(const Ice::Exception& ex)
{
- exception.reset(ex.ice_clone());
+ exception.reset(ex.ice_clone());
}
if(session)
{
- if(traceLevels && traceLevels->replica > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->replicaCat);
- out << "established session with replica `" << _name << "'";
- }
+ if(traceLevels && traceLevels->replica > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->replicaCat);
+ out << "established session with replica `" << _name << "'";
+ }
}
else
{
- if(traceLevels && traceLevels->replica > 1)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->replicaCat);
- out << "failed to establish session with replica `" << _name << "':\n";
- if(exception.get())
- {
- out << *exception.get();
- }
- else
- {
- out << "failed to get replica proxy";
- }
- }
+ if(traceLevels && traceLevels->replica > 1)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->replicaCat);
+ out << "failed to establish session with replica `" << _name << "':\n";
+ if(exception.get())
+ {
+ out << *exception.get();
+ }
+ else
+ {
+ out << "failed to get replica proxy";
+ }
+ }
}
return session;
@@ -138,7 +138,7 @@ NodeSessionKeepAliveThread::createSessionImpl(const InternalRegistryPrx& registr
int t = session->getTimeout();
if(t > 0)
{
- timeout = IceUtil::Time::seconds(t / 2);
+ timeout = IceUtil::Time::seconds(t / 2);
}
_node->addObserver(session, session->getObserver());
return session;
@@ -151,21 +151,21 @@ NodeSessionKeepAliveThread::destroySession(const NodeSessionPrx& session)
try
{
- session->destroy();
+ session->destroy();
- if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 0)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
- out << "destroyed replica `" << _name << "' session";
- }
+ if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 0)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
+ out << "destroyed replica `" << _name << "' session";
+ }
}
catch(const Ice::LocalException& ex)
{
- if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 1)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
- out << "couldn't destroy replica `" << _name << "' session:\n" << ex;
- }
+ if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 1)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
+ out << "couldn't destroy replica `" << _name << "' session:\n" << ex;
+ }
}
}
@@ -174,24 +174,24 @@ NodeSessionKeepAliveThread::keepAlive(const NodeSessionPrx& session)
{
if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 2)
{
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
- out << "sending keep alive message to replica `" << _name << "'";
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
+ out << "sending keep alive message to replica `" << _name << "'";
}
try
{
- session->keepAlive(_node->getPlatformInfo().getLoadInfo());
- return true;
+ session->keepAlive(_node->getPlatformInfo().getLoadInfo());
+ return true;
}
catch(const Ice::LocalException& ex)
{
- _node->removeObserver(session);
- if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 0)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
- out << "lost session with replica `" << _name << "':\n" << ex;
- }
- return false;
+ _node->removeObserver(session);
+ if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 0)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat);
+ out << "lost session with replica `" << _name << "':\n" << ex;
+ }
+ return false;
}
}
@@ -225,9 +225,9 @@ NodeSessionManager::create(const NodeIPtr& node)
QueryPrx query = QueryPrx::uncheckedCast(communicator->stringToProxy(communicator->identityToString(id)));
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
- Ice::EndpointSeq singleEndpoint;
- singleEndpoint.push_back(*p);
- _queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint)));
+ Ice::EndpointSeq singleEndpoint;
+ singleEndpoint.push_back(*p);
+ _queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint)));
}
id.name = "InternalRegistry-Master";
@@ -252,17 +252,17 @@ NodeSessionManager::create(const InternalRegistryPrx& replica)
NodeSessionKeepAliveThreadPtr thread;
if(replica->ice_getIdentity() == _master->ice_getIdentity())
{
- thread = _thread;
- thread->setRegistry(replica);
+ thread = _thread;
+ thread->setRegistry(replica);
}
else
{
- thread = addReplicaSession(replica);
+ thread = addReplicaSession(replica);
}
if(thread)
{
- thread->tryCreateSession();
+ thread->tryCreateSession();
}
}
@@ -270,8 +270,8 @@ void
NodeSessionManager::activate()
{
{
- Lock sync(*this);
- _activated = true;
+ Lock sync(*this);
+ _activated = true;
}
//
@@ -282,19 +282,19 @@ NodeSessionManager::activate()
NodeSessionPrx session = _thread->getSession();
if(!session)
{
- _thread->tryCreateSession(true);
- session = _thread->getSession();
+ _thread->tryCreateSession(true);
+ session = _thread->getSession();
}
if(session)
{
- try
- {
- session->setReplicaObserver(_node->getProxy());
- syncServers(session);
- }
- catch(const Ice::LocalException&)
- {
- }
+ try
+ {
+ session->setReplicaObserver(_node->getProxy());
+ syncServers(session);
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
}
}
@@ -317,23 +317,23 @@ NodeSessionManager::destroy()
{
NodeSessionMap sessions;
{
- Lock sync(*this);
- _destroyed = true;
- _sessions.swap(sessions);
- notifyAll();
+ Lock sync(*this);
+ _destroyed = true;
+ _sessions.swap(sessions);
+ notifyAll();
}
_thread->terminate();
NodeSessionMap::const_iterator p;
for(p = sessions.begin(); p != sessions.end(); ++p)
{
- p->second->terminate();
+ p->second->terminate();
}
_thread->getThreadControl().join();
for(p = sessions.begin(); p != sessions.end(); ++p)
{
- p->second->getThreadControl().join();
+ p->second->getThreadControl().join();
}
}
@@ -343,7 +343,7 @@ NodeSessionManager::replicaInit(const InternalRegistryPrxSeq& replicas)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
//
@@ -352,8 +352,8 @@ NodeSessionManager::replicaInit(const InternalRegistryPrxSeq& replicas)
_replicas.clear();
for(InternalRegistryPrxSeq::const_iterator p = replicas.begin(); p != replicas.end(); ++p)
{
- _replicas.insert((*p)->ice_getIdentity());
- addReplicaSession(*p)->tryCreateSession(false);
+ _replicas.insert((*p)->ice_getIdentity());
+ addReplicaSession(*p)->tryCreateSession(false);
}
}
@@ -363,7 +363,7 @@ NodeSessionManager::replicaAdded(const InternalRegistryPrx& replica)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
_replicas.insert(replica->ice_getIdentity());
addReplicaSession(replica)->tryCreateSession(false);
@@ -373,12 +373,12 @@ void
NodeSessionManager::replicaRemoved(const InternalRegistryPrx& replica)
{
{
- Lock sync(*this);
- if(_destroyed)
- {
- return;
- }
- _replicas.erase(replica->ice_getIdentity());
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ return;
+ }
+ _replicas.erase(replica->ice_getIdentity());
}
//
@@ -396,14 +396,14 @@ NodeSessionManager::addReplicaSession(const InternalRegistryPrx& replica)
NodeSessionKeepAliveThreadPtr thread;
if(p != _sessions.end())
{
- thread = p->second;
- thread->setRegistry(replica);
+ thread = p->second;
+ thread->setRegistry(replica);
}
else
{
- thread = new NodeSessionKeepAliveThread(replica, _node, _queryObjects);
- _sessions.insert(make_pair(replica->ice_getIdentity(), thread));
- thread->start();
+ thread = new NodeSessionKeepAliveThread(replica, _node, _queryObjects);
+ _sessions.insert(make_pair(replica->ice_getIdentity(), thread));
+ thread->start();
}
return thread;
}
@@ -413,31 +413,31 @@ NodeSessionManager::reapReplicas()
{
vector<NodeSessionKeepAliveThreadPtr> reap;
{
- Lock sync(*this);
- if(_destroyed)
- {
- return;
- }
-
- NodeSessionMap::iterator q = _sessions.begin();
- while(q != _sessions.end())
- {
- if(_replicas.find(q->first) == _replicas.end() && q->second->terminateIfDisconnected())
- {
- _node->removeObserver(q->second->getSession());
- reap.push_back(q->second);
- _sessions.erase(q++);
- }
- else
- {
- ++q;
- }
- }
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ return;
+ }
+
+ NodeSessionMap::iterator q = _sessions.begin();
+ while(q != _sessions.end())
+ {
+ if(_replicas.find(q->first) == _replicas.end() && q->second->terminateIfDisconnected())
+ {
+ _node->removeObserver(q->second->getSession());
+ reap.push_back(q->second);
+ _sessions.erase(q++);
+ }
+ else
+ {
+ ++q;
+ }
+ }
}
for(vector<NodeSessionKeepAliveThreadPtr>::const_iterator p = reap.begin(); p != reap.end(); ++p)
{
- (*p)->getThreadControl().join();
+ (*p)->getThreadControl().join();
}
}
@@ -465,8 +465,8 @@ NodeSessionManager::createdSession(const NodeSessionPrx& session)
{
bool activated;
{
- Lock sync(*this);
- activated = _activated;
+ Lock sync(*this);
+ activated = _activated;
}
//
@@ -479,15 +479,15 @@ NodeSessionManager::createdSession(const NodeSessionPrx& session)
//
if(session && activated)
{
- try
- {
- session->setReplicaObserver(_node->getProxy());
- syncServers(session);
- }
- catch(const Ice::LocalException&)
- {
- }
- return;
+ try
+ {
+ session->setReplicaObserver(_node->getProxy());
+ syncServers(session);
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ return;
}
//
@@ -501,73 +501,73 @@ NodeSessionManager::createdSession(const NodeSessionPrx& session)
InternalRegistryPrxSeq replicas;
if(session)
{
- assert(!activated); // The node adapter isn't activated yet so
- // we're not subscribed yet to the replica
+ assert(!activated); // The node adapter isn't activated yet so
+ // we're not subscribed yet to the replica
// observer topic.
- try
- {
- replicas = _thread->getRegistry()->getReplicas();
- }
- catch(const Ice::LocalException&)
- {
- }
+ try
+ {
+ replicas = _thread->getRegistry()->getReplicas();
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
}
else
{
- map<Ice::Identity, Ice::ObjectPrx> proxies;
- for(vector<QueryPrx>::const_iterator p = _queryObjects.begin(); p != _queryObjects.end(); ++p)
- {
- try
- {
- Ice::ObjectProxySeq prxs = (*p)->findAllObjectsByType(InternalRegistry::ice_staticId());
- for(Ice::ObjectProxySeq::const_iterator q = prxs.begin(); q != prxs.end(); ++q)
- {
- //
- // NOTE: We might override a good proxy here! We could improve this to make
- // sure that we don't override the proxy for replica N if that proxy was
- // obtained from replica N.
- //
- proxies[(*q)->ice_getIdentity()] = *q;
- }
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
- }
-
- for(map<Ice::Identity, Ice::ObjectPrx>::const_iterator q = proxies.begin(); q != proxies.end(); ++q)
- {
- replicas.push_back(InternalRegistryPrx::uncheckedCast(q->second));
- }
+ map<Ice::Identity, Ice::ObjectPrx> proxies;
+ for(vector<QueryPrx>::const_iterator p = _queryObjects.begin(); p != _queryObjects.end(); ++p)
+ {
+ try
+ {
+ Ice::ObjectProxySeq prxs = (*p)->findAllObjectsByType(InternalRegistry::ice_staticId());
+ for(Ice::ObjectProxySeq::const_iterator q = prxs.begin(); q != prxs.end(); ++q)
+ {
+ //
+ // NOTE: We might override a good proxy here! We could improve this to make
+ // sure that we don't override the proxy for replica N if that proxy was
+ // obtained from replica N.
+ //
+ proxies[(*q)->ice_getIdentity()] = *q;
+ }
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+ }
+
+ for(map<Ice::Identity, Ice::ObjectPrx>::const_iterator q = proxies.begin(); q != proxies.end(); ++q)
+ {
+ replicas.push_back(InternalRegistryPrx::uncheckedCast(q->second));
+ }
}
vector<NodeSessionKeepAliveThreadPtr> sessions;
{
- Lock sync(*this);
- if(_destroyed)
- {
- return;
- }
-
- //
- // If the node adapter was activated since we last check, we don't need
- // to initialize the replicas here, it will be done by replicaInit().
- //
- if(!session || !_activated)
- {
- _replicas.clear();
- for(InternalRegistryPrxSeq::const_iterator p = replicas.begin(); p != replicas.end(); ++p)
- {
- if((*p)->ice_getIdentity() != _master->ice_getIdentity())
- {
- _replicas.insert((*p)->ice_getIdentity());
- NodeSessionKeepAliveThreadPtr session = addReplicaSession(*p);
- session->tryCreateSession(false);
- sessions.push_back(session);
- }
- }
- }
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ return;
+ }
+
+ //
+ // If the node adapter was activated since we last check, we don't need
+ // to initialize the replicas here, it will be done by replicaInit().
+ //
+ if(!session || !_activated)
+ {
+ _replicas.clear();
+ for(InternalRegistryPrxSeq::const_iterator p = replicas.begin(); p != replicas.end(); ++p)
+ {
+ if((*p)->ice_getIdentity() != _master->ice_getIdentity())
+ {
+ _replicas.insert((*p)->ice_getIdentity());
+ NodeSessionKeepAliveThreadPtr session = addReplicaSession(*p);
+ session->tryCreateSession(false);
+ sessions.push_back(session);
+ }
+ }
+ }
}
//
@@ -577,7 +577,7 @@ NodeSessionManager::createdSession(const NodeSessionPrx& session)
//
for(vector<NodeSessionKeepAliveThreadPtr>::const_iterator p = sessions.begin(); p != sessions.end(); ++p)
{
- (*p)->tryCreateSession(true);
+ (*p)->tryCreateSession(true);
}
}
diff --git a/cpp/src/IceGrid/NodeSessionManager.h b/cpp/src/IceGrid/NodeSessionManager.h
index 7c67e4d0dc0..11f12386aa9 100644
--- a/cpp/src/IceGrid/NodeSessionManager.h
+++ b/cpp/src/IceGrid/NodeSessionManager.h
@@ -78,39 +78,39 @@ private:
{
public:
- Thread(NodeSessionManager& manager) :
- NodeSessionKeepAliveThread(manager._master, manager._node, manager._queryObjects),
- _manager(manager)
+ Thread(NodeSessionManager& manager) :
+ NodeSessionKeepAliveThread(manager._master, manager._node, manager._queryObjects),
+ _manager(manager)
{
- }
+ }
- virtual NodeSessionPrx
- createSession(InternalRegistryPrx& master, IceUtil::Time& timeout)
+ virtual NodeSessionPrx
+ createSession(InternalRegistryPrx& master, IceUtil::Time& timeout)
{
- NodeSessionPrx session = NodeSessionKeepAliveThread::createSession(master, timeout);
- _manager.createdSession(session);
- _manager.reapReplicas();
- return session;
- }
-
- virtual void
- destroySession(const NodeSessionPrx& session)
+ NodeSessionPrx session = NodeSessionKeepAliveThread::createSession(master, timeout);
+ _manager.createdSession(session);
+ _manager.reapReplicas();
+ return session;
+ }
+
+ virtual void
+ destroySession(const NodeSessionPrx& session)
{
- NodeSessionKeepAliveThread::destroySession(session);
- _manager.reapReplicas();
- }
+ NodeSessionKeepAliveThread::destroySession(session);
+ _manager.reapReplicas();
+ }
- virtual bool
- keepAlive(const NodeSessionPrx& session)
+ virtual bool
+ keepAlive(const NodeSessionPrx& session)
{
- bool alive = NodeSessionKeepAliveThread::keepAlive(session);
- _manager.reapReplicas();
- return alive;
- }
+ bool alive = NodeSessionKeepAliveThread::keepAlive(session);
+ _manager.reapReplicas();
+ return alive;
+ }
private:
-
- NodeSessionManager& _manager;
+
+ NodeSessionManager& _manager;
};
typedef IceUtil::Handle<Thread> ThreadPtr;
friend class Thread;
diff --git a/cpp/src/IceGrid/ObjectCache.cpp b/cpp/src/IceGrid/ObjectCache.cpp
index baa608ee12f..65dfe17cf23 100644
--- a/cpp/src/IceGrid/ObjectCache.cpp
+++ b/cpp/src/IceGrid/ObjectCache.cpp
@@ -30,7 +30,7 @@ struct ObjectEntryCI : binary_function<ObjectEntryPtr&, ObjectEntryPtr&, bool>
bool
operator()(const ObjectEntryPtr& lhs, const ObjectEntryPtr& rhs)
{
- return ::Ice::proxyIdentityLess(lhs->getProxy(), rhs->getProxy());
+ return ::Ice::proxyIdentityLess(lhs->getProxy(), rhs->getProxy());
}
};
@@ -38,7 +38,7 @@ struct ObjectLoadCI : binary_function<pair<Ice::ObjectPrx, float>&, pair<Ice::Ob
{
bool operator()(const pair<Ice::ObjectPrx, float>& lhs, const pair<Ice::ObjectPrx, float>& rhs)
{
- return lhs.second < rhs.second;
+ return lhs.second < rhs.second;
}
};
@@ -87,14 +87,14 @@ ObjectCache::add(const ObjectInfo& info, const string& application)
map<string, TypeEntry>::iterator p = _types.find(entry->getType());
if(p == _types.end())
{
- p = _types.insert(p, map<string, TypeEntry>::value_type(entry->getType(), TypeEntry()));
+ p = _types.insert(p, map<string, TypeEntry>::value_type(entry->getType(), TypeEntry()));
}
p->second.add(entry);
if(_traceLevels && _traceLevels->object > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << "added object `" << _communicator->identityToString(id) << "'";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << "added object `" << _communicator->identityToString(id) << "'";
}
}
@@ -105,7 +105,7 @@ ObjectCache::get(const Ice::Identity& id) const
ObjectEntryPtr entry = getImpl(id);
if(!entry)
{
- throw ObjectNotRegisteredException(id);
+ throw ObjectNotRegisteredException(id);
}
return entry;
}
@@ -121,14 +121,14 @@ ObjectCache::remove(const Ice::Identity& id)
map<string, TypeEntry>::iterator p = _types.find(entry->getType());
assert(p != _types.end());
if(p->second.remove(entry))
- {
- _types.erase(p);
+ {
+ _types.erase(p);
}
if(_traceLevels && _traceLevels->object > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
- out << "removed object `" << _communicator->identityToString(id) << "'";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat);
+ out << "removed object `" << _communicator->identityToString(id) << "'";
}
return entry;
@@ -142,12 +142,12 @@ ObjectCache::getObjectsByType(const string& type)
map<string, TypeEntry>::const_iterator p = _types.find(type);
if(p == _types.end())
{
- return proxies;
+ return proxies;
}
const vector<ObjectEntryPtr>& objects = p->second.getObjects();
for(vector<ObjectEntryPtr>::const_iterator q = objects.begin(); q != objects.end(); ++q)
{
- proxies.push_back((*q)->getProxy());
+ proxies.push_back((*q)->getProxy());
}
return proxies;
}
@@ -159,10 +159,10 @@ ObjectCache::getAll(const string& expression)
ObjectInfoSeq infos;
for(map<Ice::Identity, ObjectEntryPtr>::const_iterator p = _entries.begin(); p != _entries.end(); ++p)
{
- if(expression.empty() || IceUtil::match(_communicator->identityToString(p->first), expression, true))
- {
- infos.push_back(p->second->getObjectInfo());
- }
+ if(expression.empty() || IceUtil::match(_communicator->identityToString(p->first), expression, true))
+ {
+ infos.push_back(p->second->getObjectInfo());
+ }
}
return infos;
}
@@ -175,13 +175,13 @@ ObjectCache::getAllByType(const string& type)
map<string, TypeEntry>::const_iterator p = _types.find(type);
if(p == _types.end())
{
- return infos;
+ return infos;
}
const vector<ObjectEntryPtr>& objects = p->second.getObjects();
for(vector<ObjectEntryPtr>::const_iterator q = objects.begin(); q != objects.end(); ++q)
{
- infos.push_back((*q)->getObjectInfo());
+ infos.push_back((*q)->getObjectInfo());
}
return infos;
}
diff --git a/cpp/src/IceGrid/ObjectCache.h b/cpp/src/IceGrid/ObjectCache.h
index fc814a1c87e..7293d1c53fd 100644
--- a/cpp/src/IceGrid/ObjectCache.h
+++ b/cpp/src/IceGrid/ObjectCache.h
@@ -62,16 +62,16 @@ private:
{
public:
- TypeEntry();
+ TypeEntry();
- void add(const ObjectEntryPtr&);
- bool remove(const ObjectEntryPtr&);
-
- const std::vector<ObjectEntryPtr>& getObjects() const { return _objects; }
+ void add(const ObjectEntryPtr&);
+ bool remove(const ObjectEntryPtr&);
+
+ const std::vector<ObjectEntryPtr>& getObjects() const { return _objects; }
private:
-
- std::vector<ObjectEntryPtr> _objects;
+
+ std::vector<ObjectEntryPtr> _objects;
};
const Ice::CommunicatorPtr _communicator;
diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp
index d2c90f05048..bfc95391d91 100644
--- a/cpp/src/IceGrid/Parser.cpp
+++ b/cpp/src/IceGrid/Parser.cpp
@@ -210,7 +210,7 @@ Parser* parser;
ParserPtr
Parser::createParser(const CommunicatorPtr& communicator, const AdminSessionPrx& session, const AdminPrx& admin,
- bool interactive)
+ bool interactive)
{
return new Parser(communicator, session, admin, interactive);
}
@@ -220,15 +220,15 @@ Parser::usage(const string& category, const string& command)
{
if(_helpCommands.find(category) == _helpCommands.end())
{
- invalidCommand("unknown category `" + category + "'");
+ invalidCommand("unknown category `" + category + "'");
}
else if(_helpCommands[category].find(command) == _helpCommands[category].end())
{
- invalidCommand("unknown command `" + category + " " + command + "'");
+ invalidCommand("unknown command `" + category + " " + command + "'");
}
else
{
- cout << _helpCommands[category][command];
+ cout << _helpCommands[category][command];
}
}
@@ -237,15 +237,15 @@ Parser::usage(const string& category, const list<string>& args)
{
if(args.empty())
{
- usage(category);
+ usage(category);
}
else if(args.size() > 1)
{
- invalidCommand("`help' requires at most 1 argument");
+ invalidCommand("`help' requires at most 1 argument");
}
else
{
- usage(category, *args.begin());
+ usage(category, *args.begin());
}
}
@@ -255,11 +255,11 @@ Parser::usage()
cout <<
"help Print this message.\n"
"exit, quit Exit this program.\n"
- "CATEGORY help Print the help section of the given CATEGORY.\n"
- "COMMAND help Print the help of the given COMMAND.\n"
- "\n"
- "List of help categories:\n"
- "\n"
+ "CATEGORY help Print the help section of the given CATEGORY.\n"
+ "COMMAND help Print the help of the given COMMAND.\n"
+ "\n"
+ "List of help categories:\n"
+ "\n"
" application: commands to manage applications\n"
" node: commands to manage nodes\n"
" registry: commands to manage registries\n"
@@ -268,7 +268,7 @@ Parser::usage()
" object: commands to manage objects\n"
" server template: commands to manage server templates\n"
" service template: commands to manage service templates\n"
- "\n";
+ "\n";
}
void
@@ -298,11 +298,11 @@ Parser::checkInterrupted()
{
if(!_interactive)
{
- Lock sync(*this);
- if(_interrupted)
- {
- throw "interrupted with Ctrl-C";
- }
+ Lock sync(*this);
+ if(_interrupted)
+ {
+ throw "interrupted with Ctrl-C";
+ }
}
}
@@ -317,69 +317,69 @@ Parser::addApplication(const list<string>& origArgs)
vector<string> args;
try
{
- for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
- {
- args.push_back(*p);
- }
- args = opts.parse(args);
+ for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
+ {
+ args.push_back(*p);
+ }
+ args = opts.parse(args);
}
catch(const IceUtil::BadOptException& e)
{
- error(e.reason);
- return;
+ error(e.reason);
+ return;
}
if(args.size() < 1)
{
- invalidCommand("application add", "requires at least one argument");
- return;
+ invalidCommand("application add", "requires at least one argument");
+ return;
}
try
{
- StringSeq targets;
- map<string, string> vars;
-
- vector<string>::const_iterator p = args.begin();
- string desc = *p++;
-
- for(; p != args.end(); ++p)
- {
- string::size_type pos = p->find('=');
- if(pos != string::npos)
- {
- vars[p->substr(0, pos)] = p->substr(pos + 1);
- }
- else
- {
- targets.push_back(*p);
- }
- }
-
- //
- // Add the application.
- //
- ApplicationDescriptor app = DescriptorParser::parseDescriptor(desc, targets, vars, _communicator, _admin);
- _admin->addApplication(app);
-
- if(!opts.isSet("no-patch"))
- {
- //
- // Patch the application.
- //
- try
- {
- _admin->patchApplication(app.name, true);
- }
- catch(const PatchException& ex)
- {
- patchFailed(ex.reasons);
- }
- }
+ StringSeq targets;
+ map<string, string> vars;
+
+ vector<string>::const_iterator p = args.begin();
+ string desc = *p++;
+
+ for(; p != args.end(); ++p)
+ {
+ string::size_type pos = p->find('=');
+ if(pos != string::npos)
+ {
+ vars[p->substr(0, pos)] = p->substr(pos + 1);
+ }
+ else
+ {
+ targets.push_back(*p);
+ }
+ }
+
+ //
+ // Add the application.
+ //
+ ApplicationDescriptor app = DescriptorParser::parseDescriptor(desc, targets, vars, _communicator, _admin);
+ _admin->addApplication(app);
+
+ if(!opts.isSet("no-patch"))
+ {
+ //
+ // Patch the application.
+ //
+ try
+ {
+ _admin->patchApplication(app.name, true);
+ }
+ catch(const PatchException& ex)
+ {
+ patchFailed(ex.reasons);
+ }
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -388,21 +388,21 @@ Parser::removeApplication(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("application remove", "requires exactly one argument");
- return;
+ invalidCommand("application remove", "requires exactly one argument");
+ return;
}
try
{
- list<string>::const_iterator p = args.begin();
+ list<string>::const_iterator p = args.begin();
- string name = *p++;
+ string name = *p++;
- _admin->removeApplication(name);
+ _admin->removeApplication(name);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -411,25 +411,25 @@ Parser::describeApplication(const list<string>& args)
{
if(args.size() < 1)
{
- invalidCommand("application describe", "requires at least one argument");
- return;
+ invalidCommand("application describe", "requires at least one argument");
+ return;
}
try
{
- list<string>::const_iterator p = args.begin();
+ list<string>::const_iterator p = args.begin();
- string name = *p++;
+ string name = *p++;
- Output out(cout);
- ApplicationInfo info = _admin->getApplicationInfo(name);
- ApplicationHelper helper(_communicator, info.descriptor);
- helper.print(out, info);
- out << nl;
+ Output out(cout);
+ ApplicationInfo info = _admin->getApplicationInfo(name);
+ ApplicationHelper helper(_communicator, info.descriptor);
+ helper.print(out, info);
+ out << nl;
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -438,44 +438,44 @@ Parser::diffApplication(const list<string>& args)
{
if(args.size() < 1)
{
- invalidCommand("application diff" , "requires at least one argument");
- return;
+ invalidCommand("application diff" , "requires at least one argument");
+ return;
}
try
{
- StringSeq targets;
- map<string, string> vars;
-
- list<string>::const_iterator p = args.begin();
- string desc = *p++;
-
- for(; p != args.end(); ++p)
- {
- string::size_type pos = p->find('=');
- if(pos != string::npos)
- {
- vars[p->substr(0, pos)] = p->substr(pos + 1);
- }
- else
- {
- targets.push_back(*p);
- }
- }
-
- ApplicationDescriptor newApp = DescriptorParser::parseDescriptor(desc, targets, vars, _communicator, _admin);
- ApplicationInfo origApp = _admin->getApplicationInfo(newApp.name);
-
- ApplicationHelper newAppHelper(_communicator, newApp);
- ApplicationHelper oldAppHelper(_communicator, origApp.descriptor);
-
- Output out(cout);
- newAppHelper.printDiff(out, oldAppHelper);
- out << nl;
+ StringSeq targets;
+ map<string, string> vars;
+
+ list<string>::const_iterator p = args.begin();
+ string desc = *p++;
+
+ for(; p != args.end(); ++p)
+ {
+ string::size_type pos = p->find('=');
+ if(pos != string::npos)
+ {
+ vars[p->substr(0, pos)] = p->substr(pos + 1);
+ }
+ else
+ {
+ targets.push_back(*p);
+ }
+ }
+
+ ApplicationDescriptor newApp = DescriptorParser::parseDescriptor(desc, targets, vars, _communicator, _admin);
+ ApplicationInfo origApp = _admin->getApplicationInfo(newApp.name);
+
+ ApplicationHelper newAppHelper(_communicator, newApp);
+ ApplicationHelper oldAppHelper(_communicator, origApp.descriptor);
+
+ Output out(cout);
+ newAppHelper.printDiff(out, oldAppHelper);
+ out << nl;
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -484,36 +484,36 @@ Parser::updateApplication(const list<string>& args)
{
if(args.size() < 1)
{
- invalidCommand("application diff", "requires at least one argument");
- return;
+ invalidCommand("application diff", "requires at least one argument");
+ return;
}
try
{
- StringSeq targets;
- map<string, string> vars;
+ StringSeq targets;
+ map<string, string> vars;
- list<string>::const_iterator p = args.begin();
- string desc = *p++;
+ list<string>::const_iterator p = args.begin();
+ string desc = *p++;
- for(; p != args.end(); ++p)
- {
- string::size_type pos = p->find('=');
- if(pos != string::npos)
- {
- vars[p->substr(0, pos)] = p->substr(pos + 1);
- }
- else
- {
- targets.push_back(*p);
- }
- }
+ for(; p != args.end(); ++p)
+ {
+ string::size_type pos = p->find('=');
+ if(pos != string::npos)
+ {
+ vars[p->substr(0, pos)] = p->substr(pos + 1);
+ }
+ else
+ {
+ targets.push_back(*p);
+ }
+ }
- _admin->syncApplication(DescriptorParser::parseDescriptor(desc, targets, vars, _communicator, _admin));
+ _admin->syncApplication(DescriptorParser::parseDescriptor(desc, targets, vars, _communicator, _admin));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -528,33 +528,33 @@ Parser::patchApplication(const list<string>& origArgs)
vector<string> args;
try
{
- for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
- {
- args.push_back(*p);
- }
- args = opts.parse(args);
+ for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
+ {
+ args.push_back(*p);
+ }
+ args = opts.parse(args);
}
catch(const IceUtil::BadOptException& e)
{
- error(e.reason);
- return;
+ error(e.reason);
+ return;
}
if(args.size() != 1)
{
- invalidCommand("application patch", "requires exactly one argument");
- return;
+ invalidCommand("application patch", "requires exactly one argument");
+ return;
}
try
{
- vector<string>::const_iterator p = args.begin();
- string name = *p++;
- _admin->patchApplication(name, opts.isSet("force"));
+ vector<string>::const_iterator p = args.begin();
+ string name = *p++;
+ _admin->patchApplication(name, opts.isSet("force"));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -563,12 +563,12 @@ Parser::listAllApplications()
{
try
{
- Ice::StringSeq names = _admin->getAllApplicationNames();
- copy(names.begin(), names.end(), ostream_iterator<string>(cout,"\n"));
+ Ice::StringSeq names = _admin->getAllApplicationNames();
+ copy(names.begin(), names.end(), ostream_iterator<string>(cout,"\n"));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -577,50 +577,50 @@ Parser::describeServerTemplate(const list<string>& args)
{
if(args.size() != 2)
{
- invalidCommand("server template describe", "requires exactly two arguments");
- return;
+ invalidCommand("server template describe", "requires exactly two arguments");
+ return;
}
try
{
- list<string>::const_iterator p = args.begin();
-
- string name = *p++;
- string templ = *p++;
-
- ApplicationInfo application = _admin->getApplicationInfo(name);
-
- Output out(cout);
- TemplateDescriptorDict::const_iterator q = application.descriptor.serverTemplates.find(templ);
- if(q != application.descriptor.serverTemplates.end())
- {
- out << "server template `" << templ << "'";
- out << sb;
-
- out << nl << "parameters = `" << toString(q->second.parameters) << "'";
- out << nl;
-
- ServerDescriptorPtr server = ServerDescriptorPtr::dynamicCast(q->second.descriptor);
- IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(server);
- if(iceBox)
- {
- IceBoxHelper(iceBox).print(_communicator, out);
- }
- else
- {
- ServerHelper(server).print(_communicator, out);
- }
- out << eb;
- out << nl;
- }
- else
- {
- error("no server template with id `" + templ + "'");
- }
+ list<string>::const_iterator p = args.begin();
+
+ string name = *p++;
+ string templ = *p++;
+
+ ApplicationInfo application = _admin->getApplicationInfo(name);
+
+ Output out(cout);
+ TemplateDescriptorDict::const_iterator q = application.descriptor.serverTemplates.find(templ);
+ if(q != application.descriptor.serverTemplates.end())
+ {
+ out << "server template `" << templ << "'";
+ out << sb;
+
+ out << nl << "parameters = `" << toString(q->second.parameters) << "'";
+ out << nl;
+
+ ServerDescriptorPtr server = ServerDescriptorPtr::dynamicCast(q->second.descriptor);
+ IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(server);
+ if(iceBox)
+ {
+ IceBoxHelper(iceBox).print(_communicator, out);
+ }
+ else
+ {
+ ServerHelper(server).print(_communicator, out);
+ }
+ out << eb;
+ out << nl;
+ }
+ else
+ {
+ error("no server template with id `" + templ + "'");
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -629,35 +629,35 @@ Parser::instantiateServerTemplate(const list<string>& args)
{
if(args.size() < 3)
{
- invalidCommand("server template instantiate", "requires at least three arguments");
- return;
+ invalidCommand("server template instantiate", "requires at least three arguments");
+ return;
}
try
{
- map<string, string> vars;
-
- list<string>::const_iterator p = args.begin();
- string application = *p++;
- string node = *p++;
- string templ = *p++;
- for(; p != args.end(); ++p)
- {
- string::size_type pos = p->find('=');
- if(pos != string::npos)
- {
- vars[p->substr(0, pos)] = p->substr(pos + 1);
- }
- }
-
- ServerInstanceDescriptor desc;
- desc._cpp_template = templ;
- desc.parameterValues = vars;
- _admin->instantiateServer(application, node, desc);
+ map<string, string> vars;
+
+ list<string>::const_iterator p = args.begin();
+ string application = *p++;
+ string node = *p++;
+ string templ = *p++;
+ for(; p != args.end(); ++p)
+ {
+ string::size_type pos = p->find('=');
+ if(pos != string::npos)
+ {
+ vars[p->substr(0, pos)] = p->substr(pos + 1);
+ }
+ }
+
+ ServerInstanceDescriptor desc;
+ desc._cpp_template = templ;
+ desc.parameterValues = vars;
+ _admin->instantiateServer(application, node, desc);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -666,42 +666,42 @@ Parser::describeServiceTemplate(const list<string>& args)
{
if(args.size() != 2)
{
- invalidCommand("service template describe", "requires exactly two arguments");
- return;
+ invalidCommand("service template describe", "requires exactly two arguments");
+ return;
}
try
{
- list<string>::const_iterator p = args.begin();
-
- string name = *p++;
- string templ = *p++;
-
- ApplicationInfo application = _admin->getApplicationInfo(name);
-
- Output out(cout);
- TemplateDescriptorDict::const_iterator q = application.descriptor.serviceTemplates.find(templ);
- if(q != application.descriptor.serviceTemplates.end())
- {
- out << "service template `" << templ << "'";
- out << sb;
-
- out << nl << "parameters = `" << toString(q->second.parameters) << "'";
- out << nl;
-
- ServiceDescriptorPtr desc = ServiceDescriptorPtr::dynamicCast(q->second.descriptor);
- ServiceHelper(desc).print(_communicator, out);
- out << eb;
- out << nl;
- }
- else
- {
- invalidCommand("no service template with id `" + templ + "'");
- }
+ list<string>::const_iterator p = args.begin();
+
+ string name = *p++;
+ string templ = *p++;
+
+ ApplicationInfo application = _admin->getApplicationInfo(name);
+
+ Output out(cout);
+ TemplateDescriptorDict::const_iterator q = application.descriptor.serviceTemplates.find(templ);
+ if(q != application.descriptor.serviceTemplates.end())
+ {
+ out << "service template `" << templ << "'";
+ out << sb;
+
+ out << nl << "parameters = `" << toString(q->second.parameters) << "'";
+ out << nl;
+
+ ServiceDescriptorPtr desc = ServiceDescriptorPtr::dynamicCast(q->second.descriptor);
+ ServiceHelper(desc).print(_communicator, out);
+ out << eb;
+ out << nl;
+ }
+ else
+ {
+ invalidCommand("no service template with id `" + templ + "'");
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -710,28 +710,28 @@ Parser::describeNode(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("node describe", "requires exactly one argument");
- return;
+ invalidCommand("node describe", "requires exactly one argument");
+ return;
}
try
{
- NodeInfo info = _admin->getNodeInfo(args.front());
- Output out(cout);
- out << "node `" << args.front() << "'";
- out << sb;
- out << nl << "operating system = `" << info.os << "'";
- out << nl << "host name = `" << info.hostname << "'";
- out << nl << "release = `" << info.release << "'";
- out << nl << "version = `" << info.version << "'";
- out << nl << "machine type = `" << info.machine << "'";
- out << nl << "number of processors = `" << info.nProcessors << "'";
- out << eb;
- out << nl;
+ NodeInfo info = _admin->getNodeInfo(args.front());
+ Output out(cout);
+ out << "node `" << args.front() << "'";
+ out << sb;
+ out << nl << "operating system = `" << info.os << "'";
+ out << nl << "host name = `" << info.hostname << "'";
+ out << nl << "release = `" << info.release << "'";
+ out << nl << "version = `" << info.version << "'";
+ out << nl << "machine type = `" << info.machine << "'";
+ out << nl << "number of processors = `" << info.nProcessors << "'";
+ out << eb;
+ out << nl;
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -740,24 +740,24 @@ Parser::pingNode(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("node ping", "requires exactly one argument");
- return;
+ invalidCommand("node ping", "requires exactly one argument");
+ return;
}
try
{
- if(_admin->pingNode(args.front()))
- {
- cout << "node is up" << endl;
- }
- else
- {
- cout << "node is down" << endl;
- }
+ if(_admin->pingNode(args.front()))
+ {
+ cout << "node is up" << endl;
+ }
+ else
+ {
+ cout << "node is down" << endl;
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -766,18 +766,18 @@ Parser::printLoadNode(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("node load", "requires exactly one argument");
- return;
+ invalidCommand("node load", "requires exactly one argument");
+ return;
}
try
{
- LoadInfo load = _admin->getNodeLoad(args.front());
- cout << "load average (1/5/15): " << load.avg1 << " / " << load.avg5 << " / " << load.avg15 << endl;
+ LoadInfo load = _admin->getNodeLoad(args.front());
+ cout << "load average (1/5/15): " << load.avg1 << " / " << load.avg5 << " / " << load.avg15 << endl;
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -786,17 +786,17 @@ Parser::shutdownNode(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("node shutdown", "requires exactly one argument");
- return;
+ invalidCommand("node shutdown", "requires exactly one argument");
+ return;
}
try
{
- _admin->shutdownNode(args.front());
+ _admin->shutdownNode(args.front());
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -805,12 +805,12 @@ Parser::listAllNodes()
{
try
{
- Ice::StringSeq names = _admin->getAllNodeNames();
- copy(names.begin(), names.end(), ostream_iterator<string>(cout,"\n"));
+ Ice::StringSeq names = _admin->getAllNodeNames();
+ copy(names.begin(), names.end(), ostream_iterator<string>(cout,"\n"));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -819,23 +819,23 @@ Parser::describeRegistry(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("registry describe", "requires exactly one argument");
- return;
+ invalidCommand("registry describe", "requires exactly one argument");
+ return;
}
try
{
- RegistryInfo info = _admin->getRegistryInfo(args.front());
- Output out(cout);
- out << "registry `" << args.front() << "'";
- out << sb;
- out << nl << "host name = `" << info.hostname << "'";
- out << eb;
- out << nl;
+ RegistryInfo info = _admin->getRegistryInfo(args.front());
+ Output out(cout);
+ out << "registry `" << args.front() << "'";
+ out << sb;
+ out << nl << "host name = `" << info.hostname << "'";
+ out << eb;
+ out << nl;
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -844,24 +844,24 @@ Parser::pingRegistry(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("registry ping", "requires exactly one argument");
- return;
+ invalidCommand("registry ping", "requires exactly one argument");
+ return;
}
try
{
- if(_admin->pingRegistry(args.front()))
- {
- cout << "registry is up" << endl;
- }
- else
- {
- cout << "registry is down" << endl;
- }
+ if(_admin->pingRegistry(args.front()))
+ {
+ cout << "registry is up" << endl;
+ }
+ else
+ {
+ cout << "registry is down" << endl;
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -870,24 +870,24 @@ Parser::shutdownRegistry(const list<string>& args)
{
if(args.size() > 1)
{
- invalidCommand("registry shutdown", "requires at most one argument");
- return;
+ invalidCommand("registry shutdown", "requires at most one argument");
+ return;
}
try
{
- if(args.empty())
- {
- _admin->shutdown();
- }
- else
- {
- _admin->shutdownRegistry(args.front());
- }
+ if(args.empty())
+ {
+ _admin->shutdown();
+ }
+ else
+ {
+ _admin->shutdownRegistry(args.front());
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -896,12 +896,12 @@ Parser::listAllRegistries()
{
try
{
- Ice::StringSeq names = _admin->getAllRegistryNames();
- copy(names.begin(), names.end(), ostream_iterator<string>(cout,"\n"));
+ Ice::StringSeq names = _admin->getAllRegistryNames();
+ copy(names.begin(), names.end(), ostream_iterator<string>(cout,"\n"));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -910,24 +910,24 @@ Parser::removeServer(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("server remove", "requires exactly one argument");
- return;
+ invalidCommand("server remove", "requires exactly one argument");
+ return;
}
try
{
- ServerInfo info = _admin->getServerInfo(args.front());
- NodeUpdateDescriptor nodeUpdate;
- nodeUpdate.name = info.node;
- nodeUpdate.removeServers.push_back(args.front());
- ApplicationUpdateDescriptor update;
- update.name = info.application;
- update.nodes.push_back(nodeUpdate);
- _admin->updateApplication(update);
+ ServerInfo info = _admin->getServerInfo(args.front());
+ NodeUpdateDescriptor nodeUpdate;
+ nodeUpdate.name = info.node;
+ nodeUpdate.removeServers.push_back(args.front());
+ ApplicationUpdateDescriptor update;
+ update.name = info.application;
+ update.nodes.push_back(nodeUpdate);
+ _admin->updateApplication(update);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -936,21 +936,21 @@ Parser::startServer(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("server start", "requires exactly one argument");
- return;
+ invalidCommand("server start", "requires exactly one argument");
+ return;
}
try
{
- _admin->startServer(args.front());
+ _admin->startServer(args.front());
}
catch(const ServerStartException& ex)
{
- error("the server didn't start successfully:\n" + ex.reason);
+ error("the server didn't start successfully:\n" + ex.reason);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -959,21 +959,21 @@ Parser::stopServer(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("server stop", "requires exactly one argument");
- return;
+ invalidCommand("server stop", "requires exactly one argument");
+ return;
}
try
{
- _admin->stopServer(args.front());
+ _admin->stopServer(args.front());
}
catch(const ServerStopException& ex)
{
- error("the server didn't stop successfully:\n" + ex.reason);
+ error("the server didn't stop successfully:\n" + ex.reason);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -988,31 +988,31 @@ Parser::patchServer(const list<string>& origArgs)
vector<string> args;
try
{
- for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
- {
- args.push_back(*p);
- }
- args = opts.parse(args);
+ for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
+ {
+ args.push_back(*p);
+ }
+ args = opts.parse(args);
}
catch(const IceUtil::BadOptException& e)
{
- error(e.reason);
- return;
+ error(e.reason);
+ return;
}
if(args.size() != 1)
{
- invalidCommand("server patch", "requires exactly one argument");
- return;
+ invalidCommand("server patch", "requires exactly one argument");
+ return;
}
try
{
- _admin->patchServer(args.front(), opts.isSet("force"));
+ _admin->patchServer(args.front(), opts.isSet("force"));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1021,19 +1021,19 @@ Parser::signalServer(const list<string>& args)
{
if(args.size() != 2)
{
- invalidCommand("server signal", "requires exactly two arguments");
- return;
+ invalidCommand("server signal", "requires exactly two arguments");
+ return;
}
try
{
- list<string>::const_iterator p = args.begin();
- string server = *p++;
- _admin->sendSignal(server, *p);
+ list<string>::const_iterator p = args.begin();
+ string server = *p++;
+ _admin->sendSignal(server, *p);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1043,19 +1043,19 @@ Parser::writeMessage(const list<string>& args, int fd)
{
if(args.size() != 2)
{
- invalidCommand("server stdout or server stderr", "requires exactly two arguments");
- return;
+ invalidCommand("server stdout or server stderr", "requires exactly two arguments");
+ return;
}
try
{
- list<string>::const_iterator p = args.begin();
- string server = *p++;
- _admin->writeMessage(server, *p, fd);
+ list<string>::const_iterator p = args.begin();
+ string server = *p++;
+ _admin->writeMessage(server, *p, fd);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1064,28 +1064,28 @@ Parser::describeServer(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("server describe", "requires exactly one argument");
- return;
+ invalidCommand("server describe", "requires exactly one argument");
+ return;
}
try
{
- ServerInfo info = _admin->getServerInfo(args.front());
- Output out(cout);
- IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(info.descriptor);
- if(iceBox)
- {
- IceBoxHelper(iceBox).print(_communicator, out, info);
- }
- else
- {
- ServerHelper(info.descriptor).print(_communicator, out, info);
- }
- out << nl;
+ ServerInfo info = _admin->getServerInfo(args.front());
+ Output out(cout);
+ IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(info.descriptor);
+ if(iceBox)
+ {
+ IceBoxHelper(iceBox).print(_communicator, out, info);
+ }
+ else
+ {
+ ServerHelper(info.descriptor).print(_communicator, out, info);
+ }
+ out << nl;
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1094,60 +1094,60 @@ Parser::stateServer(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("server state", "requires exactly one argument");
- return;
+ invalidCommand("server state", "requires exactly one argument");
+ return;
}
try
{
- ServerState state = _admin->getServerState(args.front());
- string enabled = _admin->isServerEnabled(args.front()) ? "enabled" : "disabled";
- switch(state)
- {
- case Inactive:
- {
- cout << "inactive (" << enabled << ")" << endl;
- break;
- }
- case Activating:
- {
- cout << "activating (" << enabled << ")" << endl;
- break;
- }
- case Active:
- {
- int pid = _admin->getServerPid(args.front());
- cout << "active (pid = " << pid << ", " << enabled << ")" << endl;
- break;
- }
- case ActivationTimedOut:
- {
- int pid = _admin->getServerPid(args.front());
- cout << "activation timed out (pid = " << pid << ", " << enabled << ")" << endl;
- break;
- }
- case Deactivating:
- {
- cout << "deactivating (" << enabled << ")" << endl;
- break;
- }
- case Destroying:
- {
- cout << "destroying (" << enabled << ")" << endl;
- break;
- }
- case Destroyed:
- {
- cout << "destroyed (" << enabled << ")" << endl;
- break;
- }
- default:
- assert(false);
- }
+ ServerState state = _admin->getServerState(args.front());
+ string enabled = _admin->isServerEnabled(args.front()) ? "enabled" : "disabled";
+ switch(state)
+ {
+ case Inactive:
+ {
+ cout << "inactive (" << enabled << ")" << endl;
+ break;
+ }
+ case Activating:
+ {
+ cout << "activating (" << enabled << ")" << endl;
+ break;
+ }
+ case Active:
+ {
+ int pid = _admin->getServerPid(args.front());
+ cout << "active (pid = " << pid << ", " << enabled << ")" << endl;
+ break;
+ }
+ case ActivationTimedOut:
+ {
+ int pid = _admin->getServerPid(args.front());
+ cout << "activation timed out (pid = " << pid << ", " << enabled << ")" << endl;
+ break;
+ }
+ case Deactivating:
+ {
+ cout << "deactivating (" << enabled << ")" << endl;
+ break;
+ }
+ case Destroying:
+ {
+ cout << "destroying (" << enabled << ")" << endl;
+ break;
+ }
+ case Destroyed:
+ {
+ cout << "destroyed (" << enabled << ")" << endl;
+ break;
+ }
+ default:
+ assert(false);
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1156,25 +1156,25 @@ Parser::pidServer(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("server pid", "requires exactly one argument");
- return;
+ invalidCommand("server pid", "requires exactly one argument");
+ return;
}
try
{
- int pid = _admin->getServerPid(args.front());
- if(pid > 0)
- {
- cout << pid << endl;
- }
- else
- {
- error("server is not running");
- }
+ int pid = _admin->getServerPid(args.front());
+ if(pid > 0)
+ {
+ cout << pid << endl;
+ }
+ else
+ {
+ error("server is not running");
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1183,24 +1183,24 @@ Parser::enableServer(const list<string>& args, bool enable)
{
if(args.size() != 1)
{
- if(enable)
- {
- invalidCommand("server enable", "requires exactly one argument");
- }
- else
- {
- invalidCommand("server disable", "requires exactly one argument");
- }
- return;
+ if(enable)
+ {
+ invalidCommand("server enable", "requires exactly one argument");
+ }
+ else
+ {
+ invalidCommand("server disable", "requires exactly one argument");
+ }
+ return;
}
try
{
- _admin->enableServer(args.front(), enable);
+ _admin->enableServer(args.front(), enable);
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1209,12 +1209,12 @@ Parser::listAllServers()
{
try
{
- Ice::StringSeq ids = _admin->getAllServerIds();
- copy(ids.begin(), ids.end(), ostream_iterator<string>(cout,"\n"));
+ Ice::StringSeq ids = _admin->getAllServerIds();
+ copy(ids.begin(), ids.end(), ostream_iterator<string>(cout,"\n"));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1223,32 +1223,32 @@ Parser::endpointsAdapter(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("adapter endpoints", "requires exactly one argument");
- return;
+ invalidCommand("adapter endpoints", "requires exactly one argument");
+ return;
}
try
{
- string adapterId = args.front();
- AdapterInfoSeq adpts = _admin->getAdapterInfo(adapterId);
- if(adpts.size() == 1 && adpts.begin()->id == adapterId)
- {
- string endpoints = _communicator->proxyToString(adpts.begin()->proxy);
- cout << (endpoints.empty() ? string("<inactive>") : endpoints) << endl;
- }
- else
- {
- for(AdapterInfoSeq::const_iterator p = adpts.begin(); p != adpts.end(); ++p)
- {
- cout << (p->id.empty() ? string("<empty>") : p->id) << ": ";
- string endpoints = _communicator->proxyToString(p->proxy);
- cout << (endpoints.empty() ? string("<inactive>") : endpoints) << endl;
- }
- }
+ string adapterId = args.front();
+ AdapterInfoSeq adpts = _admin->getAdapterInfo(adapterId);
+ if(adpts.size() == 1 && adpts.begin()->id == adapterId)
+ {
+ string endpoints = _communicator->proxyToString(adpts.begin()->proxy);
+ cout << (endpoints.empty() ? string("<inactive>") : endpoints) << endl;
+ }
+ else
+ {
+ for(AdapterInfoSeq::const_iterator p = adpts.begin(); p != adpts.end(); ++p)
+ {
+ cout << (p->id.empty() ? string("<empty>") : p->id) << ": ";
+ string endpoints = _communicator->proxyToString(p->proxy);
+ cout << (endpoints.empty() ? string("<inactive>") : endpoints) << endl;
+ }
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1257,17 +1257,17 @@ Parser::removeAdapter(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("adapter remove", "requires exactly one argument");
- return;
+ invalidCommand("adapter remove", "requires exactly one argument");
+ return;
}
try
{
- _admin->removeAdapter(*args.begin());
+ _admin->removeAdapter(*args.begin());
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1276,12 +1276,12 @@ Parser::listAllAdapters()
{
try
{
- Ice::StringSeq ids = _admin->getAllAdapterIds();
- copy(ids.begin(), ids.end(), ostream_iterator<string>(cout,"\n"));
+ Ice::StringSeq ids = _admin->getAllAdapterIds();
+ copy(ids.begin(), ids.end(), ostream_iterator<string>(cout,"\n"));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1290,29 +1290,29 @@ Parser::addObject(const list<string>& args)
{
if(args.size() < 1)
{
- invalidCommand("object add", "requires at least one argument");
- return;
+ invalidCommand("object add", "requires at least one argument");
+ return;
}
try
{
- list<string>::const_iterator p = args.begin();
+ list<string>::const_iterator p = args.begin();
- string proxy = *p++;
+ string proxy = *p++;
- if(p != args.end())
- {
- string type = *p++;
- _admin->addObjectWithType(_communicator->stringToProxy(proxy), type);
- }
- else
- {
- _admin->addObject(_communicator->stringToProxy(proxy));
- }
+ if(p != args.end())
+ {
+ string type = *p++;
+ _admin->addObjectWithType(_communicator->stringToProxy(proxy), type);
+ }
+ else
+ {
+ _admin->addObject(_communicator->stringToProxy(proxy));
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1321,17 +1321,17 @@ Parser::removeObject(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("object remove", "requires exactly one argument");
- return;
+ invalidCommand("object remove", "requires exactly one argument");
+ return;
}
try
{
- _admin->removeObject(_communicator->stringToIdentity((*(args.begin()))));
+ _admin->removeObject(_communicator->stringToIdentity((*(args.begin()))));
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1340,21 +1340,21 @@ Parser::findObject(const list<string>& args)
{
if(args.size() != 1)
{
- invalidCommand("object find", "requires exactly one argument");
- return;
+ invalidCommand("object find", "requires exactly one argument");
+ return;
}
try
{
- ObjectInfoSeq objects = _admin->getObjectInfosByType(*(args.begin()));
- for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
- {
- cout << _communicator->proxyToString(p->proxy) << endl;
- }
+ ObjectInfoSeq objects = _admin->getObjectInfosByType(*(args.begin()));
+ for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
+ {
+ cout << _communicator->proxyToString(p->proxy) << endl;
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1363,36 +1363,36 @@ Parser::describeObject(const list<string>& args)
{
try
{
- ObjectInfoSeq objects;
- if(args.size() == 1)
- {
- string arg = *(args.begin());
- if(arg.find('*') == string::npos)
- {
- ObjectInfo info = _admin->getObjectInfo(_communicator->stringToIdentity(arg));
- cout << "proxy = `" << _communicator->proxyToString(info.proxy) << "'" << endl;
- cout << "type = `" << info.type << "'" << endl;
- return;
- }
- else
- {
- objects = _admin->getAllObjectInfos(arg);
- }
- }
- else
- {
- objects = _admin->getAllObjectInfos("");
- }
-
- for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
- {
- cout << "proxy = `" << _communicator->proxyToString(p->proxy) << "' type = `" << p->type << "'" << endl;
- }
-
+ ObjectInfoSeq objects;
+ if(args.size() == 1)
+ {
+ string arg = *(args.begin());
+ if(arg.find('*') == string::npos)
+ {
+ ObjectInfo info = _admin->getObjectInfo(_communicator->stringToIdentity(arg));
+ cout << "proxy = `" << _communicator->proxyToString(info.proxy) << "'" << endl;
+ cout << "type = `" << info.type << "'" << endl;
+ return;
+ }
+ else
+ {
+ objects = _admin->getAllObjectInfos(arg);
+ }
+ }
+ else
+ {
+ objects = _admin->getAllObjectInfos("");
+ }
+
+ for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
+ {
+ cout << "proxy = `" << _communicator->proxyToString(p->proxy) << "' type = `" << p->type << "'" << endl;
+ }
+
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1401,24 +1401,24 @@ Parser::listObject(const list<string>& args)
{
try
{
- ObjectInfoSeq objects;
- if(args.size() == 1)
- {
- objects = _admin->getAllObjectInfos(*(args.begin()));
- }
- else
- {
- objects = _admin->getAllObjectInfos("");
- }
-
- for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
- {
- cout << _communicator->identityToString(p->proxy->ice_getIdentity()) << endl;
- }
+ ObjectInfoSeq objects;
+ if(args.size() == 1)
+ {
+ objects = _admin->getAllObjectInfos(*(args.begin()));
+ }
+ else
+ {
+ objects = _admin->getAllObjectInfos("");
+ }
+
+ for(ObjectInfoSeq::const_iterator p = objects.begin(); p != objects.end(); ++p)
+ {
+ cout << _communicator->identityToString(p->proxy->ice_getIdentity()) << endl;
+ }
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1436,184 +1436,184 @@ Parser::showFile(const string& reader, const list<string>& origArgs)
vector<string> args;
try
{
- for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
- {
- args.push_back(*p);
- }
- args = opts.parse(args);
+ for(list<string>::const_iterator p = copyArgs.begin(); p != copyArgs.end(); ++p)
+ {
+ args.push_back(*p);
+ }
+ args = opts.parse(args);
}
catch(const IceUtil::BadOptException& e)
{
- error(e.reason);
- return;
+ error(e.reason);
+ return;
}
if(args.size() != 2)
{
- invalidCommand(reader + " show", "requires two arguments");
- return;
+ invalidCommand(reader + " show", "requires two arguments");
+ return;
}
try
{
- vector<string>::const_iterator p = args.begin();
- string id = *p++;
- string filename = *p++;
-
- cout << reader << " `" << id << "' " << filename << ": " << flush;
- Ice::StringSeq lines;
-
- bool head = opts.isSet("head");
- bool tail = opts.isSet("tail");
- if(head && tail)
- {
- invalidCommand("can't specify both -h | --head and -t | --tail options");
- return;
- }
- int lineCount = 20;
- int maxBytes = _communicator->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024) * 1024;
- if(head || tail)
- {
- if(head)
- {
- istringstream is(opts.optArg("head"));
- is >> lineCount;
- }
- else
- {
- istringstream is(opts.optArg("tail"));
- is >> lineCount;
- }
- if(lineCount <= 0)
- {
- invalidCommand("invalid argument for -h | --head or -t | --tail option");
- return;
- }
- }
-
- FileIteratorPrx it;
- if(reader == "node")
- {
- if(filename == "stderr")
- {
- it = _session->openNodeStdErr(id, tail ? lineCount : -1);
- }
- else if(filename == "stdout")
- {
- it = _session->openNodeStdOut(id, tail ? lineCount : -1);
- }
- else
- {
- invalidCommand("invalid node log filename `" + filename + "'");
- return;
- }
- }
- else if(reader == "registry")
- {
- if(filename == "stderr")
- {
- it = _session->openRegistryStdErr(id, tail ? lineCount : -1);
- }
- else if(filename == "stdout")
- {
- it = _session->openRegistryStdOut(id, tail ? lineCount : -1);
- }
- else
- {
- invalidCommand("invalid registry log filename `" + filename + "'");
- return;
- }
- }
- else if(reader == "server")
- {
- if(filename == "stderr")
- {
- it = _session->openServerStdErr(id, tail ? lineCount : -1);
- }
- else if(filename == "stdout")
- {
- it = _session->openServerStdOut(id, tail ? lineCount : -1);
- }
- else
- {
- it = _session->openServerLog(id, filename, tail ? lineCount : -1);
- }
- }
-
- bool follow = opts.isSet("follow");
- resetInterrupt();
- if(head)
- {
- if(follow)
- {
- invalidCommand("can't use -f | --follow option with -h | --head option");
- return;
- }
-
- int i = 0;
- bool eof = false;
- while(!interrupted() && !eof && i < lineCount)
- {
- eof = it->read(maxBytes, lines);
- for(Ice::StringSeq::const_iterator p = lines.begin(); i < lineCount && p != lines.end(); ++p, ++i)
- {
- cout << endl << *p << flush;
- }
- }
- }
- else
- {
- bool eof = false;
- while(!interrupted() && !eof)
- {
- eof = it->read(maxBytes, lines);
- for(Ice::StringSeq::const_iterator p = lines.begin(); p != lines.end(); ++p)
- {
- cout << endl << *p << flush;
- }
- }
- }
-
- if(follow)
- {
- while(!interrupted())
- {
- bool eof = it->read(maxBytes, lines);
- for(Ice::StringSeq::const_iterator p = lines.begin(); p != lines.end(); ++p)
- {
- cout << *p;
- if((p + 1) != lines.end())
- {
- cout << endl;
- }
- else
- {
- cout << flush;
- }
- }
-
- if(eof)
- {
- Lock sync(*this);
- if(_interrupted)
- {
- break;
- }
- timedWait(IceUtil::Time::seconds(5));
- }
- }
- }
-
- if(lines.empty() || !lines.back().empty())
- {
- cout << endl;
- }
-
- it->destroy();
+ vector<string>::const_iterator p = args.begin();
+ string id = *p++;
+ string filename = *p++;
+
+ cout << reader << " `" << id << "' " << filename << ": " << flush;
+ Ice::StringSeq lines;
+
+ bool head = opts.isSet("head");
+ bool tail = opts.isSet("tail");
+ if(head && tail)
+ {
+ invalidCommand("can't specify both -h | --head and -t | --tail options");
+ return;
+ }
+ int lineCount = 20;
+ int maxBytes = _communicator->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024) * 1024;
+ if(head || tail)
+ {
+ if(head)
+ {
+ istringstream is(opts.optArg("head"));
+ is >> lineCount;
+ }
+ else
+ {
+ istringstream is(opts.optArg("tail"));
+ is >> lineCount;
+ }
+ if(lineCount <= 0)
+ {
+ invalidCommand("invalid argument for -h | --head or -t | --tail option");
+ return;
+ }
+ }
+
+ FileIteratorPrx it;
+ if(reader == "node")
+ {
+ if(filename == "stderr")
+ {
+ it = _session->openNodeStdErr(id, tail ? lineCount : -1);
+ }
+ else if(filename == "stdout")
+ {
+ it = _session->openNodeStdOut(id, tail ? lineCount : -1);
+ }
+ else
+ {
+ invalidCommand("invalid node log filename `" + filename + "'");
+ return;
+ }
+ }
+ else if(reader == "registry")
+ {
+ if(filename == "stderr")
+ {
+ it = _session->openRegistryStdErr(id, tail ? lineCount : -1);
+ }
+ else if(filename == "stdout")
+ {
+ it = _session->openRegistryStdOut(id, tail ? lineCount : -1);
+ }
+ else
+ {
+ invalidCommand("invalid registry log filename `" + filename + "'");
+ return;
+ }
+ }
+ else if(reader == "server")
+ {
+ if(filename == "stderr")
+ {
+ it = _session->openServerStdErr(id, tail ? lineCount : -1);
+ }
+ else if(filename == "stdout")
+ {
+ it = _session->openServerStdOut(id, tail ? lineCount : -1);
+ }
+ else
+ {
+ it = _session->openServerLog(id, filename, tail ? lineCount : -1);
+ }
+ }
+
+ bool follow = opts.isSet("follow");
+ resetInterrupt();
+ if(head)
+ {
+ if(follow)
+ {
+ invalidCommand("can't use -f | --follow option with -h | --head option");
+ return;
+ }
+
+ int i = 0;
+ bool eof = false;
+ while(!interrupted() && !eof && i < lineCount)
+ {
+ eof = it->read(maxBytes, lines);
+ for(Ice::StringSeq::const_iterator p = lines.begin(); i < lineCount && p != lines.end(); ++p, ++i)
+ {
+ cout << endl << *p << flush;
+ }
+ }
+ }
+ else
+ {
+ bool eof = false;
+ while(!interrupted() && !eof)
+ {
+ eof = it->read(maxBytes, lines);
+ for(Ice::StringSeq::const_iterator p = lines.begin(); p != lines.end(); ++p)
+ {
+ cout << endl << *p << flush;
+ }
+ }
+ }
+
+ if(follow)
+ {
+ while(!interrupted())
+ {
+ bool eof = it->read(maxBytes, lines);
+ for(Ice::StringSeq::const_iterator p = lines.begin(); p != lines.end(); ++p)
+ {
+ cout << *p;
+ if((p + 1) != lines.end())
+ {
+ cout << endl;
+ }
+ else
+ {
+ cout << flush;
+ }
+ }
+
+ if(eof)
+ {
+ Lock sync(*this);
+ if(_interrupted)
+ {
+ break;
+ }
+ timedWait(IceUtil::Time::seconds(5));
+ }
+ }
+ }
+
+ if(lines.empty() || !lines.back().empty())
+ {
+ cout << endl;
+ }
+
+ it->destroy();
}
catch(const Ice::Exception& ex)
{
- exception(ex);
+ exception(ex);
}
}
@@ -1640,104 +1640,104 @@ Parser::getInput(char* buf, int& result, int maxSize)
{
if(!_commands.empty())
{
- if(_commands == ";")
- {
- result = 0;
- }
- else
- {
+ if(_commands == ";")
+ {
+ result = 0;
+ }
+ else
+ {
#if defined(_MSC_VER) && !defined(_STLP_MSVC)
- // COMPILERBUG: Stupid Visual C++ defines min and max as macros
- result = _MIN(maxSize, static_cast<int>(_commands.length()));
+ // COMPILERBUG: Stupid Visual C++ defines min and max as macros
+ result = _MIN(maxSize, static_cast<int>(_commands.length()));
#else
- result = min(maxSize, static_cast<int>(_commands.length()));
+ result = min(maxSize, static_cast<int>(_commands.length()));
#endif
- strncpy(buf, _commands.c_str(), result);
- _commands.erase(0, result);
- if(_commands.empty())
- {
- _commands = ";";
- }
- }
+ strncpy(buf, _commands.c_str(), result);
+ _commands.erase(0, result);
+ if(_commands.empty())
+ {
+ _commands = ";";
+ }
+ }
}
else if(isatty(fileno(yyin)))
{
#ifdef HAVE_READLINE
const char* prompt = parser->getPrompt();
- char* line = readline(const_cast<char*>(prompt));
- if(!line)
- {
- result = 0;
- }
- else
- {
- if(*line)
- {
- add_history(line);
- }
-
- result = strlen(line) + 1;
- if(result > maxSize)
- {
- free(line);
- error("input line too long");
- result = 0;
- }
- else
- {
- strcpy(buf, line);
- strcat(buf, "\n");
- free(line);
- }
- }
+ char* line = readline(const_cast<char*>(prompt));
+ if(!line)
+ {
+ result = 0;
+ }
+ else
+ {
+ if(*line)
+ {
+ add_history(line);
+ }
+
+ result = strlen(line) + 1;
+ if(result > maxSize)
+ {
+ free(line);
+ error("input line too long");
+ result = 0;
+ }
+ else
+ {
+ strcpy(buf, line);
+ strcat(buf, "\n");
+ free(line);
+ }
+ }
#else
- cout << parser->getPrompt() << flush;
-
- string line;
- while(true)
- {
- char c = static_cast<char>(getc(yyin));
- if(c == EOF)
- {
- if(line.size())
- {
- line += '\n';
- }
- break;
- }
- line += c;
-
- if(c == '\n')
- {
- break;
- }
- }
-
- result = (int) line.length();
- if(result > maxSize)
- {
- error("input line too long");
- buf[0] = EOF;
- result = 1;
- }
- else
- {
- strcpy(buf, line.c_str());
- }
+ cout << parser->getPrompt() << flush;
+
+ string line;
+ while(true)
+ {
+ char c = static_cast<char>(getc(yyin));
+ if(c == EOF)
+ {
+ if(line.size())
+ {
+ line += '\n';
+ }
+ break;
+ }
+ line += c;
+
+ if(c == '\n')
+ {
+ break;
+ }
+ }
+
+ result = (int) line.length();
+ if(result > maxSize)
+ {
+ error("input line too long");
+ buf[0] = EOF;
+ result = 1;
+ }
+ else
+ {
+ strcpy(buf, line.c_str());
+ }
#endif
}
else
{
- if(((result = (int) fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
- {
- error("input in flex scanner failed");
- buf[0] = EOF;
- result = 1;
- }
+ if(((result = (int) fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ {
+ error("input in flex scanner failed");
+ buf[0] = EOF;
+ result = 1;
+ }
}
}
@@ -1760,12 +1760,12 @@ Parser::getPrompt()
if(_continue)
{
- _continue = false;
- return "(cont) ";
+ _continue = false;
+ return "(cont) ";
}
else
{
- return ">>> ";
+ return ">>> ";
}
}
@@ -1778,13 +1778,13 @@ Parser::scanPosition(const char* s)
idx = line.find("line");
if(idx != string::npos)
{
- line.erase(0, idx + 4);
+ line.erase(0, idx + 4);
}
idx = line.find_first_not_of(" \t\r#");
if(idx != string::npos)
{
- line.erase(0, idx);
+ line.erase(0, idx);
}
_currentLine = atoi(line.c_str()) - 1;
@@ -1792,24 +1792,24 @@ Parser::scanPosition(const char* s)
idx = line.find_first_of(" \t\r");
if(idx != string::npos)
{
- line.erase(0, idx);
+ line.erase(0, idx);
}
idx = line.find_first_not_of(" \t\r\"");
if(idx != string::npos)
{
- line.erase(0, idx);
+ line.erase(0, idx);
- idx = line.find_first_of(" \t\r\"");
- if(idx != string::npos)
- {
- _currentFile = line.substr(0, idx);
- line.erase(0, idx + 1);
- }
- else
- {
- _currentFile = line;
- }
+ idx = line.find_first_of(" \t\r\"");
+ if(idx != string::npos)
+ {
+ _currentFile = line.substr(0, idx);
+ line.erase(0, idx + 1);
+ }
+ else
+ {
+ _currentFile = line;
+ }
}
}
@@ -1840,31 +1840,31 @@ Parser::patchFailed(const Ice::StringSeq& reasons)
out << "the patch failed on some nodes:\n";
for(Ice::StringSeq::const_iterator p = reasons.begin(); p != reasons.end(); ++p)
{
- string reason = *p;
- string::size_type beg = 0;
- string::size_type end = reason.find_first_of("\n");
- if(end == string::npos)
- {
- end = reason.size();
- }
- out << "- " << reason.substr(beg, end - beg);
- out.inc();
- while(end < reason.size())
- {
- beg = end + 1;
- end = reason.find_first_of("\n", beg);
- if(end == string::npos)
- {
- end = reason.size();
- }
- out.newline();
- out << reason.substr(beg, end - beg);
- }
- out.dec();
- if(p + 1 != reasons.end())
- {
- out.newline();
- }
+ string reason = *p;
+ string::size_type beg = 0;
+ string::size_type end = reason.find_first_of("\n");
+ if(end == string::npos)
+ {
+ end = reason.size();
+ }
+ out << "- " << reason.substr(beg, end - beg);
+ out.inc();
+ while(end < reason.size())
+ {
+ beg = end + 1;
+ end = reason.find_first_of("\n", beg);
+ if(end == string::npos)
+ {
+ end = reason.size();
+ }
+ out.newline();
+ out << reason.substr(beg, end - beg);
+ }
+ out.dec();
+ if(p + 1 != reasons.end())
+ {
+ out.newline();
+ }
}
warning(os.str());
}
@@ -1874,11 +1874,11 @@ Parser::error(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
}
else
{
- cerr << "error: " << s << endl;
+ cerr << "error: " << s << endl;
}
_errors++;
}
@@ -1894,11 +1894,11 @@ Parser::warning(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
}
else
{
- cerr << "warning: " << s << endl;
+ cerr << "warning: " << s << endl;
}
}
@@ -1929,7 +1929,7 @@ Parser::parse(FILE* file, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
@@ -1957,7 +1957,7 @@ Parser::parse(const std::string& commands, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
@@ -1965,9 +1965,9 @@ Parser::parse(const std::string& commands, bool debug)
}
Parser::Parser(const CommunicatorPtr& communicator,
- const AdminSessionPrx& session,
- const AdminPrx& admin,
- bool interactive) :
+ const AdminSessionPrx& session,
+ const AdminPrx& admin,
+ bool interactive) :
_communicator(communicator),
_session(session),
_admin(admin),
@@ -1976,11 +1976,11 @@ Parser::Parser(const CommunicatorPtr& communicator,
{
for(int i = 0; _commandsHelp[i][0]; i++)
{
- const string category = _commandsHelp[i][0];
- const string cmd = _commandsHelp[i][1];
- const string help = _commandsHelp[i][2];
- _helpCommands[category][""] += help;
- _helpCommands[category][cmd] += help;
+ const string category = _commandsHelp[i][0];
+ const string cmd = _commandsHelp[i][1];
+ const string help = _commandsHelp[i][2];
+ _helpCommands[category][""] += help;
+ _helpCommands[category][cmd] += help;
}
}
@@ -1989,81 +1989,81 @@ Parser::exception(const Ice::Exception& ex)
{
try
{
- ex.ice_throw();
+ ex.ice_throw();
}
catch(const ApplicationNotExistException& ex)
{
- error("couldn't find application `" + ex.name + "'");
+ error("couldn't find application `" + ex.name + "'");
}
catch(const NodeNotExistException& ex)
{
- error("couldn't find node `" + ex.name + "'");
+ error("couldn't find node `" + ex.name + "'");
}
catch(const ServerNotExistException& ex)
{
- error("couldn't find server `" + ex.id + "'");
+ error("couldn't find server `" + ex.id + "'");
}
catch(const AdapterNotExistException& ex)
{
- error("couldn't find adapter `" + ex.id + "'");
+ error("couldn't find adapter `" + ex.id + "'");
}
catch(const ObjectExistsException& ex)
{
- error("object `" + _communicator->identityToString(ex.id) + "' already exists");
+ error("object `" + _communicator->identityToString(ex.id) + "' already exists");
}
catch(const DeploymentException& ex)
{
- ostringstream s;
- s << ex << ":\n" << ex.reason;
- error(s.str());
+ ostringstream s;
+ s << ex << ":\n" << ex.reason;
+ error(s.str());
}
catch(const PatchException& ex)
{
- if(ex.reasons.size() == 1)
- {
- ostringstream s;
- s << ex << ":\n" << ex.reasons[0];
- error(s.str());
- }
- else
- {
- patchFailed(ex.reasons);
- }
+ if(ex.reasons.size() == 1)
+ {
+ ostringstream s;
+ s << ex << ":\n" << ex.reasons[0];
+ error(s.str());
+ }
+ else
+ {
+ patchFailed(ex.reasons);
+ }
}
catch(const BadSignalException& ex)
{
- ostringstream s;
- s << ex.reason;
- error(s.str());
+ ostringstream s;
+ s << ex.reason;
+ error(s.str());
}
catch(const NodeUnreachableException& ex)
{
- error("node `" + ex.name + "' couldn't be reached:\n" + ex.reason);
+ error("node `" + ex.name + "' couldn't be reached:\n" + ex.reason);
}
catch(const AccessDeniedException& ex)
{
- error("couldn't update the registry, the session from `" + ex.lockUserId + "' is updating the registry");
+ error("couldn't update the registry, the session from `" + ex.lockUserId + "' is updating the registry");
}
catch(const FileNotAvailableException& ex)
{
- error("couldn't access file:\n" + ex.reason);
+ error("couldn't access file:\n" + ex.reason);
}
catch(const IceXML::ParserException& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
catch(const Ice::LocalException& ex)
{
- ostringstream s;
- s << "couldn't reach the IceGrid registry:\n" << ex;
- error(s.str());
+ ostringstream s;
+ s << "couldn't reach the IceGrid registry:\n" << ex;
+ error(s.str());
}
catch(const Ice::Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp
index e9245b89527..ff7ccf65a3c 100644
--- a/cpp/src/IceGrid/PlatformInfo.cpp
+++ b/cpp/src/IceGrid/PlatformInfo.cpp
@@ -50,7 +50,7 @@ getLocalizedPerfName(const map<string, string>& perfNames, const string& name)
map<string, string>::const_iterator p = perfNames.find(name);
if(p == perfNames.end())
{
- return "";
+ return "";
}
istringstream is(p->second);
is >> idx;
@@ -60,8 +60,8 @@ getLocalizedPerfName(const map<string, string>& perfNames, const string& name)
localized.resize(size);
while(PdhLookupPerfNameByIndex(0, idx, &localized[0], &size) == PDH_MORE_DATA)
{
- size += 256;
- localized.resize(size);
+ size += 256;
+ localized.resize(size);
}
return string(&localized[0]);
}
@@ -94,8 +94,8 @@ toNodeInfo(const InternalNodeInfoPtr& node)
}
PlatformInfo::PlatformInfo(const string& prefix,
- const Ice::CommunicatorPtr& communicator,
- const TraceLevelsPtr& traceLevels) :
+ const Ice::CommunicatorPtr& communicator,
+ const TraceLevelsPtr& traceLevels) :
_traceLevels(traceLevels)
{
//
@@ -125,18 +125,18 @@ PlatformInfo::PlatformInfo(const string& prefix,
nl.n_value = 0;
if(knlist(&nl, 1, sizeof(nl)) == 0)
{
- _kmem = open("/dev/kmem", O_RDONLY);
+ _kmem = open("/dev/kmem", O_RDONLY);
- //
- // Give up root permissions to minimize security risks, it's
- // only needed to access /dev/kmem.
- //
+ //
+ // Give up root permissions to minimize security risks, it's
+ // only needed to access /dev/kmem.
+ //
setuid(getuid());
setgid(getgid());
}
else
{
- _kmem = -1;
+ _kmem = -1;
}
#endif
@@ -152,9 +152,9 @@ PlatformInfo::PlatformInfo(const string& prefix,
size_t sz = sizeof(_nProcessors);
if(sysctl(ncpu, 2, &_nProcessors, &sz, 0, 0) == -1)
{
- Ice::SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ Ice::SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
#elif defined(__hpux)
struct pst_dynamic dynInfo;
@@ -179,7 +179,7 @@ PlatformInfo::PlatformInfo(const string& prefix,
unsigned long size = sizeof(hostname);
if(GetComputerName(hostname, &size))
{
- _hostname = hostname;
+ _hostname = hostname;
}
OSVERSIONINFO osInfo;
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -196,17 +196,17 @@ PlatformInfo::PlatformInfo(const string& prefix,
#else
case PROCESSOR_ARCHITECTURE_AMD64:
#endif
- _machine = "x64";
- break;
+ _machine = "x64";
+ break;
case PROCESSOR_ARCHITECTURE_IA64:
- _machine = "IA64";
- break;
+ _machine = "IA64";
+ break;
case PROCESSOR_ARCHITECTURE_INTEL:
- _machine = "x86";
- break;
+ _machine = "x86";
+ break;
default:
- _machine = "unknown";
- break;
+ _machine = "unknown";
+ break;
};
#else
struct utsname utsinfo;
@@ -226,15 +226,15 @@ PlatformInfo::PlatformInfo(const string& prefix,
string oldEndpointsPrefix;
if(prefix == "IceGrid.Registry")
{
- _name = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master");
- endpointsPrefix = "Ice.OA." + prefix + ".Client";
- oldEndpointsPrefix = prefix + ".Client";
+ _name = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master");
+ endpointsPrefix = "Ice.OA." + prefix + ".Client";
+ oldEndpointsPrefix = prefix + ".Client";
}
else
{
- _name = properties->getProperty(prefix + ".Name");
- endpointsPrefix = "Ice.OA." + prefix;
- oldEndpointsPrefix = prefix;
+ _name = properties->getProperty(prefix + ".Name");
+ endpointsPrefix = "Ice.OA." + prefix;
+ oldEndpointsPrefix = prefix;
}
Ice::PropertyDict props = properties->getPropertiesForPrefix(endpointsPrefix);
@@ -254,7 +254,7 @@ PlatformInfo::PlatformInfo(const string& prefix,
else
{
_endpoints = properties->getPropertyWithDefault(
- endpointsPrefix + ".Endpoints", properties->getProperty(oldEndpointsPrefix + ".Endpoints"));
+ endpointsPrefix + ".Endpoints", properties->getProperty(oldEndpointsPrefix + ".Endpoints"));
}
}
@@ -262,7 +262,7 @@ PlatformInfo::PlatformInfo(const string& prefix,
char cwd[_MAX_PATH];
if(_getcwd(cwd, _MAX_PATH) == NULL)
#else
- char cwd[PATH_MAX];
+ char cwd[PATH_MAX];
if(getcwd(cwd, PATH_MAX) == NULL)
#endif
{
@@ -273,11 +273,11 @@ PlatformInfo::PlatformInfo(const string& prefix,
_dataDir = properties->getProperty(prefix + ".Data");
if(!IcePatch2::isAbsolute(_dataDir))
{
- _dataDir = _cwd + '/' + _dataDir;
+ _dataDir = _cwd + '/' + _dataDir;
}
if(_dataDir[_dataDir.length() - 1] == '/')
{
- _dataDir = _dataDir.substr(0, _dataDir.length() - 1);
+ _dataDir = _dataDir.substr(0, _dataDir.length() - 1);
}
}
@@ -286,12 +286,12 @@ PlatformInfo::~PlatformInfo()
#ifdef _WIN32
if(_query != NULL)
{
- PdhCloseQuery(_query);
+ PdhCloseQuery(_query);
}
#elif defined(_AIX)
if(_kmem > 0)
{
- close(_kmem);
+ close(_kmem);
}
#endif
}
@@ -344,14 +344,14 @@ PlatformInfo::getLoadInfo()
int usage = 100;
if(_query == NULL)
{
- initQuery();
+ initQuery();
}
if(_query != NULL && _counter != NULL && PdhCollectQueryData(_query) == ERROR_SUCCESS)
{
- DWORD type;
- PDH_FMT_COUNTERVALUE value;
- PdhGetFormattedCounterValue(_counter, PDH_FMT_LONG, &type, &value);
- usage = static_cast<int>(value.longValue);
+ DWORD type;
+ PDH_FMT_COUNTERVALUE value;
+ PdhGetFormattedCounterValue(_counter, PDH_FMT_LONG, &type, &value);
+ usage = static_cast<int>(value.longValue);
}
_last1Total += usage - _usages1.back();
@@ -377,34 +377,34 @@ PlatformInfo::getLoadInfo()
double loadAvg[3];
if(getloadavg(loadAvg, 3) != -1)
{
- info.avg1 = static_cast<float>(loadAvg[0]);
- info.avg5 = static_cast<float>(loadAvg[1]);
- info.avg15 = static_cast<float>(loadAvg[2]);
+ info.avg1 = static_cast<float>(loadAvg[0]);
+ info.avg5 = static_cast<float>(loadAvg[1]);
+ info.avg15 = static_cast<float>(loadAvg[2]);
}
#elif defined(__hpux)
struct pst_dynamic dynInfo;
if(pstat_getdynamic(&dynInfo, sizeof(dynInfo), 1, 0) >= 0)
{
- info.avg1 = dynInfo.psd_avg_1_min;
- info.avg5 = dynInfo.psd_avg_5_min;
- info.avg15 = dynInfo.psd_avg_15_min;
+ info.avg1 = dynInfo.psd_avg_1_min;
+ info.avg5 = dynInfo.psd_avg_5_min;
+ info.avg15 = dynInfo.psd_avg_15_min;
}
#elif defined(_AIX)
if(_kmem > 1)
{
- long long avenrun[3];
- struct nlist nl;
- nl.n_name = "avenrun";
- nl.n_value = 0;
- if(knlist(&nl, 1, sizeof(nl)) == 0)
- {
- if(pread(_kmem, avenrun, sizeof(avenrun), nl.n_value) >= sizeof(avenrun))
- {
- info.avg1 = avenrun[0] / 65536.0f;
- info.avg5 = avenrun[1] / 65536.0f;
- info.avg15 = avenrun[2] / 65536.0f;
- }
- }
+ long long avenrun[3];
+ struct nlist nl;
+ nl.n_name = "avenrun";
+ nl.n_value = 0;
+ if(knlist(&nl, 1, sizeof(nl)) == 0)
+ {
+ if(pread(_kmem, avenrun, sizeof(avenrun), nl.n_value) >= sizeof(avenrun))
+ {
+ info.avg1 = avenrun[0] / 65536.0f;
+ info.avg5 = avenrun[1] / 65536.0f;
+ info.avg15 = avenrun[2] / 65536.0f;
+ }
+ }
}
#endif
return info;
@@ -438,11 +438,11 @@ PlatformInfo::initQuery()
PDH_STATUS err = PdhOpenQuery(0, 0, &_query);
if(err != ERROR_SUCCESS)
{
- Ice::SyscallException ex(__FILE__, __LINE__);
- ex.error = err;
- Ice::Warning out(_traceLevels->logger);
- out << "can't open performance data query:\n" << ex;
- return;
+ Ice::SyscallException ex(__FILE__, __LINE__);
+ ex.error = err;
+ Ice::Warning out(_traceLevels->logger);
+ out << "can't open performance data query:\n" << ex;
+ return;
}
//
@@ -453,8 +453,8 @@ PlatformInfo::initQuery()
buffer.resize(size);
while(RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Counter 09", 0, 0, &buffer[0], &size) == ERROR_MORE_DATA)
{
- size += 8192;
- buffer.resize(size);
+ size += 8192;
+ buffer.resize(size);
}
map<string, string> perfNames;
@@ -462,15 +462,15 @@ PlatformInfo::initQuery()
unsigned int i = 0;
while(i < buffer.size() && buf[i])
{
- string index(&buf[i]);
- i += static_cast<int>(index.size()) + 1;
- if(i >= buffer.size())
- {
- break;
- }
- string name(&buf[i]);
- i += static_cast<int>(name.size()) + 1;
- perfNames.insert(make_pair(name, index));
+ string index(&buf[i]);
+ i += static_cast<int>(index.size()) + 1;
+ if(i >= buffer.size())
+ {
+ break;
+ }
+ string name(&buf[i]);
+ i += static_cast<int>(name.size()) + 1;
+ perfNames.insert(make_pair(name, index));
}
//
@@ -486,10 +486,10 @@ PlatformInfo::initQuery()
err = PdhAddCounter(_query, name.c_str(), 0, &_counter);
if(err != ERROR_SUCCESS)
{
- Ice::SyscallException ex(__FILE__, __LINE__);
- ex.error = err;
- Ice::Warning out(_traceLevels->logger);
- out << "can't add performance counter `" << name << "':\n" << ex;
+ Ice::SyscallException ex(__FILE__, __LINE__);
+ ex.error = err;
+ Ice::Warning out(_traceLevels->logger);
+ out << "can't add performance counter `" << name << "':\n" << ex;
}
}
#endif
diff --git a/cpp/src/IceGrid/QueryI.cpp b/cpp/src/IceGrid/QueryI.cpp
index 187b6c1339f..3d5cddf03ea 100644
--- a/cpp/src/IceGrid/QueryI.cpp
+++ b/cpp/src/IceGrid/QueryI.cpp
@@ -30,11 +30,11 @@ QueryI::findObjectById(const Ice::Identity& id, const Ice::Current&) const
{
try
{
- return _database->getObjectProxy(id);
+ return _database->getObjectProxy(id);
}
catch(const ObjectNotRegisteredException&)
{
- return 0;
+ return 0;
}
}
@@ -62,28 +62,28 @@ QueryI::findAllReplicas(const Ice::ObjectPrx& proxy, const Ice::Current&) const
{
try
{
- if(!proxy)
- {
- return Ice::ObjectProxySeq();
- }
+ if(!proxy)
+ {
+ return Ice::ObjectProxySeq();
+ }
- AdapterInfoSeq infos = _database->getAdapterInfo(proxy->ice_getAdapterId());
- assert(!infos.empty());
- if(infos[0].replicaGroupId != proxy->ice_getAdapterId()) // The adapter id doesn't refer to a replica group.
- {
- return Ice::ObjectProxySeq();
- }
+ AdapterInfoSeq infos = _database->getAdapterInfo(proxy->ice_getAdapterId());
+ assert(!infos.empty());
+ if(infos[0].replicaGroupId != proxy->ice_getAdapterId()) // The adapter id doesn't refer to a replica group.
+ {
+ return Ice::ObjectProxySeq();
+ }
- Ice::ObjectProxySeq proxies;
- for(AdapterInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p)
- {
- assert(!p->id.empty());
- proxies.push_back(proxy->ice_adapterId(p->id));
- }
- return proxies;
+ Ice::ObjectProxySeq proxies;
+ for(AdapterInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p)
+ {
+ assert(!p->id.empty());
+ proxies.push_back(proxy->ice_adapterId(p->id));
+ }
+ return proxies;
}
catch(const AdapterNotExistException&)
{
- return Ice::ObjectProxySeq();
+ return Ice::ObjectProxySeq();
}
}
diff --git a/cpp/src/IceGrid/QueryI.h b/cpp/src/IceGrid/QueryI.h
index 58fb86c182b..37a6ea87df3 100644
--- a/cpp/src/IceGrid/QueryI.h
+++ b/cpp/src/IceGrid/QueryI.h
@@ -31,7 +31,7 @@ public:
virtual Ice::ObjectPrx findObjectByType(const ::std::string&, const ::Ice::Current&) const;
virtual Ice::ObjectPrx findObjectByTypeOnLeastLoadedNode(const ::std::string&, LoadSample,
- const ::Ice::Current&) const;
+ const ::Ice::Current&) const;
virtual Ice::ObjectProxySeq findAllObjectsByType(const ::std::string&, const ::Ice::Current&) const;
diff --git a/cpp/src/IceGrid/ReapThread.cpp b/cpp/src/IceGrid/ReapThread.cpp
index e781683bd41..06869232b6e 100644
--- a/cpp/src/IceGrid/ReapThread.cpp
+++ b/cpp/src/IceGrid/ReapThread.cpp
@@ -24,61 +24,61 @@ ReapThread::run()
vector<ReapableItem> reap;
while(true)
{
- {
- Lock sync(*this);
- if(_terminated)
- {
- break;
- }
-
- calcWakeInterval();
-
- //
- // If the wake interval is zero then we wait forever.
- //
- if(_wakeInterval == IceUtil::Time())
- {
- assert(_sessions.empty());
- wait();
- }
- else
- {
- assert(!_sessions.empty());
- timedWait(_wakeInterval);
- }
-
- if(_terminated)
- {
- break;
- }
-
- list<ReapableItem>::iterator p = _sessions.begin();
- while(p != _sessions.end())
- {
- try
- {
- if((IceUtil::Time::now() - p->item->timestamp()) > p->timeout)
- {
- reap.push_back(*p);
- p = _sessions.erase(p);
- }
- else
- {
- ++p;
- }
- }
- catch(const Ice::ObjectNotExistException&)
- {
- p = _sessions.erase(p);
- }
- }
- }
-
- for(vector<ReapableItem>::const_iterator p = reap.begin(); p != reap.end(); ++p)
- {
- p->item->destroy(false);
- }
- reap.clear();
+ {
+ Lock sync(*this);
+ if(_terminated)
+ {
+ break;
+ }
+
+ calcWakeInterval();
+
+ //
+ // If the wake interval is zero then we wait forever.
+ //
+ if(_wakeInterval == IceUtil::Time())
+ {
+ assert(_sessions.empty());
+ wait();
+ }
+ else
+ {
+ assert(!_sessions.empty());
+ timedWait(_wakeInterval);
+ }
+
+ if(_terminated)
+ {
+ break;
+ }
+
+ list<ReapableItem>::iterator p = _sessions.begin();
+ while(p != _sessions.end())
+ {
+ try
+ {
+ if((IceUtil::Time::now() - p->item->timestamp()) > p->timeout)
+ {
+ reap.push_back(*p);
+ p = _sessions.erase(p);
+ }
+ else
+ {
+ ++p;
+ }
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ p = _sessions.erase(p);
+ }
+ }
+ }
+
+ for(vector<ReapableItem>::const_iterator p = reap.begin(); p != reap.end(); ++p)
+ {
+ p->item->destroy(false);
+ }
+ reap.clear();
}
}
@@ -87,20 +87,20 @@ ReapThread::terminate()
{
list<ReapableItem> reap;
{
- Lock sync(*this);
- if(_terminated)
- {
- assert(_sessions.empty());
- return;
- }
- _terminated = true;
- notify();
- reap.swap(_sessions);
+ Lock sync(*this);
+ if(_terminated)
+ {
+ assert(_sessions.empty());
+ return;
+ }
+ _terminated = true;
+ notify();
+ reap.swap(_sessions);
}
for(list<ReapableItem>::iterator p = reap.begin(); p != reap.end(); ++p)
{
- p->item->destroy(true);
+ p->item->destroy(true);
}
}
@@ -110,7 +110,7 @@ ReapThread::add(const ReapablePtr& reapable, int timeout)
Lock sync(*this);
if(_terminated)
{
- return;
+ return;
}
//
@@ -118,7 +118,7 @@ ReapThread::add(const ReapablePtr& reapable, int timeout)
//
if(timeout < 10)
{
- timeout = 10;
+ timeout = 10;
}
ReapableItem item;
@@ -132,7 +132,7 @@ ReapThread::add(const ReapablePtr& reapable, int timeout)
//
if(calcWakeInterval())
{
- notify();
+ notify();
}
//
@@ -154,11 +154,11 @@ ReapThread::calcWakeInterval()
bool first = true;
for(list<ReapableItem>::const_iterator p = _sessions.begin(); p != _sessions.end(); ++p)
{
- if(first || p->timeout < minimum)
- {
- minimum = p->timeout;
- first = false;
- }
+ if(first || p->timeout < minimum)
+ {
+ minimum = p->timeout;
+ first = false;
+ }
}
_wakeInterval = minimum;
diff --git a/cpp/src/IceGrid/ReapThread.h b/cpp/src/IceGrid/ReapThread.h
index 317624fcba5..88729d500ac 100644
--- a/cpp/src/IceGrid/ReapThread.h
+++ b/cpp/src/IceGrid/ReapThread.h
@@ -43,42 +43,42 @@ class SessionReapable : public Reapable
public:
SessionReapable(const Ice::LoggerPtr& logger, const TPtr& session) :
- _logger(logger), _session(session)
+ _logger(logger), _session(session)
{
}
virtual ~SessionReapable()
{
}
-
+
virtual IceUtil::Time
timestamp() const
{
- return _session->timestamp();
+ return _session->timestamp();
}
virtual void
destroy(bool shutdown)
{
- try
- {
- if(shutdown)
- {
- _session->shutdown();
- }
- else
- {
- _session->destroy(Ice::Current());
- }
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_logger);
- out << "unexpected exception while reaping session:\n" << ex;
- }
+ try
+ {
+ if(shutdown)
+ {
+ _session->shutdown();
+ }
+ else
+ {
+ _session->destroy(Ice::Current());
+ }
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_logger);
+ out << "unexpected exception while reaping session:\n" << ex;
+ }
}
private:
@@ -105,8 +105,8 @@ private:
bool _terminated;
struct ReapableItem
{
- ReapablePtr item;
- IceUtil::Time timeout;
+ ReapablePtr item;
+ IceUtil::Time timeout;
};
std::list<ReapableItem> _sessions;
};
diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp
index e059519cbc0..8f9d0fc1287 100644
--- a/cpp/src/IceGrid/RegistryI.cpp
+++ b/cpp/src/IceGrid/RegistryI.cpp
@@ -65,7 +65,7 @@ public:
bool checkPermissions(const string& userId, const string& password, string&, const Current&) const
{
- return true;
+ return true;
}
};
@@ -76,7 +76,7 @@ public:
virtual bool
authorize(const Glacier2::SSLInfo&, std::string&, const Ice::Current&) const
{
- return true;
+ return true;
}
};
@@ -90,25 +90,25 @@ public:
bool checkPermissions(const string& userId, const string& password, string&, const Current&) const
{
- map<string, string>::const_iterator p = _passwords.find(userId);
- if(p == _passwords.end())
- {
- return false;
- }
-
- if(p->second.size() != 13) // Crypt passwords are 13 characters long.
- {
- return false;
- }
-
- char buff[14];
- string salt = p->second.substr(0, 2);
+ map<string, string>::const_iterator p = _passwords.find(userId);
+ if(p == _passwords.end())
+ {
+ return false;
+ }
+
+ if(p->second.size() != 13) // Crypt passwords are 13 characters long.
+ {
+ return false;
+ }
+
+ char buff[14];
+ string salt = p->second.substr(0, 2);
#if OPENSSL_VERSION_NUMBER >= 0x0090700fL
- DES_fcrypt(password.c_str(), salt.c_str(), buff);
+ DES_fcrypt(password.c_str(), salt.c_str(), buff);
#else
- des_fcrypt(password.c_str(), salt.c_str(), buff);
+ des_fcrypt(password.c_str(), salt.c_str(), buff);
#endif
- return p->second == buff;
+ return p->second == buff;
}
private:
@@ -141,21 +141,21 @@ RegistryI::start(bool nowarn)
string dbPath = properties->getProperty("IceGrid.Registry.Data");
if(dbPath.empty())
{
- Error out(_communicator->getLogger());
- out << "property `IceGrid.Registry.Data' is not set";
- return false;
+ Error out(_communicator->getLogger());
+ out << "property `IceGrid.Registry.Data' is not set";
+ return false;
}
else
{
- struct stat filestat;
- if(stat(dbPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
- {
- Error out(_communicator->getLogger());
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- out << "property `IceGrid.Registry.Data' is set to an invalid path:\n" << ex;
- return false;
- }
+ struct stat filestat;
+ if(stat(dbPath.c_str(), &filestat) != 0 || !S_ISDIR(filestat.st_mode))
+ {
+ Error out(_communicator->getLogger());
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ out << "property `IceGrid.Registry.Data' is set to an invalid path:\n" << ex;
+ return false;
+ }
}
//
@@ -166,9 +166,9 @@ RegistryI::start(bool nowarn)
if(properties->getProperty("Ice.OA.IceGrid.Registry.Client.Endpoints").empty() &&
properties->getProperty("IceGrid.Registry.Client.Endpoints").empty())
{
- Error out(_communicator->getLogger());
- out << "property `Ice.OA.IceGrid.Registry.Client.Endpoints' is not set";
- return false;
+ Error out(_communicator->getLogger());
+ out << "property `Ice.OA.IceGrid.Registry.Client.Endpoints' is not set";
+ return false;
}
//
@@ -177,9 +177,9 @@ RegistryI::start(bool nowarn)
if(properties->getProperty("Ice.OA.IceGrid.Registry.Server.Endpoints").empty() &&
properties->getProperty("IceGrid.Registry.Server.Endpoints").empty())
{
- Error out(_communicator->getLogger());
- out << "property `Ice.OA.IceGrid.Registry.Server.Endpoints' is not set";
- return false;
+ Error out(_communicator->getLogger());
+ out << "property `Ice.OA.IceGrid.Registry.Server.Endpoints' is not set";
+ return false;
}
//
@@ -188,9 +188,9 @@ RegistryI::start(bool nowarn)
if(properties->getProperty("Ice.OA.IceGrid.Registry.Internal.Endpoints").empty() &&
properties->getProperty("IceGrid.Registry.Internal.Endpoints").empty())
{
- Error out(_communicator->getLogger());
- out << "property `Ice.OA.IceGrid.Registry.Internal.Endpoints' is not set";
- return false;
+ Error out(_communicator->getLogger());
+ out << "property `Ice.OA.IceGrid.Registry.Internal.Endpoints' is not set";
+ return false;
}
//
@@ -199,11 +199,11 @@ RegistryI::start(bool nowarn)
if(!properties->getProperty("Ice.OA.IceGrid.Registry.SessionManager.Endpoints").empty() ||
!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty())
{
- if(!nowarn)
- {
- Warning out(_communicator->getLogger());
- out << "session manager endpoints `Ice.OA.IceGrid.Registry.SessionManager.Endpoints' enabled";
- }
+ if(!nowarn)
+ {
+ Warning out(_communicator->getLogger());
+ out << "session manager endpoints `Ice.OA.IceGrid.Registry.SessionManager.Endpoints' enabled";
+ }
}
properties->setProperty("Ice.PrintProcessId", "0");
@@ -228,28 +228,28 @@ RegistryI::start(bool nowarn)
//
if(_master)
{
- _instanceName = properties->getProperty("IceGrid.InstanceName");
- if(_instanceName.empty())
- {
- if(_communicator->getDefaultLocator())
- {
- _instanceName = _communicator->getDefaultLocator()->ice_getIdentity().category;
- }
- else
- {
- _instanceName = "IceGrid";
- }
- }
+ _instanceName = properties->getProperty("IceGrid.InstanceName");
+ if(_instanceName.empty())
+ {
+ if(_communicator->getDefaultLocator())
+ {
+ _instanceName = _communicator->getDefaultLocator()->ice_getIdentity().category;
+ }
+ else
+ {
+ _instanceName = "IceGrid";
+ }
+ }
}
else
{
- if(properties->getProperty("Ice.Default.Locator").empty())
- {
- Error out(_communicator->getLogger());
- out << "property `Ice.Default.Locator' is not set";
- return false;
- }
- _instanceName = _communicator->getDefaultLocator()->ice_getIdentity().category;
+ if(properties->getProperty("Ice.Default.Locator").empty())
+ {
+ Error out(_communicator->getLogger());
+ out << "property `Ice.Default.Locator' is not set";
+ return false;
+ }
+ _instanceName = _communicator->getDefaultLocator()->ice_getIdentity().category;
}
//
@@ -261,18 +261,18 @@ RegistryI::start(bool nowarn)
try
{
//
- // DEPRECATED PROPERTY: Remove extra code in future release
- //
+ // DEPRECATED PROPERTY: Remove extra code in future release
+ //
string endpoints =
- properties->getPropertyWithDefault("Ice.OA.IceGrid.Registry.Client.Endpoints",
- properties->getProperty("IceGrid.Registry.Client.Endpoints"));
- string strPrx = _instanceName + "/Locator:" + endpoints;
- _communicator->stringToProxy(strPrx)->ice_timeout(5000)->ice_ping();
+ properties->getPropertyWithDefault("Ice.OA.IceGrid.Registry.Client.Endpoints",
+ properties->getProperty("IceGrid.Registry.Client.Endpoints"));
+ string strPrx = _instanceName + "/Locator:" + endpoints;
+ _communicator->stringToProxy(strPrx)->ice_timeout(5000)->ice_ping();
- Error out(_communicator->getLogger());
- out << "an IceGrid registry is already running and listening on\n";
- out << "the client endpoints `" << endpoints << "'";
- return false;
+ Error out(_communicator->getLogger());
+ out << "an IceGrid registry is already running and listening on\n";
+ out << "the client endpoints `" << endpoints << "'";
+ return false;
}
catch(const Ice::LocalException&)
{
@@ -300,11 +300,11 @@ RegistryI::start(bool nowarn)
registryTopicManagerId.category = _instanceName;
registryTopicManagerId.name = "RegistryTopicManager";
_iceStorm = IceStorm::Service::create(_communicator,
- registryAdapter,
- registryAdapter,
- "IceGrid.Registry",
- registryTopicManagerId,
- "Registry");
+ registryAdapter,
+ registryAdapter,
+ "IceGrid.Registry",
+ registryTopicManagerId,
+ "Registry");
const IceStorm::TopicManagerPrx topicManager = _iceStorm->getTopicManager();
//
@@ -324,14 +324,14 @@ RegistryI::start(bool nowarn)
proxies = _database->getInternalObjectsByType(Node::ice_staticId());
for(p = proxies.begin(); p != proxies.end(); ++p)
{
- nodes.push_back(NodePrx::uncheckedCast(*p));
+ nodes.push_back(NodePrx::uncheckedCast(*p));
}
InternalRegistryPrxSeq replicas;
proxies = _database->getObjectsByType(InternalRegistry::ice_staticId());
for(p = proxies.begin(); p != proxies.end(); ++p)
{
- replicas.push_back(InternalRegistryPrx::uncheckedCast(*p));
+ replicas.push_back(InternalRegistryPrx::uncheckedCast(*p));
}
//
@@ -343,14 +343,14 @@ RegistryI::start(bool nowarn)
InternalRegistryPrx internalRegistry = setupInternalRegistry(registryAdapter);
if(_master)
{
- nodes = registerReplicas(internalRegistry, replicas, nodes);
- registerNodes(internalRegistry, nodes);
+ nodes = registerReplicas(internalRegistry, replicas, nodes);
+ registerNodes(internalRegistry, nodes);
}
else
{
- InternalReplicaInfoPtr info = _platform.getInternalReplicaInfo();
- _session.create(_replicaName, info, _database, _wellKnownObjects, internalRegistry);
- registerNodes(internalRegistry, _session.getNodes(nodes));
+ InternalReplicaInfoPtr info = _platform.getInternalReplicaInfo();
+ _session.create(_replicaName, info, _database, _wellKnownObjects, internalRegistry);
+ registerNodes(internalRegistry, _session.getNodes(nodes));
}
ObjectAdapterPtr serverAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Server");
@@ -362,7 +362,7 @@ RegistryI::start(bool nowarn)
if(!properties->getProperty("Ice.OA.IceGrid.Registry.SessionManager.Endpoints").empty() ||
!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty())
{
- sessionManagerAdapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager");
+ sessionManagerAdapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager");
}
Ice::Identity dummy;
@@ -371,14 +371,14 @@ RegistryI::start(bool nowarn)
_wellKnownObjects->addEndpoint("Server", serverAdapter->createDirectProxy(dummy));
if(sessionManagerAdapter)
{
- _wellKnownObjects->addEndpoint("SessionManager", sessionManagerAdapter->createDirectProxy(dummy));
+ _wellKnownObjects->addEndpoint("SessionManager", sessionManagerAdapter->createDirectProxy(dummy));
}
_wellKnownObjects->addEndpoint("Internal", registryAdapter->createDirectProxy(dummy));
setupNullPermissionsVerifier(registryAdapter);
if(!setupUserAccountMapper(registryAdapter))
{
- return false;
+ return false;
}
QueryPrx query = setupQuery(_clientAdapter);
@@ -401,11 +401,11 @@ RegistryI::start(bool nowarn)
_wellKnownObjects->finish();
if(_master)
{
- _wellKnownObjects->registerAll();
+ _wellKnownObjects->registerAll();
}
else
{
- _session.registerAllWellKnownObjects();
+ _session.registerAllWellKnownObjects();
}
//
@@ -415,7 +415,7 @@ RegistryI::start(bool nowarn)
_clientAdapter->activate();
if(sessionManagerAdapter)
{
- sessionManagerAdapter->activate();
+ sessionManagerAdapter->activate();
}
return true;
@@ -434,10 +434,10 @@ RegistryI::setupLocatorRegistry(const Ice::ObjectAdapterPtr& serverAdapter)
IceGrid::LocatorPrx
RegistryI::setupLocator(const Ice::ObjectAdapterPtr& clientAdapter,
- const Ice::ObjectAdapterPtr& registryAdapter,
- const Ice::LocatorRegistryPrx& locatorRegistry,
- const RegistryPrx& registry,
- const QueryPrx& query)
+ const Ice::ObjectAdapterPtr& registryAdapter,
+ const Ice::LocatorRegistryPrx& locatorRegistry,
+ const RegistryPrx& registry,
+ const QueryPrx& query)
{
LocatorPtr locator = new LocatorI(_communicator, _database, locatorRegistry, registry, query);
Identity locatorId;
@@ -469,7 +469,7 @@ RegistryI::setupRegistry(const Ice::ObjectAdapterPtr& clientAdapter)
registryId.name = "Registry";
if(!_master)
{
- registryId.name += "-" + _replicaName;
+ registryId.name += "-" + _replicaName;
}
RegistryPrx proxy = RegistryPrx::uncheckedCast(clientAdapter->add(this, registryId));
_wellKnownObjects->add(proxy, Registry::ice_staticId());
@@ -499,13 +499,13 @@ RegistryI::setupNullPermissionsVerifier(const Ice::ObjectAdapterPtr& registryAda
nullPermVerifId.category = _instanceName;
nullPermVerifId.name = "NullPermissionsVerifier";
_nullPermissionsVerifier = Glacier2::PermissionsVerifierPrx::uncheckedCast(
- registryAdapter->add(new NullPermissionsVerifierI(), nullPermVerifId)->ice_collocationOptimized(true));
+ registryAdapter->add(new NullPermissionsVerifierI(), nullPermVerifId)->ice_collocationOptimized(true));
Identity nullSSLPermVerifId;
nullSSLPermVerifId.category = _instanceName;
nullSSLPermVerifId.name = "NullSSLPermissionsVerifier";
_nullSSLPermissionsVerifier = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast(
- registryAdapter->add(new NullSSLPermissionsVerifierI(), nullSSLPermVerifId)->ice_collocationOptimized(true));
+ registryAdapter->add(new NullSSLPermissionsVerifierI(), nullSSLPermVerifId)->ice_collocationOptimized(true));
}
bool
@@ -519,33 +519,33 @@ RegistryI::setupUserAccountMapper(const Ice::ObjectAdapterPtr& registryAdapter)
string userAccountFileProperty = properties->getProperty("IceGrid.Registry.UserAccounts");
if(!userAccountFileProperty.empty())
{
- try
- {
- Identity mapperId;
- mapperId.category = _instanceName;
- mapperId.name = "RegistryUserAccountMapper";
- if(!_master)
- {
- mapperId.name += "-" + _replicaName;
- }
- registryAdapter->add(new FileUserAccountMapperI(userAccountFileProperty), mapperId);
- _wellKnownObjects->add(registryAdapter->createProxy(mapperId), UserAccountMapper::ice_staticId());
- }
- catch(const std::string& msg)
- {
- Error out(_communicator->getLogger());
- out << msg;
- return false;
- }
+ try
+ {
+ Identity mapperId;
+ mapperId.category = _instanceName;
+ mapperId.name = "RegistryUserAccountMapper";
+ if(!_master)
+ {
+ mapperId.name += "-" + _replicaName;
+ }
+ registryAdapter->add(new FileUserAccountMapperI(userAccountFileProperty), mapperId);
+ _wellKnownObjects->add(registryAdapter->createProxy(mapperId), UserAccountMapper::ice_staticId());
+ }
+ catch(const std::string& msg)
+ {
+ Error out(_communicator->getLogger());
+ out << msg;
+ return false;
+ }
}
return true;
}
void
RegistryI::setupClientSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter,
- const Ice::ObjectAdapterPtr& sessionManagerAdapter,
- const IceGrid::LocatorPrx& locator,
- bool nowarn)
+ const Ice::ObjectAdapterPtr& sessionManagerAdapter,
+ const IceGrid::LocatorPrx& locator,
+ bool nowarn)
{
_waitQueue = new WaitQueue(); // Used for for session allocation timeout.
_waitQueue->start();
@@ -555,80 +555,80 @@ RegistryI::setupClientSessionFactory(const Ice::ObjectAdapterPtr& registryAdapte
if(sessionManagerAdapter && _master) // Slaves don't support client session manager objects.
{
- Identity clientSessionMgrId;
- clientSessionMgrId.category = _instanceName;
- clientSessionMgrId.name = "SessionManager";
- Identity sslClientSessionMgrId;
- sslClientSessionMgrId.category = _instanceName;
- sslClientSessionMgrId.name = "SSLSessionManager";
+ Identity clientSessionMgrId;
+ clientSessionMgrId.category = _instanceName;
+ clientSessionMgrId.name = "SessionManager";
+ Identity sslClientSessionMgrId;
+ sslClientSessionMgrId.category = _instanceName;
+ sslClientSessionMgrId.name = "SSLSessionManager";
- sessionManagerAdapter->add(new ClientSessionManagerI(_clientSessionFactory), clientSessionMgrId);
- sessionManagerAdapter->add(new ClientSSLSessionManagerI(_clientSessionFactory), sslClientSessionMgrId);
+ sessionManagerAdapter->add(new ClientSessionManagerI(_clientSessionFactory), clientSessionMgrId);
+ sessionManagerAdapter->add(new ClientSSLSessionManagerI(_clientSessionFactory), sslClientSessionMgrId);
- _wellKnownObjects->add(sessionManagerAdapter->createProxy(clientSessionMgrId),
- Glacier2::SessionManager::ice_staticId());
-
- _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslClientSessionMgrId),
- Glacier2::SSLSessionManager::ice_staticId());
+ _wellKnownObjects->add(sessionManagerAdapter->createProxy(clientSessionMgrId),
+ Glacier2::SessionManager::ice_staticId());
+
+ _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslClientSessionMgrId),
+ Glacier2::SSLSessionManager::ice_staticId());
}
Ice::PropertiesPtr properties = _communicator->getProperties();
_clientVerifier = getPermissionsVerifier(registryAdapter,
- locator,
- "IceGrid.Registry.PermissionsVerifier",
- properties->getProperty("IceGrid.Registry.CryptPasswords"),
- nowarn);
+ locator,
+ "IceGrid.Registry.PermissionsVerifier",
+ properties->getProperty("IceGrid.Registry.CryptPasswords"),
+ nowarn);
_sslClientVerifier = getSSLPermissionsVerifier(locator,
- "IceGrid.Registry.SSLPermissionsVerifier",
- nowarn);
+ "IceGrid.Registry.SSLPermissionsVerifier",
+ nowarn);
}
void
RegistryI::setupAdminSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter,
- const Ice::ObjectAdapterPtr& sessionManagerAdapter,
- const IceGrid::LocatorPrx& locator,
- bool nowarn)
+ const Ice::ObjectAdapterPtr& sessionManagerAdapter,
+ const IceGrid::LocatorPrx& locator,
+ bool nowarn)
{
assert(_reaper);
_adminSessionFactory = new AdminSessionFactory(sessionManagerAdapter, _database, _reaper, this);
if(sessionManagerAdapter)
{
- Identity adminSessionMgrId;
- adminSessionMgrId.category = _instanceName;
- adminSessionMgrId.name = "AdminSessionManager";
- Identity sslAdmSessionMgrId;
- sslAdmSessionMgrId.category = _instanceName;
- sslAdmSessionMgrId.name = "AdminSSLSessionManager";
- if(!_master)
- {
- adminSessionMgrId.name += "-" + _replicaName;
- sslAdmSessionMgrId.name += "-" + _replicaName;
- }
-
- sessionManagerAdapter->add(new AdminSessionManagerI(_adminSessionFactory), adminSessionMgrId);
- sessionManagerAdapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslAdmSessionMgrId);
-
- _wellKnownObjects->add(sessionManagerAdapter->createProxy(adminSessionMgrId),
- Glacier2::SessionManager::ice_staticId());
- _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslAdmSessionMgrId),
- Glacier2::SSLSessionManager::ice_staticId());
+ Identity adminSessionMgrId;
+ adminSessionMgrId.category = _instanceName;
+ adminSessionMgrId.name = "AdminSessionManager";
+ Identity sslAdmSessionMgrId;
+ sslAdmSessionMgrId.category = _instanceName;
+ sslAdmSessionMgrId.name = "AdminSSLSessionManager";
+ if(!_master)
+ {
+ adminSessionMgrId.name += "-" + _replicaName;
+ sslAdmSessionMgrId.name += "-" + _replicaName;
+ }
+
+ sessionManagerAdapter->add(new AdminSessionManagerI(_adminSessionFactory), adminSessionMgrId);
+ sessionManagerAdapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslAdmSessionMgrId);
+
+ _wellKnownObjects->add(sessionManagerAdapter->createProxy(adminSessionMgrId),
+ Glacier2::SessionManager::ice_staticId());
+ _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslAdmSessionMgrId),
+ Glacier2::SSLSessionManager::ice_staticId());
}
Ice::PropertiesPtr properties = _communicator->getProperties();
_adminVerifier = getPermissionsVerifier(registryAdapter,
- locator,
- "IceGrid.Registry.AdminPermissionsVerifier",
- properties->getProperty("IceGrid.Registry.AdminCryptPasswords"),
- nowarn);
+ locator,
+ "IceGrid.Registry.AdminPermissionsVerifier",
+ properties->getProperty("IceGrid.Registry.AdminCryptPasswords"),
+ nowarn);
_sslAdminVerifier =
- getSSLPermissionsVerifier(locator,
- "IceGrid.Registry.AdminSSLPermissionsVerifier",
- nowarn);
+ getSSLPermissionsVerifier(locator,
+ "IceGrid.Registry.AdminSSLPermissionsVerifier",
+ nowarn);
}
void
@@ -650,27 +650,27 @@ RegistryI::stop()
}
catch(const Ice::LocalException& ex)
{
- Warning out(_communicator->getLogger());
- out << "unexpected exception while shutting down registry communicator:\n" << ex;
+ Warning out(_communicator->getLogger());
+ out << "unexpected exception while shutting down registry communicator:\n" << ex;
}
if(_reaper)
{
- _reaper->terminate();
- _reaper->getThreadControl().join();
- _reaper = 0;
+ _reaper->terminate();
+ _reaper->getThreadControl().join();
+ _reaper = 0;
}
if(_waitQueue)
{
- _waitQueue->destroy();
- _waitQueue = 0;
+ _waitQueue->destroy();
+ _waitQueue = 0;
}
if(_iceStorm)
{
- _iceStorm->stop();
- _iceStorm = 0;
+ _iceStorm->stop();
+ _iceStorm = 0;
}
_wellKnownObjects = 0;
@@ -684,20 +684,20 @@ RegistryI::createSession(const string& user, const string& password, const Curre
{
if(!_master)
{
- PermissionDeniedException ex;
- ex.reason = "client session creation is only allowed with the master registry.";
- throw ex;
+ PermissionDeniedException ex;
+ ex.reason = "client session creation is only allowed with the master registry.";
+ throw ex;
}
assert(_reaper && _clientSessionFactory);
if(!_clientVerifier)
{
- PermissionDeniedException ex;
- ex.reason = "no permissions verifier configured, use the property\n";
- ex.reason += "`IceGrid.Registry.PermissionsVerifier' to configure\n";
- ex.reason += "a permissions verifier.";
- throw ex;
+ PermissionDeniedException ex;
+ ex.reason = "no permissions verifier configured, use the property\n";
+ ex.reason += "`IceGrid.Registry.PermissionsVerifier' to configure\n";
+ ex.reason += "a permissions verifier.";
+ throw ex;
}
if(user.empty())
@@ -709,32 +709,32 @@ RegistryI::createSession(const string& user, const string& password, const Curre
try
{
- string reason;
- if(!_clientVerifier->checkPermissions(user, password, reason, current.ctx))
- {
- PermissionDeniedException exc;
- exc.reason = reason;
- throw exc;
- }
+ string reason;
+ if(!_clientVerifier->checkPermissions(user, password, reason, current.ctx))
+ {
+ PermissionDeniedException exc;
+ exc.reason = reason;
+ throw exc;
+ }
}
catch(const LocalException& ex)
{
- if(_traceLevels && _traceLevels->session > 0)
- {
- Trace out(_traceLevels->logger, _traceLevels->sessionCat);
- out << "exception while verifying password with client permission verifier:\n" << ex;
- }
+ if(_traceLevels && _traceLevels->session > 0)
+ {
+ Trace out(_traceLevels->logger, _traceLevels->sessionCat);
+ out << "exception while verifying password with client permission verifier:\n" << ex;
+ }
- PermissionDeniedException exc;
- exc.reason = "internal server error";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "internal server error";
+ throw exc;
}
SessionIPtr session = _clientSessionFactory->createSessionServant(user, 0);
Ice::ObjectPrx proxy = session->registerWithServantLocator(_sessionServantLocator, current.con);
if(_sessionTimeout > 0)
{
- _reaper->add(new SessionReapable<SessionI>(_traceLevels->logger, session), _sessionTimeout);
+ _reaper->add(new SessionReapable<SessionI>(_traceLevels->logger, session), _sessionTimeout);
}
return SessionPrx::uncheckedCast(proxy);
}
@@ -746,11 +746,11 @@ RegistryI::createAdminSession(const string& user, const string& password, const
if(!_adminVerifier)
{
- PermissionDeniedException ex;
- ex.reason = "no admin permissions verifier configured, use the property\n";
- ex.reason += "`IceGrid.Registry.AdminPermissionsVerifier' to configure\n";
- ex.reason += "a permissions verifier.";
- throw ex;
+ PermissionDeniedException ex;
+ ex.reason = "no admin permissions verifier configured, use the property\n";
+ ex.reason += "`IceGrid.Registry.AdminPermissionsVerifier' to configure\n";
+ ex.reason += "a permissions verifier.";
+ throw ex;
}
if(user.empty())
@@ -762,32 +762,32 @@ RegistryI::createAdminSession(const string& user, const string& password, const
try
{
- string reason;
- if(!_adminVerifier->checkPermissions(user, password, reason, current.ctx))
- {
- PermissionDeniedException exc;
- exc.reason = reason;
- throw exc;
- }
+ string reason;
+ if(!_adminVerifier->checkPermissions(user, password, reason, current.ctx))
+ {
+ PermissionDeniedException exc;
+ exc.reason = reason;
+ throw exc;
+ }
}
catch(const LocalException& ex)
{
- if(_traceLevels && _traceLevels->session > 0)
- {
- Trace out(_traceLevels->logger, _traceLevels->sessionCat);
- out << "exception while verifying password with admin permission verifier:\n" << ex;
- }
+ if(_traceLevels && _traceLevels->session > 0)
+ {
+ Trace out(_traceLevels->logger, _traceLevels->sessionCat);
+ out << "exception while verifying password with admin permission verifier:\n" << ex;
+ }
- PermissionDeniedException exc;
- exc.reason = "internal server error";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "internal server error";
+ throw exc;
}
AdminSessionIPtr session = _adminSessionFactory->createSessionServant(user);
Ice::ObjectPrx proxy = session->registerWithServantLocator(_sessionServantLocator, current.con, this);
if(_sessionTimeout > 0)
{
- _reaper->add(new SessionReapable<AdminSessionI>(_traceLevels->logger, session), _sessionTimeout);
+ _reaper->add(new SessionReapable<AdminSessionI>(_traceLevels->logger, session), _sessionTimeout);
}
return AdminSessionPrx::uncheckedCast(proxy);
}
@@ -797,20 +797,20 @@ RegistryI::createSessionFromSecureConnection(const Current& current)
{
if(!_master)
{
- PermissionDeniedException ex;
- ex.reason = "client session creation is only allowed with the master registry.";
- throw ex;
+ PermissionDeniedException ex;
+ ex.reason = "client session creation is only allowed with the master registry.";
+ throw ex;
}
assert(_reaper && _clientSessionFactory);
if(!_sslClientVerifier)
{
- PermissionDeniedException ex;
- ex.reason = "no ssl permissions verifier configured, use the property\n";
- ex.reason += "`IceGrid.Registry.SSLPermissionsVerifier' to configure\n";
- ex.reason += "a permissions verifier.";
- throw ex;
+ PermissionDeniedException ex;
+ ex.reason = "no ssl permissions verifier configured, use the property\n";
+ ex.reason += "`IceGrid.Registry.SSLPermissionsVerifier' to configure\n";
+ ex.reason += "a permissions verifier.";
+ throw ex;
}
string userDN;
@@ -824,32 +824,32 @@ RegistryI::createSessionFromSecureConnection(const Current& current)
try
{
- string reason;
- if(!_sslClientVerifier->authorize(info, reason, current.ctx))
- {
- PermissionDeniedException exc;
- exc.reason = reason;
- throw exc;
- }
+ string reason;
+ if(!_sslClientVerifier->authorize(info, reason, current.ctx))
+ {
+ PermissionDeniedException exc;
+ exc.reason = reason;
+ throw exc;
+ }
}
catch(const LocalException& ex)
{
- if(_traceLevels && _traceLevels->session > 0)
- {
- Trace out(_traceLevels->logger, _traceLevels->sessionCat);
- out << "exception while verifying password with SSL client permission verifier:\n" << ex;
- }
+ if(_traceLevels && _traceLevels->session > 0)
+ {
+ Trace out(_traceLevels->logger, _traceLevels->sessionCat);
+ out << "exception while verifying password with SSL client permission verifier:\n" << ex;
+ }
- PermissionDeniedException exc;
- exc.reason = "internal server error";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "internal server error";
+ throw exc;
}
SessionIPtr session = _clientSessionFactory->createSessionServant(userDN, 0);
Ice::ObjectPrx proxy = session->registerWithServantLocator(_sessionServantLocator, current.con);
if(_sessionTimeout > 0)
{
- _reaper->add(new SessionReapable<SessionI>(_traceLevels->logger, session), _sessionTimeout);
+ _reaper->add(new SessionReapable<SessionI>(_traceLevels->logger, session), _sessionTimeout);
}
return SessionPrx::uncheckedCast(proxy);
}
@@ -861,36 +861,36 @@ RegistryI::createAdminSessionFromSecureConnection(const Current& current)
if(!_sslAdminVerifier)
{
- PermissionDeniedException ex;
- ex.reason = "no ssl admin permissions verifier configured, use the property\n";
- ex.reason += "`IceGrid.Registry.AdminSSLPermissionsVerifier' to configure\n";
- ex.reason += "a permissions verifier.";
- throw ex;
+ PermissionDeniedException ex;
+ ex.reason = "no ssl admin permissions verifier configured, use the property\n";
+ ex.reason += "`IceGrid.Registry.AdminSSLPermissionsVerifier' to configure\n";
+ ex.reason += "a permissions verifier.";
+ throw ex;
}
string userDN;
Glacier2::SSLInfo info = getSSLInfo(current.con, userDN);
try
{
- string reason;
- if(!_sslAdminVerifier->authorize(info, reason, current.ctx))
- {
- PermissionDeniedException exc;
- exc.reason = reason;
- throw exc;
- }
+ string reason;
+ if(!_sslAdminVerifier->authorize(info, reason, current.ctx))
+ {
+ PermissionDeniedException exc;
+ exc.reason = reason;
+ throw exc;
+ }
}
catch(const LocalException& ex)
{
- if(_traceLevels && _traceLevels->session > 0)
- {
- Trace out(_traceLevels->logger, _traceLevels->sessionCat);
- out << "exception while verifying password with SSL admin permission verifier:\n" << ex;
- }
+ if(_traceLevels && _traceLevels->session > 0)
+ {
+ Trace out(_traceLevels->logger, _traceLevels->sessionCat);
+ out << "exception while verifying password with SSL admin permission verifier:\n" << ex;
+ }
- PermissionDeniedException exc;
- exc.reason = "internal server error";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "internal server error";
+ throw exc;
}
//
@@ -900,7 +900,7 @@ RegistryI::createAdminSessionFromSecureConnection(const Current& current)
Ice::ObjectPrx proxy = session->registerWithServantLocator(_sessionServantLocator, current.con, this);
if(_sessionTimeout > 0)
{
- _reaper->add(new SessionReapable<AdminSessionI>(_traceLevels->logger, session), _sessionTimeout);
+ _reaper->add(new SessionReapable<AdminSessionI>(_traceLevels->logger, session), _sessionTimeout);
}
return AdminSessionPrx::uncheckedCast(proxy);
}
@@ -942,34 +942,34 @@ RegistryI::setupThreadPool(const PropertiesPtr& properties, const string& name,
{
if(properties->getPropertyAsIntWithDefault(name + ".Size", 0) < size)
{
- ostringstream os;
- os << size;
- properties->setProperty(name + ".Size", os.str());
+ ostringstream os;
+ os << size;
+ properties->setProperty(name + ".Size", os.str());
}
else
{
- size = properties->getPropertyAsInt(name + ".Size");
+ size = properties->getPropertyAsInt(name + ".Size");
}
if(sizeMax > 0 && properties->getPropertyAsIntWithDefault(name + ".SizeMax", 0) < sizeMax)
{
- if(size >= sizeMax)
- {
- sizeMax = size * 10;
- }
-
- ostringstream os;
- os << sizeMax;
- properties->setProperty(name + ".SizeMax", os.str());
+ if(size >= sizeMax)
+ {
+ sizeMax = size * 10;
+ }
+
+ ostringstream os;
+ os << sizeMax;
+ properties->setProperty(name + ".SizeMax", os.str());
}
}
Glacier2::PermissionsVerifierPrx
RegistryI::getPermissionsVerifier(const ObjectAdapterPtr& adapter,
- const IceGrid::LocatorPrx& locator,
- const string& verifierProperty,
- const string& passwordsProperty,
- bool nowarn)
+ const IceGrid::LocatorPrx& locator,
+ const string& verifierProperty,
+ const string& passwordsProperty,
+ bool nowarn)
{
//
// Get the permissions verifier, or create a default one if no
@@ -980,61 +980,61 @@ RegistryI::getPermissionsVerifier(const ObjectAdapterPtr& adapter,
string verifierPropertyValue = _communicator->getProperties()->getProperty(verifierProperty);
if(!verifierPropertyValue.empty())
{
- try
- {
- verifier = _communicator->propertyToProxy(verifierProperty);
- assert(_nullPermissionsVerifier);
- if(verifier->ice_getIdentity() == _nullPermissionsVerifier->ice_getIdentity())
- {
- verifier = _nullPermissionsVerifier;
- }
- }
- catch(const LocalException& ex)
- {
- Error out(_communicator->getLogger());
- out << "permissions verifier `" + verifierPropertyValue + "' is invalid:\n" << ex;
- return 0;
- }
+ try
+ {
+ verifier = _communicator->propertyToProxy(verifierProperty);
+ assert(_nullPermissionsVerifier);
+ if(verifier->ice_getIdentity() == _nullPermissionsVerifier->ice_getIdentity())
+ {
+ verifier = _nullPermissionsVerifier;
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ Error out(_communicator->getLogger());
+ out << "permissions verifier `" + verifierPropertyValue + "' is invalid:\n" << ex;
+ return 0;
+ }
}
else if(!passwordsProperty.empty())
{
- ifstream passwordFile(passwordsProperty.c_str());
- if(!passwordFile)
- {
- Error out(_communicator->getLogger());
+ ifstream passwordFile(passwordsProperty.c_str());
+ if(!passwordFile)
+ {
+ Error out(_communicator->getLogger());
string err = strerror(errno);
- out << "cannot open `" + passwordsProperty + "' for reading: " + err;
- return 0;
- }
-
- map<string, string> passwords;
-
- while(true)
- {
- string userId;
- passwordFile >> userId;
- if(!passwordFile)
- {
- break;
- }
-
- string password;
- passwordFile >> password;
- if(!passwordFile)
- {
- break;
- }
-
- assert(!userId.empty());
- assert(!password.empty());
- passwords.insert(make_pair(userId, password));
- }
-
- verifier = adapter->addWithUUID(new CryptPermissionsVerifierI(passwords));
+ out << "cannot open `" + passwordsProperty + "' for reading: " + err;
+ return 0;
+ }
+
+ map<string, string> passwords;
+
+ while(true)
+ {
+ string userId;
+ passwordFile >> userId;
+ if(!passwordFile)
+ {
+ break;
+ }
+
+ string password;
+ passwordFile >> password;
+ if(!passwordFile)
+ {
+ break;
+ }
+
+ assert(!userId.empty());
+ assert(!password.empty());
+ passwords.insert(make_pair(userId, password));
+ }
+
+ verifier = adapter->addWithUUID(new CryptPermissionsVerifierI(passwords));
}
else
{
- return 0;
+ return 0;
}
assert(verifier);
@@ -1042,28 +1042,28 @@ RegistryI::getPermissionsVerifier(const ObjectAdapterPtr& adapter,
Glacier2::PermissionsVerifierPrx verifierPrx;
try
{
- //
- // Set the permission verifier proxy locator to the internal
- // locator. We can't use the "public" locator, this could lead
- // to deadlocks if there's not enough threads in the client
- // thread pool anymore.
- //
- verifierPrx = Glacier2::PermissionsVerifierPrx::checkedCast(verifier->ice_locator(locator));
- if(!verifierPrx)
- {
- Error out(_communicator->getLogger());
- out << "permissions verifier `" + verifierProperty + "' is invalid";
- return 0;
- }
+ //
+ // Set the permission verifier proxy locator to the internal
+ // locator. We can't use the "public" locator, this could lead
+ // to deadlocks if there's not enough threads in the client
+ // thread pool anymore.
+ //
+ verifierPrx = Glacier2::PermissionsVerifierPrx::checkedCast(verifier->ice_locator(locator));
+ if(!verifierPrx)
+ {
+ Error out(_communicator->getLogger());
+ out << "permissions verifier `" + verifierProperty + "' is invalid";
+ return 0;
+ }
}
catch(const LocalException& ex)
{
- if(!nowarn)
- {
- Warning out(_communicator->getLogger());
- out << "couldn't contact permissions verifier `" + verifierProperty + "':\n" << ex;
- }
- verifierPrx = Glacier2::PermissionsVerifierPrx::uncheckedCast(verifier->ice_locator(locator));
+ if(!nowarn)
+ {
+ Warning out(_communicator->getLogger());
+ out << "couldn't contact permissions verifier `" + verifierProperty + "':\n" << ex;
+ }
+ verifierPrx = Glacier2::PermissionsVerifierPrx::uncheckedCast(verifier->ice_locator(locator));
}
return verifierPrx;
}
@@ -1081,18 +1081,18 @@ RegistryI::getSSLPermissionsVerifier(const IceGrid::LocatorPrx& locator, const s
{
try
{
- verifier = _communicator->propertyToProxy(verifierProperty);
- assert(_nullSSLPermissionsVerifier);
- if(verifier->ice_getIdentity() == _nullSSLPermissionsVerifier->ice_getIdentity())
- {
- verifier = _nullSSLPermissionsVerifier;
- }
+ verifier = _communicator->propertyToProxy(verifierProperty);
+ assert(_nullSSLPermissionsVerifier);
+ if(verifier->ice_getIdentity() == _nullSSLPermissionsVerifier->ice_getIdentity())
+ {
+ verifier = _nullSSLPermissionsVerifier;
+ }
}
catch(const LocalException& ex)
{
- Error out(_communicator->getLogger());
- out << "permissions verifier `" + verifierPropertyValue + "' is invalid:\n" << ex;
- return 0;
+ Error out(_communicator->getLogger());
+ out << "permissions verifier `" + verifierPropertyValue + "' is invalid:\n" << ex;
+ return 0;
}
}
else
@@ -1103,28 +1103,28 @@ RegistryI::getSSLPermissionsVerifier(const IceGrid::LocatorPrx& locator, const s
Glacier2::SSLPermissionsVerifierPrx verifierPrx;
try
{
- //
- // Set the permission verifier proxy locator to the internal
- // locator. We can't use the "public" locator, this could lead
- // to deadlocks if there's not enough threads in the client
- // thread pool anymore.
- //
- verifierPrx = Glacier2::SSLPermissionsVerifierPrx::checkedCast(verifier->ice_locator(locator));
- if(!verifierPrx)
- {
- Error out(_communicator->getLogger());
- out << "permissions verifier `" + verifierProperty + "' is invalid";
- return 0;
- }
+ //
+ // Set the permission verifier proxy locator to the internal
+ // locator. We can't use the "public" locator, this could lead
+ // to deadlocks if there's not enough threads in the client
+ // thread pool anymore.
+ //
+ verifierPrx = Glacier2::SSLPermissionsVerifierPrx::checkedCast(verifier->ice_locator(locator));
+ if(!verifierPrx)
+ {
+ Error out(_communicator->getLogger());
+ out << "permissions verifier `" + verifierProperty + "' is invalid";
+ return 0;
+ }
}
catch(const LocalException& ex)
{
- if(!nowarn)
- {
- Warning out(_communicator->getLogger());
- out << "couldn't contact permissions verifier `" + verifierProperty + "':\n" << ex;
- }
- verifierPrx = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast(verifier->ice_locator(locator));
+ if(!nowarn)
+ {
+ Warning out(_communicator->getLogger());
+ out << "couldn't contact permissions verifier `" + verifierProperty + "':\n" << ex;
+ }
+ verifierPrx = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast(verifier->ice_locator(locator));
}
return verifierPrx;
}
@@ -1135,35 +1135,35 @@ RegistryI::getSSLInfo(const ConnectionPtr& connection, string& userDN)
Glacier2::SSLInfo sslinfo;
try
{
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(connection);
- sslinfo.remotePort = ntohs(info.remoteAddr.sin_port);
- sslinfo.remoteHost = IceInternal::inetAddrToString(info.remoteAddr.sin_addr);
- sslinfo.localPort = ntohs(info.localAddr.sin_port);
- sslinfo.localHost = IceInternal::inetAddrToString(info.localAddr.sin_addr);
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(connection);
+ sslinfo.remotePort = ntohs(info.remoteAddr.sin_port);
+ sslinfo.remoteHost = IceInternal::inetAddrToString(info.remoteAddr.sin_addr);
+ sslinfo.localPort = ntohs(info.localAddr.sin_port);
+ sslinfo.localHost = IceInternal::inetAddrToString(info.localAddr.sin_addr);
- sslinfo.cipher = info.cipher;
+ sslinfo.cipher = info.cipher;
- if(!info.certs.empty())
- {
- sslinfo.certs.resize(info.certs.size());
- for(unsigned int i = 0; i < info.certs.size(); ++i)
- {
- sslinfo.certs[i] = info.certs[i]->encode();
- }
- userDN = info.certs[0]->getSubjectDN();
- }
+ if(!info.certs.empty())
+ {
+ sslinfo.certs.resize(info.certs.size());
+ for(unsigned int i = 0; i < info.certs.size(); ++i)
+ {
+ sslinfo.certs[i] = info.certs[i]->encode();
+ }
+ userDN = info.certs[0]->getSubjectDN();
+ }
}
catch(const IceSSL::ConnectionInvalidException&)
{
- PermissionDeniedException exc;
- exc.reason = "not ssl connection";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "not ssl connection";
+ throw exc;
}
catch(const IceSSL::CertificateEncodingException&)
{
- PermissionDeniedException exc;
- exc.reason = "certificate encoding exception";
- throw exc;
+ PermissionDeniedException exc;
+ exc.reason = "certificate encoding exception";
+ throw exc;
}
return sslinfo;
@@ -1171,71 +1171,71 @@ RegistryI::getSSLInfo(const ConnectionPtr& connection, string& userDN)
NodePrxSeq
RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry,
- const InternalRegistryPrxSeq& replicas,
- const NodePrxSeq& dbNodes)
+ const InternalRegistryPrxSeq& replicas,
+ const NodePrxSeq& dbNodes)
{
set<NodePrx> nodes;
nodes.insert(dbNodes.begin(), dbNodes.end());
for(InternalRegistryPrxSeq::const_iterator r = replicas.begin(); r != replicas.end(); ++r)
{
- if((*r)->ice_getIdentity() != internalRegistry->ice_getIdentity())
- {
- string replicaName;
- if(_traceLevels && _traceLevels->replica > 1)
- {
- replicaName = (*r)->ice_getIdentity().name;
- const string prefix("InternalRegistry-");
- string::size_type pos = replicaName.find(prefix);
- if(pos != string::npos)
- {
- replicaName = replicaName.substr(prefix.size());
- }
-
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "creating replica `" << replicaName << "' session";
- }
-
- try
- {
- (*r)->registerWithReplica(internalRegistry);
- NodePrxSeq nds = (*r)->getNodes();
- nodes.insert(nds.begin(), nds.end());
-
- if(_traceLevels && _traceLevels->replica > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "replica `" << replicaName << "' session created";
- }
- }
- catch(const Ice::LocalException& ex)
- {
- //
- // Clear the proxy from the database if we can't
- // contact the replica.
- //
- try
- {
- _database->removeObject((*r)->ice_getIdentity());
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- if(_traceLevels && _traceLevels->replica > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "replica `" << replicaName << "' session creation failed:\n" << ex;
- }
- }
- }
+ if((*r)->ice_getIdentity() != internalRegistry->ice_getIdentity())
+ {
+ string replicaName;
+ if(_traceLevels && _traceLevels->replica > 1)
+ {
+ replicaName = (*r)->ice_getIdentity().name;
+ const string prefix("InternalRegistry-");
+ string::size_type pos = replicaName.find(prefix);
+ if(pos != string::npos)
+ {
+ replicaName = replicaName.substr(prefix.size());
+ }
+
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "creating replica `" << replicaName << "' session";
+ }
+
+ try
+ {
+ (*r)->registerWithReplica(internalRegistry);
+ NodePrxSeq nds = (*r)->getNodes();
+ nodes.insert(nds.begin(), nds.end());
+
+ if(_traceLevels && _traceLevels->replica > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "replica `" << replicaName << "' session created";
+ }
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ //
+ // Clear the proxy from the database if we can't
+ // contact the replica.
+ //
+ try
+ {
+ _database->removeObject((*r)->ice_getIdentity());
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ if(_traceLevels && _traceLevels->replica > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "replica `" << replicaName << "' session creation failed:\n" << ex;
+ }
+ }
+ }
}
#ifdef _RWSTD_NO_MEMBER_TEMPLATES
NodePrxSeq result;
for(set<NodePrx>::iterator p = nodes.begin(); p != nodes.end(); ++p)
{
- result.push_back(*p);
+ result.push_back(*p);
}
return result;
#else
@@ -1250,25 +1250,25 @@ RegistryI::registerNodes(const InternalRegistryPrx& internalRegistry, const Node
for(NodePrxSeq::const_iterator p = nodes.begin(); p != nodes.end(); ++p)
{
- assert((*p)->ice_getIdentity().name.find(prefix) != string::npos);
- try
- {
- _database->getNode((*p)->ice_getIdentity().name.substr(prefix.size()))->setProxy(*p);
- }
- catch(const NodeNotExistException&)
- {
- //
- // Ignore, if nothing's deployed on the node we won't need
- // to contact it for locator requests so we don't need to
- // keep its proxy.
- //
- try
- {
- _database->removeInternalObject((*p)->ice_getIdentity());
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
- }
+ assert((*p)->ice_getIdentity().name.find(prefix) != string::npos);
+ try
+ {
+ _database->getNode((*p)->ice_getIdentity().name.substr(prefix.size()))->setProxy(*p);
+ }
+ catch(const NodeNotExistException&)
+ {
+ //
+ // Ignore, if nothing's deployed on the node we won't need
+ // to contact it for locator requests so we don't need to
+ // keep its proxy.
+ //
+ try
+ {
+ _database->removeInternalObject((*p)->ice_getIdentity());
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+ }
}
}
diff --git a/cpp/src/IceGrid/RegistryI.h b/cpp/src/IceGrid/RegistryI.h
index 63958bc08ee..152944dc19c 100644
--- a/cpp/src/IceGrid/RegistryI.h
+++ b/cpp/src/IceGrid/RegistryI.h
@@ -74,20 +74,20 @@ private:
Ice::LocatorRegistryPrx setupLocatorRegistry(const Ice::ObjectAdapterPtr&);
LocatorPrx setupLocator(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&, const Ice::LocatorRegistryPrx&,
- const RegistryPrx&, const QueryPrx&);
+ const RegistryPrx&, const QueryPrx&);
QueryPrx setupQuery(const Ice::ObjectAdapterPtr&);
RegistryPrx setupRegistry(const Ice::ObjectAdapterPtr&);
InternalRegistryPrx setupInternalRegistry(const Ice::ObjectAdapterPtr&);
void setupNullPermissionsVerifier(const Ice::ObjectAdapterPtr&);
bool setupUserAccountMapper(const Ice::ObjectAdapterPtr&);
void setupClientSessionFactory(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&, const LocatorPrx&,
- bool);
+ bool);
void setupAdminSessionFactory(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&, const LocatorPrx&,
- bool);
+ bool);
void setupThreadPool(const Ice::PropertiesPtr&, const std::string&, int, int = 0);
Glacier2::PermissionsVerifierPrx getPermissionsVerifier(const Ice::ObjectAdapterPtr&, const LocatorPrx&,
- const std::string&, const std::string&, bool);
+ const std::string&, const std::string&, bool);
Glacier2::SSLPermissionsVerifierPrx getSSLPermissionsVerifier(const LocatorPrx&, const std::string&, bool);
Glacier2::SSLInfo getSSLInfo(const Ice::ConnectionPtr&, std::string&);
diff --git a/cpp/src/IceGrid/ReplicaCache.cpp b/cpp/src/IceGrid/ReplicaCache.cpp
index fa5102a322c..a766f46c69e 100644
--- a/cpp/src/IceGrid/ReplicaCache.cpp
+++ b/cpp/src/IceGrid/ReplicaCache.cpp
@@ -23,11 +23,11 @@ ReplicaCache::ReplicaCache(const Ice::CommunicatorPtr& communicator, const IceSt
IceStorm::TopicPrx t;
try
{
- t = topicManager->create("ReplicaObserverTopic");
+ t = topicManager->create("ReplicaObserverTopic");
}
catch(const IceStorm::TopicExists&)
{
- t = topicManager->retrieve("ReplicaObserverTopic");
+ t = topicManager->retrieve("ReplicaObserverTopic");
}
const_cast<IceStorm::TopicPrx&>(_topic) = IceStorm::TopicPrx::uncheckedCast(t->ice_collocationOptimized(true));
@@ -42,59 +42,59 @@ ReplicaCache::add(const string& name, const ReplicaSessionIPtr& session)
ReplicaEntryPtr entry;
while(entry = getImpl(name))
{
- ReplicaSessionIPtr session = entry->getSession();
- if(session->isDestroyed())
- {
- wait(); // Wait for the session to be removed.
- }
- else
- {
- //
- // Check if the replica is still reachable, if not, we
- // destroy its session.
- //
- sync.release();
- try
- {
- session->getInternalRegistry()->ice_ping();
- throw ReplicaActiveException();
- }
- catch(const Ice::LocalException&)
- {
- try
- {
- session->destroy();
- }
- catch(const Ice::LocalException&)
- {
- }
- }
- sync.acquire();
- }
+ ReplicaSessionIPtr session = entry->getSession();
+ if(session->isDestroyed())
+ {
+ wait(); // Wait for the session to be removed.
+ }
+ else
+ {
+ //
+ // Check if the replica is still reachable, if not, we
+ // destroy its session.
+ //
+ sync.release();
+ try
+ {
+ session->getInternalRegistry()->ice_ping();
+ throw ReplicaActiveException();
+ }
+ catch(const Ice::LocalException&)
+ {
+ try
+ {
+ session->destroy();
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ }
+ sync.acquire();
+ }
}
if(_traceLevels && _traceLevels->replica > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "replica `" << name << "' up";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "replica `" << name << "' up";
}
try
{
- _observers->replicaAdded(session->getInternalRegistry());
+ _observers->replicaAdded(session->getInternalRegistry());
}
catch(const Ice::ConnectionRefusedException&)
{
- // Expected if the replica is being shutdown.
+ // Expected if the replica is being shutdown.
}
catch(const Ice::LocalException& ex)
{
- TraceLevelsPtr traceLevels = getTraceLevels();
- if(traceLevels)
- {
- Ice::Warning out(traceLevels->logger);
- out << "unexpected exception while publishing `replicaAdded' update:\n" << ex;
- }
+ TraceLevelsPtr traceLevels = getTraceLevels();
+ if(traceLevels)
+ {
+ Ice::Warning out(traceLevels->logger);
+ out << "unexpected exception while publishing `replicaAdded' update:\n" << ex;
+ }
}
return addImpl(name, new ReplicaEntry(name, session));
@@ -112,29 +112,29 @@ ReplicaCache::remove(const string& name, bool shutdown)
if(_traceLevels && _traceLevels->replica > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "replica `" << name << "' down";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "replica `" << name << "' down";
}
if(!shutdown)
{
- try
- {
- _observers->replicaRemoved(entry->getProxy());
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- // Expected if the replica is being shutdown.
- }
- catch(const Ice::LocalException& ex)
- {
- TraceLevelsPtr traceLevels = getTraceLevels();
- if(traceLevels)
- {
- Ice::Warning out(traceLevels->logger);
- out << "unexpected exception while publishing `replicaRemoved' update:\n" << ex;
- }
- }
+ try
+ {
+ _observers->replicaRemoved(entry->getProxy());
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ // Expected if the replica is being shutdown.
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ TraceLevelsPtr traceLevels = getTraceLevels();
+ if(traceLevels)
+ {
+ Ice::Warning out(traceLevels->logger);
+ out << "unexpected exception while publishing `replicaRemoved' update:\n" << ex;
+ }
+ }
}
return entry;
@@ -147,9 +147,9 @@ ReplicaCache::get(const string& name) const
ReplicaEntryPtr entry = getImpl(name);
if(!entry)
{
- RegistryNotExistException ex;
- ex.name = name;
- throw ex;
+ RegistryNotExistException ex;
+ ex.name = name;
+ throw ex;
}
return entry;
}
@@ -159,30 +159,30 @@ ReplicaCache::subscribe(const ReplicaObserverPrx& observer)
{
try
{
- Lock sync(*this);
- InternalRegistryPrxSeq replicas;
- for(map<string, ReplicaEntryPtr>::const_iterator p = _entries.begin(); p != _entries.end(); ++p)
- {
- replicas.push_back(p->second->getProxy());
- }
-
- IceStorm::QoS qos;
- qos["reliability"] = "ordered";
- Ice::ObjectPrx publisher = _topic->subscribeAndGetPublisher(qos, observer->ice_twoway());
- ReplicaObserverPrx::uncheckedCast(publisher)->replicaInit(replicas);
+ Lock sync(*this);
+ InternalRegistryPrxSeq replicas;
+ for(map<string, ReplicaEntryPtr>::const_iterator p = _entries.begin(); p != _entries.end(); ++p)
+ {
+ replicas.push_back(p->second->getProxy());
+ }
+
+ IceStorm::QoS qos;
+ qos["reliability"] = "ordered";
+ Ice::ObjectPrx publisher = _topic->subscribeAndGetPublisher(qos, observer->ice_twoway());
+ ReplicaObserverPrx::uncheckedCast(publisher)->replicaInit(replicas);
}
catch(const Ice::ConnectionRefusedException&)
{
- // The replica is being shutdown.
+ // The replica is being shutdown.
}
catch(const Ice::LocalException& ex)
{
- TraceLevelsPtr traceLevels = getTraceLevels();
- if(traceLevels)
- {
- Ice::Warning out(traceLevels->logger);
- out << "unexpected exception while subscribing observer from replica observer topic:\n" << ex;
- }
+ TraceLevelsPtr traceLevels = getTraceLevels();
+ if(traceLevels)
+ {
+ Ice::Warning out(traceLevels->logger);
+ out << "unexpected exception while subscribing observer from replica observer topic:\n" << ex;
+ }
}
}
@@ -191,20 +191,20 @@ ReplicaCache::unsubscribe(const ReplicaObserverPrx& observer)
{
try
{
- _topic->unsubscribe(observer);
+ _topic->unsubscribe(observer);
}
catch(const Ice::ConnectionRefusedException&)
{
- // The replica is being shutdown.
+ // The replica is being shutdown.
}
catch(const Ice::LocalException& ex)
{
- TraceLevelsPtr traceLevels = getTraceLevels();
- if(traceLevels)
- {
- Ice::Warning out(traceLevels->logger);
- out << "unexpected exception while unsubscribing observer from replica observer topic:\n" << ex;
- }
+ TraceLevelsPtr traceLevels = getTraceLevels();
+ if(traceLevels)
+ {
+ Ice::Warning out(traceLevels->logger);
+ out << "unexpected exception while unsubscribing observer from replica observer topic:\n" << ex;
+ }
}
}
@@ -215,19 +215,19 @@ ReplicaCache::getEndpoints(const string& name, const Ice::ObjectPrx& proxy) cons
if(proxy)
{
- Ice::EndpointSeq endpts = proxy->ice_getEndpoints();
- endpoints.insert(endpoints.end(), endpts.begin(), endpts.end());
+ Ice::EndpointSeq endpts = proxy->ice_getEndpoints();
+ endpoints.insert(endpoints.end(), endpts.begin(), endpts.end());
}
Lock sync(*this);
for(map<string, ReplicaEntryPtr>::const_iterator p = _entries.begin(); p != _entries.end(); ++p)
{
- Ice::ObjectPrx prx = p->second->getSession()->getEndpoint(name);
- if(prx)
- {
- Ice::EndpointSeq endpts = prx->ice_getEndpoints();
- endpoints.insert(endpoints.end(), endpts.begin(), endpts.end());
- }
+ Ice::ObjectPrx prx = p->second->getSession()->getEndpoint(name);
+ if(prx)
+ {
+ Ice::EndpointSeq endpts = prx->ice_getEndpoints();
+ endpoints.insert(endpoints.end(), endpts.begin(), endpts.end());
+ }
}
return _communicator->stringToProxy("dummy")->ice_endpoints(endpoints);
diff --git a/cpp/src/IceGrid/ReplicaSessionI.cpp b/cpp/src/IceGrid/ReplicaSessionI.cpp
index 67c633308ff..1fb589470a2 100644
--- a/cpp/src/IceGrid/ReplicaSessionI.cpp
+++ b/cpp/src/IceGrid/ReplicaSessionI.cpp
@@ -29,10 +29,10 @@ operator==(const ObjectInfo& info, const Ice::Identity& id)
}
ReplicaSessionI::ReplicaSessionI(const DatabasePtr& database,
- const WellKnownObjectsManagerPtr& wellKnownObjects,
- const InternalReplicaInfoPtr& info,
- const InternalRegistryPrx& proxy,
- int timeout) :
+ const WellKnownObjectsManagerPtr& wellKnownObjects,
+ const InternalReplicaInfoPtr& info,
+ const InternalRegistryPrx& proxy,
+ int timeout) :
_database(database),
_wellKnownObjects(wellKnownObjects),
_traceLevels(database->getTraceLevels()),
@@ -45,27 +45,27 @@ ReplicaSessionI::ReplicaSessionI(const DatabasePtr& database,
__setNoDelete(true);
try
{
- _database->getReplicaCache().add(info->name, this);
+ _database->getReplicaCache().add(info->name, this);
- ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName);
- RegistryObserverTopicPtr::dynamicCast(obsv)->registryUp(toRegistryInfo(_info));
+ ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName);
+ RegistryObserverTopicPtr::dynamicCast(obsv)->registryUp(toRegistryInfo(_info));
- _proxy = ReplicaSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this));
+ _proxy = ReplicaSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this));
}
catch(const ReplicaActiveException&)
{
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
catch(...)
{
- ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName);
- RegistryObserverTopicPtr::dynamicCast(obsv)->registryDown(_info->name);
+ ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName);
+ RegistryObserverTopicPtr::dynamicCast(obsv)->registryDown(_info->name);
- _database->getReplicaCache().remove(_info->name, false);
+ _database->getReplicaCache().remove(_info->name, false);
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -76,15 +76,15 @@ ReplicaSessionI::keepAlive(const Ice::Current& current)
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
_timestamp = IceUtil::Time::now();
if(_traceLevels->replica > 2)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "replica `" << _info->name << "' keep alive ";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "replica `" << _info->name << "' keep alive ";
}
}
@@ -100,8 +100,8 @@ ReplicaSessionI::setDatabaseObserver(const DatabaseObserverPrx& observer, const
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
- }
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
_observer = observer;
_database->getObserverTopic(ApplicationObserverTopicName)->subscribe(_observer, _info->name);
_database->getObserverTopic(AdapterObserverTopicName)->subscribe(_observer, _info->name);
@@ -112,12 +112,12 @@ void
ReplicaSessionI::setEndpoints(const StringObjectProxyDict& endpoints, const Ice::Current& current)
{
{
- Lock sync(*this);
- if(_destroy)
- {
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
- }
- _replicaEndpoints = endpoints;
+ Lock sync(*this);
+ if(_destroy)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+ _replicaEndpoints = endpoints;
}
_wellKnownObjects->updateReplicatedWellKnownObjects();
}
@@ -127,13 +127,13 @@ ReplicaSessionI::registerWellKnownObjects(const ObjectInfoSeq& objects, const Ic
{
int serial;
{
- Lock sync(*this);
- if(_destroy)
- {
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
- }
- _replicaWellKnownObjects = objects;
- serial = _database->addOrUpdateObjectsInDatabase(objects);
+ Lock sync(*this);
+ if(_destroy)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+ _replicaWellKnownObjects = objects;
+ serial = _database->addOrUpdateObjectsInDatabase(objects);
}
//
@@ -147,13 +147,13 @@ ReplicaSessionI::registerWellKnownObjects(const ObjectInfoSeq& objects, const Ic
void
ReplicaSessionI::setAdapterDirectProxy(const string& adapterId,
- const string& replicaGroupId,
- const Ice::ObjectPrx& proxy,
- const Ice::Current&)
+ const string& replicaGroupId,
+ const Ice::ObjectPrx& proxy,
+ const Ice::Current&)
{
if(_database->getCommunicator()->getProperties()->getPropertyAsInt("IceGrid.Registry.DynamicRegistration") <= 0)
{
- throw AdapterNotExistException();
+ throw AdapterNotExistException();
}
_database->setAdapterDirectProxy(adapterId, replicaGroupId, proxy);
}
@@ -164,7 +164,7 @@ ReplicaSessionI::receivedUpdate(TopicName topicName, int serial, const string& f
ObserverTopicPtr topic = _database->getObserverTopic(topicName);
if(topic)
{
- topic->receivedUpdate(_info->name, serial, failure);
+ topic->receivedUpdate(_info->name, serial, failure);
}
}
@@ -180,7 +180,7 @@ ReplicaSessionI::timestamp() const
Lock sync(*this);
if(_destroy)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
return _timestamp;
}
@@ -215,7 +215,7 @@ ReplicaSessionI::getEndpoint(const std::string& name)
Lock sync(*this);
if(_destroy)
{
- return 0;
+ return 0;
}
return _replicaEndpoints[name];
}
@@ -231,38 +231,38 @@ void
ReplicaSessionI::destroyImpl(bool shutdown)
{
{
- Lock sync(*this);
- if(_destroy)
- {
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
- }
- _destroy = true;
+ Lock sync(*this);
+ if(_destroy)
+ {
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+ _destroy = true;
}
if(_observer)
{
- _database->getObserverTopic(ApplicationObserverTopicName)->unsubscribe(_observer, _info->name);
- _database->getObserverTopic(AdapterObserverTopicName)->unsubscribe(_observer, _info->name);
- _database->getObserverTopic(ObjectObserverTopicName)->unsubscribe(_observer, _info->name);
+ _database->getObserverTopic(ApplicationObserverTopicName)->unsubscribe(_observer, _info->name);
+ _database->getObserverTopic(AdapterObserverTopicName)->unsubscribe(_observer, _info->name);
+ _database->getObserverTopic(ObjectObserverTopicName)->unsubscribe(_observer, _info->name);
}
if(!_replicaWellKnownObjects.empty())
{
- if(shutdown) // Don't remove the replica proxy from the database if the registry is being shutdown.
- {
- ObjectInfoSeq::iterator p = find(_replicaWellKnownObjects.begin(), _replicaWellKnownObjects.end(),
- _internalRegistry->ice_getIdentity());
- if(p != _replicaWellKnownObjects.end())
- {
- _replicaWellKnownObjects.erase(p);
- }
- }
- _database->removeObjectsInDatabase(_replicaWellKnownObjects);
+ if(shutdown) // Don't remove the replica proxy from the database if the registry is being shutdown.
+ {
+ ObjectInfoSeq::iterator p = find(_replicaWellKnownObjects.begin(), _replicaWellKnownObjects.end(),
+ _internalRegistry->ice_getIdentity());
+ if(p != _replicaWellKnownObjects.end())
+ {
+ _replicaWellKnownObjects.erase(p);
+ }
+ }
+ _database->removeObjectsInDatabase(_replicaWellKnownObjects);
}
if(!shutdown)
{
- _wellKnownObjects->updateReplicatedWellKnownObjects(); // No need to update these if we're shutting down.
+ _wellKnownObjects->updateReplicatedWellKnownObjects(); // No need to update these if we're shutting down.
}
//
@@ -280,12 +280,12 @@ ReplicaSessionI::destroyImpl(bool shutdown)
if(!shutdown)
{
- try
- {
- _database->getInternalAdapter()->remove(_proxy->ice_getIdentity());
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- }
+ try
+ {
+ _database->getInternalAdapter()->remove(_proxy->ice_getIdentity());
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ }
}
}
diff --git a/cpp/src/IceGrid/ReplicaSessionI.h b/cpp/src/IceGrid/ReplicaSessionI.h
index 0f9e37b5e79..28701165ece 100644
--- a/cpp/src/IceGrid/ReplicaSessionI.h
+++ b/cpp/src/IceGrid/ReplicaSessionI.h
@@ -30,7 +30,7 @@ class ReplicaSessionI : public ReplicaSession, public IceUtil::Mutex
public:
ReplicaSessionI(const DatabasePtr&, const WellKnownObjectsManagerPtr&, const InternalReplicaInfoPtr&,
- const InternalRegistryPrx&, int);
+ const InternalRegistryPrx&, int);
virtual void keepAlive(const Ice::Current&);
virtual int getTimeout(const Ice::Current&) const;
@@ -38,7 +38,7 @@ public:
virtual void setEndpoints(const StringObjectProxyDict&, const Ice::Current&);
virtual void registerWellKnownObjects(const ObjectInfoSeq&, const Ice::Current&);
virtual void setAdapterDirectProxy(const std::string&, const std::string&, const Ice::ObjectPrx&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void receivedUpdate(TopicName, int, const std::string&, const Ice::Current&);
virtual void destroy(const Ice::Current& = Ice::Current());
diff --git a/cpp/src/IceGrid/ReplicaSessionManager.cpp b/cpp/src/IceGrid/ReplicaSessionManager.cpp
index f241b51eb62..0dd232d5247 100644
--- a/cpp/src/IceGrid/ReplicaSessionManager.cpp
+++ b/cpp/src/IceGrid/ReplicaSessionManager.cpp
@@ -24,197 +24,197 @@ class MasterDatabaseObserverI : public DatabaseObserver, public IceUtil::Mutex
public:
MasterDatabaseObserverI(const ReplicaSessionManager::ThreadPtr& thread,
- const DatabasePtr& database,
- const ReplicaSessionPrx& session) :
- _thread(thread),
- _database(database),
- _session(session)
+ const DatabasePtr& database,
+ const ReplicaSessionPrx& session) :
+ _thread(thread),
+ _database(database),
+ _session(session)
{
}
virtual void
applicationInit(int, const ApplicationInfoSeq& applications, const Ice::Current& current)
{
- _database->syncApplications(applications);
- receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx));
+ _database->syncApplications(applications);
+ receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx));
}
virtual void
applicationAdded(int, const ApplicationInfo& application, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->addApplication(application);
- }
- catch(const DeploymentException& ex)
- {
- ostringstream os;
- os << ex << ":\n" << ex.reason;
- failure = os.str();
- }
- receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->addApplication(application);
+ }
+ catch(const DeploymentException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\n" << ex.reason;
+ failure = os.str();
+ }
+ receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
applicationRemoved(int, const std::string& name, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->removeApplication(name);
- }
- catch(const ApplicationNotExistException& ex)
- {
- ostringstream os;
- os << ex << ":\napplication: " << ex.name;
- failure = os.str();
- }
- receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->removeApplication(name);
+ }
+ catch(const ApplicationNotExistException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\napplication: " << ex.name;
+ failure = os.str();
+ }
+ receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
applicationUpdated(int, const ApplicationUpdateInfo& update, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->updateApplication(update);
- }
- catch(const DeploymentException& ex)
- {
- ostringstream os;
- os << ex << ":\n" << ex.reason;
- failure = os.str();
- }
- catch(const ApplicationNotExistException& ex)
- {
- ostringstream os;
- os << ex << ":\napplication: " << ex.name;
- failure = os.str();
- }
- receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->updateApplication(update);
+ }
+ catch(const DeploymentException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\n" << ex.reason;
+ failure = os.str();
+ }
+ catch(const ApplicationNotExistException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\napplication: " << ex.name;
+ failure = os.str();
+ }
+ receivedUpdate(ApplicationObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
adapterInit(const AdapterInfoSeq& adapters, const Ice::Current& current)
{
- _database->syncAdapters(adapters);
- receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx));
+ _database->syncAdapters(adapters);
+ receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx));
}
virtual void
adapterAdded(const AdapterInfo& info, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->setAdapterDirectProxy(info.id, info.replicaGroupId, info.proxy);
- }
- catch(const AdapterExistsException&)
- {
- failure = "adapter `" + info.id + "' already exists and belongs to an application";
- }
- receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->setAdapterDirectProxy(info.id, info.replicaGroupId, info.proxy);
+ }
+ catch(const AdapterExistsException&)
+ {
+ failure = "adapter `" + info.id + "' already exists and belongs to an application";
+ }
+ receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
adapterUpdated(const AdapterInfo& info, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->setAdapterDirectProxy(info.id, info.replicaGroupId, info.proxy);
- }
- catch(const AdapterExistsException&)
- {
- failure = "adapter `" + info.id + "' already exists and belongs to an application";
- }
- receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->setAdapterDirectProxy(info.id, info.replicaGroupId, info.proxy);
+ }
+ catch(const AdapterExistsException&)
+ {
+ failure = "adapter `" + info.id + "' already exists and belongs to an application";
+ }
+ receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
adapterRemoved(const std::string& id, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->setAdapterDirectProxy(id, "", 0);
- }
- catch(const AdapterExistsException&)
- {
- failure = "adapter `" + id + "' already exists and belongs to an application";
- }
- receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->setAdapterDirectProxy(id, "", 0);
+ }
+ catch(const AdapterExistsException&)
+ {
+ failure = "adapter `" + id + "' already exists and belongs to an application";
+ }
+ receivedUpdate(AdapterObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
objectInit(const ObjectInfoSeq& objects, const Ice::Current& current)
{
- _database->syncObjects(objects);
- receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx));
+ _database->syncObjects(objects);
+ receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx));
}
virtual void
objectAdded(const ObjectInfo& info, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->addOrUpdateObject(info);
- }
- catch(const ObjectExistsException& ex)
- {
- ostringstream os;
- os << ex << ":\n";
- os << "id: " << info.proxy->ice_getCommunicator()->identityToString(info.proxy->ice_getIdentity());
- failure = os.str();
- }
- receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->addOrUpdateObject(info);
+ }
+ catch(const ObjectExistsException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\n";
+ os << "id: " << info.proxy->ice_getCommunicator()->identityToString(info.proxy->ice_getIdentity());
+ failure = os.str();
+ }
+ receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
objectUpdated(const ObjectInfo& info, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->addOrUpdateObject(info);
- }
- catch(const ObjectExistsException& ex)
- {
- ostringstream os;
- os << ex << ":\n";
- os << "id: " << info.proxy->ice_getCommunicator()->identityToString(info.proxy->ice_getIdentity());
- failure = os.str();
- }
- catch(const DeploymentException& ex)
- {
- ostringstream os;
- os << ex << ":\n" << ex.reason;
- failure = os.str();
- }
- receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->addOrUpdateObject(info);
+ }
+ catch(const ObjectExistsException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\n";
+ os << "id: " << info.proxy->ice_getCommunicator()->identityToString(info.proxy->ice_getIdentity());
+ failure = os.str();
+ }
+ catch(const DeploymentException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\n" << ex.reason;
+ failure = os.str();
+ }
+ receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx), failure);
}
virtual void
objectRemoved(const Ice::Identity& id, const Ice::Current& current)
{
- string failure;
- try
- {
- _database->removeObject(id);
- }
- catch(const DeploymentException& ex)
- {
- ostringstream os;
- os << ex << ":\n" << ex.reason;
- failure = os.str();
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
- receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx), failure);
+ string failure;
+ try
+ {
+ _database->removeObject(id);
+ }
+ catch(const DeploymentException& ex)
+ {
+ ostringstream os;
+ os << ex << ":\n" << ex.reason;
+ failure = os.str();
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+ receivedUpdate(ObjectObserverTopicName, getSerial(current.ctx), failure);
}
private:
@@ -222,31 +222,31 @@ private:
int
getSerial(const Ice::Context& context)
{
- Ice::Context::const_iterator p = context.find("serial");
- if(p != context.end())
- {
- int serial;
- istringstream is(p->second);
- is >> serial;
- return serial;
- }
- return -1;
+ Ice::Context::const_iterator p = context.find("serial");
+ if(p != context.end())
+ {
+ int serial;
+ istringstream is(p->second);
+ is >> serial;
+ return serial;
+ }
+ return -1;
}
void
receivedUpdate(TopicName name, int serial, const string& failure = string())
{
- try
- {
- _session->receivedUpdate(name, serial, failure);
- }
- catch(const Ice::LocalException&)
- {
- }
- if(!failure.empty())
- {
- _thread->destroyActiveSession();
- }
+ try
+ {
+ _session->receivedUpdate(name, serial, failure);
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ if(!failure.empty())
+ {
+ _thread->destroyActiveSession();
+ }
}
const ReplicaSessionManager::ThreadPtr _thread;
@@ -263,47 +263,47 @@ ReplicaSessionManager::ReplicaSessionManager()
void
ReplicaSessionManager::create(const string& name,
- const InternalReplicaInfoPtr& info,
- const DatabasePtr& database,
- const WellKnownObjectsManagerPtr& wellKnownObjects,
- const InternalRegistryPrx& internalRegistry)
+ const InternalReplicaInfoPtr& info,
+ const DatabasePtr& database,
+ const WellKnownObjectsManagerPtr& wellKnownObjects,
+ const InternalRegistryPrx& internalRegistry)
{
Ice::CommunicatorPtr comm = database->getCommunicator();
{
- Lock sync(*this);
-
- Ice::Identity id;
- id.category = comm->getDefaultLocator()->ice_getIdentity().category;
- id.name = "InternalRegistry-Master";
-
- _master = InternalRegistryPrx::uncheckedCast(comm->stringToProxy(comm->identityToString(id)));
- _name = name;
- _info = info;
- _internalRegistry = internalRegistry;
- _database = database;
- _wellKnownObjects = wellKnownObjects;
- _traceLevels = _database->getTraceLevels();
-
- //
- // Initialize the IceGrid::Query objects. The IceGrid::Query
- // interface is used to lookup the registry proxy in case it
- // becomes unavailable. Since replicas might not always have
- // an up to date registry proxy, we need to query all the
- // replicas.
- //
- Ice::EndpointSeq endpoints = comm->getDefaultLocator()->ice_getEndpoints();
- id.name = "Query";
- QueryPrx query = QueryPrx::uncheckedCast(comm->stringToProxy(comm->identityToString(id)));
- for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
- {
- Ice::EndpointSeq singleEndpoint;
- singleEndpoint.push_back(*p);
- _queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint)));
- }
-
- _thread = new Thread(*this, _master);
- _thread->start();
- notifyAll();
+ Lock sync(*this);
+
+ Ice::Identity id;
+ id.category = comm->getDefaultLocator()->ice_getIdentity().category;
+ id.name = "InternalRegistry-Master";
+
+ _master = InternalRegistryPrx::uncheckedCast(comm->stringToProxy(comm->identityToString(id)));
+ _name = name;
+ _info = info;
+ _internalRegistry = internalRegistry;
+ _database = database;
+ _wellKnownObjects = wellKnownObjects;
+ _traceLevels = _database->getTraceLevels();
+
+ //
+ // Initialize the IceGrid::Query objects. The IceGrid::Query
+ // interface is used to lookup the registry proxy in case it
+ // becomes unavailable. Since replicas might not always have
+ // an up to date registry proxy, we need to query all the
+ // replicas.
+ //
+ Ice::EndpointSeq endpoints = comm->getDefaultLocator()->ice_getEndpoints();
+ id.name = "Query";
+ QueryPrx query = QueryPrx::uncheckedCast(comm->stringToProxy(comm->identityToString(id)));
+ for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
+ {
+ Ice::EndpointSeq singleEndpoint;
+ singleEndpoint.push_back(*p);
+ _queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint)));
+ }
+
+ _thread = new Thread(*this, _master);
+ _thread->start();
+ notifyAll();
}
_thread->tryCreateSession();
@@ -313,17 +313,17 @@ void
ReplicaSessionManager::create(const InternalRegistryPrx& replica)
{
{
- Lock sync(*this);
- while(!_master) // Wait to be initialized.
- {
- wait();
- }
+ Lock sync(*this);
+ while(!_master) // Wait to be initialized.
+ {
+ wait();
+ }
}
if(replica->ice_getIdentity() != _master->ice_getIdentity())
{
- _database->getTraceLevels()->logger->error("can only create sessions with the master replica");
- return;
+ _database->getTraceLevels()->logger->error("can only create sessions with the master replica");
+ return;
}
_thread->setRegistry(replica);
@@ -336,11 +336,11 @@ ReplicaSessionManager::getNodes(const NodePrxSeq& nodes) const
assert(_thread && _thread->getRegistry());
try
{
- return _thread->getRegistry()->getNodes();
+ return _thread->getRegistry()->getNodes();
}
catch(const Ice::LocalException&)
{
- return nodes;
+ return nodes;
}
}
@@ -348,11 +348,11 @@ void
ReplicaSessionManager::destroy()
{
{
- Lock sync(*this);
- if(!_thread)
- {
- return;
- }
+ Lock sync(*this);
+ if(!_thread)
+ {
+ return;
+ }
}
_thread->terminate();
@@ -380,14 +380,14 @@ ReplicaSessionManager::registerAllWellKnownObjects()
ReplicaSessionPrx session = _thread->getSession();
if(session)
{
- try
- {
- _wellKnownObjects->registerAll(session);
- return;
- }
- catch(const Ice::LocalException&)
- {
- }
+ try
+ {
+ _wellKnownObjects->registerAll(session);
+ return;
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
}
}
@@ -396,23 +396,23 @@ ReplicaSessionManager::keepAlive(const ReplicaSessionPrx& session)
{
try
{
- if(_traceLevels && _traceLevels->replica > 2)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "sending keep alive message to master replica";
- }
+ if(_traceLevels && _traceLevels->replica > 2)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "sending keep alive message to master replica";
+ }
- session->keepAlive();
- return true;
+ session->keepAlive();
+ return true;
}
catch(const Ice::LocalException& ex)
{
- if(_traceLevels && _traceLevels->replica > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "lost session with master replica:\n" << ex;
- }
- return false;
+ if(_traceLevels && _traceLevels->replica > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "lost session with master replica:\n" << ex;
+ }
+ return false;
}
}
@@ -423,141 +423,141 @@ ReplicaSessionManager::createSession(InternalRegistryPrx& registry, IceUtil::Tim
auto_ptr<Ice::Exception> exception;
try
{
- if(_traceLevels && _traceLevels->replica > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "trying to establish session with master replica";
- }
-
- set<InternalRegistryPrx> used;
- if(!registry->ice_getEndpoints().empty())
- {
- try
- {
- session = createSessionImpl(registry, timeout);
- }
- catch(const Ice::LocalException& ex)
- {
- exception.reset(ex.ice_clone());
- used.insert(registry);
- registry = InternalRegistryPrx::uncheckedCast(registry->ice_endpoints(Ice::EndpointSeq()));
- }
- }
-
- if(!session)
- {
- for(vector<QueryPrx>::const_iterator p = _queryObjects.begin(); p != _queryObjects.end(); ++p)
- {
- InternalRegistryPrx newRegistry;
- try
- {
- Ice::ObjectPrx obj = (*p)->findObjectById(registry->ice_getIdentity());
- newRegistry = InternalRegistryPrx::uncheckedCast(obj);
- if(newRegistry && used.find(newRegistry) == used.end())
- {
- session = createSessionImpl(newRegistry, timeout);
- registry = newRegistry;
- break;
- }
- }
- catch(const Ice::LocalException& ex)
- {
- exception.reset(ex.ice_clone());
- if(newRegistry)
- {
- used.insert(newRegistry);
- }
- }
- }
- }
+ if(_traceLevels && _traceLevels->replica > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "trying to establish session with master replica";
+ }
+
+ set<InternalRegistryPrx> used;
+ if(!registry->ice_getEndpoints().empty())
+ {
+ try
+ {
+ session = createSessionImpl(registry, timeout);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ exception.reset(ex.ice_clone());
+ used.insert(registry);
+ registry = InternalRegistryPrx::uncheckedCast(registry->ice_endpoints(Ice::EndpointSeq()));
+ }
+ }
+
+ if(!session)
+ {
+ for(vector<QueryPrx>::const_iterator p = _queryObjects.begin(); p != _queryObjects.end(); ++p)
+ {
+ InternalRegistryPrx newRegistry;
+ try
+ {
+ Ice::ObjectPrx obj = (*p)->findObjectById(registry->ice_getIdentity());
+ newRegistry = InternalRegistryPrx::uncheckedCast(obj);
+ if(newRegistry && used.find(newRegistry) == used.end())
+ {
+ session = createSessionImpl(newRegistry, timeout);
+ registry = newRegistry;
+ break;
+ }
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ exception.reset(ex.ice_clone());
+ if(newRegistry)
+ {
+ used.insert(newRegistry);
+ }
+ }
+ }
+ }
}
catch(const ReplicaActiveException& ex)
{
- if(_traceLevels)
- {
- _traceLevels->logger->error("a replica with the same name is already registered and active");
- }
- exception.reset(ex.ice_clone());
+ if(_traceLevels)
+ {
+ _traceLevels->logger->error("a replica with the same name is already registered and active");
+ }
+ exception.reset(ex.ice_clone());
}
catch(const Ice::Exception& ex)
{
- exception.reset(ex.ice_clone());
+ exception.reset(ex.ice_clone());
}
if(session)
{
- //
- // Register all the well-known objects with the replica session.
- //
- _wellKnownObjects->registerAll(session);
+ //
+ // Register all the well-known objects with the replica session.
+ //
+ _wellKnownObjects->registerAll(session);
}
else
{
- //
- // Re-register all the well known objects with the local database.
- //
- _wellKnownObjects->registerAll();
+ //
+ // Re-register all the well known objects with the local database.
+ //
+ _wellKnownObjects->registerAll();
}
if(_traceLevels && _traceLevels->replica > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- if(session)
- {
- out << "established session with master replica";
- }
- else
- {
- out << "failed to establish session with master replica:\n";
- if(exception.get())
- {
- out << *exception.get();
- }
- else
- {
- out << "failed to get replica proxy";
- }
- }
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ if(session)
+ {
+ out << "established session with master replica";
+ }
+ else
+ {
+ out << "failed to establish session with master replica:\n";
+ if(exception.get())
+ {
+ out << *exception.get();
+ }
+ else
+ {
+ out << "failed to get replica proxy";
+ }
+ }
}
return session;
}
ReplicaSessionPrx
ReplicaSessionManager::createSessionImpl(const InternalRegistryPrx& registry, IceUtil::Time& timeout)
-{
+{
try
{
- ReplicaSessionPrx session = registry->registerReplica(_info, _internalRegistry);
- int t = session->getTimeout();
- if(t > 0)
- {
- timeout = IceUtil::Time::seconds(t / 2);
- }
-
- //
- // Create a new database observer servant and give its proxy
- // to the session so that it can subscribe it. This call only
- // returns once the observer is subscribed and initialized.
- //
- DatabaseObserverPtr servant = new MasterDatabaseObserverI(_thread, _database, session);
- _observer = DatabaseObserverPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(servant));
- session->setDatabaseObserver(_observer);
- return session;
+ ReplicaSessionPrx session = registry->registerReplica(_info, _internalRegistry);
+ int t = session->getTimeout();
+ if(t > 0)
+ {
+ timeout = IceUtil::Time::seconds(t / 2);
+ }
+
+ //
+ // Create a new database observer servant and give its proxy
+ // to the session so that it can subscribe it. This call only
+ // returns once the observer is subscribed and initialized.
+ //
+ DatabaseObserverPtr servant = new MasterDatabaseObserverI(_thread, _database, session);
+ _observer = DatabaseObserverPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(servant));
+ session->setDatabaseObserver(_observer);
+ return session;
}
catch(const Ice::LocalException&)
{
- if(_observer)
- {
- try
- {
- _database->getInternalAdapter()->remove(_observer->ice_getIdentity());
- }
- catch(const Ice::LocalException&)
- {
- }
- _observer = 0;
- }
- throw;
+ if(_observer)
+ {
+ try
+ {
+ _database->getInternalAdapter()->remove(_observer->ice_getIdentity());
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ _observer = 0;
+ }
+ throw;
}
}
@@ -566,33 +566,33 @@ ReplicaSessionManager::destroySession(const ReplicaSessionPrx& session)
{
try
{
- session->destroy();
+ session->destroy();
- if(_traceLevels && _traceLevels->replica > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "destroyed master replica session";
- }
+ if(_traceLevels && _traceLevels->replica > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "destroyed master replica session";
+ }
}
catch(const Ice::LocalException& ex)
{
- if(_traceLevels && _traceLevels->replica > 1)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
- out << "couldn't destroy master replica session:\n" << ex;
- }
+ if(_traceLevels && _traceLevels->replica > 1)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat);
+ out << "couldn't destroy master replica session:\n" << ex;
+ }
}
if(_observer)
{
- try
- {
- _database->getInternalAdapter()->remove(_observer->ice_getIdentity());
- }
- catch(const Ice::LocalException&)
- {
- }
- _observer = 0;
+ try
+ {
+ _database->getInternalAdapter()->remove(_observer->ice_getIdentity());
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ _observer = 0;
}
}
diff --git a/cpp/src/IceGrid/ReplicaSessionManager.h b/cpp/src/IceGrid/ReplicaSessionManager.h
index 32658fed0bf..21a1a261710 100644
--- a/cpp/src/IceGrid/ReplicaSessionManager.h
+++ b/cpp/src/IceGrid/ReplicaSessionManager.h
@@ -37,42 +37,42 @@ public:
{
public:
- Thread(ReplicaSessionManager& manager, const InternalRegistryPrx& master) :
- SessionKeepAliveThread<ReplicaSessionPrx>(master),
- _manager(manager)
+ Thread(ReplicaSessionManager& manager, const InternalRegistryPrx& master) :
+ SessionKeepAliveThread<ReplicaSessionPrx>(master),
+ _manager(manager)
{
- }
+ }
- virtual ReplicaSessionPrx
- createSession(InternalRegistryPrx& master, IceUtil::Time& timeout)
+ virtual ReplicaSessionPrx
+ createSession(InternalRegistryPrx& master, IceUtil::Time& timeout)
{
- return _manager.createSession(master, timeout);
- }
+ return _manager.createSession(master, timeout);
+ }
- virtual void
- destroySession(const ReplicaSessionPrx& session)
+ virtual void
+ destroySession(const ReplicaSessionPrx& session)
{
- _manager.destroySession(session);
- }
+ _manager.destroySession(session);
+ }
- virtual bool
- keepAlive(const ReplicaSessionPrx& session)
+ virtual bool
+ keepAlive(const ReplicaSessionPrx& session)
{
- return _manager.keepAlive(session);
- }
+ return _manager.keepAlive(session);
+ }
- void registerAllWellKnownObjects();
+ void registerAllWellKnownObjects();
private:
-
- ReplicaSessionManager& _manager;
+
+ ReplicaSessionManager& _manager;
};
typedef IceUtil::Handle<Thread> ThreadPtr;
ReplicaSessionManager();
void create(const std::string&, const InternalReplicaInfoPtr&, const DatabasePtr&,
- const WellKnownObjectsManagerPtr&, const InternalRegistryPrx&);
+ const WellKnownObjectsManagerPtr&, const InternalRegistryPrx&);
void create(const InternalRegistryPrx&);
NodePrxSeq getNodes(const NodePrxSeq&) const;
void destroy();
diff --git a/cpp/src/IceGrid/ServerAdapterI.cpp b/cpp/src/IceGrid/ServerAdapterI.cpp
index abf97e7ed12..52a63bb3de1 100644
--- a/cpp/src/IceGrid/ServerAdapterI.cpp
+++ b/cpp/src/IceGrid/ServerAdapterI.cpp
@@ -17,10 +17,10 @@ using namespace std;
using namespace IceGrid;
ServerAdapterI::ServerAdapterI(const NodeIPtr& node,
- ServerI* server,
- const string& serverName,
- const AdapterPrx& proxy,
- const string& id) :
+ ServerI* server,
+ const string& serverName,
+ const AdapterPrx& proxy,
+ const string& id) :
_node(node),
_this(proxy),
_serverId(serverName),
@@ -37,39 +37,39 @@ void
ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Current& current)
{
{
- Lock sync(*this);
- if(_proxy)
- {
- //
- // Return the adapter direct proxy.
- //
- cb->ice_response(_proxy);
- return;
- }
- else if(_activateCB.empty())
- {
- //
- // Nothing else waits for this adapter so we must make sure that this
- // adapter if still activatable.
- //
- if(!_server->isAdapterActivatable(_id))
- {
- cb->ice_response(0);
- return;
- }
- }
-
- if(_node->getTraceLevels()->adapter > 2)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat);
- out << "waiting for activation of server `" + _serverId + "' adapter `" << _id << "'";
- }
-
- _activateCB.push_back(cb);
- if(_activateCB.size() > 1)
- {
- return;
- }
+ Lock sync(*this);
+ if(_proxy)
+ {
+ //
+ // Return the adapter direct proxy.
+ //
+ cb->ice_response(_proxy);
+ return;
+ }
+ else if(_activateCB.empty())
+ {
+ //
+ // Nothing else waits for this adapter so we must make sure that this
+ // adapter if still activatable.
+ //
+ if(!_server->isAdapterActivatable(_id))
+ {
+ cb->ice_response(0);
+ return;
+ }
+ }
+
+ if(_node->getTraceLevels()->adapter > 2)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat);
+ out << "waiting for activation of server `" + _serverId + "' adapter `" << _id << "'";
+ }
+
+ _activateCB.push_back(cb);
+ if(_activateCB.size() > 1)
+ {
+ return;
+ }
}
//
@@ -79,21 +79,21 @@ ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Cur
//
try
{
- _server->start(ServerI::OnDemand);
- return;
+ _server->start(ServerI::OnDemand);
+ return;
}
catch(const ServerStartException& ex)
{
- activationFailed(ex.reason);
+ activationFailed(ex.reason);
}
catch(const Ice::ObjectNotExistException&)
{
- //
- // The server associated to this adapter doesn't exist anymore. Somehow the database is
- // inconsistent if this happens. The best thing to do is to destroy the adapter.
- //
- destroy();
- activationFailed("server destroyed");
+ //
+ // The server associated to this adapter doesn't exist anymore. Somehow the database is
+ // inconsistent if this happens. The best thing to do is to destroy the adapter.
+ //
+ destroy();
+ activationFailed("server destroyed");
}
}
@@ -108,13 +108,13 @@ ServerAdapterI::getDirectProxy(const Ice::Current& current) const
//
if(_proxy)
{
- return _proxy;
+ return _proxy;
}
else
{
- AdapterNotActiveException ex;
- ex.activatable = _server->isAdapterActivatable(_id);
- throw ex;
+ AdapterNotActiveException ex;
+ ex.activatable = _server->isAdapterActivatable(_id);
+ throw ex;
}
}
@@ -129,10 +129,10 @@ ServerAdapterI::setDirectProxy(const Ice::ObjectPrx& prx, const Ice::Current&)
//
if(prx && _proxy)
{
- if(_server->getState() == Active)
- {
- throw AdapterActiveException();
- }
+ if(_server->getState() == Active)
+ {
+ throw AdapterActiveException();
+ }
}
bool updated = _proxy != prx;
@@ -140,35 +140,35 @@ ServerAdapterI::setDirectProxy(const Ice::ObjectPrx& prx, const Ice::Current&)
for(vector<AMD_Adapter_activatePtr>::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p)
{
- (*p)->ice_response(_proxy);
+ (*p)->ice_response(_proxy);
}
_activateCB.clear();
if(updated)
{
- AdapterDynamicInfo info;
- info.id = _id;
- info.proxy = _proxy;
- _node->observerUpdateAdapter(info);
+ AdapterDynamicInfo info;
+ info.id = _id;
+ info.proxy = _proxy;
+ _node->observerUpdateAdapter(info);
}
if(_proxy)
{
- _server->adapterActivated(_id);
+ _server->adapterActivated(_id);
}
else
{
- _server->adapterDeactivated(_id);
+ _server->adapterDeactivated(_id);
}
if(_node->getTraceLevels()->adapter > 1)
{
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat);
- out << "server `" + _serverId + "' adapter `" << _id << "' " << (_proxy ? "activated" : "deactivated");
- if(_proxy)
- {
- out << ": " << _node->getCommunicator()->proxyToString(_proxy);
- }
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat);
+ out << "server `" + _serverId + "' adapter `" << _id << "' " << (_proxy ? "activated" : "deactivated");
+ if(_proxy)
+ {
+ out << ": " << _node->getCommunicator()->proxyToString(_proxy);
+ }
}
}
@@ -194,14 +194,14 @@ ServerAdapterI::activationFailed(const std::string& reason)
//
if(_node->getTraceLevels()->adapter > 1)
{
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat);
- out << "server `" + _serverId + "' adapter `" << _id << "' activation failed: " << reason;
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->adapterCat);
+ out << "server `" + _serverId + "' adapter `" << _id << "' activation failed: " << reason;
}
Lock sync(*this);
for(vector<AMD_Adapter_activatePtr>::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p)
{
- (*p)->ice_response(0);
+ (*p)->ice_response(0);
}
_activateCB.clear();
}
diff --git a/cpp/src/IceGrid/ServerCache.cpp b/cpp/src/IceGrid/ServerCache.cpp
index 36c8a917717..14030eea69b 100644
--- a/cpp/src/IceGrid/ServerCache.cpp
+++ b/cpp/src/IceGrid/ServerCache.cpp
@@ -26,45 +26,45 @@ namespace IceGrid
struct AddCommunicator : std::unary_function<CommunicatorDescriptorPtr&, void>
{
- AddCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry, const string& application) :
- _serverCache(serverCache), _entry(entry), _application(application)
- {
- }
-
- void
- operator()(const CommunicatorDescriptorPtr& desc)
- {
- _serverCache.addCommunicator(desc, _entry, _application);
- }
-
- ServerCache& _serverCache;
- const ServerEntryPtr _entry;
- const string _application;
+ AddCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry, const string& application) :
+ _serverCache(serverCache), _entry(entry), _application(application)
+ {
+ }
+
+ void
+ operator()(const CommunicatorDescriptorPtr& desc)
+ {
+ _serverCache.addCommunicator(desc, _entry, _application);
+ }
+
+ ServerCache& _serverCache;
+ const ServerEntryPtr _entry;
+ const string _application;
};
struct RemoveCommunicator : std::unary_function<CommunicatorDescriptorPtr&, void>
{
- RemoveCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry) :
- _serverCache(serverCache), _entry(entry)
- {
- }
+ RemoveCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry) :
+ _serverCache(serverCache), _entry(entry)
+ {
+ }
- void
- operator()(const CommunicatorDescriptorPtr& desc)
- {
- _serverCache.removeCommunicator(desc, _entry);
- }
+ void
+ operator()(const CommunicatorDescriptorPtr& desc)
+ {
+ _serverCache.removeCommunicator(desc, _entry);
+ }
- ServerCache& _serverCache;
- const ServerEntryPtr _entry;
+ ServerCache& _serverCache;
+ const ServerEntryPtr _entry;
};
}
ServerCache::ServerCache(const Ice::CommunicatorPtr& communicator,
- NodeCache& nodeCache,
- AdapterCache& adapterCache,
- ObjectCache& objectCache,
- AllocatableObjectCache& allocatableObjectCache) :
+ NodeCache& nodeCache,
+ AdapterCache& adapterCache,
+ ObjectCache& objectCache,
+ AllocatableObjectCache& allocatableObjectCache) :
_communicator(communicator),
_nodeCache(nodeCache),
_adapterCache(adapterCache),
@@ -81,8 +81,8 @@ ServerCache::add(const ServerInfo& info)
ServerEntryPtr entry = getImpl(info.descriptor->id);
if(!entry)
{
- entry = new ServerEntry(*this, info.descriptor->id);
- addImpl(info.descriptor->id, entry);
+ entry = new ServerEntry(*this, info.descriptor->id);
+ addImpl(info.descriptor->id, entry);
}
entry->update(info);
_nodeCache.get(info.node, true)->addServer(entry);
@@ -91,9 +91,9 @@ ServerCache::add(const ServerInfo& info)
if(_traceLevels && _traceLevels->server > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "added server `" << info.descriptor->id << "' (`" << info.uuid << "', `" << info.revision << "')";
+ out << "added server `" << info.descriptor->id << "' (`" << info.uuid << "', `" << info.revision << "')";
}
return entry;
@@ -106,9 +106,9 @@ ServerCache::get(const string& id) const
ServerEntryPtr entry = getImpl(id);
if(!entry)
{
- ServerNotExistException ex;
- ex.id = id;
- throw ex;
+ ServerNotExistException ex;
+ ex.id = id;
+ throw ex;
}
return entry;
}
@@ -134,14 +134,14 @@ ServerCache::remove(const string& id, bool destroy)
if(destroy)
{
- entry->destroy(); // This must be done after otherwise some allocatable objects
- // might allocate a destroyed server.
+ entry->destroy(); // This must be done after otherwise some allocatable objects
+ // might allocate a destroyed server.
}
if(_traceLevels && _traceLevels->server > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
- out << "removed server `" << id << "'";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
+ out << "removed server `" << id << "'";
}
return entry;
@@ -156,30 +156,30 @@ ServerCache::clear(const string& id)
void
ServerCache::addCommunicator(const CommunicatorDescriptorPtr& comm,
- const ServerEntryPtr& server,
- const string& application)
+ const ServerEntryPtr& server,
+ const string& application)
{
for(AdapterDescriptorSeq::const_iterator q = comm->adapters.begin() ; q != comm->adapters.end(); ++q)
{
- assert(!q->id.empty());
- _adapterCache.addServerAdapter(*q, server, application);
+ assert(!q->id.empty());
+ _adapterCache.addServerAdapter(*q, server, application);
- ObjectDescriptorSeq::const_iterator r;
- for(r = q->objects.begin(); r != q->objects.end(); ++r)
- {
- ObjectInfo info;
- info.type = r->type;
- info.proxy = _communicator->stringToProxy("\"" + _communicator->identityToString(r->id) + "\" @ " + q->id);
- _objectCache.add(info, application);
- }
+ ObjectDescriptorSeq::const_iterator r;
+ for(r = q->objects.begin(); r != q->objects.end(); ++r)
+ {
+ ObjectInfo info;
+ info.type = r->type;
+ info.proxy = _communicator->stringToProxy("\"" + _communicator->identityToString(r->id) + "\" @ " + q->id);
+ _objectCache.add(info, application);
+ }
- for(r = q->allocatables.begin(); r != q->allocatables.end(); ++r)
- {
- ObjectInfo info;
- info.type = r->type;
- info.proxy = _communicator->stringToProxy("\"" + _communicator->identityToString(r->id) + "\" @ " + q->id);
- _allocatableObjectCache.add(info, server);
- }
+ for(r = q->allocatables.begin(); r != q->allocatables.end(); ++r)
+ {
+ ObjectInfo info;
+ info.type = r->type;
+ info.proxy = _communicator->stringToProxy("\"" + _communicator->identityToString(r->id) + "\" @ " + q->id);
+ _allocatableObjectCache.add(info, server);
+ }
}
}
@@ -188,16 +188,16 @@ ServerCache::removeCommunicator(const CommunicatorDescriptorPtr& comm, const Ser
{
for(AdapterDescriptorSeq::const_iterator q = comm->adapters.begin() ; q != comm->adapters.end(); ++q)
{
- ObjectDescriptorSeq::const_iterator r;
- for(r = q->objects.begin(); r != q->objects.end(); ++r)
- {
- _objectCache.remove(r->id);
- }
- for(r = q->allocatables.begin(); r != q->allocatables.end(); ++r)
- {
- _allocatableObjectCache.remove(r->id);
- }
- _adapterCache.removeServerAdapter(q->id);
+ ObjectDescriptorSeq::const_iterator r;
+ for(r = q->objects.begin(); r != q->objects.end(); ++r)
+ {
+ _objectCache.remove(r->id);
+ }
+ for(r = q->allocatables.begin(); r != q->allocatables.end(); ++r)
+ {
+ _allocatableObjectCache.remove(r->id);
+ }
+ _adapterCache.removeServerAdapter(q->id);
}
}
@@ -224,14 +224,14 @@ ServerEntry::syncAndWait()
syncImpl();
try
{
- waitImpl();
+ waitImpl();
}
catch(const NodeUnreachableException&)
{
- //
- // The node being unreachable isn't considered as a failure to
- // synchronize the server.
- //
+ //
+ // The node being unreachable isn't considered as a failure to
+ // synchronize the server.
+ //
}
}
@@ -240,7 +240,7 @@ ServerEntry::waitNoThrow()
{
try
{
- waitImpl();
+ waitImpl();
}
catch(const Ice::Exception&)
{
@@ -253,7 +253,7 @@ ServerEntry::unsync()
Lock sync(*this);
if(_loaded.get())
{
- _load = _loaded;
+ _load = _loaded;
}
_proxy = 0;
_adapters.clear();
@@ -273,14 +273,14 @@ ServerEntry::update(const ServerInfo& info)
if(!_destroy.get())
{
- if(_loaded.get() && descriptor->node != _loaded->node)
- {
- _destroy = _loaded;
- }
- else if(_load.get() && descriptor->node != _load->node)
- {
- _destroy = _load;
- }
+ if(_loaded.get() && descriptor->node != _loaded->node)
+ {
+ _destroy = _loaded;
+ }
+ else if(_load.get() && descriptor->node != _load->node)
+ {
+ _destroy = _load;
+ }
}
_load = descriptor;
@@ -298,16 +298,16 @@ ServerEntry::destroy()
assert(_loaded.get() || _load.get());
if(!_destroy.get())
{
- if(_loaded.get())
- {
- assert(!_destroy.get());
- _destroy = _loaded;
- }
- else if(_load.get())
- {
- assert(!_destroy.get());
- _destroy = _load;
- }
+ if(_loaded.get())
+ {
+ assert(!_destroy.get());
+ _destroy = _loaded;
+ }
+ else if(_load.get())
+ {
+ assert(!_destroy.get());
+ _destroy = _load;
+ }
}
_load.reset(0);
@@ -321,30 +321,30 @@ ServerEntry::getInfo(bool resolve) const
ServerInfo info;
SessionIPtr session;
{
- Lock sync(*this);
- if(!_loaded.get() && !_load.get())
- {
- throw ServerNotExistException();
- }
- info = _loaded.get() ? *_loaded : *_load;
- session = _session;
+ Lock sync(*this);
+ if(!_loaded.get() && !_load.get())
+ {
+ throw ServerNotExistException();
+ }
+ info = _loaded.get() ? *_loaded : *_load;
+ session = _session;
}
assert(info.descriptor);
if(resolve)
{
- try
- {
- return _cache.getNodeCache().get(info.node)->getServerInfo(info, session);
- }
- catch(const DeploymentException&)
- {
- }
- catch(const NodeNotExistException&)
- {
- }
- catch(const NodeUnreachableException&)
- {
- }
+ try
+ {
+ return _cache.getNodeCache().get(info.node)->getServerInfo(info, session);
+ }
+ catch(const DeploymentException&)
+ {
+ }
+ catch(const NodeNotExistException&)
+ {
+ }
+ catch(const NodeUnreachableException&)
+ {
+ }
}
return info;
}
@@ -367,45 +367,45 @@ ServerPrx
ServerEntry::getProxy(int& activationTimeout, int& deactivationTimeout, string& node, bool upToDate)
{
{
- Lock sync(*this);
- if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
- {
- assert(_loaded.get() || _load.get() || _destroy.get());
- activationTimeout = _activationTimeout;
- deactivationTimeout = _deactivationTimeout;
- node = _loaded.get() ? _loaded->node : (_load.get() ? _load->node : _destroy->node);
- return _proxy;
- }
+ Lock sync(*this);
+ if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
+ {
+ assert(_loaded.get() || _load.get() || _destroy.get());
+ activationTimeout = _activationTimeout;
+ deactivationTimeout = _deactivationTimeout;
+ node = _loaded.get() ? _loaded->node : (_load.get() ? _load->node : _destroy->node);
+ return _proxy;
+ }
}
while(true)
{
- //
- // Note that we don't call syncAndWait() because we want
- // NodeUnreachableException exceptions to go through.
- //
- syncImpl();
- waitImpl();
-
- {
- Lock sync(*this);
- if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
- {
- assert(_loaded.get() || _load.get() || _destroy.get());
- activationTimeout = _activationTimeout;
- deactivationTimeout = _deactivationTimeout;
- node = _loaded.get() ? _loaded->node : (_load.get() ? _load->node : _destroy->node);
- return _proxy;
- }
- else if(_load.get())
- {
- continue; // Retry
- }
- else
- {
- throw ServerNotExistException(_id);
- }
- }
+ //
+ // Note that we don't call syncAndWait() because we want
+ // NodeUnreachableException exceptions to go through.
+ //
+ syncImpl();
+ waitImpl();
+
+ {
+ Lock sync(*this);
+ if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
+ {
+ assert(_loaded.get() || _load.get() || _destroy.get());
+ activationTimeout = _activationTimeout;
+ deactivationTimeout = _deactivationTimeout;
+ node = _loaded.get() ? _loaded->node : (_load.get() ? _load->node : _destroy->node);
+ return _proxy;
+ }
+ else if(_load.get())
+ {
+ continue; // Retry
+ }
+ else
+ {
+ throw ServerNotExistException(_id);
+ }
+ }
}
}
@@ -420,58 +420,58 @@ AdapterPrx
ServerEntry::getAdapter(int& activationTimeout, int& deactivationTimeout, const string& id, bool upToDate)
{
{
- Lock sync(*this);
- if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
- {
- AdapterPrxDict::const_iterator p = _adapters.find(id);
- if(p != _adapters.end())
- {
- assert(p->second);
- activationTimeout = _activationTimeout;
- deactivationTimeout = _deactivationTimeout;
- return p->second;
- }
- else
- {
- throw AdapterNotExistException(id);
- }
- }
+ Lock sync(*this);
+ if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
+ {
+ AdapterPrxDict::const_iterator p = _adapters.find(id);
+ if(p != _adapters.end())
+ {
+ assert(p->second);
+ activationTimeout = _activationTimeout;
+ deactivationTimeout = _deactivationTimeout;
+ return p->second;
+ }
+ else
+ {
+ throw AdapterNotExistException(id);
+ }
+ }
}
while(true)
{
- //
- // Note that we don't call syncAndWait() because we want
- // NodeUnreachableException exceptions to go through.
- //
- syncImpl();
- waitImpl();
-
- {
- Lock sync(*this);
- if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
- {
- AdapterPrxDict::const_iterator p = _adapters.find(id);
- if(p != _adapters.end())
- {
- activationTimeout = _activationTimeout;
- deactivationTimeout = _deactivationTimeout;
- return p->second;
- }
- else
- {
- throw AdapterNotExistException(id);
- }
- }
- else if(_load.get())
- {
- continue; // Retry
- }
- else
- {
- throw AdapterNotExistException(id);
- }
- }
+ //
+ // Note that we don't call syncAndWait() because we want
+ // NodeUnreachableException exceptions to go through.
+ //
+ syncImpl();
+ waitImpl();
+
+ {
+ Lock sync(*this);
+ if(_loaded.get() || _proxy && _synchronizing && !upToDate) // Synced or if not up to date is fine
+ {
+ AdapterPrxDict::const_iterator p = _adapters.find(id);
+ if(p != _adapters.end())
+ {
+ activationTimeout = _activationTimeout;
+ deactivationTimeout = _deactivationTimeout;
+ return p->second;
+ }
+ else
+ {
+ throw AdapterNotExistException(id);
+ }
+ }
+ else if(_load.get())
+ {
+ continue; // Retry
+ }
+ else
+ {
+ throw AdapterNotExistException(id);
+ }
+ }
}
}
@@ -481,21 +481,21 @@ ServerEntry::getLoad(LoadSample sample) const
string application;
string node;
{
- Lock sync(*this);
- if(_loaded.get())
- {
- application = _loaded->application;
- node = _loaded->node;
- }
- else if(_load.get())
- {
- application = _load->application;
- node = _load->node;
- }
- else
- {
- throw ServerNotExistException();
- }
+ Lock sync(*this);
+ if(_loaded.get())
+ {
+ application = _loaded->application;
+ node = _loaded->node;
+ }
+ else if(_load.get())
+ {
+ application = _load->application;
+ node = _load->node;
+ }
+ else
+ {
+ throw ServerNotExistException();
+ }
}
float factor;
@@ -503,14 +503,14 @@ ServerEntry::getLoad(LoadSample sample) const
switch(sample)
{
case LoadSample1:
- return load.avg1 < 0.f ? 1.0f : load.avg1 * factor;
+ return load.avg1 < 0.f ? 1.0f : load.avg1 * factor;
case LoadSample5:
- return load.avg5 < 0.f ? 1.0f : load.avg5 * factor;
+ return load.avg5 < 0.f ? 1.0f : load.avg5 * factor;
case LoadSample15:
- return load.avg15 < 0.f ? 1.0f : load.avg15 * factor;
+ return load.avg15 < 0.f ? 1.0f : load.avg15 * factor;
default:
- assert(false);
- return 1.0f;
+ assert(false);
+ return 1.0f;
}
}
@@ -523,60 +523,60 @@ ServerEntry::syncImpl()
int timeout = -1;
{
- Lock sync(*this);
- if(_synchronizing)
- {
- return;
- }
-
- if(!_load.get() && !_destroy.get())
- {
- _load = _loaded; // Re-load the current server.
- }
-
- _updated = false;
- _exception.reset(0);
-
- if(_destroy.get())
- {
- destroy = *_destroy;
- timeout = _deactivationTimeout;
- }
- else if(_load.get())
- {
- load = *_load;
- session = _session;
- timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
- }
- else
- {
- return;
- }
-
- _synchronizing = true;
+ Lock sync(*this);
+ if(_synchronizing)
+ {
+ return;
+ }
+
+ if(!_load.get() && !_destroy.get())
+ {
+ _load = _loaded; // Re-load the current server.
+ }
+
+ _updated = false;
+ _exception.reset(0);
+
+ if(_destroy.get())
+ {
+ destroy = *_destroy;
+ timeout = _deactivationTimeout;
+ }
+ else if(_load.get())
+ {
+ load = *_load;
+ session = _session;
+ timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
+ }
+ else
+ {
+ return;
+ }
+
+ _synchronizing = true;
}
if(destroy.descriptor)
{
- try
- {
- _cache.getNodeCache().get(destroy.node)->destroyServer(this, destroy, timeout);
- }
- catch(NodeNotExistException&)
- {
- exception(NodeUnreachableException(destroy.node, "node is not active"));
- }
+ try
+ {
+ _cache.getNodeCache().get(destroy.node)->destroyServer(this, destroy, timeout);
+ }
+ catch(NodeNotExistException&)
+ {
+ exception(NodeUnreachableException(destroy.node, "node is not active"));
+ }
}
else if(load.descriptor)
{
- try
- {
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
- }
- catch(NodeNotExistException&)
- {
- exception(NodeUnreachableException(load.node, "node is not active"));
- }
+ try
+ {
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
+ }
+ catch(NodeNotExistException&)
+ {
+ exception(NodeUnreachableException(load.node, "node is not active"));
+ }
}
}
@@ -586,35 +586,35 @@ ServerEntry::waitImpl()
Lock sync(*this);
while(_synchronizing)
{
- wait();
+ wait();
}
if(_exception.get())
{
- try
- {
- _exception->ice_throw();
- }
- catch(const DeploymentException&)
- {
- throw;
- }
- catch(const NodeUnreachableException&)
- {
- throw;
- }
- catch(const Ice::Exception& ex) // This shouln't happen.
- {
- ostringstream os;
- os << "unexpected exception while synchronizing server `" + _id + "':\n" << ex;
- TraceLevelsPtr traceLevels = _cache.getTraceLevels();
- if(traceLevels)
- {
- Ice::Error err(traceLevels->logger);
- err << os.str();
- }
- throw DeploymentException(os.str());
- }
+ try
+ {
+ _exception->ice_throw();
+ }
+ catch(const DeploymentException&)
+ {
+ throw;
+ }
+ catch(const NodeUnreachableException&)
+ {
+ throw;
+ }
+ catch(const Ice::Exception& ex) // This shouln't happen.
+ {
+ ostringstream os;
+ os << "unexpected exception while synchronizing server `" + _id + "':\n" << ex;
+ TraceLevelsPtr traceLevels = _cache.getTraceLevels();
+ if(traceLevels)
+ {
+ Ice::Error err(traceLevels->logger);
+ err << os.str();
+ }
+ throw DeploymentException(os.str());
+ }
}
}
@@ -627,66 +627,66 @@ ServerEntry::loadCallback(const ServerPrx& proxy, const AdapterPrxDict& adpts, i
int timeout = -1;
{
- Lock sync(*this);
- if(!_updated)
- {
- //
- // Set timeout on server and adapter proxies. Most of the
- // calls on the proxies shouldn't block for longer than the
- // node session timeout. Calls that might block for a longer
- // time should set the correct timeout before invoking on the
- // proxy (e.g.: server start/stop, adapter activate).
- //
- _loaded = _load;
- assert(_loaded.get());
- _proxy = proxy;
- _adapters = adpts;
- _activationTimeout = at;
- _deactivationTimeout = dt;
-
- assert(!_destroy.get() && !_load.get());
- _synchronizing = false;
- notifyAll();
- return;
- }
- else
- {
- _updated = false;
- if(_destroy.get())
- {
- destroy = *_destroy;
- }
- else if(_load.get())
- {
- load = *_load;
- session = _session;
- timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
- }
- }
+ Lock sync(*this);
+ if(!_updated)
+ {
+ //
+ // Set timeout on server and adapter proxies. Most of the
+ // calls on the proxies shouldn't block for longer than the
+ // node session timeout. Calls that might block for a longer
+ // time should set the correct timeout before invoking on the
+ // proxy (e.g.: server start/stop, adapter activate).
+ //
+ _loaded = _load;
+ assert(_loaded.get());
+ _proxy = proxy;
+ _adapters = adpts;
+ _activationTimeout = at;
+ _deactivationTimeout = dt;
+
+ assert(!_destroy.get() && !_load.get());
+ _synchronizing = false;
+ notifyAll();
+ return;
+ }
+ else
+ {
+ _updated = false;
+ if(_destroy.get())
+ {
+ destroy = *_destroy;
+ }
+ else if(_load.get())
+ {
+ load = *_load;
+ session = _session;
+ timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
+ }
+ }
}
assert(destroy.descriptor || load.descriptor);
if(destroy.descriptor)
{
- try
- {
- _cache.getNodeCache().get(destroy.node)->destroyServer(this, destroy, timeout);
- }
- catch(NodeNotExistException&)
- {
- exception(NodeUnreachableException(destroy.node, "node is not active"));
- }
+ try
+ {
+ _cache.getNodeCache().get(destroy.node)->destroyServer(this, destroy, timeout);
+ }
+ catch(NodeNotExistException&)
+ {
+ exception(NodeUnreachableException(destroy.node, "node is not active"));
+ }
}
else if(load.descriptor)
{
- try
- {
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
- }
- catch(NodeNotExistException&)
- {
- exception(NodeUnreachableException(load.node, "node is not active"));
- }
+ try
+ {
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
+ }
+ catch(NodeNotExistException&)
+ {
+ exception(NodeUnreachableException(load.node, "node is not active"));
+ }
}
}
@@ -697,41 +697,41 @@ ServerEntry::destroyCallback()
SessionIPtr session;
{
- Lock sync(*this);
- _destroy.reset(0);
- _proxy = 0;
- _adapters.clear();
- _activationTimeout = -1;
- _deactivationTimeout = -1;
+ Lock sync(*this);
+ _destroy.reset(0);
+ _proxy = 0;
+ _adapters.clear();
+ _activationTimeout = -1;
+ _deactivationTimeout = -1;
- if(!_load.get())
- {
- assert(!_load.get() && !_loaded.get());
- _synchronizing = false;
- notifyAll();
- }
- else
- {
- _updated = false;
- load = *_load;
- session = _session;
- }
+ if(!_load.get())
+ {
+ assert(!_load.get() && !_loaded.get());
+ _synchronizing = false;
+ notifyAll();
+ }
+ else
+ {
+ _updated = false;
+ load = *_load;
+ session = _session;
+ }
}
if(load.descriptor)
{
- try
- {
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session, -1);
- }
- catch(NodeNotExistException&)
- {
- exception(NodeUnreachableException(load.node, "node is not active"));
- }
+ try
+ {
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, -1);
+ }
+ catch(NodeNotExistException&)
+ {
+ exception(NodeUnreachableException(load.node, "node is not active"));
+ }
}
else
{
- _cache.clear(_id);
+ _cache.clear(_id);
}
}
@@ -744,43 +744,43 @@ ServerEntry::exception(const Ice::Exception& ex)
int timeout = -1;
{
- Lock sync(*this);
- if((_destroy.get() && !_load.get()) || (!_destroy.get() && !_updated))
- {
- remove = _destroy.get();
- _destroy.reset(0);
- _exception.reset(ex.ice_clone());
- _proxy = 0;
- _adapters.clear();
- _activationTimeout = -1;
- _deactivationTimeout = -1;
- _synchronizing = false;
- notifyAll();
- }
- else
- {
- _destroy.reset(0);
- _updated = false;
- load = *_load.get();
- session = _session;
- timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
- }
+ Lock sync(*this);
+ if((_destroy.get() && !_load.get()) || (!_destroy.get() && !_updated))
+ {
+ remove = _destroy.get();
+ _destroy.reset(0);
+ _exception.reset(ex.ice_clone());
+ _proxy = 0;
+ _adapters.clear();
+ _activationTimeout = -1;
+ _deactivationTimeout = -1;
+ _synchronizing = false;
+ notifyAll();
+ }
+ else
+ {
+ _destroy.reset(0);
+ _updated = false;
+ load = *_load.get();
+ session = _session;
+ timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
+ }
}
if(load.descriptor)
{
- try
- {
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
- }
- catch(NodeNotExistException&)
- {
- exception(NodeUnreachableException(load.node, "node is not active"));
- }
+ try
+ {
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
+ }
+ catch(NodeNotExistException&)
+ {
+ exception(NodeUnreachableException(load.node, "node is not active"));
+ }
}
else if(remove)
{
- _cache.clear(_id);
+ _cache.clear(_id);
}
}
@@ -804,14 +804,14 @@ ServerEntry::allocated(const SessionIPtr& session)
{
if(!_loaded.get() && !_load.get())
{
- return;
+ return;
}
TraceLevelsPtr traceLevels = _cache.getTraceLevels();
if(traceLevels && traceLevels->server > 1)
{
- Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
- out << "server `" << _id << "' allocated by `" << session->getId() << "' (" << _count << ")";
+ Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
+ out << "server `" << _id << "' allocated by `" << session->getId() << "' (" << _count << ")";
}
ServerDescriptorPtr desc = _loaded.get() ? _loaded->descriptor : _load->descriptor;
@@ -824,52 +824,52 @@ ServerEntry::allocated(const SessionIPtr& session)
//
if(desc->activation == "session")
{
- _updated = true;
- if(!_load.get())
- {
- _load = _loaded;
- }
- _session = session;
- _load->sessionId = session->getId();
+ _updated = true;
+ if(!_load.get())
+ {
+ _load = _loaded;
+ }
+ _session = session;
+ _load->sessionId = session->getId();
}
Glacier2::SessionControlPrx ctl = session->getSessionControl();
if(ctl)
{
- ServerHelperPtr helper = createHelper(desc);
- multiset<string> adapterIds;
- multiset<Ice::Identity> identities;
- helper->getIds(adapterIds, identities);
- try
- {
- //
- // SunCC won't accept the following:
- //
- // ctl->adapterIds()->add(Ice::StringSeq(adapterIds.begin(), adapterIds.end()));
- // ctl->identities()->add(Ice::IdentitySeq(identities.begin(), identities.end()));
- //
- Ice::StringSeq adapterIdSeq;
- for(multiset<string>::iterator p = adapterIds.begin(); p != adapterIds.end(); ++p)
- {
- adapterIdSeq.push_back(*p);
- }
- Ice::IdentitySeq identitySeq;
- for(multiset<Ice::Identity>::iterator q = identities.begin(); q != identities.end(); ++q)
- {
- identitySeq.push_back(*q);
- }
- ctl->adapterIds()->add(adapterIdSeq);
- ctl->identities()->add(identitySeq);
- }
- catch(const Ice::LocalException& ex)
- {
- if(traceLevels && traceLevels->server > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
- out << "couldn't add Glacier2 filters for server `" << _id << "' allocated by `" << session->getId();
- out << ":\n" << ex;
- }
- }
+ ServerHelperPtr helper = createHelper(desc);
+ multiset<string> adapterIds;
+ multiset<Ice::Identity> identities;
+ helper->getIds(adapterIds, identities);
+ try
+ {
+ //
+ // SunCC won't accept the following:
+ //
+ // ctl->adapterIds()->add(Ice::StringSeq(adapterIds.begin(), adapterIds.end()));
+ // ctl->identities()->add(Ice::IdentitySeq(identities.begin(), identities.end()));
+ //
+ Ice::StringSeq adapterIdSeq;
+ for(multiset<string>::iterator p = adapterIds.begin(); p != adapterIds.end(); ++p)
+ {
+ adapterIdSeq.push_back(*p);
+ }
+ Ice::IdentitySeq identitySeq;
+ for(multiset<Ice::Identity>::iterator q = identities.begin(); q != identities.end(); ++q)
+ {
+ identitySeq.push_back(*q);
+ }
+ ctl->adapterIds()->add(adapterIdSeq);
+ ctl->identities()->add(identitySeq);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ if(traceLevels && traceLevels->server > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
+ out << "couldn't add Glacier2 filters for server `" << _id << "' allocated by `" << session->getId();
+ out << ":\n" << ex;
+ }
+ }
}
}
@@ -877,13 +877,13 @@ void
ServerEntry::allocatedNoSync(const SessionIPtr& session)
{
{
- Lock sync(*this);
- if(!_updated ||
- _loaded.get() && _loaded->descriptor->activation != "session" ||
- _load.get() && _load->descriptor->activation != "session")
- {
- return;
- }
+ Lock sync(*this);
+ if(!_updated ||
+ _loaded.get() && _loaded->descriptor->activation != "session" ||
+ _load.get() && _load->descriptor->activation != "session")
+ {
+ return;
+ }
}
sync();
@@ -895,7 +895,7 @@ ServerEntry::released(const SessionIPtr& session)
{
if(!_loaded.get() && !_load.get())
{
- return;
+ return;
}
ServerDescriptorPtr desc = _loaded.get() ? _loaded->descriptor : _load->descriptor;
@@ -909,13 +909,13 @@ ServerEntry::released(const SessionIPtr& session)
//
if(desc->activation == "session")
{
- _updated = true;
- if(!_load.get())
- {
- _load = _loaded;
- }
- _load->sessionId = "";
- _session = 0;
+ _updated = true;
+ if(!_load.get())
+ {
+ _load = _loaded;
+ }
+ _load->sessionId = "";
+ _session = 0;
}
TraceLevelsPtr traceLevels = _cache.getTraceLevels();
@@ -923,46 +923,46 @@ ServerEntry::released(const SessionIPtr& session)
Glacier2::SessionControlPrx ctl = session->getSessionControl();
if(ctl)
{
- ServerHelperPtr helper = createHelper(desc);
- multiset<string> adapterIds;
- multiset<Ice::Identity> identities;
- helper->getIds(adapterIds, identities);
- try
- {
- //
- // SunCC won't accept the following:
- //
- // ctl->adapterIds()->remove(Ice::StringSeq(adapterIds.begin(), adapterIds.end()));
- // ctl->identities()->remove(Ice::IdentitySeq(identities.begin(), identities.end()));
- //
- Ice::StringSeq adapterIdSeq;
- for(multiset<string>::iterator p = adapterIds.begin(); p != adapterIds.end(); ++p)
- {
- adapterIdSeq.push_back(*p);
- }
- Ice::IdentitySeq identitySeq;
- for(multiset<Ice::Identity>::iterator q = identities.begin(); q != identities.end(); ++q)
- {
- identitySeq.push_back(*q);
- }
- ctl->adapterIds()->remove(adapterIdSeq);
- ctl->identities()->remove(identitySeq);
- }
- catch(const Ice::LocalException& ex)
- {
- if(traceLevels && traceLevels->server > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
- out << "couldn't remove Glacier2 filters for server `" << _id << "' allocated by `";
- out << session->getId() << ":\n" << ex;
- }
- }
+ ServerHelperPtr helper = createHelper(desc);
+ multiset<string> adapterIds;
+ multiset<Ice::Identity> identities;
+ helper->getIds(adapterIds, identities);
+ try
+ {
+ //
+ // SunCC won't accept the following:
+ //
+ // ctl->adapterIds()->remove(Ice::StringSeq(adapterIds.begin(), adapterIds.end()));
+ // ctl->identities()->remove(Ice::IdentitySeq(identities.begin(), identities.end()));
+ //
+ Ice::StringSeq adapterIdSeq;
+ for(multiset<string>::iterator p = adapterIds.begin(); p != adapterIds.end(); ++p)
+ {
+ adapterIdSeq.push_back(*p);
+ }
+ Ice::IdentitySeq identitySeq;
+ for(multiset<Ice::Identity>::iterator q = identities.begin(); q != identities.end(); ++q)
+ {
+ identitySeq.push_back(*q);
+ }
+ ctl->adapterIds()->remove(adapterIdSeq);
+ ctl->identities()->remove(identitySeq);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ if(traceLevels && traceLevels->server > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
+ out << "couldn't remove Glacier2 filters for server `" << _id << "' allocated by `";
+ out << session->getId() << ":\n" << ex;
+ }
+ }
}
if(traceLevels && traceLevels->server > 1)
{
- Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
- out << "server `" << _id << "' released by `" << session->getId() << "' (" << _count << ")";
+ Ice::Trace out(traceLevels->logger, traceLevels->serverCat);
+ out << "server `" << _id << "' released by `" << session->getId() << "' (" << _count << ")";
}
}
@@ -970,13 +970,13 @@ void
ServerEntry::releasedNoSync(const SessionIPtr& session)
{
{
- Lock sync(*this);
- if(!_updated ||
- _loaded.get() && _loaded->descriptor->activation != "session" ||
- _load.get() && _load->descriptor->activation != "session")
- {
- return;
- }
+ Lock sync(*this);
+ if(!_updated ||
+ _loaded.get() && _loaded->descriptor->activation != "session" ||
+ _load.get() && _load->descriptor->activation != "session")
+ {
+ return;
+ }
}
sync();
diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp
index 2d25e742b74..4142e53fe91 100644
--- a/cpp/src/IceGrid/ServerI.cpp
+++ b/cpp/src/IceGrid/ServerI.cpp
@@ -50,7 +50,7 @@ chownRecursive(const string& path, uid_t uid, gid_t gid)
DIR* d;
if((d = opendir(path.c_str())) == 0)
{
- throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
+ throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
}
struct dirent* entry;
@@ -60,16 +60,16 @@ chownRecursive(const string& path, uid_t uid, gid_t gid)
namelist = (struct dirent**)realloc((void*)namelist, (size_t)((n + 1) * sizeof(struct dirent*)));
if(namelist == 0)
{
- closedir(d);
- throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
+ closedir(d);
+ throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
}
size_t entrysize = sizeof(struct dirent) - sizeof(entry->d_name) + strlen(entry->d_name) + 1;
namelist[n] = (struct dirent*)malloc(entrysize);
if(namelist[n] == 0)
{
- closedir(d);
- throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
+ closedir(d);
+ throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
}
memcpy(namelist[n], entry, entrysize);
++n;
@@ -77,34 +77,34 @@ chownRecursive(const string& path, uid_t uid, gid_t gid)
if(closedir(d))
{
- throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
+ throw "cannot read directory `" + path + "':\n" + IcePatch2::lastError();
}
for(int i = 0; i < n; ++i)
{
- string name = namelist[i]->d_name;
- assert(!name.empty());
- free(namelist[i]);
-
- if(name != ".." && name != ".")
- {
- name = path + "/" + name;
- if(chown(name.c_str(), uid, gid) != 0)
- {
- throw "can't change permissions on `" + name + "':\n" + IcePatch2::lastError();
- }
-
- OS::structstat buf;
- if(OS::osstat(name, &buf) == -1)
- {
- throw "cannot stat `" + name + "':\n" + IcePatch2::lastError();
- }
-
- if(S_ISDIR(buf.st_mode))
- {
- chownRecursive(name, uid, gid);
- }
- }
+ string name = namelist[i]->d_name;
+ assert(!name.empty());
+ free(namelist[i]);
+
+ if(name != ".." && name != ".")
+ {
+ name = path + "/" + name;
+ if(chown(name.c_str(), uid, gid) != 0)
+ {
+ throw "can't change permissions on `" + name + "':\n" + IcePatch2::lastError();
+ }
+
+ OS::structstat buf;
+ if(OS::osstat(name, &buf) == -1)
+ {
+ throw "cannot stat `" + name + "':\n" + IcePatch2::lastError();
+ }
+
+ if(S_ISDIR(buf.st_mode))
+ {
+ chownRecursive(name, uid, gid);
+ }
+ }
}
free(namelist);
@@ -132,57 +132,57 @@ descriptorWithoutRevisionEqual(const InternalServerDescriptorPtr& lhs, const Int
lhs->envs != rhs->envs ||
lhs->logs != rhs->logs)
{
- return false;
+ return false;
}
if(!lhs->distrib && rhs->distrib || lhs->distrib && !rhs->distrib)
{
- return false;
+ return false;
}
else if(lhs->distrib && rhs->distrib)
{
- if(lhs->distrib->icepatch != rhs->distrib->icepatch ||
- lhs->distrib->directories != rhs->distrib->directories)
- {
- return false;
- }
+ if(lhs->distrib->icepatch != rhs->distrib->icepatch ||
+ lhs->distrib->directories != rhs->distrib->directories)
+ {
+ return false;
+ }
}
if(lhs->adapters.size() != rhs->adapters.size())
{
- return false;
+ return false;
}
else
{
- InternalAdapterDescriptorSeq::const_iterator q = rhs->adapters.begin();
- for(InternalAdapterDescriptorSeq::const_iterator p = lhs->adapters.begin(); p != lhs->adapters.end(); ++p, ++q)
- {
- if((*p)->id != (*q)->id || (*p)->serverLifetime != (*q)->serverLifetime)
- {
- return false;
- }
- }
+ InternalAdapterDescriptorSeq::const_iterator q = rhs->adapters.begin();
+ for(InternalAdapterDescriptorSeq::const_iterator p = lhs->adapters.begin(); p != lhs->adapters.end(); ++p, ++q)
+ {
+ if((*p)->id != (*q)->id || (*p)->serverLifetime != (*q)->serverLifetime)
+ {
+ return false;
+ }
+ }
}
if(lhs->dbEnvs.size() != rhs->dbEnvs.size())
{
- return false;
+ return false;
}
else
{
- InternalDbEnvDescriptorSeq::const_iterator q = rhs->dbEnvs.begin();
- for(InternalDbEnvDescriptorSeq::const_iterator p = lhs->dbEnvs.begin(); p != lhs->dbEnvs.end(); ++p, ++q)
- {
- if((*p)->name != (*q)->name || (*p)->properties != (*q)->properties)
- {
- return false;
- }
- }
+ InternalDbEnvDescriptorSeq::const_iterator q = rhs->dbEnvs.begin();
+ for(InternalDbEnvDescriptorSeq::const_iterator p = lhs->dbEnvs.begin(); p != lhs->dbEnvs.end(); ++p, ++q)
+ {
+ if((*p)->name != (*q)->name || (*p)->properties != (*q)->properties)
+ {
+ return false;
+ }
+ }
}
if(lhs->properties != rhs->properties)
{
- return false;
+ return false;
}
return true;
@@ -193,13 +193,13 @@ class CommandTimeoutItem : public WaitItem
public:
CommandTimeoutItem(const TimedServerCommandPtr& command) :
- WaitItem(), _command(command)
+ WaitItem(), _command(command)
{
}
virtual void expired(bool destroyed)
{
- _command->timeout(destroyed);
+ _command->timeout(destroyed);
}
private:
@@ -212,30 +212,30 @@ class DelayedStart : public WaitItem
public:
DelayedStart(const ServerIPtr& server, const TraceLevelsPtr& traceLevels) :
- _server(server),
- _traceLevels(traceLevels)
+ _server(server),
+ _traceLevels(traceLevels)
{
}
virtual void expired(bool destroyed)
{
- if(!destroyed)
- {
- try
- {
- _server->start(ServerI::Always);
- }
- catch(const ServerStartException& ex)
- {
- Ice::Error out(_traceLevels->logger);
- out << "couldn't reactivate server `" << _server->getId()
- << "' with `always' activation mode after failure:\n"
- << ex.reason;
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- }
+ if(!destroyed)
+ {
+ try
+ {
+ _server->start(ServerI::Always);
+ }
+ catch(const ServerStartException& ex)
+ {
+ Ice::Error out(_traceLevels->logger);
+ out << "couldn't reactivate server `" << _server->getId()
+ << "' with `always' activation mode after failure:\n"
+ << ex.reason;
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ }
}
private:
@@ -255,13 +255,13 @@ public:
virtual void
ice_response()
{
- _server->activate();
+ _server->activate();
}
virtual void
ice_exception(const Ice::Exception&)
{
- _server->activate();
+ _server->activate();
}
private:
@@ -274,62 +274,62 @@ struct EnvironmentEval : std::unary_function<string, string>
string
operator()(const std::string& value)
{
- string::size_type assignment = value.find("=");
- if(assignment == string::npos || assignment >= value.size() - 1)
- {
- return value;
- }
+ string::size_type assignment = value.find("=");
+ if(assignment == string::npos || assignment >= value.size() - 1)
+ {
+ return value;
+ }
- string v = value.substr(assignment + 1);
- assert(v.size());
- string::size_type beg = 0;
- string::size_type end;
+ string v = value.substr(assignment + 1);
+ assert(v.size());
+ string::size_type beg = 0;
+ string::size_type end;
#ifdef _WIN32
- char buf[32767];
- while((beg = v.find("%", beg)) != string::npos && beg < v.size() - 1)
- {
- end = v.find("%", beg + 1);
- if(end == string::npos)
- {
- break;
- }
- string variable = v.substr(beg + 1, end - beg - 1);
- int ret = GetEnvironmentVariable(variable.c_str(), buf, sizeof(buf));
- string valstr = (ret > 0 && ret < sizeof(buf)) ? string(buf) : string("");
- v.replace(beg, end - beg + 1, valstr);
- beg += valstr.size();
- }
+ char buf[32767];
+ while((beg = v.find("%", beg)) != string::npos && beg < v.size() - 1)
+ {
+ end = v.find("%", beg + 1);
+ if(end == string::npos)
+ {
+ break;
+ }
+ string variable = v.substr(beg + 1, end - beg - 1);
+ int ret = GetEnvironmentVariable(variable.c_str(), buf, sizeof(buf));
+ string valstr = (ret > 0 && ret < sizeof(buf)) ? string(buf) : string("");
+ v.replace(beg, end - beg + 1, valstr);
+ beg += valstr.size();
+ }
#else
- while((beg = v.find("$", beg)) != string::npos && beg < v.size() - 1)
- {
- string variable;
- if(v[beg + 1] == '{')
- {
- end = v.find("}");
- if(end == string::npos)
- {
- break;
- }
- variable = v.substr(beg + 2, end - beg - 2);
- }
- else
- {
- end = beg + 1;
- while((isalnum(v[end]) || v[end] == '_') && end < v.size())
- {
- ++end;
- }
- variable = v.substr(beg + 1, end - beg - 1);
- --end;
- }
-
- char* val = getenv(variable.c_str());
- string valstr = val ? string(val) : "";
- v.replace(beg, end - beg + 1, valstr);
- beg += valstr.size();
- }
+ while((beg = v.find("$", beg)) != string::npos && beg < v.size() - 1)
+ {
+ string variable;
+ if(v[beg + 1] == '{')
+ {
+ end = v.find("}");
+ if(end == string::npos)
+ {
+ break;
+ }
+ variable = v.substr(beg + 2, end - beg - 2);
+ }
+ else
+ {
+ end = beg + 1;
+ while((isalnum(v[end]) || v[end] == '_') && end < v.size())
+ {
+ ++end;
+ }
+ variable = v.substr(beg + 1, end - beg - 1);
+ --end;
+ }
+
+ char* val = getenv(variable.c_str());
+ string valstr = val ? string(val) : "";
+ v.replace(beg, end - beg + 1, valstr);
+ beg += valstr.size();
+ }
#endif
- return value.substr(0, assignment) + "=" + v;
+ return value.substr(0, assignment) + "=" + v;
}
};
@@ -360,8 +360,8 @@ TimedServerCommand::stopTimer()
{
if(_timer)
{
- _waitQueue->remove(_timer);
- _timer = 0;
+ _waitQueue->remove(_timer);
+ _timer = 0;
}
}
@@ -419,7 +419,7 @@ LoadCommand::failed(const Ice::Exception& ex)
for(vector<AMD_Node_loadServerPtr>::const_iterator p = _loadCB.begin(); p != _loadCB.end(); ++p)
{
(*p)->ice_exception(ex);
- }
+ }
}
void
@@ -571,7 +571,7 @@ StartCommand::failed(const string& reason)
for(vector<AMD_Server_startPtr>::const_iterator p = _startCB.begin(); p != _startCB.end(); ++p)
{
(*p)->ice_exception(ex);
- }
+ }
_startCB.clear();
}
@@ -636,7 +636,7 @@ StopCommand::failed(const string& reason)
for(vector<AMD_Server_stopPtr>::const_iterator p = _stopCB.begin(); p != _stopCB.end(); ++p)
{
(*p)->ice_exception(ex);
- }
+ }
_stopCB.clear();
}
@@ -665,7 +665,7 @@ ServerI::ServerI(const NodeIPtr& node, const ServerPrx& proxy, const string& ser
{
assert(_node->getActivator());
const_cast<int&>(_disableOnFailure) =
- _node->getCommunicator()->getProperties()->getPropertyAsIntWithDefault("IceGrid.Node.DisableOnFailure", 0);
+ _node->getCommunicator()->getProperties()->getPropertyAsIntWithDefault("IceGrid.Node.DisableOnFailure", 0);
}
ServerI::~ServerI()
@@ -683,31 +683,31 @@ ServerI::stop_async(const AMD_Server_stopPtr& amdCB, const Ice::Current&)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- checkDestroyed();
-
- if(StopCommand::isStopped(_state))
- {
- throw ServerStopException(_id, "The server is already inactive.");
- }
- else if(_state == Destroying)
- {
- throw ServerStopException(_id, "The server is being destroyed.");
- }
-
- if(!_stop)
- {
- _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
- }
- if(amdCB)
- {
- _stop->addCallback(amdCB);
- }
- command = nextCommand();
+ Lock sync(*this);
+ checkDestroyed();
+
+ if(StopCommand::isStopped(_state))
+ {
+ throw ServerStopException(_id, "The server is already inactive.");
+ }
+ else if(_state == Destroying)
+ {
+ throw ServerStopException(_id, "The server is being destroyed.");
+ }
+
+ if(!_stop)
+ {
+ _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
+ }
+ if(amdCB)
+ {
+ _stop->addCallback(amdCB);
+ }
+ command = nextCommand();
}
if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -724,13 +724,13 @@ ServerI::writeMessage(const string& message, Ice::Int fd, const Ice::Current& cu
checkDestroyed();
if(_process != 0)
{
- try
- {
- _process->writeMessage(message, fd);
- }
- catch(const Ice::LocalException&)
- {
- }
+ try
+ {
+ _process->writeMessage(message, fd);
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
}
}
@@ -753,49 +753,49 @@ ServerI::setEnabled(bool enabled, const ::Ice::Current&)
{
bool activate = false;
{
- Lock sync(*this);
- checkDestroyed();
- assert(_desc);
-
- if(enabled && _activation == Disabled)
- {
- _failureTime = IceUtil::Time();
- _activation = toServerActivation(_desc->activation);
- activate = _state == Inactive && _activation == Always;
- }
- else if(!enabled && (_activation != Disabled || _failureTime != IceUtil::Time()))
- {
- _failureTime = IceUtil::Time();
- _activation = Disabled;
- if(_timer)
- {
- _node->getWaitQueue()->remove(_timer);
- _timer = 0;
- }
- }
- else
- {
- return; // Nothing to change!
- }
-
- _node->observerUpdateServer(getDynamicInfo());
+ Lock sync(*this);
+ checkDestroyed();
+ assert(_desc);
+
+ if(enabled && _activation == Disabled)
+ {
+ _failureTime = IceUtil::Time();
+ _activation = toServerActivation(_desc->activation);
+ activate = _state == Inactive && _activation == Always;
+ }
+ else if(!enabled && (_activation != Disabled || _failureTime != IceUtil::Time()))
+ {
+ _failureTime = IceUtil::Time();
+ _activation = Disabled;
+ if(_timer)
+ {
+ _node->getWaitQueue()->remove(_timer);
+ _timer = 0;
+ }
+ }
+ else
+ {
+ return; // Nothing to change!
+ }
+
+ _node->observerUpdateServer(getDynamicInfo());
}
if(activate)
{
- try
- {
- start(Always);
- }
- catch(const ServerStartException& ex)
- {
- Ice::Error out(_node->getTraceLevels()->logger);
- out << "couldn't reactivate server `" << _id << "' with `always' activation mode:\n"
- << ex.reason;
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
+ try
+ {
+ start(Always);
+ }
+ catch(const ServerStartException& ex)
+ {
+ Ice::Error out(_node->getTraceLevels()->logger);
+ out << "couldn't reactivate server `" << _id << "' with `always' activation mode:\n"
+ << ex.reason;
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
}
}
@@ -812,15 +812,15 @@ ServerI::setProcess_async(const AMD_Server_setProcessPtr& amdCB, const Ice::Proc
{
bool deact = false;
{
- Lock sync(*this);
- checkDestroyed();
- _process = process;
- deact = _state == DeactivatingWaitForProcess;
+ Lock sync(*this);
+ checkDestroyed();
+ _process = process;
+ deact = _state == DeactivatingWaitForProcess;
}
amdCB->ice_response();
if(deact)
{
- deactivate();
+ deactivate();
}
}
@@ -832,7 +832,7 @@ ServerI::getOffsetFromEnd(const string& filename, int count, const Ice::Current&
bool
ServerI::read(const string& filename, Ice::Long pos, int size, Ice::Long& newPos, Ice::StringSeq& lines,
- const Ice::Current&) const
+ const Ice::Current&) const
{
return _node->getFileCache()->read(getFilePath(filename), pos, size, newPos, lines);
}
@@ -843,34 +843,34 @@ ServerI::isAdapterActivatable(const string& id) const
Lock sync(*this);
if(!_desc || _activation == Disabled)
{
- return false;
+ return false;
}
if(_desc->activation == "manual" ||
_desc->activation == "session" && _desc->sessionId.empty())
{
- return false;
+ return false;
}
if(_state <= WaitForActivation)
{
- if(_activatedAdapters.find(id) != _activatedAdapters.end())
- {
- return false; // The adapter was already activated once.
- }
- return true;
+ if(_activatedAdapters.find(id) != _activatedAdapters.end())
+ {
+ return false; // The adapter was already activated once.
+ }
+ return true;
}
else if(_state < Deactivating)
{
- return false; // The server is active or its activation timed out.
+ return false; // The server is active or its activation timed out.
}
else if(_state < Destroying)
{
- return true; // The server is being deactivated.
+ return true; // The server is being deactivated.
}
else
{
- return false;
+ return false;
}
}
@@ -892,84 +892,84 @@ ServerI::start(ServerActivation activation, const AMD_Server_startPtr& amdCB)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- checkDestroyed();
-
- //
- // Eventually re-enable the server if it's disabled because of a failure.
- //
- if(_disableOnFailure > 0 && _failureTime != IceUtil::Time())
- {
- if(activation == Manual ||
- (_failureTime + IceUtil::Time::seconds(_disableOnFailure) < IceUtil::Time::now()))
- {
- _activation = _previousActivation;
- _failureTime = IceUtil::Time();
- }
- }
-
- //
- // Check the current activation mode and the requested activation.
- //
- if(_activation == Disabled)
- {
- throw ServerStartException(_id, "The server is disabled.");
- }
- else if(_activation != Always && activation == Always)
- {
- assert(!amdCB);
- return; // Nothing to do.
- }
- else if(_activation == Manual && activation != Manual)
- {
- throw ServerStartException(_id, "The server activation doesn't allow this activation mode.");
- }
- else if(_activation == Session && _desc->sessionId.empty())
- {
- throw ServerStartException(_id, "The server is not owned by a session.");
- }
-
- //
- // Check the current state.
- //
- if(_state == ActivationTimeout)
- {
- throw ServerStartException(_id, "The server activation timed out.");
- }
- else if(_state == Active)
- {
- if(activation == Always)
- {
- return; // Nothing to do, it's already active (and we
- // don't want to throw because it would be
- // considered as an error.)
- }
- throw ServerStartException(_id, "The server is already active.");
- }
- else if(_state == Destroying)
- {
- throw ServerStartException(_id, "The server is being destroyed.");
- }
-
- if(_timer)
- {
- _node->getWaitQueue()->remove(_timer);
- _timer = 0;
- }
-
- if(!_start)
- {
- _start = new StartCommand(this, _node->getWaitQueue(), _activationTimeout);
- }
- if(amdCB)
- {
- _start->addCallback(amdCB);
- }
- command = nextCommand();
+ Lock sync(*this);
+ checkDestroyed();
+
+ //
+ // Eventually re-enable the server if it's disabled because of a failure.
+ //
+ if(_disableOnFailure > 0 && _failureTime != IceUtil::Time())
+ {
+ if(activation == Manual ||
+ (_failureTime + IceUtil::Time::seconds(_disableOnFailure) < IceUtil::Time::now()))
+ {
+ _activation = _previousActivation;
+ _failureTime = IceUtil::Time();
+ }
+ }
+
+ //
+ // Check the current activation mode and the requested activation.
+ //
+ if(_activation == Disabled)
+ {
+ throw ServerStartException(_id, "The server is disabled.");
+ }
+ else if(_activation != Always && activation == Always)
+ {
+ assert(!amdCB);
+ return; // Nothing to do.
+ }
+ else if(_activation == Manual && activation != Manual)
+ {
+ throw ServerStartException(_id, "The server activation doesn't allow this activation mode.");
+ }
+ else if(_activation == Session && _desc->sessionId.empty())
+ {
+ throw ServerStartException(_id, "The server is not owned by a session.");
+ }
+
+ //
+ // Check the current state.
+ //
+ if(_state == ActivationTimeout)
+ {
+ throw ServerStartException(_id, "The server activation timed out.");
+ }
+ else if(_state == Active)
+ {
+ if(activation == Always)
+ {
+ return; // Nothing to do, it's already active (and we
+ // don't want to throw because it would be
+ // considered as an error.)
+ }
+ throw ServerStartException(_id, "The server is already active.");
+ }
+ else if(_state == Destroying)
+ {
+ throw ServerStartException(_id, "The server is being destroyed.");
+ }
+
+ if(_timer)
+ {
+ _node->getWaitQueue()->remove(_timer);
+ _timer = 0;
+ }
+
+ if(!_start)
+ {
+ _start = new StartCommand(this, _node->getWaitQueue(), _activationTimeout);
+ }
+ if(amdCB)
+ {
+ _start->addCallback(amdCB);
+ }
+ command = nextCommand();
}
if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -994,40 +994,40 @@ ServerI::load(const AMD_Node_loadServerPtr& amdCB, const InternalServerDescripto
(replicaName != "Master" || _desc->sessionId == desc->sessionId) &&
(_desc->uuid == desc->uuid && _desc->revision == desc->revision || descriptorWithoutRevisionEqual(_desc, desc)))
{
- if(_desc->revision != desc->revision)
- {
- updateRevision(desc->uuid, desc->revision);
- }
-
- if(amdCB)
- {
- AdapterPrxDict adapters;
- for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
- {
- adapters.insert(make_pair(p->first, p->second->getProxy()));
- }
- amdCB->ice_response(_this, adapters, _activationTimeout, _deactivationTimeout);
- }
- return 0;
+ if(_desc->revision != desc->revision)
+ {
+ updateRevision(desc->uuid, desc->revision);
+ }
+
+ if(amdCB)
+ {
+ AdapterPrxDict adapters;
+ for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
+ {
+ adapters.insert(make_pair(p->first, p->second->getProxy()));
+ }
+ amdCB->ice_response(_this, adapters, _activationTimeout, _deactivationTimeout);
+ }
+ return 0;
}
if(!StopCommand::isStopped(_state) && !_stop)
{
- _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
+ _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
}
if(!_load)
{
- _load = new LoadCommand(this);
+ _load = new LoadCommand(this);
}
_load->setUpdate(desc, _destroy);
if(_destroy && _state != Destroying)
{
- _destroy->finished();
- _destroy = 0;
+ _destroy->finished();
+ _destroy = 0;
}
if(amdCB)
{
- _load->addCallback(amdCB);
+ _load->addCallback(amdCB);
}
return nextCommand();
}
@@ -1041,21 +1041,21 @@ ServerI::destroy(const AMD_Node_destroyServerPtr& amdCB, const string& uuid, int
if(!_desc)
{
- amdCB->ice_response();
- return 0; // Server is already destroyed.
+ amdCB->ice_response();
+ return 0; // Server is already destroyed.
}
if(!StopCommand::isStopped(_state) && !_stop)
{
- _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
+ _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
}
if(!_destroy)
{
- _destroy = new DestroyCommand(this);
+ _destroy = new DestroyCommand(this);
}
if(amdCB)
{
- _destroy->addCallback(amdCB);
+ _destroy->addCallback(amdCB);
}
return nextCommand();
}
@@ -1065,28 +1065,28 @@ ServerI::startPatch(bool shutdown)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- checkDestroyed();
- if(!StopCommand::isStopped(_state))
- {
- if(!shutdown)
- {
- return false;
- }
- else if(!_stop)
- {
- _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
- }
- }
- if(!_patch)
- {
- _patch = new PatchCommand(this);
- }
- command = nextCommand();
+ Lock sync(*this);
+ checkDestroyed();
+ if(!StopCommand::isStopped(_state))
+ {
+ if(!shutdown)
+ {
+ return false;
+ }
+ else if(!_stop)
+ {
+ _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout);
+ }
+ }
+ if(!_patch)
+ {
+ _patch = new PatchCommand(this);
+ }
+ command = nextCommand();
}
if(command)
{
- command->execute();
+ command->execute();
}
return true;
}
@@ -1096,12 +1096,12 @@ ServerI::waitForPatch()
{
PatchCommandPtr patch;
{
- Lock sync(*this);
- if(!_patch)
- {
- return true;
- }
- patch = _patch;
+ Lock sync(*this);
+ if(!_patch)
+ {
+ return true;
+ }
+ patch = _patch;
}
return patch->waitForPatch();
}
@@ -1111,16 +1111,16 @@ ServerI::finishPatch()
{
#ifndef _WIN32
{
- Lock sync(*this);
- try
- {
- chownRecursive(_serverDir + "/distrib", _uid, _gid);
- }
- catch(const string& msg)
- {
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << msg;
- }
+ Lock sync(*this);
+ try
+ {
+ chownRecursive(_serverDir + "/distrib", _uid, _gid);
+ }
+ catch(const string& msg)
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << msg;
+ }
}
#endif
setState(Inactive);
@@ -1131,20 +1131,20 @@ ServerI::adapterActivated(const string& id)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- if(_state != ServerI::Activating &&
- _state != ServerI::WaitForActivation &&
- _state != ServerI::ActivationTimeout)
- {
- return;
- }
- _activatedAdapters.insert(id);
- checkActivation();
- command = nextCommand();
+ Lock sync(*this);
+ if(_state != ServerI::Activating &&
+ _state != ServerI::WaitForActivation &&
+ _state != ServerI::ActivationTimeout)
+ {
+ return;
+ }
+ _activatedAdapters.insert(id);
+ checkActivation();
+ command = nextCommand();
}
if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -1153,16 +1153,16 @@ ServerI::adapterDeactivated(const string& id)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- if(_state == Active && _serverLifetimeAdapters.find(id) != _serverLifetimeAdapters.end())
- {
- setStateNoSync(Deactivating);
- }
- command = nextCommand();
+ Lock sync(*this);
+ if(_state == Active && _serverLifetimeAdapters.find(id) != _serverLifetimeAdapters.end())
+ {
+ setStateNoSync(Deactivating);
+ }
+ command = nextCommand();
}
if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -1171,9 +1171,9 @@ ServerI::checkDestroyed() const
{
if(_state == Destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = _this->ice_getIdentity();
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = _this->ice_getIdentity();
+ throw ex;
}
}
@@ -1185,7 +1185,7 @@ ServerI::disableOnFailure()
//
if(_activation == Disabled)
{
- return;
+ return;
}
//
@@ -1195,9 +1195,9 @@ ServerI::disableOnFailure()
//
if(_disableOnFailure != 0 || _activation == Always && (_state == Activating || _state == WaitForActivation))
{
- _previousActivation = _activation;
- _activation = Disabled;
- _failureTime = IceUtil::Time::now();
+ _previousActivation = _activation;
+ _activation = Disabled;
+ _failureTime = IceUtil::Time::now();
}
}
@@ -1206,20 +1206,20 @@ ServerI::enableAfterFailure(bool force)
{
if(_disableOnFailure == 0 || _failureTime == IceUtil::Time())
{
- return;
+ return;
}
if(force ||
_disableOnFailure > 0 && (_failureTime + IceUtil::Time::seconds(_disableOnFailure) < IceUtil::Time::now()))
{
- _activation = _previousActivation;
- _failureTime = IceUtil::Time();
+ _activation = _previousActivation;
+ _failureTime = IceUtil::Time();
}
if(_timer)
{
- _node->getWaitQueue()->remove(_timer);
- _timer = 0;
+ _node->getWaitQueue()->remove(_timer);
+ _timer = 0;
}
}
@@ -1229,51 +1229,51 @@ ServerI::activationFailed(bool destroyed)
ServerCommandPtr command;
ServerAdapterDict adapters;
{
- Lock sync(*this);
- if(_state != ServerI::WaitForActivation)
- {
- return;
- }
-
- if(!destroyed)
- {
- setStateNoSync(ServerI::ActivationTimeout, "The server activation timed out.");
- }
- else
- {
- setStateNoSync(ServerI::ActivationTimeout, "The node is being shutdown.");
- }
-
- if(_node->getTraceLevels()->server > 1)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- if(!destroyed)
- {
- out << "server `" << _id << "' activation timed out";
- }
- else
- {
- out << "server `" << _id << "' activation failed";
- }
- }
- adapters = _adapters;
- command = nextCommand();
+ Lock sync(*this);
+ if(_state != ServerI::WaitForActivation)
+ {
+ return;
+ }
+
+ if(!destroyed)
+ {
+ setStateNoSync(ServerI::ActivationTimeout, "The server activation timed out.");
+ }
+ else
+ {
+ setStateNoSync(ServerI::ActivationTimeout, "The node is being shutdown.");
+ }
+
+ if(_node->getTraceLevels()->server > 1)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ if(!destroyed)
+ {
+ out << "server `" << _id << "' activation timed out";
+ }
+ else
+ {
+ out << "server `" << _id << "' activation failed";
+ }
+ }
+ adapters = _adapters;
+ command = nextCommand();
}
for(ServerAdapterDict::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- try
- {
- p->second->activationFailed(destroyed ? "server destroyed" : "server activation timed out");
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
+ try
+ {
+ p->second->activationFailed(destroyed ? "server destroyed" : "server activation timed out");
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
}
if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -1289,25 +1289,25 @@ ServerI::activate()
gid_t gid;
#endif
{
- Lock sync(*this);
- assert(_state == Activating && _desc);
- desc = _desc;
- adpts = _adapters;
-
- //
- // The first time the server is started, we ensure that the
- // replication of its descriptor is completed. This is to make
- // sure all the replicas are up to date when the server
- // starts for the first time with a given descriptor.
- //
- waitForReplication = _waitForReplication;
- _waitForReplication = false;
-
- _process = 0;
-
+ Lock sync(*this);
+ assert(_state == Activating && _desc);
+ desc = _desc;
+ adpts = _adapters;
+
+ //
+ // The first time the server is started, we ensure that the
+ // replication of its descriptor is completed. This is to make
+ // sure all the replicas are up to date when the server
+ // starts for the first time with a given descriptor.
+ //
+ waitForReplication = _waitForReplication;
+ _waitForReplication = false;
+
+ _process = 0;
+
#ifndef _WIN32
- uid = _uid;
- gid = _gid;
+ uid = _uid;
+ gid = _gid;
#endif
}
@@ -1318,13 +1318,13 @@ ServerI::activate()
//
if(waitForReplication)
{
- NodeSessionPrx session = _node->getMasterNodeSession();
- if(session)
- {
- AMI_NodeSession_waitForApplicationUpdatePtr cb = new WaitForApplicationUpdateCB(this);
- _node->getMasterNodeSession()->waitForApplicationUpdate_async(cb, desc->uuid, desc->revision);
- return;
- }
+ NodeSessionPrx session = _node->getMasterNodeSession();
+ if(session)
+ {
+ AMI_NodeSession_waitForApplicationUpdatePtr cb = new WaitForApplicationUpdateCB(this);
+ _node->getMasterNodeSession()->waitForApplicationUpdate_async(cb, desc->uuid, desc->revision);
+ return;
+ }
}
//
@@ -1343,69 +1343,69 @@ ServerI::activate()
//
for(ServerAdapterDict::iterator p = adpts.begin(); p != adpts.end(); ++p)
{
- try
- {
- p->second->clear();
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
+ try
+ {
+ p->second->clear();
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
}
string failure;
try
{
#ifndef _WIN32
- int pid = _node->getActivator()->activate(desc->id, desc->exe, desc->pwd, uid, gid, options, envs, this);
+ int pid = _node->getActivator()->activate(desc->id, desc->exe, desc->pwd, uid, gid, options, envs, this);
#else
- int pid = _node->getActivator()->activate(desc->id, desc->exe, desc->pwd, options, envs, this);
+ int pid = _node->getActivator()->activate(desc->id, desc->exe, desc->pwd, options, envs, this);
#endif
- ServerCommandPtr command;
- {
- Lock sync(*this);
- assert(_state == Activating);
- _pid = pid;
- setStateNoSync(ServerI::WaitForActivation);
- checkActivation();
- command = nextCommand();
- notifyAll(); // Terminated might be waiting for the state change.
- }
- if(command)
- {
- command->execute();
- }
- return;
+ ServerCommandPtr command;
+ {
+ Lock sync(*this);
+ assert(_state == Activating);
+ _pid = pid;
+ setStateNoSync(ServerI::WaitForActivation);
+ checkActivation();
+ command = nextCommand();
+ notifyAll(); // Terminated might be waiting for the state change.
+ }
+ if(command)
+ {
+ command->execute();
+ }
+ return;
}
catch(const std::string& ex)
{
- failure = ex;
+ failure = ex;
}
catch(const Ice::SyscallException& ex)
{
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "activation failed for server `" << _id << "':\n";
- out << ex;
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "activation failed for server `" << _id << "':\n";
+ out << ex;
- ostringstream os;
- os << ex;
- failure = os.str();
+ ostringstream os;
+ os << ex;
+ failure = os.str();
}
{
- Lock sync(*this);
- disableOnFailure();
- setStateNoSync(ServerI::Deactivating, failure);
+ Lock sync(*this);
+ disableOnFailure();
+ setStateNoSync(ServerI::Deactivating, failure);
}
for(ServerAdapterDict::iterator r = adpts.begin(); r != adpts.end(); ++r)
{
- try
- {
- r->second->activationFailed(failure);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
+ try
+ {
+ r->second->activationFailed(failure);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
}
setState(ServerI::Inactive);
@@ -1415,23 +1415,23 @@ void
ServerI::kill()
{
{
- Lock sync(*this);
- if(_state != Destroying && _state != Deactivating && _state != DeactivatingWaitForProcess)
- {
- return;
- }
+ Lock sync(*this);
+ if(_state != Destroying && _state != Deactivating && _state != DeactivatingWaitForProcess)
+ {
+ return;
+ }
}
try
{
- _node->getActivator()->kill(_id);
+ _node->getActivator()->kill(_id);
}
catch(const Ice::SyscallException& ex)
{
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "deactivation failed for server `" << _id << "':\n";
- out << ex;
- setState(ServerI::Inactive); // TODO: Is this really correct?
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "deactivation failed for server `" << _id << "':\n";
+ out << ex;
+ setState(ServerI::Inactive); // TODO: Is this really correct?
}
}
@@ -1440,55 +1440,55 @@ ServerI::deactivate()
{
Ice::ProcessPrx process;
{
- Lock sync(*this);
- assert(_desc);
- if(_state != Deactivating && _state != DeactivatingWaitForProcess)
- {
- return;
- }
-
- //
- // If a process object is supposed to be registered and it's
- // not set yet, we wait for the server to set this process
- // object before attempting to deactivate the server again.
- //
- if(_desc->processRegistered && !_process)
- {
- setStateNoSync(ServerI::DeactivatingWaitForProcess);
- return;
- }
- process = _process;
+ Lock sync(*this);
+ assert(_desc);
+ if(_state != Deactivating && _state != DeactivatingWaitForProcess)
+ {
+ return;
+ }
+
+ //
+ // If a process object is supposed to be registered and it's
+ // not set yet, we wait for the server to set this process
+ // object before attempting to deactivate the server again.
+ //
+ if(_desc->processRegistered && !_process)
+ {
+ setStateNoSync(ServerI::DeactivatingWaitForProcess);
+ return;
+ }
+ process = _process;
}
try
{
- //
- // Deactivate the server and for the termination of the server.
- //
- _node->getActivator()->deactivate(_id, process);
- return;
+ //
+ // Deactivate the server and for the termination of the server.
+ //
+ _node->getActivator()->deactivate(_id, process);
+ return;
}
catch(const Ice::Exception& ex)
{
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "graceful server shutdown failed, killing server `" << _id << "':\n";
- out << ex;
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "graceful server shutdown failed, killing server `" << _id << "':\n";
+ out << ex;
}
try
{
- //
- // If we couldn't deactivate it we kill it.
- //
- _node->getActivator()->kill(_id);
- return;
+ //
+ // If we couldn't deactivate it we kill it.
+ //
+ _node->getActivator()->kill(_id);
+ return;
}
catch(const Ice::SyscallException& ex)
{
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "deactivation failed for server `" << _id << "':\n";
- out << ex;
- setState(ServerI::Inactive); // TODO: Is this really correct?
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "deactivation failed for server `" << _id << "':\n";
+ out << ex;
+ setState(ServerI::Inactive); // TODO: Is this really correct?
}
}
@@ -1497,25 +1497,25 @@ ServerI::destroy()
{
ServerAdapterDict adpts;
{
- Lock sync(*this);
- assert(_desc);
- assert(_state == Destroying);
- adpts = _adapters;
+ Lock sync(*this);
+ assert(_desc);
+ assert(_state == Destroying);
+ adpts = _adapters;
}
_node->removeServer(this, _desc->application, _desc->applicationDistrib);
try
{
- IcePatch2::removeRecursive(_serverDir);
+ IcePatch2::removeRecursive(_serverDir);
}
catch(const string& msg)
{
- if(!_destroy->loadFailure())
- {
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "removing server directory `" << _serverDir << "' failed: " << msg;
- }
+ if(!_destroy->loadFailure())
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "removing server directory `" << _serverDir << "' failed: " << msg;
+ }
}
//
@@ -1523,13 +1523,13 @@ ServerI::destroy()
//
for(ServerAdapterDict::const_iterator p = adpts.begin(); p != adpts.end(); ++p)
{
- try
- {
- p->second->destroy();
- }
- catch(const Ice::LocalException&)
- {
- }
+ try
+ {
+ p->second->destroy();
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
}
setState(Destroyed);
@@ -1540,53 +1540,53 @@ ServerI::terminated(const string& msg, int status)
{
ServerAdapterDict adpts;
{
- Lock sync(*this);
- while(_state == ServerI::Activating)
- {
- wait(); // Wait for activate() to set the state to WaitForActivation
- }
+ Lock sync(*this);
+ while(_state == ServerI::Activating)
+ {
+ wait(); // Wait for activate() to set the state to WaitForActivation
+ }
- adpts = _adapters;
- _activatedAdapters.clear();
- _pid = 0;
+ adpts = _adapters;
+ _activatedAdapters.clear();
+ _pid = 0;
- bool failed = false;
+ bool failed = false;
#ifndef _WIN32
- failed = WIFEXITED(status) && WEXITSTATUS(status) != 0;
- if(WIFSIGNALED(status))
- {
- int s = WTERMSIG(status);
- failed = s == SIGABRT || s == SIGILL || s == SIGBUS || s == SIGFPE || s == SIGSEGV;
- }
+ failed = WIFEXITED(status) && WEXITSTATUS(status) != 0;
+ if(WIFSIGNALED(status))
+ {
+ int s = WTERMSIG(status);
+ failed = s == SIGABRT || s == SIGILL || s == SIGBUS || s == SIGFPE || s == SIGSEGV;
+ }
#else
- failed = status != 0;
+ failed = status != 0;
#endif
- if(failed)
- {
- disableOnFailure();
- }
-
- if(_state != ServerI::Deactivating &&
- _state != ServerI::DeactivatingWaitForProcess &&
- _state != ServerI::Destroying)
- {
- ostringstream os;
- os << "The server terminated unexpectedly";
+ if(failed)
+ {
+ disableOnFailure();
+ }
+
+ if(_state != ServerI::Deactivating &&
+ _state != ServerI::DeactivatingWaitForProcess &&
+ _state != ServerI::Destroying)
+ {
+ ostringstream os;
+ os << "The server terminated unexpectedly";
#ifndef _WIN32
- if(WIFEXITED(status))
- {
- os << " with exit code " << WEXITSTATUS(status);
- }
- else if(WIFSIGNALED(status))
- {
- os << " with signal " << signalToString(WTERMSIG(status));
- }
+ if(WIFEXITED(status))
+ {
+ os << " with exit code " << WEXITSTATUS(status);
+ }
+ else if(WIFSIGNALED(status))
+ {
+ os << " with signal " << signalToString(WTERMSIG(status));
+ }
#else
- os << " with exit code " << status;
+ os << " with exit code " << status;
#endif
- os << (msg.empty() ? string(".") : ":\n" + msg);
- setStateNoSync(ServerI::Deactivating, os.str());
- }
+ os << (msg.empty() ? string(".") : ":\n" + msg);
+ setStateNoSync(ServerI::Deactivating, os.str());
+ }
}
//
@@ -1596,36 +1596,36 @@ ServerI::terminated(const string& msg, int status)
//
for(ServerAdapterDict::iterator p = adpts.begin(); p != adpts.end(); ++p)
{
- try
- {
- p->second->setDirectProxy(0);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
+ try
+ {
+ p->second->setDirectProxy(0);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
}
bool doDestroy = false;
ServerCommandPtr command;
{
- Lock sync(*this);
- if(_state == ServerI::Destroying)
- {
- doDestroy = true;
- }
- else
- {
- setStateNoSync(ServerI::Inactive);
- command = nextCommand();
- }
+ Lock sync(*this);
+ if(_state == ServerI::Destroying)
+ {
+ doDestroy = true;
+ }
+ else
+ {
+ setStateNoSync(ServerI::Inactive);
+ command = nextCommand();
+ }
}
if(doDestroy)
{
- destroy();
+ destroy();
}
else if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -1634,104 +1634,104 @@ ServerI::update()
{
ServerCommandPtr command;
{
- Lock sync(*this);
- if(_state != ServerI::Loading)
- {
- return;
- }
-
- InternalServerDescriptorPtr oldDescriptor = _desc;
- try
- {
- if(_load->clearDir())
- {
- //
- // The server was explicitely destroyed then updated,
- // we first need to cleanup the directory to remove
- // any user created files.
- //
- try
- {
- IcePatch2::removeRecursive(_serverDir);
- }
- catch(const string&)
- {
- }
- }
-
- try
- {
- updateImpl(_load->getInternalServerDescriptor());
- }
- catch(const Ice::Exception& ex)
- {
- ostringstream os;
- os << ex;
- throw DeploymentException(os.str());
- }
- catch(const string& msg)
- {
- throw DeploymentException(msg);
- }
- catch(const char* msg)
- {
- throw DeploymentException(msg);
- }
-
- if(oldDescriptor)
- {
- _node->removeServer(this, oldDescriptor->application, oldDescriptor->applicationDistrib);
- }
- _node->addServer(this, _desc->application, _desc->applicationDistrib);
-
- AdapterPrxDict adapters;
- for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
- {
- adapters.insert(make_pair(p->first, p->second->getProxy()));
- }
- _load->finished(_this, adapters, _activationTimeout, _deactivationTimeout);
- }
- catch(const DeploymentException& ex)
- {
- //
- // Rollback old descriptor.
- //
- if(oldDescriptor)
- {
- try
- {
- updateImpl(oldDescriptor);
- }
- catch(const Ice::Exception& e)
- {
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << e;
- }
- catch(const string& msg)
- {
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << msg;
- }
- catch(const char* msg)
- {
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << msg;
- }
- }
- else if(!_destroy)
- {
- _destroy = new DestroyCommand(this, true);
- }
-
- _load->failed(ex);
- }
-
- setStateNoSync(Inactive);
- command = nextCommand();
+ Lock sync(*this);
+ if(_state != ServerI::Loading)
+ {
+ return;
+ }
+
+ InternalServerDescriptorPtr oldDescriptor = _desc;
+ try
+ {
+ if(_load->clearDir())
+ {
+ //
+ // The server was explicitely destroyed then updated,
+ // we first need to cleanup the directory to remove
+ // any user created files.
+ //
+ try
+ {
+ IcePatch2::removeRecursive(_serverDir);
+ }
+ catch(const string&)
+ {
+ }
+ }
+
+ try
+ {
+ updateImpl(_load->getInternalServerDescriptor());
+ }
+ catch(const Ice::Exception& ex)
+ {
+ ostringstream os;
+ os << ex;
+ throw DeploymentException(os.str());
+ }
+ catch(const string& msg)
+ {
+ throw DeploymentException(msg);
+ }
+ catch(const char* msg)
+ {
+ throw DeploymentException(msg);
+ }
+
+ if(oldDescriptor)
+ {
+ _node->removeServer(this, oldDescriptor->application, oldDescriptor->applicationDistrib);
+ }
+ _node->addServer(this, _desc->application, _desc->applicationDistrib);
+
+ AdapterPrxDict adapters;
+ for(ServerAdapterDict::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
+ {
+ adapters.insert(make_pair(p->first, p->second->getProxy()));
+ }
+ _load->finished(_this, adapters, _activationTimeout, _deactivationTimeout);
+ }
+ catch(const DeploymentException& ex)
+ {
+ //
+ // Rollback old descriptor.
+ //
+ if(oldDescriptor)
+ {
+ try
+ {
+ updateImpl(oldDescriptor);
+ }
+ catch(const Ice::Exception& e)
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << e;
+ }
+ catch(const string& msg)
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << msg;
+ }
+ catch(const char* msg)
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "update failed:\n" << ex.reason << "\nand couldn't rollback old descriptor:\n" << msg;
+ }
+ }
+ else if(!_destroy)
+ {
+ _destroy = new DestroyCommand(this, true);
+ }
+
+ _load->failed(ex);
+ }
+
+ setStateNoSync(Inactive);
+ command = nextCommand();
}
if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -1752,69 +1752,69 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
// can't start).
//
bool serverSessionReleased = _desc && _desc->activation == "session" &&
- _desc->revision == descriptor->revision && !_desc->sessionId.empty() && descriptor->sessionId.empty();
+ _desc->revision == descriptor->revision && !_desc->sessionId.empty() && descriptor->sessionId.empty();
//
// Go through the adapters and create the object adapter Ice
// objects if necessary, also remove the old ones.
//
{
- ServerAdapterDict oldAdapters;
- oldAdapters.swap(_adapters);
- _serverLifetimeAdapters.clear();
- Ice::ObjectAdapterPtr adapter = _node->getAdapter();
- for(InternalAdapterDescriptorSeq::const_iterator r = _desc->adapters.begin(); r != _desc->adapters.end(); ++r)
- {
- try
- {
- Ice::Identity id;
- id.category = _this->ice_getIdentity().category + "Adapter";
- id.name = _id + "-" + (*r)->id;
- ServerAdapterIPtr servant = ServerAdapterIPtr::dynamicCast(adapter->find(id));
- if(!servant)
- {
- AdapterPrx proxy = AdapterPrx::uncheckedCast(adapter->createProxy(id));
- servant = new ServerAdapterI(_node, this, _id, proxy, (*r)->id);
- adapter->add(servant, id);
- }
- _adapters.insert(make_pair((*r)->id, servant));
-
- if((*r)->serverLifetime)
- {
- _serverLifetimeAdapters.insert((*r)->id);
- }
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- // IGNORE
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Error out(_node->getTraceLevels()->logger);
- out << "couldn't add adapter `" << (*r)->id << "':\n" << ex;
- }
- oldAdapters.erase((*r)->id);
- }
-
- //
- // Remove old object adapters.
- //
- for(ServerAdapterDict::const_iterator t = oldAdapters.begin(); t != oldAdapters.end(); ++t)
- {
- try
- {
- t->second->destroy();
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- // IGNORE
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Error out(_node->getTraceLevels()->logger);
- out << "couldn't destroy adapter `" << t->first << "':\n" << ex;
- }
- }
+ ServerAdapterDict oldAdapters;
+ oldAdapters.swap(_adapters);
+ _serverLifetimeAdapters.clear();
+ Ice::ObjectAdapterPtr adapter = _node->getAdapter();
+ for(InternalAdapterDescriptorSeq::const_iterator r = _desc->adapters.begin(); r != _desc->adapters.end(); ++r)
+ {
+ try
+ {
+ Ice::Identity id;
+ id.category = _this->ice_getIdentity().category + "Adapter";
+ id.name = _id + "-" + (*r)->id;
+ ServerAdapterIPtr servant = ServerAdapterIPtr::dynamicCast(adapter->find(id));
+ if(!servant)
+ {
+ AdapterPrx proxy = AdapterPrx::uncheckedCast(adapter->createProxy(id));
+ servant = new ServerAdapterI(_node, this, _id, proxy, (*r)->id);
+ adapter->add(servant, id);
+ }
+ _adapters.insert(make_pair((*r)->id, servant));
+
+ if((*r)->serverLifetime)
+ {
+ _serverLifetimeAdapters.insert((*r)->id);
+ }
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ // IGNORE
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Error out(_node->getTraceLevels()->logger);
+ out << "couldn't add adapter `" << (*r)->id << "':\n" << ex;
+ }
+ oldAdapters.erase((*r)->id);
+ }
+
+ //
+ // Remove old object adapters.
+ //
+ for(ServerAdapterDict::const_iterator t = oldAdapters.begin(); t != oldAdapters.end(); ++t)
+ {
+ try
+ {
+ t->second->destroy();
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ // IGNORE
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Error out(_node->getTraceLevels()->logger);
+ out << "couldn't destroy adapter `" << t->first << "':\n" << ex;
+ }
+ }
}
//
@@ -1826,15 +1826,15 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
//
if(_activation != Disabled || _failureTime != IceUtil::Time())
{
- _activation = toServerActivation(_desc->activation);
- _failureTime = IceUtil::Time();
+ _activation = toServerActivation(_desc->activation);
+ _failureTime = IceUtil::Time();
}
if(_timer)
{
- _node->getWaitQueue()->remove(_timer);
- _timer = 0;
- }
+ _node->getWaitQueue()->remove(_timer);
+ _timer = 0;
+ }
//
// Don't change the user if the server has the session activation
@@ -1843,21 +1843,21 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
string user;
if(_desc->activation != "session" || !_desc->sessionId.empty())
{
- user = _desc->user;
+ user = _desc->user;
#ifndef _WIN32
- //
- // Check if the node is running as root, if that's the case we
- // make sure that a user is set for the process.
- //
- if(getuid() == 0 && user.empty())
- {
- //
- // If no user is configured and if this server is owned by
- // a session we set the user to the session id, otherwise
- // we set it to "nobody".
- //
- user = !_desc->sessionId.empty() ? _desc->sessionId : "nobody";
- }
+ //
+ // Check if the node is running as root, if that's the case we
+ // make sure that a user is set for the process.
+ //
+ if(getuid() == 0 && user.empty())
+ {
+ //
+ // If no user is configured and if this server is owned by
+ // a session we set the user to the session id, otherwise
+ // we set it to "nobody".
+ //
+ user = !_desc->sessionId.empty() ? _desc->sessionId : "nobody";
+ }
#endif
}
@@ -1867,108 +1867,108 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
if(!user.empty())
{
- UserAccountMapperPrx mapper = _node->getUserAccountMapper();
- if(mapper)
- {
- try
- {
- user = mapper->getUserAccount(user);
- }
- catch(const UserAccountNotFoundException&)
- {
- throw "couldn't find user account for user `" + user + "'";
- }
- catch(const Ice::LocalException& ex)
- {
- ostringstream os;
- os << "unexpected exception while trying to find user account for user `" << user << "':\n" << ex;
- throw os.str();
- }
- }
+ UserAccountMapperPrx mapper = _node->getUserAccountMapper();
+ if(mapper)
+ {
+ try
+ {
+ user = mapper->getUserAccount(user);
+ }
+ catch(const UserAccountNotFoundException&)
+ {
+ throw "couldn't find user account for user `" + user + "'";
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ ostringstream os;
+ os << "unexpected exception while trying to find user account for user `" << user << "':\n" << ex;
+ throw os.str();
+ }
+ }
#ifdef _WIN32
- //
- // Windows doesn't support running processes under another
- // account (at least not easily, see the CreateProcessAsUser
- // documentation). So if a user is specified, we just check
- // that the node is running under the same user account as the
- // one which is specified.
- //
- vector<char> buf(256);
- buf.resize(256);
- DWORD size = static_cast<DWORD>(buf.size());
- bool success = GetUserName(&buf[0], &size);
- if(!success && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
- {
- buf.resize(size);
- success = GetUserName(&buf[0], &size);
- }
- if(!success)
- {
- Ice::SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- if(user != string(&buf[0]))
- {
- throw "couldn't load server under user account `" + user + "': feature not supported on Windows";
- }
+ //
+ // Windows doesn't support running processes under another
+ // account (at least not easily, see the CreateProcessAsUser
+ // documentation). So if a user is specified, we just check
+ // that the node is running under the same user account as the
+ // one which is specified.
+ //
+ vector<char> buf(256);
+ buf.resize(256);
+ DWORD size = static_cast<DWORD>(buf.size());
+ bool success = GetUserName(&buf[0], &size);
+ if(!success && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ {
+ buf.resize(size);
+ success = GetUserName(&buf[0], &size);
+ }
+ if(!success)
+ {
+ Ice::SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ if(user != string(&buf[0]))
+ {
+ throw "couldn't load server under user account `" + user + "': feature not supported on Windows";
+ }
#else
- //
- // Get the uid/gid associated with the given user.
- //
- struct passwd* pw = getpwnam(user.c_str());
- if(!pw)
- {
- throw "unknown user account `" + user + "'";
- }
-
- //
- // If the node isn't running as root and if the uid of the
- // configured user is different from the uid of the userr
- // running the node we throw, a regular user can't run a
- // process as another user.
- //
- uid_t uid = getuid();
- if(uid != 0 && pw->pw_uid != uid)
- {
- throw "node has insufficient privileges to load server under user account `" + user + "'";
- }
-
- if(pw->pw_uid == 0) // Don't allow running proccesses as "root"
- {
- throw "running server as `root' is not allowed";
- }
-
- newUser = _uid != pw->pw_uid || _gid != pw->pw_gid;
- _uid = pw->pw_uid;
- _gid = pw->pw_gid;
+ //
+ // Get the uid/gid associated with the given user.
+ //
+ struct passwd* pw = getpwnam(user.c_str());
+ if(!pw)
+ {
+ throw "unknown user account `" + user + "'";
+ }
+
+ //
+ // If the node isn't running as root and if the uid of the
+ // configured user is different from the uid of the userr
+ // running the node we throw, a regular user can't run a
+ // process as another user.
+ //
+ uid_t uid = getuid();
+ if(uid != 0 && pw->pw_uid != uid)
+ {
+ throw "node has insufficient privileges to load server under user account `" + user + "'";
+ }
+
+ if(pw->pw_uid == 0) // Don't allow running proccesses as "root"
+ {
+ throw "running server as `root' is not allowed";
+ }
+
+ newUser = _uid != pw->pw_uid || _gid != pw->pw_gid;
+ _uid = pw->pw_uid;
+ _gid = pw->pw_gid;
#endif
}
#ifndef _WIN32
else
- {
- //
- // If no user is specified, we'll run the process as the
- // current user.
- //
- uid_t uid = getuid();
- uid_t gid = getgid();
- newUser = _uid != uid || _gid != gid;
- _uid = uid;
- _gid = gid;
+ {
+ //
+ // If no user is specified, we'll run the process as the
+ // current user.
+ //
+ uid_t uid = getuid();
+ uid_t gid = getgid();
+ newUser = _uid != uid || _gid != gid;
+ _uid = uid;
+ _gid = gid;
}
#endif
istringstream at(_desc->activationTimeout);
if(!(at >> _activationTimeout) || !at.eof() || _activationTimeout == 0)
{
- _activationTimeout = _waitTime;
+ _activationTimeout = _waitTime;
}
istringstream dt(_desc->deactivationTimeout);
if(!(dt >> _deactivationTimeout) || !dt.eof() || _deactivationTimeout == 0)
{
- _deactivationTimeout = _waitTime;
+ _deactivationTimeout = _waitTime;
}
//
@@ -2008,16 +2008,16 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
string outputDir = _node->getOutputDir();
if(!outputDir.empty())
{
- if(_stdErrFile.empty())
- {
- _stdErrFile = outputDir + "/" + _id + (_node->getRedirectErrToOut() ? ".out" : ".err");
- props.push_back(createProperty("Ice.StdErr", _stdErrFile));
- }
- if(_stdOutFile.empty())
- {
- _stdOutFile = outputDir + "/" + _id + ".out";
- props.push_back(createProperty("Ice.StdOut", _stdOutFile));
- }
+ if(_stdErrFile.empty())
+ {
+ _stdErrFile = outputDir + "/" + _id + (_node->getRedirectErrToOut() ? ".out" : ".err");
+ props.push_back(createProperty("Ice.StdErr", _stdErrFile));
+ }
+ if(_stdOutFile.empty())
+ {
+ _stdOutFile = outputDir + "/" + _id + ".out";
+ props.push_back(createProperty("Ice.StdOut", _stdOutFile));
+ }
}
//
@@ -2025,21 +2025,21 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
//
{
const PropertyDescriptorSeq& overrides = _node->getPropertiesOverride();
- for(PropertyDescriptorSeqDict::iterator p = properties.begin(); p != properties.end(); ++p)
- {
- if(getProperty(p->second, "Ice.Default.Locator").empty())
- {
- p->second.push_back(
- createProperty("Ice.Default.Locator",
- _node->getCommunicator()->getProperties()->getProperty("Ice.Default.Locator")));
- }
+ for(PropertyDescriptorSeqDict::iterator p = properties.begin(); p != properties.end(); ++p)
+ {
+ if(getProperty(p->second, "Ice.Default.Locator").empty())
+ {
+ p->second.push_back(
+ createProperty("Ice.Default.Locator",
+ _node->getCommunicator()->getProperties()->getProperty("Ice.Default.Locator")));
+ }
if(!overrides.empty())
{
p->second.push_back(createProperty("# Node properties override"));
p->second.insert(p->second.end(), overrides.begin(), overrides.end());
}
- }
+ }
}
//
@@ -2049,7 +2049,7 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
//
if(serverSessionReleased)
{
- return;
+ return;
}
//
@@ -2069,55 +2069,55 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
// Create the configuration files, remove the old ones.
//
{
- Ice::StringSeq knownFiles;
- for(PropertyDescriptorSeqDict::const_iterator p = properties.begin(); p != properties.end(); ++p)
- {
- knownFiles.push_back(p->first);
-
- const string configFilePath = _serverDir + "/config/" + p->first;
- ofstream configfile(configFilePath.c_str());
- if(!configfile.good())
- {
- throw "couldn't create configuration file: " + configFilePath;
- }
- configfile << "# Configuration file (" << IceUtil::Time::now().toDateTime();
- configfile << ", " << _desc->iceVersion << ")" << endl << endl;
- for(PropertyDescriptorSeq::const_iterator r = p->second.begin(); r != p->second.end(); ++r)
- {
- if(r->value.empty() && r->name.find('#') == 0)
- {
- configfile << r->name << endl;
- }
- else
- {
- configfile << r->name << "=" << r->value << endl;
- }
- }
- configfile.close();
- }
- sort(knownFiles.begin(), knownFiles.end());
-
- //
- // Remove old configuration files.
- //
- Ice::StringSeq files = IcePatch2::readDirectory(_serverDir + "/config");
- Ice::StringSeq toDel;
- set_difference(files.begin(), files.end(), knownFiles.begin(), knownFiles.end(), back_inserter(toDel));
- for(Ice::StringSeq::const_iterator q = toDel.begin(); q != toDel.end(); ++q)
- {
- if(q->find("config_") == 0)
- {
- try
- {
- IcePatch2::remove(_serverDir + "/config/" + *q);
- }
- catch(const string& msg)
- {
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "couldn't remove file `" + _serverDir + "/config/" + *q + "':\n" + msg;
- }
- }
- }
+ Ice::StringSeq knownFiles;
+ for(PropertyDescriptorSeqDict::const_iterator p = properties.begin(); p != properties.end(); ++p)
+ {
+ knownFiles.push_back(p->first);
+
+ const string configFilePath = _serverDir + "/config/" + p->first;
+ ofstream configfile(configFilePath.c_str());
+ if(!configfile.good())
+ {
+ throw "couldn't create configuration file: " + configFilePath;
+ }
+ configfile << "# Configuration file (" << IceUtil::Time::now().toDateTime();
+ configfile << ", " << _desc->iceVersion << ")" << endl << endl;
+ for(PropertyDescriptorSeq::const_iterator r = p->second.begin(); r != p->second.end(); ++r)
+ {
+ if(r->value.empty() && r->name.find('#') == 0)
+ {
+ configfile << r->name << endl;
+ }
+ else
+ {
+ configfile << r->name << "=" << r->value << endl;
+ }
+ }
+ configfile.close();
+ }
+ sort(knownFiles.begin(), knownFiles.end());
+
+ //
+ // Remove old configuration files.
+ //
+ Ice::StringSeq files = IcePatch2::readDirectory(_serverDir + "/config");
+ Ice::StringSeq toDel;
+ set_difference(files.begin(), files.end(), knownFiles.begin(), knownFiles.end(), back_inserter(toDel));
+ for(Ice::StringSeq::const_iterator q = toDel.begin(); q != toDel.end(); ++q)
+ {
+ if(q->find("config_") == 0)
+ {
+ try
+ {
+ IcePatch2::remove(_serverDir + "/config/" + *q);
+ }
+ catch(const string& msg)
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "couldn't remove file `" + _serverDir + "/config/" + *q + "':\n" + msg;
+ }
+ }
+ }
}
//
@@ -2125,67 +2125,67 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
// old ones.
//
{
- Ice::StringSeq knownDbEnvs;
- for(InternalDbEnvDescriptorSeq::const_iterator q = _desc->dbEnvs.begin(); q != _desc->dbEnvs.end(); ++q)
- {
- knownDbEnvs.push_back((*q)->name);
-
- string dbEnvHome = _serverDir + "/dbs/" + (*q)->name;
- createOrUpdateDirectory(dbEnvHome);
-
- if(!(*q)->properties.empty())
- {
- string file = dbEnvHome + "/DB_CONFIG";
- ofstream configfile(file.c_str());
- if(!configfile.good())
- {
- throw "couldn't create configuration file `" + file + "'";
- }
-
- PropertyDescriptorSeq::const_iterator p;
- for(p = (*q)->properties.begin(); p != (*q)->properties.end(); ++p)
- {
- if(!p->name.empty())
- {
- configfile << p->name;
- if(!p->value.empty())
- {
- configfile << " " << p->value;
- }
- configfile << endl;
- }
- }
- configfile.close();
- }
- }
- sort(knownDbEnvs.begin(), knownDbEnvs.end());
-
- //
- // Remove old database environments.
- //
- Ice::StringSeq dbEnvs = IcePatch2::readDirectory(_serverDir + "/dbs");
- Ice::StringSeq toDel;
- set_difference(dbEnvs.begin(), dbEnvs.end(), knownDbEnvs.begin(), knownDbEnvs.end(), back_inserter(toDel));
- for(Ice::StringSeq::const_iterator p = toDel.begin(); p != toDel.end(); ++p)
- {
- try
- {
- IcePatch2::removeRecursive(_serverDir + "/dbs/" + *p);
- }
- catch(const string& msg)
- {
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "couldn't remove directory `" + _serverDir + "/dbs/" + *p + "':\n" + msg;
- }
- }
+ Ice::StringSeq knownDbEnvs;
+ for(InternalDbEnvDescriptorSeq::const_iterator q = _desc->dbEnvs.begin(); q != _desc->dbEnvs.end(); ++q)
+ {
+ knownDbEnvs.push_back((*q)->name);
+
+ string dbEnvHome = _serverDir + "/dbs/" + (*q)->name;
+ createOrUpdateDirectory(dbEnvHome);
+
+ if(!(*q)->properties.empty())
+ {
+ string file = dbEnvHome + "/DB_CONFIG";
+ ofstream configfile(file.c_str());
+ if(!configfile.good())
+ {
+ throw "couldn't create configuration file `" + file + "'";
+ }
+
+ PropertyDescriptorSeq::const_iterator p;
+ for(p = (*q)->properties.begin(); p != (*q)->properties.end(); ++p)
+ {
+ if(!p->name.empty())
+ {
+ configfile << p->name;
+ if(!p->value.empty())
+ {
+ configfile << " " << p->value;
+ }
+ configfile << endl;
+ }
+ }
+ configfile.close();
+ }
+ }
+ sort(knownDbEnvs.begin(), knownDbEnvs.end());
+
+ //
+ // Remove old database environments.
+ //
+ Ice::StringSeq dbEnvs = IcePatch2::readDirectory(_serverDir + "/dbs");
+ Ice::StringSeq toDel;
+ set_difference(dbEnvs.begin(), dbEnvs.end(), knownDbEnvs.begin(), knownDbEnvs.end(), back_inserter(toDel));
+ for(Ice::StringSeq::const_iterator p = toDel.begin(); p != toDel.end(); ++p)
+ {
+ try
+ {
+ IcePatch2::removeRecursive(_serverDir + "/dbs/" + *p);
+ }
+ catch(const string& msg)
+ {
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "couldn't remove directory `" + _serverDir + "/dbs/" + *p + "':\n" + msg;
+ }
+ }
}
#ifndef _WIN32
if(newUser)
{
- chownRecursive(_serverDir + "/config", _uid, _gid);
- chownRecursive(_serverDir + "/dbs", _uid, _gid);
- chownRecursive(_serverDir + "/distrib", _uid, _gid);
+ chownRecursive(_serverDir + "/config", _uid, _gid);
+ chownRecursive(_serverDir + "/dbs", _uid, _gid);
+ chownRecursive(_serverDir + "/distrib", _uid, _gid);
}
#endif
}
@@ -2195,47 +2195,47 @@ ServerI::checkRevision(const string& replicaName, const string& uuid, int revisi
{
if(replicaName == "Master")
{
- return;
+ return;
}
string descUUID;
int descRevision;
if(_desc)
{
- descUUID = _desc->uuid;
- descRevision = _desc->revision;
+ descUUID = _desc->uuid;
+ descRevision = _desc->revision;
}
else
{
- string idFilePath = _serverDir + "/revision";
- ifstream is(idFilePath.c_str());
- if(!is.good())
- {
- return;
- }
-
- char line[1024];
- is.getline(line, 1024); // Ignore comments
- is.getline(line, 1024);
- is.getline(line, 1024);
- string ignore;
- is >> ignore >> descUUID;
- is >> ignore >> descRevision;
+ string idFilePath = _serverDir + "/revision";
+ ifstream is(idFilePath.c_str());
+ if(!is.good())
+ {
+ return;
+ }
+
+ char line[1024];
+ is.getline(line, 1024); // Ignore comments
+ is.getline(line, 1024);
+ is.getline(line, 1024);
+ string ignore;
+ is >> ignore >> descUUID;
+ is >> ignore >> descRevision;
}
if(uuid != descUUID)
{
- DeploymentException ex;
- ex.reason = "server from replica `" + replicaName + "' is from another application (`" + uuid + "')";
- throw ex;
+ DeploymentException ex;
+ ex.reason = "server from replica `" + replicaName + "' is from another application (`" + uuid + "')";
+ throw ex;
}
else if(revision != descRevision)
{
- ostringstream os;
- os << "server from replica `" + replicaName + "' has a different version:\n";
- os << "current revision: " << descRevision << "\n";
- os << "replica revision: " << revision;
- throw DeploymentException(os.str());
+ ostringstream os;
+ os << "server from replica `" + replicaName + "' has a different version:\n";
+ os << "current revision: " << descRevision << "\n";
+ os << "replica revision: " << revision;
+ throw DeploymentException(os.str());
}
}
@@ -2249,11 +2249,11 @@ ServerI::updateRevision(const string& uuid, int revision)
ofstream os(idFilePath.c_str());
if(os.good())
{
- os << "#" << endl;
- os << "# This server belongs to the application `" << _desc->application << "'" << endl;
- os << "#" << endl;
- os << "uuid: " << _desc->uuid << endl;
- os << "revision: " << _desc->revision << endl;
+ os << "#" << endl;
+ os << "# This server belongs to the application `" << _desc->application << "'" << endl;
+ os << "#" << endl;
+ os << "uuid: " << _desc->uuid << endl;
+ os << "revision: " << _desc->revision << endl;
}
}
@@ -2263,11 +2263,11 @@ ServerI::checkActivation()
//assert(locked());
if(_state == ServerI::WaitForActivation || _state == ServerI::ActivationTimeout)
{
- if(includes(_activatedAdapters.begin(), _activatedAdapters.end(),
- _serverLifetimeAdapters.begin(), _serverLifetimeAdapters.end()))
- {
- setStateNoSync(ServerI::Active);
- }
+ if(includes(_activatedAdapters.begin(), _activatedAdapters.end(),
+ _serverLifetimeAdapters.begin(), _serverLifetimeAdapters.end()))
+ {
+ setStateNoSync(ServerI::Active);
+ }
}
}
@@ -2276,13 +2276,13 @@ ServerI::setState(InternalServerState st, const std::string& reason)
{
ServerCommandPtr command;
{
- Lock sync(*this);
- setStateNoSync(st, reason);
- command = nextCommand();
+ Lock sync(*this);
+ setStateNoSync(st, reason);
+ command = nextCommand();
}
if(command)
{
- command->execute();
+ command->execute();
}
}
@@ -2292,27 +2292,27 @@ ServerI::nextCommand()
ServerCommandPtr command;
if(_stop && _stop->canExecute(_state))
{
- command = _stop;
+ command = _stop;
}
else if(_destroy && _destroy->canExecute(_state))
{
- command = _destroy;
+ command = _destroy;
}
else if(_load && _load->canExecute(_state))
{
- command = _load;
+ command = _load;
}
else if(_patch && _patch->canExecute(_state))
{
- command = _patch;
+ command = _patch;
}
else if(_start && _start->canExecute(_state))
{
- command = _start;
+ command = _start;
}
if(command)
{
- setStateNoSync(command->nextState());
+ setStateNoSync(command->nextState());
}
return command;
}
@@ -2326,37 +2326,37 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason)
switch(st)
{
case Inactive:
- break;
+ break;
case Patching:
- assert(_patch && _patch->canExecute(_state));
- break;
+ assert(_patch && _patch->canExecute(_state));
+ break;
case Loading:
- assert(_load && _load->canExecute(_state));
- break;
+ assert(_load && _load->canExecute(_state));
+ break;
case Activating:
- assert(_start && _start->canExecute(_state));
- break;
+ assert(_start && _start->canExecute(_state));
+ break;
case WaitForActivation:
- assert(_state == Activating);
- break;
+ assert(_state == Activating);
+ break;
case ActivationTimeout:
- assert(_state == WaitForActivation);
- break;
+ assert(_state == WaitForActivation);
+ break;
case Active:
- assert(_state == WaitForActivation || _state == ActivationTimeout);
- break;
+ assert(_state == WaitForActivation || _state == ActivationTimeout);
+ break;
case Deactivating:
- //assert(_stop && _stop->canExecute(_state));
- break;
+ //assert(_stop && _stop->canExecute(_state));
+ break;
case DeactivatingWaitForProcess:
- assert(_state == Deactivating);
- break;
+ assert(_state == Deactivating);
+ break;
case Destroying:
- assert(_state == Inactive && _destroy && _destroy->canExecute(_state));
- break;
+ assert(_state == Inactive && _destroy && _destroy->canExecute(_state));
+ break;
case Destroyed:
- assert(_destroy);
- break;
+ assert(_destroy);
+ break;
}
//
@@ -2372,112 +2372,112 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason)
switch(_state)
{
case Inactive:
- if(previous == Loading)
- {
- _load = 0;
- }
- if(previous == Patching)
- {
- _patch = 0;
- }
- if(_stop)
- {
- _stop->finished();
- _stop = 0;
- }
- break;
+ if(previous == Loading)
+ {
+ _load = 0;
+ }
+ if(previous == Patching)
+ {
+ _patch = 0;
+ }
+ if(_stop)
+ {
+ _stop->finished();
+ _stop = 0;
+ }
+ break;
case Active:
- if(_start)
- {
- _start->finished();
- _start = 0;
- }
- break;
+ if(_start)
+ {
+ _start->finished();
+ _start = 0;
+ }
+ break;
case ActivationTimeout:
- if(_start)
- {
- _start->failed(reason);
- _start = 0;
- }
- break;
+ if(_start)
+ {
+ _start->failed(reason);
+ _start = 0;
+ }
+ break;
case Deactivating:
- if(_start)
- {
- _start->failed(reason.empty() ? string("The server is being deactivated.") : reason);
- _start = 0;
- }
- break;
+ if(_start)
+ {
+ _start->failed(reason.empty() ? string("The server is being deactivated.") : reason);
+ _start = 0;
+ }
+ break;
case Destroying:
- loadFailure = _destroy->loadFailure();
- if(_patch)
- {
- _patch->destroyed();
- _patch = 0;
- }
- if(_load)
- {
- _load->failed(DeploymentException("The server is being destroyed."));
- _load = 0;
- }
- if(_start)
- {
- _start->failed("The server is being destroyed.");
- _start = 0;
- }
- if(_stop)
- {
- _stop->failed("The server is being destroyed.");
- _stop = 0;
- }
- break;
+ loadFailure = _destroy->loadFailure();
+ if(_patch)
+ {
+ _patch->destroyed();
+ _patch = 0;
+ }
+ if(_load)
+ {
+ _load->failed(DeploymentException("The server is being destroyed."));
+ _load = 0;
+ }
+ if(_start)
+ {
+ _start->failed("The server is being destroyed.");
+ _start = 0;
+ }
+ if(_stop)
+ {
+ _stop->failed("The server is being destroyed.");
+ _stop = 0;
+ }
+ break;
case Destroyed:
- if(_destroy)
- {
- loadFailure = _destroy->loadFailure();
- _destroy->finished();
- _destroy = 0;
- }
- break;
+ if(_destroy)
+ {
+ loadFailure = _destroy->loadFailure();
+ _destroy->finished();
+ _destroy = 0;
+ }
+ break;
default:
- break;
+ break;
}
if(_state == Destroyed && !_load)
{
- //
- // If the server is destroyed and there's no load command, we
- // remove the servant from the ASM.
- //
- try
- {
- _node->getAdapter()->remove(_this->ice_getIdentity());
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- // IGNORE
- }
- _desc = 0;
+ //
+ // If the server is destroyed and there's no load command, we
+ // remove the servant from the ASM.
+ //
+ try
+ {
+ _node->getAdapter()->remove(_this->ice_getIdentity());
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ // IGNORE
+ }
+ _desc = 0;
}
else if(_state == Inactive)
{
- if(_activation == Always)
- {
- _timer = new DelayedStart(this, _node->getTraceLevels());
- _node->getWaitQueue()->add(_timer, IceUtil::Time::milliSeconds(500));
- }
- else if(_activation == Disabled && _disableOnFailure > 0 && _failureTime != IceUtil::Time())
- {
- //
- // If the server was disabled because it failed, we
- // schedule a callback to re-enable it. We add 500ms to
- // the disable on failure duration to make sure that the
- // server will be ready to be reactivated when the
- // callback is executed.
- //
- _timer = new DelayedStart(this, _node->getTraceLevels());
- _node->getWaitQueue()->add(_timer,
- IceUtil::Time::seconds(_disableOnFailure) + IceUtil::Time::milliSeconds(500));
- }
+ if(_activation == Always)
+ {
+ _timer = new DelayedStart(this, _node->getTraceLevels());
+ _node->getWaitQueue()->add(_timer, IceUtil::Time::milliSeconds(500));
+ }
+ else if(_activation == Disabled && _disableOnFailure > 0 && _failureTime != IceUtil::Time())
+ {
+ //
+ // If the server was disabled because it failed, we
+ // schedule a callback to re-enable it. We add 500ms to
+ // the disable on failure duration to make sure that the
+ // server will be ready to be reactivated when the
+ // callback is executed.
+ //
+ _timer = new DelayedStart(this, _node->getTraceLevels());
+ _node->getWaitQueue()->add(_timer,
+ IceUtil::Time::seconds(_disableOnFailure) + IceUtil::Time::milliSeconds(500));
+ }
}
//
@@ -2491,69 +2491,69 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason)
!(previous == Inactive && _state == Deactivating) &&
!loadFailure)
{
- _node->observerUpdateServer(getDynamicInfo());
+ _node->observerUpdateServer(getDynamicInfo());
}
if(_node->getTraceLevels()->server > 1)
{
- if(_state == ServerI::Active)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Active'";
- }
- else if(_state == ServerI::Inactive)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Inactive'";
- }
- else if(_state == ServerI::Destroyed)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Destroyed'";
- }
- else if(_node->getTraceLevels()->server > 2)
- {
- if(_state == ServerI::WaitForActivation)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `WaitForActivation'";
- }
- else if(_state == ServerI::ActivationTimeout)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `ActivationTimeout'";
- }
- else if(_state == ServerI::Activating)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Activating'";
- }
- else if(_state == ServerI::Deactivating)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Deactivating'";
- }
- else if(_state == ServerI::DeactivatingWaitForProcess)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `DeactivatingWaitForProcess'";
- }
- else if(_state == ServerI::Destroying)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Destroying'";
- }
- else if(_state == ServerI::Loading)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Loading'";
- }
- else if(_state == ServerI::Patching)
- {
- Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
- out << "changed server `" << _id << "' state to `Loading'";
- }
- }
+ if(_state == ServerI::Active)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Active'";
+ }
+ else if(_state == ServerI::Inactive)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Inactive'";
+ }
+ else if(_state == ServerI::Destroyed)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Destroyed'";
+ }
+ else if(_node->getTraceLevels()->server > 2)
+ {
+ if(_state == ServerI::WaitForActivation)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `WaitForActivation'";
+ }
+ else if(_state == ServerI::ActivationTimeout)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `ActivationTimeout'";
+ }
+ else if(_state == ServerI::Activating)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Activating'";
+ }
+ else if(_state == ServerI::Deactivating)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Deactivating'";
+ }
+ else if(_state == ServerI::DeactivatingWaitForProcess)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `DeactivatingWaitForProcess'";
+ }
+ else if(_state == ServerI::Destroying)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Destroying'";
+ }
+ else if(_state == ServerI::Loading)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Loading'";
+ }
+ else if(_state == ServerI::Patching)
+ {
+ Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->serverCat);
+ out << "changed server `" << _id << "' state to `Loading'";
+ }
+ }
}
}
@@ -2562,7 +2562,7 @@ ServerI::createOrUpdateDirectory(const string& dir)
{
try
{
- IcePatch2::createDirectory(dir);
+ IcePatch2::createDirectory(dir);
}
catch(const string&)
{
@@ -2570,7 +2570,7 @@ ServerI::createOrUpdateDirectory(const string& dir)
#ifndef _WIN32
if(chown(dir.c_str(), _uid, _gid) != 0)
{
- throw "can't set permissions on directory `" + dir + "'";
+ throw "can't set permissions on directory `" + dir + "'";
}
#endif
}
@@ -2584,23 +2584,23 @@ ServerI::toServerState(InternalServerState st) const
case ServerI::Activating:
case ServerI::Patching:
case ServerI::Loading:
- return IceGrid::Inactive;
+ return IceGrid::Inactive;
case ServerI::WaitForActivation:
- return IceGrid::Activating;
+ return IceGrid::Activating;
case ServerI::ActivationTimeout:
- return IceGrid::ActivationTimedOut;
+ return IceGrid::ActivationTimedOut;
case ServerI::Active:
- return IceGrid::Active;
+ return IceGrid::Active;
case ServerI::Deactivating:
case ServerI::DeactivatingWaitForProcess:
- return IceGrid::Deactivating;
+ return IceGrid::Deactivating;
case ServerI::Destroying:
- return IceGrid::Destroying;
+ return IceGrid::Destroying;
case ServerI::Destroyed:
- return IceGrid::Destroyed;
+ return IceGrid::Destroyed;
default:
- assert(false);
- return IceGrid::Destroyed;
+ assert(false);
+ return IceGrid::Destroyed;
}
}
@@ -2609,25 +2609,25 @@ ServerI::toServerActivation(const string& activation) const
{
if(activation == "on-demand")
{
- return OnDemand;
+ return OnDemand;
}
else if(activation == "session")
{
- return Session;
+ return Session;
}
else if(activation == "always")
{
- return Always;
+ return Always;
}
else if(activation == "manual" || activation.empty())
{
- return Manual;
+ return Manual;
}
else
{
- Ice::Warning out(_node->getTraceLevels()->logger);
- out << "unknown activation mode `" << activation << "' for server `" << _id << "'";
- return Manual;
+ Ice::Warning out(_node->getTraceLevels()->logger);
+ out << "unknown activation mode `" << activation << "' for server `" << _id << "'";
+ return Manual;
}
}
@@ -2653,36 +2653,36 @@ ServerI::getFilePath(const string& filename) const
{
if(filename == "stderr")
{
- if(_stdErrFile.empty())
- {
- throw FileNotAvailableException("Ice.StdErr configuration property is not set");
- }
- return _stdErrFile;
+ if(_stdErrFile.empty())
+ {
+ throw FileNotAvailableException("Ice.StdErr configuration property is not set");
+ }
+ return _stdErrFile;
}
else if(filename == "stdout")
{
- if(_stdOutFile.empty())
- {
- throw FileNotAvailableException("Ice.StdOut configuration property is not set");
- }
- return _stdOutFile;
+ if(_stdOutFile.empty())
+ {
+ throw FileNotAvailableException("Ice.StdOut configuration property is not set");
+ }
+ return _stdOutFile;
}
else if(!filename.empty() && filename[0] == '#')
{
- string path = IcePatch2::simplify(filename.substr(1));
+ string path = IcePatch2::simplify(filename.substr(1));
if(!IcePatch2::isAbsolute(path))
{
path = _node->getPlatformInfo().getCwd() + "/" + path;
}
- if(find(_logs.begin(), _logs.end(), path) == _logs.end())
- {
- throw FileNotAvailableException("unknown log file `" + path + "'");
- }
- return path;
+ if(find(_logs.begin(), _logs.end(), path) == _logs.end())
+ {
+ throw FileNotAvailableException("unknown log file `" + path + "'");
+ }
+ return path;
}
else
{
- throw FileNotAvailableException("unknown file");
+ throw FileNotAvailableException("unknown file");
return ""; // Keep the compiler happy.
}
}
diff --git a/cpp/src/IceGrid/ServerI.h b/cpp/src/IceGrid/ServerI.h
index e0dcf3e7cf6..2e0ef5b9afa 100644
--- a/cpp/src/IceGrid/ServerI.h
+++ b/cpp/src/IceGrid/ServerI.h
@@ -47,26 +47,26 @@ public:
enum InternalServerState
{
- Loading,
- Patching,
- Inactive,
- Activating,
- WaitForActivation,
- ActivationTimeout,
- Active,
- Deactivating,
- DeactivatingWaitForProcess,
- Destroying,
- Destroyed
+ Loading,
+ Patching,
+ Inactive,
+ Activating,
+ WaitForActivation,
+ ActivationTimeout,
+ Active,
+ Deactivating,
+ DeactivatingWaitForProcess,
+ Destroying,
+ Destroyed
};
enum ServerActivation
{
- Always,
- Session,
- OnDemand,
- Manual,
- Disabled
+ Always,
+ Session,
+ OnDemand,
+ Manual,
+ Disabled
};
ServerI(const NodeIPtr&, const ServerPrx&, const std::string&, const std::string&, int);
diff --git a/cpp/src/IceGrid/SessionI.cpp b/cpp/src/IceGrid/SessionI.cpp
index daa64ddb7d7..f27ded104d5 100644
--- a/cpp/src/IceGrid/SessionI.cpp
+++ b/cpp/src/IceGrid/SessionI.cpp
@@ -31,24 +31,24 @@ class AllocateObject : public ObjectAllocationRequest
public:
AllocateObject(const SessionIPtr& session, const TPtr& cb) :
- ObjectAllocationRequest(session), _cb(cb)
+ ObjectAllocationRequest(session), _cb(cb)
{
}
virtual void
response(const Ice::ObjectPrx& proxy)
{
- assert(_cb);
- _cb->ice_response(proxy);
- _cb = 0;
+ assert(_cb);
+ _cb->ice_response(proxy);
+ _cb = 0;
}
virtual void
exception(const AllocationException& ex)
{
- assert(_cb);
- _cb->ice_exception(ex);
- _cb = 0;
+ assert(_cb);
+ _cb->ice_exception(ex);
+ _cb = 0;
}
private:
@@ -65,8 +65,8 @@ newAllocateObject(const SessionIPtr& session, const IceUtil::Handle<T>& cb)
}
BaseSessionI::BaseSessionI(const string& id,
- const string& prefix,
- const DatabasePtr& database) :
+ const string& prefix,
+ const DatabasePtr& database) :
_id(id),
_prefix(prefix),
_traceLevels(database->getTraceLevels()),
@@ -76,8 +76,8 @@ BaseSessionI::BaseSessionI(const string& id,
{
if(_traceLevels && _traceLevels->session > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->sessionCat);
- out << _prefix << " session `" << _id << "' created";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->sessionCat);
+ out << _prefix << " session `" << _id << "' created";
}
}
@@ -91,17 +91,17 @@ BaseSessionI::keepAlive(const Ice::Current& current)
Lock sync(*this);
if(_destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = current.id;
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
}
_timestamp = IceUtil::Time::now();
if(_traceLevels->session > 1)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->sessionCat);
- out << _prefix << " session `" << _id << "' keep alive";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->sessionCat);
+ out << _prefix << " session `" << _id << "' keep alive";
}
}
@@ -111,34 +111,34 @@ BaseSessionI::destroyImpl(bool shutdown)
Lock sync(*this);
if(_destroyed)
{
- Ice::ObjectNotExistException ex(__FILE__, __LINE__);
- ex.id = _identity;
- throw ex;
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = _identity;
+ throw ex;
}
_destroyed = true;
if(!shutdown)
{
- if(_servantLocator)
- {
- _servantLocator->remove(_identity);
- }
- else if(_adapter)
- {
- try
- {
- _adapter->remove(_identity);
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- }
- }
+ if(_servantLocator)
+ {
+ _servantLocator->remove(_identity);
+ }
+ else if(_adapter)
+ {
+ try
+ {
+ _adapter->remove(_identity);
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ }
+ }
}
-
+
if(_traceLevels && _traceLevels->session > 0)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->sessionCat);
- out << _prefix << " session `" << _id << "' destroyed";
+ Ice::Trace out(_traceLevels->logger, _traceLevels->sessionCat);
+ out << _prefix << " session `" << _id << "' destroyed";
}
}
@@ -180,9 +180,9 @@ BaseSessionI::registerWithObjectAdapter(const Ice::ObjectAdapterPtr& adapter)
}
SessionI::SessionI(const string& id,
- const DatabasePtr& database,
- const WaitQueuePtr& waitQueue,
- const Glacier2::SessionControlPrx& sessionControl) :
+ const DatabasePtr& database,
+ const WaitQueuePtr& waitQueue,
+ const Glacier2::SessionControlPrx& sessionControl) :
BaseSessionI(id, "client", database),
_waitQueue(waitQueue),
_sessionControl(sessionControl),
@@ -196,16 +196,16 @@ SessionI::~SessionI()
void
SessionI::allocateObjectById_async(const AMD_Session_allocateObjectByIdPtr& cb,
- const Ice::Identity& id,
- const Ice::Current&)
+ const Ice::Identity& id,
+ const Ice::Current&)
{
_database->getAllocatableObject(id)->allocate(newAllocateObject(this, cb));
}
void
SessionI::allocateObjectByType_async(const AMD_Session_allocateObjectByTypePtr& cb,
- const string& type,
- const Ice::Current&)
+ const string& type,
+ const Ice::Current&)
{
_database->getAllocatableObjectCache().allocateByType(type, newAllocateObject(this, cb));
}
@@ -242,7 +242,7 @@ SessionI::addAllocationRequest(const AllocationRequestPtr& request)
Lock sync(*this);
if(_destroyed)
{
- return false;
+ return false;
}
_requests.insert(request);
return true;
@@ -254,7 +254,7 @@ SessionI::removeAllocationRequest(const AllocationRequestPtr& request)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
_requests.erase(request);
}
@@ -265,7 +265,7 @@ SessionI::addAllocation(const AllocatablePtr& allocatable)
Lock sync(*this);
if(_destroyed)
{
- throw SessionDestroyedException();
+ throw SessionDestroyedException();
}
_allocations.insert(allocatable);
}
@@ -276,7 +276,7 @@ SessionI::removeAllocation(const AllocatablePtr& allocatable)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
_allocations.erase(allocatable);
}
@@ -294,27 +294,27 @@ SessionI::destroyImpl(bool shutdown)
for(set<AllocationRequestPtr>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
{
- (*p)->cancel(AllocationException("session destroyed"));
+ (*p)->cancel(AllocationException("session destroyed"));
}
_requests.clear();
for(set<AllocatablePtr>::const_iterator q = _allocations.begin(); q != _allocations.end(); ++q)
{
- try
- {
- (*q)->release(this);
- }
- catch(const AllocationException&)
- {
- }
+ try
+ {
+ (*q)->release(this);
+ }
+ catch(const AllocationException&)
+ {
+ }
}
_allocations.clear();
}
ClientSessionFactory::ClientSessionFactory(const Ice::ObjectAdapterPtr& adapter,
- const DatabasePtr& database,
- const WaitQueuePtr& waitQueue,
- const ReapThreadPtr& reaper) :
+ const DatabasePtr& database,
+ const WaitQueuePtr& waitQueue,
+ const ReapThreadPtr& reaper) :
_adapter(adapter),
_database(database),
_waitQueue(waitQueue),
@@ -341,21 +341,21 @@ ClientSessionFactory::createGlacier2Session(const string& sessionId, const Glaci
int timeout = 0;
if(ctl)
{
- try
- {
- ctl->identities()->add(ids);
- }
- catch(const Ice::LocalException&)
- {
- session->destroy(Ice::Current());
- return 0;
- }
- timeout = ctl->getSessionTimeout();
+ try
+ {
+ ctl->identities()->add(ids);
+ }
+ catch(const Ice::LocalException&)
+ {
+ session->destroy(Ice::Current());
+ return 0;
+ }
+ timeout = ctl->getSessionTimeout();
}
if(timeout > 0)
{
- _reaper->add(new SessionReapable<SessionI>(_database->getTraceLevels()->logger, session), timeout);
+ _reaper->add(new SessionReapable<SessionI>(_database->getTraceLevels()->logger, session), timeout);
}
return Glacier2::SessionPrx::uncheckedCast(proxy);
@@ -389,26 +389,26 @@ ClientSSLSessionManagerI::ClientSSLSessionManagerI(const ClientSessionFactoryPtr
Glacier2::SessionPrx
ClientSSLSessionManagerI::create(const Glacier2::SSLInfo& info,
- const Glacier2::SessionControlPrx& ctl,
- const Ice::Current& current)
+ const Glacier2::SessionControlPrx& ctl,
+ const Ice::Current& current)
{
string userDN;
if(!info.certs.empty()) // TODO: Require userDN?
{
- try
- {
- IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
- userDN = cert->getSubjectDN();
- }
- catch(const Ice::Exception& ex)
- {
- // This shouldn't happen, the SSLInfo is supposed to be encoded by Glacier2.
- Ice::Error out(_factory->getTraceLevels()->logger);
- out << "SSL session manager couldn't decode SSL certificates:\n" << ex;
- return 0;
- }
+ try
+ {
+ IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
+ userDN = cert->getSubjectDN();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ // This shouldn't happen, the SSLInfo is supposed to be encoded by Glacier2.
+ Ice::Error out(_factory->getTraceLevels()->logger);
+ out << "SSL session manager couldn't decode SSL certificates:\n" << ex;
+ return 0;
+ }
}
-
+
return _factory->createGlacier2Session(userDN, ctl);
}
diff --git a/cpp/src/IceGrid/SessionI.h b/cpp/src/IceGrid/SessionI.h
index 8d6d702ec91..9dbb5666b83 100644
--- a/cpp/src/IceGrid/SessionI.h
+++ b/cpp/src/IceGrid/SessionI.h
@@ -86,9 +86,9 @@ public:
virtual void keepAlive(const Ice::Current& current) { BaseSessionI::keepAlive(current); }
virtual void allocateObjectById_async(const AMD_Session_allocateObjectByIdPtr&, const Ice::Identity&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void allocateObjectByType_async(const AMD_Session_allocateObjectByTypePtr&, const std::string&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void releaseObject(const Ice::Identity&, const Ice::Current&);
virtual void setAllocationTimeout(int, const Ice::Current&);
virtual void destroy(const Ice::Current&);
@@ -154,7 +154,7 @@ public:
ClientSSLSessionManagerI(const ClientSessionFactoryPtr&);
virtual Glacier2::SessionPrx create(const Glacier2::SSLInfo&, const Glacier2::SessionControlPrx&,
- const Ice::Current&);
+ const Ice::Current&);
private:
diff --git a/cpp/src/IceGrid/SessionManager.h b/cpp/src/IceGrid/SessionManager.h
index c72924dbc53..7ce8ba23b0b 100644
--- a/cpp/src/IceGrid/SessionManager.h
+++ b/cpp/src/IceGrid/SessionManager.h
@@ -26,245 +26,245 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
{
enum State
{
- Disconnected,
- Connected,
- InProgress,
- Destroyed
+ Disconnected,
+ Connected,
+ InProgress,
+ Destroyed
};
enum Action
{
- Connect,
- Disconnect,
- KeepAlive,
- None
+ Connect,
+ Disconnect,
+ KeepAlive,
+ None
};
public:
SessionKeepAliveThread(const InternalRegistryPrx& registry) :
- _registry(registry),
- _state(InProgress),
- _nextAction(None)
+ _registry(registry),
+ _state(InProgress),
+ _nextAction(None)
{
}
virtual void
run()
{
- TPrx session;
- InternalRegistryPrx registry;
- IceUtil::Time timeout = IceUtil::Time::seconds(15);
- Action action = Connect;
+ TPrx session;
+ InternalRegistryPrx registry;
+ IceUtil::Time timeout = IceUtil::Time::seconds(15);
+ Action action = Connect;
- while(true)
- {
- {
- Lock sync(*this);
- if(_state == Destroyed)
- {
- break;
- }
+ while(true)
+ {
+ {
+ Lock sync(*this);
+ if(_state == Destroyed)
+ {
+ break;
+ }
- //
- // Update the current state.
- //
- assert(_state == InProgress);
- _state = session ? Connected : Disconnected;
- _session = session;
- if(_session)
- {
- _registry = registry;
- }
+ //
+ // Update the current state.
+ //
+ assert(_state == InProgress);
+ _state = session ? Connected : Disconnected;
+ _session = session;
+ if(_session)
+ {
+ _registry = registry;
+ }
- if(_nextAction == Connect && _state == Connected)
- {
- _nextAction = KeepAlive;
- }
- else if(_nextAction == Disconnect && _state == Disconnected)
- {
- _nextAction = None;
- }
- else if(_nextAction == KeepAlive && _state == Disconnected)
- {
- _nextAction = Connect;
- }
- notifyAll();
+ if(_nextAction == Connect && _state == Connected)
+ {
+ _nextAction = KeepAlive;
+ }
+ else if(_nextAction == Disconnect && _state == Disconnected)
+ {
+ _nextAction = None;
+ }
+ else if(_nextAction == KeepAlive && _state == Disconnected)
+ {
+ _nextAction = Connect;
+ }
+ notifyAll();
- //
- // Wait if there's nothing to do and if we are
- // connected or if we've just tried to connect.
- //
- if(_nextAction == None)
- {
- if(_state == Connected || action == Connect || action == KeepAlive)
- {
- IceUtil::Time wakeTime = IceUtil::Time::now() + timeout;
- while(_state != Destroyed && _nextAction == None)
- {
- if(!timedWait(wakeTime - IceUtil::Time::now()))
- {
- break;
- }
- }
- }
- if(_nextAction == None)
- {
- _nextAction = session ? KeepAlive : Connect;
- }
- }
+ //
+ // Wait if there's nothing to do and if we are
+ // connected or if we've just tried to connect.
+ //
+ if(_nextAction == None)
+ {
+ if(_state == Connected || action == Connect || action == KeepAlive)
+ {
+ IceUtil::Time wakeTime = IceUtil::Time::now() + timeout;
+ while(_state != Destroyed && _nextAction == None)
+ {
+ if(!timedWait(wakeTime - IceUtil::Time::now()))
+ {
+ break;
+ }
+ }
+ }
+ if(_nextAction == None)
+ {
+ _nextAction = session ? KeepAlive : Connect;
+ }
+ }
- if(_state == Destroyed)
- {
- break;
- }
-
- assert(_nextAction != None);
-
- action = _nextAction;
- registry = InternalRegistryPrx::uncheckedCast(
- _registry->ice_timeout(static_cast<int>(timeout.toMilliSeconds())));
- _nextAction = None;
- _state = InProgress;
- notifyAll();
- }
+ if(_state == Destroyed)
+ {
+ break;
+ }
+
+ assert(_nextAction != None);
+
+ action = _nextAction;
+ registry = InternalRegistryPrx::uncheckedCast(
+ _registry->ice_timeout(static_cast<int>(timeout.toMilliSeconds())));
+ _nextAction = None;
+ _state = InProgress;
+ notifyAll();
+ }
- switch(action)
- {
- case Connect:
- assert(!session);
- session = createSession(registry, timeout);
- break;
- case Disconnect:
- assert(session);
- destroySession(session);
- session = 0;
- break;
- case KeepAlive:
- assert(session);
- if(!keepAlive(session))
- {
- session = createSession(registry, timeout);
- }
- break;
- case None:
- default:
- assert(false);
- }
- }
-
- //
- // Destroy the session.
- //
- if(_nextAction == Disconnect && session)
- {
- destroySession(session);
- }
+ switch(action)
+ {
+ case Connect:
+ assert(!session);
+ session = createSession(registry, timeout);
+ break;
+ case Disconnect:
+ assert(session);
+ destroySession(session);
+ session = 0;
+ break;
+ case KeepAlive:
+ assert(session);
+ if(!keepAlive(session))
+ {
+ session = createSession(registry, timeout);
+ }
+ break;
+ case None:
+ default:
+ assert(false);
+ }
+ }
+
+ //
+ // Destroy the session.
+ //
+ if(_nextAction == Disconnect && session)
+ {
+ destroySession(session);
+ }
}
virtual bool
waitForCreate()
{
- Lock sync(*this);
- while(_state != Destroyed && _state != Connected)
- {
- wait();
- }
- return _state != Destroyed;
+ Lock sync(*this);
+ while(_state != Destroyed && _state != Connected)
+ {
+ wait();
+ }
+ return _state != Destroyed;
}
virtual void
tryCreateSession(bool waitForTry = true)
{
- {
- Lock sync(*this);
- if(_state == Destroyed)
- {
- return;
- }
+ {
+ Lock sync(*this);
+ if(_state == Destroyed)
+ {
+ return;
+ }
- if(_state == Connected)
- {
- _nextAction = KeepAlive;
- }
- else
- {
- _nextAction = Connect;
- }
- notifyAll();
- }
+ if(_state == Connected)
+ {
+ _nextAction = KeepAlive;
+ }
+ else
+ {
+ _nextAction = Connect;
+ }
+ notifyAll();
+ }
- if(waitForTry)
- {
- Lock sync(*this);
- // Wait until the action is executed and the state changes.
- while(_nextAction == Connect || _nextAction == KeepAlive || _state == InProgress)
- {
- wait();
- }
- }
+ if(waitForTry)
+ {
+ Lock sync(*this);
+ // Wait until the action is executed and the state changes.
+ while(_nextAction == Connect || _nextAction == KeepAlive || _state == InProgress)
+ {
+ wait();
+ }
+ }
}
void
destroyActiveSession()
{
- Lock sync(*this);
- if(_state == Destroyed || _state == Disconnected)
- {
- return;
- }
- _nextAction = Disconnect;
- notifyAll();
+ Lock sync(*this);
+ if(_state == Destroyed || _state == Disconnected)
+ {
+ return;
+ }
+ _nextAction = Disconnect;
+ notifyAll();
}
bool
terminateIfDisconnected()
{
- Lock sync(*this);
- if(_state != Disconnected)
- {
- return false; // Nothing we can do for now.
- }
- assert(_state != Destroyed);
- _state = Destroyed;
- _nextAction = None;
- notifyAll();
- return true;
+ Lock sync(*this);
+ if(_state != Disconnected)
+ {
+ return false; // Nothing we can do for now.
+ }
+ assert(_state != Destroyed);
+ _state = Destroyed;
+ _nextAction = None;
+ notifyAll();
+ return true;
}
void
terminate(bool destroySession = true)
{
- Lock sync(*this);
- if(_state == Destroyed)
- {
- return;
- }
- assert(_state != Destroyed);
- _state = Destroyed;
- _nextAction = destroySession ? Disconnect : None;
- notifyAll();
+ Lock sync(*this);
+ if(_state == Destroyed)
+ {
+ return;
+ }
+ assert(_state != Destroyed);
+ _state = Destroyed;
+ _nextAction = destroySession ? Disconnect : None;
+ notifyAll();
}
TPrx
getSession()
{
- Lock sync(*this);
- return _session;
+ Lock sync(*this);
+ return _session;
}
void
setRegistry(const InternalRegistryPrx& registry)
{
- Lock sync(*this);
- _registry = registry;
+ Lock sync(*this);
+ _registry = registry;
}
InternalRegistryPrx
getRegistry() const
{
- Lock sync(*this);
- return _registry;
+ Lock sync(*this);
+ return _registry;
}
virtual TPrx createSession(InternalRegistryPrx&, IceUtil::Time&) = 0;
diff --git a/cpp/src/IceGrid/SessionServantLocatorI.cpp b/cpp/src/IceGrid/SessionServantLocatorI.cpp
index caebd2890a8..3e37cda4802 100644
--- a/cpp/src/IceGrid/SessionServantLocatorI.cpp
+++ b/cpp/src/IceGrid/SessionServantLocatorI.cpp
@@ -28,7 +28,7 @@ SessionServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr&
map<Ice::Identity, SessionServant>::const_iterator p = _servants.find(current.id);
if(p == _servants.end() || p->second.connection != current.con)
{
- return 0;
+ return 0;
}
return p->second.servant;
}
@@ -54,7 +54,7 @@ SessionServantLocatorI::add(const Ice::ObjectPtr& servant, const Ice::Connection
id.category = _instanceName;
if(!_servants.insert(make_pair(id, SessionServant(servant, con))).second)
{
- throw Ice::AlreadyRegisteredException(__FILE__, __LINE__, "servant", id.name);
+ throw Ice::AlreadyRegisteredException(__FILE__, __LINE__, "servant", id.name);
}
return _adapter->createProxy(id);
}
diff --git a/cpp/src/IceGrid/SessionServantLocatorI.h b/cpp/src/IceGrid/SessionServantLocatorI.h
index 5dd51f1a2c6..3385a1233db 100644
--- a/cpp/src/IceGrid/SessionServantLocatorI.h
+++ b/cpp/src/IceGrid/SessionServantLocatorI.h
@@ -33,10 +33,10 @@ private:
struct SessionServant
{
- SessionServant(const Ice::ObjectPtr& s, const Ice::ConnectionPtr& con) : servant(s), connection(con) { }
+ SessionServant(const Ice::ObjectPtr& s, const Ice::ConnectionPtr& con) : servant(s), connection(con) { }
- const Ice::ObjectPtr servant;
- const Ice::ConnectionPtr connection;
+ const Ice::ObjectPtr servant;
+ const Ice::ConnectionPtr connection;
};
const Ice::ObjectAdapterPtr _adapter;
diff --git a/cpp/src/IceGrid/Topics.cpp b/cpp/src/IceGrid/Topics.cpp
index 546729cf464..51da20ee1ad 100644
--- a/cpp/src/IceGrid/Topics.cpp
+++ b/cpp/src/IceGrid/Topics.cpp
@@ -22,11 +22,11 @@ ObserverTopic::ObserverTopic(const IceStorm::TopicManagerPrx& topicManager, cons
IceStorm::TopicPrx t;
try
{
- t = topicManager->create(name);
+ t = topicManager->create(name);
}
catch(const IceStorm::TopicExists&)
{
- t = topicManager->retrieve(name);
+ t = topicManager->retrieve(name);
}
//
@@ -48,7 +48,7 @@ ObserverTopic::subscribe(const Ice::ObjectPrx& obsv, const string& name)
Lock sync(*this);
if(!_topic)
{
- return;
+ return;
}
assert(obsv);
@@ -60,15 +60,15 @@ ObserverTopic::subscribe(const Ice::ObjectPrx& obsv, const string& name)
}
catch(const IceStorm::AlreadySubscribed&)
{
- throw ObserverAlreadyRegisteredException(obsv->ice_getIdentity());
+ throw ObserverAlreadyRegisteredException(obsv->ice_getIdentity());
}
if(!name.empty())
{
- assert(_syncSubscribers.find(name) == _syncSubscribers.end());
- _syncSubscribers.insert(name);
- addExpectedUpdate(_serial, name);
- waitForSyncedSubscribersNoSync(_serial, name);
+ assert(_syncSubscribers.find(name) == _syncSubscribers.end());
+ _syncSubscribers.insert(name);
+ addExpectedUpdate(_serial, name);
+ waitForSyncedSubscribersNoSync(_serial, name);
}
}
@@ -78,36 +78,36 @@ ObserverTopic::unsubscribe(const Ice::ObjectPrx& observer, const string& name)
Lock sync(*this);
if(_topic)
{
- _topic->unsubscribe(observer);
+ _topic->unsubscribe(observer);
}
assert(observer);
if(!name.empty())
{
- assert(_syncSubscribers.find(name) != _syncSubscribers.end());
- _syncSubscribers.erase(name);
-
- map<int, set<string> >::iterator p = _waitForUpdates.begin();
- bool notifyMonitor = false;
- while(p != _waitForUpdates.end())
- {
- p->second.erase(name);
- if(p->second.empty())
- {
- _waitForUpdates.erase(p++);
- notifyMonitor = true;
- }
- else
- {
- ++p;
- }
- }
+ assert(_syncSubscribers.find(name) != _syncSubscribers.end());
+ _syncSubscribers.erase(name);
+
+ map<int, set<string> >::iterator p = _waitForUpdates.begin();
+ bool notifyMonitor = false;
+ while(p != _waitForUpdates.end())
+ {
+ p->second.erase(name);
+ if(p->second.empty())
+ {
+ _waitForUpdates.erase(p++);
+ notifyMonitor = true;
+ }
+ else
+ {
+ ++p;
+ }
+ }
- if(notifyMonitor)
- {
- notifyAll();
- }
+ if(notifyMonitor)
+ {
+ notifyAll();
+ }
}
}
@@ -126,24 +126,24 @@ ObserverTopic::receivedUpdate(const string& name, int serial, const string& fail
map<int, set<string> >::iterator p = _waitForUpdates.find(serial);
if(p != _waitForUpdates.end())
{
- p->second.erase(name);
-
- if(!failure.empty())
- {
- map<int, map<string, string> >::iterator q = _updateFailures.find(serial);
- if(q == _updateFailures.end())
- {
- q = _updateFailures.insert(make_pair(serial, map<string ,string>())).first;
- }
- q->second.insert(make_pair(name, failure));
- }
+ p->second.erase(name);
+
+ if(!failure.empty())
+ {
+ map<int, map<string, string> >::iterator q = _updateFailures.find(serial);
+ if(q == _updateFailures.end())
+ {
+ q = _updateFailures.insert(make_pair(serial, map<string ,string>())).first;
+ }
+ q->second.insert(make_pair(name, failure));
+ }
- if(p->second.empty())
- {
- _waitForUpdates.erase(p);
- }
+ if(p->second.empty())
+ {
+ _waitForUpdates.erase(p);
+ }
- notifyAll();
+ notifyAll();
}
}
@@ -159,18 +159,18 @@ ObserverTopic::addExpectedUpdate(int serial, const string& name)
{
if(_syncSubscribers.empty() && name.empty())
{
- return;
+ return;
}
// Must be called with the lock held.
if(name.empty())
{
- assert(_waitForUpdates[serial].empty());
- _waitForUpdates[serial] = _syncSubscribers;
+ assert(_waitForUpdates[serial].empty());
+ _waitForUpdates[serial] = _syncSubscribers;
}
else
{
- _waitForUpdates[serial].insert(name);
+ _waitForUpdates[serial].insert(name);
}
}
@@ -179,7 +179,7 @@ ObserverTopic::waitForSyncedSubscribersNoSync(int serial, const string& name)
{
if(serial < 0)
{
- return;
+ return;
}
//
@@ -187,33 +187,33 @@ ObserverTopic::waitForSyncedSubscribersNoSync(int serial, const string& name)
//
while(true)
{
- map<int, set<string> >::const_iterator p = _waitForUpdates.find(serial);
- if(p == _waitForUpdates.end())
- {
- map<int, map<string, string> >::iterator q = _updateFailures.find(serial);
- if(q != _updateFailures.end())
- {
- map<string, string> failures = q->second;
- _updateFailures.erase(q);
- ostringstream os;
- for(map<string, string>::const_iterator r = failures.begin(); r != failures.end(); ++r)
- {
- os << "replication failed on replica `" << r->first << "':\n" << r->second << "\n";
- }
-
- Ice::Error err(_logger);
- err << os.str();
- }
- return;
- }
- else
- {
- if(!name.empty() && p->second.find(name) == p->second.end())
- {
- return;
- }
- wait();
- }
+ map<int, set<string> >::const_iterator p = _waitForUpdates.find(serial);
+ if(p == _waitForUpdates.end())
+ {
+ map<int, map<string, string> >::iterator q = _updateFailures.find(serial);
+ if(q != _updateFailures.end())
+ {
+ map<string, string> failures = q->second;
+ _updateFailures.erase(q);
+ ostringstream os;
+ for(map<string, string>::const_iterator r = failures.begin(); r != failures.end(); ++r)
+ {
+ os << "replication failed on replica `" << r->first << "':\n" << r->second << "\n";
+ }
+
+ Ice::Error err(_logger);
+ err << os.str();
+ }
+ return;
+ }
+ else
+ {
+ if(!name.empty() && p->second.find(name) == p->second.end())
+ {
+ return;
+ }
+ wait();
+ }
}
}
@@ -247,18 +247,18 @@ RegistryObserverTopic::registryUp(const RegistryInfo& info)
Lock sync(*this);
if(!_topic)
{
- return;
+ return;
}
updateSerial(_serial + 1);
_registries.insert(make_pair(info.name, info));
try
{
- _publisher->registryUp(info);
+ _publisher->registryUp(info);
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `registryUp' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `registryUp' update:\n" << ex;
}
}
@@ -268,24 +268,24 @@ RegistryObserverTopic::registryDown(const string& name)
Lock sync(*this);
if(!_topic)
{
- return;
+ return;
}
if(_registries.find(name) == _registries.end())
{
- return;
+ return;
}
updateSerial(_serial + 1);
_registries.erase(name);
try
{
- _publisher->registryDown(name);
+ _publisher->registryDown(name);
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `registryDown' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `registryDown' update:\n" << ex;
}
}
@@ -297,19 +297,19 @@ RegistryObserverTopic::initObserver(const Ice::ObjectPrx& obsv)
registries.reserve(_registries.size());
for(map<string, RegistryInfo>::const_iterator p = _registries.begin(); p != _registries.end(); ++p)
{
- registries.push_back(p->second);
+ registries.push_back(p->second);
}
observer->registryInit(registries, getContext(_serial));
}
NodeObserverTopic::NodeObserverTopic(const IceStorm::TopicManagerPrx& topicManager,
- const Ice::ObjectAdapterPtr& adapter) :
+ const Ice::ObjectAdapterPtr& adapter) :
ObserverTopic(topicManager, "NodeObserver")
{
const_cast<NodeObserverPrx&>(_publisher) = NodeObserverPrx::uncheckedCast(_basePublisher);
try
{
- const_cast<NodeObserverPrx&>(_externalPublisher) = NodeObserverPrx::uncheckedCast(adapter->addWithUUID(this));
+ const_cast<NodeObserverPrx&>(_externalPublisher) = NodeObserverPrx::uncheckedCast(adapter->addWithUUID(this));
}
catch(const Ice::LocalException&)
{
@@ -328,18 +328,18 @@ NodeObserverTopic::nodeUp(const NodeDynamicInfo& info, const Ice::Current& curre
Lock sync(*this);
if(!_topic)
{
- return;
+ return;
}
updateSerial(_serial + 1);
_nodes.insert(make_pair(info.info.name, info));
try
{
- _publisher->nodeUp(info);
+ _publisher->nodeUp(info);
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing 'nodeUp' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing 'nodeUp' update:\n" << ex;
}
}
@@ -355,15 +355,15 @@ NodeObserverTopic::updateServer(const string& node, const ServerDynamicInfo& ser
Lock sync(*this);
if(!_topic)
{
- return;
+ return;
}
if(_nodes.find(node) == _nodes.end())
{
- //
- // If the node isn't known anymore, we ignore the update.
- //
- return;
+ //
+ // If the node isn't known anymore, we ignore the update.
+ //
+ return;
}
updateSerial(_serial + 1);
@@ -372,33 +372,33 @@ NodeObserverTopic::updateServer(const string& node, const ServerDynamicInfo& ser
ServerDynamicInfoSeq::iterator p = servers.begin();
while(p != servers.end())
{
- if(p->id == server.id)
- {
- if(server.state == Destroyed || (server.state == Inactive && server.enabled))
- {
- servers.erase(p);
- }
- else
- {
- *p = server;
- }
- break;
- }
- ++p;
+ if(p->id == server.id)
+ {
+ if(server.state == Destroyed || (server.state == Inactive && server.enabled))
+ {
+ servers.erase(p);
+ }
+ else
+ {
+ *p = server;
+ }
+ break;
+ }
+ ++p;
}
if(server.state != Destroyed && (server.state != Inactive || !server.enabled) && p == servers.end())
{
- servers.push_back(server);
+ servers.push_back(server);
}
try
{
- _publisher->updateServer(node, server);
+ _publisher->updateServer(node, server);
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `updateServer' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `updateServer' update:\n" << ex;
}
}
@@ -408,15 +408,15 @@ NodeObserverTopic::updateAdapter(const string& node, const AdapterDynamicInfo& a
Lock sync(*this);
if(!_topic)
{
- return;
+ return;
}
if(_nodes.find(node) == _nodes.end())
{
- //
- // If the node isn't known anymore, we ignore the update.
- //
- return;
+ //
+ // If the node isn't known anymore, we ignore the update.
+ //
+ return;
}
updateSerial(_serial + 1);
@@ -425,33 +425,33 @@ NodeObserverTopic::updateAdapter(const string& node, const AdapterDynamicInfo& a
AdapterDynamicInfoSeq::iterator p = adapters.begin();
while(p != adapters.end())
{
- if(p->id == adapter.id)
- {
- if(adapter.proxy)
- {
- *p = adapter;
- }
- else
- {
- adapters.erase(p);
- }
- break;
- }
- ++p;
+ if(p->id == adapter.id)
+ {
+ if(adapter.proxy)
+ {
+ *p = adapter;
+ }
+ else
+ {
+ adapters.erase(p);
+ }
+ break;
+ }
+ ++p;
}
if(adapter.proxy && p == adapters.end())
{
- adapters.push_back(adapter);
+ adapters.push_back(adapter);
}
try
{
- _publisher->updateAdapter(node, adapter);
+ _publisher->updateAdapter(node, adapter);
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `updateAdapter' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `updateAdapter' update:\n" << ex;
}
}
@@ -461,23 +461,23 @@ NodeObserverTopic::nodeDown(const string& name)
Lock sync(*this);
if(!_topic)
{
- return;
+ return;
}
updateSerial(_serial + 1);
if(_nodes.find(name) != _nodes.end())
{
- _nodes.erase(name);
- try
- {
- _publisher->nodeDown(name);
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `nodeDown' update:\n" << ex;
- }
+ _nodes.erase(name);
+ try
+ {
+ _publisher->nodeDown(name);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `nodeDown' update:\n" << ex;
+ }
}
}
@@ -489,13 +489,13 @@ NodeObserverTopic::initObserver(const Ice::ObjectPrx& obsv)
nodes.reserve(_nodes.size());
for(map<string, NodeDynamicInfo>::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p)
{
- nodes.push_back(p->second);
+ nodes.push_back(p->second);
}
observer->nodeInit(nodes, getContext(_serial));
}
ApplicationObserverTopic::ApplicationObserverTopic(const IceStorm::TopicManagerPrx& topicManager,
- const StringApplicationInfoDict& applications) :
+ const StringApplicationInfoDict& applications) :
ObserverTopic(topicManager, "ApplicationObserver")
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
,_applications(applications.begin(), applications.end())
@@ -504,7 +504,7 @@ ApplicationObserverTopic::ApplicationObserverTopic(const IceStorm::TopicManagerP
#ifdef _RWSTD_NO_MEMBER_TEMPLATES
for(StringApplicationInfoDict::const_iterator p = applications.begin(); p != applications.end(); ++p)
{
- _applications[p->first] = p->second;
+ _applications[p->first] = p->second;
}
#endif
@@ -517,22 +517,22 @@ ApplicationObserverTopic::applicationInit(int serial, const ApplicationInfoSeq&
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(serial);
_applications.clear();
for(ApplicationInfoSeq::const_iterator p = apps.begin(); p != apps.end(); ++p)
{
- _applications.insert(make_pair(p->descriptor.name, *p));
+ _applications.insert(make_pair(p->descriptor.name, *p));
}
try
{
- _publisher->applicationInit(serial, apps, getContext(serial));
+ _publisher->applicationInit(serial, apps, getContext(serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `applicationInit' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `applicationInit' update:\n" << ex;
}
addExpectedUpdate(serial);
return serial;
@@ -544,19 +544,19 @@ ApplicationObserverTopic::applicationAdded(int serial, const ApplicationInfo& in
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(serial);
_applications.insert(make_pair(info.descriptor.name, info));
try
{
- _publisher->applicationAdded(serial, info, getContext(serial));
+ _publisher->applicationAdded(serial, info, getContext(serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `applicationAdded' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `applicationAdded' update:\n" << ex;
}
addExpectedUpdate(serial);
return serial;
@@ -568,18 +568,18 @@ ApplicationObserverTopic::applicationRemoved(int serial, const string& name)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(serial);
_applications.erase(name);
try
{
- _publisher->applicationRemoved(serial, name, getContext(serial));
+ _publisher->applicationRemoved(serial, name, getContext(serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `applicationRemoved' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `applicationRemoved' update:\n" << ex;
}
addExpectedUpdate(serial);
return serial;
@@ -591,49 +591,49 @@ ApplicationObserverTopic::applicationUpdated(int serial, const ApplicationUpdate
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(serial);
try
{
- map<string, ApplicationInfo>::iterator p = _applications.find(info.descriptor.name);
- if(p != _applications.end())
- {
- ApplicationHelper helper(_publisher->ice_getCommunicator(), p->second.descriptor);
- p->second.descriptor = helper.update(info.descriptor);
- p->second.updateTime = info.updateTime;
- p->second.updateUser = info.updateUser;
- p->second.revision = info.revision;
- }
+ map<string, ApplicationInfo>::iterator p = _applications.find(info.descriptor.name);
+ if(p != _applications.end())
+ {
+ ApplicationHelper helper(_publisher->ice_getCommunicator(), p->second.descriptor);
+ p->second.descriptor = helper.update(info.descriptor);
+ p->second.updateTime = info.updateTime;
+ p->second.updateUser = info.updateUser;
+ p->second.revision = info.revision;
+ }
}
catch(const DeploymentException& ex)
{
- cerr << ex.reason << endl;
- assert(false);
+ cerr << ex.reason << endl;
+ assert(false);
}
catch(const std::string& msg)
{
- cerr << msg << endl;
- assert(false);
+ cerr << msg << endl;
+ assert(false);
}
catch(const char* msg)
{
- cerr << msg << endl;
- assert(false);
+ cerr << msg << endl;
+ assert(false);
}
catch(...)
{
- assert(false);
+ assert(false);
}
try
{
- _publisher->applicationUpdated(serial, info, getContext(serial));
+ _publisher->applicationUpdated(serial, info, getContext(serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `applicationUpdated' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `applicationUpdated' update:\n" << ex;
}
addExpectedUpdate(serial);
return serial;
@@ -646,13 +646,13 @@ ApplicationObserverTopic::initObserver(const Ice::ObjectPrx& obsv)
ApplicationInfoSeq applications;
for(map<string, ApplicationInfo>::const_iterator p = _applications.begin(); p != _applications.end(); ++p)
{
- applications.push_back(p->second);
+ applications.push_back(p->second);
}
observer->applicationInit(_serial, applications, getContext(_serial));
}
AdapterObserverTopic::AdapterObserverTopic(const IceStorm::TopicManagerPrx& topicManager,
- const StringAdapterInfoDict& adapters) :
+ const StringAdapterInfoDict& adapters) :
ObserverTopic(topicManager, "AdapterObserver")
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
, _adapters(adapters.begin(), adapters.end())
@@ -674,22 +674,22 @@ AdapterObserverTopic::adapterInit(const AdapterInfoSeq& adpts)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_adapters.clear();
for(AdapterInfoSeq::const_iterator q = adpts.begin(); q != adpts.end(); ++q)
{
- _adapters.insert(make_pair(q->id, *q));
+ _adapters.insert(make_pair(q->id, *q));
}
try
{
- _publisher->adapterInit(adpts, getContext(_serial));
+ _publisher->adapterInit(adpts, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `adapterInit' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `adapterInit' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -701,18 +701,18 @@ AdapterObserverTopic::adapterAdded(const AdapterInfo& info)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_adapters.insert(make_pair(info.id, info));
try
{
- _publisher->adapterAdded(info, getContext(_serial));
+ _publisher->adapterAdded(info, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `adapterAdded' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `adapterAdded' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -724,18 +724,18 @@ AdapterObserverTopic::adapterUpdated(const AdapterInfo& info)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_adapters[info.id] = info;
try
{
- _publisher->adapterUpdated(info, getContext(_serial));
+ _publisher->adapterUpdated(info, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `adapterUpdated' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `adapterUpdated' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -747,18 +747,18 @@ AdapterObserverTopic::adapterRemoved(const string& id)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_adapters.erase(id);
try
{
- _publisher->adapterRemoved(id, getContext(_serial));
+ _publisher->adapterRemoved(id, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `adapterRemoved' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `adapterRemoved' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -771,13 +771,13 @@ AdapterObserverTopic::initObserver(const Ice::ObjectPrx& obsv)
AdapterInfoSeq adapters;
for(map<string, AdapterInfo>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
- adapters.push_back(p->second);
- }
+ adapters.push_back(p->second);
+ }
observer->adapterInit(adapters, getContext(_serial));
}
ObjectObserverTopic::ObjectObserverTopic(const IceStorm::TopicManagerPrx& topicManager,
- const IdentityObjectInfoDict& objects) :
+ const IdentityObjectInfoDict& objects) :
ObserverTopic(topicManager, "ObjectObserver")
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
, _objects(objects.begin(), objects.end())
@@ -799,22 +799,22 @@ ObjectObserverTopic::objectInit(const ObjectInfoSeq& objects)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_objects.clear();
for(ObjectInfoSeq::const_iterator r = objects.begin(); r != objects.end(); ++r)
{
- _objects.insert(make_pair(r->proxy->ice_getIdentity(), *r));
+ _objects.insert(make_pair(r->proxy->ice_getIdentity(), *r));
}
try
{
- _publisher->objectInit(objects, getContext(_serial));
+ _publisher->objectInit(objects, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `objectInit' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `objectInit' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -826,18 +826,18 @@ ObjectObserverTopic::objectAdded(const ObjectInfo& info)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_objects.insert(make_pair(info.proxy->ice_getIdentity(), info));
try
{
- _publisher->objectAdded(info, getContext(_serial));
+ _publisher->objectAdded(info, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `objectAdded' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `objectAdded' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -849,18 +849,18 @@ ObjectObserverTopic::objectUpdated(const ObjectInfo& info)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_objects[info.proxy->ice_getIdentity()] = info;
try
{
- _publisher->objectUpdated(info, getContext(_serial));
+ _publisher->objectUpdated(info, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `objectUpdated' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `objectUpdated' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -872,18 +872,18 @@ ObjectObserverTopic::objectRemoved(const Ice::Identity& id)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
_objects.erase(id);
try
{
- _publisher->objectRemoved(id, getContext(_serial));
+ _publisher->objectRemoved(id, getContext(_serial));
}
catch(const Ice::LocalException& ex)
{
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `objectRemoved' update:\n" << ex;
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `objectRemoved' update:\n" << ex;
}
addExpectedUpdate(_serial);
return _serial;
@@ -895,39 +895,39 @@ ObjectObserverTopic::objectsAddedOrUpdated(const ObjectInfoSeq& infos)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
for(ObjectInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p)
{
- map<Ice::Identity, ObjectInfo>::iterator q = _objects.find(p->proxy->ice_getIdentity());
- if(q != _objects.end())
- {
- q->second = *p;
- try
- {
- _publisher->objectUpdated(*p, getContext(_serial));
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `objectUpdated' update:\n" << ex;
- }
- }
- else
- {
- _objects.insert(make_pair(p->proxy->ice_getIdentity(), *p));
- try
- {
- _publisher->objectAdded(*p, getContext(_serial));
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `objectAdded' update:\n" << ex;
- }
- }
+ map<Ice::Identity, ObjectInfo>::iterator q = _objects.find(p->proxy->ice_getIdentity());
+ if(q != _objects.end())
+ {
+ q->second = *p;
+ try
+ {
+ _publisher->objectUpdated(*p, getContext(_serial));
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `objectUpdated' update:\n" << ex;
+ }
+ }
+ else
+ {
+ _objects.insert(make_pair(p->proxy->ice_getIdentity(), *p));
+ try
+ {
+ _publisher->objectAdded(*p, getContext(_serial));
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `objectAdded' update:\n" << ex;
+ }
+ }
}
//
@@ -945,22 +945,22 @@ ObjectObserverTopic::objectsRemoved(const ObjectInfoSeq& infos)
Lock sync(*this);
if(!_topic)
{
- return -1;
+ return -1;
}
updateSerial(_serial + 1);
for(ObjectInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p)
{
- _objects.erase(p->proxy->ice_getIdentity());
- try
- {
- _publisher->objectRemoved(p->proxy->ice_getIdentity(), getContext(_serial));
- }
- catch(const Ice::LocalException& ex)
- {
- Ice::Warning out(_logger);
- out << "unexpected exception while publishing `objectUpdated' update:\n" << ex;
- }
+ _objects.erase(p->proxy->ice_getIdentity());
+ try
+ {
+ _publisher->objectRemoved(p->proxy->ice_getIdentity(), getContext(_serial));
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ Ice::Warning out(_logger);
+ out << "unexpected exception while publishing `objectUpdated' update:\n" << ex;
+ }
}
//
@@ -980,7 +980,7 @@ ObjectObserverTopic::initObserver(const Ice::ObjectPrx& obsv)
ObjectInfoSeq objects;
for(map<Ice::Identity, ObjectInfo>::const_iterator p = _objects.begin(); p != _objects.end(); ++p)
{
- objects.push_back(p->second);
+ objects.push_back(p->second);
}
observer->objectInit(objects, getContext(_serial));
}
diff --git a/cpp/src/IceGrid/Util.cpp b/cpp/src/IceGrid/Util.cpp
index 2a36351e916..f955fe69e4c 100644
--- a/cpp/src/IceGrid/Util.cpp
+++ b/cpp/src/IceGrid/Util.cpp
@@ -24,12 +24,12 @@ IceGrid::toString(const vector<string>& v, const string& sep)
Ice::StringSeq::const_iterator p = v.begin();
while(p != v.end())
{
- os << *p;
- ++p;
- if(p != v.end())
- {
- os << sep;
- }
+ os << *p;
+ ++p;
+ if(p != v.end())
+ {
+ os << sep;
+ }
}
return os.str();
}
@@ -40,22 +40,22 @@ IceGrid::toString(const Ice::Exception& exception)
std::ostringstream os;
try
{
- exception.ice_throw();
+ exception.ice_throw();
}
catch(const NodeUnreachableException& ex)
{
- os << ex << ":";
- os << "\nnode: " << ex.name;
- os << "\nreason: " << ex.reason;
+ os << ex << ":";
+ os << "\nnode: " << ex.name;
+ os << "\nreason: " << ex.reason;
}
catch(const DeploymentException& ex)
{
- os << ex << ":";
- os << "\nreason: " << ex.reason;
+ os << ex << ":";
+ os << "\nreason: " << ex.reason;
}
catch(const Ice::Exception& ex)
{
- os << ex;
+ os << ex;
}
return os.str();
}
@@ -65,10 +65,10 @@ IceGrid::getProperty(const PropertyDescriptorSeq& properties, const string& name
{
for(PropertyDescriptorSeq::const_iterator q = properties.begin(); q != properties.end(); ++q)
{
- if(q->name == name)
- {
- return q->value;
- }
+ if(q->name == name)
+ {
+ return q->value;
+ }
}
return def;
}
@@ -97,23 +97,23 @@ IceGrid::getMMVersion(const string& o)
if(minorPos != 1 && minorPos != 2)
{
- return -1;
+ return -1;
}
if(patchPos != string::npos)
{
- if((minorPos == 1 && patchPos != 3 && patchPos != 4) || (minorPos == 2 && patchPos != 4 && patchPos != 5))
- {
- return -1;
- }
- else if((version.size() - patchPos - 1) > 2)
- {
- return -1;
- }
+ if((minorPos == 1 && patchPos != 3 && patchPos != 4) || (minorPos == 2 && patchPos != 4 && patchPos != 5))
+ {
+ return -1;
+ }
+ else if((version.size() - patchPos - 1) > 2)
+ {
+ return -1;
+ }
}
else if((version.size() - minorPos - 1) > 2)
{
- return -1;
+ return -1;
}
int v, ver;
@@ -122,7 +122,7 @@ IceGrid::getMMVersion(const string& o)
major >> v;
if(major.fail() || v > 99 || v < 1)
{
- return -1;
+ return -1;
}
ver = v;
ver *= 100;
@@ -131,7 +131,7 @@ IceGrid::getMMVersion(const string& o)
minor >> v;
if(minor.fail() || v > 99 || v < 0)
{
- return -1;
+ return -1;
}
ver += v;
ver *= 100;
@@ -142,13 +142,13 @@ IceGrid::getMMVersion(const string& o)
//
// if(patchPos != string::npos)
// {
-// istringstream patch(version.substr(patchPos + 1));
-// patch >> v;
-// if(patch.fail() || v > 99 || v < 0)
-// {
-// return -1;
-// }
-// ver += v;
+// istringstream patch(version.substr(patchPos + 1));
+// patch >> v;
+// if(patch.fail() || v > 99 || v < 0)
+// {
+// return -1;
+// }
+// ver += v;
// }
return ver;
diff --git a/cpp/src/IceGrid/Util.h b/cpp/src/IceGrid/Util.h
index b3a2d7839dd..918ac4011a9 100644
--- a/cpp/src/IceGrid/Util.h
+++ b/cpp/src/IceGrid/Util.h
@@ -56,19 +56,19 @@ struct ForEachCommunicator : std::unary_function<CommunicatorDescriptorPtr&, voi
void
operator()(const ServiceInstanceDescriptor& descriptor)
{
- assert(descriptor.descriptor);
- operator()(descriptor.descriptor);
+ assert(descriptor.descriptor);
+ operator()(descriptor.descriptor);
}
void
operator()(const CommunicatorDescriptorPtr& descriptor)
{
- _function(descriptor);
- IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(descriptor);
- if(iceBox)
- {
- for_each(iceBox->services.begin(), iceBox->services.end(), forEachCommunicator(_function));
- }
+ _function(descriptor);
+ IceBoxDescriptorPtr iceBox = IceBoxDescriptorPtr::dynamicCast(descriptor);
+ if(iceBox)
+ {
+ for_each(iceBox->services.begin(), iceBox->services.end(), forEachCommunicator(_function));
+ }
}
Function _function;
@@ -92,7 +92,7 @@ public:
explicit ObjFunc(T& obj, void (T::*f)(A)) : _obj(obj), _mfn(f) { }
void operator()(A arg) const
{
- (_obj.*_mfn)(arg);
+ (_obj.*_mfn)(arg);
}
};
@@ -108,10 +108,10 @@ inline getMatchingKeys(const T& m, const std::string& expression)
std::vector<std::string> keys;
for(typename T::const_iterator p = m.begin(); p != m.end(); ++p)
{
- if(expression.empty() || IceUtil::match(p->first, expression, true))
- {
- keys.push_back(p->first);
- }
+ if(expression.empty() || IceUtil::match(p->first, expression, true))
+ {
+ keys.push_back(p->first);
+ }
}
return keys;
}
diff --git a/cpp/src/IceGrid/WaitQueue.cpp b/cpp/src/IceGrid/WaitQueue.cpp
index 24b7d9ccfba..06e18766558 100644
--- a/cpp/src/IceGrid/WaitQueue.cpp
+++ b/cpp/src/IceGrid/WaitQueue.cpp
@@ -42,74 +42,74 @@ WaitQueue::run()
{
while(true)
{
- list<WaitItemPtr> expired;
- {
- Lock sync(*this);
- if(_waitQueue.empty() && !_destroyed)
- {
- wait();
- }
-
- if(_destroyed)
- {
- break;
- }
-
- //
- // Notify expired items.
- //
- while(!_waitQueue.empty() && !_destroyed)
- {
- WaitItemPtr item = _waitQueue.front();
- if(item->getExpirationTime() <= IceUtil::Time::now())
- {
- expired.push_back(item);
- _waitQueue.pop_front();
- }
- else if(!expired.empty())
- {
- break;
- }
- else
- {
- //
- // Wait until the next item expire or a notification. Note: in any case we
- // get out of this loop to get a chance to execute the work queue.
- //
- timedWait(item->getExpirationTime() - IceUtil::Time::now());
- }
- }
- }
-
- if(!expired.empty())
- {
- for(list<WaitItemPtr>::iterator p = expired.begin(); p != expired.end(); ++p)
- {
- try
- {
- (*p)->expired(false);
- }
- catch(const Ice::LocalException&)
- {
- //
- // TODO: Add some tracing.
- //
- }
- }
- }
-
- if(_destroyed)
- {
- break;
- }
+ list<WaitItemPtr> expired;
+ {
+ Lock sync(*this);
+ if(_waitQueue.empty() && !_destroyed)
+ {
+ wait();
+ }
+
+ if(_destroyed)
+ {
+ break;
+ }
+
+ //
+ // Notify expired items.
+ //
+ while(!_waitQueue.empty() && !_destroyed)
+ {
+ WaitItemPtr item = _waitQueue.front();
+ if(item->getExpirationTime() <= IceUtil::Time::now())
+ {
+ expired.push_back(item);
+ _waitQueue.pop_front();
+ }
+ else if(!expired.empty())
+ {
+ break;
+ }
+ else
+ {
+ //
+ // Wait until the next item expire or a notification. Note: in any case we
+ // get out of this loop to get a chance to execute the work queue.
+ //
+ timedWait(item->getExpirationTime() - IceUtil::Time::now());
+ }
+ }
+ }
+
+ if(!expired.empty())
+ {
+ for(list<WaitItemPtr>::iterator p = expired.begin(); p != expired.end(); ++p)
+ {
+ try
+ {
+ (*p)->expired(false);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // TODO: Add some tracing.
+ //
+ }
+ }
+ }
+
+ if(_destroyed)
+ {
+ break;
+ }
}
if(!_waitQueue.empty())
{
- for(list<WaitItemPtr>::iterator p = _waitQueue.begin(); p != _waitQueue.end(); ++p)
- {
- (*p)->expired(true);
- }
+ for(list<WaitItemPtr>::iterator p = _waitQueue.begin(); p != _waitQueue.end(); ++p)
+ {
+ (*p)->expired(true);
+ }
}
_waitQueue.clear(); // Break cyclic reference counts.
}
@@ -118,9 +118,9 @@ void
WaitQueue::destroy()
{
{
- Lock sync(*this);
- _destroyed = true;
- notify();
+ Lock sync(*this);
+ _destroyed = true;
+ notify();
}
getThreadControl().join();
@@ -132,7 +132,7 @@ WaitQueue::add(const WaitItemPtr& item, const IceUtil::Time& wait)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
//
@@ -146,17 +146,17 @@ WaitQueue::add(const WaitItemPtr& item, const IceUtil::Time& wait)
list<WaitItemPtr>::iterator p = _waitQueue.begin();
while(p != _waitQueue.end())
{
- if((*p)->getExpirationTime() >= expire)
- {
- break;
- }
- ++p;
+ if((*p)->getExpirationTime() >= expire)
+ {
+ break;
+ }
+ ++p;
}
_waitQueue.insert(p, item);
if(notifyThread)
{
- notify();
+ notify();
}
}
@@ -167,12 +167,12 @@ WaitQueue::remove(const WaitItemPtr& item)
list<WaitItemPtr>::iterator p = _waitQueue.begin();
while(p != _waitQueue.end())
{
- if((*p).get() == item.get())
- {
- _waitQueue.erase(p);
- return true;
- }
- ++p;
+ if((*p).get() == item.get())
+ {
+ _waitQueue.erase(p);
+ return true;
+ }
+ ++p;
}
return false;
}
diff --git a/cpp/src/IceGrid/WellKnownObjectsManager.cpp b/cpp/src/IceGrid/WellKnownObjectsManager.cpp
index 44cd4adc872..c3aae53a5a2 100644
--- a/cpp/src/IceGrid/WellKnownObjectsManager.cpp
+++ b/cpp/src/IceGrid/WellKnownObjectsManager.cpp
@@ -48,7 +48,7 @@ WellKnownObjectsManager::registerAll(const ReplicaSessionPrx& session)
{
if(!initialized())
{
- return;
+ return;
}
assert(session);
@@ -65,7 +65,7 @@ WellKnownObjectsManager::registerAll()
{
if(!initialized())
{
- return;
+ return;
}
//
@@ -80,7 +80,7 @@ WellKnownObjectsManager::updateReplicatedWellKnownObjects()
{
if(!initialized())
{
- return;
+ return;
}
//
diff --git a/cpp/src/IcePatch2/Calc.cpp b/cpp/src/IcePatch2/Calc.cpp
index 33b76fdee44..01947ac9d75 100644
--- a/cpp/src/IcePatch2/Calc.cpp
+++ b/cpp/src/IcePatch2/Calc.cpp
@@ -25,7 +25,7 @@ struct FileInfoPathLess: public binary_function<const FileInfo&, const FileInfo&
bool
operator()(const FileInfo& lhs, const FileInfo& rhs)
{
- return lhs.path < rhs.path;
+ return lhs.path < rhs.path;
}
};
@@ -34,20 +34,20 @@ struct IFileInfoPathEqual: public binary_function<const FileInfo&, const FileInf
bool
operator()(const FileInfo& lhs, const FileInfo& rhs)
{
- if(lhs.path.size() != rhs.path.size())
- {
- return false;
- }
-
- for(string::size_type i = 0; i < lhs.path.size(); ++i)
- {
- if(::tolower(lhs.path[i]) != ::tolower(rhs.path[i]))
- {
- return false;
- }
- }
-
- return true;
+ if(lhs.path.size() != rhs.path.size())
+ {
+ return false;
+ }
+
+ for(string::size_type i = 0; i < lhs.path.size(); ++i)
+ {
+ if(::tolower(lhs.path[i]) != ::tolower(rhs.path[i]))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
};
@@ -56,18 +56,18 @@ struct IFileInfoPathLess: public binary_function<const FileInfo&, const FileInfo
bool
operator()(const FileInfo& lhs, const FileInfo& rhs)
{
- for(string::size_type i = 0; i < lhs.path.size() && i < rhs.path.size(); ++i)
- {
- if(::tolower(lhs.path[i]) < ::tolower(rhs.path[i]))
- {
- return true;
- }
- else if(::tolower(lhs.path[i]) > ::tolower(rhs.path[i]))
- {
- return false;
- }
- }
- return lhs.path.size() < rhs.path.size();
+ for(string::size_type i = 0; i < lhs.path.size() && i < rhs.path.size(); ++i)
+ {
+ if(::tolower(lhs.path[i]) < ::tolower(rhs.path[i]))
+ {
+ return true;
+ }
+ else if(::tolower(lhs.path[i]) > ::tolower(rhs.path[i]))
+ {
+ return false;
+ }
+ }
+ return lhs.path.size() < rhs.path.size();
}
};
@@ -78,22 +78,22 @@ public:
virtual bool
remove(const string& path)
{
- cout << "removing: " << path << endl;
- return true;
+ cout << "removing: " << path << endl;
+ return true;
}
virtual bool
checksum(const string& path)
{
- cout << "checksum: " << path << endl;
- return true;
+ cout << "checksum: " << path << endl;
+ return true;
}
virtual bool
compress(const string& path)
{
- cout << "compress: " << path << endl;
- return true;
+ cout << "compress: " << path << endl;
+ return true;
}
};
@@ -132,32 +132,32 @@ main(int argc, char* argv[])
vector<string> args;
try
{
- args = opts.parse(argc, (const char**)argv);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
cerr << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
bool doCompress = opts.isSet("compress");
bool dontCompress = opts.isSet("no-compress");
if(doCompress && dontCompress)
{
cerr << argv[0] << ": only one of -z and -Z are mutually exclusive" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(doCompress)
{
@@ -185,120 +185,120 @@ main(int argc, char* argv[])
try
{
- StringSeq::iterator p;
- string absDataDir = dataDir;
+ StringSeq::iterator p;
+ string absDataDir = dataDir;
- string cwd;
- if(OS::getcwd(cwd) != 0)
- {
- throw "cannot get the current directory:\n" + lastError();
- }
-
- if(!isAbsolute(absDataDir))
- {
- absDataDir = simplify(cwd + '/' + absDataDir);
- }
-
- for(p = fileSeq.begin(); p != fileSeq.end(); ++p)
- {
- if(!isAbsolute(*p))
- {
- *p = cwd + '/' + *p;
- }
- }
-
- //
- // We must call simplify() here: under Cygwin, any path starting with
- // a double slash simply doesn't work. But, if dataDir is "/", we end
- // up with paths that start with "//" unless we call simplify().
- //
- string absDataDirWithSlash = simplify(absDataDir + '/');
-
- for(p = fileSeq.begin(); p != fileSeq.end(); ++p)
- {
- if(p->compare(0, absDataDirWithSlash.size(), absDataDirWithSlash) != 0)
- {
- throw "`" + *p + "' is not a path in `" + dataDir + "'";
- }
-
- p->erase(0, absDataDirWithSlash.size());
- }
+ string cwd;
+ if(OS::getcwd(cwd) != 0)
+ {
+ throw "cannot get the current directory:\n" + lastError();
+ }
+
+ if(!isAbsolute(absDataDir))
+ {
+ absDataDir = simplify(cwd + '/' + absDataDir);
+ }
+
+ for(p = fileSeq.begin(); p != fileSeq.end(); ++p)
+ {
+ if(!isAbsolute(*p))
+ {
+ *p = cwd + '/' + *p;
+ }
+ }
+
+ //
+ // We must call simplify() here: under Cygwin, any path starting with
+ // a double slash simply doesn't work. But, if dataDir is "/", we end
+ // up with paths that start with "//" unless we call simplify().
+ //
+ string absDataDirWithSlash = simplify(absDataDir + '/');
+
+ for(p = fileSeq.begin(); p != fileSeq.end(); ++p)
+ {
+ if(p->compare(0, absDataDirWithSlash.size(), absDataDirWithSlash) != 0)
+ {
+ throw "`" + *p + "' is not a path in `" + dataDir + "'";
+ }
+
+ p->erase(0, absDataDirWithSlash.size());
+ }
- FileInfoSeq infoSeq;
-
- if(fileSeq.empty())
- {
- CalcCB calcCB;
- if(!getFileInfoSeq(absDataDir, compress, verbose ? &calcCB : 0, infoSeq))
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- loadFileInfoSeq(absDataDir, infoSeq);
-
- for(p = fileSeq.begin(); p != fileSeq.end(); ++p)
- {
- FileInfoSeq partialInfoSeq;
-
- CalcCB calcCB;
- if(!getFileInfoSeqSubDir(absDataDir, *p, compress, verbose ? &calcCB : 0, partialInfoSeq))
- {
- return EXIT_FAILURE;
- }
-
- FileInfoSeq newInfoSeq;
- newInfoSeq.reserve(infoSeq.size());
-
- set_difference(infoSeq.begin(),
- infoSeq.end(),
- partialInfoSeq.begin(),
- partialInfoSeq.end(),
- back_inserter(newInfoSeq),
- FileInfoPathLess());
-
- infoSeq.swap(newInfoSeq);
-
- newInfoSeq.clear();
- newInfoSeq.reserve(infoSeq.size() + partialInfoSeq.size());
-
- set_union(infoSeq.begin(),
- infoSeq.end(),
- partialInfoSeq.begin(),
- partialInfoSeq.end(),
- back_inserter(newInfoSeq),
- FileInfoPathLess());
-
- infoSeq.swap(newInfoSeq);
- }
- }
-
- if(caseInsensitive)
- {
- FileInfoSeq newInfoSeq = infoSeq;
- sort(newInfoSeq.begin(), newInfoSeq.end(), IFileInfoPathLess());
-
- string ex;
- FileInfoSeq::iterator p = newInfoSeq.begin();
- while((p = adjacent_find(p, newInfoSeq.end(), IFileInfoPathEqual())) != newInfoSeq.end())
- {
- do
- {
- ex += '\n' + dataDir + '/' + p->path;
- ++p;
- }
- while(p < newInfoSeq.end() && IFileInfoPathEqual()(*(p - 1), *p));
- }
-
- if(!ex.empty())
- {
- ex = "duplicate files:" + ex;
- throw ex;
- }
- }
-
- saveFileInfoSeq(absDataDir, infoSeq);
+ FileInfoSeq infoSeq;
+
+ if(fileSeq.empty())
+ {
+ CalcCB calcCB;
+ if(!getFileInfoSeq(absDataDir, compress, verbose ? &calcCB : 0, infoSeq))
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ loadFileInfoSeq(absDataDir, infoSeq);
+
+ for(p = fileSeq.begin(); p != fileSeq.end(); ++p)
+ {
+ FileInfoSeq partialInfoSeq;
+
+ CalcCB calcCB;
+ if(!getFileInfoSeqSubDir(absDataDir, *p, compress, verbose ? &calcCB : 0, partialInfoSeq))
+ {
+ return EXIT_FAILURE;
+ }
+
+ FileInfoSeq newInfoSeq;
+ newInfoSeq.reserve(infoSeq.size());
+
+ set_difference(infoSeq.begin(),
+ infoSeq.end(),
+ partialInfoSeq.begin(),
+ partialInfoSeq.end(),
+ back_inserter(newInfoSeq),
+ FileInfoPathLess());
+
+ infoSeq.swap(newInfoSeq);
+
+ newInfoSeq.clear();
+ newInfoSeq.reserve(infoSeq.size() + partialInfoSeq.size());
+
+ set_union(infoSeq.begin(),
+ infoSeq.end(),
+ partialInfoSeq.begin(),
+ partialInfoSeq.end(),
+ back_inserter(newInfoSeq),
+ FileInfoPathLess());
+
+ infoSeq.swap(newInfoSeq);
+ }
+ }
+
+ if(caseInsensitive)
+ {
+ FileInfoSeq newInfoSeq = infoSeq;
+ sort(newInfoSeq.begin(), newInfoSeq.end(), IFileInfoPathLess());
+
+ string ex;
+ FileInfoSeq::iterator p = newInfoSeq.begin();
+ while((p = adjacent_find(p, newInfoSeq.end(), IFileInfoPathEqual())) != newInfoSeq.end())
+ {
+ do
+ {
+ ex += '\n' + dataDir + '/' + p->path;
+ ++p;
+ }
+ while(p < newInfoSeq.end() && IFileInfoPathEqual()(*(p - 1), *p));
+ }
+
+ if(!ex.empty())
+ {
+ ex = "duplicate files:" + ex;
+ throw ex;
+ }
+ }
+
+ saveFileInfoSeq(absDataDir, infoSeq);
}
catch(const string& ex)
{
diff --git a/cpp/src/IcePatch2/Client.cpp b/cpp/src/IcePatch2/Client.cpp
index 50cbbd474b1..5bdbf0c0e10 100644
--- a/cpp/src/IcePatch2/Client.cpp
+++ b/cpp/src/IcePatch2/Client.cpp
@@ -28,137 +28,137 @@ class TextPatcherFeedback : public PatcherFeedback
public:
TextPatcherFeedback() :
- _pressAnyKeyMessage(false)
+ _pressAnyKeyMessage(false)
{
#ifndef _WIN32
- tcgetattr(0, &_savedTerm);
- _savedFlags = fcntl(0, F_GETFL);
- _block = true;
+ tcgetattr(0, &_savedTerm);
+ _savedFlags = fcntl(0, F_GETFL);
+ _block = true;
#endif
}
virtual ~TextPatcherFeedback()
{
#ifndef _WIN32
- tcsetattr(0, TCSANOW, &_savedTerm);
- fcntl(0, F_SETFL, _savedFlags);
+ tcsetattr(0, TCSANOW, &_savedTerm);
+ fcntl(0, F_SETFL, _savedFlags);
#endif
}
virtual bool
noFileSummary(const string& reason)
{
- cout << "Cannot load file summary:\n" << reason << endl;
- string answer;
- do
- {
- cout << "Do a thorough patch? (yes/no)" << endl;
- cin >> answer;
- transform(answer.begin(), answer.end(), answer.begin(), ::tolower);
- if(answer == "no")
- {
- return false;
- }
- }
- while(answer != "yes");
- return true;
+ cout << "Cannot load file summary:\n" << reason << endl;
+ string answer;
+ do
+ {
+ cout << "Do a thorough patch? (yes/no)" << endl;
+ cin >> answer;
+ transform(answer.begin(), answer.end(), answer.begin(), ::tolower);
+ if(answer == "no")
+ {
+ return false;
+ }
+ }
+ while(answer != "yes");
+ return true;
}
virtual bool
checksumStart()
{
- if(!_pressAnyKeyMessage)
- {
- cout << "[Press any key to abort]" << endl;
- _pressAnyKeyMessage = true;
- }
+ if(!_pressAnyKeyMessage)
+ {
+ cout << "[Press any key to abort]" << endl;
+ _pressAnyKeyMessage = true;
+ }
- return !keyPressed();
+ return !keyPressed();
}
virtual bool
checksumProgress(const string& path)
{
- cout << "Calculating checksum for " << getBasename(path) << endl;
- return !keyPressed();
+ cout << "Calculating checksum for " << getBasename(path) << endl;
+ return !keyPressed();
}
virtual bool
checksumEnd()
{
- return !keyPressed();
+ return !keyPressed();
}
virtual bool
fileListStart()
{
- if(!_pressAnyKeyMessage)
- {
- cout << "[Press any key to abort]" << endl;
- _pressAnyKeyMessage = true;
- }
-
- _lastProgress = "0%";
- cout << "Getting list of files to patch: " << _lastProgress << flush;
- return !keyPressed();
+ if(!_pressAnyKeyMessage)
+ {
+ cout << "[Press any key to abort]" << endl;
+ _pressAnyKeyMessage = true;
+ }
+
+ _lastProgress = "0%";
+ cout << "Getting list of files to patch: " << _lastProgress << flush;
+ return !keyPressed();
}
virtual bool
fileListProgress(Int percent)
{
- for(unsigned int i = 0; i < _lastProgress.size(); ++i)
- {
- cout << '\b';
- }
- ostringstream s;
- s << percent << '%';
- _lastProgress = s.str();
- cout << _lastProgress << flush;
- return !keyPressed();
+ for(unsigned int i = 0; i < _lastProgress.size(); ++i)
+ {
+ cout << '\b';
+ }
+ ostringstream s;
+ s << percent << '%';
+ _lastProgress = s.str();
+ cout << _lastProgress << flush;
+ return !keyPressed();
}
virtual bool
fileListEnd()
{
- cout << endl;
- return !keyPressed();
+ cout << endl;
+ return !keyPressed();
}
virtual bool
patchStart(const string& path, Long size, Long totalProgress, Long totalSize)
{
- if(!_pressAnyKeyMessage)
- {
- cout << "[Press any key to abort]" << endl;
- _pressAnyKeyMessage = true;
- }
-
- ostringstream s;
- s << "0/" << size << " (" << totalProgress << '/' << totalSize << ')';
- _lastProgress = s.str();
- cout << getBasename(path) << ' ' << _lastProgress << flush;
- return !keyPressed();
+ if(!_pressAnyKeyMessage)
+ {
+ cout << "[Press any key to abort]" << endl;
+ _pressAnyKeyMessage = true;
+ }
+
+ ostringstream s;
+ s << "0/" << size << " (" << totalProgress << '/' << totalSize << ')';
+ _lastProgress = s.str();
+ cout << getBasename(path) << ' ' << _lastProgress << flush;
+ return !keyPressed();
}
virtual bool
patchProgress(Long progress, Long size, Long totalProgress, Long totalSize)
{
- for(unsigned int i = 0; i < _lastProgress.size(); ++i)
- {
- cout << '\b';
- }
- ostringstream s;
- s << progress << '/' << size << " (" << totalProgress << '/' << totalSize << ')';
- _lastProgress = s.str();
- cout << _lastProgress << flush;
- return !keyPressed();
+ for(unsigned int i = 0; i < _lastProgress.size(); ++i)
+ {
+ cout << '\b';
+ }
+ ostringstream s;
+ s << progress << '/' << size << " (" << totalProgress << '/' << totalSize << ')';
+ _lastProgress = s.str();
+ cout << _lastProgress << flush;
+ return !keyPressed();
}
virtual bool
patchEnd()
{
- cout << endl;
- return !keyPressed();
+ cout << endl;
+ return !keyPressed();
}
private:
@@ -168,17 +168,17 @@ private:
bool
keyPressed()
{
- bool pressed = false;
+ bool pressed = false;
#ifdef __BCPLUSPLUS__
- while(kbhit())
+ while(kbhit())
#else
- while(_kbhit())
+ while(_kbhit())
#endif
- {
- pressed = true;
- _getch();
- }
- return pressed;
+ {
+ pressed = true;
+ _getch();
+ }
+ return pressed;
}
#else
@@ -186,29 +186,29 @@ private:
bool
keyPressed()
{
- if(_block)
- {
- termios term;
- memcpy(&term, &_savedTerm, sizeof(termios));
- term.c_lflag &= ~(ECHO | ICANON);
- term.c_cc[VTIME] = 0;
- term.c_cc[VMIN] = 1;
- tcsetattr(0, TCSANOW, &term);
-
- int flags = _savedFlags;
- flags |= O_NONBLOCK;
- fcntl(0, F_SETFL, flags);
-
- _block = false;
- }
-
- bool pressed = false;
- char c;
- while(read(0, &c, 1) > 0)
- {
- pressed = true;
- }
- return pressed;
+ if(_block)
+ {
+ termios term;
+ memcpy(&term, &_savedTerm, sizeof(termios));
+ term.c_lflag &= ~(ECHO | ICANON);
+ term.c_cc[VTIME] = 0;
+ term.c_cc[VMIN] = 1;
+ tcsetattr(0, TCSANOW, &term);
+
+ int flags = _savedFlags;
+ flags |= O_NONBLOCK;
+ fcntl(0, F_SETFL, flags);
+
+ _block = false;
+ }
+
+ bool pressed = false;
+ char c;
+ while(read(0, &c, 1) > 0)
+ {
+ pressed = true;
+ }
+ return pressed;
}
termios _savedTerm;
@@ -245,59 +245,59 @@ Client::run(int argc, char* argv[])
vector<string> args;
try
{
- args = opts.parse(argc, (const char**)argv);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
cerr << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
if(opts.isSet("thorough"))
{
- properties->setProperty("IcePatch2.Thorough", "1");
+ properties->setProperty("IcePatch2.Thorough", "1");
}
if(args.size() > 1)
{
- cerr << argv[0] << ": too many arguments" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": too many arguments" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(args.size() == 1)
{
- properties->setProperty("IcePatch2.Directory", simplify(args[0]));
+ properties->setProperty("IcePatch2.Directory", simplify(args[0]));
}
bool aborted = false;
try
{
- PatcherFeedbackPtr feedback = new TextPatcherFeedback;
- PatcherPtr patcher = new Patcher(communicator(), feedback);
+ PatcherFeedbackPtr feedback = new TextPatcherFeedback;
+ PatcherPtr patcher = new Patcher(communicator(), feedback);
- aborted = !patcher->prepare();
+ aborted = !patcher->prepare();
- if(!aborted)
- {
- aborted = !patcher->patch("");
- }
+ if(!aborted)
+ {
+ aborted = !patcher->patch("");
+ }
- if(!aborted)
- {
- patcher->finish();
- }
+ if(!aborted)
+ {
+ patcher->finish();
+ }
}
catch(const string& ex)
{
@@ -307,12 +307,12 @@ Client::run(int argc, char* argv[])
if(aborted)
{
- cout << "\n[Aborted]" << endl;
- return EXIT_FAILURE;
+ cout << "\n[Aborted]" << endl;
+ return EXIT_FAILURE;
}
else
{
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
}
@@ -320,10 +320,10 @@ void
Client::usage(const string& appName)
{
string options =
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.\n"
- "-t, --thorough Recalculate all checksums.";
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-t, --thorough Recalculate all checksums.";
cerr << "Usage: " << appName << " [options] [DIR]" << endl;
cerr << options << endl;
diff --git a/cpp/src/IcePatch2/ClientUtil.cpp b/cpp/src/IcePatch2/ClientUtil.cpp
index fd986e90d29..64b3f472bed 100755
--- a/cpp/src/IcePatch2/ClientUtil.cpp
+++ b/cpp/src/IcePatch2/ClientUtil.cpp
@@ -30,107 +30,107 @@ class Decompressor : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mu
public:
Decompressor(const string& dataDir) :
- _dataDir(dataDir),
- _destroy(false)
+ _dataDir(dataDir),
+ _destroy(false)
{
}
virtual ~Decompressor()
{
- assert(_destroy);
+ assert(_destroy);
}
void
destroy()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- _destroy = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _destroy = true;
+ notify();
}
void
add(const FileInfo& info)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(!_exception.empty())
- {
- throw _exception;
- }
- _files.push_back(info);
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(!_exception.empty())
+ {
+ throw _exception;
+ }
+ _files.push_back(info);
+ notify();
}
void
exception() const
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(!_exception.empty())
- {
- throw _exception;
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(!_exception.empty())
+ {
+ throw _exception;
+ }
}
void
log(FILE* fp)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- for(FileInfoSeq::const_iterator p = _filesDone.begin(); p != _filesDone.end(); ++p)
- {
- if(fputc('+', fp) == EOF || !writeFileInfo(fp, *p))
- {
- throw "error writing log file:\n" + lastError();
- }
- }
+ for(FileInfoSeq::const_iterator p = _filesDone.begin(); p != _filesDone.end(); ++p)
+ {
+ if(fputc('+', fp) == EOF || !writeFileInfo(fp, *p))
+ {
+ throw "error writing log file:\n" + lastError();
+ }
+ }
- _filesDone.clear();
+ _filesDone.clear();
}
virtual void
run()
{
- FileInfo info;
-
- while(true)
- {
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(!info.path.empty())
- {
- _filesDone.push_back(info);
- }
-
- while(!_destroy && _files.empty())
- {
- wait();
- }
-
- if(!_files.empty())
- {
- info = _files.front();
- _files.pop_front();
- }
- else
- {
- return;
- }
- }
-
- try
- {
- decompressFile(_dataDir + '/' + info.path);
- setFileFlags(_dataDir + '/' + info.path, info);
- remove(_dataDir + '/' + info.path + ".bz2");
- }
- catch(const string& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- _destroy = true;
- _exception = ex;
- return;
- }
- }
+ FileInfo info;
+
+ while(true)
+ {
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(!info.path.empty())
+ {
+ _filesDone.push_back(info);
+ }
+
+ while(!_destroy && _files.empty())
+ {
+ wait();
+ }
+
+ if(!_files.empty())
+ {
+ info = _files.front();
+ _files.pop_front();
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ try
+ {
+ decompressFile(_dataDir + '/' + info.path);
+ setFileFlags(_dataDir + '/' + info.path, info);
+ remove(_dataDir + '/' + info.path + ".bz2");
+ }
+ catch(const string& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _destroy = true;
+ _exception = ex;
+ return;
+ }
+ }
}
private:
@@ -158,7 +158,7 @@ IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFe
const char* endpointsProperty = "Ice.OA.IcePatch2.Endpoints";
string endpoints = properties->getPropertyWithDefault(endpointsProperty,
- properties->getProperty("IcePatch2.Endpoints"));
+ properties->getProperty("IcePatch2.Endpoints"));
if(endpoints.empty())
{
throw string("property `") + endpointsProperty + "' is not set";
@@ -172,18 +172,18 @@ IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFe
FileServerPrx server = FileServerPrx::checkedCast(serverBase);
if(!server)
{
- throw "proxy `" + communicator->identityToString(id) + ':' + endpoints + "' is not a file server.";
+ throw "proxy `" + communicator->identityToString(id) + ':' + endpoints + "' is not a file server.";
}
init(server);
}
IcePatch2::Patcher::Patcher(const FileServerPrx& server,
- const PatcherFeedbackPtr& feedback,
- const string& dataDir,
- bool thorough,
- Ice::Int chunkSize,
- Ice::Int remove) :
+ const PatcherFeedbackPtr& feedback,
+ const string& dataDir,
+ bool thorough,
+ Ice::Int chunkSize,
+ Ice::Int remove) :
_feedback(feedback),
_dataDir(simplify(dataDir)),
_thorough(thorough),
@@ -202,26 +202,26 @@ class PatcherGetFileInfoSeqCB : public GetFileInfoSeqCB
public:
PatcherGetFileInfoSeqCB(const PatcherFeedbackPtr& feedback) :
- _feedback(feedback)
+ _feedback(feedback)
{
}
virtual bool
remove(const string&)
{
- return true;
+ return true;
}
virtual bool
checksum(const string& path)
{
- return _feedback->checksumProgress(path);
+ return _feedback->checksumProgress(path);
}
virtual bool compress(const string&)
{
- assert(false); // Nothing must get compressed when we are patching.
- return true;
+ assert(false); // Nothing must get compressed when we are patching.
+ return true;
}
private:
@@ -234,50 +234,50 @@ class AMIGetFileInfoSeq : public AMI_FileServer_getFileInfoSeq, public IceUtil::
public:
AMIGetFileInfoSeq() :
- _done(false)
+ _done(false)
{
}
FileInfoSeq
getFileInfoSeq()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_done)
- {
- wait();
- }
+ while(!_done)
+ {
+ wait();
+ }
- _done = false;
+ _done = false;
- if(_exception.get())
- {
- auto_ptr<Exception> ex = _exception;
- _fileInfoSeq.clear();
- ex->ice_throw();
- }
+ if(_exception.get())
+ {
+ auto_ptr<Exception> ex = _exception;
+ _fileInfoSeq.clear();
+ ex->ice_throw();
+ }
- FileInfoSeq fileInfoSeq;
- fileInfoSeq.swap(_fileInfoSeq);
- return fileInfoSeq;
+ FileInfoSeq fileInfoSeq;
+ fileInfoSeq.swap(_fileInfoSeq);
+ return fileInfoSeq;
}
virtual void
ice_response(const FileInfoSeq& fileInfoSeq)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- _fileInfoSeq = fileInfoSeq;
- _done = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _fileInfoSeq = fileInfoSeq;
+ _done = true;
+ notify();
}
virtual void
ice_exception(const Exception& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- _exception.reset(ex.ice_clone());
- _done = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _exception.reset(ex.ice_clone());
+ _done = true;
+ notify();
}
private:
@@ -298,39 +298,39 @@ IcePatch2::Patcher::prepare()
if(!thorough)
{
- try
- {
- loadFileInfoSeq(_dataDir, _localFiles);
- }
- catch(const string& ex)
- {
- thorough = _feedback->noFileSummary(ex);
- if(!thorough)
- {
- return false;
- }
- }
+ try
+ {
+ loadFileInfoSeq(_dataDir, _localFiles);
+ }
+ catch(const string& ex)
+ {
+ thorough = _feedback->noFileSummary(ex);
+ if(!thorough)
+ {
+ return false;
+ }
+ }
}
if(thorough)
{
- if(!_feedback->checksumStart())
- {
- return false;
- }
+ if(!_feedback->checksumStart())
+ {
+ return false;
+ }
- PatcherGetFileInfoSeqCB cb(_feedback);
- if(!getFileInfoSeq(_dataDir, 0, &cb, _localFiles))
- {
- return false;
- }
+ PatcherGetFileInfoSeqCB cb(_feedback);
+ if(!getFileInfoSeq(_dataDir, 0, &cb, _localFiles))
+ {
+ return false;
+ }
- if(!_feedback->checksumEnd())
- {
- return false;
- }
+ if(!_feedback->checksumEnd())
+ {
+ return false;
+ }
- saveFileInfoSeq(_dataDir, _localFiles);
+ saveFileInfoSeq(_dataDir, _localFiles);
}
FileTree0 tree0;
@@ -338,124 +338,124 @@ IcePatch2::Patcher::prepare()
if(tree0.checksum != _serverCompress->getChecksum())
{
- if(!_feedback->fileListStart())
- {
- return false;
- }
-
- ByteSeqSeq checksumSeq = _serverCompress->getChecksumSeq();
- if(checksumSeq.size() != 256)
- {
- throw string("server returned illegal value");
- }
-
- AMIGetFileInfoSeqPtr curCB;
- AMIGetFileInfoSeqPtr nxtCB;
-
- for(int node0 = 0; node0 < 256; ++node0)
- {
- if(tree0.nodes[node0].checksum != checksumSeq[node0])
- {
- if(!curCB)
- {
- assert(!nxtCB);
- curCB = new AMIGetFileInfoSeq;
- nxtCB = new AMIGetFileInfoSeq;
- _serverCompress->getFileInfoSeq_async(curCB, node0);
- }
- else
- {
- assert(nxtCB);
- swap(nxtCB, curCB);
- }
-
- int node0Nxt = node0;
-
- do
- {
- ++node0Nxt;
- }
- while(node0Nxt < 256 && tree0.nodes[node0Nxt].checksum == checksumSeq[node0Nxt]);
-
- if(node0Nxt < 256)
- {
- _serverCompress->getFileInfoSeq_async(nxtCB, node0Nxt);
- }
-
- FileInfoSeq files = curCB->getFileInfoSeq();
-
- sort(files.begin(), files.end(), FileInfoLess());
- files.erase(unique(files.begin(), files.end(), FileInfoEqual()), files.end());
-
- //
- // Compute the set of files which were removed.
- //
- set_difference(tree0.nodes[node0].files.begin(),
- tree0.nodes[node0].files.end(),
- files.begin(),
- files.end(),
- back_inserter(_removeFiles),
- FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags here.
-
- //
- // Compute the set of files which were updated (either the file contents, flags or both).
- //
- FileInfoSeq updatedFiles;
- updatedFiles.reserve(files.size());
-
- set_difference(files.begin(),
- files.end(),
- tree0.nodes[node0].files.begin(),
- tree0.nodes[node0].files.end(),
- back_inserter(updatedFiles),
- FileInfoLess());
-
- //
- // Compute the set of files whose contents was updated.
- //
- FileInfoSeq contentsUpdatedFiles;
- contentsUpdatedFiles.reserve(files.size());
-
- set_difference(files.begin(),
- files.end(),
- tree0.nodes[node0].files.begin(),
- tree0.nodes[node0].files.end(),
- back_inserter(contentsUpdatedFiles),
- FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags here.
- copy(contentsUpdatedFiles.begin(), contentsUpdatedFiles.end(), back_inserter(_updateFiles));
-
- //
- // Compute the set of files whose flags were updated.
- //
- set_difference(updatedFiles.begin(),
- updatedFiles.end(),
- contentsUpdatedFiles.begin(),
- contentsUpdatedFiles.end(),
- back_inserter(_updateFlags),
- FileInfoLess());
- }
-
- if(!_feedback->fileListProgress((node0 + 1) * 100 / 256))
- {
- return false;
- }
- }
-
- if(!_feedback->fileListEnd())
- {
- return false;
- }
+ if(!_feedback->fileListStart())
+ {
+ return false;
+ }
+
+ ByteSeqSeq checksumSeq = _serverCompress->getChecksumSeq();
+ if(checksumSeq.size() != 256)
+ {
+ throw string("server returned illegal value");
+ }
+
+ AMIGetFileInfoSeqPtr curCB;
+ AMIGetFileInfoSeqPtr nxtCB;
+
+ for(int node0 = 0; node0 < 256; ++node0)
+ {
+ if(tree0.nodes[node0].checksum != checksumSeq[node0])
+ {
+ if(!curCB)
+ {
+ assert(!nxtCB);
+ curCB = new AMIGetFileInfoSeq;
+ nxtCB = new AMIGetFileInfoSeq;
+ _serverCompress->getFileInfoSeq_async(curCB, node0);
+ }
+ else
+ {
+ assert(nxtCB);
+ swap(nxtCB, curCB);
+ }
+
+ int node0Nxt = node0;
+
+ do
+ {
+ ++node0Nxt;
+ }
+ while(node0Nxt < 256 && tree0.nodes[node0Nxt].checksum == checksumSeq[node0Nxt]);
+
+ if(node0Nxt < 256)
+ {
+ _serverCompress->getFileInfoSeq_async(nxtCB, node0Nxt);
+ }
+
+ FileInfoSeq files = curCB->getFileInfoSeq();
+
+ sort(files.begin(), files.end(), FileInfoLess());
+ files.erase(unique(files.begin(), files.end(), FileInfoEqual()), files.end());
+
+ //
+ // Compute the set of files which were removed.
+ //
+ set_difference(tree0.nodes[node0].files.begin(),
+ tree0.nodes[node0].files.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(_removeFiles),
+ FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags here.
+
+ //
+ // Compute the set of files which were updated (either the file contents, flags or both).
+ //
+ FileInfoSeq updatedFiles;
+ updatedFiles.reserve(files.size());
+
+ set_difference(files.begin(),
+ files.end(),
+ tree0.nodes[node0].files.begin(),
+ tree0.nodes[node0].files.end(),
+ back_inserter(updatedFiles),
+ FileInfoLess());
+
+ //
+ // Compute the set of files whose contents was updated.
+ //
+ FileInfoSeq contentsUpdatedFiles;
+ contentsUpdatedFiles.reserve(files.size());
+
+ set_difference(files.begin(),
+ files.end(),
+ tree0.nodes[node0].files.begin(),
+ tree0.nodes[node0].files.end(),
+ back_inserter(contentsUpdatedFiles),
+ FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags here.
+ copy(contentsUpdatedFiles.begin(), contentsUpdatedFiles.end(), back_inserter(_updateFiles));
+
+ //
+ // Compute the set of files whose flags were updated.
+ //
+ set_difference(updatedFiles.begin(),
+ updatedFiles.end(),
+ contentsUpdatedFiles.begin(),
+ contentsUpdatedFiles.end(),
+ back_inserter(_updateFlags),
+ FileInfoLess());
+ }
+
+ if(!_feedback->fileListProgress((node0 + 1) * 100 / 256))
+ {
+ return false;
+ }
+ }
+
+ if(!_feedback->fileListEnd())
+ {
+ return false;
+ }
}
sort(_removeFiles.begin(), _removeFiles.end(), FileInfoLess());
sort(_updateFiles.begin(), _updateFiles.end(), FileInfoLess());
sort(_updateFlags.begin(), _updateFlags.end(), FileInfoLess());
-
+
string pathLog = simplify(_dataDir + '/' + logFile);
_log = OS::fopen(pathLog, "w");
if(!_log)
{
- throw "cannot open `" + pathLog + "' for writing:\n" + lastError();
+ throw "cannot open `" + pathLog + "' for writing:\n" + lastError();
}
return true;
@@ -468,102 +468,102 @@ IcePatch2::Patcher::patch(const string& d)
if(dir.empty() || dir == ".")
{
- if(!_removeFiles.empty())
- {
- if(!removeFiles(_removeFiles))
- {
- return false;
- }
- }
-
- if(!_updateFiles.empty())
- {
- if(!updateFiles(_updateFiles))
- {
- return false;
- }
- }
-
- if(!_updateFlags.empty())
- {
- if(!updateFlags(_updateFlags))
- {
- return false;
- }
- }
-
- return true;
+ if(!_removeFiles.empty())
+ {
+ if(!removeFiles(_removeFiles))
+ {
+ return false;
+ }
+ }
+
+ if(!_updateFiles.empty())
+ {
+ if(!updateFiles(_updateFiles))
+ {
+ return false;
+ }
+ }
+
+ if(!_updateFlags.empty())
+ {
+ if(!updateFlags(_updateFlags))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
else
{
- string dirWithSlash = simplify(dir + '/');
-
- FileInfoSeq::const_iterator p;
-
- FileInfoSeq remove;
- for(p = _removeFiles.begin(); p != _removeFiles.end(); ++p)
- {
- if(p->path == dir)
- {
- remove.push_back(*p);
- }
- else if(p->path.compare(0, dirWithSlash.size(), dirWithSlash) == 0)
- {
- remove.push_back(*p);
- }
- }
-
- FileInfoSeq update;
- for(p = _updateFiles.begin(); p != _updateFiles.end(); ++p)
- {
- if(p->path == dir)
- {
- update.push_back(*p);
- }
- else if(p->path.compare(0, dirWithSlash.size(), dirWithSlash) == 0)
- {
- update.push_back(*p);
- }
- }
-
- FileInfoSeq updateFlag;
- for(p = _updateFlags.begin(); p != _updateFlags.end(); ++p)
- {
- if(p->path == dir)
- {
- updateFlag.push_back(*p);
- }
- else if(p->path.compare(0, dirWithSlash.size(), dirWithSlash) == 0)
- {
- updateFlag.push_back(*p);
- }
- }
-
- if(!remove.empty())
- {
- if(!removeFiles(remove))
- {
- return false;
- }
- }
-
- if(!update.empty())
- {
- if(!updateFiles(update))
- {
- return false;
- }
- }
-
- if(!updateFlag.empty())
- {
- if(!updateFlags(updateFlag))
- {
- return false;
- }
- }
-
- return true;
+ string dirWithSlash = simplify(dir + '/');
+
+ FileInfoSeq::const_iterator p;
+
+ FileInfoSeq remove;
+ for(p = _removeFiles.begin(); p != _removeFiles.end(); ++p)
+ {
+ if(p->path == dir)
+ {
+ remove.push_back(*p);
+ }
+ else if(p->path.compare(0, dirWithSlash.size(), dirWithSlash) == 0)
+ {
+ remove.push_back(*p);
+ }
+ }
+
+ FileInfoSeq update;
+ for(p = _updateFiles.begin(); p != _updateFiles.end(); ++p)
+ {
+ if(p->path == dir)
+ {
+ update.push_back(*p);
+ }
+ else if(p->path.compare(0, dirWithSlash.size(), dirWithSlash) == 0)
+ {
+ update.push_back(*p);
+ }
+ }
+
+ FileInfoSeq updateFlag;
+ for(p = _updateFlags.begin(); p != _updateFlags.end(); ++p)
+ {
+ if(p->path == dir)
+ {
+ updateFlag.push_back(*p);
+ }
+ else if(p->path.compare(0, dirWithSlash.size(), dirWithSlash) == 0)
+ {
+ updateFlag.push_back(*p);
+ }
+ }
+
+ if(!remove.empty())
+ {
+ if(!removeFiles(remove))
+ {
+ return false;
+ }
+ }
+
+ if(!update.empty())
+ {
+ if(!updateFiles(update))
+ {
+ return false;
+ }
+ }
+
+ if(!updateFlag.empty())
+ {
+ if(!updateFlags(updateFlag))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
}
@@ -572,8 +572,8 @@ IcePatch2::Patcher::finish()
{
if(_log != 0)
{
- fclose(_log);
- _log = 0;
+ fclose(_log);
+ _log = 0;
}
saveFileInfoSeq(_dataDir, _localFiles);
@@ -584,7 +584,7 @@ IcePatch2::Patcher::init(const FileServerPrx& server)
{
if(_dataDir.empty())
{
- throw string("no data directory specified");
+ throw string("no data directory specified");
}
//
@@ -595,7 +595,7 @@ IcePatch2::Patcher::init(const FileServerPrx& server)
server->ice_getCommunicator()->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024);
if(_chunkSize < 1)
{
- const_cast<Int&>(_chunkSize) = 1;
+ const_cast<Int&>(_chunkSize) = 1;
}
else if(_chunkSize > sizeMax)
{
@@ -607,19 +607,19 @@ IcePatch2::Patcher::init(const FileServerPrx& server)
}
else
{
- const_cast<Int&>(_chunkSize) *= 1024;
+ const_cast<Int&>(_chunkSize) *= 1024;
}
if(!isAbsolute(_dataDir))
{
- string cwd;
- if(OS::getcwd(cwd) != 0)
- {
- throw "cannot get the current directory:\n" + lastError();
- }
- const_cast<string&>(_dataDir) = simplify(cwd + '/' + _dataDir);
+ string cwd;
+ if(OS::getcwd(cwd) != 0)
+ {
+ throw "cannot get the current directory:\n" + lastError();
+ }
+ const_cast<string&>(_dataDir) = simplify(cwd + '/' + _dataDir);
}
-
+
const_cast<FileServerPrx&>(_serverCompress) = FileServerPrx::uncheckedCast(server->ice_compress(true));
const_cast<FileServerPrx&>(_serverNoCompress) = FileServerPrx::uncheckedCast(server->ice_compress(false));
}
@@ -629,48 +629,48 @@ IcePatch2::Patcher::removeFiles(const FileInfoSeq& files)
{
if(_remove < 1)
{
- return true;
+ return true;
}
for(FileInfoSeq::const_reverse_iterator p = files.rbegin(); p != files.rend(); ++p)
{
- try
- {
- remove(_dataDir + '/' + p->path);
- if(fputc('-', _log) == EOF || ! writeFileInfo(_log, *p))
- {
- throw "error writing log file:\n" + lastError();
- }
- }
- catch(...)
- {
- if(_remove < 2) // We ignore errors if IcePatch2.Remove >= 2.
- {
- throw;
- }
- }
+ try
+ {
+ remove(_dataDir + '/' + p->path);
+ if(fputc('-', _log) == EOF || ! writeFileInfo(_log, *p))
+ {
+ throw "error writing log file:\n" + lastError();
+ }
+ }
+ catch(...)
+ {
+ if(_remove < 2) // We ignore errors if IcePatch2.Remove >= 2.
+ {
+ throw;
+ }
+ }
}
FileInfoSeq newLocalFiles;
newLocalFiles.reserve(_localFiles.size());
set_difference(_localFiles.begin(),
- _localFiles.end(),
- files.begin(),
- files.end(),
- back_inserter(newLocalFiles),
- FileInfoLess());
+ _localFiles.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(newLocalFiles),
+ FileInfoLess());
_localFiles.swap(newLocalFiles);
FileInfoSeq newRemoveFiles;
set_difference(_removeFiles.begin(),
- _removeFiles.end(),
- files.begin(),
- files.end(),
- back_inserter(newRemoveFiles),
- FileInfoLess());
+ _removeFiles.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(newRemoveFiles),
+ FileInfoLess());
_removeFiles.swap(newRemoveFiles);
@@ -694,14 +694,14 @@ IcePatch2::Patcher::updateFiles(const FileInfoSeq& files)
try
{
- result = updateFilesInternal(files, decompressor);
+ result = updateFilesInternal(files, decompressor);
}
catch(...)
{
- decompressor->destroy();
- decompressor->getThreadControl().join();
- decompressor->log(_log);
- throw;
+ decompressor->destroy();
+ decompressor->getThreadControl().join();
+ decompressor->log(_log);
+ throw;
}
decompressor->destroy();
@@ -717,50 +717,50 @@ class AMIGetFileCompressed : public AMI_FileServer_getFileCompressed, public Ice
public:
AMIGetFileCompressed() :
- _done(false)
+ _done(false)
{
}
ByteSeq
getFileCompressed()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_done)
- {
- wait();
- }
+ while(!_done)
+ {
+ wait();
+ }
- _done = false;
+ _done = false;
- if(_exception.get())
- {
- auto_ptr<Exception> ex = _exception;
- _bytes.clear();
- ex->ice_throw();
- }
+ if(_exception.get())
+ {
+ auto_ptr<Exception> ex = _exception;
+ _bytes.clear();
+ ex->ice_throw();
+ }
- ByteSeq bytes;
- bytes.swap(_bytes);
- return bytes;
+ ByteSeq bytes;
+ bytes.swap(_bytes);
+ return bytes;
}
virtual void
ice_response(const pair<const Ice::Byte*, const Ice::Byte*>& bytes)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- ByteSeq(bytes.first, bytes.second).swap(_bytes);
- _done = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ ByteSeq(bytes.first, bytes.second).swap(_bytes);
+ _done = true;
+ notify();
}
virtual void
ice_exception(const Exception& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- _exception.reset(ex.ice_clone());
- _done = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _exception.reset(ex.ice_clone());
+ _done = true;
+ notify();
}
private:
@@ -782,10 +782,10 @@ IcePatch2::Patcher::updateFilesInternal(const FileInfoSeq& files, const Decompre
for(p = files.begin(); p != files.end(); ++p)
{
- if(p->size > 0) // Regular, non-empty file?
- {
- total += p->size;
- }
+ if(p->size > 0) // Regular, non-empty file?
+ {
+ total += p->size;
+ }
}
AMIGetFileCompressedPtr curCB;
@@ -793,164 +793,164 @@ IcePatch2::Patcher::updateFilesInternal(const FileInfoSeq& files, const Decompre
for(p = files.begin(); p != files.end(); ++p)
{
- if(p->size < 0) // Directory?
- {
- createDirectoryRecursive(_dataDir + '/' + p->path);
- if(fputc('+', _log) == EOF || !writeFileInfo(_log, *p))
- {
- throw "error writing log file:\n" + lastError();
- }
- }
- else // Regular file.
- {
- if(!_feedback->patchStart(p->path, p->size, updated, total))
- {
- return false;
- }
-
- if(p->size == 0)
- {
- string path = simplify(_dataDir + '/' + p->path);
- FILE* fp = OS::fopen(path, "wb");
- if(fp == 0)
- {
- throw "cannot open `" + path +"' for writing:\n" + lastError();
- }
- fclose(fp);
- }
- else
- {
- string pathBZ2 = simplify(_dataDir + '/' + p->path + ".bz2");
-
- string dir = getDirname(pathBZ2);
- if(!dir.empty())
- {
- createDirectoryRecursive(dir);
- }
-
- try
- {
- removeRecursive(pathBZ2);
- }
- catch(...)
- {
- }
-
- FILE* fileBZ2 = OS::fopen(pathBZ2, "wb");
- if(fileBZ2 == 0)
- {
- throw "cannot open `" + pathBZ2 + "' for writing:\n" + lastError();
- }
-
- try
- {
- Int pos = 0;
-
- while(pos < p->size)
- {
- if(!curCB)
- {
- assert(!nxtCB);
- curCB = new AMIGetFileCompressed;
- nxtCB = new AMIGetFileCompressed;
- _serverNoCompress->getFileCompressed_async(curCB, p->path, pos, _chunkSize);
- }
- else
- {
- assert(nxtCB);
- swap(nxtCB, curCB);
- }
-
- if(pos + _chunkSize < p->size)
- {
- _serverNoCompress->getFileCompressed_async(nxtCB, p->path, pos + _chunkSize, _chunkSize);
- }
- else
- {
- FileInfoSeq::const_iterator q = p + 1;
-
- while(q != files.end() && q->size <= 0)
- {
- ++q;
- }
-
- if(q != files.end())
- {
- _serverNoCompress->getFileCompressed_async(nxtCB, q->path, 0, _chunkSize);
- }
- }
-
- ByteSeq bytes;
-
- try
- {
- bytes = curCB->getFileCompressed();
- }
- catch(const FileAccessException& ex)
- {
- throw "error from IcePatch2 server for `" + p->path + "': " + ex.reason;
- }
-
- if(bytes.empty())
- {
- throw "size mismatch for `" + p->path + "'";
- }
-
- if(fwrite(reinterpret_cast<char*>(&bytes[0]), bytes.size(), 1, fileBZ2) != 1)
- {
- throw ": cannot write `" + pathBZ2 + "':\n" + lastError();
- }
-
- pos += static_cast<int>(bytes.size());
- updated += bytes.size();
-
- if(!_feedback->patchProgress(pos, p->size, updated, total))
- {
- fclose(fileBZ2);
- return false;
- }
- }
- }
- catch(...)
- {
- fclose(fileBZ2);
- throw;
- }
-
- fclose(fileBZ2);
-
- decompressor->log(_log);
- decompressor->add(*p);
- }
-
- if(!_feedback->patchEnd())
- {
- return false;
- }
- }
+ if(p->size < 0) // Directory?
+ {
+ createDirectoryRecursive(_dataDir + '/' + p->path);
+ if(fputc('+', _log) == EOF || !writeFileInfo(_log, *p))
+ {
+ throw "error writing log file:\n" + lastError();
+ }
+ }
+ else // Regular file.
+ {
+ if(!_feedback->patchStart(p->path, p->size, updated, total))
+ {
+ return false;
+ }
+
+ if(p->size == 0)
+ {
+ string path = simplify(_dataDir + '/' + p->path);
+ FILE* fp = OS::fopen(path, "wb");
+ if(fp == 0)
+ {
+ throw "cannot open `" + path +"' for writing:\n" + lastError();
+ }
+ fclose(fp);
+ }
+ else
+ {
+ string pathBZ2 = simplify(_dataDir + '/' + p->path + ".bz2");
+
+ string dir = getDirname(pathBZ2);
+ if(!dir.empty())
+ {
+ createDirectoryRecursive(dir);
+ }
+
+ try
+ {
+ removeRecursive(pathBZ2);
+ }
+ catch(...)
+ {
+ }
+
+ FILE* fileBZ2 = OS::fopen(pathBZ2, "wb");
+ if(fileBZ2 == 0)
+ {
+ throw "cannot open `" + pathBZ2 + "' for writing:\n" + lastError();
+ }
+
+ try
+ {
+ Int pos = 0;
+
+ while(pos < p->size)
+ {
+ if(!curCB)
+ {
+ assert(!nxtCB);
+ curCB = new AMIGetFileCompressed;
+ nxtCB = new AMIGetFileCompressed;
+ _serverNoCompress->getFileCompressed_async(curCB, p->path, pos, _chunkSize);
+ }
+ else
+ {
+ assert(nxtCB);
+ swap(nxtCB, curCB);
+ }
+
+ if(pos + _chunkSize < p->size)
+ {
+ _serverNoCompress->getFileCompressed_async(nxtCB, p->path, pos + _chunkSize, _chunkSize);
+ }
+ else
+ {
+ FileInfoSeq::const_iterator q = p + 1;
+
+ while(q != files.end() && q->size <= 0)
+ {
+ ++q;
+ }
+
+ if(q != files.end())
+ {
+ _serverNoCompress->getFileCompressed_async(nxtCB, q->path, 0, _chunkSize);
+ }
+ }
+
+ ByteSeq bytes;
+
+ try
+ {
+ bytes = curCB->getFileCompressed();
+ }
+ catch(const FileAccessException& ex)
+ {
+ throw "error from IcePatch2 server for `" + p->path + "': " + ex.reason;
+ }
+
+ if(bytes.empty())
+ {
+ throw "size mismatch for `" + p->path + "'";
+ }
+
+ if(fwrite(reinterpret_cast<char*>(&bytes[0]), bytes.size(), 1, fileBZ2) != 1)
+ {
+ throw ": cannot write `" + pathBZ2 + "':\n" + lastError();
+ }
+
+ pos += static_cast<int>(bytes.size());
+ updated += bytes.size();
+
+ if(!_feedback->patchProgress(pos, p->size, updated, total))
+ {
+ fclose(fileBZ2);
+ return false;
+ }
+ }
+ }
+ catch(...)
+ {
+ fclose(fileBZ2);
+ throw;
+ }
+
+ fclose(fileBZ2);
+
+ decompressor->log(_log);
+ decompressor->add(*p);
+ }
+
+ if(!_feedback->patchEnd())
+ {
+ return false;
+ }
+ }
}
FileInfoSeq newLocalFiles;
newLocalFiles.reserve(_localFiles.size());
-
+
set_union(_localFiles.begin(),
- _localFiles.end(),
- files.begin(),
- files.end(),
- back_inserter(newLocalFiles),
- FileInfoLess());
-
+ _localFiles.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(newLocalFiles),
+ FileInfoLess());
+
_localFiles.swap(newLocalFiles);
FileInfoSeq newUpdateFiles;
set_difference(_updateFiles.begin(),
- _updateFiles.end(),
- files.begin(),
- files.end(),
- back_inserter(newUpdateFiles),
- FileInfoLess());
-
+ _updateFiles.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(newUpdateFiles),
+ FileInfoLess());
+
_updateFiles.swap(newUpdateFiles);
return true;
@@ -961,10 +961,10 @@ IcePatch2::Patcher::updateFlags(const FileInfoSeq& files)
{
for(FileInfoSeq::const_iterator p = files.begin(); p != files.end(); ++p)
{
- if(p->size >= 0) // Regular file?
- {
- setFileFlags(_dataDir + '/' + p->path, *p);
- }
+ if(p->size >= 0) // Regular file?
+ {
+ setFileFlags(_dataDir + '/' + p->path, *p);
+ }
}
//
@@ -974,32 +974,32 @@ IcePatch2::Patcher::updateFlags(const FileInfoSeq& files)
FileInfoSeq localFiles;
localFiles.reserve(_localFiles.size());
set_difference(_localFiles.begin(),
- _localFiles.end(),
- files.begin(),
- files.end(),
- back_inserter(localFiles),
- FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags.
+ _localFiles.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(localFiles),
+ FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags.
//
// Add the new files to the set of local file.
//
_localFiles.clear();
set_union(localFiles.begin(),
- localFiles.end(),
- files.begin(),
- files.end(),
- back_inserter(_localFiles),
- FileInfoLess());
+ localFiles.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(_localFiles),
+ FileInfoLess());
FileInfoSeq newUpdateFlags;
set_difference(_updateFlags.begin(),
- _updateFlags.end(),
- files.begin(),
- files.end(),
- back_inserter(newUpdateFlags),
- FileInfoLess());
-
+ _updateFlags.end(),
+ files.begin(),
+ files.end(),
+ back_inserter(newUpdateFlags),
+ FileInfoLess());
+
_updateFlags.swap(newUpdateFlags);
return true;
diff --git a/cpp/src/IcePatch2/FileServerI.cpp b/cpp/src/IcePatch2/FileServerI.cpp
index 3c647faf16c..c8fdcc2366c 100644
--- a/cpp/src/IcePatch2/FileServerI.cpp
+++ b/cpp/src/IcePatch2/FileServerI.cpp
@@ -35,7 +35,7 @@ IcePatch2::FileServerI::getFileInfoSeq(Int node0, const Current&) const
{
if(node0 < 0 || node0 > 255)
{
- throw PartitionOutOfRangeException();
+ throw PartitionOutOfRangeException();
}
return _tree0.nodes[node0].files;
@@ -48,7 +48,7 @@ IcePatch2::FileServerI::getChecksumSeq(const Current&) const
for(int node0 = 0; node0 < 256; ++node0)
{
- checksums[node0] = _tree0.nodes[node0].checksum;
+ checksums[node0] = _tree0.nodes[node0].checksum;
}
return checksums;
@@ -62,14 +62,14 @@ IcePatch2::FileServerI::getChecksum(const Current&) const
void
IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileCompressedPtr& cb,
- const string& pa, Int pos, Int num, const Current&) const
+ const string& pa, Int pos, Int num, const Current&) const
{
if(isAbsolute(pa))
{
- FileAccessException ex;
- ex.reason = "illegal absolute path `" + pa + "'";
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "illegal absolute path `" + pa + "'";
+ cb->ice_exception(ex);
+ return;
}
string path = simplify(pa);
@@ -78,39 +78,39 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp
path.find("/../") != string::npos ||
path.size() >= 3 && (path.substr(0, 3) == "../" || path.substr(path.size() - 3, 3) == "/.."))
{
- FileAccessException ex;
- ex.reason = "illegal `..' component in path `" + path + "'";
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "illegal `..' component in path `" + path + "'";
+ cb->ice_exception(ex);
+ return;
}
pair<const Byte*, const Byte*> ret(0, 0);
if(num <= 0 || pos < 0)
- {
+ {
cb->ice_response(ret);
- return;
+ return;
}
int fd = OS::open(_dataDir + '/' + path + ".bz2", O_RDONLY|O_BINARY);
if(fd == -1)
{
- FileAccessException ex;
- ex.reason = "cannot open `" + path + "' for reading: " + strerror(errno);
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "cannot open `" + path + "' for reading: " + strerror(errno);
+ cb->ice_exception(ex);
+ return;
}
if(lseek(fd, static_cast<off_t>(pos), SEEK_SET) != static_cast<off_t>(pos))
{
- close(fd);
+ close(fd);
- ostringstream posStr;
- posStr << pos;
+ ostringstream posStr;
+ posStr << pos;
- FileAccessException ex;
- ex.reason = "cannot seek position " + posStr.str() + " in file `" + path + "': " + strerror(errno);
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "cannot seek position " + posStr.str() + " in file `" + path + "': " + strerror(errno);
+ cb->ice_exception(ex);
+ return;
}
IceUtil::ScopedArray<Byte> bytes(new Byte[num]);
@@ -122,12 +122,12 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp
if((r = read(fd, bytes.get(), static_cast<size_t>(num))) == -1)
#endif
{
- close(fd);
+ close(fd);
- FileAccessException ex;
- ex.reason = "cannot read `" + path + "': " + strerror(errno);
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "cannot read `" + path + "': " + strerror(errno);
+ cb->ice_exception(ex);
+ return;
}
close(fd);
diff --git a/cpp/src/IcePatch2/FileServerI.h b/cpp/src/IcePatch2/FileServerI.h
index ae02fca4bd2..5c38e33a91b 100644
--- a/cpp/src/IcePatch2/FileServerI.h
+++ b/cpp/src/IcePatch2/FileServerI.h
@@ -29,7 +29,7 @@ public:
Ice::ByteSeq getChecksum(const Ice::Current&) const;
void getFileCompressed_async(const AMD_FileServer_getFileCompressedPtr&, const std::string&, Ice::Int pos,
- Ice::Int num, const Ice::Current&) const;
+ Ice::Int num, const Ice::Current&) const;
private:
diff --git a/cpp/src/IcePatch2/OS.cpp b/cpp/src/IcePatch2/OS.cpp
index 33eedc2d0b7..b57249f82de 100644
--- a/cpp/src/IcePatch2/OS.cpp
+++ b/cpp/src/IcePatch2/OS.cpp
@@ -68,7 +68,7 @@ OS::getcwd(string& cwd)
wchar_t cwdbuf[_MAX_PATH];
if(_wgetcwd(cwdbuf, _MAX_PATH) == NULL)
{
- return -1;
+ return -1;
}
cwd = IceUtil::wstringToString(cwdbuf);
return 0;
@@ -124,7 +124,7 @@ OS::getcwd(string& cwd)
char cwdbuf[PATH_MAX];
if(::getcwd(cwdbuf, PATH_MAX) == NULL)
{
- return -1;
+ return -1;
}
cwd = cwdbuf;
return 0;
diff --git a/cpp/src/IcePatch2/Server.cpp b/cpp/src/IcePatch2/Server.cpp
index a89db23f7af..98ac031b21a 100644
--- a/cpp/src/IcePatch2/Server.cpp
+++ b/cpp/src/IcePatch2/Server.cpp
@@ -25,14 +25,14 @@ class AdminI : public Admin
public:
AdminI(const CommunicatorPtr& communicator) :
- _communicator(communicator)
+ _communicator(communicator)
{
}
virtual void
shutdown(const Current&)
{
- _communicator->shutdown();
+ _communicator->shutdown();
}
private:
@@ -74,61 +74,61 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
vector<string> args;
try
{
- args = opts.parse(argc, (const char**)argv);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
error(e.reason);
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return false;
+ usage(argv[0]);
+ return false;
}
if(opts.isSet("version"))
{
- print(ICE_STRING_VERSION);
- return false;
+ print(ICE_STRING_VERSION);
+ return false;
}
if(args.size() > 1)
{
- error("too many arguments");
- usage(argv[0]);
- return false;
+ error("too many arguments");
+ usage(argv[0]);
+ return false;
}
if(args.size() == 1)
{
- properties->setProperty("IcePatch2.Directory", simplify(args[0]));
+ properties->setProperty("IcePatch2.Directory", simplify(args[0]));
}
string dataDir = properties->getPropertyWithDefault("IcePatch2.Directory", ".");
if(dataDir.empty())
{
- error("no data directory specified");
- usage(argv[0]);
- return false;
+ error("no data directory specified");
+ usage(argv[0]);
+ return false;
}
FileInfoSeq infoSeq;
try
{
- if(!isAbsolute(dataDir))
- {
- string cwd;
- if(OS::getcwd(cwd) != 0)
- {
- throw "cannot get the current directory:\n" + lastError();
- }
-
- dataDir = cwd + '/' + dataDir;
- }
-
- loadFileInfoSeq(dataDir, infoSeq);
+ if(!isAbsolute(dataDir))
+ {
+ string cwd;
+ if(OS::getcwd(cwd) != 0)
+ {
+ throw "cannot get the current directory:\n" + lastError();
+ }
+
+ dataDir = cwd + '/' + dataDir;
+ }
+
+ loadFileInfoSeq(dataDir, infoSeq);
}
catch(const string& ex)
{
@@ -146,7 +146,7 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
//
const string endpointsProperty = "Ice.OA.IcePatch2.Endpoints";
string endpoints = properties->getPropertyWithDefault(endpointsProperty,
- properties->getProperty("IcePatch2.Endpoints"));
+ properties->getProperty("IcePatch2.Endpoints"));
if(endpoints.empty())
{
error("property `" + endpointsProperty + "' is not set");
@@ -161,7 +161,7 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
if(!properties->getProperty("Ice.OA.IcePatch2.Admin.Endpoints").empty() ||
!properties->getProperty("IcePatch2.Admin.Endpoints").empty())
{
- adminAdapter = communicator()->createObjectAdapter("IcePatch2.Admin");
+ adminAdapter = communicator()->createObjectAdapter("IcePatch2.Admin");
}
const string instanceNameProperty = "IcePatch2.InstanceName";
@@ -174,16 +174,16 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
if(adminAdapter)
{
- Identity adminId;
- adminId.category = instanceName;
- adminId.name = "admin";
- adminAdapter->add(new AdminI(communicator()), adminId);
+ Identity adminId;
+ adminId.category = instanceName;
+ adminId.name = "admin";
+ adminAdapter->add(new AdminI(communicator()), adminId);
}
adapter->activate();
if(adminAdapter)
{
- adminAdapter->activate();
+ adminAdapter->activate();
}
return true;
@@ -199,30 +199,30 @@ void
IcePatch2::PatcherService::usage(const string& appName)
{
string options =
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.";
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.";
#ifdef _WIN32
if(checkSystem())
{
options.append(
- "\n"
- "\n"
- "--service NAME Run as the Windows service NAME.\n"
- "\n"
- "--install NAME [--display DISP] [--executable EXEC] [args]\n"
- " Install as Windows service NAME. If DISP is\n"
- " provided, use it as the display name,\n"
- " otherwise NAME is used. If EXEC is provided,\n"
- " use it as the service executable, otherwise\n"
- " this executable is used. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service at startup.\n"
- "--uninstall NAME Uninstall Windows service NAME.\n"
- "--start NAME [args] Start Windows service NAME. Any additional\n"
- " arguments are passed unchanged to the\n"
- " service.\n"
- "--stop NAME Stop Windows service NAME."
+ "\n"
+ "\n"
+ "--service NAME Run as the Windows service NAME.\n"
+ "\n"
+ "--install NAME [--display DISP] [--executable EXEC] [args]\n"
+ " Install as Windows service NAME. If DISP is\n"
+ " provided, use it as the display name,\n"
+ " otherwise NAME is used. If EXEC is provided,\n"
+ " use it as the service executable, otherwise\n"
+ " this executable is used. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service at startup.\n"
+ "--uninstall NAME Uninstall Windows service NAME.\n"
+ "--start NAME [args] Start Windows service NAME. Any additional\n"
+ " arguments are passed unchanged to the\n"
+ " service.\n"
+ "--stop NAME Stop Windows service NAME."
);
}
#else
@@ -232,7 +232,7 @@ IcePatch2::PatcherService::usage(const string& appName)
"--daemon Run as a daemon.\n"
"--noclose Do not close open file descriptors."
- // --nochdir is intentionally not shown here. (See the comment in main().)
+ // --nochdir is intentionally not shown here. (See the comment in main().)
);
#endif
print("Usage: " + appName + " [options] [DIR]\n" + options);
@@ -269,13 +269,13 @@ main(int argc, char* argv[])
{
v[i + 1] = new char[strlen(argv[i]) + 1];
strcpy(v[i + 1], argv[i]);
- vsave[i + 1] = v[i + 1];
+ vsave[i + 1] = v[i + 1];
}
v[argc + 1] = 0;
try
{
- int ac = argc + 1;
+ int ac = argc + 1;
status = svc.main(ac, v);
}
catch(...)
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp
index f18a1b86b75..57b7890f723 100644
--- a/cpp/src/IcePatch2/Util.cpp
+++ b/cpp/src/IcePatch2/Util.cpp
@@ -44,8 +44,8 @@ const char* IcePatch2::logFile = "IcePatch2.log";
extern "C" static int
ice_scandir(const char* dir, struct dirent*** namelist,
- int (*select)(const struct dirent*),
- int (*compar)(const void*, const void*))
+ int (*select)(const struct dirent*),
+ int (*compar)(const void*, const void*))
{
DIR* d;
struct dirent* entry;
@@ -54,46 +54,46 @@ ice_scandir(const char* dir, struct dirent*** namelist,
if((d = opendir(dir)) == 0)
{
- return -1;
+ return -1;
}
*namelist = 0;
while((entry = readdir(d)) != 0)
{
- if(select == 0 || (select != 0 && (*select)(entry)))
- {
- *namelist = (struct dirent**)realloc((void*)(*namelist), (size_t)((i + 1) * sizeof(struct dirent*)));
- if(*namelist == 0)
- {
- closedir(d);
- return -1;
- }
-
- entrysize = sizeof(struct dirent) - sizeof(entry->d_name) + strlen(entry->d_name) + 1;
- (*namelist)[i] = (struct dirent*)malloc(entrysize);
- if((*namelist)[i] == 0)
- {
- closedir(d);
- return -1;
- }
- memcpy((*namelist)[i], entry, entrysize);
- ++i;
- }
+ if(select == 0 || (select != 0 && (*select)(entry)))
+ {
+ *namelist = (struct dirent**)realloc((void*)(*namelist), (size_t)((i + 1) * sizeof(struct dirent*)));
+ if(*namelist == 0)
+ {
+ closedir(d);
+ return -1;
+ }
+
+ entrysize = sizeof(struct dirent) - sizeof(entry->d_name) + strlen(entry->d_name) + 1;
+ (*namelist)[i] = (struct dirent*)malloc(entrysize);
+ if((*namelist)[i] == 0)
+ {
+ closedir(d);
+ return -1;
+ }
+ memcpy((*namelist)[i], entry, entrysize);
+ ++i;
+ }
}
if(closedir(d))
{
- return -1;
+ return -1;
}
if(i == 0)
{
- return -1;
+ return -1;
}
if(compar != 0)
{
- qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar);
+ qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar);
}
return i;
@@ -117,10 +117,10 @@ bool
IcePatch2::writeFileInfo(FILE* fp, const FileInfo& info)
{
int rc = fprintf(fp, "%s\t%s\t%d\t%d\n",
- IceUtil::escapeString(info.path, "").c_str(),
- bytesToString(info.checksum).c_str(),
- info.size,
- static_cast<int>(info.executable));
+ IceUtil::escapeString(info.path, "").c_str(),
+ bytesToString(info.checksum).c_str(),
+ info.size,
+ static_cast<int>(info.executable));
return rc > 0;
}
@@ -131,17 +131,17 @@ IcePatch2::readFileInfo(FILE* fp, FileInfo& info)
char buf[BUFSIZ];
while(fgets(buf, static_cast<int>(sizeof(buf)), fp) != 0)
{
- data += buf;
+ data += buf;
- size_t len = strlen(buf);
- if(buf[len - 1] == '\n')
- {
- break;
- }
+ size_t len = strlen(buf);
+ if(buf[len - 1] == '\n')
+ {
+ break;
+ }
}
if(data.empty())
{
- return false;
+ return false;
}
istringstream is(data);
@@ -165,31 +165,31 @@ IcePatch2::lastError()
#ifdef _WIN32
LPVOID lpMsgBuf = 0;
DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
if(ok)
{
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((const char*)msg) > 0);
- string result = (const char*)msg;
- LocalFree(lpMsgBuf);
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((const char*)msg) > 0);
+ string result = (const char*)msg;
+ LocalFree(lpMsgBuf);
- while(result.size() >= 1 && (result[result.size() - 1] == '\n' || result[result.size() - 1] == '\r'))
- {
- result.erase(result.size() - 1);
- }
+ while(result.size() >= 1 && (result[result.size() - 1] == '\n' || result[result.size() - 1] == '\r'))
+ {
+ result.erase(result.size() - 1);
+ }
- return result;
+ return result;
}
else
{
- return "unknown error";
+ return "unknown error";
}
#else
return strerror(errno);
@@ -204,7 +204,7 @@ IcePatch2::bytesToString(const ByteSeq& bytes)
for(ByteSeq::const_iterator p = bytes.begin(); p != bytes.end(); ++p)
{
- s << setw(2) << setfill('0') << hex << static_cast<int>(*p);
+ s << setw(2) << setfill('0') << hex << static_cast<int>(*p);
}
return s.str();
@@ -217,8 +217,8 @@ IcePatch2::bytesToString(const ByteSeq& bytes)
for(unsigned int i = 0; i < bytes.size(); ++i)
{
- s[i * 2] = toHex[(bytes[i] >> 4) & 0xf];
- s[i * 2 + 1] = toHex[bytes[i] & 0xf];
+ s[i * 2] = toHex[(bytes[i] >> 4) & 0xf];
+ s[i * 2 + 1] = toHex[bytes[i] & 0xf];
}
return s;
@@ -233,37 +233,37 @@ IcePatch2::stringToBytes(const string& str)
for(unsigned int i = 0; i + 1 < str.size(); i += 2)
{
/*
- istringstream is(str.substr(i, 2));
- int byte;
- is >> hex >> byte;
+ istringstream is(str.substr(i, 2));
+ int byte;
+ is >> hex >> byte;
*/
- int byte = 0;
+ int byte = 0;
- for(int j = 0; j < 2; ++j)
- {
- char c = str[i + j];
+ for(int j = 0; j < 2; ++j)
+ {
+ char c = str[i + j];
- if(c >= '0' && c <= '9')
- {
- byte |= c - '0';
- }
- else if(c >= 'a' && c <= 'f')
- {
- byte |= 10 + c - 'a';
- }
- else if(c >= 'A' && c <= 'F')
- {
- byte |= 10 + c - 'A';
- }
+ if(c >= '0' && c <= '9')
+ {
+ byte |= c - '0';
+ }
+ else if(c >= 'a' && c <= 'f')
+ {
+ byte |= 10 + c - 'a';
+ }
+ else if(c >= 'A' && c <= 'F')
+ {
+ byte |= 10 + c - 'A';
+ }
- if(j == 0)
- {
- byte <<= 4;
- }
- }
+ if(j == 0)
+ {
+ byte <<= 4;
+ }
+ }
- bytes.push_back(static_cast<Byte>(byte));
+ bytes.push_back(static_cast<Byte>(byte));
}
return bytes;
@@ -279,23 +279,23 @@ IcePatch2::simplify(const string& path)
#ifdef _WIN32
for(pos = 0; pos < result.size(); ++pos)
{
- if(result[pos] == '\\')
- {
- result[pos] = '/';
- }
+ if(result[pos] == '\\')
+ {
+ result[pos] = '/';
+ }
}
#endif
pos = 0;
while((pos = result.find("//", pos)) != string::npos)
{
- result.erase(pos, 1);
+ result.erase(pos, 1);
}
pos = 0;
while((pos = result.find("/./", pos)) != string::npos)
{
- result.erase(pos, 2);
+ result.erase(pos, 2);
}
while(result.substr(0, 4) == "/../")
@@ -305,7 +305,7 @@ IcePatch2::simplify(const string& path)
if(result.substr(0, 2) == "./")
{
- result.erase(0, 2);
+ result.erase(0, 2);
}
if(result == "/." ||
@@ -316,7 +316,7 @@ IcePatch2::simplify(const string& path)
if(result.size() >= 2 && result.substr(result.size() - 2, 2) == "/.")
{
- result.erase(result.size() - 2, 2);
+ result.erase(result.size() - 2, 2);
}
if(result == "/" || result.size() == 3 && isalpha(result[0]) && result[1] == ':' && result[2] == '/')
@@ -326,7 +326,7 @@ IcePatch2::simplify(const string& path)
if(result.size() >= 1 && result[result.size() - 1] == '/')
{
- result.erase(result.size() - 1);
+ result.erase(result.size() - 1);
}
if(result == "/..")
@@ -342,7 +342,7 @@ IcePatch2::isAbsolute(const string& pa)
{
if(pa.empty())
{
- return false;
+ return false;
}
unsigned i = 0;
@@ -378,7 +378,7 @@ IcePatch2::getSuffix(const string& pa)
if(dotPos == string::npos || slashPos != string::npos && slashPos > dotPos)
{
- return string();
+ return string();
}
return path.substr(dotPos + 1);
@@ -394,7 +394,7 @@ IcePatch2::getWithoutSuffix(const string& pa)
if(dotPos == string::npos || slashPos != string::npos && slashPos > dotPos)
{
- return path;
+ return path;
}
return path.substr(0, dotPos);
@@ -405,9 +405,9 @@ IcePatch2::ignoreSuffix(const string& path)
{
string suffix = getSuffix(path);
return suffix == "md5" // For legacy IcePatch.
- || suffix == "tot" // For legacy IcePatch.
- || suffix == "bz2"
- || suffix == "bz2temp";
+ || suffix == "tot" // For legacy IcePatch.
+ || suffix == "bz2"
+ || suffix == "bz2temp";
}
string
@@ -418,11 +418,11 @@ IcePatch2::getBasename(const string& pa)
string::size_type pos = path.rfind('/');
if(pos == string::npos)
{
- return path;
+ return path;
}
else
{
- return path.substr(pos + 1);
+ return path.substr(pos + 1);
}
}
@@ -434,11 +434,11 @@ IcePatch2::getDirname(const string& pa)
string::size_type pos = path.rfind('/');
if(pos == string::npos)
{
- return string();
+ return string();
}
else
{
- return path.substr(0, pos);
+ return path.substr(0, pos);
}
}
@@ -453,7 +453,7 @@ IcePatch2::rename(const string& fromPa, const string& toPa)
if(OS::rename(fromPath ,toPath) == -1)
{
- throw "cannot rename `" + fromPath + "' to `" + toPath + "': " + lastError();
+ throw "cannot rename `" + fromPath + "' to `" + toPath + "': " + lastError();
}
}
@@ -465,26 +465,26 @@ IcePatch2::remove(const string& pa)
OS::structstat buf;
if(OS::osstat(path, &buf) == -1)
{
- throw "cannot stat `" + path + "':\n" + lastError();
+ throw "cannot stat `" + path + "':\n" + lastError();
}
if(S_ISDIR(buf.st_mode))
{
- if(OS::rmdir(path) == -1)
- {
- if(errno == EACCES)
- {
- assert(false);
- }
- throw "cannot remove directory `" + path + "':\n" + lastError();
- }
+ if(OS::rmdir(path) == -1)
+ {
+ if(errno == EACCES)
+ {
+ assert(false);
+ }
+ throw "cannot remove directory `" + path + "':\n" + lastError();
+ }
}
else
{
- if(OS::remove(path) == -1)
- {
- throw "cannot remove file `" + path + "':\n" + lastError();
- }
+ if(OS::remove(path) == -1)
+ {
+ throw "cannot remove file `" + path + "':\n" + lastError();
+ }
}
}
@@ -496,31 +496,31 @@ IcePatch2::removeRecursive(const string& pa)
OS::structstat buf;
if(OS::osstat(path, &buf) == -1)
{
- throw "cannot stat `" + path + "':\n" + lastError();
+ throw "cannot stat `" + path + "':\n" + lastError();
}
if(S_ISDIR(buf.st_mode))
{
- StringSeq paths = readDirectory(path);
- for(StringSeq::const_iterator p = paths.begin(); p != paths.end(); ++p)
- {
- removeRecursive(path + '/' + *p);
- }
+ StringSeq paths = readDirectory(path);
+ for(StringSeq::const_iterator p = paths.begin(); p != paths.end(); ++p)
+ {
+ removeRecursive(path + '/' + *p);
+ }
- if(!isRoot(path))
- {
- if(OS::rmdir(path) == -1)
- {
- throw "cannot remove directory `" + path + "':\n" + lastError();
- }
- }
+ if(!isRoot(path))
+ {
+ if(OS::rmdir(path) == -1)
+ {
+ throw "cannot remove directory `" + path + "':\n" + lastError();
+ }
+ }
}
else
{
- if(OS::remove(path) == -1)
- {
- throw "cannot remove file `" + path + "':\n" + lastError();
- }
+ if(OS::remove(path) == -1)
+ {
+ throw "cannot remove file `" + path + "':\n" + lastError();
+ }
}
}
@@ -539,35 +539,35 @@ IcePatch2::readDirectory(const string& pa)
int h = _wfindfirst(fs.c_str(), &data, FA_DIREC);
if(h == -1)
{
- if(_doserrno == ENMFILE)
- {
- return result;
- }
- throw "cannot read directory `" + path + "':\n" + lastError();
+ if(_doserrno == ENMFILE)
+ {
+ return result;
+ }
+ throw "cannot read directory `" + path + "':\n" + lastError();
}
while(true)
{
- string name = IceUtil::wstringToString(data.ff_name);
- assert(!name.empty());
+ string name = IceUtil::wstringToString(data.ff_name);
+ assert(!name.empty());
- if(name != ".." && name != ".")
- {
- result.push_back(name);
- }
+ if(name != ".." && name != ".")
+ {
+ result.push_back(name);
+ }
- if(_wfindnext(&data) == -1)
- {
- if(errno == ENOENT)
- {
- break;
- }
+ if(_wfindnext(&data) == -1)
+ {
+ if(errno == ENOENT)
+ {
+ break;
+ }
- string ex = "cannot read directory `" + path + "':\n" + lastError();
- _wfindclose(&data);
- throw ex;
- }
+ string ex = "cannot read directory `" + path + "':\n" + lastError();
+ _wfindclose(&data);
+ throw ex;
+ }
}
_wfindclose(&data);
@@ -623,7 +623,7 @@ IcePatch2::readDirectory(const string& pa)
#endif
if(n < 0)
{
- throw "cannot read directory `" + path + "':\n" + lastError();
+ throw "cannot read directory `" + path + "':\n" + lastError();
}
StringSeq result;
@@ -631,15 +631,15 @@ IcePatch2::readDirectory(const string& pa)
for(int i = 0; i < n; ++i)
{
- string name = namelist[i]->d_name;
- assert(!name.empty());
+ string name = namelist[i]->d_name;
+ assert(!name.empty());
- free(namelist[i]);
+ free(namelist[i]);
- if(name != ".." && name != ".")
- {
- result.push_back(name);
- }
+ if(name != ".." && name != ".")
+ {
+ result.push_back(name);
+ }
}
free(namelist);
@@ -655,10 +655,10 @@ IcePatch2::createDirectory(const string& pa)
if(OS::mkdir(path, 0777) == -1)
{
- if(errno != EEXIST)
- {
- throw "cannot create directory `" + path + "':\n" + lastError();
- }
+ if(errno != EEXIST)
+ {
+ throw "cannot create directory `" + path + "':\n" + lastError();
+ }
}
}
@@ -670,26 +670,26 @@ IcePatch2::createDirectoryRecursive(const string& pa)
string dir = getDirname(path);
if(!dir.empty())
{
- createDirectoryRecursive(dir);
+ createDirectoryRecursive(dir);
}
if(!isRoot(path + "/"))
{
- OS::structstat buf;
- if(OS::osstat(path, &buf) != -1)
- {
- if(S_ISDIR(buf.st_mode))
- {
- return;
- }
- }
+ OS::structstat buf;
+ if(OS::osstat(path, &buf) != -1)
+ {
+ if(S_ISDIR(buf.st_mode))
+ {
+ return;
+ }
+ }
if(OS::mkdir(path, 0777) == -1)
{
- if(errno != EEXIST)
- {
- throw "cannot create directory `" + path + "':\n" + lastError();
- }
+ if(errno != EEXIST)
+ {
+ throw "cannot create directory `" + path + "':\n" + lastError();
+ }
}
}
}
@@ -702,45 +702,45 @@ IcePatch2::compressBytesToFile(const string& pa, const ByteSeq& bytes, Int pos)
FILE* stdioFile = OS::fopen(path, "wb");
if(!stdioFile)
{
- throw "cannot open `" + path + "' for writing:\n" + lastError();
+ throw "cannot open `" + path + "' for writing:\n" + lastError();
}
int bzError;
BZFILE* bzFile = BZ2_bzWriteOpen(&bzError, stdioFile, 5, 0, 0);
if(bzError != BZ_OK)
{
- string ex = "BZ2_bzWriteOpen failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- fclose(stdioFile);
- throw ex;
+ string ex = "BZ2_bzWriteOpen failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ fclose(stdioFile);
+ throw ex;
}
BZ2_bzWrite(&bzError, bzFile, const_cast<Byte*>(&bytes[pos]), static_cast<int>(bytes.size() - pos));
if(bzError != BZ_OK)
{
- string ex = "BZ2_bzWrite failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- BZ2_bzWriteClose(&bzError, bzFile, 0, 0, 0);
- fclose(stdioFile);
- throw ex;
+ string ex = "BZ2_bzWrite failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ BZ2_bzWriteClose(&bzError, bzFile, 0, 0, 0);
+ fclose(stdioFile);
+ throw ex;
}
BZ2_bzWriteClose(&bzError, bzFile, 0, 0, 0);
if(bzError != BZ_OK)
{
- string ex = "BZ2_bzWriteClose failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- fclose(stdioFile);
- throw ex;
+ string ex = "BZ2_bzWriteClose failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ fclose(stdioFile);
+ throw ex;
}
fclose(stdioFile);
@@ -759,136 +759,136 @@ IcePatch2::decompressFile(const string& pa)
try
{
- fp = OS::fopen(path, "wb");
- if(!fp)
- {
- throw "cannot open `" + path + "' for writing:\n" + lastError();
- }
-
- stdioFileBZ2 = OS::fopen(pathBZ2, "rb");
- if(!stdioFileBZ2)
- {
- throw "cannot open `" + pathBZ2 + "' for reading:\n" + lastError();
- }
+ fp = OS::fopen(path, "wb");
+ if(!fp)
+ {
+ throw "cannot open `" + path + "' for writing:\n" + lastError();
+ }
+
+ stdioFileBZ2 = OS::fopen(pathBZ2, "rb");
+ if(!stdioFileBZ2)
+ {
+ throw "cannot open `" + pathBZ2 + "' for reading:\n" + lastError();
+ }
#ifdef __BCPLUSPLUS__
- //
- // The BZ2_bzReadOpen/BZ2_bzRead/BZ2_bzReadClose functions fail with BCC
- //
- OS::structstat buf;
- if(OS::osstat(pathBZ2, &buf) == -1)
- {
- throw "cannot stat `" + pathBZ2 + "':\n" + lastError();
- }
-
- ByteSeq compressedBytes(buf.st_size);
- if(fread(&compressedBytes[0], buf.st_size, 1, stdioFileBZ2) == -1)
- {
- throw "cannot read from `" + pathBZ2 + "':\n" + lastError();
- }
-
- ByteSeq uncompressedBytes;
- unsigned int uncompressedLen = buf.st_size * 2;
- while(true)
- {
- uncompressedBytes.resize(uncompressedLen);
- int bzError = BZ2_bzBuffToBuffDecompress(&uncompressedBytes[0], &uncompressedLen, &compressedBytes[0],
- buf.st_size, 0, 0);
- if(bzError == BZ_OK)
- {
- break;
- }
- else if(bzError == BZ_OUTBUFF_FULL)
- {
- uncompressedLen *= 2;
- continue;
- }
- else
- {
- string ex = "BZ2_bzBuffToBuffDecompress failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- throw ex;
- }
- }
-
- if(fwrite(&uncompressedBytes[0], uncompressedLen, 1, fp) != 1)
- {
- throw "cannot write to `" + path + "':\n" + lastError();
- }
+ //
+ // The BZ2_bzReadOpen/BZ2_bzRead/BZ2_bzReadClose functions fail with BCC
+ //
+ OS::structstat buf;
+ if(OS::osstat(pathBZ2, &buf) == -1)
+ {
+ throw "cannot stat `" + pathBZ2 + "':\n" + lastError();
+ }
+
+ ByteSeq compressedBytes(buf.st_size);
+ if(fread(&compressedBytes[0], buf.st_size, 1, stdioFileBZ2) == -1)
+ {
+ throw "cannot read from `" + pathBZ2 + "':\n" + lastError();
+ }
+
+ ByteSeq uncompressedBytes;
+ unsigned int uncompressedLen = buf.st_size * 2;
+ while(true)
+ {
+ uncompressedBytes.resize(uncompressedLen);
+ int bzError = BZ2_bzBuffToBuffDecompress(&uncompressedBytes[0], &uncompressedLen, &compressedBytes[0],
+ buf.st_size, 0, 0);
+ if(bzError == BZ_OK)
+ {
+ break;
+ }
+ else if(bzError == BZ_OUTBUFF_FULL)
+ {
+ uncompressedLen *= 2;
+ continue;
+ }
+ else
+ {
+ string ex = "BZ2_bzBuffToBuffDecompress failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ throw ex;
+ }
+ }
+
+ if(fwrite(&uncompressedBytes[0], uncompressedLen, 1, fp) != 1)
+ {
+ throw "cannot write to `" + path + "':\n" + lastError();
+ }
#else
- bzFile = BZ2_bzReadOpen(&bzError, stdioFileBZ2, 0, 0, 0, 0);
- if(bzError != BZ_OK)
- {
- string ex = "BZ2_bzReadOpen failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- throw ex;
- }
-
- const Int numBZ2 = 64 * 1024;
- Byte bytesBZ2[numBZ2];
-
- while(bzError != BZ_STREAM_END)
- {
- int sz = BZ2_bzRead(&bzError, bzFile, bytesBZ2, numBZ2);
- if(bzError != BZ_OK && bzError != BZ_STREAM_END)
- {
- string ex = "BZ2_bzRead failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- throw ex;
- }
-
- if(sz > 0)
- {
- long pos = ftell(stdioFileBZ2);
- if(pos == -1)
- {
- throw "cannot get read position for `" + pathBZ2 + "':\n" + lastError();
- }
-
- if(fwrite(bytesBZ2, sz, 1, fp) != 1)
- {
- throw "cannot write to `" + path + "':\n" + lastError();
- }
- }
- }
-
- BZ2_bzReadClose(&bzError, bzFile);
- bzFile = 0;
- if(bzError != BZ_OK)
- {
- string ex = "BZ2_bzReadClose failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- throw ex;
- }
+ bzFile = BZ2_bzReadOpen(&bzError, stdioFileBZ2, 0, 0, 0, 0);
+ if(bzError != BZ_OK)
+ {
+ string ex = "BZ2_bzReadOpen failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ throw ex;
+ }
+
+ const Int numBZ2 = 64 * 1024;
+ Byte bytesBZ2[numBZ2];
+
+ while(bzError != BZ_STREAM_END)
+ {
+ int sz = BZ2_bzRead(&bzError, bzFile, bytesBZ2, numBZ2);
+ if(bzError != BZ_OK && bzError != BZ_STREAM_END)
+ {
+ string ex = "BZ2_bzRead failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ throw ex;
+ }
+
+ if(sz > 0)
+ {
+ long pos = ftell(stdioFileBZ2);
+ if(pos == -1)
+ {
+ throw "cannot get read position for `" + pathBZ2 + "':\n" + lastError();
+ }
+
+ if(fwrite(bytesBZ2, sz, 1, fp) != 1)
+ {
+ throw "cannot write to `" + path + "':\n" + lastError();
+ }
+ }
+ }
+
+ BZ2_bzReadClose(&bzError, bzFile);
+ bzFile = 0;
+ if(bzError != BZ_OK)
+ {
+ string ex = "BZ2_bzReadClose failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ throw ex;
+ }
#endif
}
catch(...)
{
- if(bzFile != 0)
- {
- BZ2_bzReadClose(&bzError, bzFile);
- }
- if(stdioFileBZ2 != 0)
- {
- fclose(stdioFileBZ2);
- }
- if(fp != 0)
- {
- fclose(fp);
- }
- throw;
+ if(bzFile != 0)
+ {
+ BZ2_bzReadClose(&bzError, bzFile);
+ }
+ if(stdioFileBZ2 != 0)
+ {
+ fclose(stdioFileBZ2);
+ }
+ if(fp != 0)
+ {
+ fclose(fp);
+ }
+ throw;
}
fclose(stdioFileBZ2);
@@ -903,7 +903,7 @@ IcePatch2::setFileFlags(const string& pa, const FileInfo& info)
OS::structstat buf;
if(OS::osstat(path, &buf) == -1)
{
- throw "cannot stat `" + path + "':\n" + lastError();
+ throw "cannot stat `" + path + "':\n" + lastError();
}
chmod(path.c_str(), info.executable ? buf.st_mode | S_IXUSR : buf.st_mode & ~S_IXUSR);
#endif
@@ -911,321 +911,321 @@ IcePatch2::setFileFlags(const string& pa, const FileInfo& info)
static bool
getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, GetFileInfoSeqCB* cb,
- FileInfoSeq& infoSeq)
+ FileInfoSeq& infoSeq)
{
if(relPath == checksumFile || relPath == logFile)
{
- return true;
+ return true;
}
const string path = simplify(basePath + '/' + relPath);
if(ignoreSuffix(path))
{
- const string pathWithoutSuffix = getWithoutSuffix(path);
-
- if(ignoreSuffix(pathWithoutSuffix))
- {
- if(cb && !cb->remove(relPath))
- {
- return false;
- }
-
- remove(path); // Removing file with suffix for another file that already has a suffix.
- }
- else
- {
- OS::structstat buf;
- if(OS::osstat(getWithoutSuffix(path), &buf) == -1)
- {
- if(errno == ENOENT)
- {
- if(cb && !cb->remove(relPath))
- {
- return false;
- }
-
- remove(path); // Removing orphaned file.
- }
- else
- {
- throw "cannot stat `" + path + "':\n" + lastError();
- }
- }
- else if(buf.st_size == 0)
- {
- if(cb && !cb->remove(relPath))
- {
- return false;
- }
-
- remove(path); // Removing file with suffix for empty file.
- }
- }
+ const string pathWithoutSuffix = getWithoutSuffix(path);
+
+ if(ignoreSuffix(pathWithoutSuffix))
+ {
+ if(cb && !cb->remove(relPath))
+ {
+ return false;
+ }
+
+ remove(path); // Removing file with suffix for another file that already has a suffix.
+ }
+ else
+ {
+ OS::structstat buf;
+ if(OS::osstat(getWithoutSuffix(path), &buf) == -1)
+ {
+ if(errno == ENOENT)
+ {
+ if(cb && !cb->remove(relPath))
+ {
+ return false;
+ }
+
+ remove(path); // Removing orphaned file.
+ }
+ else
+ {
+ throw "cannot stat `" + path + "':\n" + lastError();
+ }
+ }
+ else if(buf.st_size == 0)
+ {
+ if(cb && !cb->remove(relPath))
+ {
+ return false;
+ }
+
+ remove(path); // Removing file with suffix for empty file.
+ }
+ }
}
else
{
- OS::structstat buf;
- if(OS::osstat(path, &buf) == -1)
- {
- throw "cannot stat `" + path + "':\n" + lastError();
- }
-
- if(S_ISDIR(buf.st_mode))
- {
- FileInfo info;
- info.path = relPath;
- info.size = -1;
- info.executable = false;
-
- ByteSeq bytes(relPath.size());
- copy(relPath.begin(), relPath.end(), bytes.begin());
-
- ByteSeq bytesSHA(20);
- if(!bytes.empty())
- {
- SHA1(reinterpret_cast<unsigned char*>(&bytes[0]), bytes.size(),
- reinterpret_cast<unsigned char*>(&bytesSHA[0]));
- }
- else
- {
- fill(bytesSHA.begin(), bytesSHA.end(), 0);
- }
- info.checksum.swap(bytesSHA);
-
- infoSeq.push_back(info);
-
- StringSeq content = readDirectory(path);
- for(StringSeq::const_iterator p = content.begin(); p != content.end() ; ++p)
- {
- if(!getFileInfoSeqInt(basePath, simplify(relPath + '/' + *p), compress, cb, infoSeq))
- {
- return false;
- }
- }
- }
- else if(S_ISREG(buf.st_mode))
- {
- FileInfo info;
- info.path = relPath;
- info.size = 0;
+ OS::structstat buf;
+ if(OS::osstat(path, &buf) == -1)
+ {
+ throw "cannot stat `" + path + "':\n" + lastError();
+ }
+
+ if(S_ISDIR(buf.st_mode))
+ {
+ FileInfo info;
+ info.path = relPath;
+ info.size = -1;
+ info.executable = false;
+
+ ByteSeq bytes(relPath.size());
+ copy(relPath.begin(), relPath.end(), bytes.begin());
+
+ ByteSeq bytesSHA(20);
+ if(!bytes.empty())
+ {
+ SHA1(reinterpret_cast<unsigned char*>(&bytes[0]), bytes.size(),
+ reinterpret_cast<unsigned char*>(&bytesSHA[0]));
+ }
+ else
+ {
+ fill(bytesSHA.begin(), bytesSHA.end(), 0);
+ }
+ info.checksum.swap(bytesSHA);
+
+ infoSeq.push_back(info);
+
+ StringSeq content = readDirectory(path);
+ for(StringSeq::const_iterator p = content.begin(); p != content.end() ; ++p)
+ {
+ if(!getFileInfoSeqInt(basePath, simplify(relPath + '/' + *p), compress, cb, infoSeq))
+ {
+ return false;
+ }
+ }
+ }
+ else if(S_ISREG(buf.st_mode))
+ {
+ FileInfo info;
+ info.path = relPath;
+ info.size = 0;
#ifdef _WIN32
- info.executable = false; // Windows doesn't support the executable flag
+ info.executable = false; // Windows doesn't support the executable flag
#else
- info.executable = buf.st_mode & S_IXUSR;
+ info.executable = buf.st_mode & S_IXUSR;
#endif
OS::structstat bufBZ2;
- const string pathBZ2 = path + ".bz2";
- bool doCompress = false;
- if(buf.st_size != 0 && compress > 0)
- {
- //
- // compress == 0: Never compress.
- // compress == 1: Compress if necessary.
- // compress >= 2: Always compress.
- //
- if(compress >= 2 || OS::osstat(pathBZ2, &bufBZ2) == -1 || buf.st_mtime >= bufBZ2.st_mtime)
- {
- if(cb && !cb->compress(relPath))
- {
- return false;
- }
-
- doCompress = true;
- }
- else
- {
- info.size = static_cast<Int>(bufBZ2.st_size);
- }
- }
-
- if(cb && !cb->checksum(relPath))
- {
- return false;
- }
-
- ByteSeq bytesSHA(20);
-
- if(relPath.size() + buf.st_size == 0)
- {
- fill(bytesSHA.begin(), bytesSHA.end(), 0);
- }
- else
- {
- SHA_CTX ctx;
- SHA1_Init(&ctx);
- if(relPath.size() != 0)
- {
- SHA1_Update(&ctx, reinterpret_cast<const void*>(relPath.c_str()), relPath.size());
- }
-
- if(buf.st_size != 0)
- {
+ const string pathBZ2 = path + ".bz2";
+ bool doCompress = false;
+ if(buf.st_size != 0 && compress > 0)
+ {
+ //
+ // compress == 0: Never compress.
+ // compress == 1: Compress if necessary.
+ // compress >= 2: Always compress.
+ //
+ if(compress >= 2 || OS::osstat(pathBZ2, &bufBZ2) == -1 || buf.st_mtime >= bufBZ2.st_mtime)
+ {
+ if(cb && !cb->compress(relPath))
+ {
+ return false;
+ }
+
+ doCompress = true;
+ }
+ else
+ {
+ info.size = static_cast<Int>(bufBZ2.st_size);
+ }
+ }
+
+ if(cb && !cb->checksum(relPath))
+ {
+ return false;
+ }
+
+ ByteSeq bytesSHA(20);
+
+ if(relPath.size() + buf.st_size == 0)
+ {
+ fill(bytesSHA.begin(), bytesSHA.end(), 0);
+ }
+ else
+ {
+ SHA_CTX ctx;
+ SHA1_Init(&ctx);
+ if(relPath.size() != 0)
+ {
+ SHA1_Update(&ctx, reinterpret_cast<const void*>(relPath.c_str()), relPath.size());
+ }
+
+ if(buf.st_size != 0)
+ {
#ifdef __BCPLUSPLUS__
- //
- // The BZ2_bzWriteOpen/BZ2_bzWrite/BZ2_bzWriteClose functions fail with BCC
- //
- if(doCompress)
- {
- int fd = OS::open(path.c_str(), O_BINARY|O_RDONLY);
- if(fd == -1)
- {
- throw "cannot open `" + path + "' for reading:\n" + lastError();
- }
-
- ByteSeq uncompressedBytes(buf.st_size);
-
- if(read(fd, &uncompressedBytes[0], buf.st_size) == -1)
- {
- close(fd);
- throw "cannot read from `" + path + "':\n" + lastError();
- }
-
- unsigned int compressedLen = buf.st_size * 1.01 + 600;
- ByteSeq compressedBytes(compressedLen);
-
- int bzError = BZ2_bzBuffToBuffCompress(&compressedBytes[0], &compressedLen,
- &uncompressedBytes[0], buf.st_size, 5, 0, 0);
- if(bzError != BZ_OK)
- {
- string ex = "BZ2_bzBuffToBuffCompress failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- close(fd);
- throw ex;
- }
- close(fd);
-
- const string pathBZ2Temp = path + ".bz2temp";
- FILE* stdioFile = OS::fopen(pathBZ2Temp, "wb");
- if(fwrite(&compressedBytes[0], compressedLen, 1, stdioFile) != 1)
- {
- fclose(stdioFile);
- throw "cannot write to `" + pathBZ2Temp + "':\n" + lastError();
- }
- fclose(stdioFile);
-
- rename(pathBZ2Temp, pathBZ2);
-
- }
+ //
+ // The BZ2_bzWriteOpen/BZ2_bzWrite/BZ2_bzWriteClose functions fail with BCC
+ //
+ if(doCompress)
+ {
+ int fd = OS::open(path.c_str(), O_BINARY|O_RDONLY);
+ if(fd == -1)
+ {
+ throw "cannot open `" + path + "' for reading:\n" + lastError();
+ }
+
+ ByteSeq uncompressedBytes(buf.st_size);
+
+ if(read(fd, &uncompressedBytes[0], buf.st_size) == -1)
+ {
+ close(fd);
+ throw "cannot read from `" + path + "':\n" + lastError();
+ }
+
+ unsigned int compressedLen = buf.st_size * 1.01 + 600;
+ ByteSeq compressedBytes(compressedLen);
+
+ int bzError = BZ2_bzBuffToBuffCompress(&compressedBytes[0], &compressedLen,
+ &uncompressedBytes[0], buf.st_size, 5, 0, 0);
+ if(bzError != BZ_OK)
+ {
+ string ex = "BZ2_bzBuffToBuffCompress failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ close(fd);
+ throw ex;
+ }
+ close(fd);
+
+ const string pathBZ2Temp = path + ".bz2temp";
+ FILE* stdioFile = OS::fopen(pathBZ2Temp, "wb");
+ if(fwrite(&compressedBytes[0], compressedLen, 1, stdioFile) != 1)
+ {
+ fclose(stdioFile);
+ throw "cannot write to `" + pathBZ2Temp + "':\n" + lastError();
+ }
+ fclose(stdioFile);
+
+ rename(pathBZ2Temp, pathBZ2);
+
+ }
#endif
- int fd = OS::open(path.c_str(), O_BINARY|O_RDONLY);
- if(fd == -1)
- {
- throw "cannot open `" + path + "' for reading:\n" + lastError();
- }
+ int fd = OS::open(path.c_str(), O_BINARY|O_RDONLY);
+ if(fd == -1)
+ {
+ throw "cannot open `" + path + "' for reading:\n" + lastError();
+ }
#ifndef __BCPLUSPLUS__
- const string pathBZ2Temp = path + ".bz2temp";
- FILE* stdioFile = 0;
- int bzError = 0;
- BZFILE* bzFile = 0;
- if(doCompress)
- {
- stdioFile = OS::fopen(simplify(pathBZ2Temp), "wb");
- if(!stdioFile)
- {
- close(fd);
- throw "cannot open `" + pathBZ2Temp + "' for writing:\n" + lastError();
- }
-
- bzFile = BZ2_bzWriteOpen(&bzError, stdioFile, 5, 0, 0);
- if(bzError != BZ_OK)
- {
- string ex = "BZ2_bzWriteOpen failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- fclose(stdioFile);
- close(fd);
- throw ex;
- }
- }
+ const string pathBZ2Temp = path + ".bz2temp";
+ FILE* stdioFile = 0;
+ int bzError = 0;
+ BZFILE* bzFile = 0;
+ if(doCompress)
+ {
+ stdioFile = OS::fopen(simplify(pathBZ2Temp), "wb");
+ if(!stdioFile)
+ {
+ close(fd);
+ throw "cannot open `" + pathBZ2Temp + "' for writing:\n" + lastError();
+ }
+
+ bzFile = BZ2_bzWriteOpen(&bzError, stdioFile, 5, 0, 0);
+ if(bzError != BZ_OK)
+ {
+ string ex = "BZ2_bzWriteOpen failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ fclose(stdioFile);
+ close(fd);
+ throw ex;
+ }
+ }
#endif
- unsigned int bytesLeft = static_cast<unsigned int>(buf.st_size);
- while(bytesLeft > 0)
- {
- ByteSeq bytes(min(bytesLeft, 1024u*1024));
- if(read(fd, &bytes[0], static_cast<unsigned int>(bytes.size())) == -1)
- {
+ unsigned int bytesLeft = static_cast<unsigned int>(buf.st_size);
+ while(bytesLeft > 0)
+ {
+ ByteSeq bytes(min(bytesLeft, 1024u*1024));
+ if(read(fd, &bytes[0], static_cast<unsigned int>(bytes.size())) == -1)
+ {
#ifndef __BCPLUSPLUS__
- if(doCompress)
- {
- fclose(stdioFile);
- }
+ if(doCompress)
+ {
+ fclose(stdioFile);
+ }
#endif
- close(fd);
- throw "cannot read from `" + path + "':\n" + lastError();
- }
- bytesLeft -= static_cast<unsigned int>(bytes.size());
+ close(fd);
+ throw "cannot read from `" + path + "':\n" + lastError();
+ }
+ bytesLeft -= static_cast<unsigned int>(bytes.size());
#ifndef __BCPLUSPLUS__
- if(doCompress)
- {
+ if(doCompress)
+ {
BZ2_bzWrite(&bzError, bzFile, const_cast<Byte*>(&bytes[0]), static_cast<int>(bytes.size()));
if(bzError != BZ_OK)
{
- string ex = "BZ2_bzWrite failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- BZ2_bzWriteClose(&bzError, bzFile, 0, 0, 0);
- fclose(stdioFile);
- close(fd);
- throw ex;
+ string ex = "BZ2_bzWrite failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ BZ2_bzWriteClose(&bzError, bzFile, 0, 0, 0);
+ fclose(stdioFile);
+ close(fd);
+ throw ex;
}
- }
+ }
#endif
- SHA1_Update(&ctx, reinterpret_cast<const void*>(&bytes[0]), bytes.size());
- }
+ SHA1_Update(&ctx, reinterpret_cast<const void*>(&bytes[0]), bytes.size());
+ }
- close(fd);
+ close(fd);
#ifndef __BCPLUSPLUS__
- if(doCompress)
- {
+ if(doCompress)
+ {
BZ2_bzWriteClose(&bzError, bzFile, 0, 0, 0);
if(bzError != BZ_OK)
{
- string ex = "BZ2_bzWriteClose failed";
- if(bzError == BZ_IO_ERROR)
- {
- ex += string(": ") + lastError();
- }
- fclose(stdioFile);
- throw ex;
+ string ex = "BZ2_bzWriteClose failed";
+ if(bzError == BZ_IO_ERROR)
+ {
+ ex += string(": ") + lastError();
+ }
+ fclose(stdioFile);
+ throw ex;
}
- fclose(stdioFile);
+ fclose(stdioFile);
- rename(pathBZ2Temp, pathBZ2);
+ rename(pathBZ2Temp, pathBZ2);
- if(OS::osstat(pathBZ2, &bufBZ2) == -1)
- {
- throw "cannot stat `" + pathBZ2 + "':\n" + lastError();
- }
+ if(OS::osstat(pathBZ2, &bufBZ2) == -1)
+ {
+ throw "cannot stat `" + pathBZ2 + "':\n" + lastError();
+ }
- info.size = static_cast<Int>(bufBZ2.st_size);
- }
+ info.size = static_cast<Int>(bufBZ2.st_size);
+ }
#endif
- }
+ }
- SHA1_Final(reinterpret_cast<unsigned char*>(&bytesSHA[0]), &ctx);
- }
+ SHA1_Final(reinterpret_cast<unsigned char*>(&bytesSHA[0]), &ctx);
+ }
- info.checksum.swap(bytesSHA);
+ info.checksum.swap(bytesSHA);
- infoSeq.push_back(info);
- }
+ infoSeq.push_back(info);
+ }
}
return true;
@@ -1233,21 +1233,21 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G
bool
IcePatch2::getFileInfoSeq(const string& basePath, int compress, GetFileInfoSeqCB* cb,
- FileInfoSeq& infoSeq)
+ FileInfoSeq& infoSeq)
{
return getFileInfoSeqSubDir(basePath, ".", compress, cb, infoSeq);
}
bool
IcePatch2::getFileInfoSeqSubDir(const string& basePa, const string& relPa, int compress, GetFileInfoSeqCB* cb,
- FileInfoSeq& infoSeq)
+ FileInfoSeq& infoSeq)
{
const string basePath = simplify(basePa);
const string relPath = simplify(relPa);
if(!getFileInfoSeqInt(basePath, relPath, compress, cb, infoSeq))
{
- return false;
+ return false;
}
sort(infoSeq.begin(), infoSeq.end(), FileInfoLess());
@@ -1260,41 +1260,41 @@ void
IcePatch2::saveFileInfoSeq(const string& pa, const FileInfoSeq& infoSeq)
{
{
- const string path = simplify(pa + '/' + checksumFile);
-
- FILE* fp = OS::fopen(path, "w");
- if(!fp)
- {
- throw "cannot open `" + path + "' for writing:\n" + lastError();
- }
- try
- {
- for(FileInfoSeq::const_iterator p = infoSeq.begin(); p != infoSeq.end(); ++p)
- {
- if(!writeFileInfo(fp, *p))
- {
- throw "error writing `" + path + "':\n" + lastError();
- }
- }
- }
- catch(...)
- {
- fclose(fp);
- throw;
- }
- fclose(fp);
- }
-
- {
- const string pathLog = simplify(pa + '/' + logFile);
-
- try
- {
- remove(pathLog);
- }
- catch(...)
- {
- }
+ const string path = simplify(pa + '/' + checksumFile);
+
+ FILE* fp = OS::fopen(path, "w");
+ if(!fp)
+ {
+ throw "cannot open `" + path + "' for writing:\n" + lastError();
+ }
+ try
+ {
+ for(FileInfoSeq::const_iterator p = infoSeq.begin(); p != infoSeq.end(); ++p)
+ {
+ if(!writeFileInfo(fp, *p))
+ {
+ throw "error writing `" + path + "':\n" + lastError();
+ }
+ }
+ }
+ catch(...)
+ {
+ fclose(fp);
+ throw;
+ }
+ fclose(fp);
+ }
+
+ {
+ const string pathLog = simplify(pa + '/' + logFile);
+
+ try
+ {
+ remove(pathLog);
+ }
+ catch(...)
+ {
+ }
}
}
@@ -1302,98 +1302,98 @@ void
IcePatch2::loadFileInfoSeq(const string& pa, FileInfoSeq& infoSeq)
{
{
- const string path = simplify(pa + '/' + checksumFile);
-
- FILE* fp = OS::fopen(path, "r");
- if(!fp)
- {
- throw "cannot open `" + path + "' for reading:\n" + lastError();
- }
-
- while(true)
- {
- FileInfo info;
- if(readFileInfo(fp, info))
- {
- infoSeq.push_back(info);
- }
- else
- {
- break;
- }
- }
- fclose(fp);
-
- sort(infoSeq.begin(), infoSeq.end(), FileInfoLess());
- infoSeq.erase(unique(infoSeq.begin(), infoSeq.end(), FileInfoEqual()), infoSeq.end());
- }
-
- {
- const string pathLog = simplify(pa + '/' + logFile);
-
- FILE* fp = OS::fopen(pathLog, "r");
- if(fp != 0)
- {
- FileInfoSeq remove;
- FileInfoSeq update;
-
- while(true)
- {
- int c = fgetc(fp);
- if(c == EOF)
- {
- break;
- }
-
- FileInfo info;
- if(!readFileInfo(fp, info))
- {
- break;
- }
-
- if(c == '-')
- {
- remove.push_back(info);
- }
- else if(c == '+')
- {
- update.push_back(info);
- }
- }
- fclose(fp);
-
- sort(remove.begin(), remove.end(), FileInfoLess());
- remove.erase(unique(remove.begin(), remove.end(), FileInfoEqual()), remove.end());
-
- sort(update.begin(), update.end(), FileInfoLess());
- update.erase(unique(update.begin(), update.end(), FileInfoEqual()), update.end());
-
- FileInfoSeq newInfoSeq;
- newInfoSeq.reserve(infoSeq.size());
-
- set_difference(infoSeq.begin(),
- infoSeq.end(),
- remove.begin(),
- remove.end(),
- back_inserter(newInfoSeq),
- FileInfoLess());
-
- infoSeq.swap(newInfoSeq);
-
- newInfoSeq.clear();
- newInfoSeq.reserve(infoSeq.size());
-
- set_union(infoSeq.begin(),
- infoSeq.end(),
- update.begin(),
- update.end(),
- back_inserter(newInfoSeq),
- FileInfoLess());
-
- infoSeq.swap(newInfoSeq);
-
- saveFileInfoSeq(pa, infoSeq);
- }
+ const string path = simplify(pa + '/' + checksumFile);
+
+ FILE* fp = OS::fopen(path, "r");
+ if(!fp)
+ {
+ throw "cannot open `" + path + "' for reading:\n" + lastError();
+ }
+
+ while(true)
+ {
+ FileInfo info;
+ if(readFileInfo(fp, info))
+ {
+ infoSeq.push_back(info);
+ }
+ else
+ {
+ break;
+ }
+ }
+ fclose(fp);
+
+ sort(infoSeq.begin(), infoSeq.end(), FileInfoLess());
+ infoSeq.erase(unique(infoSeq.begin(), infoSeq.end(), FileInfoEqual()), infoSeq.end());
+ }
+
+ {
+ const string pathLog = simplify(pa + '/' + logFile);
+
+ FILE* fp = OS::fopen(pathLog, "r");
+ if(fp != 0)
+ {
+ FileInfoSeq remove;
+ FileInfoSeq update;
+
+ while(true)
+ {
+ int c = fgetc(fp);
+ if(c == EOF)
+ {
+ break;
+ }
+
+ FileInfo info;
+ if(!readFileInfo(fp, info))
+ {
+ break;
+ }
+
+ if(c == '-')
+ {
+ remove.push_back(info);
+ }
+ else if(c == '+')
+ {
+ update.push_back(info);
+ }
+ }
+ fclose(fp);
+
+ sort(remove.begin(), remove.end(), FileInfoLess());
+ remove.erase(unique(remove.begin(), remove.end(), FileInfoEqual()), remove.end());
+
+ sort(update.begin(), update.end(), FileInfoLess());
+ update.erase(unique(update.begin(), update.end(), FileInfoEqual()), update.end());
+
+ FileInfoSeq newInfoSeq;
+ newInfoSeq.reserve(infoSeq.size());
+
+ set_difference(infoSeq.begin(),
+ infoSeq.end(),
+ remove.begin(),
+ remove.end(),
+ back_inserter(newInfoSeq),
+ FileInfoLess());
+
+ infoSeq.swap(newInfoSeq);
+
+ newInfoSeq.clear();
+ newInfoSeq.reserve(infoSeq.size());
+
+ set_union(infoSeq.begin(),
+ infoSeq.end(),
+ update.begin(),
+ update.end(),
+ back_inserter(newInfoSeq),
+ FileInfoLess());
+
+ infoSeq.swap(newInfoSeq);
+
+ saveFileInfoSeq(pa, infoSeq);
+ }
}
}
@@ -1409,52 +1409,52 @@ IcePatch2::getFileTree0(const FileInfoSeq& infoSeq, FileTree0& tree0)
for(int i = 0; i < 256; ++i, c0 += 20)
{
- FileTree1& tree1 = tree0.nodes[i];
-
- tree1.files.clear();
- tree1.checksum.resize(20);
-
- FileInfoSeq::const_iterator p;
-
- for(p = infoSeq.begin(); p != infoSeq.end(); ++p)
- {
- if(i == static_cast<int>(p->checksum[0]))
- {
- tree1.files.push_back(*p);
- }
- }
-
- ByteSeq allChecksums1;
- allChecksums1.resize(tree1.files.size() * 21); // 20 bytes for the checksum + 1 byte for the flag
- ByteSeq::iterator c1 = allChecksums1.begin();
-
- for(p = tree1.files.begin(); p != tree1.files.end(); ++p, c1 += 21)
- {
- copy(p->checksum.begin(), p->checksum.end(), c1);
- *(c1 + 20) = p->executable;
- }
-
- if(!allChecksums1.empty())
- {
- SHA1(reinterpret_cast<unsigned char*>(&allChecksums1[0]), allChecksums1.size(),
- reinterpret_cast<unsigned char*>(&tree1.checksum[0]));
- }
- else
- {
- fill(tree1.checksum.begin(), tree1.checksum.end(), 0);
- }
-
- copy(tree1.checksum.begin(), tree1.checksum.end(), c0);
+ FileTree1& tree1 = tree0.nodes[i];
+
+ tree1.files.clear();
+ tree1.checksum.resize(20);
+
+ FileInfoSeq::const_iterator p;
+
+ for(p = infoSeq.begin(); p != infoSeq.end(); ++p)
+ {
+ if(i == static_cast<int>(p->checksum[0]))
+ {
+ tree1.files.push_back(*p);
+ }
+ }
+
+ ByteSeq allChecksums1;
+ allChecksums1.resize(tree1.files.size() * 21); // 20 bytes for the checksum + 1 byte for the flag
+ ByteSeq::iterator c1 = allChecksums1.begin();
+
+ for(p = tree1.files.begin(); p != tree1.files.end(); ++p, c1 += 21)
+ {
+ copy(p->checksum.begin(), p->checksum.end(), c1);
+ *(c1 + 20) = p->executable;
+ }
+
+ if(!allChecksums1.empty())
+ {
+ SHA1(reinterpret_cast<unsigned char*>(&allChecksums1[0]), allChecksums1.size(),
+ reinterpret_cast<unsigned char*>(&tree1.checksum[0]));
+ }
+ else
+ {
+ fill(tree1.checksum.begin(), tree1.checksum.end(), 0);
+ }
+
+ copy(tree1.checksum.begin(), tree1.checksum.end(), c0);
}
if(!allChecksums0.empty())
{
- SHA1(reinterpret_cast<unsigned char*>(&allChecksums0[0]), allChecksums0.size(),
- reinterpret_cast<unsigned char*>(&tree0.checksum[0]));
+ SHA1(reinterpret_cast<unsigned char*>(&allChecksums0[0]), allChecksums0.size(),
+ reinterpret_cast<unsigned char*>(&tree0.checksum[0]));
}
else
{
- fill(tree0.checksum.begin(), tree0.checksum.end(), 0);
+ fill(tree0.checksum.begin(), tree0.checksum.end(), 0);
}
}
diff --git a/cpp/src/IceSSL/AcceptorI.cpp b/cpp/src/IceSSL/AcceptorI.cpp
index 7d54e7d3ea3..2bd7a3e105c 100644
--- a/cpp/src/IceSSL/AcceptorI.cpp
+++ b/cpp/src/IceSSL/AcceptorI.cpp
@@ -33,8 +33,8 @@ IceSSL::AcceptorI::close()
{
if(_instance->networkTraceLevel() >= 1)
{
- Trace out(_logger, _instance->networkTraceCategory());
- out << "stopping to accept ssl connections at " << toString();
+ Trace out(_logger, _instance->networkTraceCategory());
+ out << "stopping to accept ssl connections at " << toString();
}
SOCKET fd = _fd;
@@ -47,18 +47,18 @@ IceSSL::AcceptorI::listen()
{
try
{
- IceInternal::doListen(_fd, _backlog);
+ IceInternal::doListen(_fd, _backlog);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
if(_instance->networkTraceLevel() >= 1)
{
- Trace out(_logger, _instance->networkTraceCategory());
- out << "accepting ssl connections at " << toString();
+ Trace out(_logger, _instance->networkTraceCategory());
+ out << "accepting ssl connections at " << toString();
}
}
@@ -70,9 +70,9 @@ IceSSL::AcceptorI::accept(int timeout)
//
if(!_instance->context())
{
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: plugin is not initialized";
- throw ex;
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: plugin is not initialized";
+ throw ex;
}
SOCKET fd = IceInternal::doAccept(_fd, timeout);
@@ -81,19 +81,19 @@ IceSSL::AcceptorI::accept(int timeout)
BIO* bio = BIO_new_socket(static_cast<int>(fd), BIO_CLOSE);
if(!bio)
{
- IceInternal::closeSocketNoThrow(fd);
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = "openssl failure";
- throw ex;
+ IceInternal::closeSocketNoThrow(fd);
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = "openssl failure";
+ throw ex;
}
SSL* ssl = SSL_new(_instance->context());
if(!ssl)
{
- BIO_free(bio); // Also closes the socket.
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = "openssl failure";
- throw ex;
+ BIO_free(bio); // Also closes the socket.
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = "openssl failure";
+ throw ex;
}
SSL_set_bio(ssl, bio, bio);
@@ -152,20 +152,20 @@ IceSSL::AcceptorI::AcceptorI(const InstancePtr& instance, const string& adapterN
try
{
- _fd = IceInternal::createSocket(false);
- IceInternal::setBlock(_fd, false);
- IceInternal::getAddress(host, port, _addr);
- if(_instance->networkTraceLevel() >= 2)
- {
- Trace out(_logger, _instance->networkTraceCategory());
- out << "attempting to bind to ssl socket " << toString();
- }
- IceInternal::doBind(_fd, _addr);
+ _fd = IceInternal::createSocket(false);
+ IceInternal::setBlock(_fd, false);
+ IceInternal::getAddress(host, port, _addr);
+ if(_instance->networkTraceLevel() >= 2)
+ {
+ Trace out(_logger, _instance->networkTraceCategory());
+ out << "attempting to bind to ssl socket " << toString();
+ }
+ IceInternal::doBind(_fd, _addr);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
}
diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp
index ab9c47ee473..24c3df58ddc 100755
--- a/cpp/src/IceSSL/Certificate.cpp
+++ b/cpp/src/IceSSL/Certificate.cpp
@@ -93,7 +93,7 @@ ASMUtcTimeToIceUtilTime(const ASN1_UTCTIME* s)
#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
tm.tm_year = g2(s->data);
if(tm.tm_year < 50)
- tm.tm_year += 100;
+ tm.tm_year += 100;
tm.tm_mon = g2(s->data + 2) - 1;
tm.tm_mday = g2(s->data + 4);
tm.tm_hour = g2(s->data + 6);
@@ -101,15 +101,15 @@ ASMUtcTimeToIceUtilTime(const ASN1_UTCTIME* s)
tm.tm_sec = g2(s->data + 10);
if(s->data[12] == 'Z')
{
- offset = 0;
+ offset = 0;
}
else
{
- offset = g2(s->data + 13) * 60 + g2(s->data + 15);
- if(s->data[12] == '-')
- {
- offset = -offset;
- }
+ offset = g2(s->data + 13) * 60 + g2(s->data + 15);
+ if(s->data[12] == '-')
+ {
+ offset = -offset;
+ }
}
#undef g2
@@ -121,10 +121,10 @@ ASMUtcTimeToIceUtilTime(const ASN1_UTCTIME* s)
//
time_t tzone;
{
- static IceUtil::StaticMutex mutex = ICE_STATIC_MUTEX_INITIALIZER;
- IceUtil::StaticMutex::Lock sync(mutex);
- time_t now = time(0);
- tzone = mktime(localtime(&now)) - mktime(gmtime(&now));
+ static IceUtil::StaticMutex mutex = ICE_STATIC_MUTEX_INITIALIZER;
+ IceUtil::StaticMutex::Lock sync(mutex);
+ time_t now = time(0);
+ tzone = mktime(localtime(&now)) - mktime(gmtime(&now));
}
return IceUtil::Time::seconds(mktime(&tm) - offset*60 + tzone);
}
@@ -147,81 +147,81 @@ convertGeneralNames(GENERAL_NAMES* gens)
vector<pair<int, string> > alt;
if(gens == 0)
{
- return alt;
+ return alt;
}
for(int i = 0; i < sk_GENERAL_NAME_num(gens); ++i)
{
- GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
- pair<int, string> p;
- p.first = gen->type;
- switch(gen->type)
- {
- case GEN_EMAIL:
- {
- ASN1_IA5STRING* str = gen->d.rfc822Name;
- if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
- {
- p.second = reinterpret_cast<const char*>(str->data);
- }
- break;
- }
- case GEN_DNS:
- {
- ASN1_IA5STRING* str = gen->d.dNSName;
- if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
- {
- p.second = reinterpret_cast<const char*>(str->data);
- }
- break;
- }
- case GEN_DIRNAME:
- {
- p.second = convertX509NameToString(gen->d.directoryName);
- break;
- }
- case GEN_URI:
- {
- ASN1_IA5STRING* str = gen->d.uniformResourceIdentifier;
- if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
- {
- p.second = reinterpret_cast<const char*>(str->data);
- }
- break;
- }
- case GEN_IPADD:
- {
- ASN1_OCTET_STRING* addr = gen->d.iPAddress;
- // TODO: Support IPv6 someday.
- if(addr && addr->type == V_ASN1_OCTET_STRING && addr->data && addr->length == 4)
- {
- ostringstream ostr;
- for(int j = 0; j < 4; ++j)
- {
- if(j > 0)
- {
- ostr << '.';
- }
- ostr << static_cast<int>(addr->data[j]);
- }
- p.second = ostr.str();
- }
- break;
- }
- case GEN_OTHERNAME:
- case GEN_EDIPARTY:
- case GEN_X400:
- case GEN_RID:
- {
- //
- // TODO: These types are not supported. If the user wants
- // them, they have to get at the certificate data. Another
- // alternative is to DER encode the data (as the Java
- // certificate does).
- //
- break;
- }
- }
- alt.push_back(p);
+ GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
+ pair<int, string> p;
+ p.first = gen->type;
+ switch(gen->type)
+ {
+ case GEN_EMAIL:
+ {
+ ASN1_IA5STRING* str = gen->d.rfc822Name;
+ if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
+ {
+ p.second = reinterpret_cast<const char*>(str->data);
+ }
+ break;
+ }
+ case GEN_DNS:
+ {
+ ASN1_IA5STRING* str = gen->d.dNSName;
+ if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
+ {
+ p.second = reinterpret_cast<const char*>(str->data);
+ }
+ break;
+ }
+ case GEN_DIRNAME:
+ {
+ p.second = convertX509NameToString(gen->d.directoryName);
+ break;
+ }
+ case GEN_URI:
+ {
+ ASN1_IA5STRING* str = gen->d.uniformResourceIdentifier;
+ if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
+ {
+ p.second = reinterpret_cast<const char*>(str->data);
+ }
+ break;
+ }
+ case GEN_IPADD:
+ {
+ ASN1_OCTET_STRING* addr = gen->d.iPAddress;
+ // TODO: Support IPv6 someday.
+ if(addr && addr->type == V_ASN1_OCTET_STRING && addr->data && addr->length == 4)
+ {
+ ostringstream ostr;
+ for(int j = 0; j < 4; ++j)
+ {
+ if(j > 0)
+ {
+ ostr << '.';
+ }
+ ostr << static_cast<int>(addr->data[j]);
+ }
+ p.second = ostr.str();
+ }
+ break;
+ }
+ case GEN_OTHERNAME:
+ case GEN_EDIPARTY:
+ case GEN_X400:
+ case GEN_RID:
+ {
+ //
+ // TODO: These types are not supported. If the user wants
+ // them, they have to get at the certificate data. Another
+ // alternative is to DER encode the data (as the Java
+ // certificate does).
+ //
+ break;
+ }
+ }
+ alt.push_back(p);
}
sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free);
return alt;
@@ -298,22 +298,22 @@ DistinguishedName::match(const DistinguishedName& other) const
{
for(list< pair<string, string> >::const_iterator p = other._unescaped.begin(); p != other._unescaped.end(); ++p)
{
- bool found = false;
- for(list< pair<string, string> >::const_iterator q = _unescaped.begin(); q != _unescaped.end(); ++q)
- {
- if(p->first == q->first)
- {
- found = true;
- if(p->second != q->second)
- {
- return false;
- }
- }
- }
- if(!found)
- {
- return false;
- }
+ bool found = false;
+ for(list< pair<string, string> >::const_iterator q = _unescaped.begin(); q != _unescaped.end(); ++q)
+ {
+ if(p->first == q->first)
+ {
+ found = true;
+ if(p->second != q->second)
+ {
+ return false;
+ }
+ }
+ }
+ if(!found)
+ {
+ return false;
+ }
}
return true;
}
@@ -328,12 +328,12 @@ DistinguishedName::operator string() const
bool first = true;
for(list< pair<string, string> >::const_iterator p = _rdns.begin(); p != _rdns.end(); ++p)
{
- if(!first)
- {
- os << ",";
- }
- first = false;
- os << p->first << "=" << p->second;
+ if(!first)
+ {
+ os << ",";
+ }
+ first = false;
+ os << p->first << "=" << p->second;
}
return os.str();
}
@@ -343,9 +343,9 @@ DistinguishedName::unescape()
{
for(list< pair<string, string> >::const_iterator q = _rdns.begin(); q != _rdns.end(); ++q)
{
- pair<string, string> rdn = *q;
- rdn.second = RFC2253::unescape(rdn.second);
- _unescaped.push_back(rdn);
+ pair<string, string> rdn = *q;
+ rdn.second = RFC2253::unescape(rdn.second);
+ _unescaped.push_back(rdn);
}
}
@@ -385,15 +385,15 @@ Certificate::load(const string& file)
BIO *cert = BIO_new(BIO_s_file());
if(BIO_read_filename(cert, file.c_str()) <= 0)
{
- BIO_free(cert);
- throw CertificateReadException(__FILE__, __LINE__, "error opening file");
+ BIO_free(cert);
+ throw CertificateReadException(__FILE__, __LINE__, "error opening file");
}
X509* x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
if(x == NULL)
{
- BIO_free(cert);
- throw CertificateReadException(__FILE__, __LINE__, "error reading file:\n" + getSslErrors(false));
+ BIO_free(cert);
+ throw CertificateReadException(__FILE__, __LINE__, "error reading file:\n" + getSslErrors(false));
}
BIO_free(cert);
return new Certificate(x);
@@ -406,8 +406,8 @@ Certificate::decode(const string& encoding)
X509* x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
if(x == NULL)
{
- BIO_free(cert);
- throw CertificateReadException(__FILE__, __LINE__, "error decoding certificate:\n" + getSslErrors(false));
+ BIO_free(cert);
+ throw CertificateReadException(__FILE__, __LINE__, "error decoding certificate:\n" + getSslErrors(false));
}
BIO_free(cert);
return new Certificate(x);
@@ -444,8 +444,8 @@ Certificate::encode() const
int i = PEM_write_bio_X509_AUX(out, _cert);
if(i <= 0)
{
- BIO_free(out);
- throw CertificateEncodingException(__FILE__, __LINE__, getSslErrors(false));
+ BIO_free(out);
+ throw CertificateEncodingException(__FILE__, __LINE__, getSslErrors(false));
}
BUF_MEM* p;
BIO_get_mem_ptr(out, &p);
@@ -511,7 +511,7 @@ vector<pair<int, string> >
Certificate::getIssuerAlternativeNames()
{
return convertGeneralNames(reinterpret_cast<GENERAL_NAMES*>(
- X509_get_ext_d2i(_cert, NID_issuer_alt_name, 0, 0)));
+ X509_get_ext_d2i(_cert, NID_issuer_alt_name, 0, 0)));
}
DistinguishedName
@@ -524,7 +524,7 @@ vector<pair<int, string> >
Certificate::getSubjectAlternativeNames()
{
return convertGeneralNames(
- reinterpret_cast<GENERAL_NAMES*>(X509_get_ext_d2i(_cert, NID_subject_alt_name, 0, 0)));
+ reinterpret_cast<GENERAL_NAMES*>(X509_get_ext_d2i(_cert, NID_subject_alt_name, 0, 0)));
}
int
diff --git a/cpp/src/IceSSL/ConnectorI.cpp b/cpp/src/IceSSL/ConnectorI.cpp
index 29433f31f3f..8a68c3559c3 100644
--- a/cpp/src/IceSSL/ConnectorI.cpp
+++ b/cpp/src/IceSSL/ConnectorI.cpp
@@ -28,15 +28,15 @@ IceSSL::ConnectorI::connect(int timeout)
//
if(!_instance->context())
{
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: plugin is not initialized";
- throw ex;
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: plugin is not initialized";
+ throw ex;
}
if(_instance->networkTraceLevel() >= 2)
{
- Trace out(_logger, _instance->networkTraceCategory());
- out << "trying to establish ssl connection to " << toString();
+ Trace out(_logger, _instance->networkTraceCategory());
+ out << "trying to establish ssl connection to " << toString();
}
SOCKET fd = IceInternal::createSocket(false);
@@ -47,125 +47,125 @@ IceSSL::ConnectorI::connect(int timeout)
BIO* bio = BIO_new_socket(static_cast<int>(fd), BIO_CLOSE);
if(!bio)
{
- IceInternal::closeSocketNoThrow(fd);
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = "openssl failure";
- throw ex;
+ IceInternal::closeSocketNoThrow(fd);
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = "openssl failure";
+ throw ex;
}
SSL* ssl = SSL_new(_instance->context());
if(!ssl)
{
- BIO_free(bio); // Also closes the socket.
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = "openssl failure";
- throw ex;
+ BIO_free(bio); // Also closes the socket.
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = "openssl failure";
+ throw ex;
}
SSL_set_bio(ssl, bio, bio);
try
{
- do
- {
- int result = SSL_connect(ssl);
- switch(SSL_get_error(ssl, result))
- {
- case SSL_ERROR_NONE:
- break;
- case SSL_ERROR_ZERO_RETURN:
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = IceInternal::getSocketErrno();
- throw ex;
- }
- case SSL_ERROR_WANT_READ:
- if(!selectRead(fd, timeout))
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- break;
- case SSL_ERROR_WANT_WRITE:
- if(!selectWrite(fd, timeout))
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- break;
- case SSL_ERROR_SYSCALL:
- {
- if(result == -1)
- {
- if(IceInternal::interrupted())
- {
- break;
- }
-
- if(IceInternal::wouldBlock())
- {
- if(SSL_want_read(ssl))
- {
- if(!selectRead(fd, timeout))
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- }
- else if(SSL_want_write(ssl))
- {
- if(!selectWrite(fd, timeout))
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- }
-
- continue;
- }
-
- if(IceInternal::connectionLost())
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = IceInternal::getSocketErrno();
- throw ex;
- }
- }
-
- if(result == 0)
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = IceInternal::getSocketErrno();
- throw ex;
- }
- case SSL_ERROR_SSL:
- {
- ProtocolException ex(__FILE__, __LINE__);
- ex.reason = "SSL error for new outgoing connection:\nremote address = " +
- IceInternal::addrToString(_addr) + "\n" + _instance->sslErrors();
- throw ex;
- }
- }
- }
- while(!SSL_is_init_finished(ssl));
-
- _instance->verifyPeer(ssl, fd, _host, "", false);
+ do
+ {
+ int result = SSL_connect(ssl);
+ switch(SSL_get_error(ssl, result))
+ {
+ case SSL_ERROR_NONE:
+ break;
+ case SSL_ERROR_ZERO_RETURN:
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = IceInternal::getSocketErrno();
+ throw ex;
+ }
+ case SSL_ERROR_WANT_READ:
+ if(!selectRead(fd, timeout))
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ break;
+ case SSL_ERROR_WANT_WRITE:
+ if(!selectWrite(fd, timeout))
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ break;
+ case SSL_ERROR_SYSCALL:
+ {
+ if(result == -1)
+ {
+ if(IceInternal::interrupted())
+ {
+ break;
+ }
+
+ if(IceInternal::wouldBlock())
+ {
+ if(SSL_want_read(ssl))
+ {
+ if(!selectRead(fd, timeout))
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ }
+ else if(SSL_want_write(ssl))
+ {
+ if(!selectWrite(fd, timeout))
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ }
+
+ continue;
+ }
+
+ if(IceInternal::connectionLost())
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = IceInternal::getSocketErrno();
+ throw ex;
+ }
+ }
+
+ if(result == 0)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = IceInternal::getSocketErrno();
+ throw ex;
+ }
+ case SSL_ERROR_SSL:
+ {
+ ProtocolException ex(__FILE__, __LINE__);
+ ex.reason = "SSL error for new outgoing connection:\nremote address = " +
+ IceInternal::addrToString(_addr) + "\n" + _instance->sslErrors();
+ throw ex;
+ }
+ }
+ }
+ while(!SSL_is_init_finished(ssl));
+
+ _instance->verifyPeer(ssl, fd, _host, "", false);
}
catch(...)
{
- SSL_free(ssl);
- throw;
+ SSL_free(ssl);
+ throw;
}
if(_instance->networkTraceLevel() >= 1)
{
- Trace out(_logger, _instance->networkTraceCategory());
- out << "ssl connection established\n" << IceInternal::fdToString(fd);
+ Trace out(_logger, _instance->networkTraceCategory());
+ out << "ssl connection established\n" << IceInternal::fdToString(fd);
}
if(_instance->securityTraceLevel() >= 1)
{
- _instance->traceConnection(ssl, false);
+ _instance->traceConnection(ssl, false);
}
return new TransceiverI(_instance, ssl, fd, false);
diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp
index e962ff4b9a6..69866544132 100644
--- a/cpp/src/IceSSL/EndpointI.cpp
+++ b/cpp/src/IceSSL/EndpointI.cpp
@@ -22,7 +22,7 @@ using namespace Ice;
using namespace IceSSL;
IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& ho, Int po, Int ti, const string& conId,
- bool co, bool pub) :
+ bool co, bool pub) :
_instance(instance),
_host(ho),
_port(po),
@@ -47,96 +47,96 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, const string& str) :
while(true)
{
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- string option = str.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "ssl " + str;
- throw ex;
- }
-
- string argument;
- string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if(argumentBeg != string::npos && str[argumentBeg] != '-')
- {
- beg = argumentBeg;
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
- argument = str.substr(beg, end - beg);
- }
-
- switch(option[1])
- {
- case 'h':
- {
- if(argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "ssl " + str;
- throw ex;
- }
- const_cast<string&>(_host) = argument;
- break;
- }
-
- case 'p':
- {
- istringstream p(argument);
- if(!(p >> const_cast<Int&>(_port)) || !p.eof() || _port < 0 || _port > 65535)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "ssl " + str;
- throw ex;
- }
- break;
- }
-
- case 't':
- {
- istringstream t(argument);
- if(!(t >> const_cast<Int&>(_timeout)) || !t.eof())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "ssl " + str;
- throw ex;
- }
- break;
- }
-
- case 'z':
- {
- if(!argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "ssl " + str;
- throw ex;
- }
- const_cast<bool&>(_compress) = true;
- break;
- }
-
- default:
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "ssl " + str;
- throw ex;
- }
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ string option = str.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "ssl " + str;
+ throw ex;
+ }
+
+ string argument;
+ string::size_type argumentBeg = str.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
+ {
+ beg = argumentBeg;
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+ argument = str.substr(beg, end - beg);
+ }
+
+ switch(option[1])
+ {
+ case 'h':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "ssl " + str;
+ throw ex;
+ }
+ const_cast<string&>(_host) = argument;
+ break;
+ }
+
+ case 'p':
+ {
+ istringstream p(argument);
+ if(!(p >> const_cast<Int&>(_port)) || !p.eof() || _port < 0 || _port > 65535)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "ssl " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 't':
+ {
+ istringstream t(argument);
+ if(!(t >> const_cast<Int&>(_timeout)) || !t.eof())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "ssl " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 'z':
+ {
+ if(!argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "ssl " + str;
+ throw ex;
+ }
+ const_cast<bool&>(_compress) = true;
+ break;
+ }
+
+ default:
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "ssl " + str;
+ throw ex;
+ }
+ }
}
}
@@ -181,11 +181,11 @@ IceSSL::EndpointI::toString() const
s << "ssl -h " << _host << " -p " << _port;
if(_timeout != -1)
{
- s << " -t " << _timeout;
+ s << " -t " << _timeout;
}
if(_compress)
{
- s << " -z";
+ s << " -z";
}
return s.str();
}
@@ -207,11 +207,11 @@ IceSSL::EndpointI::timeout(Int timeout) const
{
if(timeout == _timeout)
{
- return const_cast<EndpointI*>(this);
+ return const_cast<EndpointI*>(this);
}
else
{
- return new EndpointI(_instance, _host, _port, timeout, _connectionId, _compress, _publish);
+ return new EndpointI(_instance, _host, _port, timeout, _connectionId, _compress, _publish);
}
}
@@ -220,11 +220,11 @@ IceSSL::EndpointI::connectionId(const string& connectionId) const
{
if(connectionId == _connectionId)
{
- return const_cast<EndpointI*>(this);
+ return const_cast<EndpointI*>(this);
}
else
{
- return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress, _publish);
+ return new EndpointI(_instance, _host, _port, _timeout, connectionId, _compress, _publish);
}
}
@@ -239,11 +239,11 @@ IceSSL::EndpointI::compress(bool compress) const
{
if(compress == _compress)
{
- return const_cast<EndpointI*>(this);
+ return const_cast<EndpointI*>(this);
}
else
{
- return new EndpointI(_instance, _host, _port, _timeout, _connectionId, compress, _publish);
+ return new EndpointI(_instance, _host, _port, _timeout, _connectionId, compress, _publish);
}
}
@@ -319,11 +319,11 @@ IceSSL::EndpointI::expand(bool server) const
if(_host == "0.0.0.0")
{
vector<string> hosts = IceInternal::getLocalHosts();
- for(unsigned int i = 0; i < hosts.size(); ++i)
- {
- endps.push_back(new EndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress,
- hosts.size() == 1 || hosts[i] != "127.0.0.1"));
- }
+ for(unsigned int i = 0; i < hosts.size(); ++i)
+ {
+ endps.push_back(new EndpointI(_instance, hosts[i], _port, _timeout, _connectionId, _compress,
+ hosts.size() == 1 || hosts[i] != "127.0.0.1"));
+ }
}
else
{
@@ -350,7 +350,7 @@ IceSSL::EndpointI::equivalent(const IceInternal::AcceptorPtr& acceptor) const
const AcceptorI* sslAcceptor = dynamic_cast<const AcceptorI*>(acceptor.get());
if(!sslAcceptor)
{
- return false;
+ return false;
}
return sslAcceptor->equivalent(_host, _port);
}
@@ -361,52 +361,52 @@ IceSSL::EndpointI::operator==(const IceInternal::EndpointI& r) const
const EndpointI* p = dynamic_cast<const EndpointI*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_port != p->_port)
{
- return false;
+ return false;
}
if(_timeout != p->_timeout)
{
- return false;
+ return false;
}
if(_connectionId != p->_connectionId)
{
- return false;
+ return false;
}
if(_compress != p->_compress)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- struct sockaddr_in raddr;
- try
- {
- IceInternal::getAddress(_host, _port, laddr);
- IceInternal::getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ struct sockaddr_in raddr;
+ try
+ {
+ IceInternal::getAddress(_host, _port, laddr);
+ IceInternal::getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ return false;
+ }
- return IceInternal::compareAddress(laddr, raddr);
+ return IceInternal::compareAddress(laddr, raddr);
}
return true;
@@ -429,76 +429,76 @@ IceSSL::EndpointI::operator<(const IceInternal::EndpointI& r) const
if(this == p)
{
- return false;
+ return false;
}
if(_port < p->_port)
{
- return true;
+ return true;
}
else if(p->_port < _port)
{
- return false;
+ return false;
}
if(_timeout < p->_timeout)
{
- return true;
+ return true;
}
else if(p->_timeout < _timeout)
{
- return false;
+ return false;
}
if(_connectionId < p->_connectionId)
{
- return true;
+ return true;
}
else if(p->_connectionId < _connectionId)
{
- return false;
+ return false;
}
if(!_compress && p->_compress)
{
- return true;
+ return true;
}
else if(p->_compress < _compress)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- try
- {
- IceInternal::getAddress(_host, _port, laddr);
- }
- catch(const DNSException&)
- {
- }
-
- struct sockaddr_in raddr;
- try
- {
- IceInternal::getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- }
-
- if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
- {
- return true;
- }
- else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ try
+ {
+ IceInternal::getAddress(_host, _port, laddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ struct sockaddr_in raddr;
+ try
+ {
+ IceInternal::getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ {
+ return true;
+ }
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ {
+ return false;
+ }
}
return false;
diff --git a/cpp/src/IceSSL/Instance.cpp b/cpp/src/IceSSL/Instance.cpp
index 78af13bbcd3..112e013cb2d 100644
--- a/cpp/src/IceSSL/Instance.cpp
+++ b/cpp/src/IceSSL/Instance.cpp
@@ -41,7 +41,7 @@ IceSSL_opensslPasswordCallback(char* buf, int size, int flag, void* userData)
int sz = static_cast<int>(passwd.size());
if(sz > size)
{
- sz = size - 1;
+ sz = size - 1;
}
strncpy(buf, passwd.c_str(), sz);
buf[sz] = '\0';
@@ -75,9 +75,9 @@ passwordError()
{
int reason = ERR_GET_REASON(ERR_peek_error());
return (reason == PEM_R_BAD_BASE64_DECODE ||
- reason == PEM_R_BAD_DECRYPT ||
- reason == PEM_R_BAD_PASSWORD_READ ||
- reason == PEM_R_PROBLEMS_GETTING_PASSWORD);
+ reason == PEM_R_BAD_DECRYPT ||
+ reason == PEM_R_BAD_PASSWORD_READ ||
+ reason == PEM_R_PROBLEMS_GETTING_PASSWORD);
}
IceSSL::Instance::Instance(const CommunicatorPtr& communicator) :
@@ -106,393 +106,393 @@ IceSSL::Instance::initialize()
{
if(_ctx)
{
- return;
+ return;
}
_ctx = SSL_CTX_new(SSLv23_method());
if(!_ctx)
{
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: unable to create SSL context:\n" + sslErrors();
- throw ex;
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unable to create SSL context:\n" + sslErrors();
+ throw ex;
}
try
{
- //
- // Store a pointer to ourself for use in OpenSSL callbacks.
- //
- SSL_CTX_set_ex_data(_ctx, 0, this);
-
- //
- // This is necessary for successful interop with Java. Without it, a Java
- // client would fail to reestablish a connection: the server gets the
- // error "session id context uninitialized" and the client receives
- // "SSLHandshakeException: Remote host closed connection during handshake".
- //
- SSL_CTX_set_session_cache_mode(_ctx, SSL_SESS_CACHE_OFF);
-
- PropertiesPtr properties = communicator()->getProperties();
- const string propPrefix = "IceSSL.";
-
- //
- // Check for a default directory. We look in this directory for
- // files mentioned in the configuration.
- //
- {
- _defaultDir = properties->getProperty(propPrefix + "DefaultDir");
- }
-
- //
- // Select protocols.
- //
- {
- string protocols = properties->getProperty(propPrefix + "Protocols");
- if(!protocols.empty())
- {
- parseProtocols(protocols);
- }
- }
-
- //
- // CheckCertName determines whether we compare the name in a peer's
- // certificate against its hostname.
- //
- {
- _checkCertName = properties->getPropertyAsIntWithDefault(propPrefix + "CheckCertName", 0) > 0;
- }
-
- //
- // VerifyDepthMax establishes the maximum length of a peer's certificate
- // chain, including the peer's certificate. A value of 0 means there is
- // no maximum.
- //
- {
- _verifyDepthMax = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyDepthMax", 2);
- }
-
- //
- // Determine whether a certificate is required from the peer.
- //
- {
- int verifyPeer = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyPeer", 2);
- int sslVerifyMode;
- switch(verifyPeer)
- {
- case 0:
- sslVerifyMode = SSL_VERIFY_NONE;
- break;
- case 1:
- sslVerifyMode = SSL_VERIFY_PEER;
- break;
- case 2:
- sslVerifyMode = SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
- break;
- default:
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: invalid value for " + propPrefix + "VerifyPeer";
- throw ex;
- }
- }
- SSL_CTX_set_verify(_ctx, sslVerifyMode, IceSSL_opensslVerifyCallback);
- }
-
- //
- // If the configuration defines a password, or the application has supplied
- // a password prompt object, then register a password callback. Otherwise,
- // let OpenSSL use its default behavior.
- //
- {
- // TODO: Support quoted value?
- string password = properties->getProperty(propPrefix + "Password");
- if(!password.empty() || _prompt)
- {
- SSL_CTX_set_default_passwd_cb(_ctx, IceSSL_opensslPasswordCallback);
- SSL_CTX_set_default_passwd_cb_userdata(_ctx, this);
- _password = password;
- }
- }
-
- int passwordRetryMax = properties->getPropertyAsIntWithDefault(propPrefix + "PasswordRetryMax", 3);
-
- //
- // Establish the location of CA certificates.
- //
- {
- string caFile = properties->getProperty(propPrefix + "CertAuthFile");
- string caDir = properties->getPropertyWithDefault(propPrefix + "CertAuthDir", _defaultDir);
- const char* file = 0;
- const char* dir = 0;
- if(!caFile.empty())
- {
- if(!checkPath(caFile, _defaultDir, false))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: CA certificate file not found:\n" + caFile;
- throw ex;
- }
- file = caFile.c_str();
- }
- if(!caDir.empty())
- {
- if(!checkPath(caDir, _defaultDir, true))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: CA certificate directory not found:\n" + caDir;
- throw ex;
- }
- dir = caDir.c_str();
- }
- if(file || dir)
- {
- //
- // The certificate may be stored in an encrypted file, so handle
- // password retries.
- //
- int count = 0;
- int err = 0;
- while(count < passwordRetryMax)
- {
- ERR_clear_error();
- err = SSL_CTX_load_verify_locations(_ctx, file, dir);
- if(err || !passwordError())
- {
- break;
- }
- ++count;
- }
- if(err == 0)
- {
- string msg = "IceSSL: unable to establish CA certificates";
- if(passwordError())
- {
- msg += ":\ninvalid password";
- }
- else
- {
- string err = sslErrors();
- if(!err.empty())
- {
- msg += ":\n" + err;
- }
- }
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
- }
- }
- }
-
- //
- // Establish the certificate chains and private keys. One RSA certificate and
- // one DSA certificate are allowed.
- //
- {
+ //
+ // Store a pointer to ourself for use in OpenSSL callbacks.
+ //
+ SSL_CTX_set_ex_data(_ctx, 0, this);
+
+ //
+ // This is necessary for successful interop with Java. Without it, a Java
+ // client would fail to reestablish a connection: the server gets the
+ // error "session id context uninitialized" and the client receives
+ // "SSLHandshakeException: Remote host closed connection during handshake".
+ //
+ SSL_CTX_set_session_cache_mode(_ctx, SSL_SESS_CACHE_OFF);
+
+ PropertiesPtr properties = communicator()->getProperties();
+ const string propPrefix = "IceSSL.";
+
+ //
+ // Check for a default directory. We look in this directory for
+ // files mentioned in the configuration.
+ //
+ {
+ _defaultDir = properties->getProperty(propPrefix + "DefaultDir");
+ }
+
+ //
+ // Select protocols.
+ //
+ {
+ string protocols = properties->getProperty(propPrefix + "Protocols");
+ if(!protocols.empty())
+ {
+ parseProtocols(protocols);
+ }
+ }
+
+ //
+ // CheckCertName determines whether we compare the name in a peer's
+ // certificate against its hostname.
+ //
+ {
+ _checkCertName = properties->getPropertyAsIntWithDefault(propPrefix + "CheckCertName", 0) > 0;
+ }
+
+ //
+ // VerifyDepthMax establishes the maximum length of a peer's certificate
+ // chain, including the peer's certificate. A value of 0 means there is
+ // no maximum.
+ //
+ {
+ _verifyDepthMax = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyDepthMax", 2);
+ }
+
+ //
+ // Determine whether a certificate is required from the peer.
+ //
+ {
+ int verifyPeer = properties->getPropertyAsIntWithDefault(propPrefix + "VerifyPeer", 2);
+ int sslVerifyMode;
+ switch(verifyPeer)
+ {
+ case 0:
+ sslVerifyMode = SSL_VERIFY_NONE;
+ break;
+ case 1:
+ sslVerifyMode = SSL_VERIFY_PEER;
+ break;
+ case 2:
+ sslVerifyMode = SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+ break;
+ default:
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: invalid value for " + propPrefix + "VerifyPeer";
+ throw ex;
+ }
+ }
+ SSL_CTX_set_verify(_ctx, sslVerifyMode, IceSSL_opensslVerifyCallback);
+ }
+
+ //
+ // If the configuration defines a password, or the application has supplied
+ // a password prompt object, then register a password callback. Otherwise,
+ // let OpenSSL use its default behavior.
+ //
+ {
+ // TODO: Support quoted value?
+ string password = properties->getProperty(propPrefix + "Password");
+ if(!password.empty() || _prompt)
+ {
+ SSL_CTX_set_default_passwd_cb(_ctx, IceSSL_opensslPasswordCallback);
+ SSL_CTX_set_default_passwd_cb_userdata(_ctx, this);
+ _password = password;
+ }
+ }
+
+ int passwordRetryMax = properties->getPropertyAsIntWithDefault(propPrefix + "PasswordRetryMax", 3);
+
+ //
+ // Establish the location of CA certificates.
+ //
+ {
+ string caFile = properties->getProperty(propPrefix + "CertAuthFile");
+ string caDir = properties->getPropertyWithDefault(propPrefix + "CertAuthDir", _defaultDir);
+ const char* file = 0;
+ const char* dir = 0;
+ if(!caFile.empty())
+ {
+ if(!checkPath(caFile, _defaultDir, false))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: CA certificate file not found:\n" + caFile;
+ throw ex;
+ }
+ file = caFile.c_str();
+ }
+ if(!caDir.empty())
+ {
+ if(!checkPath(caDir, _defaultDir, true))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: CA certificate directory not found:\n" + caDir;
+ throw ex;
+ }
+ dir = caDir.c_str();
+ }
+ if(file || dir)
+ {
+ //
+ // The certificate may be stored in an encrypted file, so handle
+ // password retries.
+ //
+ int count = 0;
+ int err = 0;
+ while(count < passwordRetryMax)
+ {
+ ERR_clear_error();
+ err = SSL_CTX_load_verify_locations(_ctx, file, dir);
+ if(err || !passwordError())
+ {
+ break;
+ }
+ ++count;
+ }
+ if(err == 0)
+ {
+ string msg = "IceSSL: unable to establish CA certificates";
+ if(passwordError())
+ {
+ msg += ":\ninvalid password";
+ }
+ else
+ {
+ string err = sslErrors();
+ if(!err.empty())
+ {
+ msg += ":\n" + err;
+ }
+ }
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
+ }
+ }
+ }
+
+ //
+ // Establish the certificate chains and private keys. One RSA certificate and
+ // one DSA certificate are allowed.
+ //
+ {
#ifdef _WIN32
- const string sep = ";";
+ const string sep = ";";
#else
- const string sep = ":";
+ const string sep = ":";
#endif
- string certFile = properties->getProperty(propPrefix + "CertFile");
- string keyFile = properties->getProperty(propPrefix + "KeyFile");
- vector<string>::size_type numCerts = 0;
- if(!certFile.empty())
- {
- vector<string> files;
- if(!splitString(certFile, sep, false, files) || files.size() > 2)
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: invalid value for " + propPrefix + "CertFile:\n" + certFile;
- throw ex;
- }
- numCerts = files.size();
- for(vector<string>::iterator p = files.begin(); p != files.end(); ++p)
- {
- string file = *p;
- if(!checkPath(file, _defaultDir, false))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: certificate file not found:\n" + file;
- throw ex;
- }
- //
- // The certificate may be stored in an encrypted file, so handle
- // password retries.
- //
- int count = 0;
- int err = 0;
- while(count < passwordRetryMax)
- {
- ERR_clear_error();
- err = SSL_CTX_use_certificate_chain_file(_ctx, file.c_str());
- if(err || !passwordError())
- {
- break;
- }
- ++count;
- }
- if(err == 0)
- {
- string msg = "IceSSL: unable to load certificate chain from file " + file;
- if(passwordError())
- {
- msg += ":\ninvalid password";
- }
- else
- {
- string err = sslErrors();
- if(!err.empty())
- {
- msg += ":\n" + err;
- }
- }
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
- }
- }
- }
- if(keyFile.empty())
- {
- keyFile = certFile; // Assume the certificate file also contains the private key.
- }
- if(!keyFile.empty())
- {
- vector<string> files;
- if(!splitString(keyFile, sep, false, files) || files.size() > 2)
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: invalid value for " + propPrefix + "KeyFile:\n" + keyFile;
- throw ex;
- }
- if(files.size() != numCerts)
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: " + propPrefix + "KeyFile does not agree with " + propPrefix + "CertFile";
- throw ex;
- }
- for(vector<string>::iterator p = files.begin(); p != files.end(); ++p)
- {
- string file = *p;
- if(!checkPath(file, _defaultDir, false))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: key file not found:\n" + file;
- throw ex;
- }
- //
- // The private key may be stored in an encrypted file, so handle
- // password retries.
- //
- int count = 0;
- int err = 0;
- while(count < passwordRetryMax)
- {
- ERR_clear_error();
- err = SSL_CTX_use_PrivateKey_file(_ctx, file.c_str(), SSL_FILETYPE_PEM);
- if(err || !passwordError())
- {
- break;
- }
- ++count;
- }
- if(err == 0)
- {
- string msg = "IceSSL: unable to load private key from file " + file;
- if(passwordError())
- {
- msg += ":\ninvalid password";
- }
- else
- {
- string err = sslErrors();
- if(!err.empty())
- {
- msg += ":\n" + err;
- }
- }
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
- }
- }
- if(!SSL_CTX_check_private_key(_ctx))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: unable to validate private key(s):\n" + sslErrors();
- throw ex;
- }
- }
- }
-
- //
- // Establish the cipher list.
- //
- {
- string ciphers = properties->getProperty(propPrefix + "Ciphers");
- if(!ciphers.empty())
- {
- if(!SSL_CTX_set_cipher_list(_ctx, ciphers.c_str()))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: unable to set ciphers using `" + ciphers + "':\n" + sslErrors();
- throw ex;
- }
- }
- }
-
- //
- // Diffie Hellman configuration.
- //
- {
+ string certFile = properties->getProperty(propPrefix + "CertFile");
+ string keyFile = properties->getProperty(propPrefix + "KeyFile");
+ vector<string>::size_type numCerts = 0;
+ if(!certFile.empty())
+ {
+ vector<string> files;
+ if(!splitString(certFile, sep, false, files) || files.size() > 2)
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: invalid value for " + propPrefix + "CertFile:\n" + certFile;
+ throw ex;
+ }
+ numCerts = files.size();
+ for(vector<string>::iterator p = files.begin(); p != files.end(); ++p)
+ {
+ string file = *p;
+ if(!checkPath(file, _defaultDir, false))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: certificate file not found:\n" + file;
+ throw ex;
+ }
+ //
+ // The certificate may be stored in an encrypted file, so handle
+ // password retries.
+ //
+ int count = 0;
+ int err = 0;
+ while(count < passwordRetryMax)
+ {
+ ERR_clear_error();
+ err = SSL_CTX_use_certificate_chain_file(_ctx, file.c_str());
+ if(err || !passwordError())
+ {
+ break;
+ }
+ ++count;
+ }
+ if(err == 0)
+ {
+ string msg = "IceSSL: unable to load certificate chain from file " + file;
+ if(passwordError())
+ {
+ msg += ":\ninvalid password";
+ }
+ else
+ {
+ string err = sslErrors();
+ if(!err.empty())
+ {
+ msg += ":\n" + err;
+ }
+ }
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
+ }
+ }
+ }
+ if(keyFile.empty())
+ {
+ keyFile = certFile; // Assume the certificate file also contains the private key.
+ }
+ if(!keyFile.empty())
+ {
+ vector<string> files;
+ if(!splitString(keyFile, sep, false, files) || files.size() > 2)
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: invalid value for " + propPrefix + "KeyFile:\n" + keyFile;
+ throw ex;
+ }
+ if(files.size() != numCerts)
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: " + propPrefix + "KeyFile does not agree with " + propPrefix + "CertFile";
+ throw ex;
+ }
+ for(vector<string>::iterator p = files.begin(); p != files.end(); ++p)
+ {
+ string file = *p;
+ if(!checkPath(file, _defaultDir, false))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: key file not found:\n" + file;
+ throw ex;
+ }
+ //
+ // The private key may be stored in an encrypted file, so handle
+ // password retries.
+ //
+ int count = 0;
+ int err = 0;
+ while(count < passwordRetryMax)
+ {
+ ERR_clear_error();
+ err = SSL_CTX_use_PrivateKey_file(_ctx, file.c_str(), SSL_FILETYPE_PEM);
+ if(err || !passwordError())
+ {
+ break;
+ }
+ ++count;
+ }
+ if(err == 0)
+ {
+ string msg = "IceSSL: unable to load private key from file " + file;
+ if(passwordError())
+ {
+ msg += ":\ninvalid password";
+ }
+ else
+ {
+ string err = sslErrors();
+ if(!err.empty())
+ {
+ msg += ":\n" + err;
+ }
+ }
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
+ }
+ }
+ if(!SSL_CTX_check_private_key(_ctx))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unable to validate private key(s):\n" + sslErrors();
+ throw ex;
+ }
+ }
+ }
+
+ //
+ // Establish the cipher list.
+ //
+ {
+ string ciphers = properties->getProperty(propPrefix + "Ciphers");
+ if(!ciphers.empty())
+ {
+ if(!SSL_CTX_set_cipher_list(_ctx, ciphers.c_str()))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unable to set ciphers using `" + ciphers + "':\n" + sslErrors();
+ throw ex;
+ }
+ }
+ }
+
+ //
+ // Diffie Hellman configuration.
+ //
+ {
#ifndef OPENSSL_NO_DH
- _dhParams = new DHParams;
- SSL_CTX_set_options(_ctx, SSL_OP_SINGLE_DH_USE);
- SSL_CTX_set_tmp_dh_callback(_ctx, IceSSL_opensslDHCallback);
+ _dhParams = new DHParams;
+ SSL_CTX_set_options(_ctx, SSL_OP_SINGLE_DH_USE);
+ SSL_CTX_set_tmp_dh_callback(_ctx, IceSSL_opensslDHCallback);
#endif
- //
- // Properties have the following form:
- //
- // ...DH.<keyLength>=file
- //
- const string dhPrefix = propPrefix + "DH.";
- PropertyDict d = properties->getPropertiesForPrefix(dhPrefix);
- if(!d.empty())
- {
+ //
+ // Properties have the following form:
+ //
+ // ...DH.<keyLength>=file
+ //
+ const string dhPrefix = propPrefix + "DH.";
+ PropertyDict d = properties->getPropertiesForPrefix(dhPrefix);
+ if(!d.empty())
+ {
#ifdef OPENSSL_NO_DH
- _logger->warning("IceSSL: OpenSSL is not configured for Diffie Hellman");
+ _logger->warning("IceSSL: OpenSSL is not configured for Diffie Hellman");
#else
- for(PropertyDict::iterator p = d.begin(); p != d.end(); ++p)
- {
- string s = p->first.substr(dhPrefix.size());
- int keyLength = atoi(s.c_str());
- if(keyLength > 0)
- {
- string file = p->second;
- if(!checkPath(file, _defaultDir, false))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: DH parameter file not found:\n" + file;
- throw ex;
- }
- if(!_dhParams->add(keyLength, file))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: unable to read DH parameter file " + file;
- throw ex;
- }
- }
- }
+ for(PropertyDict::iterator p = d.begin(); p != d.end(); ++p)
+ {
+ string s = p->first.substr(dhPrefix.size());
+ int keyLength = atoi(s.c_str());
+ if(keyLength > 0)
+ {
+ string file = p->second;
+ if(!checkPath(file, _defaultDir, false))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: DH parameter file not found:\n" + file;
+ throw ex;
+ }
+ if(!_dhParams->add(keyLength, file))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unable to read DH parameter file " + file;
+ throw ex;
+ }
+ }
+ }
#endif
- }
- }
+ }
+ }
}
catch(...)
{
- SSL_CTX_free(_ctx);
- _ctx = 0;
- throw;
+ SSL_CTX_free(_ctx);
+ _ctx = 0;
+ throw;
}
}
@@ -501,9 +501,9 @@ IceSSL::Instance::context(SSL_CTX* context)
{
if(_ctx)
{
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: plugin is already initialized";
- throw ex;
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: plugin is already initialized";
+ throw ex;
}
_ctx = context;
@@ -569,23 +569,23 @@ IceSSL::Instance::verifyPeer(SSL* ssl, SOCKET fd, const string& address, const s
long result = SSL_get_verify_result(ssl);
if(result != X509_V_OK)
{
- ostringstream ostr;
- ostr << "IceSSL: certificate verification failed:\n" << X509_verify_cert_error_string(result);
- string msg = ostr.str();
- if(_securityTraceLevel >= 1)
- {
- _logger->trace(_securityTraceCategory, msg);
- }
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
+ ostringstream ostr;
+ ostr << "IceSSL: certificate verification failed:\n" << X509_verify_cert_error_string(result);
+ string msg = ostr.str();
+ if(_securityTraceLevel >= 1)
+ {
+ _logger->trace(_securityTraceCategory, msg);
+ }
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
}
X509* rawCert = SSL_get_peer_certificate(ssl);
CertificatePtr cert;
if(rawCert != 0)
{
- cert = new Certificate(rawCert);
+ cert = new Certificate(rawCert);
}
//
@@ -594,148 +594,148 @@ IceSSL::Instance::verifyPeer(SSL* ssl, SOCKET fd, const string& address, const s
//
if(cert)
{
- vector<pair<int, string> > subjectAltNames = cert->getSubjectAlternativeNames();
- vector<string> ipAddresses;
- vector<string> dnsNames;
- for(vector<pair<int, string> >::const_iterator p = subjectAltNames.begin(); p != subjectAltNames.end(); ++p)
- {
- if(p->first == 7)
- {
- ipAddresses.push_back(p->second);
- }
- else if(p->first == 2)
- {
- dnsNames.push_back(p->second);
- }
- }
-
- //
- // Compare the peer's address against the dnsName and ipAddress values.
- // This is only relevant for an outgoing connection.
- //
- if(!address.empty())
- {
- bool certNameOK = false;
-
- for(vector<string>::const_iterator p = ipAddresses.begin(); p != ipAddresses.end() && !certNameOK; ++p)
- {
- if(address == *p)
- {
- certNameOK = true;
- break;
- }
- }
-
- if(!certNameOK && !dnsNames.empty())
- {
- string host = address;
- transform(host.begin(), host.end(), host.begin(), ::tolower);
- for(vector<string>::const_iterator p = dnsNames.begin(); p != dnsNames.end() && !certNameOK; ++p)
- {
- string s = *p;
- transform(s.begin(), s.end(), s.begin(), ::tolower);
- if(host == s)
- {
- certNameOK = true;
- }
- }
- }
-
- //
- // Log a message if the name comparison fails. If CheckCertName is defined,
- // we also raise an exception to abort the connection. Don't log a message if
- // CheckCertName is not defined and a verifier is present.
- //
- if(!certNameOK && (_checkCertName || (_securityTraceLevel >= 1 && !_verifier)))
- {
- ostringstream ostr;
- ostr << "IceSSL: ";
- if(!_checkCertName)
- {
- ostr << "ignoring ";
- }
- ostr << "certificate validation failure:\npeer certificate does not contain `"
- << address << "' in its subjectAltName extension";
- if(!dnsNames.empty())
- {
- ostr << "\nDNS names found in certificate: ";
- for(vector<string>::const_iterator p = dnsNames.begin(); p != dnsNames.end(); ++p)
- {
- if(p != dnsNames.begin())
- {
- ostr << ", ";
- }
- ostr << *p;
- }
- }
- if(!ipAddresses.empty())
- {
- ostr << "\nIP addresses found in certificate: ";
- for(vector<string>::const_iterator p = ipAddresses.begin(); p != ipAddresses.end(); ++p)
- {
- if(p != ipAddresses.begin())
- {
- ostr << ", ";
- }
- ostr << *p;
- }
- }
- string msg = ostr.str();
- if(_securityTraceLevel >= 1)
- {
- Trace out(_logger, _securityTraceCategory);
- out << msg;
- }
- if(_checkCertName)
- {
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
- }
- }
- }
+ vector<pair<int, string> > subjectAltNames = cert->getSubjectAlternativeNames();
+ vector<string> ipAddresses;
+ vector<string> dnsNames;
+ for(vector<pair<int, string> >::const_iterator p = subjectAltNames.begin(); p != subjectAltNames.end(); ++p)
+ {
+ if(p->first == 7)
+ {
+ ipAddresses.push_back(p->second);
+ }
+ else if(p->first == 2)
+ {
+ dnsNames.push_back(p->second);
+ }
+ }
+
+ //
+ // Compare the peer's address against the dnsName and ipAddress values.
+ // This is only relevant for an outgoing connection.
+ //
+ if(!address.empty())
+ {
+ bool certNameOK = false;
+
+ for(vector<string>::const_iterator p = ipAddresses.begin(); p != ipAddresses.end() && !certNameOK; ++p)
+ {
+ if(address == *p)
+ {
+ certNameOK = true;
+ break;
+ }
+ }
+
+ if(!certNameOK && !dnsNames.empty())
+ {
+ string host = address;
+ transform(host.begin(), host.end(), host.begin(), ::tolower);
+ for(vector<string>::const_iterator p = dnsNames.begin(); p != dnsNames.end() && !certNameOK; ++p)
+ {
+ string s = *p;
+ transform(s.begin(), s.end(), s.begin(), ::tolower);
+ if(host == s)
+ {
+ certNameOK = true;
+ }
+ }
+ }
+
+ //
+ // Log a message if the name comparison fails. If CheckCertName is defined,
+ // we also raise an exception to abort the connection. Don't log a message if
+ // CheckCertName is not defined and a verifier is present.
+ //
+ if(!certNameOK && (_checkCertName || (_securityTraceLevel >= 1 && !_verifier)))
+ {
+ ostringstream ostr;
+ ostr << "IceSSL: ";
+ if(!_checkCertName)
+ {
+ ostr << "ignoring ";
+ }
+ ostr << "certificate validation failure:\npeer certificate does not contain `"
+ << address << "' in its subjectAltName extension";
+ if(!dnsNames.empty())
+ {
+ ostr << "\nDNS names found in certificate: ";
+ for(vector<string>::const_iterator p = dnsNames.begin(); p != dnsNames.end(); ++p)
+ {
+ if(p != dnsNames.begin())
+ {
+ ostr << ", ";
+ }
+ ostr << *p;
+ }
+ }
+ if(!ipAddresses.empty())
+ {
+ ostr << "\nIP addresses found in certificate: ";
+ for(vector<string>::const_iterator p = ipAddresses.begin(); p != ipAddresses.end(); ++p)
+ {
+ if(p != ipAddresses.begin())
+ {
+ ostr << ", ";
+ }
+ ostr << *p;
+ }
+ }
+ string msg = ostr.str();
+ if(_securityTraceLevel >= 1)
+ {
+ Trace out(_logger, _securityTraceCategory);
+ out << msg;
+ }
+ if(_checkCertName)
+ {
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
+ }
+ }
+ }
}
ConnectionInfo info = populateConnectionInfo(ssl, fd, adapterName, incoming);
if(_verifyDepthMax > 0 && static_cast<int>(info.certs.size()) > _verifyDepthMax)
{
- ostringstream ostr;
- ostr << (incoming ? "incoming" : "outgoing") << " connection rejected:\n"
- << "length of peer's certificate chain (" << info.certs.size() << ") exceeds maximum of "
- << _verifyDepthMax;
- string msg = ostr.str();
- if(_securityTraceLevel >= 1)
- {
- _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd));
- }
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
+ ostringstream ostr;
+ ostr << (incoming ? "incoming" : "outgoing") << " connection rejected:\n"
+ << "length of peer's certificate chain (" << info.certs.size() << ") exceeds maximum of "
+ << _verifyDepthMax;
+ string msg = ostr.str();
+ if(_securityTraceLevel >= 1)
+ {
+ _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd));
+ }
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
}
if(!_trustManager->verify(info))
{
- string msg = string(incoming ? "incoming" : "outgoing") + " connection rejected by trust manager";
- if(_securityTraceLevel >= 1)
- {
- _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd));
- }
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
+ string msg = string(incoming ? "incoming" : "outgoing") + " connection rejected by trust manager";
+ if(_securityTraceLevel >= 1)
+ {
+ _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd));
+ }
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
}
if(_verifier && !_verifier->verify(info))
{
- string msg = string(incoming ? "incoming" : "outgoing") + " connection rejected by certificate verifier";
- if(_securityTraceLevel >= 1)
- {
- _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd));
- }
- SecurityException ex(__FILE__, __LINE__);
- ex.reason = msg;
- throw ex;
+ string msg = string(incoming ? "incoming" : "outgoing") + " connection rejected by certificate verifier";
+ if(_securityTraceLevel >= 1)
+ {
+ _logger->trace(_securityTraceCategory, msg + "\n" + IceInternal::fdToString(fd));
+ }
+ SecurityException ex(__FILE__, __LINE__);
+ ex.reason = msg;
+ throw ex;
}
}
@@ -752,7 +752,7 @@ IceSSL::Instance::destroy()
if(_ctx)
{
- SSL_CTX_free(_ctx);
+ SSL_CTX_free(_ctx);
}
}
@@ -761,21 +761,21 @@ IceSSL::Instance::password(bool /*encrypting*/)
{
if(_prompt)
{
- try
- {
- return _prompt->getPassword();
- }
- catch(...)
- {
- //
- // Don't allow exceptions to cross an OpenSSL boundary.
- //
- return string();
- }
+ try
+ {
+ return _prompt->getPassword();
+ }
+ catch(...)
+ {
+ //
+ // Don't allow exceptions to cross an OpenSSL boundary.
+ //
+ return string();
+ }
}
else
{
- return _password;
+ return _password;
}
}
@@ -784,20 +784,20 @@ IceSSL::Instance::verifyCallback(int ok, SSL* ssl, X509_STORE_CTX* c)
{
if(!ok && _securityTraceLevel >= 1)
{
- X509* cert = X509_STORE_CTX_get_current_cert(c);
- int err = X509_STORE_CTX_get_error(c);
- char buf[256];
-
- Trace out(_logger, _securityTraceCategory);
- out << "certificate verification failure\n";
-
- X509_NAME_oneline(X509_get_issuer_name(cert), buf, static_cast<int>(sizeof(buf)));
- out << "issuer = " << buf << '\n';
- X509_NAME_oneline(X509_get_subject_name(cert), buf, static_cast<int>(sizeof(buf)));
- out << "subject = " << buf << '\n';
- out << "depth = " << X509_STORE_CTX_get_error_depth(c) << '\n';
- out << "error = " << X509_verify_cert_error_string(err) << '\n';
- out << IceInternal::fdToString(SSL_get_fd(ssl));
+ X509* cert = X509_STORE_CTX_get_current_cert(c);
+ int err = X509_STORE_CTX_get_error(c);
+ char buf[256];
+
+ Trace out(_logger, _securityTraceCategory);
+ out << "certificate verification failure\n";
+
+ X509_NAME_oneline(X509_get_issuer_name(cert), buf, static_cast<int>(sizeof(buf)));
+ out << "issuer = " << buf << '\n';
+ X509_NAME_oneline(X509_get_subject_name(cert), buf, static_cast<int>(sizeof(buf)));
+ out << "subject = " << buf << '\n';
+ out << "depth = " << X509_STORE_CTX_get_error_depth(c) << '\n';
+ out << "error = " << X509_verify_cert_error_string(err) << '\n';
+ out << IceInternal::fdToString(SSL_get_fd(ssl));
}
return ok;
}
@@ -818,13 +818,13 @@ IceSSL::Instance::traceConnection(SSL* ssl, bool incoming)
SSL_CIPHER* cipher = SSL_get_current_cipher(ssl);
if(!cipher)
{
- out << "unknown cipher\n";
+ out << "unknown cipher\n";
}
else
{
- out << "cipher = " << SSL_CIPHER_get_name(cipher) << "\n";
- out << "bits = " << SSL_CIPHER_get_bits(cipher, 0) << "\n";
- out << "protocol = " << SSL_get_version(ssl) << "\n";
+ out << "cipher = " << SSL_CIPHER_get_name(cipher) << "\n";
+ out << "bits = " << SSL_CIPHER_get_bits(cipher, 0) << "\n";
+ out << "protocol = " << SSL_get_version(ssl) << "\n";
}
out << IceInternal::fdToString(SSL_get_fd(ssl));
}
@@ -837,48 +837,48 @@ IceSSL::Instance::parseProtocols(const string& val)
string::size_type pos = 0;
while(pos != string::npos)
{
- pos = val.find_first_not_of(delim, pos);
- if(pos == string::npos)
- {
- break;
- }
-
- string prot;
- string::size_type end = val.find_first_of(delim, pos);
- if(end == string::npos)
- {
- prot = val.substr(pos);
- }
- else
- {
- prot = val.substr(pos, end - pos);
- }
- pos = end;
-
- if(prot == "ssl3" || prot == "sslv3")
- {
- sslv3 = true;
- }
- else if(prot == "tls" || prot == "tls1" || prot == "tlsv1")
- {
- tlsv1 = true;
- }
- else
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: unrecognized protocol `" + prot + "'";
- throw ex;
- }
+ pos = val.find_first_not_of(delim, pos);
+ if(pos == string::npos)
+ {
+ break;
+ }
+
+ string prot;
+ string::size_type end = val.find_first_of(delim, pos);
+ if(end == string::npos)
+ {
+ prot = val.substr(pos);
+ }
+ else
+ {
+ prot = val.substr(pos, end - pos);
+ }
+ pos = end;
+
+ if(prot == "ssl3" || prot == "sslv3")
+ {
+ sslv3 = true;
+ }
+ else if(prot == "tls" || prot == "tls1" || prot == "tlsv1")
+ {
+ tlsv1 = true;
+ }
+ else
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unrecognized protocol `" + prot + "'";
+ throw ex;
+ }
}
long opts = SSL_OP_NO_SSLv2; // SSLv2 is not supported.
if(!sslv3)
{
- opts |= SSL_OP_NO_SSLv3;
+ opts |= SSL_OP_NO_SSLv3;
}
if(!tlsv1)
{
- opts |= SSL_OP_NO_TLSv1;
+ opts |= SSL_OP_NO_TLSv1;
}
SSL_CTX_set_options(_ctx, opts);
}
diff --git a/cpp/src/IceSSL/PluginI.cpp b/cpp/src/IceSSL/PluginI.cpp
index 50f986c84d3..30f92d03015 100644
--- a/cpp/src/IceSSL/PluginI.cpp
+++ b/cpp/src/IceSSL/PluginI.cpp
@@ -60,11 +60,11 @@ IceSSL_opensslLockCallback(int mode, int n, const char* file, int line)
{
if(mode & CRYPTO_LOCK)
{
- locks[n].lock();
+ locks[n].lock();
}
else
{
- locks[n].unlock();
+ locks[n].unlock();
}
}
@@ -153,89 +153,89 @@ IceSSL::PluginI::setupSSL(const CommunicatorPtr& communicator)
if(instanceCount == 1)
{
- PropertiesPtr properties = communicator->getProperties();
-
- //
- // Create the mutexes and set the callbacks.
- //
- locks = new IceUtil::Mutex[CRYPTO_num_locks()];
- CRYPTO_set_locking_callback(IceSSL_opensslLockCallback);
- CRYPTO_set_id_callback(IceSSL_opensslThreadIdCallback);
-
- //
- // Load human-readable error messages.
- //
- SSL_load_error_strings();
-
- //
- // Initialize the SSL library.
- //
- SSL_library_init();
-
- //
- // Initialize the PRNG.
- //
+ PropertiesPtr properties = communicator->getProperties();
+
+ //
+ // Create the mutexes and set the callbacks.
+ //
+ locks = new IceUtil::Mutex[CRYPTO_num_locks()];
+ CRYPTO_set_locking_callback(IceSSL_opensslLockCallback);
+ CRYPTO_set_id_callback(IceSSL_opensslThreadIdCallback);
+
+ //
+ // Load human-readable error messages.
+ //
+ SSL_load_error_strings();
+
+ //
+ // Initialize the SSL library.
+ //
+ SSL_library_init();
+
+ //
+ // Initialize the PRNG.
+ //
#ifdef WINDOWS
- RAND_screen(); // Uses data from the screen if possible.
+ RAND_screen(); // Uses data from the screen if possible.
#endif
- char randFile[1024];
- if(RAND_file_name(randFile, sizeof(randFile))) // Gets the name of a default seed file.
- {
- RAND_load_file(randFile, 1024);
- }
- string randFiles = properties->getProperty("IceSSL.Random");
- if(!randFiles.empty())
- {
- vector<string> files;
+ char randFile[1024];
+ if(RAND_file_name(randFile, sizeof(randFile))) // Gets the name of a default seed file.
+ {
+ RAND_load_file(randFile, 1024);
+ }
+ string randFiles = properties->getProperty("IceSSL.Random");
+ if(!randFiles.empty())
+ {
+ vector<string> files;
#ifdef _WIN32
- const string sep = ";";
+ const string sep = ";";
#else
- const string sep = ":";
+ const string sep = ":";
#endif
- string defaultDir = properties->getProperty("IceSSL.DefaultDir");
- if(!splitString(randFiles, sep, false, files))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: invalid value for IceSSL.Random:\n" + randFiles;
- throw ex;
- }
- for(vector<string>::iterator p = files.begin(); p != files.end(); ++p)
- {
- string file = *p;
- if(!checkPath(file, defaultDir, false))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: entropy data file not found:\n" + file;
- throw ex;
- }
- if(!RAND_load_file(file.c_str(), 1024))
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: unable to load entropy data from " + file;
- throw ex;
- }
- }
- }
+ string defaultDir = properties->getProperty("IceSSL.DefaultDir");
+ if(!splitString(randFiles, sep, false, files))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: invalid value for IceSSL.Random:\n" + randFiles;
+ throw ex;
+ }
+ for(vector<string>::iterator p = files.begin(); p != files.end(); ++p)
+ {
+ string file = *p;
+ if(!checkPath(file, defaultDir, false))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: entropy data file not found:\n" + file;
+ throw ex;
+ }
+ if(!RAND_load_file(file.c_str(), 1024))
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unable to load entropy data from " + file;
+ throw ex;
+ }
+ }
+ }
#ifndef _WIN32
- //
- // The Entropy Gathering Daemon (EGD) is not available on Windows.
- // The file should be a Unix domain socket for the daemon.
- //
- string entropyDaemon = properties->getProperty("IceSSL.EntropyDaemon");
- if(!entropyDaemon.empty())
- {
- if(RAND_egd(entropyDaemon.c_str()) <= 0)
- {
- PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: EGD failure using file " + entropyDaemon;
- throw ex;
- }
- }
+ //
+ // The Entropy Gathering Daemon (EGD) is not available on Windows.
+ // The file should be a Unix domain socket for the daemon.
+ //
+ string entropyDaemon = properties->getProperty("IceSSL.EntropyDaemon");
+ if(!entropyDaemon.empty())
+ {
+ if(RAND_egd(entropyDaemon.c_str()) <= 0)
+ {
+ PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: EGD failure using file " + entropyDaemon;
+ throw ex;
+ }
+ }
#endif
- if(!RAND_status())
- {
- communicator->getLogger()->warning("IceSSL: insufficient data to initialize PRNG");
- }
+ if(!RAND_status())
+ {
+ communicator->getLogger()->warning("IceSSL: insufficient data to initialize PRNG");
+ }
}
}
@@ -246,15 +246,15 @@ IceSSL::PluginI::cleanupSSL()
if(--instanceCount == 0)
{
- CRYPTO_set_locking_callback(0);
- CRYPTO_set_id_callback(0);
- delete[] locks;
- locks = 0;
-
- CRYPTO_cleanup_all_ex_data();
- RAND_cleanup();
- ERR_free_strings();
- EVP_cleanup();
+ CRYPTO_set_locking_callback(0);
+ CRYPTO_set_id_callback(0);
+ delete[] locks;
+ locks = 0;
+
+ CRYPTO_cleanup_all_ex_data();
+ RAND_cleanup();
+ ERR_free_strings();
+ EVP_cleanup();
}
}
@@ -303,23 +303,23 @@ IceSSL::getConnectionInfo(const ConnectionPtr& connection)
IceInternal::TransceiverPtr transceiver = con->getTransceiver();
if(!transceiver)
{
- throw ConnectionInvalidException(__FILE__, __LINE__, "connection closed");
+ throw ConnectionInvalidException(__FILE__, __LINE__, "connection closed");
}
TransceiverIPtr ssltransceiver = TransceiverIPtr::dynamicCast(con->getTransceiver());
if(!ssltransceiver)
{
- throw ConnectionInvalidException(__FILE__, __LINE__, "not ssl connection");
+ throw ConnectionInvalidException(__FILE__, __LINE__, "not ssl connection");
}
try
{
- return ssltransceiver->getConnectionInfo();
+ return ssltransceiver->getConnectionInfo();
}
catch(const Ice::LocalException& ex)
{
- ostringstream os;
- os << "couldn't get connection information:\n" << ex << endl;
- throw ConnectionInvalidException(__FILE__, __LINE__, os.str());
+ ostringstream os;
+ os << "couldn't get connection information:\n" << ex << endl;
+ throw ConnectionInvalidException(__FILE__, __LINE__, os.str());
}
}
diff --git a/cpp/src/IceSSL/RFC2253.cpp b/cpp/src/IceSSL/RFC2253.cpp
index ad221ef1ac5..72afe765070 100644
--- a/cpp/src/IceSSL/RFC2253.cpp
+++ b/cpp/src/IceSSL/RFC2253.cpp
@@ -37,26 +37,26 @@ IceSSL::RFC2253::parse(const string& data)
size_t pos = 0;
while(pos < data.size())
{
- current.push_back(parseNameComponent(data, pos));
- eatWhite(data, pos);
- if(pos < data.size() && data[pos] == ',')
- {
- ++pos;
- }
- else if(pos < data.size() && data[pos] == ';')
- {
- ++pos;
- results.push_back(current);
- current.clear();
- }
- else if(pos < data.size())
- {
- throw ParseException(__FILE__, __LINE__, "expected ',' or ';' at `" + data.substr(pos) + "'");
- }
+ current.push_back(parseNameComponent(data, pos));
+ eatWhite(data, pos);
+ if(pos < data.size() && data[pos] == ',')
+ {
+ ++pos;
+ }
+ else if(pos < data.size() && data[pos] == ';')
+ {
+ ++pos;
+ results.push_back(current);
+ current.clear();
+ }
+ else if(pos < data.size())
+ {
+ throw ParseException(__FILE__, __LINE__, "expected ',' or ';' at `" + data.substr(pos) + "'");
+ }
}
if(!current.empty())
{
- results.push_back(current);
+ results.push_back(current);
}
return results;
@@ -69,16 +69,16 @@ IceSSL::RFC2253::parseStrict(const string& data)
size_t pos = 0;
while(pos < data.size())
{
- results.push_back(parseNameComponent(data, pos));
- eatWhite(data, pos);
- if(pos < data.size() && (data[pos] == ',' || data[pos] == ';'))
- {
- ++pos;
- }
- else if(pos < data.size())
- {
- throw ParseException(__FILE__, __LINE__, "expected ',' or ';' at `" + data.substr(pos) + "'");
- }
+ results.push_back(parseNameComponent(data, pos));
+ eatWhite(data, pos);
+ if(pos < data.size() && (data[pos] == ',' || data[pos] == ';'))
+ {
+ ++pos;
+ }
+ else if(pos < data.size())
+ {
+ throw ParseException(__FILE__, __LINE__, "expected ',' or ';' at `" + data.substr(pos) + "'");
+ }
}
return results;
}
@@ -88,20 +88,20 @@ IceSSL::RFC2253::unescape(const string& data)
{
if(data.size() == 0)
{
- return data;
+ return data;
}
if(data[0] == '"')
{
- if(data[data.size() - 1] != '"')
- {
- throw ParseException(__FILE__, __LINE__, "unescape: missing \"");
- }
+ if(data[data.size() - 1] != '"')
+ {
+ throw ParseException(__FILE__, __LINE__, "unescape: missing \"");
+ }
- //
- // Return the string without quotes.
- //
- return data.substr(1, data.size() - 2);
+ //
+ // Return the string without quotes.
+ //
+ return data.substr(1, data.size() - 2);
}
//
@@ -110,61 +110,61 @@ IceSSL::RFC2253::unescape(const string& data)
string result;
if(data[0] == '#')
{
- size_t pos = 1;
- while(pos < data.size())
- {
- result += unescapeHex(data, pos);
- pos += 2;
- }
+ size_t pos = 1;
+ while(pos < data.size())
+ {
+ result += unescapeHex(data, pos);
+ pos += 2;
+ }
}
else
{
- size_t pos = 0;
- while(pos < data.size())
- {
- if(data[pos] != '\\')
- {
- result += data[pos];
- ++pos;
- }
- else
- {
- ++pos;
- if(pos >= data.size())
- {
- throw ParseException(__FILE__, __LINE__, "unescape: invalid escape sequence");
- }
- if(special.find(data[pos]) != string::npos || data[pos] != '\\' || data[pos] != '"')
- {
- result += data[pos];
- ++pos;
- }
- else
- {
- result += unescapeHex(data, pos);
- pos += 2;
- }
- }
- }
+ size_t pos = 0;
+ while(pos < data.size())
+ {
+ if(data[pos] != '\\')
+ {
+ result += data[pos];
+ ++pos;
+ }
+ else
+ {
+ ++pos;
+ if(pos >= data.size())
+ {
+ throw ParseException(__FILE__, __LINE__, "unescape: invalid escape sequence");
+ }
+ if(special.find(data[pos]) != string::npos || data[pos] != '\\' || data[pos] != '"')
+ {
+ result += data[pos];
+ ++pos;
+ }
+ else
+ {
+ result += unescapeHex(data, pos);
+ pos += 2;
+ }
+ }
+ }
}
return result;
}
-
+
static int
hexToInt(char v)
{
if(v >= '0' && v <= '9')
{
- return v - '0';
+ return v - '0';
}
if(v >= 'a' && v <= 'f')
{
- return 10 + (v - 'a');
+ return 10 + (v - 'a');
}
if(v >= 'A' && v <= 'F')
{
- return 10 + (v - 'A');
+ return 10 + (v - 'A');
}
throw ParseException(__FILE__, __LINE__, "unescape: invalid hex pair");
return 0; // To satisfy the compiler.
@@ -176,7 +176,7 @@ unescapeHex(const string& data, size_t pos)
assert(pos < data.size());
if(pos + 2 >= data.size())
{
- throw ParseException(__FILE__, __LINE__, "unescape: invalid hex pair");
+ throw ParseException(__FILE__, __LINE__, "unescape: invalid hex pair");
}
return (char)(hexToInt(data[pos]) * 16 + hexToInt(data[pos + 1]));
}
@@ -187,20 +187,20 @@ parseNameComponent(const string& data, size_t& pos)
pair<string, string> final = parseAttributeTypeAndValue(data, pos);
while(pos < data.size())
{
- eatWhite(data, pos);
- if(pos < data.size() && data[pos] == '+')
- {
- ++pos;
- }
- else
- {
- break;
- }
- pair<string, string> p = parseAttributeTypeAndValue(data, pos);
- final.second += "+";
- final.second += p.first;
- final.second += '=';
- final.second += p.second;
+ eatWhite(data, pos);
+ if(pos < data.size() && data[pos] == '+')
+ {
+ ++pos;
+ }
+ else
+ {
+ break;
+ }
+ pair<string, string> p = parseAttributeTypeAndValue(data, pos);
+ final.second += "+";
+ final.second += p.first;
+ final.second += '=';
+ final.second += p.second;
}
return final;
}
@@ -213,11 +213,11 @@ parseAttributeTypeAndValue(const string& data, size_t& pos)
eatWhite(data, pos);
if(pos >= data.size())
{
- throw ParseException(__FILE__, __LINE__, "invalid attribute type/value pair (unexpected end of data)");
+ throw ParseException(__FILE__, __LINE__, "invalid attribute type/value pair (unexpected end of data)");
}
if(data[pos] != '=')
{
- throw ParseException(__FILE__, __LINE__, "invalid attribute type/value pair (missing =)");
+ throw ParseException(__FILE__, __LINE__, "invalid attribute type/value pair (missing =)");
}
++pos;
p.second = parseAttributeValue(data, pos);
@@ -230,7 +230,7 @@ parseAttributeType(const string& data, size_t& pos)
eatWhite(data, pos);
if(pos >= data.size())
{
- throw ParseException(__FILE__, __LINE__, "invalid attribute type (expected end of data)");
+ throw ParseException(__FILE__, __LINE__, "invalid attribute type (expected end of data)");
}
string result;
@@ -256,56 +256,56 @@ parseAttributeType(const string& data, size_t& pos)
if(isdigit(data[pos]) ||
(data.size() - pos >= 4 && (data.substr(pos, 4) == "oid." || data.substr(pos, 4) == "OID.")))
{
- if(!isdigit(data[pos]))
- {
- result += data.substr(pos, 4);
- pos += 4;
- }
+ if(!isdigit(data[pos]))
+ {
+ result += data.substr(pos, 4);
+ pos += 4;
+ }
- while(true)
- {
- // 1*DIGIT
- while(pos < data.size() && isdigit(data[pos]))
- {
- result += data[pos];
- ++pos;
- }
- // "." 1*DIGIT
- if(pos < data.size() && data[pos] == '.')
- {
- result += data[pos];
- ++pos;
- // 1*DIGIT must follow "."
- if(pos < data.size() && !isdigit(data[pos]))
- {
- throw ParseException(__FILE__, __LINE__, "invalid attribute type (expected end of data)");
- }
- }
- else
- {
- break;
- }
- }
+ while(true)
+ {
+ // 1*DIGIT
+ while(pos < data.size() && isdigit(data[pos]))
+ {
+ result += data[pos];
+ ++pos;
+ }
+ // "." 1*DIGIT
+ if(pos < data.size() && data[pos] == '.')
+ {
+ result += data[pos];
+ ++pos;
+ // 1*DIGIT must follow "."
+ if(pos < data.size() && !isdigit(data[pos]))
+ {
+ throw ParseException(__FILE__, __LINE__, "invalid attribute type (expected end of data)");
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
}
else if(isalpha(data[pos]))
{
- //
- // The grammar is wrong in this case. It should be ALPHA
- // KEYCHAR* otherwise it will not accept "O" as a valid
- // attribute type.
- //
- result += data[pos];
- ++pos;
- // 1* KEYCHAR
- while(pos < data.size() && (isalpha(data[pos]) || isdigit(data[pos]) || data[pos] == '-'))
- {
- result += data[pos];
- ++pos;
- }
+ //
+ // The grammar is wrong in this case. It should be ALPHA
+ // KEYCHAR* otherwise it will not accept "O" as a valid
+ // attribute type.
+ //
+ result += data[pos];
+ ++pos;
+ // 1* KEYCHAR
+ while(pos < data.size() && (isalpha(data[pos]) || isdigit(data[pos]) || data[pos] == '-'))
+ {
+ result += data[pos];
+ ++pos;
+ }
}
else
{
- throw ParseException(__FILE__, __LINE__, "invalid attribute type");
+ throw ParseException(__FILE__, __LINE__, "invalid attribute type");
}
return result;
}
@@ -317,7 +317,7 @@ parseAttributeValue(const string& data, size_t& pos)
string result;
if(pos >= data.size())
{
- return result;
+ return result;
}
//
@@ -326,17 +326,17 @@ parseAttributeValue(const string& data, size_t& pos)
//
if(data[pos] == '#')
{
- result += data[pos];
- ++pos;
- while(true)
- {
- string h = parseHexPair(data, pos, true);
- if(h.size() == 0)
- {
- break;
- }
- result += h;
- }
+ result += data[pos];
+ ++pos;
+ while(true)
+ {
+ string h = parseHexPair(data, pos, true);
+ if(h.size() == 0)
+ {
+ break;
+ }
+ result += h;
+ }
}
//
// RFC 2253
@@ -345,33 +345,33 @@ parseAttributeValue(const string& data, size_t& pos)
//
else if(data[pos] == '"')
{
- result += data[pos];
- ++pos;
- while(true)
- {
- if(pos >= data.size())
- {
- throw ParseException(__FILE__, __LINE__, "invalid attribute value (unexpected end of data)");
- }
- // final terminating "
- if(data[pos] == '"')
- {
- result += data[pos];
- ++pos;
- break;
- }
- // any character except '\'
- else if(data[pos] != '\\')
- {
- result += data[pos];
- ++pos;
- }
- // pair '\'
- else
- {
- result += parsePair(data, pos);
- }
- }
+ result += data[pos];
+ ++pos;
+ while(true)
+ {
+ if(pos >= data.size())
+ {
+ throw ParseException(__FILE__, __LINE__, "invalid attribute value (unexpected end of data)");
+ }
+ // final terminating "
+ if(data[pos] == '"')
+ {
+ result += data[pos];
+ ++pos;
+ break;
+ }
+ // any character except '\'
+ else if(data[pos] != '\\')
+ {
+ result += data[pos];
+ ++pos;
+ }
+ // pair '\'
+ else
+ {
+ result += parsePair(data, pos);
+ }
+ }
}
//
// RFC 2253
@@ -380,22 +380,22 @@ parseAttributeValue(const string& data, size_t& pos)
//
else
{
- while(pos < data.size())
- {
- if(data[pos] == '\\')
- {
- result += parsePair(data, pos);
- }
- else if(special.find(data[pos]) == string::npos && data[pos] != '"')
- {
- result += data[pos];
- ++pos;
- }
- else
- {
- break;
- }
- }
+ while(pos < data.size())
+ {
+ if(data[pos] == '\\')
+ {
+ result += parsePair(data, pos);
+ }
+ else if(special.find(data[pos]) == string::npos && data[pos] != '"')
+ {
+ result += data[pos];
+ ++pos;
+ }
+ else
+ {
+ break;
+ }
+ }
}
return result;
}
@@ -415,14 +415,14 @@ parsePair(const string& data, size_t& pos)
if(pos >= data.size())
{
- throw ParseException(__FILE__, __LINE__, "invalid escape format (unexpected end of data)");
+ throw ParseException(__FILE__, __LINE__, "invalid escape format (unexpected end of data)");
}
if(special.find(data[pos]) != string::npos || data[pos] != '\\' || data[pos] != '"')
{
- result += data[pos];
- ++pos;
- return result;
+ result += data[pos];
+ ++pos;
+ return result;
}
return parseHexPair(data, pos, false);
}
@@ -437,21 +437,21 @@ parseHexPair(const string& data, size_t& pos, bool allowEmpty)
string result;
if(pos < data.size() && hexvalid.find(data[pos]) != string::npos)
{
- result += data[pos];
- ++pos;
+ result += data[pos];
+ ++pos;
}
if(pos < data.size() && hexvalid.find(data[pos]) != string::npos)
{
- result += data[pos];
- ++pos;
+ result += data[pos];
+ ++pos;
}
if(result.size() != 2)
{
- if(allowEmpty && result.size() == 0)
- {
- return result;
- }
- throw ParseException(__FILE__, __LINE__, "invalid hex format");
+ if(allowEmpty && result.size() == 0)
+ {
+ return result;
+ }
+ throw ParseException(__FILE__, __LINE__, "invalid hex format");
}
return result;
}
@@ -469,7 +469,7 @@ eatWhite(const string& data, size_t& pos)
{
while(pos < data.size() && data[pos] == ' ')
{
- ++pos;
+ ++pos;
}
}
@@ -479,16 +479,16 @@ print(const list< list<pair<string, string> > >& r)
{
if(r.size() > 1)
{
- cout << "result: " << r.size() << " DNs" << endl;
+ cout << "result: " << r.size() << " DNs" << endl;
}
for(list< list<pair<string, string> > >::const_iterator q = r.begin(); q != r.end(); ++q)
{
- list<pair<string, string> > l = *q;
- cout << "result: " << l.size() << " RDNs" << endl;
- for(list<pair<string, string> >::const_iterator p = l.begin(); p != l.end(); ++p)
- {
- cout << "\t\"" << p->first << "\"=\"" << p->second << "\"" << endl;
- }
+ list<pair<string, string> > l = *q;
+ cout << "result: " << l.size() << " RDNs" << endl;
+ for(list<pair<string, string> >::const_iterator p = l.begin(); p != l.end(); ++p)
+ {
+ cout << "\t\"" << p->first << "\"=\"" << p->second << "\"" << endl;
+ }
}
}
@@ -496,24 +496,24 @@ int
main()
{
string examples[] = {
- "CN=Steve Kille,O=Isode Limited,C=GB",
- "OU=Sales+CN=J. Smith,O=Widget Inc.,C=US",
- "CN=L. Eagle,O=Sue\\, Grabbit and Runn,C=GB",
- "CN=Before\\0DAfter,O=Test,C=GB",
- "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB",
- "SN=Lu\\C4\\8Di\\C4\\87",
+ "CN=Steve Kille,O=Isode Limited,C=GB",
+ "OU=Sales+CN=J. Smith,O=Widget Inc.,C=US",
+ "CN=L. Eagle,O=Sue\\, Grabbit and Runn,C=GB",
+ "CN=Before\\0DAfter,O=Test,C=GB",
+ "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB",
+ "SN=Lu\\C4\\8Di\\C4\\87",
};
try
{
- for(int i = 0; i < sizeof(examples)/sizeof(examples[0]); ++i)
- {
- cout << "string: " << examples[i] << endl;
- print(RFC2253::parse(examples[i]));
- }
+ for(int i = 0; i < sizeof(examples)/sizeof(examples[0]); ++i)
+ {
+ cout << "string: " << examples[i] << endl;
+ print(RFC2253::parse(examples[i]));
+ }
}
catch(const RFC2253::ParseException& e)
{
- cout << "error: " << e.reason << endl;
+ cout << "error: " << e.reason << endl;
}
}
#endif
diff --git a/cpp/src/IceSSL/TrustManager.cpp b/cpp/src/IceSSL/TrustManager.cpp
index f505cca8e37..5e620615fe9 100644
--- a/cpp/src/IceSSL/TrustManager.cpp
+++ b/cpp/src/IceSSL/TrustManager.cpp
@@ -31,25 +31,25 @@ TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) :
string key;
try
{
- key = "IceSSL.TrustOnly";
- _all = parse(properties->getProperty(key));
- key = "IceSSL.TrustOnly.Client";
- _client = parse(properties->getProperty(key));
- key = "IceSSL.TrustOnly.Server";
- _allServer = parse(properties->getProperty(key));
- Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
- for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
- {
- string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size());
- key = p->first;
- _server[name] = parse(p->second);
- }
+ key = "IceSSL.TrustOnly";
+ _all = parse(properties->getProperty(key));
+ key = "IceSSL.TrustOnly.Client";
+ _client = parse(properties->getProperty(key));
+ key = "IceSSL.TrustOnly.Server";
+ _allServer = parse(properties->getProperty(key));
+ Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
+ for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
+ {
+ string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size());
+ key = p->first;
+ _server[name] = parse(p->second);
+ }
}
catch(const ParseException& e)
{
- Ice::PluginInitializationException ex(__FILE__, __LINE__);
- ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason;
- throw ex;
+ Ice::PluginInitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason;
+ throw ex;
}
}
@@ -59,30 +59,30 @@ TrustManager::verify(const ConnectionInfo& info)
list<list<DistinguishedName> > trustset;
if(_all.size() > 0)
{
- trustset.push_back(_all);
+ trustset.push_back(_all);
}
if(info.incoming)
{
- if(_allServer.size() > 0)
- {
- trustset.push_back(_allServer);
- }
- if(info.adapterName.size() > 0)
- {
- map<string, list<DistinguishedName> >::const_iterator p = _server.find(info.adapterName);
- if(p != _server.end())
- {
- trustset.push_back(p->second);
- }
- }
+ if(_allServer.size() > 0)
+ {
+ trustset.push_back(_allServer);
+ }
+ if(info.adapterName.size() > 0)
+ {
+ map<string, list<DistinguishedName> >::const_iterator p = _server.find(info.adapterName);
+ if(p != _server.end())
+ {
+ trustset.push_back(p->second);
+ }
+ }
}
else
{
- if(_client.size() > 0)
- {
- trustset.push_back(_client);
- }
+ if(_client.size() > 0)
+ {
+ trustset.push_back(_client);
+ }
}
//
@@ -90,7 +90,7 @@ TrustManager::verify(const ConnectionInfo& info)
//
if(trustset.size() == 0)
{
- return true;
+ return true;
}
//
@@ -98,50 +98,50 @@ TrustManager::verify(const ConnectionInfo& info)
//
if(info.certs.size() != 0)
{
- DistinguishedName subject = info.certs[0]->getSubjectDN();
- if(_traceLevel > 0)
- {
- Ice::Trace trace(_communicator->getLogger(), "Security");
- if(info.incoming)
- {
- trace << "trust manager evaluating client:\n"
- << "subject = " << string(subject) << '\n'
- << "adapter = " << info.adapterName << '\n'
- << "local addr = " << IceInternal::addrToString(info.localAddr) << '\n'
- << "remote addr = " << IceInternal::addrToString(info.remoteAddr);
- }
- else
- {
- trace << "trust manager evaluating server:\n"
- << "subject = " << string(subject) << '\n'
- << "local addr = " << IceInternal::addrToString(info.localAddr) << '\n'
- << "remote addr = " << IceInternal::addrToString(info.remoteAddr);
- }
- }
-
- //
- // Try matching against everything in the trust set.
- //
- for(list<list<DistinguishedName> >::const_iterator p = trustset.begin(); p != trustset.end(); ++p)
- {
- if(_traceLevel > 1)
- {
- Ice::Trace trace(_communicator->getLogger(), "Security");
- trace << "trust manager matching PDNs:\n";
- for(list<DistinguishedName>::const_iterator r = p->begin(); r != p->end(); ++r)
- {
- if(r != p->begin())
- {
- trace << ';';
- }
- trace << string(*r);
- }
- }
- if(match(*p, subject))
- {
- return true;
- }
- }
+ DistinguishedName subject = info.certs[0]->getSubjectDN();
+ if(_traceLevel > 0)
+ {
+ Ice::Trace trace(_communicator->getLogger(), "Security");
+ if(info.incoming)
+ {
+ trace << "trust manager evaluating client:\n"
+ << "subject = " << string(subject) << '\n'
+ << "adapter = " << info.adapterName << '\n'
+ << "local addr = " << IceInternal::addrToString(info.localAddr) << '\n'
+ << "remote addr = " << IceInternal::addrToString(info.remoteAddr);
+ }
+ else
+ {
+ trace << "trust manager evaluating server:\n"
+ << "subject = " << string(subject) << '\n'
+ << "local addr = " << IceInternal::addrToString(info.localAddr) << '\n'
+ << "remote addr = " << IceInternal::addrToString(info.remoteAddr);
+ }
+ }
+
+ //
+ // Try matching against everything in the trust set.
+ //
+ for(list<list<DistinguishedName> >::const_iterator p = trustset.begin(); p != trustset.end(); ++p)
+ {
+ if(_traceLevel > 1)
+ {
+ Ice::Trace trace(_communicator->getLogger(), "Security");
+ trace << "trust manager matching PDNs:\n";
+ for(list<DistinguishedName>::const_iterator r = p->begin(); r != p->end(); ++r)
+ {
+ if(r != p->begin())
+ {
+ trace << ';';
+ }
+ trace << string(*r);
+ }
+ }
+ if(match(*p, subject))
+ {
+ return true;
+ }
+ }
}
return false;
@@ -152,10 +152,10 @@ TrustManager::match(const list< DistinguishedName>& matchSet, const Distinguishe
{
for(list<DistinguishedName>::const_iterator r = matchSet.begin(); r != matchSet.end(); ++r)
{
- if(subject.match(*r))
- {
- return true;
- }
+ if(subject.match(*r))
+ {
+ return true;
+ }
}
return false;
}
@@ -166,11 +166,11 @@ TrustManager::parse(const string& value) const
list<DistinguishedName> result;
if(!value.empty())
{
- RFC2253::RDNSeqSeq dns = RFC2253::parse(value);
- for(RFC2253::RDNSeqSeq::const_iterator p = dns.begin(); p != dns.end(); ++p)
- {
- result.push_back(DistinguishedName(*p));
- }
+ RFC2253::RDNSeqSeq dns = RFC2253::parse(value);
+ for(RFC2253::RDNSeqSeq::const_iterator p = dns.begin(); p != dns.end(); ++p)
+ {
+ result.push_back(DistinguishedName(*p));
+ }
}
return result;
}
diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp
index 1754bd62654..9adf539fac3 100644
--- a/cpp/src/IceSSL/Util.cpp
+++ b/cpp/src/IceSSL/Util.cpp
@@ -184,7 +184,7 @@ IceSSL::DHParams::~DHParams()
ParamList::iterator p;
for(p = _params.begin(); p != _params.end(); ++p)
{
- DH_free(p->second);
+ DH_free(p->second);
}
DH_free(_dh512);
DH_free(_dh1024);
@@ -198,19 +198,19 @@ IceSSL::DHParams::add(int keyLength, const string& file)
BIO* bio = BIO_new(BIO_s_file());
if(BIO_read_filename(bio, file.c_str()) <= 0)
{
- BIO_free(bio);
- return false;
+ BIO_free(bio);
+ return false;
}
DH* dh = PEM_read_bio_DHparams(bio, 0, 0, 0);
BIO_free(bio);
if(!dh)
{
- return false;
+ return false;
}
ParamList::iterator p = _params.begin();
while(p != _params.end() && keyLength > p->first)
{
- ++p;
+ ++p;
}
_params.insert(p, KeyParamPair(keyLength, dh));
return true;
@@ -226,10 +226,10 @@ IceSSL::DHParams::get(int keyLength)
ParamList::iterator p;
for(p = _params.begin(); p != _params.end(); ++p)
{
- if(p->first >= keyLength)
- {
- return p->second;
- }
+ if(p->first >= keyLength)
+ {
+ return p->second;
+ }
}
//
@@ -239,35 +239,35 @@ IceSSL::DHParams::get(int keyLength)
if(keyLength >= 4096)
{
- if(!_dh4096)
- {
- _dh4096 = convertDH(dh4096_p, (int) sizeof(dh4096_p), dh4096_g, (int) sizeof(dh4096_g));
- }
- return _dh4096;
+ if(!_dh4096)
+ {
+ _dh4096 = convertDH(dh4096_p, (int) sizeof(dh4096_p), dh4096_g, (int) sizeof(dh4096_g));
+ }
+ return _dh4096;
}
else if(keyLength >= 2048)
{
- if(!_dh2048)
- {
- _dh2048 = convertDH(dh2048_p, (int) sizeof(dh2048_p), dh2048_g, (int) sizeof(dh2048_g));
- }
- return _dh2048;
+ if(!_dh2048)
+ {
+ _dh2048 = convertDH(dh2048_p, (int) sizeof(dh2048_p), dh2048_g, (int) sizeof(dh2048_g));
+ }
+ return _dh2048;
}
else if(keyLength >= 1024)
{
- if(!_dh1024)
- {
- _dh1024 = convertDH(dh1024_p, (int) sizeof(dh1024_p), dh1024_g, (int) sizeof(dh1024_g));
- }
- return _dh1024;
+ if(!_dh1024)
+ {
+ _dh1024 = convertDH(dh1024_p, (int) sizeof(dh1024_p), dh1024_g, (int) sizeof(dh1024_g));
+ }
+ return _dh1024;
}
else
{
- if(!_dh512)
- {
- _dh512 = convertDH(dh512_p, (int) sizeof(dh512_p), dh512_g, (int) sizeof(dh512_g));
- }
- return _dh512;
+ if(!_dh512)
+ {
+ _dh512 = convertDH(dh512_p, (int) sizeof(dh512_p), dh512_g, (int) sizeof(dh512_g));
+ }
+ return _dh512;
}
}
@@ -282,11 +282,11 @@ selectReadWrite(SOCKET fd, bool read, int timeout)
FD_ZERO(&wFdSet);
if(read)
{
- FD_SET(fd, &rFdSet);
+ FD_SET(fd, &rFdSet);
}
else
{
- FD_SET(fd, &wFdSet);
+ FD_SET(fd, &wFdSet);
}
#else
struct pollfd pollfd[1];
@@ -299,14 +299,14 @@ repeatSelect:
#ifdef _WIN32
if(timeout >= 0)
{
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, &tv);
+ struct timeval tv;
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
+ ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, &tv);
}
else
{
- ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, 0);
+ ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, 0);
}
#else
ret = ::poll(pollfd, 1, timeout);
@@ -314,18 +314,18 @@ repeatSelect:
if(ret == 0)
{
- return false; // Timeout.
+ return false; // Timeout.
}
else if(ret == SOCKET_ERROR)
{
- if(IceInternal::interrupted())
- {
- goto repeatSelect;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = IceInternal::getSocketErrno();
- throw ex;
+ if(IceInternal::interrupted())
+ {
+ goto repeatSelect;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = IceInternal::getSocketErrno();
+ throw ex;
}
return true;
@@ -349,56 +349,56 @@ IceSSL::splitString(const string& str, const string& delim, bool handleQuotes, v
string::size_type pos = str.find_first_not_of(delim + " \t");
if(pos == string::npos)
{
- return true;
+ return true;
}
string::value_type quoteChar = 0;
while(pos != string::npos)
{
- if(handleQuotes && (str[pos] == '"' || str[pos] == '\''))
- {
- quoteChar = str[pos];
- ++pos;
- }
-
- string val;
- while(pos < str.size())
- {
- if((!handleQuotes || !quoteChar) && delim.find(str[pos]) != string::npos)
- {
- break;
- }
- if(handleQuotes)
- {
- if(str[pos] == '\\')
- {
- if(pos + 1 < str.size() && str[pos + 1] == quoteChar)
- {
- ++pos;
- }
- }
- else if(str[pos] == quoteChar)
- {
- quoteChar = 0;
- ++pos;
- continue;
- }
- }
- val.push_back(str[pos]);
- ++pos;
- }
-
- if(!val.empty())
- {
- result.push_back(val);
- }
-
- pos = str.find_first_not_of(delim, pos);
+ if(handleQuotes && (str[pos] == '"' || str[pos] == '\''))
+ {
+ quoteChar = str[pos];
+ ++pos;
+ }
+
+ string val;
+ while(pos < str.size())
+ {
+ if((!handleQuotes || !quoteChar) && delim.find(str[pos]) != string::npos)
+ {
+ break;
+ }
+ if(handleQuotes)
+ {
+ if(str[pos] == '\\')
+ {
+ if(pos + 1 < str.size() && str[pos + 1] == quoteChar)
+ {
+ ++pos;
+ }
+ }
+ else if(str[pos] == quoteChar)
+ {
+ quoteChar = 0;
+ ++pos;
+ continue;
+ }
+ }
+ val.push_back(str[pos]);
+ ++pos;
+ }
+
+ if(!val.empty())
+ {
+ result.push_back(val);
+ }
+
+ pos = str.find_first_not_of(delim, pos);
}
if(quoteChar) // Mismatched quote.
{
- return false;
+ return false;
}
return true;
@@ -422,23 +422,23 @@ IceSSL::checkPath(string& path, const string& defaultDir, bool dir)
#endif
if(err == 0)
{
- return dir ? S_ISDIR(st.st_mode) != 0 : S_ISREG(st.st_mode) != 0;
+ return dir ? S_ISDIR(st.st_mode) != 0 : S_ISREG(st.st_mode) != 0;
}
if(!defaultDir.empty())
{
#ifdef _WIN32
- string s = defaultDir + "\\" + path;
- err = ::_stat(s.c_str(), &st);
+ string s = defaultDir + "\\" + path;
+ err = ::_stat(s.c_str(), &st);
#else
- string s = defaultDir + "/" + path;
- err = ::stat(s.c_str(), &st);
+ string s = defaultDir + "/" + path;
+ err = ::stat(s.c_str(), &st);
#endif
- if(err == 0 && ((!dir && S_ISREG(st.st_mode)) || (dir && S_ISDIR(st.st_mode))))
- {
- path = s;
- return true;
- }
+ if(err == 0 && ((!dir && S_ISREG(st.st_mode)) || (dir && S_ISDIR(st.st_mode))))
+ {
+ path = s;
+ return true;
+ }
}
return false;
@@ -465,23 +465,23 @@ IceSSL::populateConnectionInfo(SSL* ssl, SOCKET fd, const string& adapterName, b
STACK_OF(X509)* chain = SSL_get_peer_cert_chain(ssl);
if(cert != 0 && (chain == 0 || sk_X509_num(chain) == 0 || cert != sk_X509_value(chain, 0)))
{
- info.certs.push_back(new Certificate(cert));
+ info.certs.push_back(new Certificate(cert));
}
else
{
- X509_free(cert);
+ X509_free(cert);
}
if(chain != 0)
{
- for(int i = 0; i < sk_X509_num(chain); ++i)
- {
- X509* cert = sk_X509_value(chain, i);
- //
- // Duplicate the certificate since the stack comes straight from the SSL connection.
- //
- info.certs.push_back(new Certificate(X509_dup(cert)));
- }
+ for(int i = 0; i < sk_X509_num(chain); ++i)
+ {
+ X509* cert = sk_X509_value(chain, i);
+ //
+ // Duplicate the certificate since the stack comes straight from the SSL connection.
+ //
+ info.certs.push_back(new Certificate(X509_dup(cert)));
+ }
}
info.cipher = SSL_get_cipher_name(ssl); // Nothing needs to be free'd.
@@ -490,9 +490,9 @@ IceSSL::populateConnectionInfo(SSL* ssl, SOCKET fd, const string& adapterName, b
if(!IceInternal::fdToRemoteAddress(fd, info.remoteAddr))
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = IceInternal::getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = IceInternal::getSocketErrno();
+ throw ex;
}
return info;
@@ -511,41 +511,41 @@ IceSSL::getSslErrors(bool verbose)
int count = 0;
while((err = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0)
{
- if(count > 0)
- {
- ostr << endl;
- }
-
- if(verbose)
- {
- if(count > 0)
- {
- ostr << endl;
- }
-
- char buf[200];
- ERR_error_string_n(err, buf, sizeof(buf));
-
- ostr << "error # = " << err << endl;
- ostr << "message = " << buf << endl;
- ostr << "location = " << file << ", " << line;
- if(flags & ERR_TXT_STRING)
- {
- ostr << endl;
- ostr << "data = " << data;
- }
- }
- else
- {
- const char* reason = ERR_reason_error_string(err);
- ostr << (reason == NULL ? "unknown reason" : reason);
- if(flags & ERR_TXT_STRING)
- {
- ostr << ": " << data;
- }
- }
-
- ++count;
+ if(count > 0)
+ {
+ ostr << endl;
+ }
+
+ if(verbose)
+ {
+ if(count > 0)
+ {
+ ostr << endl;
+ }
+
+ char buf[200];
+ ERR_error_string_n(err, buf, sizeof(buf));
+
+ ostr << "error # = " << err << endl;
+ ostr << "message = " << buf << endl;
+ ostr << "location = " << file << ", " << line;
+ if(flags & ERR_TXT_STRING)
+ {
+ ostr << endl;
+ ostr << "data = " << data;
+ }
+ }
+ else
+ {
+ const char* reason = ERR_reason_error_string(err);
+ ostr << (reason == NULL ? "unknown reason" : reason);
+ if(flags & ERR_TXT_STRING)
+ {
+ ostr << ": " << data;
+ }
+ }
+
+ ++count;
}
ERR_clear_error();
diff --git a/cpp/src/IceStorm/Admin.cpp b/cpp/src/IceStorm/Admin.cpp
index bd175b818d3..62ab8958c0a 100644
--- a/cpp/src/IceStorm/Admin.cpp
+++ b/cpp/src/IceStorm/Admin.cpp
@@ -39,17 +39,17 @@ void
Client::usage()
{
cerr << "Usage: " << appName() << " [options] [file...]\n";
- cerr <<
- "Options:\n"
- "-h, --help Show this message.\n"
- "-v, --version Display the Ice version.\n"
- "-DNAME Define NAME as 1.\n"
- "-DNAME=DEF Define NAME as DEF.\n"
- "-UNAME Remove any definition for NAME.\n"
- "-IDIR Put DIR in the include file search path.\n"
- "-e COMMANDS Execute COMMANDS.\n"
- "-d, --debug Print debug messages.\n"
- ;
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-DNAME Define NAME as 1.\n"
+ "-DNAME=DEF Define NAME as DEF.\n"
+ "-UNAME Remove any definition for NAME.\n"
+ "-IDIR Put DIR in the include file search path.\n"
+ "-e COMMANDS Execute COMMANDS.\n"
+ "-d, --debug Print debug messages.\n"
+ ;
}
int
@@ -71,64 +71,64 @@ Client::run(int argc, char* argv[])
vector<string> args;
try
{
- args = opts.parse(argc, (const char**)argv);
+ args = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
cerr << e.reason << endl;
- usage();
- return EXIT_FAILURE;
+ usage();
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage();
- return EXIT_SUCCESS;
+ usage();
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
if(opts.isSet("D"))
{
- vector<string> optargs = opts.argVec("D");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -D" + *i;
- }
+ vector<string> optargs = opts.argVec("D");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cpp += " -D" + *i;
+ }
}
if(opts.isSet("U"))
{
- vector<string> optargs = opts.argVec("U");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -U" + *i;
- }
+ vector<string> optargs = opts.argVec("U");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cpp += " -U" + *i;
+ }
}
if(opts.isSet("I"))
{
- vector<string> optargs = opts.argVec("I");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- cpp += " -I" + *i;
- }
+ vector<string> optargs = opts.argVec("I");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ cpp += " -I" + *i;
+ }
}
if(opts.isSet("e"))
{
- vector<string> optargs = opts.argVec("e");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- commands += *i + ";";
- }
+ vector<string> optargs = opts.argVec("e");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ commands += *i + ";";
+ }
}
debug = opts.isSet("debug");
if(!args.empty() && !commands.empty())
{
- cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
- usage();
- return EXIT_FAILURE;
+ cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
+ usage();
+ return EXIT_FAILURE;
}
// The complete set of Ice::Identity -> manager proxies.
@@ -141,14 +141,14 @@ Client::run(int argc, char* argv[])
IceStorm::TopicManagerPrx defaultManager;
if(!managerProxy.empty())
{
- defaultManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->stringToProxy(managerProxy));
- if(!defaultManager)
- {
- cerr << appName() << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
- }
- managers.insert(map<Ice::Identity, IceStorm::TopicManagerPrx>::value_type(
- defaultManager->ice_getIdentity(), defaultManager));
+ defaultManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->stringToProxy(managerProxy));
+ if(!defaultManager)
+ {
+ cerr << appName() << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
+ }
+ managers.insert(map<Ice::Identity, IceStorm::TopicManagerPrx>::value_type(
+ defaultManager->ice_getIdentity(), defaultManager));
}
//
@@ -156,134 +156,134 @@ Client::run(int argc, char* argv[])
//
Ice::PropertyDict props = communicator()->getProperties()->getPropertiesForPrefix("IceStormAdmin.TopicManager.");
{
- for(Ice::PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p)
- {
- try
- {
- IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::uncheckedCast(
- communicator()->stringToProxy(p->second));
- managers.insert(map<Ice::Identity, IceStorm::TopicManagerPrx>::value_type(
- manager->ice_getIdentity(), manager));
- }
- catch(const Ice::ProxyParseException&)
- {
- cerr << appName() << ": malformed proxy: " << p->second << endl;
- return EXIT_FAILURE;
- }
- }
- if(props.empty() && !defaultManager)
- {
- cerr << appName() << ": no manager proxies configured" << endl;
- return EXIT_FAILURE;
- }
+ for(Ice::PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p)
+ {
+ try
+ {
+ IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::uncheckedCast(
+ communicator()->stringToProxy(p->second));
+ managers.insert(map<Ice::Identity, IceStorm::TopicManagerPrx>::value_type(
+ manager->ice_getIdentity(), manager));
+ }
+ catch(const Ice::ProxyParseException&)
+ {
+ cerr << appName() << ": malformed proxy: " << p->second << endl;
+ return EXIT_FAILURE;
+ }
+ }
+ if(props.empty() && !defaultManager)
+ {
+ cerr << appName() << ": no manager proxies configured" << endl;
+ return EXIT_FAILURE;
+ }
- if(!defaultManager)
- {
- string managerProxy = properties->getProperty("IceStormAdmin.TopicManager.Default");
- if(!managerProxy.empty())
- {
- defaultManager = IceStorm::TopicManagerPrx::uncheckedCast(
- communicator()->stringToProxy(managerProxy));
- }
- else
- {
- defaultManager = managers.begin()->second;
- }
- }
+ if(!defaultManager)
+ {
+ string managerProxy = properties->getProperty("IceStormAdmin.TopicManager.Default");
+ if(!managerProxy.empty())
+ {
+ defaultManager = IceStorm::TopicManagerPrx::uncheckedCast(
+ communicator()->stringToProxy(managerProxy));
+ }
+ else
+ {
+ defaultManager = managers.begin()->second;
+ }
+ }
}
// Check slice checksums for each manager.
{
- for(map<Ice::Identity, IceStorm::TopicManagerPrx>::const_iterator p = managers.begin(); p != managers.end();
- ++p)
- {
- try
- {
- Ice::SliceChecksumDict serverChecksums = p->second->getSliceChecksums();
- Ice::SliceChecksumDict localChecksums = Ice::sliceChecksums();
- for(Ice::SliceChecksumDict::const_iterator q = localChecksums.begin(); q != localChecksums.end(); ++q)
- {
- Ice::SliceChecksumDict::const_iterator r = serverChecksums.find(q->first);
- if(r == serverChecksums.end())
- {
- cerr << appName() << ": " << communicator()->identityToString(p->first)
- << " is using unknown Slice type `" << q->first << "'" << endl;
- }
- else if(q->second != r->second)
- {
- cerr << appName() << ": " << communicator()->identityToString(p->first)
- << " is using a different Slice definition of `" << q->first << "'" << endl;
- }
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << communicator()->identityToString(p->first) << ": " << ex << endl;
- }
- }
+ for(map<Ice::Identity, IceStorm::TopicManagerPrx>::const_iterator p = managers.begin(); p != managers.end();
+ ++p)
+ {
+ try
+ {
+ Ice::SliceChecksumDict serverChecksums = p->second->getSliceChecksums();
+ Ice::SliceChecksumDict localChecksums = Ice::sliceChecksums();
+ for(Ice::SliceChecksumDict::const_iterator q = localChecksums.begin(); q != localChecksums.end(); ++q)
+ {
+ Ice::SliceChecksumDict::const_iterator r = serverChecksums.find(q->first);
+ if(r == serverChecksums.end())
+ {
+ cerr << appName() << ": " << communicator()->identityToString(p->first)
+ << " is using unknown Slice type `" << q->first << "'" << endl;
+ }
+ else if(q->second != r->second)
+ {
+ cerr << appName() << ": " << communicator()->identityToString(p->first)
+ << " is using a different Slice definition of `" << q->first << "'" << endl;
+ }
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << communicator()->identityToString(p->first) << ": " << ex << endl;
+ }
+ }
}
-
+
ParserPtr p = Parser::createParser(communicator(), defaultManager, managers);
int status = EXIT_SUCCESS;
if(args.empty()) // No files given
{
- if(!commands.empty()) // Commands were given
- {
- int parseStatus = p->parse(commands, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
- else // No commands, let's use standard input
- {
- p->showBanner();
+ if(!commands.empty()) // Commands were given
+ {
+ int parseStatus = p->parse(commands, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ else // No commands, let's use standard input
+ {
+ p->showBanner();
- int parseStatus = p->parse(stdin, debug);
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
+ int parseStatus = p->parse(stdin, debug);
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
}
else // Process files given on the command line
{
- for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
- {
- ifstream test(i->c_str());
- if(!test)
- {
- cerr << appName() << ": can't open `" << *i << "' for reading: " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
- test.close();
-
- string cmd = cpp + " " + *i;
+ for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
+ {
+ ifstream test(i->c_str());
+ if(!test)
+ {
+ cerr << appName() << ": can't open `" << *i << "' for reading: " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+ test.close();
+
+ string cmd = cpp + " " + *i;
#ifdef _WIN32
- FILE* cppHandle = _popen(cmd.c_str(), "r");
+ FILE* cppHandle = _popen(cmd.c_str(), "r");
#else
- FILE* cppHandle = popen(cmd.c_str(), "r");
+ FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if(cppHandle == NULL)
- {
- cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
- return EXIT_FAILURE;
- }
-
- int parseStatus = p->parse(cppHandle, debug);
-
+ if(cppHandle == NULL)
+ {
+ cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+
+ int parseStatus = p->parse(cppHandle, debug);
+
#ifdef _WIN32
- _pclose(cppHandle);
+ _pclose(cppHandle);
#else
- pclose(cppHandle);
+ pclose(cppHandle);
#endif
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- }
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
}
return status;
diff --git a/cpp/src/IceStorm/BatchFlusher.cpp b/cpp/src/IceStorm/BatchFlusher.cpp
index 699a145db87..d38c93ea649 100644
--- a/cpp/src/IceStorm/BatchFlusher.cpp
+++ b/cpp/src/IceStorm/BatchFlusher.cpp
@@ -24,8 +24,8 @@ using namespace std;
BatchFlusher::BatchFlusher(const InstancePtr& instance) :
_traceLevels(instance->traceLevels()),
_flushTime(IceUtil::Time::milliSeconds(
- max(instance->properties()->getPropertyAsIntWithDefault(
- "IceStorm.Flush.Timeout", 1000), 100))), // Minimum of 100ms.
+ max(instance->properties()->getPropertyAsIntWithDefault(
+ "IceStorm.Flush.Timeout", 1000), 100))), // Minimum of 100ms.
_destroy(false)
{
start();
@@ -45,7 +45,7 @@ BatchFlusher::add(const Ice::ObjectPrx& subscriber)
//
if(_subscribers.empty())
{
- notify();
+ notify();
}
_subscribers.push_back(subscriber);
}
@@ -70,58 +70,58 @@ BatchFlusher::run()
{
for(;;)
{
- list<Ice::ObjectPrx> subscribers;
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(_destroy)
- {
- return;
- }
- if(_subscribers.empty())
- {
- wait();
- }
- else
- {
- timedWait(_flushTime);
- }
- if(_destroy)
- {
- return;
- }
- subscribers = _subscribers;
- }
+ list<Ice::ObjectPrx> subscribers;
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(_destroy)
+ {
+ return;
+ }
+ if(_subscribers.empty())
+ {
+ wait();
+ }
+ else
+ {
+ timedWait(_flushTime);
+ }
+ if(_destroy)
+ {
+ return;
+ }
+ subscribers = _subscribers;
+ }
- set<Ice::ConnectionPtr> flushSet;
- for(list<Ice::ObjectPrx>::const_iterator p = subscribers.begin(); p != subscribers.end(); ++p)
- {
- Ice::ConnectionPtr connection = (*p)->ice_getCachedConnection();
- if(connection)
- {
- flushSet.insert(connection);
- }
- }
-
- for(set<Ice::ConnectionPtr>::const_iterator q = flushSet.begin(); q != flushSet.end(); ++q)
- {
- try
- {
- (*q)->flushBatchRequests();
- }
- catch(const Ice::LocalException&)
- {
- // Ignore.
- }
- }
-
- //
- // Trace after the flush so that the correct number of objects
- // are displayed
- //
- if(_traceLevels->flush > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->flushCat);
- out << "connections: " << flushSet.size() << " subscribers: " << subscribers.size();
- }
+ set<Ice::ConnectionPtr> flushSet;
+ for(list<Ice::ObjectPrx>::const_iterator p = subscribers.begin(); p != subscribers.end(); ++p)
+ {
+ Ice::ConnectionPtr connection = (*p)->ice_getCachedConnection();
+ if(connection)
+ {
+ flushSet.insert(connection);
+ }
+ }
+
+ for(set<Ice::ConnectionPtr>::const_iterator q = flushSet.begin(); q != flushSet.end(); ++q)
+ {
+ try
+ {
+ (*q)->flushBatchRequests();
+ }
+ catch(const Ice::LocalException&)
+ {
+ // Ignore.
+ }
+ }
+
+ //
+ // Trace after the flush so that the correct number of objects
+ // are displayed
+ //
+ if(_traceLevels->flush > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->flushCat);
+ out << "connections: " << flushSet.size() << " subscribers: " << subscribers.size();
+ }
}
}
diff --git a/cpp/src/IceStorm/Instance.cpp b/cpp/src/IceStorm/Instance.cpp
index a5bcb3628d6..dac531d34f0 100644
--- a/cpp/src/IceStorm/Instance.cpp
+++ b/cpp/src/IceStorm/Instance.cpp
@@ -28,23 +28,23 @@ Instance::Instance(
_adapter(adapter),
_traceLevels(new TraceLevels(name, communicator->getProperties(), communicator->getLogger())),
_discardInterval(IceUtil::Time::seconds(communicator->getProperties()->getPropertyAsIntWithDefault(
- "IceStorm.Discard.Interval", 60))), // default one minute.
+ "IceStorm.Discard.Interval", 60))), // default one minute.
// default one minute.
_sendTimeout(communicator->getProperties()->getPropertyAsIntWithDefault("IceStorm.Send.Timeout", 60 * 1000))
{
try
{
- __setNoDelete(true);
+ __setNoDelete(true);
- _batchFlusher = new BatchFlusher(this);
- _subscriberPool = new SubscriberPool(this);
+ _batchFlusher = new BatchFlusher(this);
+ _subscriberPool = new SubscriberPool(this);
}
catch(...)
{
- shutdown();
- __setNoDelete(false);
+ shutdown();
+ __setNoDelete(false);
- throw;
+ throw;
}
__setNoDelete(false);
}
@@ -112,12 +112,12 @@ Instance::shutdown()
{
if(_batchFlusher)
{
- _batchFlusher->destroy();
- _batchFlusher->getThreadControl().join();
+ _batchFlusher->destroy();
+ _batchFlusher->getThreadControl().join();
}
if(_subscriberPool)
{
- _subscriberPool->destroy();
+ _subscriberPool->destroy();
}
}
diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp
index aed113d2aec..3933ce6bd5a 100644
--- a/cpp/src/IceStorm/Parser.cpp
+++ b/cpp/src/IceStorm/Parser.cpp
@@ -39,8 +39,8 @@ class UnknownManagerException : public Exception
public:
UnknownManagerException(const string& name, const char* file, int line) :
- Exception(file, line),
- name(name)
+ Exception(file, line),
+ name(name)
{
}
@@ -51,18 +51,18 @@ public:
virtual string
ice_name() const
{
- return "UnknownManagerException";
+ return "UnknownManagerException";
}
virtual Exception*
ice_clone() const
{
- return new UnknownManagerException(*this);
+ return new UnknownManagerException(*this);
}
virtual void
ice_throw() const
{
- throw *this;
+ throw *this;
}
const string name;
};
@@ -71,7 +71,7 @@ public:
ParserPtr
Parser::createParser(const CommunicatorPtr& communicator, const TopicManagerPrx& admin,
- const map<Ice::Identity, IceStorm::TopicManagerPrx>& managers)
+ const map<Ice::Identity, IceStorm::TopicManagerPrx>& managers)
{
return new Parser(communicator, admin, managers);
}
@@ -102,18 +102,18 @@ Parser::create(const list<string>& args)
try
{
- for(list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
- {
- string arg;
- IceStorm::TopicManagerPrx manager = findManagerById(*i, arg);
- manager->create(arg);
- }
+ for(list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
+ {
+ string arg;
+ IceStorm::TopicManagerPrx manager = findManagerById(*i, arg);
+ manager->create(arg);
+ }
}
catch(const Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -122,19 +122,19 @@ Parser::destroy(const list<string>& args)
{
try
{
- for(list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
- {
- string arg;
- IceStorm::TopicManagerPrx manager = findManagerById(*i, arg);
- TopicPrx topic = manager->retrieve(arg);
- topic->destroy();
- }
+ for(list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
+ {
+ string arg;
+ IceStorm::TopicManagerPrx manager = findManagerById(*i, arg);
+ TopicPrx topic = manager->retrieve(arg);
+ topic->destroy();
+ }
}
catch(const Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -145,56 +145,56 @@ Parser::link(const list<string>& _args)
if(args.size() < 2)
{
- error("`link' requires at least two arguments (type `help' for more info)");
- return;
+ error("`link' requires at least two arguments (type `help' for more info)");
+ return;
}
try
{
- TopicPrx fromTopic;
- TopicPrx toTopic;
-
- try
- {
- string arg;
- IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
- fromTopic = manager->retrieve(arg);
- }
- catch(const IceStorm::NoSuchTopic&)
- {
- ostringstream s;
- s << args.front() << ": topic doesn't exist";
- error(s.str());
- return;
- }
- args.pop_front();
-
- try
- {
- string arg;
- IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
- toTopic = manager->retrieve(arg);
- }
- catch(const IceStorm::NoSuchTopic&)
- {
- ostringstream s;
- s << args.front() << ": topic doesn't exist";
- error(s.str());
- return;
- }
- args.pop_front();
- Ice::Int cost = 0;
- if(!args.empty())
- {
- cost = atoi(args.front().c_str());
- }
- fromTopic->link(toTopic, cost);
+ TopicPrx fromTopic;
+ TopicPrx toTopic;
+
+ try
+ {
+ string arg;
+ IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
+ fromTopic = manager->retrieve(arg);
+ }
+ catch(const IceStorm::NoSuchTopic&)
+ {
+ ostringstream s;
+ s << args.front() << ": topic doesn't exist";
+ error(s.str());
+ return;
+ }
+ args.pop_front();
+
+ try
+ {
+ string arg;
+ IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
+ toTopic = manager->retrieve(arg);
+ }
+ catch(const IceStorm::NoSuchTopic&)
+ {
+ ostringstream s;
+ s << args.front() << ": topic doesn't exist";
+ error(s.str());
+ return;
+ }
+ args.pop_front();
+ Ice::Int cost = 0;
+ if(!args.empty())
+ {
+ cost = atoi(args.front().c_str());
+ }
+ fromTopic->link(toTopic, cost);
}
catch(const Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -205,51 +205,51 @@ Parser::unlink(const list<string>& _args)
if(args.size() != 2)
{
- error("`unlink' requires exactly two arguments (type `help' for more info)");
- return;
+ error("`unlink' requires exactly two arguments (type `help' for more info)");
+ return;
}
try
{
- TopicPrx fromTopic;
- TopicPrx toTopic;
-
- try
- {
- string arg;
- IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
- fromTopic = manager->retrieve(arg);
- }
- catch(const IceStorm::NoSuchTopic&)
- {
- ostringstream s;
- s << args.front() << ": topic doesn't exist";
- error(s.str());
- return;
- }
- args.pop_front();
-
- try
- {
- string arg;
- IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
- toTopic = manager->retrieve(arg);
- }
- catch(const IceStorm::NoSuchTopic&)
- {
- ostringstream s;
- s << args.front() << ": topic doesn't exist";
- error(s.str());
- return;
- }
-
- fromTopic->unlink(toTopic);
+ TopicPrx fromTopic;
+ TopicPrx toTopic;
+
+ try
+ {
+ string arg;
+ IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
+ fromTopic = manager->retrieve(arg);
+ }
+ catch(const IceStorm::NoSuchTopic&)
+ {
+ ostringstream s;
+ s << args.front() << ": topic doesn't exist";
+ error(s.str());
+ return;
+ }
+ args.pop_front();
+
+ try
+ {
+ string arg;
+ IceStorm::TopicManagerPrx manager = findManagerById(args.front(), arg);
+ toTopic = manager->retrieve(arg);
+ }
+ catch(const IceStorm::NoSuchTopic&)
+ {
+ ostringstream s;
+ s << args.front() << ": topic doesn't exist";
+ error(s.str());
+ return;
+ }
+
+ fromTopic->unlink(toTopic);
}
catch(const Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -260,22 +260,22 @@ Parser::current(const list<string>& _args)
if(args.size() == 0)
{
- cout << _communicator->identityToString(_defaultManager->ice_getIdentity()) << endl;
- return;
+ cout << _communicator->identityToString(_defaultManager->ice_getIdentity()) << endl;
+ return;
}
try
{
- IceStorm::TopicManagerPrx manager = findManagerByCategory(args.front());
- manager->ice_ping();
- _defaultManager = manager;
+ IceStorm::TopicManagerPrx manager = findManagerByCategory(args.front());
+ manager->ice_ping();
+ _defaultManager = manager;
}
catch(const Exception& ex)
{
- ostringstream s;
- s << args.front() << ": " << ex;
- error(s.str());
- return;
+ ostringstream s;
+ s << args.front() << ": " << ex;
+ error(s.str());
+ return;
}
}
@@ -286,60 +286,60 @@ Parser::dolist(const list<string>& _args)
try
{
- if(args.size() <= 1)
- {
- IceStorm::TopicManagerPrx manager;
- if(args.size() == 1)
- {
- manager = findManagerByCategory(args.front());
- }
- else
- {
- manager = _defaultManager;
- }
- TopicDict d = manager->retrieveAll();
- if(!d.empty())
- {
- for(TopicDict::iterator i = d.begin(); i != d.end(); ++i)
- {
- if(i != d.begin())
- {
- cout << ", ";
- }
- cout << i->first;
- }
- cout << endl;
- }
- }
- else
- {
- IceStorm::TopicManagerPrx manager = findManagerByCategory(args.front());
- args.pop_front();
- while(!args.empty())
- {
- try
- {
- string arg = args.front();
- args.pop_front();
- TopicPrx topic = manager->retrieve(arg);
- LinkInfoSeq links = topic->getLinkInfoSeq();
- for(LinkInfoSeq::const_iterator p = links.begin(); p != links.end(); ++p)
- {
- cout << "\t" << (*p).name << " with cost " << (*p).cost << endl;
- }
- }
- catch(const NoSuchTopic&)
- {
- cout << "\tNo such topic" << endl;
- }
- }
- }
+ if(args.size() <= 1)
+ {
+ IceStorm::TopicManagerPrx manager;
+ if(args.size() == 1)
+ {
+ manager = findManagerByCategory(args.front());
+ }
+ else
+ {
+ manager = _defaultManager;
+ }
+ TopicDict d = manager->retrieveAll();
+ if(!d.empty())
+ {
+ for(TopicDict::iterator i = d.begin(); i != d.end(); ++i)
+ {
+ if(i != d.begin())
+ {
+ cout << ", ";
+ }
+ cout << i->first;
+ }
+ cout << endl;
+ }
+ }
+ else
+ {
+ IceStorm::TopicManagerPrx manager = findManagerByCategory(args.front());
+ args.pop_front();
+ while(!args.empty())
+ {
+ try
+ {
+ string arg = args.front();
+ args.pop_front();
+ TopicPrx topic = manager->retrieve(arg);
+ LinkInfoSeq links = topic->getLinkInfoSeq();
+ for(LinkInfoSeq::const_iterator p = links.begin(); p != links.end(); ++p)
+ {
+ cout << "\t" << (*p).name << " with cost " << (*p).cost << endl;
+ }
+ }
+ catch(const NoSuchTopic&)
+ {
+ cout << "\tNo such topic" << endl;
+ }
+ }
+ }
}
catch(const Exception& ex)
{
- ostringstream s;
- s << ex;
- error(s.str());
+ ostringstream s;
+ s << ex;
+ error(s.str());
}
}
@@ -366,105 +366,105 @@ Parser::getInput(char* buf, int& result, int maxSize)
{
if(!_commands.empty())
{
- if(_commands == ";")
- {
- result = 0;
- }
- else
- {
+ if(_commands == ";")
+ {
+ result = 0;
+ }
+ else
+ {
#if defined(_MSC_VER) && !defined(_STLP_MSVC)
- // COMPILERBUG: Stupid Visual C++ defines min and max as macros
- result = _MIN(maxSize, static_cast<int>(_commands.length()));
+ // COMPILERBUG: Stupid Visual C++ defines min and max as macros
+ result = _MIN(maxSize, static_cast<int>(_commands.length()));
#else
- result = min(maxSize, static_cast<int>(_commands.length()));
+ result = min(maxSize, static_cast<int>(_commands.length()));
#endif
- strncpy(buf, _commands.c_str(), result);
- _commands.erase(0, result);
- if(_commands.empty())
- {
- _commands = ";";
- }
- }
+ strncpy(buf, _commands.c_str(), result);
+ _commands.erase(0, result);
+ if(_commands.empty())
+ {
+ _commands = ";";
+ }
+ }
}
else if(isatty(fileno(yyin)))
{
#ifdef HAVE_READLINE
const char* prompt = parser->getPrompt();
- char* line = readline(const_cast<char*>(prompt));
- if(!line)
- {
- result = 0;
- }
- else
- {
- if(*line)
- {
- add_history(line);
- }
-
- result = strlen(line) + 1;
- if(result > maxSize)
- {
- free(line);
- error("input line too long");
- result = 0;
- }
- else
- {
- strcpy(buf, line);
- strcat(buf, "\n");
- free(line);
- }
- }
+ char* line = readline(const_cast<char*>(prompt));
+ if(!line)
+ {
+ result = 0;
+ }
+ else
+ {
+ if(*line)
+ {
+ add_history(line);
+ }
+
+ result = strlen(line) + 1;
+ if(result > maxSize)
+ {
+ free(line);
+ error("input line too long");
+ result = 0;
+ }
+ else
+ {
+ strcpy(buf, line);
+ strcat(buf, "\n");
+ free(line);
+ }
+ }
#else
- cout << parser->getPrompt() << flush;
-
- string line;
- while(true)
- {
- char c = static_cast<char>(getc(yyin));
- if(c == EOF)
- {
- if(line.size())
- {
- line += '\n';
- }
- break;
- }
-
- line += c;
-
- if(c == '\n')
- {
- break;
- }
- }
-
- result = (int) line.length();
- if(result > maxSize)
- {
- error("input line too long");
- buf[0] = EOF;
- result = 1;
- }
- else
- {
- strcpy(buf, line.c_str());
- }
+ cout << parser->getPrompt() << flush;
+
+ string line;
+ while(true)
+ {
+ char c = static_cast<char>(getc(yyin));
+ if(c == EOF)
+ {
+ if(line.size())
+ {
+ line += '\n';
+ }
+ break;
+ }
+
+ line += c;
+
+ if(c == '\n')
+ {
+ break;
+ }
+ }
+
+ result = (int) line.length();
+ if(result > maxSize)
+ {
+ error("input line too long");
+ buf[0] = EOF;
+ result = 1;
+ }
+ else
+ {
+ strcpy(buf, line.c_str());
+ }
#endif
}
else
{
- if(((result = (int) fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
- {
- error("input in flex scanner failed");
- buf[0] = EOF;
- result = 1;
- }
+ if(((result = (int) fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ {
+ error("input in flex scanner failed");
+ buf[0] = EOF;
+ result = 1;
+ }
}
}
@@ -487,12 +487,12 @@ Parser::getPrompt()
if(_continue)
{
- _continue = false;
- return "(cont) ";
+ _continue = false;
+ return "(cont) ";
}
else
{
- return ">>> ";
+ return ">>> ";
}
}
@@ -505,13 +505,13 @@ Parser::scanPosition(const char* s)
idx = line.find("line");
if(idx != string::npos)
{
- line.erase(0, idx + 4);
+ line.erase(0, idx + 4);
}
idx = line.find_first_not_of(" \t\r#");
if(idx != string::npos)
{
- line.erase(0, idx);
+ line.erase(0, idx);
}
_currentLine = atoi(line.c_str()) - 1;
@@ -519,24 +519,24 @@ Parser::scanPosition(const char* s)
idx = line.find_first_of(" \t\r");
if(idx != string::npos)
{
- line.erase(0, idx);
+ line.erase(0, idx);
}
idx = line.find_first_not_of(" \t\r\"");
if(idx != string::npos)
{
- line.erase(0, idx);
+ line.erase(0, idx);
- idx = line.find_first_of(" \t\r\"");
- if(idx != string::npos)
- {
- _currentFile = line.substr(0, idx);
- line.erase(0, idx + 1);
- }
- else
- {
- _currentFile = line;
- }
+ idx = line.find_first_of(" \t\r\"");
+ if(idx != string::npos)
+ {
+ _currentFile = line.substr(0, idx);
+ line.erase(0, idx + 1);
+ }
+ else
+ {
+ _currentFile = line;
+ }
}
}
@@ -545,11 +545,11 @@ Parser::error(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
}
else
{
- cerr << "error: " << s << endl;
+ cerr << "error: " << s << endl;
}
_errors++;
}
@@ -565,11 +565,11 @@ Parser::warning(const char* s)
{
if(_commands.empty() && !isatty(fileno(yyin)))
{
- cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
+ cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
}
else
{
- cerr << "warning: " << s << endl;
+ cerr << "warning: " << s << endl;
}
}
@@ -600,7 +600,7 @@ Parser::parse(FILE* file, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
@@ -628,7 +628,7 @@ Parser::parse(const std::string& commands, bool debug)
int status = yyparse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
parser = 0;
@@ -642,13 +642,13 @@ Parser::findManagerById(const string& full, string& arg) const
arg = id.name;
if(id.category.empty())
{
- return _defaultManager;
+ return _defaultManager;
}
id.name = "TopicManager";
map<Ice::Identity, IceStorm::TopicManagerPrx>::const_iterator p = _managers.find(id);
if(p == _managers.end())
{
- throw UnknownManagerException(id.category, __FILE__, __LINE__);
+ throw UnknownManagerException(id.category, __FILE__, __LINE__);
}
return p->second;
}
@@ -662,13 +662,13 @@ Parser::findManagerByCategory(const string& full) const
map<Ice::Identity, IceStorm::TopicManagerPrx>::const_iterator p = _managers.find(id);
if(p == _managers.end())
{
- throw UnknownManagerException(id.category, __FILE__, __LINE__);
+ throw UnknownManagerException(id.category, __FILE__, __LINE__);
}
return p->second;
}
Parser::Parser(const CommunicatorPtr& communicator, const TopicManagerPrx& admin,
- const map<Ice::Identity, IceStorm::TopicManagerPrx>& managers) :
+ const map<Ice::Identity, IceStorm::TopicManagerPrx>& managers) :
_communicator(communicator),
_defaultManager(admin),
_managers(managers)
diff --git a/cpp/src/IceStorm/Parser.h b/cpp/src/IceStorm/Parser.h
index be753288518..df8d77c0ea4 100644
--- a/cpp/src/IceStorm/Parser.h
+++ b/cpp/src/IceStorm/Parser.h
@@ -64,7 +64,7 @@ class Parser : public ::IceUtil::SimpleShared
public:
static ParserPtr createParser(const Ice::CommunicatorPtr&, const IceStorm::TopicManagerPrx&,
- const std::map<Ice::Identity, IceStorm::TopicManagerPrx>&);
+ const std::map<Ice::Identity, IceStorm::TopicManagerPrx>&);
void usage();
@@ -100,7 +100,7 @@ private:
IceStorm::TopicManagerPrx findManagerByCategory(const std::string&) const;
Parser(const Ice::CommunicatorPtr&, const IceStorm::TopicManagerPrx&,
- const std::map<Ice::Identity, IceStorm::TopicManagerPrx>&);
+ const std::map<Ice::Identity, IceStorm::TopicManagerPrx>&);
const Ice::CommunicatorPtr _communicator;
IceStorm::TopicManagerPrx _defaultManager;
diff --git a/cpp/src/IceStorm/Service.cpp b/cpp/src/IceStorm/Service.cpp
index be83f1c46a2..bf5b93951c6 100644
--- a/cpp/src/IceStorm/Service.cpp
+++ b/cpp/src/IceStorm/Service.cpp
@@ -32,15 +32,15 @@ public:
virtual ~ServiceI();
virtual void start(const string&,
- const CommunicatorPtr&,
- const StringSeq&);
+ const CommunicatorPtr&,
+ const StringSeq&);
virtual void start(const CommunicatorPtr&,
- const ObjectAdapterPtr&,
- const ObjectAdapterPtr&,
- const string&,
- const Ice::Identity&,
- const string&);
+ const ObjectAdapterPtr&,
+ const ObjectAdapterPtr&,
+ const string&,
+ const Ice::Identity&,
+ const string&);
virtual TopicManagerPrx getTopicManager() const;
@@ -70,11 +70,11 @@ createIceStorm(CommunicatorPtr communicator)
ServicePtr
IceStorm::Service::create(const CommunicatorPtr& communicator,
- const ObjectAdapterPtr& topicAdapter,
- const ObjectAdapterPtr& publishAdapter,
- const string& name,
- const Ice::Identity& id,
- const string& dbEnv)
+ const ObjectAdapterPtr& topicAdapter,
+ const ObjectAdapterPtr& publishAdapter,
+ const string& name,
+ const Ice::Identity& id,
+ const string& dbEnv)
{
ServiceI* service = new ServiceI;
ServicePtr svc = service;
@@ -113,26 +113,26 @@ IceStorm::ServiceI::start(
try
{
- _manager = new TopicManagerI(_instance, _topicAdapter, name, "topics");
- _managerProxy = TopicManagerPrx::uncheckedCast(_topicAdapter->add(_manager, topicManagerId));
+ _manager = new TopicManagerI(_instance, _topicAdapter, name, "topics");
+ _managerProxy = TopicManagerPrx::uncheckedCast(_topicAdapter->add(_manager, topicManagerId));
}
catch(const Ice::Exception&)
{
- _instance = 0;
- throw;
+ _instance = 0;
+ throw;
}
-
+
_topicAdapter->activate();
_publishAdapter->activate();
}
void
IceStorm::ServiceI::start(const CommunicatorPtr& communicator,
- const ObjectAdapterPtr& topicAdapter,
- const ObjectAdapterPtr& publishAdapter,
- const string& name,
- const Ice::Identity& id,
- const string& dbEnv)
+ const ObjectAdapterPtr& topicAdapter,
+ const ObjectAdapterPtr& publishAdapter,
+ const string& name,
+ const Ice::Identity& id,
+ const string& dbEnv)
{
string instanceName = communicator->getProperties()->getPropertyWithDefault(name + ".InstanceName", "IceStorm");
_instance = new Instance(instanceName, name, communicator, publishAdapter);
@@ -142,13 +142,13 @@ IceStorm::ServiceI::start(const CommunicatorPtr& communicator,
//
try
{
- _manager = new TopicManagerI(_instance, topicAdapter, dbEnv, "topics");
- _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->add(_manager, id));
+ _manager = new TopicManagerI(_instance, topicAdapter, dbEnv, "topics");
+ _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->add(_manager, id));
}
catch(const Ice::Exception&)
{
- _instance = 0;
- throw;
+ _instance = 0;
+ throw;
}
}
@@ -163,20 +163,20 @@ IceStorm::ServiceI::stop()
{
if(_topicAdapter)
{
- _topicAdapter->deactivate();
+ _topicAdapter->deactivate();
}
if(_publishAdapter)
{
- _publishAdapter->deactivate();
+ _publishAdapter->deactivate();
}
if(_topicAdapter)
{
- _topicAdapter->waitForDeactivate();
+ _topicAdapter->waitForDeactivate();
}
if(_publishAdapter)
{
- _publishAdapter->waitForDeactivate();
+ _publishAdapter->waitForDeactivate();
}
//
diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp
index 9174eed5949..3162116566a 100644
--- a/cpp/src/IceStorm/Subscriber.cpp
+++ b/cpp/src/IceStorm/Subscriber.cpp
@@ -37,7 +37,7 @@ class PerSubscriberPublisherI : public Ice::BlobjectArray
public:
PerSubscriberPublisherI(const InstancePtr& instance) :
- _instance(instance)
+ _instance(instance)
{
}
@@ -48,36 +48,36 @@ public:
void
setSubscriber(const SubscriberPtr& subscriber)
{
- _subscriber = subscriber;
+ _subscriber = subscriber;
}
virtual bool
ice_invoke(const pair<const Ice::Byte*, const Ice::Byte*>& inParams,
- vector<Ice::Byte>&,
- const Ice::Current& current)
+ vector<Ice::Byte>&,
+ const Ice::Current& current)
{
- EventDataPtr event = new EventData(
- current.operation,
- current.mode,
- Ice::ByteSeq(),
- current.ctx);
+ EventDataPtr event = new EventData(
+ current.operation,
+ current.mode,
+ Ice::ByteSeq(),
+ current.ctx);
- //
- // COMPILERBUG: gcc 4.0.1 doesn't like this.
- //
- //event->data.swap(Ice::ByteSeq(inParams.first, inParams.second));
- Ice::ByteSeq data(inParams.first, inParams.second);
- event->data.swap(data);
+ //
+ // COMPILERBUG: gcc 4.0.1 doesn't like this.
+ //
+ //event->data.swap(Ice::ByteSeq(inParams.first, inParams.second));
+ Ice::ByteSeq data(inParams.first, inParams.second);
+ event->data.swap(data);
- EventDataSeq e;
- e.push_back(event);
- Subscriber::QueueState state = _subscriber->queue(false, e);
+ EventDataSeq e;
+ e.push_back(event);
+ Subscriber::QueueState state = _subscriber->queue(false, e);
- if(state == Subscriber::QueueStateFlush)
- {
- _instance->subscriberPool()->flush(_subscriber);
- }
- return true;
+ if(state == Subscriber::QueueStateFlush)
+ {
+ _instance->subscriberPool()->flush(_subscriber);
+ }
+ return true;
}
private:
@@ -188,7 +188,7 @@ SubscriberOneway::SubscriberOneway(
if(_batch)
{
- _instance->batchFlusher()->add(_obj);
+ _instance->batchFlusher()->add(_obj);
}
}
@@ -202,66 +202,66 @@ SubscriberOneway::flush()
//
if(_state == SubscriberStateError)
{
- return false;
+ return false;
}
assert(_state == SubscriberStateFlushPending);
assert(!_events.empty());
try
{
- //
- // Get the current set of events, but release the lock before
- // attempting to deliver the events. This allows other threads
- // to add events in case we block (such as during connection
- // establishment).
- //
- EventDataSeq v;
- v.swap(_events);
- sync.release();
-
- //
- // Deliver the events without holding the lock.
- //
- // If there are more than one event queued and we are not in
- // batch sending mode then send the events as a batch and then
- // flush immediately, otherwise send one at a time.
- //
- vector<Ice::Byte> dummy;
- if(v.size() > 1 && !_batch)
- {
- for(EventDataSeq::const_iterator p = v.begin(); p != v.end(); ++p)
- {
- _objBatch->ice_invoke((*p)->op, (*p)->mode, (*p)->data, dummy, (*p)->context);
- }
- Ice::ConnectionPtr conn = _objBatch->ice_getCachedConnection();
- assert(conn);
- conn->flushBatchRequests();
- }
- else
- {
- for(EventDataSeq::const_iterator p = v.begin(); p != v.end(); ++p)
- {
- _obj->ice_invoke((*p)->op, (*p)->mode, (*p)->data, dummy, (*p)->context);
- }
- }
-
- //
- // Reacquire the lock before we check the queue again.
- //
- sync.acquire();
+ //
+ // Get the current set of events, but release the lock before
+ // attempting to deliver the events. This allows other threads
+ // to add events in case we block (such as during connection
+ // establishment).
+ //
+ EventDataSeq v;
+ v.swap(_events);
+ sync.release();
+
+ //
+ // Deliver the events without holding the lock.
+ //
+ // If there are more than one event queued and we are not in
+ // batch sending mode then send the events as a batch and then
+ // flush immediately, otherwise send one at a time.
+ //
+ vector<Ice::Byte> dummy;
+ if(v.size() > 1 && !_batch)
+ {
+ for(EventDataSeq::const_iterator p = v.begin(); p != v.end(); ++p)
+ {
+ _objBatch->ice_invoke((*p)->op, (*p)->mode, (*p)->data, dummy, (*p)->context);
+ }
+ Ice::ConnectionPtr conn = _objBatch->ice_getCachedConnection();
+ assert(conn);
+ conn->flushBatchRequests();
+ }
+ else
+ {
+ for(EventDataSeq::const_iterator p = v.begin(); p != v.end(); ++p)
+ {
+ _obj->ice_invoke((*p)->op, (*p)->mode, (*p)->data, dummy, (*p)->context);
+ }
+ }
+
+ //
+ // Reacquire the lock before we check the queue again.
+ //
+ sync.acquire();
}
catch(const Ice::LocalException& ex)
{
- assert(!sync.acquired());
- // error will re-acquire and release the lock.
- error(ex);
- return false;
+ assert(!sync.acquired());
+ // error will re-acquire and release the lock.
+ error(ex);
+ return false;
}
if(!_events.empty())
{
- assert(_state == SubscriberStateFlushPending);
- return true;
+ assert(_state == SubscriberStateFlushPending);
+ return true;
}
_state = SubscriberStateOnline;
return false;
@@ -272,7 +272,7 @@ SubscriberOneway::destroy()
{
if(_batch)
{
- _instance->batchFlusher()->remove(_obj);
+ _instance->batchFlusher()->remove(_obj);
}
Subscriber::destroy();
}
@@ -285,7 +285,7 @@ class TwowayInvokeI : public Ice::AMI_Object_ice_invoke
public:
TwowayInvokeI(const SubscriberPtr& subscriber) :
- _subscriber(subscriber)
+ _subscriber(subscriber)
{
}
@@ -297,7 +297,7 @@ public:
virtual void
ice_exception(const Ice::Exception& e)
{
- _subscriber->error(e);
+ _subscriber->error(e);
}
private:
@@ -326,7 +326,7 @@ SubscriberTwoway::flush()
//
if(_state == SubscriberStateError)
{
- return false;
+ return false;
}
assert(_state == SubscriberStateFlushPending);
assert(!_events.empty());
@@ -346,7 +346,7 @@ SubscriberTwoway::flush()
//
for(EventDataSeq::const_iterator p = v.begin(); p != v.end(); ++p)
{
- _obj->ice_invoke_async(new TwowayInvokeI(this), (*p)->op, (*p)->mode, (*p)->data, (*p)->context);
+ _obj->ice_invoke_async(new TwowayInvokeI(this), (*p)->op, (*p)->mode, (*p)->data, (*p)->context);
}
//
@@ -360,8 +360,8 @@ SubscriberTwoway::flush()
//
if(!_events.empty())
{
- assert(_state == SubscriberStateFlushPending);
- return true;
+ assert(_state == SubscriberStateFlushPending);
+ return true;
}
_state = SubscriberStateOnline;
return false;
@@ -375,20 +375,20 @@ class TwowayOrderedInvokeI : public Ice::AMI_Object_ice_invoke
public:
TwowayOrderedInvokeI(const SubscriberTwowayOrderedPtr& subscriber) :
- _subscriber(subscriber)
+ _subscriber(subscriber)
{
}
virtual void
ice_response(bool, const std::vector<Ice::Byte>&)
{
- _subscriber->response();
+ _subscriber->response();
}
virtual void
ice_exception(const Ice::Exception& ex)
{
- _subscriber->error(ex);
+ _subscriber->error(ex);
}
private:
@@ -412,20 +412,20 @@ SubscriberTwowayOrdered::flush()
{
EventDataPtr e;
{
- IceUtil::Mutex::Lock sync(_mutex);
-
- //
- // If the subscriber errored out then we're done.
- //
- if(_state == SubscriberStateError)
- {
- return false;
- }
- assert(_state == SubscriberStateFlushPending);
- assert(!_events.empty());
-
- e = _events.front();
- _events.erase(_events.begin());
+ IceUtil::Mutex::Lock sync(_mutex);
+
+ //
+ // If the subscriber errored out then we're done.
+ //
+ if(_state == SubscriberStateError)
+ {
+ return false;
+ }
+ assert(_state == SubscriberStateFlushPending);
+ assert(!_events.empty());
+
+ e = _events.front();
+ _events.erase(_events.begin());
}
_obj->ice_invoke_async(new TwowayOrderedInvokeI(this), e->op, e->mode, e->data, e->context);
@@ -441,8 +441,8 @@ SubscriberTwowayOrdered::response()
assert(_state != SubscriberStateError);
if(_events.empty())
{
- _state = SubscriberStateOnline;
- return;
+ _state = SubscriberStateOnline;
+ return;
}
_instance->subscriberPool()->flush(this);
}
@@ -455,31 +455,31 @@ class Topiclink_forwardI : public IceStorm::AMI_TopicLink_forward
public:
Topiclink_forwardI(const SubscriberLinkPtr& subscriber) :
- _subscriber(subscriber)
+ _subscriber(subscriber)
{
}
virtual void
ice_response()
{
- _subscriber->response();
+ _subscriber->response();
}
virtual void
ice_exception(const Ice::Exception& ex)
{
- try
- {
- ex.ice_throw();
- }
- catch(const Ice::ObjectNotExistException& ex)
- {
- _subscriber->error(ex);
- }
- catch(const Ice::LocalException& ex)
- {
- _subscriber->offline(ex);
- }
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const Ice::ObjectNotExistException& ex)
+ {
+ _subscriber->error(ex);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ _subscriber->offline(ex);
+ }
}
private:
@@ -505,7 +505,7 @@ SubscriberLink::queue(bool forwarded, const EventDataSeq& events)
{
if(forwarded)
{
- return QueueStateNoFlush;
+ return QueueStateNoFlush;
}
//
@@ -518,7 +518,7 @@ SubscriberLink::queue(bool forwarded, const EventDataSeq& events)
if(_state == SubscriberStateError)
{
- return QueueStateError;
+ return QueueStateError;
}
//
@@ -527,53 +527,53 @@ SubscriberLink::queue(bool forwarded, const EventDataSeq& events)
//
if(_state == SubscriberStateOffline)
{
- //
- // If there are alot of subscribers offline then we will call
- // Time::now() alot, which could be costly. This could be
- // optimized to only one per event-batch by making the
- // forwarded argument an EventInfo thing where the queue-time
- // is lazy initialized.
- //
- if(IceUtil::Time::now() < _next)
- {
- return QueueStateNoFlush;
- }
-
- //
- // State transition to online.
- //
- _state = SubscriberStateOnline;
+ //
+ // If there are alot of subscribers offline then we will call
+ // Time::now() alot, which could be costly. This could be
+ // optimized to only one per event-batch by making the
+ // forwarded argument an EventInfo thing where the queue-time
+ // is lazy initialized.
+ //
+ if(IceUtil::Time::now() < _next)
+ {
+ return QueueStateNoFlush;
+ }
+
+ //
+ // State transition to online.
+ //
+ _state = SubscriberStateOnline;
}
int queued = 0;
for(EventDataSeq::const_iterator p = events.begin(); p != events.end(); ++p)
{
- if(_cost != 0)
- {
- //
- // Note that we could calculate this cost once and cache
- // it in a private form of the event to avoid this if this
- // really is a performance problem (this could use the
- // EventInfo thing discussed above).
- //
- int cost = 0;
- Ice::Context::const_iterator q = (*p)->context.find("cost");
- if(q != (*p)->context.end())
- {
- cost = atoi(q->second.c_str());
- }
- if(cost > _cost)
- {
- continue;
- }
- }
- ++queued;
- _events.push_back(*p);
+ if(_cost != 0)
+ {
+ //
+ // Note that we could calculate this cost once and cache
+ // it in a private form of the event to avoid this if this
+ // really is a performance problem (this could use the
+ // EventInfo thing discussed above).
+ //
+ int cost = 0;
+ Ice::Context::const_iterator q = (*p)->context.find("cost");
+ if(q != (*p)->context.end())
+ {
+ cost = atoi(q->second.c_str());
+ }
+ if(cost > _cost)
+ {
+ continue;
+ }
+ }
+ ++queued;
+ _events.push_back(*p);
}
if(_state == SubscriberStateFlushPending || queued == 0)
{
- return QueueStateNoFlush;
+ return QueueStateNoFlush;
}
_state = SubscriberStateFlushPending;
return QueueStateFlush;
@@ -584,20 +584,20 @@ SubscriberLink::flush()
{
EventDataSeq v;
{
- IceUtil::Mutex::Lock sync(_mutex);
-
- //
- // If the subscriber errored out then we're done.
- //
- if(_state == SubscriberStateError)
- {
- return false;
- }
+ IceUtil::Mutex::Lock sync(_mutex);
+
+ //
+ // If the subscriber errored out then we're done.
+ //
+ if(_state == SubscriberStateError)
+ {
+ return false;
+ }
- assert(_state == SubscriberStateFlushPending);
- assert(!_events.empty());
-
- v.swap(_events);
+ assert(_state == SubscriberStateFlushPending);
+ assert(!_events.empty());
+
+ v.swap(_events);
}
_obj->forward_async(new Topiclink_forwardI(this), v);
@@ -622,8 +622,8 @@ SubscriberLink::response()
//
if(_events.empty())
{
- _state = SubscriberStateOnline;
- return;
+ _state = SubscriberStateOnline;
+ return;
}
_instance->subscriberPool()->flush(this);
}
@@ -639,18 +639,18 @@ SubscriberLink::offline(const Ice::Exception& e)
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(_warn)
{
- Ice::Warning warn(traceLevels->logger);
- warn << traceLevels->subscriberCat << ":" << _instance->communicator()->identityToString(_id)
- << ": link offline: " << e;
+ Ice::Warning warn(traceLevels->logger);
+ warn << traceLevels->subscriberCat << ":" << _instance->communicator()->identityToString(_id)
+ << ": link offline: " << e;
}
else
{
- if(traceLevels->subscriber > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->subscriberCat);
- out << _instance->communicator()->identityToString(_id) << ": link offline: " << e
- << " discarding events: " << _instance->discardInterval() << "s";
- }
+ if(traceLevels->subscriber > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->subscriberCat);
+ out << _instance->communicator()->identityToString(_id) << ": link offline: " << e
+ << " discarding events: " << _instance->discardInterval() << "s";
+ }
}
_state = SubscriberStateOffline;
@@ -675,57 +675,57 @@ Subscriber::create(
try
{
- string reliability;
- QoS::const_iterator p = qos.find("reliability");
- if(p != qos.end())
- {
- reliability = p->second;
- }
- if(!reliability.empty() && reliability != "ordered")
- {
- throw BadQoS("invalid reliability: " + reliability);
- }
-
- //
- // Override the timeout.
- //
- Ice::ObjectPrx newObj;
- try
- {
- newObj = obj->ice_timeout(instance->sendTimeout());
- }
- catch(const Ice::FixedProxyException&)
- {
- //
- // In the event IceStorm is collocated this could be a
- // fixed proxy in which case its not possible to set the
- // timeout.
- //
- newObj = obj;
- }
- if(reliability == "ordered")
- {
- if(!newObj->ice_isTwoway())
- {
- throw BadQoS("ordered reliability requires a twoway proxy");
- }
- subscriber = new SubscriberTwowayOrdered(instance, proxy, newObj);
- }
- else if(newObj->ice_isOneway() || newObj->ice_isDatagram() ||
- newObj->ice_isBatchOneway() || newObj->ice_isBatchDatagram())
- {
- subscriber = new SubscriberOneway(instance, proxy, newObj);
- }
- else if(newObj->ice_isTwoway())
- {
- subscriber = new SubscriberTwoway(instance, proxy, newObj);
- }
- per->setSubscriber(subscriber);
+ string reliability;
+ QoS::const_iterator p = qos.find("reliability");
+ if(p != qos.end())
+ {
+ reliability = p->second;
+ }
+ if(!reliability.empty() && reliability != "ordered")
+ {
+ throw BadQoS("invalid reliability: " + reliability);
+ }
+
+ //
+ // Override the timeout.
+ //
+ Ice::ObjectPrx newObj;
+ try
+ {
+ newObj = obj->ice_timeout(instance->sendTimeout());
+ }
+ catch(const Ice::FixedProxyException&)
+ {
+ //
+ // In the event IceStorm is collocated this could be a
+ // fixed proxy in which case its not possible to set the
+ // timeout.
+ //
+ newObj = obj;
+ }
+ if(reliability == "ordered")
+ {
+ if(!newObj->ice_isTwoway())
+ {
+ throw BadQoS("ordered reliability requires a twoway proxy");
+ }
+ subscriber = new SubscriberTwowayOrdered(instance, proxy, newObj);
+ }
+ else if(newObj->ice_isOneway() || newObj->ice_isDatagram() ||
+ newObj->ice_isBatchOneway() || newObj->ice_isBatchDatagram())
+ {
+ subscriber = new SubscriberOneway(instance, proxy, newObj);
+ }
+ else if(newObj->ice_isTwoway())
+ {
+ subscriber = new SubscriberTwoway(instance, proxy, newObj);
+ }
+ per->setSubscriber(subscriber);
}
catch(const Ice::Exception&)
{
- instance->objectAdapter()->remove(proxy->ice_getIdentity());
- throw;
+ instance->objectAdapter()->remove(proxy->ice_getIdentity());
+ throw;
}
return subscriber;
@@ -738,9 +738,9 @@ Subscriber::create(
int cost)
{
return new SubscriberLink(
- instance,
- TopicLinkPrx::uncheckedCast(link->ice_timeout(instance->sendTimeout())),
- cost);
+ instance,
+ TopicLinkPrx::uncheckedCast(link->ice_timeout(instance->sendTimeout())),
+ cost);
}
Subscriber::~Subscriber()
@@ -772,13 +772,13 @@ Subscriber::queue(bool, const EventDataSeq& events)
if(_state == SubscriberStateError)
{
- return QueueStateError;
+ return QueueStateError;
}
copy(events.begin(), events.end(), back_inserter(_events));
if(_state == SubscriberStateFlushPending)
{
- return QueueStateNoFlush;
+ return QueueStateNoFlush;
}
_state = SubscriberStateFlushPending;
@@ -793,18 +793,18 @@ Subscriber::destroy()
//
if(_proxy)
{
- try
- {
- _instance->objectAdapter()->remove(_proxy->ice_getIdentity());
- }
- catch(const Ice::NotRegisteredException&)
- {
- // Ignore
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- // Ignore
- }
+ try
+ {
+ _instance->objectAdapter()->remove(_proxy->ice_getIdentity());
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ // Ignore
+ }
+ catch(const Ice::ObjectAdapterDeactivatedException&)
+ {
+ // Ignore
+ }
}
}
@@ -813,9 +813,9 @@ Subscriber::flushTime(const IceUtil::Time& interval)
{
if(_resetMax || interval > _maxSend)
{
- assert(interval != IceUtil::Time());
- _resetMax = false;
- _maxSend = interval;
+ assert(interval != IceUtil::Time());
+ _resetMax = false;
+ _maxSend = interval;
}
}
@@ -833,15 +833,15 @@ Subscriber::error(const Ice::Exception& e)
IceUtil::Mutex::Lock sync(_mutex);
if(_state != SubscriberStateError)
{
- _state = SubscriberStateError;
- _events.clear();
-
- TraceLevelsPtr traceLevels = _instance->traceLevels();
- if(traceLevels->subscriber > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->subscriberCat);
- out << _instance->communicator()->identityToString(_id) << ": topic publish failed: " << e;
- }
+ _state = SubscriberStateError;
+ _events.clear();
+
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
+ if(traceLevels->subscriber > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->subscriberCat);
+ out << _instance->communicator()->identityToString(_id) << ": topic publish failed: " << e;
+ }
}
}
diff --git a/cpp/src/IceStorm/Subscriber.h b/cpp/src/IceStorm/Subscriber.h
index bbe83750874..166362f1128 100644
--- a/cpp/src/IceStorm/Subscriber.h
+++ b/cpp/src/IceStorm/Subscriber.h
@@ -36,9 +36,9 @@ public:
enum QueueState
{
- QueueStateError,
- QueueStateFlush,
- QueueStateNoFlush
+ QueueStateError,
+ QueueStateFlush,
+ QueueStateNoFlush
};
virtual QueueState queue(bool, const std::vector<EventDataPtr>&);
//
@@ -70,10 +70,10 @@ protected:
enum SubscriberState
{
- SubscriberStateOnline,
- SubscriberStateFlushPending,
- SubscriberStateOffline,
- SubscriberStateError
+ SubscriberStateOnline,
+ SubscriberStateFlushPending,
+ SubscriberStateOffline,
+ SubscriberStateError
};
SubscriberState _state; // The subscriber state.
EventDataSeq _events; // The queue of events to send.
diff --git a/cpp/src/IceStorm/SubscriberPool.cpp b/cpp/src/IceStorm/SubscriberPool.cpp
index 42c92fd97cf..1d1fd773028 100644
--- a/cpp/src/IceStorm/SubscriberPool.cpp
+++ b/cpp/src/IceStorm/SubscriberPool.cpp
@@ -27,9 +27,9 @@ class SubscriberPoolWorker : public IceUtil::Thread
public:
SubscriberPoolWorker(const SubscriberPoolPtr& manager) :
- _manager(manager)
+ _manager(manager)
{
- start();
+ start();
}
~SubscriberPoolWorker()
@@ -39,35 +39,35 @@ public:
virtual void
run()
{
- IceUtil::Time interval = IceUtil::Time::seconds(24 * 60); // A long time.
- SubscriberPtr sub;
- bool requeue = false;
- bool computeInterval = false;
- while(true)
- {
- _manager->dequeue(sub, requeue, interval, computeInterval);
- if(!sub)
- {
- return;
- }
-
- //
- // If SubscriberPool returns true then the subscriber
- // needs to be SubscriberPooled again, so therefore we
- // will re-enqueue the subscriber in the call to dequeue.
- //
- if(computeInterval)
- {
- IceUtil::Time start = IceUtil::Time::now();
- requeue = sub->flush();
- interval = IceUtil::Time::now() - start;
- }
- else
- {
- requeue = sub->flush();
- interval = IceUtil::Time::seconds(24 * 60); // A long time.
- }
- }
+ IceUtil::Time interval = IceUtil::Time::seconds(24 * 60); // A long time.
+ SubscriberPtr sub;
+ bool requeue = false;
+ bool computeInterval = false;
+ while(true)
+ {
+ _manager->dequeue(sub, requeue, interval, computeInterval);
+ if(!sub)
+ {
+ return;
+ }
+
+ //
+ // If SubscriberPool returns true then the subscriber
+ // needs to be SubscriberPooled again, so therefore we
+ // will re-enqueue the subscriber in the call to dequeue.
+ //
+ if(computeInterval)
+ {
+ IceUtil::Time start = IceUtil::Time::now();
+ requeue = sub->flush();
+ interval = IceUtil::Time::now() - start;
+ }
+ else
+ {
+ requeue = sub->flush();
+ interval = IceUtil::Time::seconds(24 * 60); // A long time.
+ }
+ }
}
private:
@@ -96,32 +96,32 @@ SubscriberPoolMonitor::run()
for(;;)
{
{
- Lock sync(*this);
- if(_destroyed)
- {
- return;
- }
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ return;
+ }
- if(_needCheck)
- {
- timedWait(_timeout);
- //
- // Monitoring was stopped.
- //
- if(!_needCheck)
- {
- continue;
- }
- if(_destroyed)
- {
- return;
- }
- }
- else
- {
- wait();
- continue;
- }
+ if(_needCheck)
+ {
+ timedWait(_timeout);
+ //
+ // Monitoring was stopped.
+ //
+ if(!_needCheck)
+ {
+ continue;
+ }
+ if(_destroyed)
+ {
+ return;
+ }
+ }
+ else
+ {
+ wait();
+ continue;
+ }
}
//
// Call outside of the lock to prevent any deadlocks.
@@ -163,7 +163,7 @@ SubscriberPool::SubscriberPool(const InstancePtr& instance) :
_size(instance->properties()->getPropertyAsIntWithDefault("IceStorm.SubscriberPool.Size", 1)),
// minimum 50ms, default 1s.
_timeout(IceUtil::Time::milliSeconds(max(instance->properties()->getPropertyAsIntWithDefault(
- "IceStorm.SubscriberPool.Timeout", 1000), 50))),
+ "IceStorm.SubscriberPool.Timeout", 1000), 50))),
// 10 * the stall timeout.
_stallCheck(_timeout * 10),
_destroyed(false),
@@ -171,23 +171,23 @@ SubscriberPool::SubscriberPool(const InstancePtr& instance) :
{
try
{
- __setNoDelete(true);
- _subscriberPoolMonitor = new SubscriberPoolMonitor(this, _timeout);
- for(unsigned int i = 0; i < _size; ++i)
- {
- ++_inUse;
- _workers.push_back(new SubscriberPoolWorker(this));
- }
+ __setNoDelete(true);
+ _subscriberPoolMonitor = new SubscriberPoolMonitor(this, _timeout);
+ for(unsigned int i = 0; i < _size; ++i)
+ {
+ ++_inUse;
+ _workers.push_back(new SubscriberPoolWorker(this));
+ }
}
catch(const IceUtil::Exception& ex)
{
- {
- Ice::Error out(_traceLevels->logger);
- out << "SubscriberPool: " << ex;
- }
- destroy();
- __setNoDelete(false);
- throw;
+ {
+ Ice::Error out(_traceLevels->logger);
+ out << "SubscriberPool: " << ex;
+ }
+ destroy();
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
@@ -203,7 +203,7 @@ SubscriberPool::flush(list<SubscriberPtr>& subscribers)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
//
// Splice on the new set of subscribers to SubscriberPool.
@@ -219,7 +219,7 @@ SubscriberPool::flush(const SubscriberPtr& subscriber)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
_pending.push_back(subscriber);
assert(invariants());
@@ -232,7 +232,7 @@ SubscriberPool::add(const SubscriberPtr& subscriber)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
_subscribers.push_back(subscriber);
assert(invariants());
@@ -244,7 +244,7 @@ SubscriberPool::remove(const SubscriberPtr& subscriber)
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
//
// Note that this cannot remove based on the subscriber id because
@@ -267,18 +267,18 @@ SubscriberPool::dequeue(SubscriberPtr& subscriber, bool requeue, const IceUtil::
if(_destroyed)
{
- subscriber = 0;
- return;
+ subscriber = 0;
+ return;
}
if(subscriber)
{
- if(requeue)
- {
- _pending.push_back(subscriber);
- assert(invariants());
- }
- subscriber->flushTime(interval);
+ if(requeue)
+ {
+ _pending.push_back(subscriber);
+ assert(invariants());
+ }
+ subscriber->flushTime(interval);
}
//
// Clear the reference.
@@ -297,99 +297,99 @@ SubscriberPool::dequeue(SubscriberPtr& subscriber, bool requeue, const IceUtil::
if(_sizeMax != 1)
{
- //
- // Reap dead workers, if necessary.
- //
- if(_reap > 0)
- {
- if(_traceLevels->subscriberPool > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
- out << "reaping: " << _reap << " workers";
- }
- list<IceUtil::ThreadPtr>::iterator p = _workers.begin();
- while(p != _workers.end() && _reap > 0)
- {
- if(!(*p)->isAlive())
- {
- (*p)->getThreadControl().join();
- p = _workers.erase(p);
- --_reap;
- }
- else
- {
- ++p;
- }
- }
- }
-
- //
- // If we have extra workers every _stallCheck period we run
- // through the complete set of subscribers and determine how
- // many have stalled since the last check. If this number is
- // less than the number of extra threads then we terminate the
- // calling worker.
- //
- // - The flush time is protected by the subscriber pool mutex.
- // - The flush time is only computed if we have extra threads,
- // otherwise it is set to some large value.
- // - The max flush time is reset to the next sending interval
- // after after _stallCheck period.
- // - Every subscriber is considered to be stalled iff it has
- // never sent an event or we have just created the first
- // additional worker. The first handles the case where a
- // subscriber stalls for a long time on the first message
- // send. The second means that we can disable computation of
- // the flush latency if there are no additional threads.
- //
- if(_workers.size() > _size)
- {
- IceUtil::Time now = IceUtil::Time::now();
- if(now - _lastStallCheck > _stallCheck)
- {
- _lastStallCheck = now;
- unsigned int stalls = 0;
- for(list<SubscriberPtr>::const_iterator p = _subscribers.begin(); p != _subscribers.end(); ++p)
- {
- if((*p)->pollMaxFlushTime(now) > _timeout)
- {
- ++stalls;
- }
- }
-
- if(_traceLevels->subscriberPool > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
- out << "checking stalls. extra workers: " << _workers.size() - _size
- << " subscribers: " << _subscribers.size() << " stalls: " << stalls;
- }
-
- if((_workers.size() - _size) > stalls)
- {
- if(_traceLevels->subscriberPool > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
- out << "destroying workers";
- }
- ++_reap;
- return;
- }
- }
- }
+ //
+ // Reap dead workers, if necessary.
+ //
+ if(_reap > 0)
+ {
+ if(_traceLevels->subscriberPool > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
+ out << "reaping: " << _reap << " workers";
+ }
+ list<IceUtil::ThreadPtr>::iterator p = _workers.begin();
+ while(p != _workers.end() && _reap > 0)
+ {
+ if(!(*p)->isAlive())
+ {
+ (*p)->getThreadControl().join();
+ p = _workers.erase(p);
+ --_reap;
+ }
+ else
+ {
+ ++p;
+ }
+ }
+ }
+
+ //
+ // If we have extra workers every _stallCheck period we run
+ // through the complete set of subscribers and determine how
+ // many have stalled since the last check. If this number is
+ // less than the number of extra threads then we terminate the
+ // calling worker.
+ //
+ // - The flush time is protected by the subscriber pool mutex.
+ // - The flush time is only computed if we have extra threads,
+ // otherwise it is set to some large value.
+ // - The max flush time is reset to the next sending interval
+ // after after _stallCheck period.
+ // - Every subscriber is considered to be stalled iff it has
+ // never sent an event or we have just created the first
+ // additional worker. The first handles the case where a
+ // subscriber stalls for a long time on the first message
+ // send. The second means that we can disable computation of
+ // the flush latency if there are no additional threads.
+ //
+ if(_workers.size() > _size)
+ {
+ IceUtil::Time now = IceUtil::Time::now();
+ if(now - _lastStallCheck > _stallCheck)
+ {
+ _lastStallCheck = now;
+ unsigned int stalls = 0;
+ for(list<SubscriberPtr>::const_iterator p = _subscribers.begin(); p != _subscribers.end(); ++p)
+ {
+ if((*p)->pollMaxFlushTime(now) > _timeout)
+ {
+ ++stalls;
+ }
+ }
+
+ if(_traceLevels->subscriberPool > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
+ out << "checking stalls. extra workers: " << _workers.size() - _size
+ << " subscribers: " << _subscribers.size() << " stalls: " << stalls;
+ }
+
+ if((_workers.size() - _size) > stalls)
+ {
+ if(_traceLevels->subscriberPool > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
+ out << "destroying workers";
+ }
+ ++_reap;
+ return;
+ }
+ }
+ }
}
-
+
while(_pending.empty() && !_destroyed)
{
- //
- // If we wait then there is no need to monitor anymore.
- //
- _subscriberPoolMonitor->stopMonitor();
- wait();
+ //
+ // If we wait then there is no need to monitor anymore.
+ //
+ _subscriberPoolMonitor->stopMonitor();
+ wait();
}
if(_destroyed)
{
- return;
+ return;
}
_lastDequeue = IceUtil::Time::now();
@@ -405,11 +405,11 @@ SubscriberPool::dequeue(SubscriberPtr& subscriber, bool requeue, const IceUtil::
//
if(_inUse == _workers.size() && (_workers.size() < _sizeMax || _sizeMax != 1))
{
- _subscriberPoolMonitor->startMonitor();
+ _subscriberPoolMonitor->startMonitor();
}
else
{
- _subscriberPoolMonitor->stopMonitor();
+ _subscriberPoolMonitor->stopMonitor();
}
//
// We only need to compute the push interval if we've created
@@ -429,22 +429,22 @@ SubscriberPool::destroy()
// _destroyed is set.
//
{
- Lock sync(*this);
- _destroyed = true;
- notifyAll();
- if(_subscriberPoolMonitor)
- {
- _subscriberPoolMonitor->destroy();
- }
- _subscribers.clear();
- _pending.clear();
+ Lock sync(*this);
+ _destroyed = true;
+ notifyAll();
+ if(_subscriberPoolMonitor)
+ {
+ _subscriberPoolMonitor->destroy();
+ }
+ _subscribers.clear();
+ _pending.clear();
}
//
// Next join with each worker.
//
for(list<IceUtil::ThreadPtr>::const_iterator p = _workers.begin(); p != _workers.end(); ++p)
{
- (*p)->getThreadControl().join();
+ (*p)->getThreadControl().join();
}
_workers.clear();
@@ -455,8 +455,8 @@ SubscriberPool::destroy()
//
if(_subscriberPoolMonitor)
{
- _subscriberPoolMonitor->getThreadControl().join();
- _subscriberPoolMonitor = 0;
+ _subscriberPoolMonitor->getThreadControl().join();
+ _subscriberPoolMonitor = 0;
}
}
@@ -466,7 +466,7 @@ SubscriberPool::check()
Lock sync(*this);
if(_destroyed)
{
- return;
+ return;
}
IceUtil::Time now = IceUtil::Time::now();
@@ -474,34 +474,34 @@ SubscriberPool::check()
/*
if(_traceLevels->subscriberPool > 1)
{
- Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
- out << "check called: interval: " << interval << " timeout: " << _timeout
- << " pending: " << _pending.size() << " running: " << _workers.size()
- << " sizeMax: " << _sizeMax;
+ Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
+ out << "check called: interval: " << interval << " timeout: " << _timeout
+ << " pending: " << _pending.size() << " running: " << _workers.size()
+ << " sizeMax: " << _sizeMax;
}
*/
if(interval > _timeout && _pending.size() > 0 && (_workers.size() < _sizeMax || _sizeMax == 0))
{
- if(_traceLevels->subscriberPool > 0)
- {
- Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
- out << "detected stall: creating thread: threads: " << _workers.size();
- }
-
- //
- // We'll now start stall checking at regular intervals if this
- // is the first newly created worker. Here we need to
- // initially set the stall check and the number of requests at
- // this point.
- //
- if(_workers.size() == _size)
- {
- _lastStallCheck = now;
- }
-
- ++_inUse;
- _workers.push_back(new SubscriberPoolWorker(this));
+ if(_traceLevels->subscriberPool > 0)
+ {
+ Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberPoolCat);
+ out << "detected stall: creating thread: threads: " << _workers.size();
+ }
+
+ //
+ // We'll now start stall checking at regular intervals if this
+ // is the first newly created worker. Here we need to
+ // initially set the stall check and the number of requests at
+ // this point.
+ //
+ if(_workers.size() == _size)
+ {
+ _lastStallCheck = now;
+ }
+
+ ++_inUse;
+ _workers.push_back(new SubscriberPoolWorker(this));
}
}
@@ -512,14 +512,14 @@ SubscriberPool::invariants()
list<SubscriberPtr>::const_iterator p;
for(p = _subscribers.begin(); p != _subscribers.end(); ++p)
{
- assert(subs.find(*p) == subs.end());
- subs.insert(*p);
+ assert(subs.find(*p) == subs.end());
+ subs.insert(*p);
}
subs.clear();
for(p = _pending.begin(); p != _pending.end(); ++p)
{
- assert(subs.find(*p) == subs.end());
- subs.insert(*p);
+ assert(subs.find(*p) == subs.end());
+ subs.insert(*p);
}
return true;
}
diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp
index a88bc1c1744..1831a746ac5 100644
--- a/cpp/src/IceStorm/TopicI.cpp
+++ b/cpp/src/IceStorm/TopicI.cpp
@@ -35,33 +35,33 @@ class PublisherI : public Ice::BlobjectArray
public:
PublisherI(const TopicIPtr& topic) :
- _topic(topic)
+ _topic(topic)
{
}
virtual bool
ice_invoke(const pair<const Ice::Byte*, const Ice::Byte*>& inParams,
- Ice::ByteSeq&,
- const Ice::Current& current)
+ Ice::ByteSeq&,
+ const Ice::Current& current)
{
- EventDataPtr event = new EventData(
- current.operation,
- current.mode,
- Ice::ByteSeq(),
- current.ctx);
+ EventDataPtr event = new EventData(
+ current.operation,
+ current.mode,
+ Ice::ByteSeq(),
+ current.ctx);
- //
- // COMPILERBUG: gcc 4.0.1 doesn't like this.
- //
- //event->data.swap(Ice::ByteSeq(inParams.first, inParams.second));
- Ice::ByteSeq data(inParams.first, inParams.second);
- event->data.swap(data);
-
- EventDataSeq v;
- v.push_back(event);
- _topic->publish(false, v);
+ //
+ // COMPILERBUG: gcc 4.0.1 doesn't like this.
+ //
+ //event->data.swap(Ice::ByteSeq(inParams.first, inParams.second));
+ Ice::ByteSeq data(inParams.first, inParams.second);
+ event->data.swap(data);
+
+ EventDataSeq v;
+ v.push_back(event);
+ _topic->publish(false, v);
- return true;
+ return true;
}
private:
@@ -78,14 +78,14 @@ class TopicLinkI : public TopicLink
public:
TopicLinkI(const TopicIPtr& topic) :
- _topic(topic)
+ _topic(topic)
{
}
virtual void
forward(const EventDataSeq& v, const Ice::Current& current)
{
- _topic->publish(true, v);
+ _topic->publish(true, v);
}
private:
@@ -128,17 +128,17 @@ TopicI::TopicI(
Ice::Identity linkid;
if(id.category.empty())
{
- pubid.category = _name;
- pubid.name = "publish";
- linkid.category = _name;
- linkid.name = "link";
+ pubid.category = _name;
+ pubid.name = "publish";
+ linkid.category = _name;
+ linkid.name = "link";
}
else
{
- pubid.category = id.category;
- pubid.name = _name + ".publish";
- linkid.category = id.category;
- linkid.name = _name + ".link";
+ pubid.category = id.category;
+ pubid.name = _name + ".publish";
+ linkid.category = id.category;
+ linkid.name = _name + ".link";
}
_publisherPrx = _instance->objectAdapter()->add(new PublisherI(this), pubid);
@@ -149,20 +149,20 @@ TopicI::TopicI(
//
for(LinkRecordSeq::const_iterator p = _topicRecord.begin(); p != _topicRecord.end(); ++p)
{
- TraceLevelsPtr traceLevels = _instance->traceLevels();
- if(traceLevels->topic > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << _name << " relink " << _instance->communicator()->identityToString(p->theTopic->ice_getIdentity());
- }
-
- //
- // Create the subscriber object add it to the set of
- // subscribers.
- //
- SubscriberPtr subscriber = Subscriber::create(_instance, p->obj, p->cost);
- _subscribers.push_back(subscriber);
- _instance->subscriberPool()->add(subscriber);
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
+ if(traceLevels->topic > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << _name << " relink " << _instance->communicator()->identityToString(p->theTopic->ice_getIdentity());
+ }
+
+ //
+ // Create the subscriber object add it to the set of
+ // subscribers.
+ //
+ SubscriberPtr subscriber = Subscriber::create(_instance, p->obj, p->cost);
+ _subscribers.push_back(subscriber);
+ _instance->subscriberPool()->add(subscriber);
}
}
@@ -193,11 +193,11 @@ find(vector<SubscriberPtr>::iterator start, vector<SubscriberPtr>::iterator end,
{
while(start != end)
{
- if(*start == ident)
- {
- return start;
- }
- ++start;
+ if(*start == ident)
+ {
+ return start;
+ }
+ ++start;
}
return end;
}
@@ -211,74 +211,74 @@ TopicI::subscribe(const QoS& origQoS, const Ice::ObjectPrx& obj, const Ice::Curr
QoS qos = origQoS;
if(traceLevels->topic > 0)
{
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << "Subscribe: " << _instance->communicator()->identityToString(id);
- if(traceLevels->topic > 1)
- {
- out << " QoS: ";
- for(QoS::const_iterator p = qos.begin(); p != qos.end() ; ++p)
- {
- if(p != qos.begin())
- {
- out << ',';
- }
- out << '[' << p->first << "," << p->second << ']';
- }
- }
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << "Subscribe: " << _instance->communicator()->identityToString(id);
+ if(traceLevels->topic > 1)
+ {
+ out << " QoS: ";
+ for(QoS::const_iterator p = qos.begin(); p != qos.end() ; ++p)
+ {
+ if(p != qos.begin())
+ {
+ out << ',';
+ }
+ out << '[' << p->first << "," << p->second << ']';
+ }
+ }
}
string reliability = "oneway";
{
- QoS::iterator p = qos.find("reliability");
- if(p != qos.end())
- {
- reliability = p->second;
- qos.erase(p);
- }
+ QoS::iterator p = qos.find("reliability");
+ if(p != qos.end())
+ {
+ reliability = p->second;
+ qos.erase(p);
+ }
}
Ice::ObjectPrx newObj = obj;
if(reliability == "batch")
{
- if(newObj->ice_isDatagram())
- {
- newObj = newObj->ice_batchDatagram();
- }
- else
- {
- newObj = newObj->ice_batchOneway();
- }
+ if(newObj->ice_isDatagram())
+ {
+ newObj = newObj->ice_batchDatagram();
+ }
+ else
+ {
+ newObj = newObj->ice_batchOneway();
+ }
}
else if(reliability == "twoway")
{
- newObj = newObj->ice_twoway();
+ newObj = newObj->ice_twoway();
}
else if(reliability == "twoway ordered")
{
- qos["reliability"] = "ordered";
- newObj = newObj->ice_twoway();
+ qos["reliability"] = "ordered";
+ newObj = newObj->ice_twoway();
}
else // reliability == "oneway"
{
- if(reliability != "oneway" && traceLevels->subscriber > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->subscriberCat);
- out << reliability <<" mode not understood.";
- }
- if(!newObj->ice_isDatagram())
- {
- newObj = newObj->ice_oneway();
- }
+ if(reliability != "oneway" && traceLevels->subscriber > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->subscriberCat);
+ out << reliability <<" mode not understood.";
+ }
+ if(!newObj->ice_isDatagram())
+ {
+ newObj = newObj->ice_oneway();
+ }
}
IceUtil::Mutex::Lock sync(_subscribersMutex);
vector<SubscriberPtr>::iterator p = find(_subscribers.begin(), _subscribers.end(), id);
if(p != _subscribers.end())
{
- (*p)->destroy();
- _instance->subscriberPool()->remove(*p);
- _subscribers.erase(p);
+ (*p)->destroy();
+ _instance->subscriberPool()->remove(*p);
+ _subscribers.erase(p);
}
SubscriberPtr subscriber = Subscriber::create(_instance, newObj, qos);
@@ -293,27 +293,27 @@ TopicI::subscribeAndGetPublisher(const QoS& qos, const Ice::ObjectPrx& obj, cons
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topic > 0)
{
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << "Subscribe: " << _instance->communicator()->identityToString(id);
- if(traceLevels->topic > 1)
- {
- out << " QoS: ";
- for(QoS::const_iterator p = qos.begin(); p != qos.end() ; ++p)
- {
- if(p != qos.begin())
- {
- out << ',';
- }
- out << '[' << p->first << "," << p->second << ']';
- }
- }
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << "Subscribe: " << _instance->communicator()->identityToString(id);
+ if(traceLevels->topic > 1)
+ {
+ out << " QoS: ";
+ for(QoS::const_iterator p = qos.begin(); p != qos.end() ; ++p)
+ {
+ if(p != qos.begin())
+ {
+ out << ',';
+ }
+ out << '[' << p->first << "," << p->second << ']';
+ }
+ }
}
IceUtil::Mutex::Lock sync(_subscribersMutex);
vector<SubscriberPtr>::iterator p = find(_subscribers.begin(), _subscribers.end(), id);
if(p != _subscribers.end())
{
- throw AlreadySubscribed();
+ throw AlreadySubscribed();
}
SubscriberPtr subscriber = Subscriber::create(_instance, obj, qos);
@@ -329,20 +329,20 @@ TopicI::unsubscribe(const Ice::ObjectPrx& subscriber, const Ice::Current&)
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(!subscriber)
{
- if(traceLevels->topic > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << "unsubscribe with null subscriber.";
- }
- return;
+ if(traceLevels->topic > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << "unsubscribe with null subscriber.";
+ }
+ return;
}
Ice::Identity id = subscriber->ice_getIdentity();
if(traceLevels->topic > 0)
{
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << "Unsubscribe: " << _instance->communicator()->identityToString(id);
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << "Unsubscribe: " << _instance->communicator()->identityToString(id);
}
//
@@ -367,7 +367,7 @@ TopicI::link(const TopicPrx& topic, Ice::Int cost, const Ice::Current&)
IceUtil::RecMutex::Lock topicSync(_topicRecordMutex);
if(_destroyed)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
reap();
@@ -379,20 +379,20 @@ TopicI::link(const TopicPrx& topic, Ice::Int cost, const Ice::Current&)
// link.
for(LinkRecordSeq::const_iterator p = _topicRecord.begin(); p != _topicRecord.end(); ++p)
{
- if(p->theTopic->ice_getIdentity() == topic->ice_getIdentity())
- {
- LinkExists ex;
- ex.name = name;
- throw ex;
- }
+ if(p->theTopic->ice_getIdentity() == topic->ice_getIdentity())
+ {
+ LinkExists ex;
+ ex.name = name;
+ throw ex;
+ }
}
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topic > 0)
{
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << _name << " link " << _instance->communicator()->identityToString(id)
- << " cost " << cost;
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << _name << " link " << _instance->communicator()->identityToString(id)
+ << " cost " << cost;
}
SubscriberPtr subscriber = Subscriber::create(_instance, link, cost);
@@ -422,7 +422,7 @@ TopicI::unlink(const TopicPrx& topic, const Ice::Current& current)
IceUtil::RecMutex::Lock topicSync(_topicRecordMutex);
if(_destroyed)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
reap();
@@ -433,24 +433,24 @@ TopicI::unlink(const TopicPrx& topic, const Ice::Current& current)
LinkRecordSeq::iterator p = _topicRecord.begin();
while(p != _topicRecord.end())
{
- if(p->theTopic->ice_getIdentity() == topic->ice_getIdentity())
- {
- break;
- }
- ++p;
+ if(p->theTopic->ice_getIdentity() == topic->ice_getIdentity())
+ {
+ break;
+ }
+ ++p;
}
if(p == _topicRecord.end())
{
- TraceLevelsPtr traceLevels = _instance->traceLevels();
- if(traceLevels->topic > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << _name << " unlink " << name << " failed - not linked";
- }
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
+ if(traceLevels->topic > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << _name << " unlink " << name << " failed - not linked";
+ }
- NoSuchLink ex;
- ex.name = name;
- throw ex;
+ NoSuchLink ex;
+ ex.name = name;
+ throw ex;
}
Ice::ObjectPrx subscriber = p->obj;
@@ -464,8 +464,8 @@ TopicI::unlink(const TopicPrx& topic, const Ice::Current& current)
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topic > 0)
{
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << _name << " unlink " << _instance->communicator()->identityToString(id);
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << _name << " unlink " << _instance->communicator()->identityToString(id);
}
removeSubscriber(subscriber);
}
@@ -481,11 +481,11 @@ TopicI::getLinkInfoSeq(const Ice::Current&) const
for(LinkRecordSeq::const_iterator q = _topicRecord.begin(); q != _topicRecord.end(); ++q)
{
- LinkInfo info;
- info.name = identityToTopicName(q->theTopic->ice_getIdentity());
- info.cost = q->cost;
- info.theTopic = q->theTopic;
- seq.push_back(info);
+ LinkInfo info;
+ info.name = identityToTopicName(q->theTopic->ice_getIdentity());
+ info.cost = q->cost;
+ info.theTopic = q->theTopic;
+ seq.push_back(info);
}
return seq;
@@ -498,18 +498,18 @@ TopicI::destroy(const Ice::Current&)
if(_destroyed)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
_destroyed = true;
try
{
- _instance->objectAdapter()->remove(_linkPrx->ice_getIdentity());
- _instance->objectAdapter()->remove(_publisherPrx->ice_getIdentity());
+ _instance->objectAdapter()->remove(_linkPrx->ice_getIdentity());
+ _instance->objectAdapter()->remove(_publisherPrx->ice_getIdentity());
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
- // Ignore -- this could occur on shutdown.
+ // Ignore -- this could occur on shutdown.
}
}
@@ -533,7 +533,7 @@ TopicI::reap()
IceUtil::RecMutex::Lock topicSync(_topicRecordMutex);
if(_destroyed)
{
- return;
+ return;
}
bool updated = false;
@@ -543,46 +543,46 @@ TopicI::reap()
//
list<SubscriberPtr> error;
{
- IceUtil::Mutex::Lock errorSync(_errorMutex);
- _error.swap(error);
+ IceUtil::Mutex::Lock errorSync(_errorMutex);
+ _error.swap(error);
}
TraceLevelsPtr traceLevels = _instance->traceLevels();
for(list<SubscriberPtr>::const_iterator p = error.begin(); p != error.end(); ++p)
{
- SubscriberPtr subscriber = *p;
- assert(subscriber->persistent()); // Only persistent subscribers need to be reaped.
-
- bool found = false;
- //
- // If this turns out to be a performance problem then we
- // can create an in memory map cache.
- //
- LinkRecordSeq::iterator q = _topicRecord.begin();
- while(q != _topicRecord.end())
- {
- if(q->obj->ice_getIdentity() == subscriber->id())
- {
- _topicRecord.erase(q);
- updated = true;
- found = true;
- break;
- }
- ++q;
- }
- if(traceLevels->topic > 0)
- {
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << "reaping " << _instance->communicator()->identityToString(subscriber->id());
- if(!found)
- {
- out << ": failed - not in database";
- }
- }
+ SubscriberPtr subscriber = *p;
+ assert(subscriber->persistent()); // Only persistent subscribers need to be reaped.
+
+ bool found = false;
+ //
+ // If this turns out to be a performance problem then we
+ // can create an in memory map cache.
+ //
+ LinkRecordSeq::iterator q = _topicRecord.begin();
+ while(q != _topicRecord.end())
+ {
+ if(q->obj->ice_getIdentity() == subscriber->id())
+ {
+ _topicRecord.erase(q);
+ updated = true;
+ found = true;
+ break;
+ }
+ ++q;
+ }
+ if(traceLevels->topic > 0)
+ {
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << "reaping " << _instance->communicator()->identityToString(subscriber->id());
+ if(!found)
+ {
+ out << ": failed - not in database";
+ }
+ }
}
if(updated)
{
- _topics.put(PersistentTopicMap::value_type(_id, _topicRecord));
+ _topics.put(PersistentTopicMap::value_type(_id, _topicRecord));
}
}
@@ -595,8 +595,8 @@ TopicI::publish(bool forwarded, const EventDataSeq& events)
//
vector<SubscriberPtr> copy;
{
- IceUtil::Mutex::Lock sync(_subscribersMutex);
- copy = _subscribers;
+ IceUtil::Mutex::Lock sync(_subscribersMutex);
+ copy = _subscribers;
}
//
@@ -608,18 +608,18 @@ TopicI::publish(bool forwarded, const EventDataSeq& events)
list<SubscriberPtr> flush;
for(vector<SubscriberPtr>::const_iterator p = copy.begin(); p != copy.end(); ++p)
{
- Subscriber::QueueState state = (*p)->queue(forwarded, events);
- switch(state)
- {
- case Subscriber::QueueStateError:
- e.push_back((*p)->id());
- break;
- case Subscriber::QueueStateFlush:
- flush.push_back(*p);
- break;
- case Subscriber::QueueStateNoFlush:
- break;
- }
+ Subscriber::QueueState state = (*p)->queue(forwarded, events);
+ switch(state)
+ {
+ case Subscriber::QueueStateError:
+ e.push_back((*p)->id());
+ break;
+ case Subscriber::QueueStateFlush:
+ flush.push_back(*p);
+ break;
+ case Subscriber::QueueStateNoFlush:
+ break;
+ }
}
//
@@ -627,7 +627,7 @@ TopicI::publish(bool forwarded, const EventDataSeq& events)
//
if(!flush.empty())
{
- _instance->subscriberPool()->flush(flush);
+ _instance->subscriberPool()->flush(flush);
}
//
@@ -637,48 +637,48 @@ TopicI::publish(bool forwarded, const EventDataSeq& events)
list<SubscriberPtr> reap;
if(!e.empty())
{
- IceUtil::Mutex::Lock sync(_subscribersMutex);
- for(vector<Ice::Identity>::const_iterator ep = e.begin(); ep != e.end(); ++ep)
- {
- //
- // Its possible for the subscriber to already have been
- // removed since the copy is iterated over outside of
- // mutex protection.
- //
- // Note that although this could be quicker if we used a
- // map, the most optimal case should be pushing around
- // events not searching for a particular subscriber.
- //
- // The subscriber is immediately destroyed & removed from
- // the _subscribers list. If the subscriber is persistent
- // its added to an list of error'd subscribers and removed
- // from the database on the next reap.
- //
- vector<SubscriberPtr>::iterator q = find(_subscribers.begin(), _subscribers.end(), *ep);
- if(q != _subscribers.end())
- {
- //
- // Destroy the subscriber in any case.
- //
- (*q)->destroy();
- if((*q)->persistent())
- {
- reap.push_back(*q);
- }
- _instance->subscriberPool()->remove(*q);
- _subscribers.erase(q);
- }
- }
+ IceUtil::Mutex::Lock sync(_subscribersMutex);
+ for(vector<Ice::Identity>::const_iterator ep = e.begin(); ep != e.end(); ++ep)
+ {
+ //
+ // Its possible for the subscriber to already have been
+ // removed since the copy is iterated over outside of
+ // mutex protection.
+ //
+ // Note that although this could be quicker if we used a
+ // map, the most optimal case should be pushing around
+ // events not searching for a particular subscriber.
+ //
+ // The subscriber is immediately destroyed & removed from
+ // the _subscribers list. If the subscriber is persistent
+ // its added to an list of error'd subscribers and removed
+ // from the database on the next reap.
+ //
+ vector<SubscriberPtr>::iterator q = find(_subscribers.begin(), _subscribers.end(), *ep);
+ if(q != _subscribers.end())
+ {
+ //
+ // Destroy the subscriber in any case.
+ //
+ (*q)->destroy();
+ if((*q)->persistent())
+ {
+ reap.push_back(*q);
+ }
+ _instance->subscriberPool()->remove(*q);
+ _subscribers.erase(q);
+ }
+ }
}
if(!reap.empty())
{
- //
- // This is why _error is a list, so we can splice on the
- // reaped subscribers.
- //
- IceUtil::Mutex::Lock errorSync(_errorMutex);
- _error.splice(_error.begin(), reap);
+ //
+ // This is why _error is a list, so we can splice on the
+ // reaped subscribers.
+ //
+ IceUtil::Mutex::Lock errorSync(_errorMutex);
+ _error.splice(_error.begin(), reap);
}
}
@@ -691,10 +691,10 @@ TopicI::removeSubscriber(const Ice::ObjectPrx& obj)
vector<SubscriberPtr>::iterator p = find(_subscribers.begin(), _subscribers.end(), id);
if(p != _subscribers.end())
{
- (*p)->destroy();
- _instance->subscriberPool()->remove(*p);
- _subscribers.erase(p);
- return;
+ (*p)->destroy();
+ _instance->subscriberPool()->remove(*p);
+ _subscribers.erase(p);
+ return;
}
//
@@ -703,7 +703,7 @@ TopicI::removeSubscriber(const Ice::ObjectPrx& obj)
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topic > 0)
{
- Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
- out << _instance->communicator()->identityToString(id) << ": not subscribed.";
+ Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
+ out << _instance->communicator()->identityToString(id) << ": not subscribed.";
}
}
diff --git a/cpp/src/IceStorm/TopicI.h b/cpp/src/IceStorm/TopicI.h
index 2ec61aee3c2..8db61085fa3 100644
--- a/cpp/src/IceStorm/TopicI.h
+++ b/cpp/src/IceStorm/TopicI.h
@@ -29,7 +29,7 @@ class TopicI : public TopicInternal
public:
TopicI(const InstancePtr&, const std::string&, const Ice::Identity&, const LinkRecordSeq&, const std::string&,
- const std::string&);
+ const std::string&);
~TopicI();
virtual std::string getName(const Ice::Current&) const;
diff --git a/cpp/src/IceStorm/TopicManagerI.cpp b/cpp/src/IceStorm/TopicManagerI.cpp
index 12c9706ceaa..f8ab5fe80bd 100644
--- a/cpp/src/IceStorm/TopicManagerI.cpp
+++ b/cpp/src/IceStorm/TopicManagerI.cpp
@@ -37,7 +37,7 @@ identityToTopicName(const Ice::Identity& id)
//
if(id.category.empty())
{
- return id.name;
+ return id.name;
}
assert(id.name.length() > 6 && id.name.compare(0, 6, "topic.") == 0);
@@ -63,7 +63,7 @@ TopicManagerI::TopicManagerI(
//
for(PersistentTopicMap::const_iterator p = _topics.begin(); p != _topics.end(); ++p)
{
- installTopic(identityToTopicName(p->first), p->first, p->second, false);
+ installTopic(identityToTopicName(p->first), p->first, p->second, false);
}
}
@@ -80,7 +80,7 @@ TopicManagerI::create(const string& name, const Ice::Current&)
if(_topicIMap.find(name) != _topicIMap.end())
{
TopicExists ex;
- ex.name = name;
+ ex.name = name;
throw ex;
}
@@ -105,9 +105,9 @@ TopicManagerI::retrieve(const string& name, const Ice::Current&) const
TopicIMap::const_iterator p = _topicIMap.find(name);
if(p == _topicIMap.end())
{
- NoSuchTopic ex;
- ex.name = name;
- throw ex;
+ NoSuchTopic ex;
+ ex.name = name;
+ throw ex;
}
// Here we cannot just reconstruct the identity since the
@@ -127,13 +127,13 @@ TopicManagerI::retrieveAll(const Ice::Current&) const
TopicDict all;
for(TopicIMap::const_iterator p = _topicIMap.begin(); p != _topicIMap.end(); ++p)
{
- //
- // Here we cannot just reconstruct the identity since the
- // identity could be either "<instanceName>/topic.<topicname>"
- // name, or if created with pre-3.2 IceStorm "/<topicname>".
- //
+ //
+ // Here we cannot just reconstruct the identity since the
+ // identity could be either "<instanceName>/topic.<topicname>"
+ // name, or if created with pre-3.2 IceStorm "/<topicname>".
+ //
all.insert(TopicDict::value_type(
- p->first, TopicPrx::uncheckedCast(_topicAdapter->createProxy(p->second->id()))));
+ p->first, TopicPrx::uncheckedCast(_topicAdapter->createProxy(p->second->id()))));
}
return all;
@@ -158,8 +158,8 @@ TopicManagerI::reap()
{
if(i->second->destroyed())
{
- Ice::Identity id = i->second->id();
- TraceLevelsPtr traceLevels = _instance->traceLevels();
+ Ice::Identity id = i->second->id();
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topicMgr > 0)
{
Ice::Trace out(traceLevels->logger, traceLevels->topicMgrCat);
@@ -195,7 +195,7 @@ TopicManagerI::shutdown()
for(TopicIMap::const_iterator p = _topicIMap.begin(); p != _topicIMap.end(); ++p)
{
- p->second->reap();
+ p->second->reap();
}
}
@@ -208,17 +208,17 @@ TopicManagerI::installTopic(const string& name, const Ice::Identity& id, const L
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topicMgr > 0)
{
- Ice::Trace out(traceLevels->logger, traceLevels->topicMgrCat);
- if(create)
- {
- out << "creating new topic \"" << name << "\". id: "
- << _instance->communicator()->identityToString(id);
- }
- else
- {
- out << "loading topic \"" << name << "\" from database. id: "
- << _instance->communicator()->identityToString(id);
- }
+ Ice::Trace out(traceLevels->logger, traceLevels->topicMgrCat);
+ if(create)
+ {
+ out << "creating new topic \"" << name << "\". id: "
+ << _instance->communicator()->identityToString(id);
+ }
+ else
+ {
+ out << "loading topic \"" << name << "\" from database. id: "
+ << _instance->communicator()->identityToString(id);
+ }
}
//
diff --git a/cpp/src/IceStorm/TopicManagerI.h b/cpp/src/IceStorm/TopicManagerI.h
index 61e6f30e223..ebddf8a9156 100644
--- a/cpp/src/IceStorm/TopicManagerI.h
+++ b/cpp/src/IceStorm/TopicManagerI.h
@@ -38,9 +38,9 @@ class TopicManagerI : public TopicManager, public IceUtil::Mutex
public:
TopicManagerI(const InstancePtr&,
- const Ice::ObjectAdapterPtr&,
- const std::string&,
- const std::string&);
+ const Ice::ObjectAdapterPtr&,
+ const std::string&,
+ const std::string&);
~TopicManagerI();
virtual TopicPrx create(const std::string&, const Ice::Current&);
diff --git a/cpp/src/IceUtil/Cond.cpp b/cpp/src/IceUtil/Cond.cpp
index ab59e63958e..0f895980c9a 100644
--- a/cpp/src/IceUtil/Cond.cpp
+++ b/cpp/src/IceUtil/Cond.cpp
@@ -20,7 +20,7 @@ IceUtil::Semaphore::Semaphore(long initial)
_sem = CreateSemaphore(0, initial, 0x7fffffff, 0);
if(_sem == INVALID_HANDLE_VALUE)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -35,7 +35,7 @@ IceUtil::Semaphore::wait() const
int rc = WaitForSingleObject(_sem, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -45,7 +45,7 @@ IceUtil::Semaphore::timedWait(const Time& timeout) const
int rc = WaitForSingleObject(_sem, static_cast<long>(timeout.toMilliSeconds()));
if(rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
return rc != WAIT_TIMEOUT;
}
@@ -56,7 +56,7 @@ IceUtil::Semaphore::post(int count) const
int rc = ReleaseSemaphore(_sem, count, 0);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -95,26 +95,26 @@ IceUtil::Cond::wake(bool broadcast)
if(_unblocked != 0)
{
- _blocked -= _unblocked;
- _unblocked = 0;
+ _blocked -= _unblocked;
+ _unblocked = 0;
}
if(_blocked > 0)
{
- //
- // Unblock some number of waiters.
- //
- _toUnblock = (broadcast) ? _blocked : 1;
- _internal.unlock();
- _queue.post();
+ //
+ // Unblock some number of waiters.
+ //
+ _toUnblock = (broadcast) ? _blocked : 1;
+ _internal.unlock();
+ _queue.post();
}
else
{
- //
- // Otherwise no blocked waiters, release gate & mutex.
- //
- _gate.post();
- _internal.unlock();
+ //
+ // Otherwise no blocked waiters, release gate & mutex.
+ //
+ _gate.post();
+ _internal.unlock();
}
}
@@ -134,26 +134,26 @@ IceUtil::Cond::postWait(bool timedOut) const
if(_toUnblock != 0)
{
- bool last = --_toUnblock == 0;
- _internal.unlock();
-
- if(timedOut)
- {
- _queue.wait();
- }
-
- if(last)
- {
- _gate.post();
- }
- else
- {
- _queue.post();
- }
+ bool last = --_toUnblock == 0;
+ _internal.unlock();
+
+ if(timedOut)
+ {
+ _queue.wait();
+ }
+
+ if(last)
+ {
+ _gate.post();
+ }
+ else
+ {
+ _queue.post();
+ }
}
else
{
- _internal.unlock();
+ _internal.unlock();
}
}
@@ -162,13 +162,13 @@ IceUtil::Cond::dowait() const
{
try
{
- _queue.wait();
- postWait(false);
+ _queue.wait();
+ postWait(false);
}
catch(...)
{
- postWait(false);
- throw;
+ postWait(false);
+ throw;
}
}
@@ -177,14 +177,14 @@ IceUtil::Cond::timedDowait(const Time& timeout) const
{
try
{
- bool rc = _queue.timedWait(timeout);
- postWait(!rc);
- return rc;
+ bool rc = _queue.timedWait(timeout);
+ postWait(!rc);
+ return rc;
}
catch(...)
{
- postWait(false);
- throw;
+ postWait(false);
+ throw;
}
}
@@ -199,19 +199,19 @@ IceUtil::Cond::Cond()
rc = pthread_condattr_init(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_cond_init(&_cond, &attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_condattr_destroy(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -228,7 +228,7 @@ IceUtil::Cond::signal()
int rc = pthread_cond_signal(&_cond);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -238,7 +238,7 @@ IceUtil::Cond::broadcast()
int rc = pthread_cond_broadcast(&_cond);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cpp/src/IceUtil/ConvertUTF.cpp b/cpp/src/IceUtil/ConvertUTF.cpp
index 34a827163f9..f44aea0f0b5 100755
--- a/cpp/src/IceUtil/ConvertUTF.cpp
+++ b/cpp/src/IceUtil/ConvertUTF.cpp
@@ -36,10 +36,10 @@
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
Sept 2001: fixed const & error conditions per
- mods suggested by S. Parent & A. Lillich.
+ mods suggested by S. Parent & A. Lillich.
June 2002: Tim Dodd added detection and handling of incomplete
- source sequences, enhanced error detection, added casts
- to eliminate compiler warnings.
+ source sequences, enhanced error detection, added casts
+ to eliminate compiler warnings.
July 2003: slight mods to back out aggressive FFFE detection.
Jan 2004: updated switches in from-UTF8 conversions.
Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
@@ -67,8 +67,8 @@ static const UTF32 halfMask = 0x3FFUL;
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
#define UNI_SUR_LOW_START (UTF32)0xDC00
#define UNI_SUR_LOW_END (UTF32)0xDFFF
-// #define false 0
-// #define true 1
+// #define false 0
+// #define true 1
/* --------------------------------------------------------------------- */
@@ -97,7 +97,7 @@ static const char trailingBytesForUTF8[256] = {
* in a UTF-8 sequence.
*/
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
- 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
+ 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
/*
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
@@ -121,67 +121,67 @@ static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
- ch = *source++;
- /* If we have a surrogate pair, convert to UTF32 first. */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
- /* If the 16 bits following the high surrogate are in the source buffer... */
- if (source < sourceEnd) {
- UTF32 ch2 = *source;
- /* If it's a low surrogate, convert to UTF32. */
- if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
- ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
- + (ch2 - UNI_SUR_LOW_START) + halfBase;
- ++source;
- } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- } else { /* We don't have the 16 bits following the high surrogate. */
- --source; /* return to the high surrogate */
- result = sourceExhausted;
- break;
- }
- } else if (flags == strictConversion) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /* Figure out how many bytes the result will require */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- source = oldSource; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ UTF32 ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /* Figure out how many bytes the result will require */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -206,19 +206,19 @@ static Boolean isLegalUTF8(const UTF8 *source, int length) {
const UTF8 *srcptr = source+length;
switch (length) {
default: return false;
- /* Everything else falls through when "true"... */
+ /* Everything else falls through when "true"... */
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
- switch (*source) {
- /* no fall-through in this inner switch */
- case 0xE0: if (a < 0xA0) return false; break;
- case 0xED: if (a > 0x9F) return false; break;
- case 0xF0: if (a < 0x90) return false; break;
- case 0xF4: if (a > 0x8F) return false; break;
- default: if (a < 0x80) return false;
- }
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0: if (a < 0xA0) return false; break;
+ case 0xED: if (a > 0x9F) return false; break;
+ case 0xF0: if (a < 0x90) return false; break;
+ case 0xF4: if (a > 0x8F) return false; break;
+ default: if (a < 0x80) return false;
+ }
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
}
@@ -238,89 +238,89 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
}
while(true) {
int length = trailingBytesForUTF8[*source]+1;
- // Is buffer big enough to contain character?
+ // Is buffer big enough to contain character?
if (source+length > sourceEnd) {
- return false;
+ return false;
}
- // Is character legal UTF8?
+ // Is character legal UTF8?
if(!isLegalUTF8(source, length)) {
- return false;
- }
- // Are we at end of buffer?
- source += length;
- if(source == sourceEnd) {
- return true;
- }
+ return false;
+ }
+ // Are we at end of buffer?
+ source += length;
+ if(source == sourceEnd) {
+ return true;
+ }
}
}
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF16* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = (UTF16)ch; /* normal case */
- }
- } else if (ch > UNI_MAX_UTF16) {
- if (flags == strictConversion) {
- result = sourceIllegal;
- source -= (extraBytesToRead+1); /* return to the start */
- break; /* Bail out; shouldn't continue */
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- /* target is a character in range 0xFFFF - 0x10FFFF. */
- if (target + 1 >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- ch -= halfBase;
- *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
- *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_UTF16) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ source -= (extraBytesToRead+1); /* return to the start */
+ break; /* Bail out; shouldn't continue */
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -330,50 +330,50 @@ ConversionResult ConvertUTF8toUTF16 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF32* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- ch = *source++;
- if (flags == strictConversion ) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /*
- * Figure out how many bytes the result will require. Turn any
- * illegally large UTF32 things (> Plane 17) into replacement chars.
- */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- result = sourceIllegal;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- --source; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ ch = *source++;
+ if (flags == strictConversion ) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /*
+ * Figure out how many bytes the result will require. Turn any
+ * illegally large UTF32 things (> Plane 17) into replacement chars.
+ */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ result = sourceIllegal;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ --source; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -383,59 +383,59 @@ ConversionResult ConvertUTF32toUTF8 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF32 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF32* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6;
- case 4: ch += *source++; ch <<= 6;
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up the source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_LEGAL_UTF32) {
- /*
- * UTF-16 surrogate values are illegal in UTF-32, and anything
- * over Plane 17 (> 0x10FFFF) is illegal.
- */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = ch;
- }
- } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
- result = sourceIllegal;
- *target++ = UNI_REPLACEMENT_CHAR;
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6;
+ case 4: ch += *source++; ch <<= 6;
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up the source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ /*
+ * UTF-16 surrogate values are illegal in UTF-32, and anything
+ * over Plane 17 (> 0x10FFFF) is illegal.
+ */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = ch;
+ }
+ } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
+ result = sourceIllegal;
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -448,14 +448,14 @@ ConversionResult ConvertUTF8toUTF32 (
The fall-through switches in UTF-8 reading code save a
temp variable, some decrements & conditionals. The switches
are equivalent to the following loop:
- {
- int tmpBytesToRead = extraBytesToRead+1;
- do {
- ch += *source++;
- --tmpBytesToRead;
- if (tmpBytesToRead) ch <<= 6;
- } while (tmpBytesToRead > 0);
- }
+ {
+ int tmpBytesToRead = extraBytesToRead+1;
+ do {
+ ch += *source++;
+ --tmpBytesToRead;
+ if (tmpBytesToRead) ch <<= 6;
+ } while (tmpBytesToRead > 0);
+ }
In UTF-8 writing code, the switches on "bytesToWrite" are
similarly unrolled loops.
diff --git a/cpp/src/IceUtil/ConvertUTF.h b/cpp/src/IceUtil/ConvertUTF.h
index daa2e98db52..a70e62fd1a9 100755
--- a/cpp/src/IceUtil/ConvertUTF.h
+++ b/cpp/src/IceUtil/ConvertUTF.h
@@ -60,12 +60,12 @@
the respective buffers.
Input parameters:
- sourceStart - pointer to a pointer to the source buffer.
- The contents of this are modified on return so that
- it points at the next thing to be converted.
- targetStart - similarly, pointer to pointer to the target buffer.
- sourceEnd, targetEnd - respectively pointers to the ends of the
- two buffers, for overflow checking only.
+ sourceStart - pointer to a pointer to the source buffer.
+ The contents of this are modified on return so that
+ it points at the next thing to be converted.
+ targetStart - similarly, pointer to pointer to the target buffer.
+ sourceEnd, targetEnd - respectively pointers to the ends of the
+ two buffers, for overflow checking only.
These conversion functions take a ConversionFlags argument. When this
flag is set to strict, both irregular sequences and isolated surrogates
@@ -82,15 +82,15 @@
they constitute an error.
Output parameters:
- The value "sourceIllegal" is returned from some routines if the input
- sequence is malformed. When "sourceIllegal" is returned, the source
- value will point to the illegal value that caused the problem. E.g.,
- in UTF-8 when a sequence is malformed, it points to the start of the
- malformed sequence.
+ The value "sourceIllegal" is returned from some routines if the input
+ sequence is malformed. When "sourceIllegal" is returned, the source
+ value will point to the illegal value that caused the problem. E.g.,
+ in UTF-8 when a sequence is malformed, it points to the start of the
+ malformed sequence.
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
- Fixes & updates, Sept 2001.
+ Fixes & updates, Sept 2001.
------------------------------------------------------------------------ */
@@ -105,10 +105,10 @@
namespace IceUtil
{
-typedef unsigned int UTF32; /* at least 32 bits */
-typedef unsigned short UTF16; /* at least 16 bits */
-typedef unsigned char UTF8; /* typically 8 bits */
-typedef bool Boolean; /* 0 or 1 */
+typedef unsigned int UTF32; /* at least 32 bits */
+typedef unsigned short UTF16; /* at least 16 bits */
+typedef unsigned char UTF8; /* typically 8 bits */
+typedef bool Boolean; /* 0 or 1 */
/* Some fundamental constants */
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
@@ -125,7 +125,7 @@ ConversionResult ConvertUTF8toUTF16(
ConversionResult ConvertUTF16toUTF8 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
+
ConversionResult ConvertUTF8toUTF32(
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
diff --git a/cpp/src/IceUtil/CountDownLatch.cpp b/cpp/src/IceUtil/CountDownLatch.cpp
index b30fe718242..c54cc51240d 100644
--- a/cpp/src/IceUtil/CountDownLatch.cpp
+++ b/cpp/src/IceUtil/CountDownLatch.cpp
@@ -15,26 +15,26 @@ IceUtil::CountDownLatch::CountDownLatch(int count) :
{
if(count < 0)
{
- throw Exception(__FILE__, __LINE__);
+ throw Exception(__FILE__, __LINE__);
}
#ifdef _WIN32
_event = CreateEvent(0, TRUE, FALSE, 0);
if(_event == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
#else
int rc = pthread_mutex_init(&_mutex, 0);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_cond_init(&_cond, 0);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#endif
}
@@ -58,24 +58,24 @@ IceUtil::CountDownLatch::await() const
#ifdef _WIN32
while(InterlockedExchangeAdd(&_count, 0) > 0)
{
- DWORD rc = WaitForSingleObject(_event, INFINITE);
- assert(rc == WAIT_OBJECT_0 || rc == WAIT_FAILED);
-
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ DWORD rc = WaitForSingleObject(_event, INFINITE);
+ assert(rc == WAIT_OBJECT_0 || rc == WAIT_FAILED);
+
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
#else
lock();
while(_count > 0)
{
- int rc = pthread_cond_wait(&_cond, &_mutex);
- if(rc != 0)
- {
- pthread_mutex_unlock(&_mutex);
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ int rc = pthread_cond_wait(&_cond, &_mutex);
+ if(rc != 0)
+ {
+ pthread_mutex_unlock(&_mutex);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
unlock();
@@ -88,10 +88,10 @@ IceUtil::CountDownLatch::countDown()
#ifdef _WIN32
if(InterlockedDecrement(&_count) == 0)
{
- if(SetEvent(_event) == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ if(SetEvent(_event) == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
#else
bool broadcast = false;
@@ -99,7 +99,7 @@ IceUtil::CountDownLatch::countDown()
lock();
if(_count > 0 && --_count == 0)
{
- broadcast = true;
+ broadcast = true;
}
#if defined(__APPLE__)
//
@@ -108,12 +108,12 @@ IceUtil::CountDownLatch::countDown()
//
if(broadcast)
{
- int rc = pthread_cond_broadcast(&_cond);
- if(rc != 0)
- {
- pthread_mutex_unlock(&_mutex);
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ int rc = pthread_cond_broadcast(&_cond);
+ if(rc != 0)
+ {
+ pthread_mutex_unlock(&_mutex);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
unlock();
@@ -122,11 +122,11 @@ IceUtil::CountDownLatch::countDown()
if(broadcast)
{
- int rc = pthread_cond_broadcast(&_cond);
- if(rc != 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ int rc = pthread_cond_broadcast(&_cond);
+ if(rc != 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
#endif
@@ -154,7 +154,7 @@ IceUtil::CountDownLatch::lock() const
int rc = pthread_mutex_lock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -164,7 +164,7 @@ IceUtil::CountDownLatch::unlock() const
int rc = pthread_mutex_unlock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cpp/src/IceUtil/CtrlCHandler.cpp b/cpp/src/IceUtil/CtrlCHandler.cpp
index a11f36f09a6..21338923e4b 100644
--- a/cpp/src/IceUtil/CtrlCHandler.cpp
+++ b/cpp/src/IceUtil/CtrlCHandler.cpp
@@ -70,7 +70,7 @@ static BOOL WINAPI handlerRoutine(DWORD dwCtrlType)
CtrlCHandlerCallback callback = _handler->getCallback();
if(callback != 0)
{
- callback(dwCtrlType);
+ callback(dwCtrlType);
}
return TRUE;
}
@@ -81,14 +81,14 @@ CtrlCHandler::CtrlCHandler(CtrlCHandlerCallback callback)
StaticMutex::Lock lock(globalMutex);
if(_handler != 0)
{
- throw CtrlCHandlerException(__FILE__, __LINE__);
+ throw CtrlCHandlerException(__FILE__, __LINE__);
}
else
{
- _callback = callback;
- _handler = this;
- lock.release();
- SetConsoleCtrlHandler(handlerRoutine, TRUE);
+ _callback = callback;
+ _handler = this;
+ lock.release();
+ SetConsoleCtrlHandler(handlerRoutine, TRUE);
}
}
@@ -96,8 +96,8 @@ CtrlCHandler::~CtrlCHandler()
{
SetConsoleCtrlHandler(handlerRoutine, FALSE);
{
- StaticMutex::Lock lock(globalMutex);
- _handler = 0;
+ StaticMutex::Lock lock(globalMutex);
+ _handler = 0;
}
}
@@ -120,38 +120,38 @@ sigwaitThread(void*)
//
for(;;)
{
- int signal = 0;
- int rc = sigwait(&ctrlCLikeSignals, &signal);
+ int signal = 0;
+ int rc = sigwait(&ctrlCLikeSignals, &signal);
#if defined(__APPLE__)
- //
- // WORKAROUND: sigwait is not a cancelation point on MacOS X. To cancel this thread, the
- // destructor cancels the thread and send a signal to the thread to unblock sigwait, then
- // we explicitly test for cancellation.
- //
- pthread_testcancel();
+ //
+ // WORKAROUND: sigwait is not a cancelation point on MacOS X. To cancel this thread, the
+ // destructor cancels the thread and send a signal to the thread to unblock sigwait, then
+ // we explicitly test for cancellation.
+ //
+ pthread_testcancel();
#endif
- //
- // Some sigwait() implementations incorrectly return EINTR
- // when interrupted by an unblocked caught signal
- //
- if(rc == EINTR)
- {
- continue;
- }
- assert(rc == 0);
-
- rc = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
- assert(rc == 0);
-
- CtrlCHandlerCallback callback = _handler->getCallback();
-
- if(callback != 0)
- {
- callback(signal);
- }
-
- rc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
- assert(rc == 0);
+ //
+ // Some sigwait() implementations incorrectly return EINTR
+ // when interrupted by an unblocked caught signal
+ //
+ if(rc == EINTR)
+ {
+ continue;
+ }
+ assert(rc == 0);
+
+ rc = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
+ assert(rc == 0);
+
+ CtrlCHandlerCallback callback = _handler->getCallback();
+
+ if(callback != 0)
+ {
+ callback(signal);
+ }
+
+ rc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
+ assert(rc == 0);
}
return 0;
}
@@ -164,29 +164,29 @@ CtrlCHandler::CtrlCHandler(CtrlCHandlerCallback callback)
StaticMutex::Lock lock(globalMutex);
if(_handler != 0)
{
- throw CtrlCHandlerException(__FILE__, __LINE__);
+ throw CtrlCHandlerException(__FILE__, __LINE__);
}
else
{
- _callback = callback;
- _handler = this;
- lock.release();
-
- // We block these CTRL+C like signals in the main thread,
- // and by default all other threads will inherit this signal
- // disposition.
-
- sigset_t ctrlCLikeSignals;
- sigemptyset(&ctrlCLikeSignals);
- sigaddset(&ctrlCLikeSignals, SIGHUP);
- sigaddset(&ctrlCLikeSignals, SIGINT);
- sigaddset(&ctrlCLikeSignals, SIGTERM);
- int rc = pthread_sigmask(SIG_BLOCK, &ctrlCLikeSignals, 0);
- assert(rc == 0);
-
- // Joinable thread
- rc = pthread_create(&_tid, 0, sigwaitThread, 0);
- assert(rc == 0);
+ _callback = callback;
+ _handler = this;
+ lock.release();
+
+ // We block these CTRL+C like signals in the main thread,
+ // and by default all other threads will inherit this signal
+ // disposition.
+
+ sigset_t ctrlCLikeSignals;
+ sigemptyset(&ctrlCLikeSignals);
+ sigaddset(&ctrlCLikeSignals, SIGHUP);
+ sigaddset(&ctrlCLikeSignals, SIGINT);
+ sigaddset(&ctrlCLikeSignals, SIGTERM);
+ int rc = pthread_sigmask(SIG_BLOCK, &ctrlCLikeSignals, 0);
+ assert(rc == 0);
+
+ // Joinable thread
+ rc = pthread_create(&_tid, 0, sigwaitThread, 0);
+ assert(rc == 0);
}
}
@@ -209,8 +209,8 @@ CtrlCHandler::~CtrlCHandler()
assert(status == PTHREAD_CANCELED);
#endif
{
- StaticMutex::Lock lock(globalMutex);
- _handler = 0;
+ StaticMutex::Lock lock(globalMutex);
+ _handler = 0;
}
}
diff --git a/cpp/src/IceUtil/Exception.cpp b/cpp/src/IceUtil/Exception.cpp
index c7619eadcd3..adcced92d33 100644
--- a/cpp/src/IceUtil/Exception.cpp
+++ b/cpp/src/IceUtil/Exception.cpp
@@ -47,7 +47,7 @@ IceUtil::Exception::ice_print(ostream& out) const
{
if(_file && _line > 0)
{
- out << _file << ':' << _line << ": ";
+ out << _file << ':' << _line << ": ";
}
out << ice_name();
}
@@ -88,7 +88,7 @@ IceUtil::NullHandleException::NullHandleException(const char* file, int line) :
{
if(nullHandleAbort)
{
- abort();
+ abort();
}
}
diff --git a/cpp/src/IceUtil/InputUtil.cpp b/cpp/src/IceUtil/InputUtil.cpp
index b8cdb278e9f..293bd8b2107 100644
--- a/cpp/src/IceUtil/InputUtil.cpp
+++ b/cpp/src/IceUtil/InputUtil.cpp
@@ -36,11 +36,11 @@ static const string allDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//
static const char digitVal[] =
{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // '0' - '9'
- 100, 100, 100, 100, 100, 100, 100, // punctuation
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 'A' - 'J'
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 'K' - 'T'
- 30, 31, 32, 33, 34, 35 // 'U' - 'Z'
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // '0' - '9'
+ 100, 100, 100, 100, 100, 100, 100, // punctuation
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 'A' - 'J'
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 'K' - 'T'
+ 30, 31, 32, 33, 34, 35 // 'U' - 'Z'
};
static IceUtil::Int64
@@ -51,7 +51,7 @@ strToInt64Impl(const char* s, char** endptr, int base)
//
if(endptr)
{
- *endptr = const_cast<char *>(s);
+ *endptr = const_cast<char *>(s);
}
//
@@ -59,7 +59,7 @@ strToInt64Impl(const char* s, char** endptr, int base)
//
while(*s && isspace(*s))
{
- ++s;
+ ++s;
}
//
@@ -68,12 +68,12 @@ strToInt64Impl(const char* s, char** endptr, int base)
int sign = 1;
if(*s == '+')
{
- ++s;
+ ++s;
}
else if(*s == '-')
{
- sign = -1;
- ++s;
+ sign = -1;
+ ++s;
}
//
@@ -81,34 +81,34 @@ strToInt64Impl(const char* s, char** endptr, int base)
//
if(base == 0)
{
- if(*s == '0')
- {
- base = 8;
- ++s;
-
- //
- // We have at least this zero
- //
- if(endptr)
- {
- *endptr = const_cast<char *>(s);
- }
-
- if(*s == 'x' || *s == 'X')
- {
- base = 16;
- ++s;
- }
- }
- else
- {
- base = 10;
- }
+ if(*s == '0')
+ {
+ base = 8;
+ ++s;
+
+ //
+ // We have at least this zero
+ //
+ if(endptr)
+ {
+ *endptr = const_cast<char *>(s);
+ }
+
+ if(*s == 'x' || *s == 'X')
+ {
+ base = 16;
+ ++s;
+ }
+ }
+ else
+ {
+ base = 10;
+ }
}
else if(base < 2 || base > 36)
{
- errno = EINVAL;
- return 0;
+ errno = EINVAL;
+ return 0;
}
//
@@ -116,10 +116,10 @@ strToInt64Impl(const char* s, char** endptr, int base)
//
if(*s == '\0')
{
- //
- // We did not read any new digit so we don't update endptr
- //
- return 0;
+ //
+ // We did not read any new digit so we don't update endptr
+ //
+ return 0;
}
Int64 result = 0;
@@ -127,43 +127,43 @@ strToInt64Impl(const char* s, char** endptr, int base)
bool digitFound = false;
const string validDigits(allDigits.begin(), allDigits.begin() + base);
while(*s && validDigits.find_first_of(toupper(*s)) != validDigits.npos)
- {
- digitFound = true;
- if(!overflow)
- {
- int digit = digitVal[toupper(*s) - '0'];
- assert(digit != 100);
- if(result < _I64_MAX / base)
- {
- result *= base;
- result += digit;
- }
- else if((digit <= _I64_MAX % base) || (sign == -1 && digit == _I64_MAX % base + 1))
- {
- result *= base;
- result += digit;
- }
- else
- {
- overflow = true;
- result = sign == -1 ? _I64_MIN : _I64_MAX;
- }
- }
- ++s;
+ {
+ digitFound = true;
+ if(!overflow)
+ {
+ int digit = digitVal[toupper(*s) - '0'];
+ assert(digit != 100);
+ if(result < _I64_MAX / base)
+ {
+ result *= base;
+ result += digit;
+ }
+ else if((digit <= _I64_MAX % base) || (sign == -1 && digit == _I64_MAX % base + 1))
+ {
+ result *= base;
+ result += digit;
+ }
+ else
+ {
+ overflow = true;
+ result = sign == -1 ? _I64_MIN : _I64_MAX;
+ }
+ }
+ ++s;
}
if(overflow)
{
- errno = ERANGE;
+ errno = ERANGE;
}
else
{
- result *= sign;
+ result *= sign;
}
if(digitFound && endptr != 0)
{
- *endptr = const_cast<char *>(s);
+ *endptr = const_cast<char *>(s);
}
return result;
diff --git a/cpp/src/IceUtil/MD5I.cpp b/cpp/src/IceUtil/MD5I.cpp
index dc96955a36a..ac5be31483e 100644
--- a/cpp/src/IceUtil/MD5I.cpp
+++ b/cpp/src/IceUtil/MD5I.cpp
@@ -27,7 +27,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
- http://www.ietf.org/rfc/rfc1321.txt
+ http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
@@ -38,14 +38,14 @@
that follows (in reverse chronological order):
2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
- either statically or dynamically; added missing #include <string.h>
- in library.
+ either statically or dynamically; added missing #include <string.h>
+ in library.
2002-03-11 lpd Corrected argument list for main(), and added int return
- type, in test program and T value program.
+ type, in test program and T value program.
2002-02-21 lpd Added missing #include <stdio.h> in test program.
2000-07-03 lpd Patched to eliminate warnings about "constant is
- unsigned in ANSI C, signed in traditional"; made test program
- self-checking.
+ unsigned in ANSI C, signed in traditional"; made test program
+ self-checking.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
1999-05-03 lpd Original version.
@@ -54,7 +54,7 @@
#include <IceUtil/MD5I.h>
#include <string.h>
-#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
+#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
#ifdef ARCH_IS_BIG_ENDIAN
# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
#else
@@ -132,8 +132,8 @@ static void
md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
{
md5_word_t
- a = pms->abcd[0], b = pms->abcd[1],
- c = pms->abcd[2], d = pms->abcd[3];
+ a = pms->abcd[0], b = pms->abcd[1],
+ c = pms->abcd[2], d = pms->abcd[3];
md5_word_t t;
#if BYTE_ORDER > 0
/* Define storage only for big-endian CPUs. */
@@ -146,51 +146,51 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
{
#if BYTE_ORDER == 0
- /*
- * Determine dynamically whether this is a big-endian or
- * little-endian machine, since we can use a more efficient
- * algorithm on the latter.
- */
- static const int w = 1;
-
- if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
+ /*
+ * Determine dynamically whether this is a big-endian or
+ * little-endian machine, since we can use a more efficient
+ * algorithm on the latter.
+ */
+ static const int w = 1;
+
+ if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
#endif
-#if BYTE_ORDER <= 0 /* little-endian */
- {
- /*
- * On little-endian machines, we can process properly aligned
- * data without copying it.
- */
- if (!((data - (const md5_byte_t *)0) & 3)) {
- /* data are properly aligned */
- X = (const md5_word_t *)data;
- } else {
- /* not aligned */
- memcpy(xbuf, data, 64);
- X = xbuf;
- }
- }
+#if BYTE_ORDER <= 0 /* little-endian */
+ {
+ /*
+ * On little-endian machines, we can process properly aligned
+ * data without copying it.
+ */
+ if (!((data - (const md5_byte_t *)0) & 3)) {
+ /* data are properly aligned */
+ X = (const md5_word_t *)data;
+ } else {
+ /* not aligned */
+ memcpy(xbuf, data, 64);
+ X = xbuf;
+ }
+ }
#endif
#if BYTE_ORDER == 0
- else /* dynamic big-endian */
+ else /* dynamic big-endian */
#endif
-#if BYTE_ORDER >= 0 /* big-endian */
- {
- /*
- * On big-endian machines, we must arrange the bytes in the
- * right order.
- */
- const md5_byte_t *xp = data;
- int i;
+#if BYTE_ORDER >= 0 /* big-endian */
+ {
+ /*
+ * On big-endian machines, we must arrange the bytes in the
+ * right order.
+ */
+ const md5_byte_t *xp = data;
+ int i;
# if BYTE_ORDER == 0
- X = xbuf; /* (dynamic only) */
+ X = xbuf; /* (dynamic only) */
# else
-# define xbuf X /* (static only) */
+# define xbuf X /* (static only) */
# endif
- for (i = 0; i < 16; ++i, xp += 4)
- xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
- }
+ for (i = 0; i < 16; ++i, xp += 4)
+ xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+ }
#endif
}
@@ -328,54 +328,54 @@ md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
md5_word_t nbits = (md5_word_t)(nbytes << 3);
if (nbytes <= 0)
- return;
+ return;
/* Update the message length. */
pms->count[1] += nbytes >> 29;
pms->count[0] += nbits;
if (pms->count[0] < nbits)
- pms->count[1]++;
+ pms->count[1]++;
/* Process an initial partial block. */
if (offset) {
- int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
-
- memcpy(pms->buf + offset, p, copy);
- if (offset + copy < 64)
- return;
- p += copy;
- left -= copy;
- md5_process(pms, pms->buf);
+ int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
+
+ memcpy(pms->buf + offset, p, copy);
+ if (offset + copy < 64)
+ return;
+ p += copy;
+ left -= copy;
+ md5_process(pms, pms->buf);
}
/* Process full blocks. */
for (; left >= 64; p += 64, left -= 64)
- md5_process(pms, p);
+ md5_process(pms, p);
/* Process a final partial block. */
if (left)
- memcpy(pms->buf, p, left);
+ memcpy(pms->buf, p, left);
}
void
md5_finish(md5_state_t *pms, md5_byte_t digest[16])
{
static const md5_byte_t pad[64] = {
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
md5_byte_t data[8];
int i;
/* Save the length before padding. */
for (i = 0; i < 8; ++i)
- data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
+ data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
/* Pad to 56 bytes mod 64. */
md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
md5_append(pms, data, 8);
for (i = 0; i < 16; ++i)
- digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
+ digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
diff --git a/cpp/src/IceUtil/MD5I.h b/cpp/src/IceUtil/MD5I.h
index 5eb6d6c469c..66588283e83 100644
--- a/cpp/src/IceUtil/MD5I.h
+++ b/cpp/src/IceUtil/MD5I.h
@@ -27,7 +27,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
- http://www.ietf.org/rfc/rfc1321.txt
+ http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
@@ -38,12 +38,12 @@
that follows (in reverse chronological order):
2002-04-13 lpd Removed support for non-ANSI compilers; removed
- references to Ghostscript; clarified derivation from RFC 1321;
- now handles byte order either statically or dynamically.
+ references to Ghostscript; clarified derivation from RFC 1321;
+ now handles byte order either statically or dynamically.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
- added conditionalization for C++ compilation from Martin
- Purschke <purschke@bnl.gov>.
+ added conditionalization for C++ compilation from Martin
+ Purschke <purschke@bnl.gov>.
1999-05-03 lpd Original version.
*/
@@ -65,9 +65,9 @@ typedef unsigned int md5_word_t; /* 32-bit word */
/* Define the state of the MD5 Algorithm. */
typedef struct md5_state_s {
- md5_word_t count[2]; /* message length in bits, lsw first */
- md5_word_t abcd[4]; /* digest buffer */
- md5_byte_t buf[64]; /* accumulate block */
+ md5_word_t count[2]; /* message length in bits, lsw first */
+ md5_word_t abcd[4]; /* digest buffer */
+ md5_byte_t buf[64]; /* accumulate block */
} md5_state_t;
#ifdef __cplusplus
diff --git a/cpp/src/IceUtil/Options.cpp b/cpp/src/IceUtil/Options.cpp
index c8fc3635177..9fe71cc1311 100755
--- a/cpp/src/IceUtil/Options.cpp
+++ b/cpp/src/IceUtil/Options.cpp
@@ -36,7 +36,7 @@ IceUtil::APIException::ice_print(ostream& out) const
Exception::ice_print(out);
if(!reason.empty())
{
- out << ": " << reason;
+ out << ": " << reason;
}
}
@@ -82,7 +82,7 @@ IceUtil::BadOptException::ice_print(ostream& out) const
Exception::ice_print(out);
if(!reason.empty())
{
- out << ": " << reason;
+ out << ": " << reason;
}
}
@@ -120,51 +120,51 @@ IceUtil::Options::checkArgs(const string& shortOpt, const string& longOpt, bool
if(!shortOpt.empty())
{
- if(shortOpt.size() != 1)
- {
- string err = "`";
- err += shortOpt;
- err += "': a short option cannot specify more than one option";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
- }
- if(shortOpt.find_first_of(" \t\n\r\f\v") != string::npos)
- {
- string err = "`";
- err += shortOpt;
- err += "': a short option cannot be whitespace";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
- }
- if(shortOpt[0] == '-')
- {
- string err = "`";
- err += shortOpt;
- err += "': a short option cannot be `-'";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
- }
+ if(shortOpt.size() != 1)
+ {
+ string err = "`";
+ err += shortOpt;
+ err += "': a short option cannot specify more than one option";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
+ }
+ if(shortOpt.find_first_of(" \t\n\r\f\v") != string::npos)
+ {
+ string err = "`";
+ err += shortOpt;
+ err += "': a short option cannot be whitespace";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
+ }
+ if(shortOpt[0] == '-')
+ {
+ string err = "`";
+ err += shortOpt;
+ err += "': a short option cannot be `-'";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
+ }
}
if(!longOpt.empty())
{
- if(longOpt.find_first_of(" \t\n\r\f\v") != string::npos)
- {
- string err = "`";
- err += longOpt;
- err += "': a long option cannot contain whitespace";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
- }
- if(longOpt[0] == '-')
- {
- string err = "`";
- err += longOpt;
- err += "': a long option must not contain a leading `-'";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
- }
+ if(longOpt.find_first_of(" \t\n\r\f\v") != string::npos)
+ {
+ string err = "`";
+ err += longOpt;
+ err += "': a long option cannot contain whitespace";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
+ }
+ if(longOpt[0] == '-')
+ {
+ string err = "`";
+ err += longOpt;
+ err += "': a long option must not contain a leading `-'";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
+ }
}
if(!needArg && !dflt.empty())
{
- throw IllegalArgumentException(__FILE__, __LINE__,
- "a default value can be specified only for options requiring an argument");
+ throw IllegalArgumentException(__FILE__, __LINE__,
+ "a default value can be specified only for options requiring an argument");
}
}
@@ -175,7 +175,7 @@ IceUtil::Options::addOpt(const string& shortOpt, const string& longOpt, ArgType
if(parseCalled)
{
- throw APIException(__FILE__, __LINE__, "cannot add options after parse() was called");
+ throw APIException(__FILE__, __LINE__, "cannot add options after parse() was called");
}
checkArgs(shortOpt, longOpt, at == NeedArg, dflt);
@@ -217,361 +217,361 @@ IceUtil::Options::split(const string& line)
for(string::size_type i = 0; i < l.size(); ++i)
{
- char c = l[i];
+ char c = l[i];
switch(state)
- {
- case Normal:
- {
- switch(c)
- {
- case '\\':
- {
- //
- // Ignore a backslash at the end of the string,
- // and strip backslash-newline pairs. If a
- // backslash is followed by a space, single quote,
- // double quote, or dollar sign, we drop the backslash
- // and write the space, single quote, double quote,
- // or dollar sign. This is necessary to allow quotes
- // to be escaped. Dropping the backslash preceding a
- // space deviates from bash quoting rules, but is
- // necessary so we don't drop backslashes from Windows
- // path names.)
- //
- if(i < l.size() - 1 && l[++i] != '\n')
- {
- switch(l[i])
- {
- case ' ':
- case '$':
- case '\'':
- case '"':
- {
- arg.push_back(l[i]);
- break;
- }
- default:
- {
- arg.push_back('\\');
- arg.push_back(l[i]);
- break;
- }
- }
- }
- break;
- }
- case '\'':
- {
- state = SingleQuote;
- break;
- }
- case '"':
- {
- state = DoubleQuote;
- break;
- }
- case '$':
- {
- if(i < l.size() - 1 && l[i + 1] == '\'')
- {
- state = ANSIQuote; // Bash uses $'<text>' to allow ANSI escape sequences within <text>.
- ++i;
- }
- else
- {
- arg.push_back('$');
- }
- break;
- }
- default:
- {
- if(IFS.find(l[i]) != string::npos)
- {
- vec.push_back(arg);
- arg.clear();
-
- //
- // Move to start of next argument.
- //
- while(++i < l.size() && IFS.find(l[i]) != string::npos)
- {
- ;
- }
- --i;
- }
- else
- {
- arg.push_back(l[i]);
- }
- break;
- }
- }
- break;
- }
- case DoubleQuote:
- {
- //
- // Within double quotes, only backslash retains its special
- // meaning, and only if followed by double quote, backslash,
- // or newline. If not followed by one of these characters,
- // both the backslash and the character are preserved.
- //
- if(c == '\\' && i < l.size() - 1)
- {
- switch(c = l[++i])
- {
- case '"':
- case '\\':
- case '\n':
- {
- arg.push_back(c);
- break;
- }
- default:
- {
- arg.push_back('\\');
- arg.push_back(c);
- break;
- }
- }
- }
- else if(c == '"') // End of double-quote mode.
- {
- state = Normal;
- }
- else
- {
- arg.push_back(c); // Everything else is taken literally.
- }
- break;
- }
- case SingleQuote:
- {
- if(c == '\'') // End of single-quote mode.
- {
- state = Normal;
- }
- else
- {
- arg.push_back(c); // Everything else is taken literally.
- }
- break;
- }
- case ANSIQuote:
- {
- switch(c)
- {
- case '\\':
- {
- if(i == l.size() - 1)
- {
- break;
- }
- switch(c = l[++i])
- {
- //
- // Single-letter escape sequences.
- //
- case 'a':
- {
- arg.push_back('\a');
- break;
- }
- case 'b':
- {
- arg.push_back('\b');
- break;
- }
- case 'f':
- {
- arg.push_back('\f');
- break;
- }
- case 'n':
- {
- arg.push_back('\n');
- break;
- }
- case 'r':
- {
- arg.push_back('\r');
- break;
- }
- case 't':
- {
- arg.push_back('\t');
- break;
- }
- case 'v':
- {
- arg.push_back('\v');
- break;
- }
- case '\\':
- {
- arg.push_back('\\');
- break;
- }
- case '\'':
- {
- arg.push_back('\'');
- break;
- }
- case 'e': // Not ANSI-C, but used by bash.
- {
- arg.push_back('\033');
- break;
- }
-
- //
- // Process up to three octal digits.
- //
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- static string octalDigits = "01234567";
- unsigned short us = 0;
- string::size_type j;
- for(j = i;
- j < i + 3 && j < l.size() && octalDigits.find_first_of(c = l[j]) != string::npos;
- ++j)
- {
- us = us * 8 + c - '0';
- }
- i = j - 1;
- arg.push_back(static_cast<char>(us));
- break;
- }
-
- //
- // Process up to two hex digits.
- //
- case 'x':
- {
- if(i < l.size() - 1 && !isxdigit(l[i + 1]))
- {
- arg.push_back('\\');
- arg.push_back('x');
- break;
- }
-
- IceUtil::Int64 ull = 0;
- string::size_type j;
- for(j = i + 1; j < i + 3 && j < l.size() && isxdigit(c = l[j]); ++j)
- {
- ull *= 16;
- if(isdigit(c))
- {
- ull += c - '0';
- }
- else if(islower(c))
- {
- ull += c - 'a' + 10;
- }
- else
- {
- ull += c - 'A' + 10;
- }
- }
- i = j - 1;
- arg.push_back(static_cast<char>(ull));
- break;
- }
-
- //
- // Process control-chars.
- //
- case 'c':
- {
- c = l[++i];
- if(isalpha(c) || c == '@' || (c >= '[' && c <= '_'))
- {
- arg.push_back(static_cast<char>(toupper(c) - '@'));
- }
- else
- {
- //
- // Bash does not define what should happen if a \c
- // is not followed by a recognized control character.
- // We simply treat this case like other unrecognized
- // escape sequences, that is, we preserve the escape
- // sequence unchanged.
- //
- arg.push_back('\\');
- arg.push_back('c');
- arg.push_back(c);
- }
- break;
- }
-
- //
- // If inside an ANSI-quoted string, a backslash isn't followed by
- // one of the recognized characters, both the backslash and the
- // character are preserved.
- //
- default:
- {
- arg.push_back('\\');
- arg.push_back(c);
- break;
- }
- }
- break;
- }
- case '\'': // End of ANSI-quote mode.
- {
- state = Normal;
- break;
- }
- default:
- {
- arg.push_back(c); // Everything else is taken literally.
- break;
- }
- }
- break;
- }
- default:
- {
- assert(!"Impossible parse state");
- break;
- }
- }
+ {
+ case Normal:
+ {
+ switch(c)
+ {
+ case '\\':
+ {
+ //
+ // Ignore a backslash at the end of the string,
+ // and strip backslash-newline pairs. If a
+ // backslash is followed by a space, single quote,
+ // double quote, or dollar sign, we drop the backslash
+ // and write the space, single quote, double quote,
+ // or dollar sign. This is necessary to allow quotes
+ // to be escaped. Dropping the backslash preceding a
+ // space deviates from bash quoting rules, but is
+ // necessary so we don't drop backslashes from Windows
+ // path names.)
+ //
+ if(i < l.size() - 1 && l[++i] != '\n')
+ {
+ switch(l[i])
+ {
+ case ' ':
+ case '$':
+ case '\'':
+ case '"':
+ {
+ arg.push_back(l[i]);
+ break;
+ }
+ default:
+ {
+ arg.push_back('\\');
+ arg.push_back(l[i]);
+ break;
+ }
+ }
+ }
+ break;
+ }
+ case '\'':
+ {
+ state = SingleQuote;
+ break;
+ }
+ case '"':
+ {
+ state = DoubleQuote;
+ break;
+ }
+ case '$':
+ {
+ if(i < l.size() - 1 && l[i + 1] == '\'')
+ {
+ state = ANSIQuote; // Bash uses $'<text>' to allow ANSI escape sequences within <text>.
+ ++i;
+ }
+ else
+ {
+ arg.push_back('$');
+ }
+ break;
+ }
+ default:
+ {
+ if(IFS.find(l[i]) != string::npos)
+ {
+ vec.push_back(arg);
+ arg.clear();
+
+ //
+ // Move to start of next argument.
+ //
+ while(++i < l.size() && IFS.find(l[i]) != string::npos)
+ {
+ ;
+ }
+ --i;
+ }
+ else
+ {
+ arg.push_back(l[i]);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ case DoubleQuote:
+ {
+ //
+ // Within double quotes, only backslash retains its special
+ // meaning, and only if followed by double quote, backslash,
+ // or newline. If not followed by one of these characters,
+ // both the backslash and the character are preserved.
+ //
+ if(c == '\\' && i < l.size() - 1)
+ {
+ switch(c = l[++i])
+ {
+ case '"':
+ case '\\':
+ case '\n':
+ {
+ arg.push_back(c);
+ break;
+ }
+ default:
+ {
+ arg.push_back('\\');
+ arg.push_back(c);
+ break;
+ }
+ }
+ }
+ else if(c == '"') // End of double-quote mode.
+ {
+ state = Normal;
+ }
+ else
+ {
+ arg.push_back(c); // Everything else is taken literally.
+ }
+ break;
+ }
+ case SingleQuote:
+ {
+ if(c == '\'') // End of single-quote mode.
+ {
+ state = Normal;
+ }
+ else
+ {
+ arg.push_back(c); // Everything else is taken literally.
+ }
+ break;
+ }
+ case ANSIQuote:
+ {
+ switch(c)
+ {
+ case '\\':
+ {
+ if(i == l.size() - 1)
+ {
+ break;
+ }
+ switch(c = l[++i])
+ {
+ //
+ // Single-letter escape sequences.
+ //
+ case 'a':
+ {
+ arg.push_back('\a');
+ break;
+ }
+ case 'b':
+ {
+ arg.push_back('\b');
+ break;
+ }
+ case 'f':
+ {
+ arg.push_back('\f');
+ break;
+ }
+ case 'n':
+ {
+ arg.push_back('\n');
+ break;
+ }
+ case 'r':
+ {
+ arg.push_back('\r');
+ break;
+ }
+ case 't':
+ {
+ arg.push_back('\t');
+ break;
+ }
+ case 'v':
+ {
+ arg.push_back('\v');
+ break;
+ }
+ case '\\':
+ {
+ arg.push_back('\\');
+ break;
+ }
+ case '\'':
+ {
+ arg.push_back('\'');
+ break;
+ }
+ case 'e': // Not ANSI-C, but used by bash.
+ {
+ arg.push_back('\033');
+ break;
+ }
+
+ //
+ // Process up to three octal digits.
+ //
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ static string octalDigits = "01234567";
+ unsigned short us = 0;
+ string::size_type j;
+ for(j = i;
+ j < i + 3 && j < l.size() && octalDigits.find_first_of(c = l[j]) != string::npos;
+ ++j)
+ {
+ us = us * 8 + c - '0';
+ }
+ i = j - 1;
+ arg.push_back(static_cast<char>(us));
+ break;
+ }
+
+ //
+ // Process up to two hex digits.
+ //
+ case 'x':
+ {
+ if(i < l.size() - 1 && !isxdigit(l[i + 1]))
+ {
+ arg.push_back('\\');
+ arg.push_back('x');
+ break;
+ }
+
+ IceUtil::Int64 ull = 0;
+ string::size_type j;
+ for(j = i + 1; j < i + 3 && j < l.size() && isxdigit(c = l[j]); ++j)
+ {
+ ull *= 16;
+ if(isdigit(c))
+ {
+ ull += c - '0';
+ }
+ else if(islower(c))
+ {
+ ull += c - 'a' + 10;
+ }
+ else
+ {
+ ull += c - 'A' + 10;
+ }
+ }
+ i = j - 1;
+ arg.push_back(static_cast<char>(ull));
+ break;
+ }
+
+ //
+ // Process control-chars.
+ //
+ case 'c':
+ {
+ c = l[++i];
+ if(isalpha(c) || c == '@' || (c >= '[' && c <= '_'))
+ {
+ arg.push_back(static_cast<char>(toupper(c) - '@'));
+ }
+ else
+ {
+ //
+ // Bash does not define what should happen if a \c
+ // is not followed by a recognized control character.
+ // We simply treat this case like other unrecognized
+ // escape sequences, that is, we preserve the escape
+ // sequence unchanged.
+ //
+ arg.push_back('\\');
+ arg.push_back('c');
+ arg.push_back(c);
+ }
+ break;
+ }
+
+ //
+ // If inside an ANSI-quoted string, a backslash isn't followed by
+ // one of the recognized characters, both the backslash and the
+ // character are preserved.
+ //
+ default:
+ {
+ arg.push_back('\\');
+ arg.push_back(c);
+ break;
+ }
+ }
+ break;
+ }
+ case '\'': // End of ANSI-quote mode.
+ {
+ state = Normal;
+ break;
+ }
+ default:
+ {
+ arg.push_back(c); // Everything else is taken literally.
+ break;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ assert(!"Impossible parse state");
+ break;
+ }
+ }
}
switch(state)
{
- case Normal:
- {
- vec.push_back(arg);
- break;
- }
- case SingleQuote:
- {
- throw BadOptException(__FILE__, __LINE__, "missing closing single quote");
- break;
- }
- case DoubleQuote:
- {
- throw BadOptException(__FILE__, __LINE__, "missing closing double quote");
- break;
- }
- case ANSIQuote:
- {
- throw BadOptException(__FILE__, __LINE__, "unterminated $' quote");
- break;
- }
- default:
- {
- assert(!"Impossible parse state");
- break;
- }
+ case Normal:
+ {
+ vec.push_back(arg);
+ break;
+ }
+ case SingleQuote:
+ {
+ throw BadOptException(__FILE__, __LINE__, "missing closing single quote");
+ break;
+ }
+ case DoubleQuote:
+ {
+ throw BadOptException(__FILE__, __LINE__, "missing closing double quote");
+ break;
+ }
+ case ANSIQuote:
+ {
+ throw BadOptException(__FILE__, __LINE__, "unterminated $' quote");
+ break;
+ }
+ default:
+ {
+ assert(!"Impossible parse state");
+ break;
+ }
}
return vec;
@@ -592,7 +592,7 @@ IceUtil::Options::parse(const StringVector& args)
if(parseCalled)
{
- throw APIException(__FILE__, __LINE__, "cannot call parse() more than once on the same Option instance");
+ throw APIException(__FILE__, __LINE__, "cannot call parse() more than once on the same Option instance");
}
parseCalled = true;
@@ -603,133 +603,133 @@ IceUtil::Options::parse(const StringVector& args)
string::size_type i;
for(i = 1; i < args.size(); ++i)
{
- if(args[i] == "-" || args[i] == "--")
- {
- ++i;
- break; // "-" and "--" indicate end of options.
- }
-
- string opt;
- ValidOpts::iterator pos;
+ if(args[i] == "-" || args[i] == "--")
+ {
+ ++i;
+ break; // "-" and "--" indicate end of options.
+ }
+
+ string opt;
+ ValidOpts::iterator pos;
bool argDone = false;
- if(args[i].compare(0, 2, "--") == 0)
- {
- //
- // Long option. If the option has an argument, it can either be separated by '='
- // or appear as a separate argument. For example, "--name value" is the same
- // as "--name=value".
- //
- string::size_type p = args[i].find('=', 2);
- if(p != string::npos)
- {
- opt = args[i].substr(2, p - 2);
- }
- else
- {
- opt = args[i].substr(2);
- }
-
- pos = checkOpt(opt, LongOpt);
-
- if(pos->second->repeat == NoRepeat)
- {
- set<string>::iterator seenPos = seenNonRepeatableOpts.find(opt);
- if(seenPos != seenNonRepeatableOpts.end())
- {
- string err = "`--";
- err += opt + ":' option cannot be repeated";
- throw BadOptException(__FILE__, __LINE__, err);
- }
- seenNonRepeatableOpts.insert(seenPos, opt);
- string synonym = getSynonym(opt);
- if(!synonym.empty())
- {
- seenNonRepeatableOpts.insert(synonym);
- }
- }
-
- if(p != string::npos)
- {
- if(pos->second->arg == NoArg && p != args[i].size() - 1)
- {
- string err = "`";
- err += args[i];
- err += "': option does not take an argument";
- throw BadOptException(__FILE__, __LINE__, err);
- }
- setOpt(opt, "", args[i].substr(p + 1), pos->second->repeat);
- argDone = true;
- }
- }
- else if(!args[i].empty() && args[i][0] == '-')
- {
- //
- // Short option.
- //
- for(string::size_type p = 1; p < args[i].size(); ++p)
- {
- opt.clear();
- opt.push_back(args[i][p]);
- pos = checkOpt(opt, ShortOpt);
-
- if(pos->second->repeat == NoRepeat)
- {
- set<string>::iterator seenPos = seenNonRepeatableOpts.find(opt);
- if(seenPos != seenNonRepeatableOpts.end())
- {
- string err = "`-";
- err += opt + ":' option cannot be repeated";
- throw BadOptException(__FILE__, __LINE__, err);
- }
- seenNonRepeatableOpts.insert(seenPos, opt);
- string synonym = getSynonym(opt);
- if(!synonym.empty())
- {
- seenNonRepeatableOpts.insert(synonym);
- }
- }
-
- if(pos->second->arg == NeedArg && p != args[i].size() - 1)
- {
- string optArg = args[i].substr(p + 1);
- setOpt(opt, "", optArg, pos->second->repeat);
- argDone = true;
- break;
- }
- }
- }
- else
- {
- //
- // Not an option or option argument.
- //
- result.push_back(args[i]);
- argDone = true;
- }
-
- if(!argDone)
- {
- if(pos->second->arg == NeedArg) // Need an argument that is separated by whitespace.
- {
- if(i == args.size() - 1)
- {
- string err = "`-";
- if(opt.size() != 1)
- {
- err += "-";
- }
- err += opt;
- err += "' option requires an argument";
- throw BadOptException(__FILE__, __LINE__, err);
- }
- setOpt(opt, "", args[++i], pos->second->repeat);
- }
- else
- {
- setOpt(opt, "", "1", pos->second->repeat);
- }
- }
+ if(args[i].compare(0, 2, "--") == 0)
+ {
+ //
+ // Long option. If the option has an argument, it can either be separated by '='
+ // or appear as a separate argument. For example, "--name value" is the same
+ // as "--name=value".
+ //
+ string::size_type p = args[i].find('=', 2);
+ if(p != string::npos)
+ {
+ opt = args[i].substr(2, p - 2);
+ }
+ else
+ {
+ opt = args[i].substr(2);
+ }
+
+ pos = checkOpt(opt, LongOpt);
+
+ if(pos->second->repeat == NoRepeat)
+ {
+ set<string>::iterator seenPos = seenNonRepeatableOpts.find(opt);
+ if(seenPos != seenNonRepeatableOpts.end())
+ {
+ string err = "`--";
+ err += opt + ":' option cannot be repeated";
+ throw BadOptException(__FILE__, __LINE__, err);
+ }
+ seenNonRepeatableOpts.insert(seenPos, opt);
+ string synonym = getSynonym(opt);
+ if(!synonym.empty())
+ {
+ seenNonRepeatableOpts.insert(synonym);
+ }
+ }
+
+ if(p != string::npos)
+ {
+ if(pos->second->arg == NoArg && p != args[i].size() - 1)
+ {
+ string err = "`";
+ err += args[i];
+ err += "': option does not take an argument";
+ throw BadOptException(__FILE__, __LINE__, err);
+ }
+ setOpt(opt, "", args[i].substr(p + 1), pos->second->repeat);
+ argDone = true;
+ }
+ }
+ else if(!args[i].empty() && args[i][0] == '-')
+ {
+ //
+ // Short option.
+ //
+ for(string::size_type p = 1; p < args[i].size(); ++p)
+ {
+ opt.clear();
+ opt.push_back(args[i][p]);
+ pos = checkOpt(opt, ShortOpt);
+
+ if(pos->second->repeat == NoRepeat)
+ {
+ set<string>::iterator seenPos = seenNonRepeatableOpts.find(opt);
+ if(seenPos != seenNonRepeatableOpts.end())
+ {
+ string err = "`-";
+ err += opt + ":' option cannot be repeated";
+ throw BadOptException(__FILE__, __LINE__, err);
+ }
+ seenNonRepeatableOpts.insert(seenPos, opt);
+ string synonym = getSynonym(opt);
+ if(!synonym.empty())
+ {
+ seenNonRepeatableOpts.insert(synonym);
+ }
+ }
+
+ if(pos->second->arg == NeedArg && p != args[i].size() - 1)
+ {
+ string optArg = args[i].substr(p + 1);
+ setOpt(opt, "", optArg, pos->second->repeat);
+ argDone = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ //
+ // Not an option or option argument.
+ //
+ result.push_back(args[i]);
+ argDone = true;
+ }
+
+ if(!argDone)
+ {
+ if(pos->second->arg == NeedArg) // Need an argument that is separated by whitespace.
+ {
+ if(i == args.size() - 1)
+ {
+ string err = "`-";
+ if(opt.size() != 1)
+ {
+ err += "-";
+ }
+ err += opt;
+ err += "' option requires an argument";
+ throw BadOptException(__FILE__, __LINE__, err);
+ }
+ setOpt(opt, "", args[++i], pos->second->repeat);
+ }
+ else
+ {
+ setOpt(opt, "", "1", pos->second->repeat);
+ }
+ }
}
_synonyms.clear(); // Don't need the contents anymore.
@@ -765,7 +765,7 @@ IceUtil::Options::isSet(const string& opt) const
if(!parseCalled)
{
- throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()");
+ throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()");
}
ValidOpts::const_iterator pos = checkOptIsValid(opt);
@@ -779,21 +779,21 @@ IceUtil::Options::optArg(const string& opt) const
if(!parseCalled)
{
- throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()");
+ throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()");
}
ValidOpts::const_iterator pos = checkOptHasArg(opt);
if(pos->second->repeat == Repeat)
{
- string err = "`-";
- if(pos->second->length == LongOpt)
- {
- err.push_back('-');
- }
- err += opt;
- err += "': is a repeating option -- use argVec() to get its arguments";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
+ string err = "`-";
+ if(pos->second->length == LongOpt)
+ {
+ err.push_back('-');
+ }
+ err += opt;
+ err += "': is a repeating option -- use argVec() to get its arguments";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
}
Opts::const_iterator p = _opts.find(opt);
@@ -811,20 +811,20 @@ IceUtil::Options::argVec(const string& opt) const
if(!parseCalled)
{
- throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()");
+ throw APIException(__FILE__, __LINE__, "cannot lookup options before calling parse()");
}
ValidOpts::const_iterator pos = checkOptHasArg(opt);
if(pos->second->repeat == NoRepeat)
{
- string err = "`-";
- if(pos->second->length == LongOpt)
- {
- err.push_back('-');
- }
- err += opt + "': is a non-repeating option -- use optArg() to get its argument";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
+ string err = "`-";
+ if(pos->second->length == LongOpt)
+ {
+ err.push_back('-');
+ }
+ err += opt + "': is a non-repeating option -- use optArg() to get its argument";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
}
ROpts::const_iterator p = _ropts.find(opt);
@@ -837,17 +837,17 @@ IceUtil::Options::addValidOpt(const string& shortOpt, const string& longOpt,
{
if(!shortOpt.empty() && _validOpts.find(shortOpt) != _validOpts.end())
{
- string err = "`";
- err += shortOpt;
- err += "': duplicate option";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
+ string err = "`";
+ err += shortOpt;
+ err += "': duplicate option";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
}
if(!longOpt.empty() && _validOpts.find(longOpt) != _validOpts.end())
{
- string err = "`";
- err += longOpt;
- err += "': duplicate option";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
+ string err = "`";
+ err += longOpt;
+ err += "': duplicate option";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
}
ODPtr odp = new OptionDetails;
@@ -857,12 +857,12 @@ IceUtil::Options::addValidOpt(const string& shortOpt, const string& longOpt,
if(!shortOpt.empty())
{
- odp->length = ShortOpt;
- _validOpts[shortOpt] = odp;
+ odp->length = ShortOpt;
+ _validOpts[shortOpt] = odp;
}
if(!longOpt.empty())
{
- odp->length = LongOpt;
+ odp->length = LongOpt;
_validOpts[longOpt] = odp;
}
@@ -870,7 +870,7 @@ IceUtil::Options::addValidOpt(const string& shortOpt, const string& longOpt,
if(at == NeedArg && !dflt.empty())
{
- setOpt(shortOpt, longOpt, dflt, rt);
+ setOpt(shortOpt, longOpt, dflt, rt);
}
}
@@ -880,14 +880,14 @@ IceUtil::Options::checkOpt(const string& opt, LengthType lt)
ValidOpts::iterator pos = _validOpts.find(opt);
if(pos == _validOpts.end())
{
- string err = "invalid option: `-";
- if(lt == LongOpt)
- {
- err.push_back('-');
- }
- err += opt;
- err.push_back('\'');
- throw BadOptException(__FILE__, __LINE__, err);
+ string err = "invalid option: `-";
+ if(lt == LongOpt)
+ {
+ err.push_back('-');
+ }
+ err += opt;
+ err.push_back('\'');
+ throw BadOptException(__FILE__, __LINE__, err);
}
return pos;
}
@@ -902,13 +902,13 @@ IceUtil::Options::setOpt(const string& opt1, const string& opt2, const string& v
if(rt == NoRepeat)
{
- setNonRepeatingOpt(opt1, val);
- setNonRepeatingOpt(opt2, val);
+ setNonRepeatingOpt(opt1, val);
+ setNonRepeatingOpt(opt2, val);
}
else
{
- setRepeatingOpt(opt1, val);
- setRepeatingOpt(opt2, val);
+ setRepeatingOpt(opt1, val);
+ setRepeatingOpt(opt2, val);
}
}
@@ -933,7 +933,7 @@ IceUtil::Options::setNonRepeatingOpt(const string& opt, const string& val)
const string synonym = getSynonym(opt);
if(!synonym.empty())
{
- _opts[synonym] = ovp;
+ _opts[synonym] = ovp;
}
}
@@ -954,45 +954,45 @@ IceUtil::Options::setRepeatingOpt(const string& opt, const string& val)
if(pos != _ropts.end())
{
- assert(_validOpts.find(opt) != _validOpts.end());
- assert(vpos->second->repeat == Repeat);
-
- _ropts[opt] = pos->second;
- if(vpos->second->hasDefault && pos->second->vals.size() == 1)
- {
- pos->second->vals[0] = val;
- vpos->second->hasDefault = false;
- }
- else
- {
- pos->second->vals.push_back(val);
- }
+ assert(_validOpts.find(opt) != _validOpts.end());
+ assert(vpos->second->repeat == Repeat);
+
+ _ropts[opt] = pos->second;
+ if(vpos->second->hasDefault && pos->second->vals.size() == 1)
+ {
+ pos->second->vals[0] = val;
+ vpos->second->hasDefault = false;
+ }
+ else
+ {
+ pos->second->vals.push_back(val);
+ }
}
else if(spos != _ropts.end())
{
- assert(_validOpts.find(synonym) != _validOpts.end());
- assert(_validOpts.find(synonym)->second->repeat == Repeat);
-
- _ropts[synonym] = spos->second;
- if(vpos->second->hasDefault && spos->second->vals.size() == 1)
- {
- spos->second->vals[0] = val;
- vpos->second->hasDefault = false;
- }
- else
- {
- spos->second->vals.push_back(val);
- }
+ assert(_validOpts.find(synonym) != _validOpts.end());
+ assert(_validOpts.find(synonym)->second->repeat == Repeat);
+
+ _ropts[synonym] = spos->second;
+ if(vpos->second->hasDefault && spos->second->vals.size() == 1)
+ {
+ spos->second->vals[0] = val;
+ vpos->second->hasDefault = false;
+ }
+ else
+ {
+ spos->second->vals.push_back(val);
+ }
}
else
{
- OVecPtr ovp = new OptionValueVector;
- ovp->vals.push_back(val);
- _ropts[opt] = ovp;
- if(!synonym.empty())
- {
- _ropts[synonym] = ovp;
- }
+ OVecPtr ovp = new OptionValueVector;
+ ovp->vals.push_back(val);
+ _ropts[opt] = ovp;
+ if(!synonym.empty())
+ {
+ _ropts[synonym] = ovp;
+ }
}
}
@@ -1002,10 +1002,10 @@ IceUtil::Options::checkOptIsValid(const string& opt) const
ValidOpts::const_iterator pos = _validOpts.find(opt);
if(pos == _validOpts.end())
{
- string err = "`";
- err += opt;
- err += "': invalid option";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
+ string err = "`";
+ err += opt;
+ err += "': invalid option";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
}
return pos;
}
@@ -1016,14 +1016,14 @@ IceUtil::Options::checkOptHasArg(const string& opt) const
ValidOpts::const_iterator pos = checkOptIsValid(opt);
if(pos->second->arg == NoArg)
{
- string err = "`-";
- if(pos->second->length == LongOpt)
- {
- err.push_back('-');
- }
- err += opt;
- err += "': option does not take arguments";
- throw IllegalArgumentException(__FILE__, __LINE__, err);
+ string err = "`-";
+ if(pos->second->length == LongOpt)
+ {
+ err.push_back('-');
+ }
+ err += opt;
+ err += "': option does not take arguments";
+ throw IllegalArgumentException(__FILE__, __LINE__, err);
}
return pos;
}
@@ -1034,7 +1034,7 @@ IceUtil::Options::updateSynonyms(const ::std::string& shortOpt, const ::std::str
if(!shortOpt.empty() && !longOpt.empty())
{
_synonyms[shortOpt] = longOpt;
- _synonyms[longOpt] = shortOpt;
+ _synonyms[longOpt] = shortOpt;
}
}
diff --git a/cpp/src/IceUtil/OutputUtil.cpp b/cpp/src/IceUtil/OutputUtil.cpp
index acf1a7a4590..e3ef63d1a45 100644
--- a/cpp/src/IceUtil/OutputUtil.cpp
+++ b/cpp/src/IceUtil/OutputUtil.cpp
@@ -84,14 +84,14 @@ IceUtil::OutputBase::print(const char* s)
{
for(unsigned int i = 0; i < strlen(s); ++i)
{
- if(s[i] == '\n')
- {
- _pos = 0;
- }
- else
- {
- ++_pos;
- }
+ if(s[i] == '\n')
+ {
+ _pos = 0;
+ }
+ else
+ {
+ ++_pos;
+ }
}
_out << s;
@@ -236,10 +236,10 @@ IceUtil::Output::print(const char* s)
{
if(_par >= 0)
{
- if(++_par > 1) // No comma for the first parameter.
- {
- _out << ", ";
- }
+ if(++_par > 1) // No comma for the first parameter.
+ {
+ _out << ", ";
+ }
}
OutputBase::print(s);
}
@@ -337,19 +337,19 @@ IceUtil::XMLOutput::print(const char* s)
{
if(_se)
{
- _out << '>';
- _se = false;
+ _out << '>';
+ _se = false;
}
_text = true;
if(_escape)
{
- string escaped = escape(s);
- OutputBase::print(escaped.c_str());
+ string escaped = escape(s);
+ OutputBase::print(escaped.c_str());
}
else
{
- OutputBase::print(s);
+ OutputBase::print(s);
}
}
@@ -358,8 +358,8 @@ IceUtil::XMLOutput::newline()
{
if(_se)
{
- _se = false;
- _out << '>';
+ _se = false;
+ _out << '>';
}
OutputBase::newline();
}
@@ -376,11 +376,11 @@ IceUtil::XMLOutput::startElement(const string& element)
//
if(_escape)
{
- _out << '<' << escape(element);
+ _out << '<' << escape(element);
}
else
{
- _out << '<' << element;
+ _out << '<' << element;
}
_se = true;
_text = false;
@@ -388,11 +388,11 @@ IceUtil::XMLOutput::startElement(const string& element)
string::size_type pos = element.find_first_of(" \t");
if(pos == string::npos)
{
- _elementStack.push(element);
+ _elementStack.push(element);
}
else
{
- _elementStack.push(element.substr(0, pos));
+ _elementStack.push(element.substr(0, pos));
}
++_pos; // TODO: ???
@@ -409,15 +409,15 @@ IceUtil::XMLOutput::endElement()
dec();
if(_se)
{
- _out << "></" << element << '>';
+ _out << "></" << element << '>';
}
else
{
- if(!_text)
- {
- newline();
- }
- _out << "</" << element << '>';
+ if(!_text)
+ {
+ newline();
+ }
+ _out << "</" << element << '>';
}
--_pos; // TODO: ???
@@ -472,50 +472,50 @@ IceUtil::XMLOutput::escape(const string& input) const
const string allReserved = "<>'\"&";
if(v.find_first_of(allReserved) != string::npos)
{
- //
- // First convert all & to &amp;
- //
- size_t pos = 0;
- while((pos = v.find_first_of('&', pos)) != string::npos)
- {
- v.insert(pos+1, "amp;");
- pos += 4;
- }
-
- //
- // Next convert remaining reserved characters.
- //
- const string reserved = "<>'\"";
- pos = 0;
- while((pos = v.find_first_of(reserved, pos)) != string::npos)
- {
- string replace;
- switch(v[pos])
- {
- case '>':
- replace = "&gt;";
- break;
-
- case '<':
- replace = "&lt;";
- break;
-
- case '\'':
- replace = "&apos;";
- break;
-
- case '"':
- replace = "&quot;";
- break;
-
- default:
- assert(false);
- }
-
- v.erase(pos, 1);
- v.insert(pos, replace);
- pos += replace.size();
- }
+ //
+ // First convert all & to &amp;
+ //
+ size_t pos = 0;
+ while((pos = v.find_first_of('&', pos)) != string::npos)
+ {
+ v.insert(pos+1, "amp;");
+ pos += 4;
+ }
+
+ //
+ // Next convert remaining reserved characters.
+ //
+ const string reserved = "<>'\"";
+ pos = 0;
+ while((pos = v.find_first_of(reserved, pos)) != string::npos)
+ {
+ string replace;
+ switch(v[pos])
+ {
+ case '>':
+ replace = "&gt;";
+ break;
+
+ case '<':
+ replace = "&lt;";
+ break;
+
+ case '\'':
+ replace = "&apos;";
+ break;
+
+ case '"':
+ replace = "&quot;";
+ break;
+
+ default:
+ assert(false);
+ }
+
+ v.erase(pos, 1);
+ v.insert(pos, replace);
+ pos += replace.size();
+ }
}
return v;
}
diff --git a/cpp/src/IceUtil/RWRecMutex.cpp b/cpp/src/IceUtil/RWRecMutex.cpp
index 8e78db985a3..d15d4acd98c 100644
--- a/cpp/src/IceUtil/RWRecMutex.cpp
+++ b/cpp/src/IceUtil/RWRecMutex.cpp
@@ -58,7 +58,7 @@ IceUtil::RWRecMutex::readLock() const
//
while(_count < 0 || _waitingWriters != 0)
{
- _readers.wait(lock);
+ _readers.wait(lock);
}
++_count;
}
@@ -74,7 +74,7 @@ IceUtil::RWRecMutex::tryReadLock() const
//
if(_count < 0 || _waitingWriters != 0)
{
- return false;
+ return false;
}
++_count;
return true;
@@ -92,18 +92,18 @@ IceUtil::RWRecMutex::timedReadLock(const Time& timeout) const
Time end = Time::now() + timeout;
while(_count < 0 || _waitingWriters != 0)
{
- Time remainder = end - Time::now();
- if(remainder > Time())
- {
- if(_readers.timedWait(lock, remainder) == false)
- {
- return false;
- }
- }
- else
- {
- return false;
- }
+ Time remainder = end - Time::now();
+ if(remainder > Time())
+ {
+ if(_readers.timedWait(lock, remainder) == false)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
}
++_count;
@@ -121,8 +121,8 @@ IceUtil::RWRecMutex::writeLock() const
//
if(_count < 0 && _writerId == ThreadControl())
{
- --_count;
- return;
+ --_count;
+ return;
}
//
@@ -131,17 +131,17 @@ IceUtil::RWRecMutex::writeLock() const
//
while(_count != 0)
{
- ++_waitingWriters;
- try
- {
- _writers.wait(lock);
- }
- catch(...)
- {
- --_waitingWriters;
- throw;
- }
- --_waitingWriters;
+ ++_waitingWriters;
+ try
+ {
+ _writers.wait(lock);
+ }
+ catch(...)
+ {
+ --_waitingWriters;
+ throw;
+ }
+ --_waitingWriters;
}
//
@@ -162,8 +162,8 @@ IceUtil::RWRecMutex::tryWriteLock() const
//
if(_count < 0 && _writerId == ThreadControl())
{
- --_count;
- return true;
+ --_count;
+ return true;
}
//
@@ -171,7 +171,7 @@ IceUtil::RWRecMutex::tryWriteLock() const
//
if(_count != 0)
{
- return false;
+ return false;
}
//
@@ -192,8 +192,8 @@ IceUtil::RWRecMutex::timedWriteLock(const Time& timeout) const
// decrement _count, and return.
if(_count < 0 && _writerId == ThreadControl())
{
- --_count;
- return true;
+ --_count;
+ return true;
}
//
@@ -203,29 +203,29 @@ IceUtil::RWRecMutex::timedWriteLock(const Time& timeout) const
Time end = Time::now() + timeout;
while(_count != 0)
{
- Time remainder = end - Time::now();
- if(remainder > Time())
- {
- ++_waitingWriters;
- try
- {
- bool result = _writers.timedWait(lock, remainder);
- --_waitingWriters;
- if(result == false)
- {
- return false;
- }
- }
- catch(...)
- {
- --_waitingWriters;
- throw;
- }
- }
- else
- {
- return false;
- }
+ Time remainder = end - Time::now();
+ if(remainder > Time())
+ {
+ ++_waitingWriters;
+ try
+ {
+ bool result = _writers.timedWait(lock, remainder);
+ --_waitingWriters;
+ if(result == false)
+ {
+ return false;
+ }
+ }
+ catch(...)
+ {
+ --_waitingWriters;
+ throw;
+ }
+ }
+ else
+ {
+ return false;
+ }
}
//
@@ -242,46 +242,46 @@ IceUtil::RWRecMutex::unlock() const
bool ww = false;
bool wr = false;
{
- Mutex::Lock lock(_mutex);
-
- assert(_count != 0);
-
- //
- // If _count < 0, the calling thread is a writer that holds the
- // lock, so release the lock. Otherwise, _count is guaranteed to
- // be > 0, so the calling thread is a reader releasing the lock.
- //
- if(_count < 0)
- {
- //
- // Writer called unlock
- //
- ++_count;
-
- //
- // If the write lock wasn't totally released we're done.
- //
- if(_count != 0)
- {
- return;
- }
- }
- else
- {
- //
- // Reader called unlock
- //
- --_count;
- }
-
- //
- // Writers are waiting (ww) if _waitingWriters > 0. In that
- // case, it's OK to let another writer into the region once there
- // are no more readers (_count == 0). Otherwise, no writers are
- // waiting but readers may be waiting (wr).
- //
- ww = (_waitingWriters != 0 && _count == 0);
- wr = (_waitingWriters == 0);
+ Mutex::Lock lock(_mutex);
+
+ assert(_count != 0);
+
+ //
+ // If _count < 0, the calling thread is a writer that holds the
+ // lock, so release the lock. Otherwise, _count is guaranteed to
+ // be > 0, so the calling thread is a reader releasing the lock.
+ //
+ if(_count < 0)
+ {
+ //
+ // Writer called unlock
+ //
+ ++_count;
+
+ //
+ // If the write lock wasn't totally released we're done.
+ //
+ if(_count != 0)
+ {
+ return;
+ }
+ }
+ else
+ {
+ //
+ // Reader called unlock
+ //
+ --_count;
+ }
+
+ //
+ // Writers are waiting (ww) if _waitingWriters > 0. In that
+ // case, it's OK to let another writer into the region once there
+ // are no more readers (_count == 0). Otherwise, no writers are
+ // waiting but readers may be waiting (wr).
+ //
+ ww = (_waitingWriters != 0 && _count == 0);
+ wr = (_waitingWriters == 0);
} // Unlock mutex.
//
@@ -290,27 +290,27 @@ IceUtil::RWRecMutex::unlock() const
//
if(ww)
{
- if(_upgrading)
- {
- //
- // If there is an untimed upgrader, it runs.
- //
- _upgrader.signal();
- }
- else
- {
- //
- // Wake a normal writer.
- //
- _writers.signal();
- }
+ if(_upgrading)
+ {
+ //
+ // If there is an untimed upgrader, it runs.
+ //
+ _upgrader.signal();
+ }
+ else
+ {
+ //
+ // Wake a normal writer.
+ //
+ _writers.signal();
+ }
}
else if(wr)
{
- //
- // Wake readers
- //
- _readers.broadcast();
+ //
+ // Wake readers
+ //
+ _readers.broadcast();
}
}
@@ -336,19 +336,19 @@ IceUtil::RWRecMutex::upgrade() const
_upgrading = true;
while(_count != 0)
{
- ++_waitingWriters;
- try
- {
- _upgrader.wait(lock);
- }
- catch(...)
- {
- _upgrading = false;
- --_waitingWriters;
- ++_count;
- throw;
- }
- --_waitingWriters;
+ ++_waitingWriters;
+ try
+ {
+ _upgrader.wait(lock);
+ }
+ catch(...)
+ {
+ _upgrading = false;
+ --_waitingWriters;
+ ++_count;
+ throw;
+ }
+ --_waitingWriters;
}
//
@@ -385,38 +385,38 @@ IceUtil::RWRecMutex::timedUpgrade(const Time& timeout) const
Time end = Time::now() + timeout;
while(_count != 0)
{
- Time remainder = end - Time::now();
- if(remainder > Time())
- {
- ++_waitingWriters;
- try
- {
- bool result = _upgrader.timedWait(lock, remainder);
- --_waitingWriters;
- if(!result)
- {
- _upgrading = false;
- ++_count;
- return false;
- }
- }
- catch(...)
- {
- _upgrading = false;
- --_waitingWriters;
- ++_count;
- throw;
- }
- }
- else
- {
- //
- // The lock isn't acquired if a timeout occurred.
- //
- ++_count;
- _upgrading = false;
- return false;
- }
+ Time remainder = end - Time::now();
+ if(remainder > Time())
+ {
+ ++_waitingWriters;
+ try
+ {
+ bool result = _upgrader.timedWait(lock, remainder);
+ --_waitingWriters;
+ if(!result)
+ {
+ _upgrading = false;
+ ++_count;
+ return false;
+ }
+ }
+ catch(...)
+ {
+ _upgrading = false;
+ --_waitingWriters;
+ ++_count;
+ throw;
+ }
+ }
+ else
+ {
+ //
+ // The lock isn't acquired if a timeout occurred.
+ //
+ ++_count;
+ _upgrading = false;
+ return false;
+ }
}
//
@@ -435,6 +435,6 @@ IceUtil::RWRecMutex::downgrade() const
if(++_count == 0)
{
- _count = 1;
+ _count = 1;
}
}
diff --git a/cpp/src/IceUtil/Random.cpp b/cpp/src/IceUtil/Random.cpp
index f532d64d35e..bbe8b523198 100644
--- a/cpp/src/IceUtil/Random.cpp
+++ b/cpp/src/IceUtil/Random.cpp
@@ -60,17 +60,17 @@ public:
~RandomCleanup()
{
#ifdef _WIN32
- if(context != NULL)
- {
- CryptReleaseContext(context, 0);
- context = NULL;
- }
+ if(context != NULL)
+ {
+ CryptReleaseContext(context, 0);
+ context = NULL;
+ }
#else
- if(fd != -1)
- {
- close(fd);
- fd = -1;
- }
+ if(fd != -1)
+ {
+ close(fd);
+ fd = -1;
+ }
#endif
}
};
@@ -89,30 +89,30 @@ IceUtil::RandomGeneratorException::ice_print(ostream& os) const
Exception::ice_print(os);
if(_error != 0)
{
- os << ":\nrandom generator exception: ";
+ os << ":\nrandom generator exception: ";
#ifdef _WIN32
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- _error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
-
- if(ok)
- {
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((char*)msg) > 0);
- os << msg;
- LocalFree(lpMsgBuf);
- }
- else
- {
- os << "unknown random generator error";
- }
+ LPVOID lpMsgBuf = 0;
+ DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ _error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
+
+ if(ok)
+ {
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((char*)msg) > 0);
+ os << msg;
+ LocalFree(lpMsgBuf);
+ }
+ else
+ {
+ os << "unknown random generator error";
+ }
#else
os << strerror(_error);
#endif
@@ -145,15 +145,15 @@ IceUtil::generateRandom(char* buffer, int size)
IceUtil::StaticMutex::Lock lock(staticMutex);
if(context == NULL)
{
- if(!CryptAcquireContext(&context, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
- {
- throw RandomGeneratorException(__FILE__, __LINE__, GetLastError());
- }
+ if(!CryptAcquireContext(&context, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+ {
+ throw RandomGeneratorException(__FILE__, __LINE__, GetLastError());
+ }
}
if(!CryptGenRandom(context, size, reinterpret_cast<unsigned char*>(buffer)))
{
- throw RandomGeneratorException(__FILE__, __LINE__, GetLastError());
+ throw RandomGeneratorException(__FILE__, __LINE__, GetLastError());
}
#else
@@ -163,12 +163,12 @@ IceUtil::generateRandom(char* buffer, int size)
IceUtil::StaticMutex::Lock lock(staticMutex);
if(fd == -1)
{
- fd = open("/dev/urandom", O_RDONLY);
- if(fd == -1)
- {
- assert(0);
- throw RandomGeneratorException(__FILE__, __LINE__);
- }
+ fd = open("/dev/urandom", O_RDONLY);
+ if(fd == -1)
+ {
+ assert(0);
+ throw RandomGeneratorException(__FILE__, __LINE__);
+ }
}
//
@@ -179,26 +179,26 @@ IceUtil::generateRandom(char* buffer, int size)
size_t index = 0;
while(reads <= 20 && index != static_cast<size_t>(size))
{
- ssize_t bytesRead = read(fd, buffer + index, static_cast<size_t>(size) - index);
-
- if(bytesRead == -1 && errno != EINTR)
- {
- int err = errno;
- cerr << "Reading /dev/urandom returned " << strerror(err) << endl;
- assert(0);
- throw RandomGeneratorException(__FILE__, __LINE__, errno);
- }
- else
- {
- index += bytesRead;
- reads++;
- }
+ ssize_t bytesRead = read(fd, buffer + index, static_cast<size_t>(size) - index);
+
+ if(bytesRead == -1 && errno != EINTR)
+ {
+ int err = errno;
+ cerr << "Reading /dev/urandom returned " << strerror(err) << endl;
+ assert(0);
+ throw RandomGeneratorException(__FILE__, __LINE__, errno);
+ }
+ else
+ {
+ index += bytesRead;
+ reads++;
+ }
}
-
+
if(index != static_cast<size_t>(size))
{
- assert(0);
- throw RandomGeneratorException(__FILE__, __LINE__);
+ assert(0);
+ throw RandomGeneratorException(__FILE__, __LINE__);
}
#endif
}
@@ -210,11 +210,11 @@ IceUtil::random(int limit)
generateRandom(reinterpret_cast<char*>(&r), static_cast<int>(sizeof(int)));
if(limit > 0)
{
- r = r % limit;
+ r = r % limit;
}
if(r < 0)
{
- r = -r;
+ r = -r;
}
return r;
}
diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp
index 1682917b2e0..4571750e030 100644
--- a/cpp/src/IceUtil/RecMutex.cpp
+++ b/cpp/src/IceUtil/RecMutex.cpp
@@ -34,7 +34,7 @@ IceUtil::RecMutex::lock() const
EnterCriticalSection(&_mutex);
if(++_count > 1)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
}
@@ -43,11 +43,11 @@ IceUtil::RecMutex::tryLock() const
{
if(!TryEnterCriticalSection(&_mutex))
{
- return false;
+ return false;
}
if(++_count > 1)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
return true;
}
@@ -57,7 +57,7 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
}
@@ -84,7 +84,7 @@ IceUtil::RecMutex::RecMutex() :
_mutex = CreateMutex(0, false, 0);
if(_mutex == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -94,7 +94,7 @@ IceUtil::RecMutex::~RecMutex()
BOOL rc = CloseHandle(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -104,23 +104,23 @@ IceUtil::RecMutex::lock() const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
if(++_count > 1)
{
- BOOL rc2 = ReleaseMutex(_mutex);
- if(rc2 == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc2 = ReleaseMutex(_mutex);
+ if(rc2 == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
}
@@ -130,15 +130,15 @@ IceUtil::RecMutex::tryLock() const
DWORD rc = WaitForSingleObject(_mutex, 0);
if(rc != WAIT_OBJECT_0)
{
- return false;
+ return false;
}
if(++_count > 1)
{
- BOOL rc2 = ReleaseMutex(_mutex);
- if(rc2 == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc2 = ReleaseMutex(_mutex);
+ if(rc2 == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
return true;
}
@@ -148,11 +148,11 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- BOOL rc = ReleaseMutex(_mutex);
- if(rc == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc = ReleaseMutex(_mutex);
+ if(rc == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
}
@@ -164,7 +164,7 @@ IceUtil::RecMutex::unlock(LockState& state) const
BOOL rc = ReleaseMutex(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -174,14 +174,14 @@ IceUtil::RecMutex::lock(LockState& state) const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
_count = state.count;
@@ -203,19 +203,19 @@ IceUtil::RecMutex::RecMutex() :
rc = pthread_mutexattr_init(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#endif
rc = pthread_mutex_init(&_mutex, &attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#if defined(__linux) && !defined(__USE_UNIX98)
@@ -224,7 +224,7 @@ IceUtil::RecMutex::RecMutex() :
rc = pthread_mutexattr_destroy(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#endif
}
@@ -243,12 +243,12 @@ IceUtil::RecMutex::lock() const
int rc = pthread_mutex_lock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
if(++_count > 1)
{
- rc = pthread_mutex_unlock(&_mutex);
- assert(rc == 0);
+ rc = pthread_mutex_unlock(&_mutex);
+ assert(rc == 0);
}
}
@@ -259,18 +259,18 @@ IceUtil::RecMutex::tryLock() const
bool result = (rc == 0);
if(!result)
{
- if(rc != EBUSY)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ if(rc != EBUSY)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
else if(++_count > 1)
{
- rc = pthread_mutex_unlock(&_mutex);
- if(rc != 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ rc = pthread_mutex_unlock(&_mutex);
+ if(rc != 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
return result;
}
@@ -280,9 +280,9 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- int rc = 0; // Prevent warnings when NDEBUG is defined.
- rc = pthread_mutex_unlock(&_mutex);
- assert(rc == 0);
+ int rc = 0; // Prevent warnings when NDEBUG is defined.
+ rc = pthread_mutex_unlock(&_mutex);
+ assert(rc == 0);
}
}
diff --git a/cpp/src/IceUtil/StaticMutex.cpp b/cpp/src/IceUtil/StaticMutex.cpp
index 857147a0496..f573bbbd4b9 100644
--- a/cpp/src/IceUtil/StaticMutex.cpp
+++ b/cpp/src/IceUtil/StaticMutex.cpp
@@ -55,14 +55,14 @@ Init::~Init()
{
# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400
for(MutexList::iterator p = _mutexList->begin();
- p != _mutexList->end(); ++p)
+ p != _mutexList->end(); ++p)
{
- DeleteCriticalSection(*p);
- delete *p;
+ DeleteCriticalSection(*p);
+ delete *p;
}
# else
for_each(_mutexList->begin(), _mutexList->end(),
- CloseHandle);
+ CloseHandle);
# endif
delete _mutexList;
DeleteCriticalSection(&_criticalSection);
@@ -83,25 +83,25 @@ void IceUtil::StaticMutex::initialize() const
if(_mutex == 0)
{
# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400
- CRITICAL_SECTION* newMutex = new CRITICAL_SECTION;
- InitializeCriticalSection(newMutex);
+ CRITICAL_SECTION* newMutex = new CRITICAL_SECTION;
+ InitializeCriticalSection(newMutex);
# else
- _recursionCount = 0;
-
- HANDLE newMutex = CreateMutex(0, false, 0);
- if(newMutex == 0)
- {
- LeaveCriticalSection(&_criticalSection);
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ _recursionCount = 0;
+
+ HANDLE newMutex = CreateMutex(0, false, 0);
+ if(newMutex == 0)
+ {
+ LeaveCriticalSection(&_criticalSection);
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
# endif
- //
- // _mutex is written after the new initialized CRITICAL_SECTION/Mutex
- //
- void* oldVal = InterlockedCompareExchangePointer(reinterpret_cast<void**>(&_mutex), newMutex, 0);
- assert(oldVal == 0);
- _mutexList->push_back(_mutex);
+ //
+ // _mutex is written after the new initialized CRITICAL_SECTION/Mutex
+ //
+ void* oldVal = InterlockedCompareExchangePointer(reinterpret_cast<void**>(&_mutex), newMutex, 0);
+ assert(oldVal == 0);
+ _mutexList->push_back(_mutex);
}
LeaveCriticalSection(&_criticalSection);
diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp
index 12ce3e3cd1e..30029300f59 100644
--- a/cpp/src/IceUtil/StringUtil.cpp
+++ b/cpp/src/IceUtil/StringUtil.cpp
@@ -42,86 +42,86 @@ encodeChar(string::value_type b, string& s, const string& special)
{
switch(b)
{
- case '\\':
- {
- s.append("\\\\");
- break;
- }
-
- case '\'':
- {
- s.append("\\'");
- break;
- }
-
- case '"':
- {
- s.append("\\\"");
- break;
- }
-
- case '\b':
- {
- s.append("\\b");
- break;
- }
-
- case '\f':
- {
- s.append("\\f");
- break;
- }
-
- case '\n':
- {
- s.append("\\n");
- break;
- }
-
- case '\r':
- {
- s.append("\\r");
- break;
- }
-
- case '\t':
- {
- s.append("\\t");
- break;
- }
-
- default:
- {
- unsigned char i = static_cast<unsigned char>(b);
- if(!(i >= 32 && i <= 126))
- {
- s.push_back('\\');
- string octal = toOctalString(i);
- //
- // Add leading zeroes so that we avoid problems during
- // decoding. For example, consider the escaped string
- // \0013 (i.e., a character with value 1 followed by the
- // character '3'). If the leading zeroes were omitted, the
- // result would be incorrectly interpreted as a single
- // character with value 11.
- //
- for(string::size_type j = octal.size(); j < 3; j++)
- {
- s.push_back('0');
- }
- s.append(octal);
- }
- else if(special.find(b) != string::npos)
- {
- s.push_back('\\');
- s.push_back(b);
- }
- else
- {
- s.push_back(b);
- }
- break;
- }
+ case '\\':
+ {
+ s.append("\\\\");
+ break;
+ }
+
+ case '\'':
+ {
+ s.append("\\'");
+ break;
+ }
+
+ case '"':
+ {
+ s.append("\\\"");
+ break;
+ }
+
+ case '\b':
+ {
+ s.append("\\b");
+ break;
+ }
+
+ case '\f':
+ {
+ s.append("\\f");
+ break;
+ }
+
+ case '\n':
+ {
+ s.append("\\n");
+ break;
+ }
+
+ case '\r':
+ {
+ s.append("\\r");
+ break;
+ }
+
+ case '\t':
+ {
+ s.append("\\t");
+ break;
+ }
+
+ default:
+ {
+ unsigned char i = static_cast<unsigned char>(b);
+ if(!(i >= 32 && i <= 126))
+ {
+ s.push_back('\\');
+ string octal = toOctalString(i);
+ //
+ // Add leading zeroes so that we avoid problems during
+ // decoding. For example, consider the escaped string
+ // \0013 (i.e., a character with value 1 followed by the
+ // character '3'). If the leading zeroes were omitted, the
+ // result would be incorrectly interpreted as a single
+ // character with value 11.
+ //
+ for(string::size_type j = octal.size(); j < 3; j++)
+ {
+ s.push_back('0');
+ }
+ s.append(octal);
+ }
+ else if(special.find(b) != string::npos)
+ {
+ s.push_back('\\');
+ s.push_back(b);
+ }
+ else
+ {
+ s.push_back(b);
+ }
+ break;
+ }
}
}
@@ -136,16 +136,16 @@ IceUtil::escapeString(const string& s, const string& special)
string::size_type i;
for(i = 0; i < special.size(); ++i)
{
- if(static_cast<unsigned char>(special[i]) < 32 || static_cast<unsigned char>(special[i]) > 126)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "special characters must be in ASCII range 32-126");
- }
+ if(static_cast<unsigned char>(special[i]) < 32 || static_cast<unsigned char>(special[i]) > 126)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "special characters must be in ASCII range 32-126");
+ }
}
string result;
for(i = 0; i < s.size(); ++i)
{
- encodeChar(s[i], result, special);
+ encodeChar(s[i], result, special);
}
return result;
@@ -178,86 +178,86 @@ decodeChar(const string& s, string::size_type start, string::size_type end, stri
if(s[start] != '\\')
{
- c = checkChar(s[start++]);
+ c = checkChar(s[start++]);
}
else
{
- if(start + 1 == end)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "trailing backslash in argument");
- }
- switch(s[++start])
- {
- case '\\':
- case '\'':
- case '"':
- {
- c = s[start++];
- break;
- }
- case 'b':
- {
- ++start;
- c = '\b';
- break;
- }
- case 'f':
- {
- ++start;
- c = '\f';
- break;
- }
- case 'n':
- {
- ++start;
- c = '\n';
- break;
- }
- case 'r':
- {
- ++start;
- c = '\r';
- break;
- }
- case 't':
- {
- ++start;
- c = '\t';
- break;
- }
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int oct = 0;
- for(int j = 0; j < 3 && start < end; ++j)
- {
- int charVal = s[start++] - '0';
- if(charVal < 0 || charVal > 7)
- {
- --start;
- break;
- }
- oct = oct * 8 + charVal;
- }
- if(oct > 255)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "octal value out of range");
- }
- c = (char)oct;
- break;
- }
- default:
- {
- c = checkChar(s[start++]);
- break;
- }
- }
+ if(start + 1 == end)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "trailing backslash in argument");
+ }
+ switch(s[++start])
+ {
+ case '\\':
+ case '\'':
+ case '"':
+ {
+ c = s[start++];
+ break;
+ }
+ case 'b':
+ {
+ ++start;
+ c = '\b';
+ break;
+ }
+ case 'f':
+ {
+ ++start;
+ c = '\f';
+ break;
+ }
+ case 'n':
+ {
+ ++start;
+ c = '\n';
+ break;
+ }
+ case 'r':
+ {
+ ++start;
+ c = '\r';
+ break;
+ }
+ case 't':
+ {
+ ++start;
+ c = '\t';
+ break;
+ }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int oct = 0;
+ for(int j = 0; j < 3 && start < end; ++j)
+ {
+ int charVal = s[start++] - '0';
+ if(charVal < 0 || charVal > 7)
+ {
+ --start;
+ break;
+ }
+ oct = oct * 8 + charVal;
+ }
+ if(oct > 255)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "octal value out of range");
+ }
+ c = (char)oct;
+ break;
+ }
+ default:
+ {
+ c = checkChar(s[start++]);
+ break;
+ }
+ }
}
nextStart = start;
return c;
@@ -271,7 +271,7 @@ static void decodeString(const string& s, string::size_type start, string::size_
{
while(start < end)
{
- sb.push_back(decodeChar(s, start, end, start));
+ sb.push_back(decodeChar(s, start, end, start));
}
}
@@ -291,20 +291,20 @@ IceUtil::unescapeString(const string& s, string::size_type start, string::size_t
}
if(start > end)
{
- throw IllegalArgumentException(__FILE__, __LINE__, "start offset must <= end offset");
+ throw IllegalArgumentException(__FILE__, __LINE__, "start offset must <= end offset");
}
result.reserve(end - start);
try
{
- result.clear();
- decodeString(s, start, end, result);
- return true;
+ result.clear();
+ decodeString(s, start, end, result);
+ return true;
}
catch(...)
{
- return false;
+ return false;
}
}
@@ -320,17 +320,17 @@ IceUtil::checkQuote(const string& s, string::size_type start)
string::value_type quoteChar = s[start];
if(quoteChar == '"' || quoteChar == '\'')
{
- start++;
- string::size_type pos;
- while(start < s.size() && (pos = s.find(quoteChar, start)) != string::npos)
- {
- if(s[pos - 1] != '\\')
- {
- return pos;
- }
- start = pos + 1;
- }
- return string::npos; // Unmatched quote.
+ start++;
+ string::size_type pos;
+ while(start < s.size() && (pos = s.find(quoteChar, start)) != string::npos)
+ {
+ if(s[pos - 1] != '\\')
+ {
+ return pos;
+ }
+ start = pos + 1;
+ }
+ return string::npos; // Unmatched quote.
}
return 0; // Not quoted.
}
diff --git a/cpp/src/IceUtil/Thread.cpp b/cpp/src/IceUtil/Thread.cpp
index 86658d581b4..70c4aa8b52c 100644
--- a/cpp/src/IceUtil/Thread.cpp
+++ b/cpp/src/IceUtil/Thread.cpp
@@ -44,13 +44,13 @@ IceUtil::ThreadControl::join()
{
if(_handle == 0)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
int rc = WaitForSingleObject(_handle, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
detach();
@@ -61,12 +61,12 @@ IceUtil::ThreadControl::detach()
{
if(_handle == 0)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
if(CloseHandle(_handle) == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -115,13 +115,13 @@ WINAPI startHook(void* arg)
try
{
- IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
+ IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
- //
- // Ensure that the thread doesn't go away until run() has
- // completed.
- //
- thread = rawThread;
+ //
+ // Ensure that the thread doesn't go away until run() has
+ // completed.
+ //
+ thread = rawThread;
#ifdef _WIN32
//
@@ -132,20 +132,20 @@ WINAPI startHook(void* arg)
srand(seed ^ thread->getThreadControl().id());
#endif
- //
- // See the comment in IceUtil::Thread::start() for details.
- //
- rawThread->__decRef();
- thread->run();
+ //
+ // See the comment in IceUtil::Thread::start() for details.
+ //
+ rawThread->__decRef();
+ thread->run();
}
catch(const IceUtil::Exception& e)
{
- cerr << "IceUtil::Thread::run(): uncaught exception: ";
- cerr << e << endl;
+ cerr << "IceUtil::Thread::run(): uncaught exception: ";
+ cerr << e << endl;
}
catch(...)
{
- cerr << "IceUtil::Thread::run(): uncaught exception" << endl;
+ cerr << "IceUtil::Thread::run(): uncaught exception" << endl;
}
thread->_done();
@@ -166,7 +166,7 @@ IceUtil::Thread::start(size_t stackSize)
if(_started)
{
- throw ThreadStartedException(__FILE__, __LINE__);
+ throw ThreadStartedException(__FILE__, __LINE__);
}
//
@@ -185,19 +185,19 @@ IceUtil::Thread::start(size_t stackSize)
_handle =
reinterpret_cast<HANDLE>(
_beginthreadex(0,
- static_cast<unsigned int>(stackSize),
- startHook, this, 0, &id));
+ static_cast<unsigned int>(stackSize),
+ startHook, this, 0, &id));
_id = id;
if(_handle == 0)
{
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
_started = true;
_running = true;
-
+
return ThreadControl(_handle, _id);
}
@@ -207,7 +207,7 @@ IceUtil::Thread::getThreadControl() const
IceUtil::Mutex::Lock lock(_stateMutex);
if(!_started)
{
- throw ThreadNotStartedException(__FILE__, __LINE__);
+ throw ThreadNotStartedException(__FILE__, __LINE__);
}
return ThreadControl(_handle, _id);
}
@@ -275,14 +275,14 @@ IceUtil::ThreadControl::join()
{
if(!_detachable)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
void* ignore = 0;
int rc = pthread_join(_thread, &ignore);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -291,13 +291,13 @@ IceUtil::ThreadControl::detach()
{
if(!_detachable)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
int rc = pthread_detach(_thread);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -346,24 +346,24 @@ startHook(void* arg)
try
{
- IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
+ IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
- thread = rawThread;
+ thread = rawThread;
- //
- // See the comment in IceUtil::Thread::start() for details.
- //
- rawThread->__decRef();
- thread->run();
+ //
+ // See the comment in IceUtil::Thread::start() for details.
+ //
+ rawThread->__decRef();
+ thread->run();
}
catch(const IceUtil::Exception& e)
{
- cerr << "IceUtil::Thread::run(): uncaught exception: ";
- cerr << e << endl;
+ cerr << "IceUtil::Thread::run(): uncaught exception: ";
+ cerr << e << endl;
}
catch(...)
{
- cerr << "IceUtil::Thread::run(): uncaught exception" << endl;
+ cerr << "IceUtil::Thread::run(): uncaught exception" << endl;
}
thread->_done();
@@ -383,7 +383,7 @@ IceUtil::Thread::start(size_t stackSize)
if(_started)
{
- throw ThreadStartedException(__FILE__, __LINE__);
+ throw ThreadStartedException(__FILE__, __LINE__);
}
//
@@ -399,34 +399,34 @@ IceUtil::Thread::start(size_t stackSize)
if(stackSize > 0)
{
- pthread_attr_t attr;
- int rc = pthread_attr_init(&attr);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- rc = pthread_attr_setstacksize(&attr, stackSize);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- rc = pthread_create(&_thread, &attr, startHook, this);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ pthread_attr_t attr;
+ int rc = pthread_attr_init(&attr);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ rc = pthread_attr_setstacksize(&attr, stackSize);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ rc = pthread_create(&_thread, &attr, startHook, this);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
else
{
- int rc = pthread_create(&_thread, 0, startHook, this);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ int rc = pthread_create(&_thread, 0, startHook, this);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
_started = true;
@@ -441,7 +441,7 @@ IceUtil::Thread::getThreadControl() const
IceUtil::Mutex::Lock lock(_stateMutex);
if(!_started)
{
- throw ThreadNotStartedException(__FILE__, __LINE__);
+ throw ThreadNotStartedException(__FILE__, __LINE__);
}
return ThreadControl(_thread);
}
diff --git a/cpp/src/IceUtil/ThreadException.cpp b/cpp/src/IceUtil/ThreadException.cpp
index 83f162933e0..4f474723feb 100644
--- a/cpp/src/IceUtil/ThreadException.cpp
+++ b/cpp/src/IceUtil/ThreadException.cpp
@@ -31,30 +31,30 @@ IceUtil::ThreadSyscallException::ice_print(ostream& os) const
Exception::ice_print(os);
if(_error != 0)
{
- os << ":\nthread syscall exception: ";
+ os << ":\nthread syscall exception: ";
#ifdef _WIN32
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- _error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
-
- if(ok)
- {
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((char*)msg) > 0);
- os << msg;
- LocalFree(lpMsgBuf);
- }
- else
- {
- os << "unknown thread error";
- }
+ LPVOID lpMsgBuf = 0;
+ DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ _error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
+
+ if(ok)
+ {
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((char*)msg) > 0);
+ os << msg;
+ LocalFree(lpMsgBuf);
+ }
+ else
+ {
+ os << "unknown thread error";
+ }
#else
os << strerror(_error);
#endif
diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp
index 1325afe0d42..c39c2bcf53e 100644
--- a/cpp/src/IceUtil/Time.cpp
+++ b/cpp/src/IceUtil/Time.cpp
@@ -37,7 +37,7 @@ IceUtil::Time::now()
ftime(&tb);
# endif
return Time(static_cast<Int64>(tb.time) * ICE_INT64(1000000) +
- tb.millitm * 1000);
+ tb.millitm * 1000);
#else
struct timeval tv;
gettimeofday(&tv, 0);
diff --git a/cpp/src/IceUtil/UUID.cpp b/cpp/src/IceUtil/UUID.cpp
index 7c0eb5c7847..af8253b0991 100644
--- a/cpp/src/IceUtil/UUID.cpp
+++ b/cpp/src/IceUtil/UUID.cpp
@@ -40,9 +40,9 @@ public:
PidInitializer()
{
- pid_t p = getpid();
- myPid[0] = (p >> 8) & 0x7F;
- myPid[1] = p & 0xFF;
+ pid_t p = getpid();
+ myPid[0] = (p >> 8) & 0x7F;
+ myPid[1] = p & 0xFF;
}
};
static PidInitializer pidInitializer;
@@ -56,11 +56,11 @@ inline void halfByteToHex(unsigned char hb, char*& hexBuffer)
{
if(hb < 10)
{
- *hexBuffer++ = '0' + hb;
+ *hexBuffer++ = '0' + hb;
}
else
{
- *hexBuffer++ = 'A' + (hb - 10);
+ *hexBuffer++ = 'A' + (hb - 10);
}
}
@@ -68,8 +68,8 @@ inline void bytesToHex(unsigned char* bytes, size_t len, char*& hexBuffer)
{
for(size_t i = 0; i < len; i++)
{
- halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer);
- halfByteToHex((bytes[i] & 0x0F), hexBuffer);
+ halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer);
+ halfByteToHex((bytes[i] & 0x0F), hexBuffer);
}
}
@@ -93,12 +93,12 @@ IceUtil::generateUUID()
#else
struct UUID
{
- unsigned char timeLow[4];
- unsigned char timeMid[2];
- unsigned char timeHighAndVersion[2];
- unsigned char clockSeqHiAndReserved;
- unsigned char clockSeqLow;
- unsigned char node[6];
+ unsigned char timeLow[4];
+ unsigned char timeMid[2];
+ unsigned char timeHighAndVersion[2];
+ unsigned char clockSeqHiAndReserved;
+ unsigned char clockSeqLow;
+ unsigned char node[6];
};
UUID uuid;
diff --git a/cpp/src/IceUtil/Unicode.cpp b/cpp/src/IceUtil/Unicode.cpp
index fb7890e2a91..20fc1f89c01 100644
--- a/cpp/src/IceUtil/Unicode.cpp
+++ b/cpp/src/IceUtil/Unicode.cpp
@@ -23,35 +23,35 @@ template<size_t wcharSize>
struct WstringHelper
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
};
template<>
struct WstringHelper<2>
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
- return ConvertUTF16toUTF8(
- reinterpret_cast<const UTF16**>(&sourceStart),
- reinterpret_cast<const UTF16*>(sourceEnd),
- &targetStart, targetEnd, flags);
+ return ConvertUTF16toUTF8(
+ reinterpret_cast<const UTF16**>(&sourceStart),
+ reinterpret_cast<const UTF16*>(sourceEnd),
+ &targetStart, targetEnd, flags);
}
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
- return ConvertUTF8toUTF16(
- &sourceStart, sourceEnd,
- reinterpret_cast<UTF16**>(&targetStart),
- reinterpret_cast<UTF16*>(targetEnd), flags);
+ return ConvertUTF8toUTF16(
+ &sourceStart, sourceEnd,
+ reinterpret_cast<UTF16**>(&targetStart),
+ reinterpret_cast<UTF16*>(targetEnd), flags);
}
};
@@ -59,23 +59,23 @@ template<>
struct WstringHelper<4>
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
- return ConvertUTF32toUTF8(
- reinterpret_cast<const UTF32**>(&sourceStart),
- reinterpret_cast<const UTF32*>(sourceEnd),
- &targetStart, targetEnd, flags);
+ return ConvertUTF32toUTF8(
+ reinterpret_cast<const UTF32**>(&sourceStart),
+ reinterpret_cast<const UTF32*>(sourceEnd),
+ &targetStart, targetEnd, flags);
}
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
- return ConvertUTF8toUTF32(
- &sourceStart, sourceEnd,
- reinterpret_cast<UTF32**>(&targetStart),
- reinterpret_cast<UTF32*>(targetEnd), flags);
+ return ConvertUTF8toUTF32(
+ &sourceStart, sourceEnd,
+ reinterpret_cast<UTF32**>(&targetStart),
+ reinterpret_cast<UTF32*>(targetEnd), flags);
}
};
}
@@ -90,7 +90,7 @@ IceUtil::convertUTFWstringToUTF8(
Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
return WstringHelper<sizeof(wchar_t)>::toUTF8(
- sourceStart, sourceEnd, targetStart, targetEnd, flags);
+ sourceStart, sourceEnd, targetStart, targetEnd, flags);
}
ConversionResult
@@ -99,12 +99,12 @@ IceUtil::convertUTF8ToUTFWstring(
wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
return WstringHelper<sizeof(wchar_t)>::fromUTF8(
- sourceStart, sourceEnd, targetStart, targetEnd, flags);
+ sourceStart, sourceEnd, targetStart, targetEnd, flags);
}
ConversionResult
IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd,
- std::wstring& target, ConversionFlags flags)
+ std::wstring& target, ConversionFlags flags)
{
//
// Could be reimplemented without this temporary wchar_t buffer
@@ -115,13 +115,13 @@ IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd
wchar_t* targetEnd = targetStart + size;
ConversionResult result =
- convertUTF8ToUTFWstring(sourceStart, sourceEnd, targetStart,
- targetEnd, flags);
+ convertUTF8ToUTFWstring(sourceStart, sourceEnd, targetStart,
+ targetEnd, flags);
if(result == conversionOK)
{
- std::wstring s(outBuf, static_cast<size_t>(targetStart - outBuf));
- s.swap(target);
+ std::wstring s(outBuf, static_cast<size_t>(targetStart - outBuf));
+ s.swap(target);
}
delete[] outBuf;
return result;
@@ -135,7 +135,7 @@ IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd
const char* IceUtil::UTFConversionException::_name = "IceUtil::UTFConversionException";
IceUtil::UTFConversionException::UTFConversionException(const char* file, int line,
- ConversionResult cr):
+ ConversionResult cr):
Exception(file, line),
_conversionResult(cr)
{}
@@ -152,18 +152,18 @@ IceUtil::UTFConversionException::ice_print(ostream& os) const
Exception::ice_print(os);
switch(_conversionResult)
{
- case sourceExhausted:
- os << ": source exhausted";
- break;
- case targetExhausted:
- os << ": target exhausted";
- break;
- case sourceIllegal:
- os << ": illegal source";
- break;
- default:
- assert(0);
- break;
+ case sourceExhausted:
+ os << ": source exhausted";
+ break;
+ case targetExhausted:
+ os << ": target exhausted";
+ break;
+ case sourceIllegal:
+ os << ": illegal source";
+ break;
+ default:
+ assert(0);
+ break;
};
}
@@ -200,18 +200,18 @@ IceUtil::wstringToString(const wstring& wstr)
const wchar_t* sourceStart = wstr.data();
ConversionResult cr =
- convertUTFWstringToUTF8(
- sourceStart, sourceStart + wstr.size(),
- targetStart, targetEnd, lenientConversion);
-
+ convertUTFWstringToUTF8(
+ sourceStart, sourceStart + wstr.size(),
+ targetStart, targetEnd, lenientConversion);
+
if(cr != conversionOK)
{
- delete[] outBuf;
- throw UTFConversionException(__FILE__, __LINE__, cr);
+ delete[] outBuf;
+ throw UTFConversionException(__FILE__, __LINE__, cr);
}
string s(reinterpret_cast<char*>(outBuf),
- static_cast<size_t>(targetStart - outBuf));
+ static_cast<size_t>(targetStart - outBuf));
s.swap(target);
delete[] outBuf;
return target;
@@ -224,12 +224,12 @@ IceUtil::stringToWstring(const string& str)
const Byte* sourceStart = reinterpret_cast<const Byte*>(str.data());
ConversionResult cr
- = convertUTF8ToUTFWstring(sourceStart, sourceStart + str.size(),
- result, lenientConversion);
+ = convertUTF8ToUTFWstring(sourceStart, sourceStart + str.size(),
+ result, lenientConversion);
if(cr != conversionOK)
{
- throw UTFConversionException(__FILE__, __LINE__, cr);
+ throw UTFConversionException(__FILE__, __LINE__, cr);
}
return result;
}
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index b4f9d48f8d0..0bbd0750002 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -18,11 +18,11 @@ Slice::ToIfdef::operator()(char c)
{
if(!isalnum(c))
{
- return '_';
+ return '_';
}
else
{
- return c;
+ return c;
}
}
@@ -56,21 +56,21 @@ Slice::changeInclude(const string& orig, const vector<string>& includePaths)
string result = file;
for(vector<string>::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p)
{
- string includePath = normalizePath(*p);
+ string includePath = normalizePath(*p);
- if(file.compare(0, includePath.length(), includePath) == 0)
- {
- string s = file.substr(includePath.length());
- if(s.size() < result.size())
- {
- result = s;
- }
- }
+ if(file.compare(0, includePath.length(), includePath) == 0)
+ {
+ string s = file.substr(includePath.length());
+ if(s.size() < result.size())
+ {
+ result = s;
+ }
+ }
}
if((pos = result.rfind('.')) != string::npos)
{
- result.erase(pos);
+ result.erase(pos);
}
return result;
@@ -101,29 +101,29 @@ Slice::printVersionCheck(Output& out)
out << "\n#ifndef ICE_IGNORE_VERSION";
if(ICE_INT_VERSION % 100 > 50)
{
- //
- // Beta version: exact match required
- //
- out << "\n# if ICE_INT_VERSION != " << ICE_INT_VERSION;
- out << "\n# error Ice version mismatch: an exact match is required for beta generated code";
- out << "\n# endif";
+ //
+ // Beta version: exact match required
+ //
+ out << "\n# if ICE_INT_VERSION != " << ICE_INT_VERSION;
+ out << "\n# error Ice version mismatch: an exact match is required for beta generated code";
+ out << "\n# endif";
}
else
{
- out << "\n# if ICE_INT_VERSION / 100 != " << ICE_INT_VERSION / 100;
- out << "\n# error Ice version mismatch!";
- out << "\n# endif";
-
- //
- // Generated code is release; reject beta header
- //
- out << "\n# if ICE_INT_VERSION % 100 > 50";
- out << "\n# error Beta header file detected";
- out << "\n# endif";
-
- out << "\n# if ICE_INT_VERSION % 100 < " << ICE_INT_VERSION % 100;
- out << "\n# error Ice patch level mismatch!";
- out << "\n# endif";
+ out << "\n# if ICE_INT_VERSION / 100 != " << ICE_INT_VERSION / 100;
+ out << "\n# error Ice version mismatch!";
+ out << "\n# endif";
+
+ //
+ // Generated code is release; reject beta header
+ //
+ out << "\n# if ICE_INT_VERSION % 100 > 50";
+ out << "\n# error Beta header file detected";
+ out << "\n# endif";
+
+ out << "\n# if ICE_INT_VERSION % 100 < " << ICE_INT_VERSION % 100;
+ out << "\n# error Ice patch level mismatch!";
+ out << "\n# endif";
}
out << "\n#endif";
}
@@ -133,14 +133,14 @@ Slice::printDllExportStuff(Output& out, const string& dllExport)
{
if(dllExport.size())
{
- out << sp;
- out << "\n#ifndef " << dllExport;
- out << "\n# ifdef " << dllExport << "_EXPORTS";
- out << "\n# define " << dllExport << " ICE_DECLSPEC_EXPORT";
- out << "\n# else";
- out << "\n# define " << dllExport << " ICE_DECLSPEC_IMPORT";
- out << "\n# endif";
- out << "\n#endif";
+ out << sp;
+ out << "\n#ifndef " << dllExport;
+ out << "\n# ifdef " << dllExport << "_EXPORTS";
+ out << "\n# define " << dllExport << " ICE_DECLSPEC_EXPORT";
+ out << "\n# else";
+ out << "\n# define " << dllExport << " ICE_DECLSPEC_IMPORT";
+ out << "\n# endif";
+ out << "\n#endif";
}
}
@@ -149,121 +149,121 @@ Slice::typeToString(const TypePtr& type, bool useWstring, const StringList& meta
{
static const char* builtinTable[] =
{
- "::Ice::Byte",
- "bool",
- "::Ice::Short",
- "::Ice::Int",
- "::Ice::Long",
- "::Ice::Float",
- "::Ice::Double",
- "::std::string",
- "::Ice::ObjectPtr",
- "::Ice::ObjectPrx",
- "::Ice::LocalObjectPtr"
+ "::Ice::Byte",
+ "bool",
+ "::Ice::Short",
+ "::Ice::Int",
+ "::Ice::Long",
+ "::Ice::Float",
+ "::Ice::Double",
+ "::std::string",
+ "::Ice::ObjectPtr",
+ "::Ice::ObjectPrx",
+ "::Ice::LocalObjectPtr"
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
if(builtin->kind() == Builtin::KindString)
- {
+ {
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
- {
- return "::std::wstring";
- }
- }
- return builtinTable[builtin->kind()];
+ if(strType != "string" && (useWstring || strType == "wstring"))
+ {
+ return "::std::wstring";
+ }
+ }
+ return builtinTable[builtin->kind()];
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- return fixKwd(cl->scoped() + "Ptr");
+ return fixKwd(cl->scoped() + "Ptr");
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- if(findMetaData(st->getMetaData(), false) == "class")
- {
- return fixKwd(st->scoped() + "Ptr");
- }
- return fixKwd(st->scoped());
+ if(findMetaData(st->getMetaData(), false) == "class")
+ {
+ return fixKwd(st->scoped() + "Ptr");
+ }
+ return fixKwd(st->scoped());
}
-
+
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
if(proxy)
{
- return fixKwd(proxy->_class()->scoped() + "Prx");
+ return fixKwd(proxy->_class()->scoped() + "Prx");
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
string seqType = findMetaData(metaData, true);
- if(!seqType.empty())
- {
- if(seqType == "array" || seqType == "range:array")
- {
- if(inParam)
- {
- TypePtr elemType = seq->type();
- string s = typeToString(elemType, inWstringModule(seq), seq->typeMetaData());
- return "::std::pair<const " + s + "*, const " + s + "*>";
- }
- else
- {
- return fixKwd(seq->scoped());
- }
- }
- else if(seqType.find("range") == 0)
- {
- if(inParam)
- {
- string s;
- if(seqType.find("range:") == 0)
- {
- s = seqType.substr(strlen("range:"));
- }
- else
- {
- s = fixKwd(seq->scoped());
- }
- if(s[0] == ':')
- {
- s = " " + s;
- }
- return "::std::pair<" + s + "::const_iterator, " + s + "::const_iterator>";
- }
- else
- {
- return fixKwd(seq->scoped());
- }
- }
- else
- {
- return seqType;
- }
- }
- else
- {
- return fixKwd(seq->scoped());
- }
- }
-
+ if(!seqType.empty())
+ {
+ if(seqType == "array" || seqType == "range:array")
+ {
+ if(inParam)
+ {
+ TypePtr elemType = seq->type();
+ string s = typeToString(elemType, inWstringModule(seq), seq->typeMetaData());
+ return "::std::pair<const " + s + "*, const " + s + "*>";
+ }
+ else
+ {
+ return fixKwd(seq->scoped());
+ }
+ }
+ else if(seqType.find("range") == 0)
+ {
+ if(inParam)
+ {
+ string s;
+ if(seqType.find("range:") == 0)
+ {
+ s = seqType.substr(strlen("range:"));
+ }
+ else
+ {
+ s = fixKwd(seq->scoped());
+ }
+ if(s[0] == ':')
+ {
+ s = " " + s;
+ }
+ return "::std::pair<" + s + "::const_iterator, " + s + "::const_iterator>";
+ }
+ else
+ {
+ return fixKwd(seq->scoped());
+ }
+ }
+ else
+ {
+ return seqType;
+ }
+ }
+ else
+ {
+ return fixKwd(seq->scoped());
+ }
+ }
+
ContainedPtr contained = ContainedPtr::dynamicCast(type);
if(contained)
{
- return fixKwd(contained->scoped());
+ return fixKwd(contained->scoped());
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return fixKwd(en->scoped());
+ return fixKwd(en->scoped());
}
-
+
return "???";
}
@@ -272,7 +272,7 @@ Slice::returnTypeToString(const TypePtr& type, bool useWstring, const StringList
{
if(!type)
{
- return "void";
+ return "void";
}
return typeToString(type, useWstring, metaData, false);
@@ -283,59 +283,59 @@ Slice::inputTypeToString(const TypePtr& type, bool useWstring, const StringList&
{
static const char* inputBuiltinTable[] =
{
- "::Ice::Byte",
- "bool",
- "::Ice::Short",
- "::Ice::Int",
- "::Ice::Long",
- "::Ice::Float",
- "::Ice::Double",
- "const ::std::string&",
- "const ::Ice::ObjectPtr&",
- "const ::Ice::ObjectPrx&",
- "const ::Ice::LocalObjectPtr&"
+ "::Ice::Byte",
+ "bool",
+ "::Ice::Short",
+ "::Ice::Int",
+ "::Ice::Long",
+ "::Ice::Float",
+ "::Ice::Double",
+ "const ::std::string&",
+ "const ::Ice::ObjectPtr&",
+ "const ::Ice::ObjectPrx&",
+ "const ::Ice::LocalObjectPtr&"
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
if(builtin->kind() == Builtin::KindString)
- {
+ {
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
- {
- return "const ::std::wstring&";
- }
- }
- return inputBuiltinTable[builtin->kind()];
+ if(strType != "string" && (useWstring || strType == "wstring"))
+ {
+ return "const ::std::wstring&";
+ }
+ }
+ return inputBuiltinTable[builtin->kind()];
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- return "const " + fixKwd(cl->scoped()) + "Ptr&";
+ return "const " + fixKwd(cl->scoped()) + "Ptr&";
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- if(findMetaData(st->getMetaData(), false) == "class")
- {
- return "const " + fixKwd(st->scoped()) + "Ptr&";
- }
- return "const " + fixKwd(st->scoped()) + "&";
+ if(findMetaData(st->getMetaData(), false) == "class")
+ {
+ return "const " + fixKwd(st->scoped()) + "Ptr&";
+ }
+ return "const " + fixKwd(st->scoped()) + "&";
}
-
+
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
if(proxy)
{
- return "const " + fixKwd(proxy->_class()->scoped()) + "Prx&";
+ return "const " + fixKwd(proxy->_class()->scoped()) + "Prx&";
}
-
+
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return fixKwd(en->scoped());
+ return fixKwd(en->scoped());
}
SequencePtr seq = SequencePtr::dynamicCast(type);
@@ -350,23 +350,23 @@ Slice::inputTypeToString(const TypePtr& type, bool useWstring, const StringList&
string s = typeToString(elemType, inWstringModule(seq), seq->typeMetaData());
return "const ::std::pair<const " + s + "*, const " + s + "*>&";
}
- else if(seqType.find("range") == 0)
- {
- string s;
- if(seqType.find("range:") == 0)
- {
- s = seqType.substr(strlen("range:"));
- }
- else
- {
- s = fixKwd(seq->scoped());
- }
- if(s[0] == ':')
- {
- s = " " + s;
- }
- return "const ::std::pair<" + s + "::const_iterator, " + s + "::const_iterator>&";
- }
+ else if(seqType.find("range") == 0)
+ {
+ string s;
+ if(seqType.find("range:") == 0)
+ {
+ s = seqType.substr(strlen("range:"));
+ }
+ else
+ {
+ s = fixKwd(seq->scoped());
+ }
+ if(s[0] == ':')
+ {
+ s = " " + s;
+ }
+ return "const ::std::pair<" + s + "::const_iterator, " + s + "::const_iterator>&";
+ }
else
{
return "const " + seqType + "&";
@@ -377,11 +377,11 @@ Slice::inputTypeToString(const TypePtr& type, bool useWstring, const StringList&
return "const " + fixKwd(seq->scoped()) + "&";
}
}
-
+
ContainedPtr contained = ContainedPtr::dynamicCast(type);
if(contained)
{
- return "const " + fixKwd(contained->scoped()) + "&";
+ return "const " + fixKwd(contained->scoped()) + "&";
}
return "???";
@@ -392,55 +392,55 @@ Slice::outputTypeToString(const TypePtr& type, bool useWstring, const StringList
{
static const char* outputBuiltinTable[] =
{
- "::Ice::Byte&",
- "bool&",
- "::Ice::Short&",
- "::Ice::Int&",
- "::Ice::Long&",
- "::Ice::Float&",
- "::Ice::Double&",
- "::std::string&",
- "::Ice::ObjectPtr&",
- "::Ice::ObjectPrx&",
- "::Ice::LocalObjectPtr&"
+ "::Ice::Byte&",
+ "bool&",
+ "::Ice::Short&",
+ "::Ice::Int&",
+ "::Ice::Long&",
+ "::Ice::Float&",
+ "::Ice::Double&",
+ "::std::string&",
+ "::Ice::ObjectPtr&",
+ "::Ice::ObjectPrx&",
+ "::Ice::LocalObjectPtr&"
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
if(builtin->kind() == Builtin::KindString)
- {
+ {
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
- {
- return "::std::wstring&";
- }
- }
- return outputBuiltinTable[builtin->kind()];
+ if(strType != "string" && (useWstring || strType == "wstring"))
+ {
+ return "::std::wstring&";
+ }
+ }
+ return outputBuiltinTable[builtin->kind()];
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- return fixKwd(cl->scoped()) + "Ptr&";
+ return fixKwd(cl->scoped()) + "Ptr&";
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- if(findMetaData(st->getMetaData(), false) == "class")
- {
- return fixKwd(st->scoped()) + "Ptr&";
- }
- return fixKwd(st->scoped()) + "&";
+ if(findMetaData(st->getMetaData(), false) == "class")
+ {
+ return fixKwd(st->scoped()) + "Ptr&";
+ }
+ return fixKwd(st->scoped()) + "&";
}
-
+
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
if(proxy)
{
- return fixKwd(proxy->_class()->scoped()) + "Prx&";
+ return fixKwd(proxy->_class()->scoped()) + "Prx&";
}
-
+
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
@@ -457,7 +457,7 @@ Slice::outputTypeToString(const TypePtr& type, bool useWstring, const StringList
ContainedPtr contained = ContainedPtr::dynamicCast(type);
if(contained)
{
- return fixKwd(contained->scoped()) + "&";
+ return fixKwd(contained->scoped()) + "&";
}
return "???";
@@ -468,25 +468,25 @@ Slice::operationModeToString(Operation::Mode mode)
{
switch(mode)
{
- case Operation::Normal:
- {
- return "::Ice::Normal";
- }
-
- case Operation::Nonmutating:
- {
- return "::Ice::Nonmutating";
- }
-
- case Operation::Idempotent:
- {
- return "::Ice::Idempotent";
- }
-
- default:
- {
- assert(false);
- }
+ case Operation::Normal:
+ {
+ return "::Ice::Normal";
+ }
+
+ case Operation::Nonmutating:
+ {
+ return "::Ice::Nonmutating";
+ }
+
+ case Operation::Idempotent:
+ {
+ return "::Ice::Idempotent";
+ }
+
+ default:
+ {
+ assert(false);
+ }
}
return "???";
@@ -505,18 +505,18 @@ lookupKwd(const string& name)
//
static const string keywordList[] =
{
- "and", "and_eq", "asm", "auto", "bit_and", "bit_or", "bool", "break", "case", "catch", "char",
- "class", "compl", "const", "const_cast", "continue", "default", "delete", "do", "double",
- "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float", "for",
- "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "not", "not_eq",
- "operator", "or", "or_eq", "private", "protected", "public", "register", "reinterpret_cast",
- "return", "short", "signed", "sizeof", "static", "static_cast", "struct", "switch", "template",
- "this", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using",
- "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq"
+ "and", "and_eq", "asm", "auto", "bit_and", "bit_or", "bool", "break", "case", "catch", "char",
+ "class", "compl", "const", "const_cast", "continue", "default", "delete", "do", "double",
+ "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float", "for",
+ "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "not", "not_eq",
+ "operator", "or", "or_eq", "private", "protected", "public", "register", "reinterpret_cast",
+ "return", "short", "signed", "sizeof", "static", "static_cast", "struct", "switch", "template",
+ "this", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using",
+ "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq"
};
bool found = binary_search(&keywordList[0],
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
- name);
+ &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
+ name);
return found ? "_cpp_" + name : name;
}
@@ -532,24 +532,24 @@ splitScopedName(const string& scoped)
string::size_type pos;
while((pos = scoped.find("::", next)) != string::npos)
{
- pos += 2;
- if(pos != scoped.size())
- {
- string::size_type endpos = scoped.find("::", pos);
- if(endpos != string::npos)
- {
- ids.push_back(scoped.substr(pos, endpos - pos));
- }
- }
- next = pos;
+ pos += 2;
+ if(pos != scoped.size())
+ {
+ string::size_type endpos = scoped.find("::", pos);
+ if(endpos != string::npos)
+ {
+ ids.push_back(scoped.substr(pos, endpos - pos));
+ }
+ }
+ next = pos;
}
if(next != scoped.size())
{
- ids.push_back(scoped.substr(next));
+ ids.push_back(scoped.substr(next));
}
else
{
- ids.push_back("");
+ ids.push_back("");
}
return ids;
@@ -567,42 +567,42 @@ Slice::fixKwd(const string& name)
{
if(name[0] != ':')
{
- return lookupKwd(name);
+ return lookupKwd(name);
}
StringList ids = splitScopedName(name);
transform(ids.begin(), ids.end(), ids.begin(), ptr_fun(lookupKwd));
stringstream result;
for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
{
- result << "::" + *i;
+ result << "::" + *i;
}
return result.str();
}
void
Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& param, bool marshal,
- const string& str, bool pointer, const StringList& metaData, bool inParam)
+ const string& str, bool pointer, const StringList& metaData, bool inParam)
{
string fixedParam = fixKwd(param);
string stream;
if(str.empty())
{
- stream = marshal ? "__os" : "__is";
+ stream = marshal ? "__os" : "__is";
}
else
{
- stream = str;
+ stream = str;
}
string deref;
if(pointer)
{
- deref = "->";
+ deref = "->";
}
else
{
- deref = '.';
+ deref = '.';
}
string func = marshal ? "write(" : "read(";
@@ -610,284 +610,284 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- if(builtin->kind() == Builtin::KindObject)
- {
- if(marshal)
- {
- out << nl << stream << deref << func << fixedParam << ");";
- }
- else
- {
- out << nl << stream << deref << func << "::Ice::__patch__ObjectPtr, &" << fixedParam << ");";
- }
- return;
- }
- else
- {
- out << nl << stream << deref << func << fixedParam << ");";
- return;
- }
+ if(builtin->kind() == Builtin::KindObject)
+ {
+ if(marshal)
+ {
+ out << nl << stream << deref << func << fixedParam << ");";
+ }
+ else
+ {
+ out << nl << stream << deref << func << "::Ice::__patch__ObjectPtr, &" << fixedParam << ");";
+ }
+ return;
+ }
+ else
+ {
+ out << nl << stream << deref << func << fixedParam << ");";
+ return;
+ }
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- string scope = fixKwd(cl->scope());
- if(marshal)
- {
- out << nl << scope << "__write(" << (pointer ? "" : "&") << stream << ", " << fixedParam << ");";
- }
- else
- {
- out << nl << stream << deref << "read("
- << scope << "__patch__" << cl->name() << "Ptr, &" << fixedParam << ");";
- }
+ string scope = fixKwd(cl->scope());
+ if(marshal)
+ {
+ out << nl << scope << "__write(" << (pointer ? "" : "&") << stream << ", " << fixedParam << ");";
+ }
+ else
+ {
+ out << nl << stream << deref << "read("
+ << scope << "__patch__" << cl->name() << "Ptr, &" << fixedParam << ");";
+ }
- return;
+ return;
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- string deref;
- if(findMetaData(st->getMetaData(), false) == "class")
- {
- if(!marshal)
- {
- out << nl << fixedParam << " = new " << fixKwd(st->scoped()) << ";";
- }
- out << nl << fixedParam << "->__" << func << (pointer ? "" : "&") << stream << ");";
- }
- else
- {
- out << nl << fixedParam << ".__" << func << (pointer ? "" : "&") << stream << ");";
- }
- return;
+ string deref;
+ if(findMetaData(st->getMetaData(), false) == "class")
+ {
+ if(!marshal)
+ {
+ out << nl << fixedParam << " = new " << fixKwd(st->scoped()) << ";";
+ }
+ out << nl << fixedParam << "->__" << func << (pointer ? "" : "&") << stream << ");";
+ }
+ else
+ {
+ out << nl << fixedParam << ".__" << func << (pointer ? "" : "&") << stream << ");";
+ }
+ return;
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
string seqType = findMetaData(metaData, inParam);
- builtin = BuiltinPtr::dynamicCast(seq->type());
+ builtin = BuiltinPtr::dynamicCast(seq->type());
if(marshal)
- {
- string scope = fixKwd(seq->scope());
- if(seqType == "array" || seqType == "range:array")
- {
- //
- // Use array (pair<const TYPE*, const TYPE*>). In parameters only.
- //
- if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)
- {
- //
- // Sequence type in not handled by BasicStream functions. If the sequence is the
- // default vector than we can use the sequences generated write function. Otherwise
- // we need to generate marshal code to write each element.
- //
+ {
+ string scope = fixKwd(seq->scope());
+ if(seqType == "array" || seqType == "range:array")
+ {
+ //
+ // Use array (pair<const TYPE*, const TYPE*>). In parameters only.
+ //
+ if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)
+ {
+ //
+ // Sequence type in not handled by BasicStream functions. If the sequence is the
+ // default vector than we can use the sequences generated write function. Otherwise
+ // we need to generate marshal code to write each element.
+ //
StringList l = seq->getMetaData();
seqType = findMetaData(l, false);
- if(seqType.empty())
- {
- out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", "
- << fixedParam << ".first, " << fixedParam << ".second, " << scope
- << "__U__" << fixKwd(seq->name()) << "());";
- }
- else
- {
- out << nl << "::Ice::Int __sz_" << fixedParam << " = static_cast< ::Ice::Int>(" << fixedParam
- << ".second - " << fixedParam << ".first);";
- out << nl << stream << deref << "writeSize(__sz_" << fixedParam << ");";
- out << nl << "for(int __i_" << fixedParam << " = 0; __i_" << fixedParam << " < __sz_"
- << fixedParam << "; ++__i_" << fixedParam << ")";
- out << sb;
- writeMarshalUnmarshalCode(out, seq->type(), fixedParam + ".first[__i_" + fixedParam + "]",
- true);
- out << eb;
- }
- }
- else
- {
- //
- // Use BasicStream write functions.
- //
- out << nl << stream << deref << func << fixedParam << ".first, " << fixedParam << ".second);";
- }
- }
- else if(seqType.find("range") == 0)
- {
- //
- // Use range (pair<TYPE::const_iterator, TYPE::const_iterator). Only for in paramaters.
- // Need to check if the range defines an iterator type other than the actual sequence
- // type.
- //
- StringList l;
- if(seqType.find("range:") == 0)
- {
- seqType = seqType.substr(strlen("range:"));
- l.push_back("cpp:" + seqType);
- }
- else
- {
- seqType = fixKwd(seq->scoped());
- }
- out << nl << stream << deref << "writeSize(static_cast< ::Ice::Int>(ice_distance("
- << fixedParam << ".first, " << fixedParam << ".second)));";
- out << nl << "for(" << seqType << "::const_iterator ___" << fixedParam << " = "
- << fixedParam << ".first; ___" << fixedParam << " != " << fixedParam << ".second; ++___"
- << fixedParam << ")";
- out << sb;
- writeMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", true, "", true, l, false);
- out << eb;
- }
- else if(!seqType.empty())
- {
+ if(seqType.empty())
+ {
+ out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", "
+ << fixedParam << ".first, " << fixedParam << ".second, " << scope
+ << "__U__" << fixKwd(seq->name()) << "());";
+ }
+ else
+ {
+ out << nl << "::Ice::Int __sz_" << fixedParam << " = static_cast< ::Ice::Int>(" << fixedParam
+ << ".second - " << fixedParam << ".first);";
+ out << nl << stream << deref << "writeSize(__sz_" << fixedParam << ");";
+ out << nl << "for(int __i_" << fixedParam << " = 0; __i_" << fixedParam << " < __sz_"
+ << fixedParam << "; ++__i_" << fixedParam << ")";
+ out << sb;
+ writeMarshalUnmarshalCode(out, seq->type(), fixedParam + ".first[__i_" + fixedParam + "]",
+ true);
+ out << eb;
+ }
+ }
+ else
+ {
+ //
+ // Use BasicStream write functions.
+ //
+ out << nl << stream << deref << func << fixedParam << ".first, " << fixedParam << ".second);";
+ }
+ }
+ else if(seqType.find("range") == 0)
+ {
+ //
+ // Use range (pair<TYPE::const_iterator, TYPE::const_iterator). Only for in paramaters.
+ // Need to check if the range defines an iterator type other than the actual sequence
+ // type.
+ //
+ StringList l;
+ if(seqType.find("range:") == 0)
+ {
+ seqType = seqType.substr(strlen("range:"));
+ l.push_back("cpp:" + seqType);
+ }
+ else
+ {
+ seqType = fixKwd(seq->scoped());
+ }
+ out << nl << stream << deref << "writeSize(static_cast< ::Ice::Int>(ice_distance("
+ << fixedParam << ".first, " << fixedParam << ".second)));";
+ out << nl << "for(" << seqType << "::const_iterator ___" << fixedParam << " = "
+ << fixedParam << ".first; ___" << fixedParam << " != " << fixedParam << ".second; ++___"
+ << fixedParam << ")";
+ out << sb;
+ writeMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", true, "", true, l, false);
+ out << eb;
+ }
+ else if(!seqType.empty())
+ {
out << nl << stream << deref << "writeSize(static_cast< ::Ice::Int>(" << fixedParam << ".size()));";
- out << nl << seqType << "::const_iterator __p_" << fixedParam << ";";
+ out << nl << seqType << "::const_iterator __p_" << fixedParam << ";";
out << nl << "for(__p_" << fixedParam << " = " << fixedParam << ".begin(); __p_" << fixedParam
- << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")";
+ << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")";
out << sb;
writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", true);
out << eb;
- }
- else
- {
- //
- // No modifying metadata specified. Use appropriate write methods for type.
- //
+ }
+ else
+ {
+ //
+ // No modifying metadata specified. Use appropriate write methods for type.
+ //
StringList l = seq->getMetaData();
seqType = findMetaData(l, false);
- if(!seqType.empty())
- {
- out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " << fixedParam << ", "
- << scope << "__U__" << fixKwd(seq->name()) << "());";
- }
- else if(!builtin || builtin->kind() == Builtin::KindObject ||
- builtin->kind() == Builtin::KindObjectProxy)
- {
- out << nl << "if(" << fixedParam << ".size() == 0)";
- out << sb;
- out << nl << stream << deref << "writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", &"
- << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size(), " << scope
- << "__U__" << fixKwd(seq->name()) << "());";
- out << eb;
- }
- else if(builtin->kind() == Builtin::KindBool)
- {
- out << nl << stream << deref << func << fixedParam << ");";
- }
- else
- {
- out << nl << "if(" << fixedParam << ".size() == 0)";
- out << sb;
- out << nl << stream << deref << "writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << stream << deref << func << "&" << fixedParam << "[0], &" << fixedParam
- << "[0] + " << fixedParam << ".size());";
- out << eb;
- }
- }
- }
- else
- {
- string scope = fixKwd(seq->scope());
- if(seqType == "array" || seqType == "range:array")
- {
- //
- // Use array (pair<const TYPE*, const TYPE*>). In paramters only.
- //
- if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)
- {
+ if(!seqType.empty())
+ {
+ out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " << fixedParam << ", "
+ << scope << "__U__" << fixKwd(seq->name()) << "());";
+ }
+ else if(!builtin || builtin->kind() == Builtin::KindObject ||
+ builtin->kind() == Builtin::KindObjectProxy)
+ {
+ out << nl << "if(" << fixedParam << ".size() == 0)";
+ out << sb;
+ out << nl << stream << deref << "writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", &"
+ << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size(), " << scope
+ << "__U__" << fixKwd(seq->name()) << "());";
+ out << eb;
+ }
+ else if(builtin->kind() == Builtin::KindBool)
+ {
+ out << nl << stream << deref << func << fixedParam << ");";
+ }
+ else
+ {
+ out << nl << "if(" << fixedParam << ".size() == 0)";
+ out << sb;
+ out << nl << stream << deref << "writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << deref << func << "&" << fixedParam << "[0], &" << fixedParam
+ << "[0] + " << fixedParam << ".size());";
+ out << eb;
+ }
+ }
+ }
+ else
+ {
+ string scope = fixKwd(seq->scope());
+ if(seqType == "array" || seqType == "range:array")
+ {
+ //
+ // Use array (pair<const TYPE*, const TYPE*>). In paramters only.
+ //
+ if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)
+ {
StringList l = seq->getMetaData();
seqType = findMetaData(l, false);
- if(seqType.empty())
- {
- out << nl << typeToString(type, false) << " ___" << fixedParam << ";";
- out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", ___"
- << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());";
- }
- else
- {
- seqType = "::std::vector< " + typeToString(seq->type(), false) + ">";
- StringList l;
- l.push_back("cpp:type:" + seqType);
- out << nl << seqType << " ___" << fixedParam << ";";
- writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, l, false);
- }
- }
- else if(builtin->kind() == Builtin::KindByte)
- {
- out << nl << stream << deref << func << fixedParam << ");";
- }
- else if(builtin->kind() != Builtin::KindString && builtin->kind() != Builtin::KindObject &&
- builtin->kind() != Builtin::KindObjectProxy)
- {
- string s = typeToString(builtin, false);
- if(s[0] == ':')
- {
- s = " " + s;
- }
- out << nl << "::IceUtil::ScopedArray<" << s << "> ___" << fixedParam << '('
- << stream << deref << func << fixedParam << "));";
- }
- else
- {
- out << nl << "::std::vector< "
- << typeToString(seq->type(), inWstringModule(seq), seq->typeMetaData()) << "> ___"
- << fixedParam << ";";
- out << nl << stream << deref << func << "___" << fixedParam << ");";
- }
-
- if(!builtin || builtin->kind() == Builtin::KindString || builtin->kind() == Builtin::KindObject ||
- builtin->kind() == Builtin::KindObjectProxy)
- {
- out << nl << fixedParam << ".first" << " = &___" << fixedParam << "[0];";
- out << nl << fixedParam << ".second" << " = " << fixedParam << ".first + " << "___"
- << fixedParam << ".size();";
- }
- }
- else if(seqType.find("range") == 0)
- {
- //
- // Use range (pair<TYPE::const_iterator, TYPE::const_iterator>). In paramters only.
- // Need to check if iterator type other than default is specified.
- //
- StringList md;
- if(seqType.find("range:") == 0)
- {
- md.push_back("cpp:type:" + seqType.substr(strlen("range:")));
- }
- writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, md, false);
- out << nl << fixedParam << ".first = ___" << fixedParam << ".begin();";
- out << nl << fixedParam << ".second = ___" << fixedParam << ".end();";
- }
- else if(!seqType.empty())
- {
- //
- // Using alternate sequence type.
- //
+ if(seqType.empty())
+ {
+ out << nl << typeToString(type, false) << " ___" << fixedParam << ";";
+ out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", ___"
+ << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());";
+ }
+ else
+ {
+ seqType = "::std::vector< " + typeToString(seq->type(), false) + ">";
+ StringList l;
+ l.push_back("cpp:type:" + seqType);
+ out << nl << seqType << " ___" << fixedParam << ";";
+ writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, l, false);
+ }
+ }
+ else if(builtin->kind() == Builtin::KindByte)
+ {
+ out << nl << stream << deref << func << fixedParam << ");";
+ }
+ else if(builtin->kind() != Builtin::KindString && builtin->kind() != Builtin::KindObject &&
+ builtin->kind() != Builtin::KindObjectProxy)
+ {
+ string s = typeToString(builtin, false);
+ if(s[0] == ':')
+ {
+ s = " " + s;
+ }
+ out << nl << "::IceUtil::ScopedArray<" << s << "> ___" << fixedParam << '('
+ << stream << deref << func << fixedParam << "));";
+ }
+ else
+ {
+ out << nl << "::std::vector< "
+ << typeToString(seq->type(), inWstringModule(seq), seq->typeMetaData()) << "> ___"
+ << fixedParam << ";";
+ out << nl << stream << deref << func << "___" << fixedParam << ");";
+ }
+
+ if(!builtin || builtin->kind() == Builtin::KindString || builtin->kind() == Builtin::KindObject ||
+ builtin->kind() == Builtin::KindObjectProxy)
+ {
+ out << nl << fixedParam << ".first" << " = &___" << fixedParam << "[0];";
+ out << nl << fixedParam << ".second" << " = " << fixedParam << ".first + " << "___"
+ << fixedParam << ".size();";
+ }
+ }
+ else if(seqType.find("range") == 0)
+ {
+ //
+ // Use range (pair<TYPE::const_iterator, TYPE::const_iterator>). In paramters only.
+ // Need to check if iterator type other than default is specified.
+ //
+ StringList md;
+ if(seqType.find("range:") == 0)
+ {
+ md.push_back("cpp:type:" + seqType.substr(strlen("range:")));
+ }
+ writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, md, false);
+ out << nl << fixedParam << ".first = ___" << fixedParam << ".begin();";
+ out << nl << fixedParam << ".second = ___" << fixedParam << ".end();";
+ }
+ else if(!seqType.empty())
+ {
+ //
+ // Using alternate sequence type.
+ //
out << nl << "::Ice::Int __sz_" << fixedParam << ";";
out << nl << stream << deref << "readSize(__sz_" << fixedParam << ");";
out << nl << seqType << "(__sz_" << fixedParam << ").swap(" << fixedParam << ");";
if(seq->type()->isVariableLength())
{
out << nl << stream << deref << "startSeq(__sz_" << fixedParam << ", "
- << seq->type()->minWireSize() << ");";
+ << seq->type()->minWireSize() << ");";
}
else
{
out << nl << stream << deref << "checkFixedSeq(__sz_" << fixedParam << ", "
- << seq->type()->minWireSize() << ");";
+ << seq->type()->minWireSize() << ");";
}
- out << nl << seqType << "::iterator __p_" << fixedParam << ";";
+ out << nl << seqType << "::iterator __p_" << fixedParam << ";";
out << nl << "for(__p_" << fixedParam << " = " << fixedParam << ".begin(); __p_" << fixedParam
- << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")";
+ << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")";
out << sb;
writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", false);
if(seq->type()->isVariableLength())
@@ -903,114 +903,114 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
{
out << nl << stream << deref << "endSeq(__sz_" << fixedParam << ");";
}
- }
- else
- {
- //
- // No modifying metadata supplied. Just use appropriate read function.
- //
+ }
+ else
+ {
+ //
+ // No modifying metadata supplied. Just use appropriate read function.
+ //
StringList l = seq->getMetaData();
seqType = findMetaData(l, false);
- if(!seqType.empty() || !builtin || builtin->kind() == Builtin::KindObject ||
- builtin->kind() == Builtin::KindObjectProxy)
- {
- out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", "
- << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());";
- }
- else if(builtin->kind() == Builtin::KindByte)
- {
- StringList md;
- md.push_back("cpp:array");
- string tmpParam = "___";
-
- //
- // Catch some case in which it is not possible to just prepend
- // underscores to param to use as temporary variable.
- //
- if(fixedParam.find("(*") == 0)
- {
- tmpParam += fixedParam.substr(2, fixedParam.length() - 3);
- }
- else if(fixedParam.find("[i]") != string::npos)
- {
- tmpParam += fixedParam.substr(0, fixedParam.length() - 3);
- }
- else if(fixedParam.find("->second") != string::npos)
- {
- tmpParam += fixedParam.substr(0, fixedParam.length() - 8);
- }
- else
- {
- tmpParam += fixedParam;
- }
- out << nl << typeToString(type, false, md) << " " << tmpParam << ";";
- out << nl << stream << deref << func << tmpParam << ");";
- out << nl << "::std::vector< ::Ice::Byte>(" << tmpParam << ".first, " << tmpParam
- << ".second).swap(" << fixedParam << ");";
- }
- else
- {
- out << nl << stream << deref << func << fixedParam << ");";
- }
- }
- }
- return;
+ if(!seqType.empty() || !builtin || builtin->kind() == Builtin::KindObject ||
+ builtin->kind() == Builtin::KindObjectProxy)
+ {
+ out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", "
+ << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());";
+ }
+ else if(builtin->kind() == Builtin::KindByte)
+ {
+ StringList md;
+ md.push_back("cpp:array");
+ string tmpParam = "___";
+
+ //
+ // Catch some case in which it is not possible to just prepend
+ // underscores to param to use as temporary variable.
+ //
+ if(fixedParam.find("(*") == 0)
+ {
+ tmpParam += fixedParam.substr(2, fixedParam.length() - 3);
+ }
+ else if(fixedParam.find("[i]") != string::npos)
+ {
+ tmpParam += fixedParam.substr(0, fixedParam.length() - 3);
+ }
+ else if(fixedParam.find("->second") != string::npos)
+ {
+ tmpParam += fixedParam.substr(0, fixedParam.length() - 8);
+ }
+ else
+ {
+ tmpParam += fixedParam;
+ }
+ out << nl << typeToString(type, false, md) << " " << tmpParam << ";";
+ out << nl << stream << deref << func << tmpParam << ");";
+ out << nl << "::std::vector< ::Ice::Byte>(" << tmpParam << ".first, " << tmpParam
+ << ".second).swap(" << fixedParam << ");";
+ }
+ else
+ {
+ out << nl << stream << deref << func << fixedParam << ");";
+ }
+ }
+ }
+ return;
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if(dict)
{
- string scope = fixKwd(dict->scope());
- out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", "
- << fixedParam << ", " << scope << "__U__" << fixKwd(dict->name()) << "());";
- return;
+ string scope = fixKwd(dict->scope());
+ out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", "
+ << fixedParam << ", " << scope << "__U__" << fixKwd(dict->name()) << "());";
+ return;
}
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
if(!constructed)
{
- ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- assert(proxy);
- constructed = proxy->_class();
+ ProxyPtr proxy = ProxyPtr::dynamicCast(type);
+ assert(proxy);
+ constructed = proxy->_class();
}
out << nl << fixKwd(constructed->scope()) << "__" << func << (pointer ? "" : "&") << stream << ", "
- << fixedParam << ");";
+ << fixedParam << ");";
}
void
Slice::writeMarshalCode(Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData,
- bool inParam)
+ bool inParam)
{
for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p)
{
- writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), true, "", true, (*p)->getMetaData(),
- inParam);
+ writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), true, "", true, (*p)->getMetaData(),
+ inParam);
}
if(ret)
{
- writeMarshalUnmarshalCode(out, ret, "__ret", true, "", true, metaData, false);
+ writeMarshalUnmarshalCode(out, ret, "__ret", true, "", true, metaData, false);
}
}
void
Slice::writeUnmarshalCode(Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData,
- bool inParam)
+ bool inParam)
{
for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p)
{
- writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), false, "", true, (*p)->getMetaData(),
- inParam);
+ writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), false, "", true, (*p)->getMetaData(),
+ inParam);
}
if(ret)
{
- writeMarshalUnmarshalCode(out, ret, "__ret", false, "", true, metaData, false);
+ writeMarshalUnmarshalCode(out, ret, "__ret", false, "", true, metaData, false);
}
}
static void
writeRangeAllocateCode(Output& out, const TypePtr& type, const string& fixedName, const StringList& metaData,
- bool inParam)
+ bool inParam)
{
if(!inParam)
{
@@ -1021,72 +1021,72 @@ writeRangeAllocateCode(Output& out, const TypePtr& type, const string& fixedName
if(seq)
{
string seqType = findMetaData(metaData, true);
- if(seqType.find("range") == 0 && seqType != "range:array")
- {
- StringList md;
- if(seqType.find("range:") == 0)
- {
- md.push_back("cpp:type:" + seqType.substr(strlen("range:")));
- }
+ if(seqType.find("range") == 0 && seqType != "range:array")
+ {
+ StringList md;
+ if(seqType.find("range:") == 0)
+ {
+ md.push_back("cpp:type:" + seqType.substr(strlen("range:")));
+ }
out << nl << typeToString(seq, false, md, false) << " ___" << fixedName << ";";
- }
+ }
}
}
void
Slice::writeAllocateCode(Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData,
- bool useWstring, bool inParam)
+ bool useWstring, bool inParam)
{
for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p)
{
- out << nl << typeToString((*p)->type(), useWstring, (*p)->getMetaData(), inParam) << ' '
- << fixKwd((*p)->name());
- StructPtr st = StructPtr::dynamicCast((*p)->type());
- if(st && findMetaData(st->getMetaData(), false) == "class")
- {
- out << " = new " << fixKwd(st->scoped());
- }
- out << ';';
+ out << nl << typeToString((*p)->type(), useWstring, (*p)->getMetaData(), inParam) << ' '
+ << fixKwd((*p)->name());
+ StructPtr st = StructPtr::dynamicCast((*p)->type());
+ if(st && findMetaData(st->getMetaData(), false) == "class")
+ {
+ out << " = new " << fixKwd(st->scoped());
+ }
+ out << ';';
- //
- // If using a range we need to allocate the range container as well now to ensure they
- // are always in the same scope.
- //
- writeRangeAllocateCode(out, (*p)->type(), fixKwd((*p)->name()), (*p)->getMetaData(), inParam);
+ //
+ // If using a range we need to allocate the range container as well now to ensure they
+ // are always in the same scope.
+ //
+ writeRangeAllocateCode(out, (*p)->type(), fixKwd((*p)->name()), (*p)->getMetaData(), inParam);
}
if(ret)
{
- out << nl << typeToString(ret, useWstring, metaData, inParam) << " __ret";
- StructPtr st = StructPtr::dynamicCast(ret);
- if(st && findMetaData(st->getMetaData(), false) == "class")
- {
- out << " = new " << fixKwd(st->scoped());
- }
- out << ";";
+ out << nl << typeToString(ret, useWstring, metaData, inParam) << " __ret";
+ StructPtr st = StructPtr::dynamicCast(ret);
+ if(st && findMetaData(st->getMetaData(), false) == "class")
+ {
+ out << " = new " << fixKwd(st->scoped());
+ }
+ out << ";";
- //
- // If using a range we need to allocate the range container as well now to ensure they
- // are always in the same scope.
- //
- writeRangeAllocateCode(out, ret, "__ret", metaData, inParam);
+ //
+ // If using a range we need to allocate the range container as well now to ensure they
+ // are always in the same scope.
+ //
+ writeRangeAllocateCode(out, ret, "__ret", metaData, inParam);
}
}
void
Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& param, bool marshal,
- const string& str, bool useWstring, const StringList& metaData)
+ const string& str, bool useWstring, const StringList& metaData)
{
string fixedParam = fixKwd(param);
string stream;
if(str.empty())
{
- stream = marshal ? "__outS" : "__inS";
+ stream = marshal ? "__outS" : "__inS";
}
else
{
- stream = str;
+ stream = str;
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
@@ -1181,8 +1181,8 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
case Builtin::KindString:
{
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
- {
+ if(strType != "string" && (useWstring || strType == "wstring"))
+ {
if(marshal)
{
out << nl << stream << "->writeWstring(" << fixedParam << ");";
@@ -1191,9 +1191,9 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
{
out << nl << fixedParam << " = " << stream << "->readWstring();";
}
- }
- else
- {
+ }
+ else
+ {
if(marshal)
{
out << nl << stream << "->writeString(" << fixedParam << ");";
@@ -1202,7 +1202,7 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
{
out << nl << fixedParam << " = " << stream << "->readString();";
}
- }
+ }
break;
}
case Builtin::KindObject:
@@ -1243,73 +1243,73 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- string scope = fixKwd(cl->scope());
- if(marshal)
- {
+ string scope = fixKwd(cl->scope());
+ if(marshal)
+ {
out << nl << scope << "ice_write" << cl->name() << "(" << stream << ", " << fixedParam << ");";
- }
- else
- {
+ }
+ else
+ {
out << nl << scope << "ice_read" << cl->name() << "(" << stream << ", " << fixedParam << ");";
- }
+ }
- return;
+ return;
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- string scope = fixKwd(st->scope());
- if(marshal)
- {
+ string scope = fixKwd(st->scope());
+ if(marshal)
+ {
out << nl << scope << "ice_write" << st->name() << "(" << stream << ", " << fixedParam << ");";
- }
- else
- {
- if(findMetaData(st->getMetaData(), false) == "class")
- {
- out << nl << fixedParam << " = new " << fixKwd(st->scoped()) << ";";
- }
+ }
+ else
+ {
+ if(findMetaData(st->getMetaData(), false) == "class")
+ {
+ out << nl << fixedParam << " = new " << fixKwd(st->scoped()) << ";";
+ }
out << nl << scope << "ice_read" << st->name() << "(" << stream << ", " << fixedParam << ");";
- }
+ }
- return;
+ return;
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- string seqType = findMetaData(metaData, false);
- if(!seqType.empty())
- {
- if(marshal)
- {
- out << nl << stream << "->writeSize(static_cast< ::Ice::Int>(" << fixedParam << ".size()));";
- out << nl << seqType << "::const_iterator ___" << fixedParam << ";";
- out << nl << "for(___" << fixedParam << " = " << fixedParam << ".begin(); ___" << fixedParam << " != "
- << fixedParam << ".end(); ++___" << fixedParam << ")";
- out << sb;
- writeStreamMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", true);
- out << eb;
- }
- else
- {
- out << nl << seqType << "(static_cast< ::Ice::Int>(" << stream << "->readSize())).swap("
- << fixedParam << ");";
- out << nl << seqType << "::iterator ___" << fixedParam << ";";
- out << nl << "for(___" << fixedParam << " = " << fixedParam << ".begin(); ___" << fixedParam << " != "
- << fixedParam << ".end(); ++___" << fixedParam << ")";
- out << sb;
- writeStreamMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", false);
- out << eb;
- }
- }
- else
- {
- seqType = findMetaData(seq->getMetaData(), false);
+ string seqType = findMetaData(metaData, false);
+ if(!seqType.empty())
+ {
+ if(marshal)
+ {
+ out << nl << stream << "->writeSize(static_cast< ::Ice::Int>(" << fixedParam << ".size()));";
+ out << nl << seqType << "::const_iterator ___" << fixedParam << ";";
+ out << nl << "for(___" << fixedParam << " = " << fixedParam << ".begin(); ___" << fixedParam << " != "
+ << fixedParam << ".end(); ++___" << fixedParam << ")";
+ out << sb;
+ writeStreamMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", true);
+ out << eb;
+ }
+ else
+ {
+ out << nl << seqType << "(static_cast< ::Ice::Int>(" << stream << "->readSize())).swap("
+ << fixedParam << ");";
+ out << nl << seqType << "::iterator ___" << fixedParam << ";";
+ out << nl << "for(___" << fixedParam << " = " << fixedParam << ".begin(); ___" << fixedParam << " != "
+ << fixedParam << ".end(); ++___" << fixedParam << ")";
+ out << sb;
+ writeStreamMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", false);
+ out << eb;
+ }
+ }
+ else
+ {
+ seqType = findMetaData(seq->getMetaData(), false);
builtin = BuiltinPtr::dynamicCast(seq->type());
if(!seqType.empty() || !builtin || (builtin->kind() == Builtin::KindObject ||
- builtin->kind() == Builtin::KindObjectProxy))
+ builtin->kind() == Builtin::KindObjectProxy))
{
string scope = fixKwd(seq->scope());
if(marshal)
@@ -1412,8 +1412,8 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
case Builtin::KindString:
{
string strType = findMetaData(seq->typeMetaData(), true);
- if(strType != "string" && (useWstring || strType == "wstring"))
- {
+ if(strType != "string" && (useWstring || strType == "wstring"))
+ {
if(marshal)
{
out << nl << stream << "->writeWstringSeq(" << fixedParam << ");";
@@ -1422,9 +1422,9 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
{
out << nl << fixedParam << " = " << stream << "->readWstringSeq();";
}
- }
- else
- {
+ }
+ else
+ {
if(marshal)
{
out << nl << stream << "->writeStringSeq(" << fixedParam << ");";
@@ -1433,7 +1433,7 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
{
out << nl << fixedParam << " = " << stream << "->readStringSeq();";
}
- }
+ }
break;
}
case Builtin::KindObject:
@@ -1444,26 +1444,26 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
break;
}
}
- }
+ }
}
- return;
+ return;
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if(dict)
{
string scope = fixKwd(dict->scope());
- if(marshal)
- {
+ if(marshal)
+ {
out << nl << scope << "ice_write" << dict->name() << "(" << stream << ", " << fixedParam << ");";
- }
- else
- {
+ }
+ else
+ {
out << nl << scope << "ice_read" << dict->name() << "(" << stream << ", " << fixedParam << ");";
- }
+ }
- return;
+ return;
}
EnumPtr en = EnumPtr::dynamicCast(type);
@@ -1479,7 +1479,7 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
out << nl << scope << "ice_read" << en->name() << "(" << stream << ", " << fixedParam << ");";
}
- return;
+ return;
}
ProxyPtr prx = ProxyPtr::dynamicCast(type);
@@ -1496,7 +1496,7 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
out << nl << scope << "ice_read" << cls->name() << "Prx(" << stream << ", " << fixedParam << ");";
}
- return;
+ return;
}
assert(false);
@@ -1509,50 +1509,50 @@ Slice::findMetaData(const StringList& metaData, bool inParam)
for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
{
string str = *q;
- if(str.find(prefix) == 0)
- {
- string::size_type pos = str.find(':', prefix.size());
- //
- // If the form is cpp:type:<...> the data after cpp:type:
- // is returned. If the form is cpp:range:<...> (and this
- // is an inParam) the data after cpp: is returned.
- //
- if(pos != string::npos)
- {
- string ss = str.substr(prefix.size(), pos - prefix.size());
- if(ss == "type")
- {
- return str.substr(pos + 1);
- }
- else if(inParam && ss == "range")
- {
- return str.substr(prefix.size());
- }
- }
- //
- // If the data is an inParam and the metadata is cpp:array
- // or cpp:range then array or range is returned.
- //
- else if(inParam)
- {
- string ss = str.substr(prefix.size());
- if(ss == "array" || ss == "range")
- {
- return ss;
- }
- }
- //
- // Otherwise if the data is "class" it is returned.
- //
- else
- {
- string ss = str.substr(prefix.size());
- if(ss == "class")
- {
- return ss;
- }
- }
- }
+ if(str.find(prefix) == 0)
+ {
+ string::size_type pos = str.find(':', prefix.size());
+ //
+ // If the form is cpp:type:<...> the data after cpp:type:
+ // is returned. If the form is cpp:range:<...> (and this
+ // is an inParam) the data after cpp: is returned.
+ //
+ if(pos != string::npos)
+ {
+ string ss = str.substr(prefix.size(), pos - prefix.size());
+ if(ss == "type")
+ {
+ return str.substr(pos + 1);
+ }
+ else if(inParam && ss == "range")
+ {
+ return str.substr(prefix.size());
+ }
+ }
+ //
+ // If the data is an inParam and the metadata is cpp:array
+ // or cpp:range then array or range is returned.
+ //
+ else if(inParam)
+ {
+ string ss = str.substr(prefix.size());
+ if(ss == "array" || ss == "range")
+ {
+ return ss;
+ }
+ }
+ //
+ // Otherwise if the data is "class" it is returned.
+ //
+ else
+ {
+ string ss = str.substr(prefix.size());
+ if(ss == "class")
+ {
+ return ss;
+ }
+ }
+ }
}
return "";
@@ -1565,20 +1565,20 @@ Slice::inWstringModule(const SequencePtr& seq)
while(cont)
{
ModulePtr mod = ModulePtr::dynamicCast(cont);
- if(!mod)
- {
- break;
- }
- StringList metaData = mod->getMetaData();
- if(find(metaData.begin(), metaData.end(), "cpp:type:wstring") != metaData.end())
- {
- return true;
- }
- else if(find(metaData.begin(), metaData.end(), "cpp:type:string") != metaData.end())
- {
- return false;
- }
- cont = mod->container();
+ if(!mod)
+ {
+ break;
+ }
+ StringList metaData = mod->getMetaData();
+ if(find(metaData.begin(), metaData.end(), "cpp:type:wstring") != metaData.end())
+ {
+ return true;
+ }
+ else if(find(metaData.begin(), metaData.end(), "cpp:type:string") != metaData.end())
+ {
+ return false;
+ }
+ cont = mod->container();
}
return false;
}
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 303870ec66d..061033bb802 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -34,25 +34,25 @@ lookupKwd(const string& name, int baseTypes, bool mangleCasts = false)
//
static const string keywordList[] =
{
- "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const",
- "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern",
- "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface",
- "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override",
- "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short",
- "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof",
- "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while"
+ "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const",
+ "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern",
+ "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface",
+ "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override",
+ "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short",
+ "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof",
+ "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while"
};
bool found = binary_search(&keywordList[0],
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
- name,
- Slice::CICompare());
+ &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
+ name,
+ Slice::CICompare());
if(found)
{
return "@" + name;
}
if(mangleCasts && (name == "checkedCast" || name == "uncheckedCast"))
{
- return string(DotNet::manglePrefix) + name;
+ return string(DotNet::manglePrefix) + name;
}
return Slice::DotNet::mangleName(name, baseTypes);
}
@@ -69,24 +69,24 @@ splitScopedName(const string& scoped)
string::size_type pos;
while((pos = scoped.find("::", next)) != string::npos)
{
- pos += 2;
- if(pos != scoped.size())
- {
- string::size_type endpos = scoped.find("::", pos);
- if(endpos != string::npos)
- {
- ids.push_back(scoped.substr(pos, endpos - pos));
- }
- }
- next = pos;
+ pos += 2;
+ if(pos != scoped.size())
+ {
+ string::size_type endpos = scoped.find("::", pos);
+ if(endpos != string::npos)
+ {
+ ids.push_back(scoped.substr(pos, endpos - pos));
+ }
+ }
+ next = pos;
}
if(next != scoped.size())
{
- ids.push_back(scoped.substr(next));
+ ids.push_back(scoped.substr(next));
}
else
{
- ids.push_back("");
+ ids.push_back("");
}
return ids;
@@ -105,26 +105,26 @@ Slice::CsGenerator::fixId(const string& name, int baseTypes, bool mangleCasts)
{
if(name.empty())
{
- return name;
+ return name;
}
if(name[0] != ':')
{
- return lookupKwd(name, baseTypes, mangleCasts);
+ return lookupKwd(name, baseTypes, mangleCasts);
}
StringList ids = splitScopedName(name);
StringList newIds;
for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
{
- newIds.push_back(lookupKwd(*i, baseTypes));
+ newIds.push_back(lookupKwd(*i, baseTypes));
}
stringstream result;
for(StringList::const_iterator j = newIds.begin(); j != newIds.end(); ++j)
{
- if(j != newIds.begin())
- {
- result << '.';
- }
- result << *j;
+ if(j != newIds.begin())
+ {
+ result << '.';
+ }
+ result << *j;
}
return result.str();
}
@@ -155,7 +155,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- return builtinTable[builtin->kind()];
+ return builtinTable[builtin->kind()];
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
@@ -167,7 +167,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type)
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq && !seq->hasMetaData("clr:collection"))
{
- return typeToString(seq->type()) + "[]";
+ return typeToString(seq->type()) + "[]";
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
@@ -186,54 +186,54 @@ Slice::CsGenerator::isValueType(const TypePtr& type)
if(builtin)
{
switch(builtin->kind())
- {
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- {
- return false;
- break;
- }
- default:
- {
- return true;
- break;
- }
- }
+ {
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ return false;
+ break;
+ }
+ default:
+ {
+ return true;
+ break;
+ }
+ }
}
StructPtr s = StructPtr::dynamicCast(type);
if(s)
{
- if(s->hasMetaData("clr:class"))
- {
- return false;
- }
- DataMemberList dm = s->dataMembers();
- for(DataMemberList::const_iterator i = dm.begin(); i != dm.end(); ++i)
- {
- if(!isValueType((*i)->type()))
- {
- return false;
- }
- }
- return true;
+ if(s->hasMetaData("clr:class"))
+ {
+ return false;
+ }
+ DataMemberList dm = s->dataMembers();
+ for(DataMemberList::const_iterator i = dm.begin(); i != dm.end(); ++i)
+ {
+ if(!isValueType((*i)->type()))
+ {
+ return false;
+ }
+ }
+ return true;
}
if(EnumPtr::dynamicCast(type))
{
- return true;
+ return true;
}
return false;
}
void
Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
- const TypePtr& type,
- const string& param,
- bool marshal,
- bool streamingAPI,
- bool isOutParam,
- const string& patchParams)
+ const TypePtr& type,
+ const string& param,
+ bool marshal,
+ bool streamingAPI,
+ bool isOutParam,
+ const string& patchParams)
{
string stream;
@@ -355,32 +355,32 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- if(isOutParam)
- {
- out << nl << "IceInternal.ParamPatcher " << param
- << "_PP = new IceInternal.ParamPatcher(typeof(Ice.Object), \"::Ice::Object\");";
- out << nl << stream << ".readObject(";
- if(streamingAPI)
- {
- out << "(Ice.ReadObjectCallback)";
- }
- out << param << "_PP);";
- }
- else
- {
- out << nl << stream << ".readObject(";
- if(streamingAPI)
- {
- out << "(Ice.ReadObjectCallback)";
- }
- out << "new Patcher__(" << patchParams << "));";
- }
+ if(isOutParam)
+ {
+ out << nl << "IceInternal.ParamPatcher " << param
+ << "_PP = new IceInternal.ParamPatcher(typeof(Ice.Object), \"::Ice::Object\");";
+ out << nl << stream << ".readObject(";
+ if(streamingAPI)
+ {
+ out << "(Ice.ReadObjectCallback)";
+ }
+ out << param << "_PP);";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(";
+ if(streamingAPI)
+ {
+ out << "(Ice.ReadObjectCallback)";
+ }
+ out << "new Patcher__(" << patchParams << "));";
+ }
}
break;
}
case Builtin::KindObjectProxy:
{
- string typeS = typeToString(type);
+ string typeS = typeToString(type);
if(marshal)
{
out << nl << stream << ".writeProxy(" << param << ");";
@@ -407,20 +407,20 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
if(marshal)
{
out << nl << typeS << "Helper.write";
- if(!streamingAPI)
- {
- out << "__";
- }
- out << "(" << stream << ", " << param << ");";
+ if(!streamingAPI)
+ {
+ out << "__";
+ }
+ out << "(" << stream << ", " << param << ");";
}
else
{
out << nl << param << " = " << typeS << "Helper.read";
- if(!streamingAPI)
- {
- out << "__";
- }
- out << "(" << stream << ");";
+ if(!streamingAPI)
+ {
+ out << "__";
+ }
+ out << "(" << stream << ");";
}
return;
}
@@ -434,27 +434,27 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- if(isOutParam)
- {
- ContainedPtr contained = ContainedPtr::dynamicCast(type);
- out << nl << "IceInternal.ParamPatcher " << param
- << "_PP = new IceInternal.ParamPatcher(typeof(" << typeToString(type) << "), \"" << contained->scoped() << "\");";
- out << nl << stream << ".readObject(";
- if(streamingAPI)
- {
- out << "(Ice.ReadObjectCallback)";
- }
- out << param << "_PP);";
- }
- else
- {
- out << nl << stream << ".readObject(";
- if(streamingAPI)
- {
- out << "(Ice.ReadObjectCallback)";
- }
- out << "new Patcher__(" << patchParams << "));";
- }
+ if(isOutParam)
+ {
+ ContainedPtr contained = ContainedPtr::dynamicCast(type);
+ out << nl << "IceInternal.ParamPatcher " << param
+ << "_PP = new IceInternal.ParamPatcher(typeof(" << typeToString(type) << "), \"" << contained->scoped() << "\");";
+ out << nl << stream << ".readObject(";
+ if(streamingAPI)
+ {
+ out << "(Ice.ReadObjectCallback)";
+ }
+ out << param << "_PP);";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(";
+ if(streamingAPI)
+ {
+ out << "(Ice.ReadObjectCallback)";
+ }
+ out << "new Patcher__(" << patchParams << "));";
+ }
}
return;
}
@@ -464,27 +464,27 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
if(marshal)
{
- if(streamingAPI)
- {
- out << nl << param << ".ice_write(" << stream << ");";
- }
- else
- {
- out << nl << param << ".write__(" << stream << ");";
- }
+ if(streamingAPI)
+ {
+ out << nl << param << ".ice_write(" << stream << ");";
+ }
+ else
+ {
+ out << nl << param << ".write__(" << stream << ");";
+ }
}
else
{
string typeS = typeToString(type);
out << nl << param << " = new " << typeS << "();";
- if(streamingAPI)
- {
- out << nl << param << ".ice_read(" << stream << ");";
- }
- else
- {
- out << nl << param << ".read__(" << stream << ");";
- }
+ if(streamingAPI)
+ {
+ out << nl << param << ".ice_read(" << stream << ");";
+ }
+ else
+ {
+ out << nl << param << ".read__(" << stream << ");";
+ }
}
return;
}
@@ -492,32 +492,32 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- string func;
- string cast;
- size_t sz = en->getEnumerators().size();
- if(sz <= 0x7f)
- {
- func = marshal ? "writeByte" : "readByte";
- cast = marshal ? string("(byte)") : "(" + fixId(en->scoped()) + ")";
- }
- else if(sz <= 0x7fff)
- {
- func = marshal ? "writeShort" : "readShort";
- cast = marshal ? string("(short)") : "(" + fixId(en->scoped()) + ")";
- }
- else
- {
- func = marshal ? "writeInt" : "readInt";
- cast = marshal ? string("(int)") : "(" + fixId(en->scoped()) + ")";
- }
- if(marshal)
- {
- out << nl << stream << '.' << func << '(' << cast << param << ");";
- }
- else
- {
- out << nl << param << " = " << cast << stream << '.' << func << "()" << ';';
- }
+ string func;
+ string cast;
+ size_t sz = en->getEnumerators().size();
+ if(sz <= 0x7f)
+ {
+ func = marshal ? "writeByte" : "readByte";
+ cast = marshal ? string("(byte)") : "(" + fixId(en->scoped()) + ")";
+ }
+ else if(sz <= 0x7fff)
+ {
+ func = marshal ? "writeShort" : "readShort";
+ cast = marshal ? string("(short)") : "(" + fixId(en->scoped()) + ")";
+ }
+ else
+ {
+ func = marshal ? "writeInt" : "readInt";
+ cast = marshal ? string("(int)") : "(" + fixId(en->scoped()) + ")";
+ }
+ if(marshal)
+ {
+ out << nl << stream << '.' << func << '(' << cast << param << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << cast << stream << '.' << func << "()" << ';';
+ }
return;
}
@@ -545,7 +545,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
const SequencePtr& seq,
const string& param,
bool marshal,
- bool streamingAPI)
+ bool streamingAPI)
{
string stream;
if(marshal)
@@ -566,127 +566,127 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- switch(builtin->kind())
- {
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- {
- if(marshal)
- {
- out << nl << "if(" << param << " == null)";
- out << sb;
- out << nl << stream << ".writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
- out << sb;
- string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy";
- out << nl << stream << '.' << func << '(' << param << "[ix__]);";
- out << eb;
- out << eb;
- }
- else
- {
- out << nl << "int lenx__ = " << stream << ".readSize();";
- if(!streamingAPI)
- {
- if(builtin->isVariableLength())
- {
- out << nl << stream << ".startSeq(lenx__, "
- << static_cast<unsigned>(builtin->minWireSize()) << ");";
- }
- else
- {
- out << nl << stream << ".checkFixedSeq(lenx__, "
- << static_cast<unsigned>(builtin->minWireSize()) << ");";
- }
- }
- out << nl << param << " = new ";
- if(builtin->kind() == Builtin::KindObject)
- {
- if(isArray)
- {
- out << "Ice.Object[lenx__];";
- }
- else
- {
- out << typeToString(seq) << "(lenx__);";
- }
- out << nl << "for(int ix__ = 0; ix__ < lenx__; ++ix__)";
- out << sb;
- out << nl << stream << ".readObject(";
- if(streamingAPI)
- {
- out << "(ReadObjectCallback)";
- }
- out << "new IceInternal.SequencePatcher(" << param << ", typeof(Ice.Object), ix__));";
- }
- else
- {
- if(isArray)
- {
- out << "Ice.ObjectPrx[lenx__];";
- }
- else
- {
- out << typeToString(seq) << "(lenx__);";
- }
- out << nl << "for(int ix__ = 0; ix__ < lenx__; ++ix__)";
- out << sb;
- if(isArray)
- {
- out << nl << param << "[ix__] = " << stream << ".readProxy();";
- }
- else
- {
- out << nl << "Ice.ObjectPrx val__ = new Ice.ObjectPrxHelperBase();";
- out << nl << "val__ = " << stream << ".readProxy();";
- out << nl << param << ".Add(val__);";
- }
- }
- if(!streamingAPI && builtin->isVariableLength())
- {
- out << nl << stream << ".checkSeq();";
- out << nl << stream << ".endElement();";
- }
- out << eb;
- if(!streamingAPI && builtin->isVariableLength())
- {
- out << nl << stream << ".endSeq(lenx__);";
- }
- }
- break;
- }
- default:
- {
- typeS[0] = toupper(typeS[0]);
- if(marshal)
- {
- out << nl << stream << ".write" << typeS << "Seq(" << param;
- if(!isArray)
- {
- out << " == null ? null : " << param << ".ToArray()";
- }
- out << ");";
- }
- else
- {
- if(!isArray)
- {
- out << nl << param << " = new " << fixId(seq->scoped())
- << '(' << stream << ".read" << typeS << "Seq());";
- }
- else
- {
- out << nl << param << " = " << stream << ".read" << typeS << "Seq();";
- }
- }
- break;
- }
- }
- return;
+ switch(builtin->kind())
+ {
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ {
+ if(marshal)
+ {
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << sb;
+ string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy";
+ out << nl << stream << '.' << func << '(' << param << "[ix__]);";
+ out << eb;
+ out << eb;
+ }
+ else
+ {
+ out << nl << "int lenx__ = " << stream << ".readSize();";
+ if(!streamingAPI)
+ {
+ if(builtin->isVariableLength())
+ {
+ out << nl << stream << ".startSeq(lenx__, "
+ << static_cast<unsigned>(builtin->minWireSize()) << ");";
+ }
+ else
+ {
+ out << nl << stream << ".checkFixedSeq(lenx__, "
+ << static_cast<unsigned>(builtin->minWireSize()) << ");";
+ }
+ }
+ out << nl << param << " = new ";
+ if(builtin->kind() == Builtin::KindObject)
+ {
+ if(isArray)
+ {
+ out << "Ice.Object[lenx__];";
+ }
+ else
+ {
+ out << typeToString(seq) << "(lenx__);";
+ }
+ out << nl << "for(int ix__ = 0; ix__ < lenx__; ++ix__)";
+ out << sb;
+ out << nl << stream << ".readObject(";
+ if(streamingAPI)
+ {
+ out << "(ReadObjectCallback)";
+ }
+ out << "new IceInternal.SequencePatcher(" << param << ", typeof(Ice.Object), ix__));";
+ }
+ else
+ {
+ if(isArray)
+ {
+ out << "Ice.ObjectPrx[lenx__];";
+ }
+ else
+ {
+ out << typeToString(seq) << "(lenx__);";
+ }
+ out << nl << "for(int ix__ = 0; ix__ < lenx__; ++ix__)";
+ out << sb;
+ if(isArray)
+ {
+ out << nl << param << "[ix__] = " << stream << ".readProxy();";
+ }
+ else
+ {
+ out << nl << "Ice.ObjectPrx val__ = new Ice.ObjectPrxHelperBase();";
+ out << nl << "val__ = " << stream << ".readProxy();";
+ out << nl << param << ".Add(val__);";
+ }
+ }
+ if(!streamingAPI && builtin->isVariableLength())
+ {
+ out << nl << stream << ".checkSeq();";
+ out << nl << stream << ".endElement();";
+ }
+ out << eb;
+ if(!streamingAPI && builtin->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(lenx__);";
+ }
+ }
+ break;
+ }
+ default:
+ {
+ typeS[0] = toupper(typeS[0]);
+ if(marshal)
+ {
+ out << nl << stream << ".write" << typeS << "Seq(" << param;
+ if(!isArray)
+ {
+ out << " == null ? null : " << param << ".ToArray()";
+ }
+ out << ");";
+ }
+ else
+ {
+ if(!isArray)
+ {
+ out << nl << param << " = new " << fixId(seq->scoped())
+ << '(' << stream << ".read" << typeS << "Seq());";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".read" << typeS << "Seq();";
+ }
+ }
+ break;
+ }
+ }
+ return;
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
@@ -694,65 +694,65 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(marshal)
{
- out << nl << "if(" << param << " == null)";
- out << sb;
- out << nl << stream << ".writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
- out << sb;
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << sb;
out << nl << stream << ".writeObject(" << param << "[ix__]);";
- out << eb;
- out << eb;
+ out << eb;
+ out << eb;
}
else
{
- out << sb;
- out << nl << "int szx__ = " << stream << ".readSize();";
- if(!streamingAPI)
- {
- if(type->isVariableLength())
- {
- out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
- }
- else
- {
- out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
- }
- }
- out << nl << param << " = new ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "[]", "szx__");
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << ';';
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
- out << sb;
- out << nl << "IceInternal.SequencePatcher spx = new IceInternal.SequencePatcher("
- << param << ", " << "typeof(" << typeS << "), ix__);";
- out << nl << stream << ".readObject(";
- if(streamingAPI)
- {
- out << "(Ice.ReadObjectCallback)";
- }
- out << "spx);";
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".checkSeq();";
- out << nl << stream << ".endElement();";
- }
- out << eb;
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".endSeq(szx__);";
- }
- out << eb;
+ out << sb;
+ out << nl << "int szx__ = " << stream << ".readSize();";
+ if(!streamingAPI)
+ {
+ if(type->isVariableLength())
+ {
+ out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ }
+ else
+ {
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ }
+ }
+ out << nl << param << " = new ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "[]", "szx__");
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << ';';
+ out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << sb;
+ out << nl << "IceInternal.SequencePatcher spx = new IceInternal.SequencePatcher("
+ << param << ", " << "typeof(" << typeS << "), ix__);";
+ out << nl << stream << ".readObject(";
+ if(streamingAPI)
+ {
+ out << "(Ice.ReadObjectCallback)";
+ }
+ out << "spx);";
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".checkSeq();";
+ out << nl << stream << ".endElement();";
+ }
+ out << eb;
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(szx__);";
+ }
+ out << eb;
}
return;
}
@@ -761,146 +761,146 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
if(st)
{
if(marshal)
- {
- out << nl << "if(" << param << " == null)";
- out << sb;
- out << nl << stream << ".writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
- out << sb;
- if(streamingAPI)
- {
- out << nl << param << "[ix__].ice_write(" << stream << ");";
- }
- else
- {
- out << nl << param << "[ix__].write__(" << stream << ");";
- }
- out << eb;
- out << eb;
- }
- else
- {
- out << sb;
- out << nl << "int szx__ = " << stream << ".readSize();";
- if(!streamingAPI)
- {
- if(type->isVariableLength())
- {
- out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
- }
- else
- {
- out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
- }
- }
- out << nl << param << " = new ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "[]", "szx__");
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << ';';
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
- out << sb;
- if(isArray)
- {
- if(!isValueType(st))
- {
- out << nl << param << "[ix__] = new " << typeS << "();";
- }
- if(streamingAPI)
- {
- out << nl << param << "[ix__].ice_read(" << stream << ");";
- }
- else
- {
- out << nl << param << "[ix__].read__(" << stream << ");";
- }
- }
- else
- {
- out << nl << typeS << " val__ = new " << typeS << "();";
- if(streamingAPI)
- {
- out << nl << "val__.ice_read(" << stream << ");";
- }
- else
- {
- out << nl << "val__.read__(" << stream << ");";
- }
- out << nl << param << ".Add(val__);";
- }
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".checkSeq();";
- out << nl << stream << ".endElement();";
- }
- out << eb;
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".endSeq(szx__);";
- }
- out << eb;
- }
- return;
+ {
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << sb;
+ if(streamingAPI)
+ {
+ out << nl << param << "[ix__].ice_write(" << stream << ");";
+ }
+ else
+ {
+ out << nl << param << "[ix__].write__(" << stream << ");";
+ }
+ out << eb;
+ out << eb;
+ }
+ else
+ {
+ out << sb;
+ out << nl << "int szx__ = " << stream << ".readSize();";
+ if(!streamingAPI)
+ {
+ if(type->isVariableLength())
+ {
+ out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ }
+ else
+ {
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ }
+ }
+ out << nl << param << " = new ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "[]", "szx__");
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << ';';
+ out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << sb;
+ if(isArray)
+ {
+ if(!isValueType(st))
+ {
+ out << nl << param << "[ix__] = new " << typeS << "();";
+ }
+ if(streamingAPI)
+ {
+ out << nl << param << "[ix__].ice_read(" << stream << ");";
+ }
+ else
+ {
+ out << nl << param << "[ix__].read__(" << stream << ");";
+ }
+ }
+ else
+ {
+ out << nl << typeS << " val__ = new " << typeS << "();";
+ if(streamingAPI)
+ {
+ out << nl << "val__.ice_read(" << stream << ");";
+ }
+ else
+ {
+ out << nl << "val__.read__(" << stream << ");";
+ }
+ out << nl << param << ".Add(val__);";
+ }
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".checkSeq();";
+ out << nl << stream << ".endElement();";
+ }
+ out << eb;
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(szx__);";
+ }
+ out << eb;
+ }
+ return;
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- if(marshal)
- {
- out << nl << "if(" << param << " == null)";
- out << sb;
- out << nl << stream << ".writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << stream << ".writeSize(" << param << '.'<< limitID << ");";
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
- out << sb;
- out << nl << stream << ".writeByte((byte)" << param << "[ix__]);";
- out << eb;
- out << eb;
- }
- else
- {
- out << sb;
- out << nl << "int szx__ = " << stream << ".readSize();";
- if(!streamingAPI)
- {
- out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
- }
- out << nl << param << " = new ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "[]", "szx__");
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << ';';
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
- out << sb;
- if(isArray)
- {
- out << nl << param << "[ix__] = (" << typeS << ')' << stream << ".readByte();";
- }
- else
- {
- out << nl << param << ".Add((" << typeS << ')' << stream << ".readByte());";
- }
- out << eb;
- out << eb;
- }
+ if(marshal)
+ {
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << ".writeSize(" << param << '.'<< limitID << ");";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << sb;
+ out << nl << stream << ".writeByte((byte)" << param << "[ix__]);";
+ out << eb;
+ out << eb;
+ }
+ else
+ {
+ out << sb;
+ out << nl << "int szx__ = " << stream << ".readSize();";
+ if(!streamingAPI)
+ {
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ }
+ out << nl << param << " = new ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "[]", "szx__");
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << ';';
+ out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << sb;
+ if(isArray)
+ {
+ out << nl << param << "[ix__] = (" << typeS << ')' << stream << ".readByte();";
+ }
+ else
+ {
+ out << nl << param << ".Add((" << typeS << ')' << stream << ".readByte());";
+ }
+ out << eb;
+ out << eb;
+ }
return;
}
@@ -918,77 +918,77 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
if(marshal)
{
func = "write";
- if(!streamingAPI && ProxyPtr::dynamicCast(type))
- {
- func += "__";
- }
- out << nl << "if(" << param << " == null)";
- out << sb;
- out << nl << stream << ".writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
- out << sb;
- out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[ix__]);";
- out << eb;
- out << eb;
+ if(!streamingAPI && ProxyPtr::dynamicCast(type))
+ {
+ func += "__";
+ }
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
+ out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << sb;
+ out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[ix__]);";
+ out << eb;
+ out << eb;
}
else
{
func = "read";
- if(!streamingAPI && ProxyPtr::dynamicCast(type))
- {
- func += "__";
- }
- out << sb;
- out << nl << "int szx__ = " << stream << ".readSize();";
- if(!streamingAPI)
- {
- if(type->isVariableLength())
- {
- out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
- }
- else
- {
- out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
- }
- }
- out << nl << param << " = new ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "[]", "szx__");
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << ';';
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
- out << sb;
- if(isArray)
- {
- out << nl << param << "[ix__] = " << helperName << '.' << func << '(' << stream << ");";
- }
- else
- {
- out << nl << param << ".Add(" << helperName << '.' << func << '(' << stream << "));";
- }
- if(!streamingAPI && type->isVariableLength())
- {
- if(!SequencePtr::dynamicCast(type))
- {
- out << nl << stream << ".checkSeq();";
- }
- out << nl << stream << ".endElement();";
- }
- out << eb;
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".endSeq(szx__);";
- }
- out << eb;
+ if(!streamingAPI && ProxyPtr::dynamicCast(type))
+ {
+ func += "__";
+ }
+ out << sb;
+ out << nl << "int szx__ = " << stream << ".readSize();";
+ if(!streamingAPI)
+ {
+ if(type->isVariableLength())
+ {
+ out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ }
+ else
+ {
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ }
+ }
+ out << nl << param << " = new ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "[]", "szx__");
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << ';';
+ out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << sb;
+ if(isArray)
+ {
+ out << nl << param << "[ix__] = " << helperName << '.' << func << '(' << stream << ");";
+ }
+ else
+ {
+ out << nl << param << ".Add(" << helperName << '.' << func << '(' << stream << "));";
+ }
+ if(!streamingAPI && type->isVariableLength())
+ {
+ if(!SequencePtr::dynamicCast(type))
+ {
+ out << nl << stream << ".checkSeq();";
+ }
+ out << nl << stream << ".endElement();";
+ }
+ out << eb;
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(szx__);";
+ }
+ out << eb;
}
return;
@@ -1002,7 +1002,7 @@ Slice::CsGenerator::toArrayAlloc(const string& decl, const string& sz)
while(pos > 1 && decl.substr(pos - 2, 2) == "[]")
{
++count;
- pos -= 2;
+ pos -= 2;
}
assert(count > 0);
@@ -1028,31 +1028,31 @@ Slice::CsGenerator::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
{
if(!_globalMetaDataDone)
{
- //
- // Validate global metadata.
- //
- DefinitionContextPtr dc = p->definitionContext();
- assert(dc);
- StringList globalMetaData = dc->getMetaData();
- string file = dc->filename();
- static const string prefix = "cs:";
- for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
- {
- string s = *q;
- if(_history.count(s) == 0)
- {
- if(s.find(prefix) == 0)
- {
- static const string attributePrefix = "cs:attribute:";
- if(s.find(attributePrefix) != 0 || s.size() == attributePrefix.size())
- {
- cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
- }
- }
- _history.insert(s);
- }
- }
- _globalMetaDataDone = true;
+ //
+ // Validate global metadata.
+ //
+ DefinitionContextPtr dc = p->definitionContext();
+ assert(dc);
+ StringList globalMetaData = dc->getMetaData();
+ string file = dc->filename();
+ static const string prefix = "cs:";
+ for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
+ {
+ string s = *q;
+ if(_history.count(s) == 0)
+ {
+ if(s.find(prefix) == 0)
+ {
+ static const string attributePrefix = "cs:attribute:";
+ if(s.find(attributePrefix) != 0 || s.size() == attributePrefix.size())
+ {
+ cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
+ }
+ }
+ _history.insert(s);
+ }
+ }
+ _globalMetaDataDone = true;
}
validate(p);
return true;
@@ -1160,83 +1160,83 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont)
for(p = localMetaData.begin(); p != localMetaData.end(); ++p)
{
- string s = *p;
+ string s = *p;
- if(s.find("cs:") == 0) // TODO: remove this statement once "cs:" is a hard error.
- {
- if(SequencePtr::dynamicCast(cont))
- {
- if(s.substr(3) == "collection")
- {
- cout << file << ":" << cont->line() << ": warning: `cs:' metadata prefix is deprecated; "
- << "use `clr:' instead" << endl;
- cont->addMetaData("clr:collection");
- }
- }
- else if(StructPtr::dynamicCast(cont))
- {
- if(s.substr(3) == "class")
- {
- cout << file << ":" << cont->line() << ": warning: `cs:' metadata prefix is deprecated; "
- << "use `clr:' instead" << endl;
- cont->addMetaData("clr:class");
- }
- }
- else if(s.find("cs:attribute:") == 0)
- {
- ; // Do nothing, "cs:attribute:" is OK
- }
- else
- {
- cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
- }
- } // End TODO
+ if(s.find("cs:") == 0) // TODO: remove this statement once "cs:" is a hard error.
+ {
+ if(SequencePtr::dynamicCast(cont))
+ {
+ if(s.substr(3) == "collection")
+ {
+ cout << file << ":" << cont->line() << ": warning: `cs:' metadata prefix is deprecated; "
+ << "use `clr:' instead" << endl;
+ cont->addMetaData("clr:collection");
+ }
+ }
+ else if(StructPtr::dynamicCast(cont))
+ {
+ if(s.substr(3) == "class")
+ {
+ cout << file << ":" << cont->line() << ": warning: `cs:' metadata prefix is deprecated; "
+ << "use `clr:' instead" << endl;
+ cont->addMetaData("clr:class");
+ }
+ }
+ else if(s.find("cs:attribute:") == 0)
+ {
+ ; // Do nothing, "cs:attribute:" is OK
+ }
+ else
+ {
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ }
+ } // End TODO
- string prefix = "clr:";
+ string prefix = "clr:";
if(_history.count(s) == 0)
{
if(s.find(prefix) == 0)
{
- if(SequencePtr::dynamicCast(cont))
- {
- if(s.substr(prefix.size()) == "collection")
- {
- continue;
- }
- }
- if(StructPtr::dynamicCast(cont))
- {
- if(s.substr(prefix.size()) == "class")
- {
- continue;
- }
- if(s.substr(prefix.size()) == "property")
- {
- continue;
- }
- }
- if(ClassDefPtr::dynamicCast(cont))
- {
- if(s.substr(prefix.size()) == "property")
- {
- continue;
- }
- }
- cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ if(SequencePtr::dynamicCast(cont))
+ {
+ if(s.substr(prefix.size()) == "collection")
+ {
+ continue;
+ }
+ }
+ if(StructPtr::dynamicCast(cont))
+ {
+ if(s.substr(prefix.size()) == "class")
+ {
+ continue;
+ }
+ if(s.substr(prefix.size()) == "property")
+ {
+ continue;
+ }
+ }
+ if(ClassDefPtr::dynamicCast(cont))
+ {
+ if(s.substr(prefix.size()) == "property")
+ {
+ continue;
+ }
+ }
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
}
_history.insert(s);
}
- prefix = "cs:";
+ prefix = "cs:";
if(_history.count(s) == 0)
{
if(s.find(prefix) == 0)
{
- if(s.substr(prefix.size()) == "attribute:")
- {
- continue;
- }
- cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ if(s.substr(prefix.size()) == "attribute:")
+ {
+ continue;
+ }
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
}
_history.insert(s);
}
diff --git a/cpp/src/Slice/DotNetNames.cpp b/cpp/src/Slice/DotNetNames.cpp
index 5588f9a20c9..f55f6470454 100755
--- a/cpp/src/Slice/DotNetNames.cpp
+++ b/cpp/src/Slice/DotNetNames.cpp
@@ -25,81 +25,81 @@ struct Node
};
static const char* ObjectNames[] =
- {
- "Equals", "Finalize", "GetHashCode", "GetType",
- "MemberwiseClone", "ReferenceEquals", "ToString", 0
- };
+ {
+ "Equals", "Finalize", "GetHashCode", "GetType",
+ "MemberwiseClone", "ReferenceEquals", "ToString", 0
+ };
static const Node* ObjectParents[] =
- {
- 0
- };
+ {
+ 0
+ };
static const Node ObjectNode =
- {
- ObjectNames, &ObjectParents[0]
- };
+ {
+ ObjectNames, &ObjectParents[0]
+ };
static const char* ICloneableNames[] =
- {
- "Clone", 0
- };
+ {
+ "Clone", 0
+ };
static const Node* ICloneableParents[] =
- {
- &ObjectNode, 0
- };
+ {
+ &ObjectNode, 0
+ };
static const Node ICloneableNode =
- {
- ICloneableNames, &ICloneableParents[0]
- };
+ {
+ ICloneableNames, &ICloneableParents[0]
+ };
static const char* ExceptionNames[] =
- {
- "GetBaseException", "GetObjectData", "HelpLink", "HResult", "InnerException",
- "Message", "Source", "StackTrace", "TargetSite", 0
- };
+ {
+ "GetBaseException", "GetObjectData", "HelpLink", "HResult", "InnerException",
+ "Message", "Source", "StackTrace", "TargetSite", 0
+ };
static const Node* ExceptionParents[] =
- {
- &ObjectNode, 0
- };
+ {
+ &ObjectNode, 0
+ };
static const Node ExceptionNode =
- {
- ExceptionNames, &ExceptionParents[0]
- };
+ {
+ ExceptionNames, &ExceptionParents[0]
+ };
static const char* ApplicationExceptionNames[] =
- {
- 0
- };
+ {
+ 0
+ };
static const Node* ApplicationExceptionParents[] =
- {
- &ExceptionNode, 0
- };
+ {
+ &ExceptionNode, 0
+ };
static const Node ApplicationExceptionNode =
- {
- ApplicationExceptionNames, &ApplicationExceptionParents[0]
- };
+ {
+ ApplicationExceptionNames, &ApplicationExceptionParents[0]
+ };
//
// Must be kept in same order as definition of BaseType in header file!
//
static const Node* nodes[] =
- {
- &ObjectNode, &ICloneableNode, &ExceptionNode, &ApplicationExceptionNode
- };
+ {
+ &ObjectNode, &ICloneableNode, &ExceptionNode, &ApplicationExceptionNode
+ };
static bool
ciEquals(const string& s, const char* p)
{
if(s.size() != strlen(p))
{
- return false;
+ return false;
}
string::const_iterator i = s.begin();
while(i != s.end())
{
- if(tolower(*i++) != tolower(*p++))
- {
- return false;
- }
+ if(tolower(*i++) != tolower(*p++))
+ {
+ return false;
+ }
}
return true;
}
@@ -113,21 +113,21 @@ mangle(const string& s, const Node* np, string& newName)
const char** namep = np->names;
while(*namep)
{
- if(ciEquals(s, *namep))
- {
- newName = manglePrefix + s + mangleSuffix;
- return true;
- }
- ++namep;
+ if(ciEquals(s, *namep))
+ {
+ newName = manglePrefix + s + mangleSuffix;
+ return true;
+ }
+ ++namep;
}
const Node** parentp = np->parents;
while(*parentp)
{
- if(mangle(s, *parentp, newName))
- {
- return true;
- }
- ++parentp;
+ if(mangle(s, *parentp, newName))
+ {
+ return true;
+ }
+ ++parentp;
}
return false;
}
@@ -141,18 +141,18 @@ Slice::DotNet::mangleName(const string& s, int baseTypes)
{
if(baseTypes == 0)
{
- return s;
+ return s;
}
string newName;
for(unsigned int mask = 1, i=0; mask < END; mask <<= 1, ++i)
{
- if(baseTypes & mask)
- {
- if(mangle(s, nodes[i], newName))
- {
- return newName;
- }
- }
+ if(baseTypes & mask)
+ {
+ if(mangle(s, nodes[i], newName))
+ {
+ return newName;
+ }
+ }
}
return s;
}
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index 5406f1dedef..3c3d68afd0e 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -220,16 +220,16 @@ lookupKwd(const string& name)
"abstract", "assert", "boolean", "break", "byte", "case", "catch",
"char", "checkedCast", "class", "clone", "const", "continue", "default", "do",
"double", "else", "enum", "equals", "extends", "false", "final", "finalize",
- "finally", "float", "for", "getClass", "goto", "hashCode", "if",
- "implements", "import", "instanceof", "int", "interface", "long",
- "native", "new", "notify", "notifyAll", "null", "package", "private",
- "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
+ "finally", "float", "for", "getClass", "goto", "hashCode", "if",
+ "implements", "import", "instanceof", "int", "interface", "long",
+ "native", "new", "notify", "notifyAll", "null", "package", "private",
+ "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
"synchronized", "this", "throw", "throws", "toString", "transient",
"true", "try", "uncheckedCast", "void", "volatile", "wait", "while"
};
bool found = binary_search(&keywordList[0],
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
- name);
+ &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
+ name);
return found ? "_" + name : name;
}
@@ -245,24 +245,24 @@ splitScopedName(const string& scoped)
string::size_type pos;
while((pos = scoped.find("::", next)) != string::npos)
{
- pos += 2;
- if(pos != scoped.size())
- {
- string::size_type endpos = scoped.find("::", pos);
- if(endpos != string::npos)
- {
- ids.push_back(scoped.substr(pos, endpos - pos));
- }
- }
- next = pos;
+ pos += 2;
+ if(pos != scoped.size())
+ {
+ string::size_type endpos = scoped.find("::", pos);
+ if(endpos != string::npos)
+ {
+ ids.push_back(scoped.substr(pos, endpos - pos));
+ }
+ }
+ next = pos;
}
if(next != scoped.size())
{
- ids.push_back(scoped.substr(next));
+ ids.push_back(scoped.substr(next));
}
else
{
- ids.push_back("");
+ ids.push_back("");
}
return ids;
@@ -280,18 +280,18 @@ Slice::JavaGenerator::fixKwd(const string& name) const
{
if(name.empty())
{
- return name;
+ return name;
}
if(name[0] != ':')
{
- return lookupKwd(name);
+ return lookupKwd(name);
}
StringList ids = splitScopedName(name);
transform(ids.begin(), ids.end(), ids.begin(), ptr_fun(lookupKwd));
stringstream result;
for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
{
- result << "::" + *i;
+ result << "::" + *i;
}
return result.str();
}
@@ -403,7 +403,7 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
TypeMode mode,
const string& package,
const StringList& metaData,
- bool abstract) const
+ bool abstract) const
{
static const char* builtinTable[] =
{
@@ -470,48 +470,48 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
{
if(mode == TypeModeOut)
{
- if(_featureProfile == Slice::IceE)
- {
- return getAbsolute(dict, package, "", "Holder");
- }
- else
- {
- //
- // Only use the type's generated holder if the concrete and
- // abstract types match.
- //
- string concreteType, abstractType;
- getDictionaryTypes(dict, "", metaData, concreteType, abstractType);
- string origConcreteType, origAbstractType;
- getDictionaryTypes(dict, "", StringList(), origConcreteType, origAbstractType);
- if(abstractType == origAbstractType && concreteType == origConcreteType)
- {
- return getAbsolute(dict, package, "", "Holder");
- }
-
- bool java2 = dict->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
-
- //
- // The custom type may or may not be compatible with the type used
- // in the generated holder. For Java5, we can use a generic holder
- // that holds a value of the abstract custom type. Otherwise, we
- // use MapHolder.
- //
- if(java2)
- {
- return "Ice.MapHolder";
- }
- else
- {
- return string("Ice.Holder<") + abstractType + " >";
- }
- }
+ if(_featureProfile == Slice::IceE)
+ {
+ return getAbsolute(dict, package, "", "Holder");
+ }
+ else
+ {
+ //
+ // Only use the type's generated holder if the concrete and
+ // abstract types match.
+ //
+ string concreteType, abstractType;
+ getDictionaryTypes(dict, "", metaData, concreteType, abstractType);
+ string origConcreteType, origAbstractType;
+ getDictionaryTypes(dict, "", StringList(), origConcreteType, origAbstractType);
+ if(abstractType == origAbstractType && concreteType == origConcreteType)
+ {
+ return getAbsolute(dict, package, "", "Holder");
+ }
+
+ bool java2 = dict->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
+
+ //
+ // The custom type may or may not be compatible with the type used
+ // in the generated holder. For Java5, we can use a generic holder
+ // that holds a value of the abstract custom type. Otherwise, we
+ // use MapHolder.
+ //
+ if(java2)
+ {
+ return "Ice.MapHolder";
+ }
+ else
+ {
+ return string("Ice.Holder<") + abstractType + " >";
+ }
+ }
}
else
{
- string concreteType, abstractType;
- getDictionaryTypes(dict, package, metaData, concreteType, abstractType);
- return abstract ? abstractType : concreteType;
+ string concreteType, abstractType;
+ getDictionaryTypes(dict, package, metaData, concreteType, abstractType);
+ return abstract ? abstractType : concreteType;
}
}
@@ -520,59 +520,59 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
{
if(mode == TypeModeOut)
{
- if(_featureProfile == Slice::IceE)
- {
- return getAbsolute(seq, package, "", "Holder");
- }
- else
- {
- //
- // Only use the type's generated holder if the concrete and
- // abstract types match.
- //
- string concreteType, abstractType;
- getSequenceTypes(seq, "", metaData, concreteType, abstractType);
- string origConcreteType, origAbstractType;
- getSequenceTypes(seq, "", StringList(), origConcreteType, origAbstractType);
- if(abstractType == origAbstractType && concreteType == origConcreteType)
- {
- return getAbsolute(seq, package, "", "Holder");
- }
-
- bool java2 = seq->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
-
- //
- // The custom type may or may not be compatible with the type used
- // in the generated holder. For Java5, we can use a generic holder
- // that holds a value of the abstract custom type. Otherwise, we
- // choose a predefined holder class.
- //
- if(java2)
- {
- if(abstractType == "java.util.ArrayList")
- {
- return "Ice.ArrayListHolder";
- }
- else if(abstractType == "java.util.LinkedList")
- {
- return "Ice.LinkedListHolder";
- }
- else
- {
- return "Ice.ListHolder";
- }
- }
- else
- {
- return string("Ice.Holder<") + abstractType + " >";
- }
- }
+ if(_featureProfile == Slice::IceE)
+ {
+ return getAbsolute(seq, package, "", "Holder");
+ }
+ else
+ {
+ //
+ // Only use the type's generated holder if the concrete and
+ // abstract types match.
+ //
+ string concreteType, abstractType;
+ getSequenceTypes(seq, "", metaData, concreteType, abstractType);
+ string origConcreteType, origAbstractType;
+ getSequenceTypes(seq, "", StringList(), origConcreteType, origAbstractType);
+ if(abstractType == origAbstractType && concreteType == origConcreteType)
+ {
+ return getAbsolute(seq, package, "", "Holder");
+ }
+
+ bool java2 = seq->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
+
+ //
+ // The custom type may or may not be compatible with the type used
+ // in the generated holder. For Java5, we can use a generic holder
+ // that holds a value of the abstract custom type. Otherwise, we
+ // choose a predefined holder class.
+ //
+ if(java2)
+ {
+ if(abstractType == "java.util.ArrayList")
+ {
+ return "Ice.ArrayListHolder";
+ }
+ else if(abstractType == "java.util.LinkedList")
+ {
+ return "Ice.LinkedListHolder";
+ }
+ else
+ {
+ return "Ice.ListHolder";
+ }
+ }
+ else
+ {
+ return string("Ice.Holder<") + abstractType + " >";
+ }
+ }
}
else
{
- string concreteType, abstractType;
- getSequenceTypes(seq, package, metaData, concreteType, abstractType);
- return abstract ? abstractType : concreteType;
+ string concreteType, abstractType;
+ getSequenceTypes(seq, package, metaData, concreteType, abstractType);
+ return abstract ? abstractType : concreteType;
}
}
@@ -594,10 +594,10 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
string
Slice::JavaGenerator::typeToObjectString(const TypePtr& type,
- TypeMode mode,
- const string& package,
- const StringList& metaData,
- bool abstract) const
+ TypeMode mode,
+ const string& package,
+ const StringList& metaData,
+ bool abstract) const
{
static const char* builtinTable[] =
{
@@ -617,7 +617,7 @@ Slice::JavaGenerator::typeToObjectString(const TypePtr& type,
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin && mode != TypeModeOut)
{
- return builtinTable[builtin->kind()];
+ return builtinTable[builtin->kind()];
}
return typeToString(type, mode, package, metaData, abstract);
@@ -632,7 +632,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
int& iter,
bool holder,
const StringList& metaData,
- const string& patchParams)
+ const string& patchParams)
{
string stream = marshal ? "__os" : "__is";
string v;
@@ -748,31 +748,31 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindObject:
{
- if(_featureProfile != Slice::IceE)
- {
- if(marshal)
- {
- out << nl << stream << ".writeObject(" << v << ");";
- }
- else
- {
- if(holder)
- {
- out << nl << stream << ".readObject(" << param << ".getPatcher());";
- }
- else
- {
- if(patchParams.empty())
- {
- out << nl << stream << ".readObject(new Patcher());";
- }
- else
- {
- out << nl << stream << ".readObject(" << patchParams << ");";
- }
- }
- }
- }
+ if(_featureProfile != Slice::IceE)
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeObject(" << v << ");";
+ }
+ else
+ {
+ if(holder)
+ {
+ out << nl << stream << ".readObject(" << param << ".getPatcher());";
+ }
+ else
+ {
+ if(patchParams.empty())
+ {
+ out << nl << stream << ".readObject(new Patcher());";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(" << patchParams << ");";
+ }
+ }
+ }
+ }
break;
}
case Builtin::KindObjectProxy:
@@ -814,32 +814,32 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- if(_featureProfile != Slice::IceE)
- {
- if(marshal)
- {
- out << nl << stream << ".writeObject(" << v << ");";
- }
- else
- {
- string typeS = typeToString(type, TypeModeIn, package);
- if(holder)
- {
- out << nl << stream << ".readObject(" << param << ".getPatcher());";
- }
- else
- {
- if(patchParams.empty())
- {
- out << nl << stream << ".readObject(new Patcher());";
- }
- else
- {
- out << nl << stream << ".readObject(" << patchParams << ");";
- }
- }
- }
- }
+ if(_featureProfile != Slice::IceE)
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeObject(" << v << ");";
+ }
+ else
+ {
+ string typeS = typeToString(type, TypeModeIn, package);
+ if(holder)
+ {
+ out << nl << stream << ".readObject(" << param << ".getPatcher());";
+ }
+ else
+ {
+ if(patchParams.empty())
+ {
+ out << nl << stream << ".readObject(new Patcher());";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(" << patchParams << ");";
+ }
+ }
+ }
+ }
return;
}
@@ -919,30 +919,30 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
if(_featureProfile != Slice::IceE)
{
- java2 = dict->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
-
- //
- // We have to determine whether it's possible to use the
- // type's generated helper class for this marshal/unmarshal
- // task. Since the user may have specified a custom type in
- // metadata, it's possible that the helper class is not
- // compatible and therefore we'll need to generate the code
- // in-line instead.
- //
- // Specifically, there may be "local" metadata (i.e., from
- // a data member or parameter definition) that overrides the
- // original type. We'll compare the mapped types with and
- // without local metadata to determine whether we can use
- // the helper.
- //
- string abstractType;
- getDictionaryTypes(dict, "", metaData, concreteType, abstractType);
- string origConcreteType, origAbstractType;
- getDictionaryTypes(dict, "", StringList(), origConcreteType, origAbstractType);
- if((abstractType != origAbstractType) || (!marshal && concreteType != origConcreteType))
- {
- useHelper = false;
- }
+ java2 = dict->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
+
+ //
+ // We have to determine whether it's possible to use the
+ // type's generated helper class for this marshal/unmarshal
+ // task. Since the user may have specified a custom type in
+ // metadata, it's possible that the helper class is not
+ // compatible and therefore we'll need to generate the code
+ // in-line instead.
+ //
+ // Specifically, there may be "local" metadata (i.e., from
+ // a data member or parameter definition) that overrides the
+ // original type. We'll compare the mapped types with and
+ // without local metadata to determine whether we can use
+ // the helper.
+ //
+ string abstractType;
+ getDictionaryTypes(dict, "", metaData, concreteType, abstractType);
+ string origConcreteType, origAbstractType;
+ getDictionaryTypes(dict, "", StringList(), origConcreteType, origAbstractType);
+ if((abstractType != origAbstractType) || (!marshal && concreteType != origConcreteType))
+ {
+ useHelper = false;
+ }
}
//
@@ -950,16 +950,16 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
//
if(useHelper)
{
- string typeS = getAbsolute(dict, package);
- if(marshal)
- {
- out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
- }
- else
- {
- out << nl << v << " = " << typeS << "Helper.read(" << stream << ");";
- }
- return;
+ string typeS = getAbsolute(dict, package);
+ if(marshal)
+ {
+ out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << typeS << "Helper.read(" << stream << ");";
+ }
+ return;
}
TypePtr key = dict->keyType();
@@ -983,21 +983,21 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << "__os.writeSize(" << v << ".size());";
- if(java2)
- {
- out << nl << "java.util.Iterator __i" << iterS << " = " << v << ".entrySet().iterator();";
- out << nl << "while(__i" << iterS << ".hasNext())";
- out << sb;
- out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i" << iterS << ".next();";
- }
- else
- {
- string keyObjectS = typeToObjectString(key, TypeModeIn, package);
- string valueObjectS = typeToObjectString(value, TypeModeIn, package);
- out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> __e : " << v
- << ".entrySet())";
- out << sb;
- }
+ if(java2)
+ {
+ out << nl << "java.util.Iterator __i" << iterS << " = " << v << ".entrySet().iterator();";
+ out << nl << "while(__i" << iterS << ".hasNext())";
+ out << sb;
+ out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i" << iterS << ".next();";
+ }
+ else
+ {
+ string keyObjectS = typeToObjectString(key, TypeModeIn, package);
+ string valueObjectS = typeToObjectString(value, TypeModeIn, package);
+ out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> __e : " << v
+ << ".entrySet())";
+ out << sb;
+ }
for(i = 0; i < 2; i++)
{
string val;
@@ -1014,74 +1014,74 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
type = value;
}
- //
- // We have to downcast unless we're using Java5.
- //
- if(java2)
- {
- BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if(b)
- {
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- val = "((java.lang.Byte)" + arg + ").byteValue()";
- break;
- }
- case Builtin::KindBool:
- {
- val = "((java.lang.Boolean)" + arg + ").booleanValue()";
- break;
- }
- case Builtin::KindShort:
- {
- val = "((java.lang.Short)" + arg + ").shortValue()";
- break;
- }
- case Builtin::KindInt:
- {
- val = "((java.lang.Integer)" + arg + ").intValue()";
- break;
- }
- case Builtin::KindLong:
- {
- val = "((java.lang.Long)" + arg + ").longValue()";
- break;
- }
- case Builtin::KindFloat:
- {
- val = "((java.lang.Float)" + arg + ").floatValue()";
- break;
- }
- case Builtin::KindDouble:
- {
- val = "((java.lang.Double)" + arg + ").doubleValue()";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- {
- break;
- }
- case Builtin::KindLocalObject:
- {
- assert(false);
- break;
- }
- }
- }
-
- if(val.empty())
- {
- val = "((" + typeToString(type, TypeModeIn, package) + ')' + arg + ')';
- }
- }
- else
- {
- val = arg;
- }
+ //
+ // We have to downcast unless we're using Java5.
+ //
+ if(java2)
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(b)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ val = "((java.lang.Byte)" + arg + ").byteValue()";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ val = "((java.lang.Boolean)" + arg + ").booleanValue()";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ val = "((java.lang.Short)" + arg + ").shortValue()";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ val = "((java.lang.Integer)" + arg + ").intValue()";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ val = "((java.lang.Long)" + arg + ").longValue()";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ val = "((java.lang.Float)" + arg + ").floatValue()";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ val = "((java.lang.Double)" + arg + ").doubleValue()";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ {
+ break;
+ }
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ }
+ }
+
+ if(val.empty())
+ {
+ val = "((" + typeToString(type, TypeModeIn, package) + ')' + arg + ')';
+ }
+ }
+ else
+ {
+ val = arg;
+ }
writeMarshalUnmarshalCode(out, package, type, val, true, iter, false);
}
out << eb;
@@ -1089,7 +1089,7 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << v << " = new " << concreteType << "();";
+ out << nl << v << " = new " << concreteType << "();";
out << nl << "int __sz" << iterS << " = __is.readSize();";
out << nl << "for(int __i" << iterS << " = 0; __i" << iterS << " < __sz" << iterS << "; __i" << iterS << "++)";
out << sb;
@@ -1097,18 +1097,18 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
{
string arg;
TypePtr type;
- string typeS;
+ string typeS;
if(i == 0)
{
arg = "__key";
type = key;
- typeS = keyS;
+ typeS = keyS;
}
else
{
arg = "__value";
type = value;
- typeS = valueS;
+ typeS = valueS;
}
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
@@ -1118,37 +1118,37 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
{
case Builtin::KindByte:
{
- out << nl << "java.lang.Byte " << arg << " = new java.lang.Byte(__is.readByte());";
+ out << nl << "java.lang.Byte " << arg << " = new java.lang.Byte(__is.readByte());";
break;
}
case Builtin::KindBool:
{
- out << nl << "java.lang.Boolean " << arg << " = new java.lang.Boolean(__is.readBool());";
+ out << nl << "java.lang.Boolean " << arg << " = new java.lang.Boolean(__is.readBool());";
break;
}
case Builtin::KindShort:
{
- out << nl << "java.lang.Short " << arg << " = new java.lang.Short(__is.readShort());";
+ out << nl << "java.lang.Short " << arg << " = new java.lang.Short(__is.readShort());";
break;
}
case Builtin::KindInt:
{
- out << nl << "java.lang.Integer " << arg << " = new java.lang.Integer(__is.readInt());";
+ out << nl << "java.lang.Integer " << arg << " = new java.lang.Integer(__is.readInt());";
break;
}
case Builtin::KindLong:
{
- out << nl << "java.lang.Long " << arg << " = new java.lang.Long(__is.readLong());";
+ out << nl << "java.lang.Long " << arg << " = new java.lang.Long(__is.readLong());";
break;
}
case Builtin::KindFloat:
{
- out << nl << "java.lang.Float " << arg << " = new java.lang.Float(__is.readFloat());";
+ out << nl << "java.lang.Float " << arg << " = new java.lang.Float(__is.readFloat());";
break;
}
case Builtin::KindDouble:
{
- out << nl << "java.lang.Double " << arg << " = new java.lang.Double(__is.readDouble());";
+ out << nl << "java.lang.Double " << arg << " = new java.lang.Double(__is.readDouble());";
break;
}
case Builtin::KindString:
@@ -1158,9 +1158,9 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
}
case Builtin::KindObject:
{
- assert(i == 1); // Must be the element value, since an object cannot be a key.
+ assert(i == 1); // Must be the element value, since an object cannot be a key.
out << nl << "__is.readObject(new IceInternal.DictionaryPatcher(" << v << ", "
- << valueS << ".class, \"" << value->typeId() << "\", __key));";
+ << valueS << ".class, \"" << value->typeId() << "\", __key));";
break;
}
case Builtin::KindObjectProxy:
@@ -1177,24 +1177,24 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
}
else
{
- if(ClassDeclPtr::dynamicCast(type) || (b && b->kind() == Builtin::KindObject))
- {
- writeMarshalUnmarshalCode(out, package, type, arg, false, iter, false, StringList(),
- "new IceInternal.DictionaryPatcher(" + v + ", " + typeS + ".class, \"" +
- type->typeId() + "\", __key)");
- }
- else
- {
- out << nl << typeS << ' ' << arg << ';';
- writeMarshalUnmarshalCode(out, package, type, arg, false, iter, false);
- }
- }
- }
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
- if(!(builtin && builtin->kind() == Builtin::KindObject) && !ClassDeclPtr::dynamicCast(value))
- {
- out << nl << "" << v << ".put(__key, __value);";
- }
+ if(ClassDeclPtr::dynamicCast(type) || (b && b->kind() == Builtin::KindObject))
+ {
+ writeMarshalUnmarshalCode(out, package, type, arg, false, iter, false, StringList(),
+ "new IceInternal.DictionaryPatcher(" + v + ", " + typeS + ".class, \"" +
+ type->typeId() + "\", __key)");
+ }
+ else
+ {
+ out << nl << typeS << ' ' << arg << ';';
+ writeMarshalUnmarshalCode(out, package, type, arg, false, iter, false);
+ }
+ }
+ }
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
+ if(!(builtin && builtin->kind() == Builtin::KindObject) && !ClassDeclPtr::dynamicCast(value))
+ {
+ out << nl << "" << v << ".put(__key, __value);";
+ }
out << eb;
}
}
@@ -1218,30 +1218,30 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
if(_featureProfile != Slice::IceE)
{
- java2 = seq->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
-
- //
- // We have to determine whether it's possible to use the
- // type's generated helper class for this marshal/unmarshal
- // task. Since the user may have specified a custom type in
- // metadata, it's possible that the helper class is not
- // compatible and therefore we'll need to generate the code
- // in-line instead.
- //
- // Specifically, there may be "local" metadata (i.e., from
- // a data member or parameter definition) that overrides the
- // original type. We'll compare the mapped types with and
- // without local metadata to determine whether we can use
- // the helper.
- //
- string abstractType;
- customType = getSequenceTypes(seq, "", metaData, concreteType, abstractType);
- string origConcreteType, origAbstractType;
- getSequenceTypes(seq, "", StringList(), origConcreteType, origAbstractType);
- if((abstractType != origAbstractType) || (!marshal && concreteType != origConcreteType))
- {
- useHelper = false;
- }
+ java2 = seq->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
+
+ //
+ // We have to determine whether it's possible to use the
+ // type's generated helper class for this marshal/unmarshal
+ // task. Since the user may have specified a custom type in
+ // metadata, it's possible that the helper class is not
+ // compatible and therefore we'll need to generate the code
+ // in-line instead.
+ //
+ // Specifically, there may be "local" metadata (i.e., from
+ // a data member or parameter definition) that overrides the
+ // original type. We'll compare the mapped types with and
+ // without local metadata to determine whether we can use
+ // the helper.
+ //
+ string abstractType;
+ customType = getSequenceTypes(seq, "", metaData, concreteType, abstractType);
+ string origConcreteType, origAbstractType;
+ getSequenceTypes(seq, "", StringList(), origConcreteType, origAbstractType);
+ if((abstractType != origAbstractType) || (!marshal && concreteType != origConcreteType))
+ {
+ useHelper = false;
+ }
}
//
@@ -1272,10 +1272,10 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
//
// Stop if the inner sequence type has a custom type.
//
- if(hasTypeMetaData(s) && _featureProfile != Slice::IceE)
- {
- break;
- }
+ if(hasTypeMetaData(s) && _featureProfile != Slice::IceE)
+ {
+ break;
+ }
depth++;
origContent = s->type();
s = SequencePtr::dynamicCast(origContent);
@@ -1301,12 +1301,12 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << v << ".size());";
- ostringstream o;
- o << "__i" << iter;
- string it = o.str();
- iter++;
- out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
- out << nl << "while(" << it << ".hasNext())";
+ ostringstream o;
+ o << "__i" << iter;
+ string it = o.str();
+ iter++;
+ out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
+ out << nl << "while(" << it << ".hasNext())";
out << sb;
switch(b->kind())
@@ -1484,14 +1484,14 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
string typeS = getAbsolute(seq, package);
- ostringstream o;
- o << origContentS;
- int d = depth;
- while(d--)
- {
- o << "[]";
- }
- string cont = o.str();
+ ostringstream o;
+ o << origContentS;
+ int d = depth;
+ while(d--)
+ {
+ o << "[]";
+ }
+ string cont = o.str();
if(marshal)
{
out << nl << "if(" << v << " == null)";
@@ -1501,47 +1501,47 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << v << ".size());";
- if(java2)
- {
- ostringstream oit;
- oit << "__i" << iter;
- iter++;
- string it = oit.str();
- out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
- out << nl << "while(" << it << ".hasNext())";
- out << sb;
- out << nl << cont << " __elem = (" << cont << ")" << it << ".next();";
- writeMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
- out << eb;
- }
- else
- {
- string typeS = typeToString(type, TypeModeIn, package);
- out << nl << "for(" << typeS << " __elem : " << v << ')';
- out << sb;
- writeMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
- out << eb;
- }
+ if(java2)
+ {
+ ostringstream oit;
+ oit << "__i" << iter;
+ iter++;
+ string it = oit.str();
+ out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
+ out << nl << "while(" << it << ".hasNext())";
+ out << sb;
+ out << nl << cont << " __elem = (" << cont << ")" << it << ".next();";
+ writeMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
+ out << eb;
+ }
+ else
+ {
+ string typeS = typeToString(type, TypeModeIn, package);
+ out << nl << "for(" << typeS << " __elem : " << v << ')';
+ out << sb;
+ writeMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
+ out << eb;
+ }
out << eb; // else
}
else
{
bool isObject = false;
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if((b && b->kind() == Builtin::KindObject) || cl)
+ if((b && b->kind() == Builtin::KindObject) || cl)
{
isObject = true;
}
- out << nl << v << " = new " << concreteType << "();";
+ out << nl << v << " = new " << concreteType << "();";
out << nl << "final int __len" << iter << " = " << stream << ".readSize();";
- if(type->isVariableLength())
- {
- out << nl << stream << ".startSeq(__len" << iter << ", " << type->minWireSize() << ");";
- }
- else
- {
- out << nl << stream << ".checkFixedSeq(__len" << iter << ", " << type->minWireSize() << ");";
- }
+ if(type->isVariableLength())
+ {
+ out << nl << stream << ".startSeq(__len" << iter << ", " << type->minWireSize() << ");";
+ }
+ else
+ {
+ out << nl << stream << ".checkFixedSeq(__len" << iter << ", " << type->minWireSize() << ");";
+ }
if(isObject)
{
if(b)
@@ -1565,54 +1565,54 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
<< "++)";
out << sb;
- if(isObject)
- {
+ if(isObject)
+ {
//
// Add a null value to the list as a placeholder for the element.
//
- out << nl << v << ".add(null);";
- ostringstream patchParams;
- patchParams << "new IceInternal.ListPatcher(" << v << ", " << origContentS << ".class, __type"
+ out << nl << v << ".add(null);";
+ ostringstream patchParams;
+ patchParams << "new IceInternal.ListPatcher(" << v << ", " << origContentS << ".class, __type"
<< iter << ", __i" << iter << ')';
- writeMarshalUnmarshalCode(out, package, type, "__elem", false, iter, false, StringList(),
- patchParams.str());
- }
- else
- {
- out << nl << cont << " __elem;";
- writeMarshalUnmarshalCode(out, package, type, "__elem", false, iter, false);
- }
- if(!isObject)
- {
- out << nl << v << ".add(__elem);";
- }
-
- //
- // After unmarshaling each element, check that there are still enough bytes left in the stream
- // to unmarshal the remainder of the sequence, and decrement the count of elements
- // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
- // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
- // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
- // (For fixed-length sequences, we don't need to do this because the prediction of how many
- // bytes will be taken up by the sequence is accurate.)
- //
- if(type->isVariableLength())
- {
- if(!SequencePtr::dynamicCast(type))
- {
- //
- // No need to check for directly nested sequences because, at the at start of each
- // sequence, we check anyway.
- //
- out << nl << stream << ".checkSeq();";
- }
- out << nl << stream << ".endElement();";
- }
- out << eb;
- if(type->isVariableLength())
- {
- out << nl << stream << ".endSeq(__len" << iter << ");";
- }
+ writeMarshalUnmarshalCode(out, package, type, "__elem", false, iter, false, StringList(),
+ patchParams.str());
+ }
+ else
+ {
+ out << nl << cont << " __elem;";
+ writeMarshalUnmarshalCode(out, package, type, "__elem", false, iter, false);
+ }
+ if(!isObject)
+ {
+ out << nl << v << ".add(__elem);";
+ }
+
+ //
+ // After unmarshaling each element, check that there are still enough bytes left in the stream
+ // to unmarshal the remainder of the sequence, and decrement the count of elements
+ // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
+ // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
+ // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
+ // (For fixed-length sequences, we don't need to do this because the prediction of how many
+ // bytes will be taken up by the sequence is accurate.)
+ //
+ if(type->isVariableLength())
+ {
+ if(!SequencePtr::dynamicCast(type))
+ {
+ //
+ // No need to check for directly nested sequences because, at the at start of each
+ // sequence, we check anyway.
+ //
+ out << nl << stream << ".checkSeq();";
+ }
+ out << nl << stream << ".endElement();";
+ }
+ out << eb;
+ if(type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(__len" << iter << ");";
+ }
iter++;
}
}
@@ -1754,19 +1754,19 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
bool isObject = false;
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(origContent);
- if((b && b->kind() == Builtin::KindObject) || cl)
+ if((b && b->kind() == Builtin::KindObject) || cl)
{
isObject = true;
}
out << nl << "final int __len" << iter << " = " << stream << ".readSize();";
- if(type->isVariableLength())
- {
- out << nl << stream << ".startSeq(__len" << iter << ", " << type->minWireSize() << ");";
- }
- else
- {
- out << nl << stream << ".checkFixedSeq(__len" << iter << ", " << type->minWireSize() << ");";
- }
+ if(type->isVariableLength())
+ {
+ out << nl << stream << ".startSeq(__len" << iter << ", " << type->minWireSize() << ");";
+ }
+ else
+ {
+ out << nl << stream << ".checkFixedSeq(__len" << iter << ", " << type->minWireSize() << ");";
+ }
if(isObject)
{
if(b)
@@ -1799,45 +1799,45 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << sb;
ostringstream o;
o << v << "[__i" << iter << "]";
- ostringstream patchParams;
+ ostringstream patchParams;
if(isObject)
{
patchParams << "new IceInternal.SequencePatcher(" << v << ", " << origContentS
<< ".class, __type" << iter << ", __i" << iter << ')';
writeMarshalUnmarshalCode(out, package, type, o.str(), false, iter, false, StringList(),
- patchParams.str());
+ patchParams.str());
}
else
{
writeMarshalUnmarshalCode(out, package, type, o.str(), false, iter, false);
}
- //
- // After unmarshaling each element, check that there are still enough bytes left in the stream
- // to unmarshal the remainder of the sequence, and decrement the count of elements
- // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
- // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
- // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
- // (For fixed-length sequences, we don't need to do this because the prediction of how many
- // bytes will be taken up by the sequence is accurate.)
- //
- if(type->isVariableLength())
- {
- if(!SequencePtr::dynamicCast(type))
- {
- //
- // No need to check for directly nested sequences because, at the at start of each
- // sequence, we check anyway.
- //
- out << nl << stream << ".checkSeq();";
- }
- out << nl << stream << ".endElement();";
- }
+ //
+ // After unmarshaling each element, check that there are still enough bytes left in the stream
+ // to unmarshal the remainder of the sequence, and decrement the count of elements
+ // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
+ // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
+ // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
+ // (For fixed-length sequences, we don't need to do this because the prediction of how many
+ // bytes will be taken up by the sequence is accurate.)
+ //
+ if(type->isVariableLength())
+ {
+ if(!SequencePtr::dynamicCast(type))
+ {
+ //
+ // No need to check for directly nested sequences because, at the at start of each
+ // sequence, we check anyway.
+ //
+ out << nl << stream << ".checkSeq();";
+ }
+ out << nl << stream << ".endElement();";
+ }
out << eb;
- if(type->isVariableLength())
- {
- out << nl << stream << ".endSeq(__len" << iter << ");";
- }
+ if(type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(__len" << iter << ");";
+ }
iter++;
}
}
@@ -1969,31 +1969,31 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out,
}
case Builtin::KindObject:
{
- if(_featureProfile != Slice::IceE)
- {
- if(marshal)
- {
- out << nl << stream << ".writeObject(" << v << ");";
- }
- else
- {
- if(holder)
- {
- out << nl << stream << ".readObject((Ice.ReadObjectCallback)" << param << ".getPatcher());";
- }
- else
- {
- if(patchParams.empty())
- {
- out << nl << stream << ".readObject(new Patcher());";
- }
- else
- {
- out << nl << stream << ".readObject(" << patchParams << ");";
- }
- }
- }
- }
+ if(_featureProfile != Slice::IceE)
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeObject(" << v << ");";
+ }
+ else
+ {
+ if(holder)
+ {
+ out << nl << stream << ".readObject((Ice.ReadObjectCallback)" << param << ".getPatcher());";
+ }
+ else
+ {
+ if(patchParams.empty())
+ {
+ out << nl << stream << ".readObject(new Patcher());";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(" << patchParams << ");";
+ }
+ }
+ }
+ }
break;
}
case Builtin::KindObjectProxy:
@@ -2035,32 +2035,32 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out,
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- if(_featureProfile != Slice::IceE)
- {
- if(marshal)
- {
- out << nl << stream << ".writeObject(" << v << ");";
- }
- else
- {
- string typeS = typeToString(type, TypeModeIn, package);
- if(holder)
- {
- out << nl << stream << ".readObject(" << param << ".getPatcher());";
- }
- else
- {
- if(patchParams.empty())
- {
- out << nl << stream << ".readObject(new Patcher());";
- }
- else
- {
- out << nl << stream << ".readObject(" << patchParams << ");";
- }
- }
- }
- }
+ if(_featureProfile != Slice::IceE)
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeObject(" << v << ");";
+ }
+ else
+ {
+ string typeS = typeToString(type, TypeModeIn, package);
+ if(holder)
+ {
+ out << nl << stream << ".readObject(" << param << ".getPatcher());";
+ }
+ else
+ {
+ if(patchParams.empty())
+ {
+ out << nl << stream << ".readObject(new Patcher());";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(" << patchParams << ");";
+ }
+ }
+ }
+ }
return;
}
@@ -2157,7 +2157,7 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
getDictionaryTypes(dict, "", StringList(), origConcreteType, origAbstractType);
if((abstractType != origAbstractType) || (!marshal && concreteType != origConcreteType))
{
- useHelper = false;
+ useHelper = false;
}
//
@@ -2165,16 +2165,16 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
//
if(useHelper)
{
- string typeS = getAbsolute(dict, package);
- if(marshal)
- {
- out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
- }
- else
- {
- out << nl << v << " = " << typeS << "Helper.read(" << stream << ");";
- }
- return;
+ string typeS = getAbsolute(dict, package);
+ if(marshal)
+ {
+ out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << typeS << "Helper.read(" << stream << ");";
+ }
+ return;
}
TypePtr key = dict->keyType();
@@ -2198,21 +2198,21 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << "__outS.writeSize(" << v << ".size());";
- if(java2)
- {
- out << nl << "java.util.Iterator __i" << iterS << " = " << v << ".entrySet().iterator();";
- out << nl << "while(__i" << iterS << ".hasNext())";
- out << sb;
- out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i" << iterS << ".next();";
- }
- else
- {
- string keyObjectS = typeToObjectString(key, TypeModeIn, package);
- string valueObjectS = typeToObjectString(value, TypeModeIn, package);
- out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> __e : " << v
- << ".entrySet())";
- out << sb;
- }
+ if(java2)
+ {
+ out << nl << "java.util.Iterator __i" << iterS << " = " << v << ".entrySet().iterator();";
+ out << nl << "while(__i" << iterS << ".hasNext())";
+ out << sb;
+ out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i" << iterS << ".next();";
+ }
+ else
+ {
+ string keyObjectS = typeToObjectString(key, TypeModeIn, package);
+ string valueObjectS = typeToObjectString(value, TypeModeIn, package);
+ out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> __e : " << v
+ << ".entrySet())";
+ out << sb;
+ }
for(i = 0; i < 2; i++)
{
string val;
@@ -2229,74 +2229,74 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
type = value;
}
- //
- // We have to downcast unless we're using Java5.
- //
- if(java2)
- {
- BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if(b)
- {
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- val = "((java.lang.Byte)" + arg + ").byteValue()";
- break;
- }
- case Builtin::KindBool:
- {
- val = "((java.lang.Boolean)" + arg + ").booleanValue()";
- break;
- }
- case Builtin::KindShort:
- {
- val = "((java.lang.Short)" + arg + ").shortValue()";
- break;
- }
- case Builtin::KindInt:
- {
- val = "((java.lang.Integer)" + arg + ").intValue()";
- break;
- }
- case Builtin::KindLong:
- {
- val = "((java.lang.Long)" + arg + ").longValue()";
- break;
- }
- case Builtin::KindFloat:
- {
- val = "((java.lang.Float)" + arg + ").floatValue()";
- break;
- }
- case Builtin::KindDouble:
- {
- val = "((java.lang.Double)" + arg + ").doubleValue()";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- {
- break;
- }
- case Builtin::KindLocalObject:
- {
- assert(false);
- break;
- }
- }
- }
-
- if(val.empty())
- {
- val = "((" + typeToString(type, TypeModeIn, package) + ')' + arg + ')';
- }
- }
- else
- {
- val = arg;
- }
+ //
+ // We have to downcast unless we're using Java5.
+ //
+ if(java2)
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(b)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ val = "((java.lang.Byte)" + arg + ").byteValue()";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ val = "((java.lang.Boolean)" + arg + ").booleanValue()";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ val = "((java.lang.Short)" + arg + ").shortValue()";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ val = "((java.lang.Integer)" + arg + ").intValue()";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ val = "((java.lang.Long)" + arg + ").longValue()";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ val = "((java.lang.Float)" + arg + ").floatValue()";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ val = "((java.lang.Double)" + arg + ").doubleValue()";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ {
+ break;
+ }
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ }
+ }
+
+ if(val.empty())
+ {
+ val = "((" + typeToString(type, TypeModeIn, package) + ')' + arg + ')';
+ }
+ }
+ else
+ {
+ val = arg;
+ }
writeStreamMarshalUnmarshalCode(out, package, type, val, true, iter, false);
}
out << eb;
@@ -2304,7 +2304,7 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << v << " = new " << concreteType << "();";
+ out << nl << v << " = new " << concreteType << "();";
out << nl << "int __sz" << iterS << " = __inS.readSize();";
out << nl << "for(int __i" << iterS << " = 0; __i" << iterS << " < __sz" << iterS << "; __i" << iterS << "++)";
out << sb;
@@ -2312,18 +2312,18 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
{
string arg;
TypePtr type;
- string typeS;
+ string typeS;
if(i == 0)
{
arg = "__key";
type = key;
- typeS = keyS;
+ typeS = keyS;
}
else
{
arg = "__value";
type = value;
- typeS = valueS;
+ typeS = valueS;
}
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
@@ -2374,7 +2374,7 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
case Builtin::KindObject:
{
out << nl << "__inS.readObject(new IceInternal.DictionaryPatcher(" << v << ", "
- << valueS << ".class, \"" << value->typeId() << "\", __key));";
+ << valueS << ".class, \"" << value->typeId() << "\", __key));";
break;
}
case Builtin::KindObjectProxy:
@@ -2392,11 +2392,11 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
else
{
string s = typeToString(type, TypeModeIn, package);
- if(ClassDeclPtr::dynamicCast(type) || (b && b->kind() == Builtin::KindObject))
+ if(ClassDeclPtr::dynamicCast(type) || (b && b->kind() == Builtin::KindObject))
{
writeStreamMarshalUnmarshalCode(out, package, type, arg, false, iter, false, StringList(),
"new IceInternal.DictionaryPatcher(" + v + ", " + s +
- ".class, \"" + type->typeId() + "\", __key)");
+ ".class, \"" + type->typeId() + "\", __key)");
}
else
{
@@ -2405,7 +2405,7 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out,
}
}
}
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
if(!(builtin && builtin->kind() == Builtin::KindObject) && !ClassDeclPtr::dynamicCast(value))
{
out << nl << "" << v << ".put(__key, __value);";
@@ -2449,7 +2449,7 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out,
getSequenceTypes(seq, "", StringList(), origConcreteType, origAbstractType);
if((abstractType != origAbstractType) || (!marshal && concreteType != origConcreteType))
{
- useHelper = false;
+ useHelper = false;
}
//
@@ -2480,10 +2480,10 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out,
//
// Stop if the inner sequence type has a custom type.
//
- if(hasTypeMetaData(s))
- {
- break;
- }
+ if(hasTypeMetaData(s))
+ {
+ break;
+ }
depth++;
origContent = s->type();
s = SequencePtr::dynamicCast(origContent);
@@ -2692,14 +2692,14 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out,
else
{
string typeS = getAbsolute(seq, package);
- ostringstream o;
- o << origContentS;
- int d = depth;
- while(d--)
- {
- o << "[]";
- }
- string cont = o.str();
+ ostringstream o;
+ o << origContentS;
+ int d = depth;
+ while(d--)
+ {
+ o << "[]";
+ }
+ string cont = o.str();
if(marshal)
{
out << nl << "if(" << v << " == null)";
@@ -2709,27 +2709,27 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << v << ".size());";
- if(java2)
- {
- ostringstream oit;
- oit << "__i" << iter;
- iter++;
- string it = oit.str();
- out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
- out << nl << "while(" << it << ".hasNext())";
- out << sb;
- out << nl << cont << " __elem = (" << cont << ")" << it << ".next();";
- writeStreamMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
- out << eb;
- }
- else
- {
- string typeS = typeToString(type, TypeModeIn, package);
- out << nl << "for(" << typeS << " __elem : " << v << ')';
- out << sb;
- writeStreamMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
- out << eb;
- }
+ if(java2)
+ {
+ ostringstream oit;
+ oit << "__i" << iter;
+ iter++;
+ string it = oit.str();
+ out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
+ out << nl << "while(" << it << ".hasNext())";
+ out << sb;
+ out << nl << cont << " __elem = (" << cont << ")" << it << ".next();";
+ writeStreamMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
+ out << eb;
+ }
+ else
+ {
+ string typeS = typeToString(type, TypeModeIn, package);
+ out << nl << "for(" << typeS << " __elem : " << v << ')';
+ out << sb;
+ writeStreamMarshalUnmarshalCode(out, package, type, "__elem", true, iter, false);
+ out << eb;
+ }
out << eb; // else
}
else
@@ -2994,22 +2994,22 @@ Slice::JavaGenerator::getTypeMetaData(const StringList& metaData, string& concre
static const string prefix = "java:type:";
for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
{
- string str = *q;
- if(str.find(prefix) == 0)
- {
- string::size_type pos = str.find(':', prefix.size());
- if(pos != string::npos)
- {
- concreteType = str.substr(prefix.size(), pos - prefix.size());
- abstractType = str.substr(pos + 1);
- }
- else
- {
- concreteType = str.substr(prefix.size());
- abstractType.clear();
- }
- return true;
- }
+ string str = *q;
+ if(str.find(prefix) == 0)
+ {
+ string::size_type pos = str.find(':', prefix.size());
+ if(pos != string::npos)
+ {
+ concreteType = str.substr(prefix.size(), pos - prefix.size());
+ abstractType = str.substr(pos + 1);
+ }
+ else
+ {
+ concreteType = str.substr(prefix.size());
+ abstractType.clear();
+ }
+ return true;
+ }
}
return false;
@@ -3021,27 +3021,27 @@ Slice::JavaGenerator::hasTypeMetaData(const TypePtr& type, const StringList& loc
ContainedPtr cont = ContainedPtr::dynamicCast(type);
if(cont)
{
- static const string prefix = "java:type:";
-
- StringList::const_iterator q;
- for(q = localMetaData.begin(); q != localMetaData.end(); ++q)
- {
- string str = *q;
- if(str.find(prefix) == 0)
- {
- return true;
- }
- }
-
- StringList metaData = cont->getMetaData();
- for(q = metaData.begin(); q != metaData.end(); ++q)
- {
- string str = *q;
- if(str.find(prefix) == 0)
- {
- return true;
- }
- }
+ static const string prefix = "java:type:";
+
+ StringList::const_iterator q;
+ for(q = localMetaData.begin(); q != localMetaData.end(); ++q)
+ {
+ string str = *q;
+ if(str.find(prefix) == 0)
+ {
+ return true;
+ }
+ }
+
+ StringList metaData = cont->getMetaData();
+ for(q = metaData.begin(); q != metaData.end(); ++q)
+ {
+ string str = *q;
+ if(str.find(prefix) == 0)
+ {
+ return true;
+ }
+ }
}
return false;
@@ -3049,17 +3049,17 @@ Slice::JavaGenerator::hasTypeMetaData(const TypePtr& type, const StringList& loc
bool
Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
- const string& package,
- const StringList& metaData,
- string& concreteType,
- string& abstractType) const
+ const string& package,
+ const StringList& metaData,
+ string& concreteType,
+ string& abstractType) const
{
bool customType = false;
if(_featureProfile == Slice::IceE)
{
- concreteType = abstractType = "java.util.Hashtable";
- return customType;
+ concreteType = abstractType = "java.util.Hashtable";
+ return customType;
}
bool java2 = dict->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
@@ -3071,7 +3071,7 @@ Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
customType = getTypeMetaData(metaData, ct, at);
if(!customType)
{
- customType = getTypeMetaData(dict->getMetaData(), ct, at);
+ customType = getTypeMetaData(dict->getMetaData(), ct, at);
}
//
@@ -3081,8 +3081,8 @@ Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
string valueTypeStr;
if(!java2)
{
- keyTypeStr = typeToObjectString(dict->keyType(), TypeModeIn, package);
- valueTypeStr = typeToObjectString(dict->valueType(), TypeModeIn, package);
+ keyTypeStr = typeToObjectString(dict->keyType(), TypeModeIn, package);
+ valueTypeStr = typeToObjectString(dict->valueType(), TypeModeIn, package);
}
//
@@ -3090,47 +3090,47 @@ Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
//
if(customType)
{
- assert(!ct.empty());
-
- //
- // Check for portable syntax. Convert {type} to type<key, value> for Java5.
- //
- if(ct[0] == '{')
- {
- string::size_type pos = ct.find('}');
- if(pos != string::npos)
- {
- concreteType = ct.substr(1, pos - 1);
- if(!java2)
- {
- concreteType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
- }
- }
- }
- else
- {
- concreteType = ct;
- }
-
- if(!at.empty())
- {
- if(at[0] == '{')
- {
- string::size_type pos = at.find('}');
- if(pos != string::npos)
- {
- abstractType = at.substr(1, pos - 1);
- if(!java2)
- {
- abstractType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
- }
- }
- }
- else
- {
- abstractType = at;
- }
- }
+ assert(!ct.empty());
+
+ //
+ // Check for portable syntax. Convert {type} to type<key, value> for Java5.
+ //
+ if(ct[0] == '{')
+ {
+ string::size_type pos = ct.find('}');
+ if(pos != string::npos)
+ {
+ concreteType = ct.substr(1, pos - 1);
+ if(!java2)
+ {
+ concreteType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
+ }
+ }
+ }
+ else
+ {
+ concreteType = ct;
+ }
+
+ if(!at.empty())
+ {
+ if(at[0] == '{')
+ {
+ string::size_type pos = at.find('}');
+ if(pos != string::npos)
+ {
+ abstractType = at.substr(1, pos - 1);
+ if(!java2)
+ {
+ abstractType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
+ }
+ }
+ }
+ else
+ {
+ abstractType = at;
+ }
+ }
}
//
@@ -3138,11 +3138,11 @@ Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
//
if(concreteType.empty())
{
- concreteType = "java.util.HashMap";
- if(!java2)
- {
- concreteType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
- }
+ concreteType = "java.util.HashMap";
+ if(!java2)
+ {
+ concreteType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
+ }
}
//
@@ -3154,11 +3154,11 @@ Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
//
if(abstractType.empty())
{
- abstractType = "java.util.Map";
- if(!java2)
- {
- abstractType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
- }
+ abstractType = "java.util.Map";
+ if(!java2)
+ {
+ abstractType += "<" + keyTypeStr + ", " + valueTypeStr + ">";
+ }
}
return customType;
@@ -3166,17 +3166,17 @@ Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
bool
Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
- const string& package,
- const StringList& metaData,
- string& concreteType,
- string& abstractType) const
+ const string& package,
+ const StringList& metaData,
+ string& concreteType,
+ string& abstractType) const
{
bool customType = false;
if(_featureProfile == Slice::IceE)
{
- concreteType = abstractType = typeToString(seq->type(), TypeModeIn, package) + "[]";
- return customType;
+ concreteType = abstractType = typeToString(seq->type(), TypeModeIn, package) + "[]";
+ return customType;
}
bool java2 = seq->definitionContext()->findMetaData(_java2MetaData) == _java2MetaData;
@@ -3188,7 +3188,7 @@ Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
customType = getTypeMetaData(metaData, ct, at);
if(!customType)
{
- customType = getTypeMetaData(seq->getMetaData(), ct, at);
+ customType = getTypeMetaData(seq->getMetaData(), ct, at);
}
//
@@ -3197,7 +3197,7 @@ Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
string typeStr;
if(!java2)
{
- typeStr = typeToObjectString(seq->type(), TypeModeIn, package);
+ typeStr = typeToObjectString(seq->type(), TypeModeIn, package);
}
//
@@ -3205,62 +3205,62 @@ Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
//
if(customType)
{
- assert(!ct.empty());
-
- //
- // Check for portable syntax. Convert {type} to type<key, value> for Java5.
- //
- if(ct[0] == '{')
- {
- string::size_type pos = ct.find('}');
- if(pos != string::npos)
- {
- concreteType = ct.substr(1, pos - 1);
- if(!java2)
- {
- concreteType += "<" + typeStr + ">";
- }
- }
- }
- else
- {
- concreteType = ct;
- }
-
- if(!at.empty())
- {
- if(at[0] == '{')
- {
- string::size_type pos = at.find('}');
- if(pos != string::npos)
- {
- abstractType = at.substr(1, pos - 1);
- if(!java2)
- {
- abstractType += "<" + typeStr + ">";
- }
- }
- }
- else
- {
- abstractType = at;
- }
- }
- else
- {
- //
- // If an abstract type is not defined, we use the concrete type as the default.
- // If instead we chose a default abstract type, such as List<T>, then we
- // might inadvertently generate uncompilable code. The Java5 compiler does not
- // allow polymorphic assignment between generic types if it can weaken the
- // compile-time type safety rules.
- //
- abstractType = "java.util.List";
- if(!java2)
- {
- abstractType += "<" + typeStr + ">";
- }
- }
+ assert(!ct.empty());
+
+ //
+ // Check for portable syntax. Convert {type} to type<key, value> for Java5.
+ //
+ if(ct[0] == '{')
+ {
+ string::size_type pos = ct.find('}');
+ if(pos != string::npos)
+ {
+ concreteType = ct.substr(1, pos - 1);
+ if(!java2)
+ {
+ concreteType += "<" + typeStr + ">";
+ }
+ }
+ }
+ else
+ {
+ concreteType = ct;
+ }
+
+ if(!at.empty())
+ {
+ if(at[0] == '{')
+ {
+ string::size_type pos = at.find('}');
+ if(pos != string::npos)
+ {
+ abstractType = at.substr(1, pos - 1);
+ if(!java2)
+ {
+ abstractType += "<" + typeStr + ">";
+ }
+ }
+ }
+ else
+ {
+ abstractType = at;
+ }
+ }
+ else
+ {
+ //
+ // If an abstract type is not defined, we use the concrete type as the default.
+ // If instead we chose a default abstract type, such as List<T>, then we
+ // might inadvertently generate uncompilable code. The Java5 compiler does not
+ // allow polymorphic assignment between generic types if it can weaken the
+ // compile-time type safety rules.
+ //
+ abstractType = "java.util.List";
+ if(!java2)
+ {
+ abstractType += "<" + typeStr + ">";
+ }
+ }
}
//
@@ -3268,7 +3268,7 @@ Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
//
if(concreteType.empty())
{
- concreteType = abstractType = typeToString(seq->type(), TypeModeIn, package) + "[]";
+ concreteType = abstractType = typeToString(seq->type(), TypeModeIn, package) + "[]";
}
return customType;
@@ -3305,26 +3305,26 @@ Slice::JavaGenerator::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
{
if(s.find(prefix) == 0)
{
- bool ok = false;
-
- static const string packagePrefix = "java:package:";
- if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
- {
- ok = true;
- }
- else if(s == _java2MetaData)
- {
- ok = true;
- }
- else if(s == _java5MetaData)
- {
- ok = true;
- }
-
- if(!ok)
- {
- cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
- }
+ bool ok = false;
+
+ static const string packagePrefix = "java:package:";
+ if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
+ {
+ ok = true;
+ }
+ else if(s == _java2MetaData)
+ {
+ ok = true;
+ }
+ else if(s == _java5MetaData)
+ {
+ ok = true;
+ }
+
+ if(!ok)
+ {
+ cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
+ }
}
_history.insert(s);
}
@@ -3378,29 +3378,29 @@ Slice::JavaGenerator::MetaDataVisitor::visitOperation(const OperationPtr& p)
TypePtr returnType = p->returnType();
if(!metaData.empty())
{
- if(!returnType)
- {
- for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
- {
- if(q->find("java:type:", 0) == 0)
- {
- cout << p->definitionContext()->filename() << ":" << p->line()
- << ": warning: invalid metadata for operation" << endl;
- break;
- }
- }
- }
- else
- {
- validateType(returnType, metaData, p->definitionContext()->filename(), p->line());
- }
+ if(!returnType)
+ {
+ for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
+ {
+ if(q->find("java:type:", 0) == 0)
+ {
+ cout << p->definitionContext()->filename() << ":" << p->line()
+ << ": warning: invalid metadata for operation" << endl;
+ break;
+ }
+ }
+ }
+ else
+ {
+ validateType(returnType, metaData, p->definitionContext()->filename(), p->line());
+ }
}
ParamDeclList params = p->parameters();
for(ParamDeclList::iterator q = params.begin(); q != params.end(); ++q)
{
- metaData = getMetaData(*q);
- validateType((*q)->type(), metaData, p->definitionContext()->filename(), (*q)->line());
+ metaData = getMetaData(*q);
+ validateType((*q)->type(), metaData, p->definitionContext()->filename(), (*q)->line());
}
validateGetSet(p, metaData, p->definitionContext()->filename(), p->line());
@@ -3430,18 +3430,18 @@ Slice::JavaGenerator::MetaDataVisitor::visitSequence(const SequencePtr& p)
//
if(p->definitionContext()->findMetaData(_java2MetaData) != _java2MetaData && !hasTypeMetaData(p))
{
- SequencePtr innerSeq = SequencePtr::dynamicCast(p->type());
- DictionaryPtr innerDict = DictionaryPtr::dynamicCast(p->type());
- if((innerSeq && hasTypeMetaData(innerSeq)) || (innerDict && hasTypeMetaData(innerDict)))
- {
- string file = p->file();
- string line = p->line();
- if(!file.empty())
- {
- cout << file << ':' << line << ": ";
- }
- cout << "warning: Java5 forbids arrays of generic types";
- }
+ SequencePtr innerSeq = SequencePtr::dynamicCast(p->type());
+ DictionaryPtr innerDict = DictionaryPtr::dynamicCast(p->type());
+ if((innerSeq && hasTypeMetaData(innerSeq)) || (innerDict && hasTypeMetaData(innerDict)))
+ {
+ string file = p->file();
+ string line = p->line();
+ if(!file.empty())
+ {
+ cout << file << ':' << line << ": ";
+ }
+ cout << "warning: Java5 forbids arrays of generic types";
+ }
}
}
@@ -3490,23 +3490,23 @@ Slice::JavaGenerator::MetaDataVisitor::getMetaData(const ContainedPtr& cont)
string::size_type pos = s.find(':', prefix.size());
if(pos == string::npos)
{
- if(s.size() > prefix.size())
- {
- string rest = s.substr(prefix.size());
- if(rest == "getset")
- {
- result.push_back(s);
- }
- continue;
- }
+ if(s.size() > prefix.size())
+ {
+ string rest = s.substr(prefix.size());
+ if(rest == "getset")
+ {
+ result.push_back(s);
+ }
+ continue;
+ }
}
else if(s.substr(prefix.size(), pos - prefix.size()) == "type")
{
- result.push_back(s);
- continue;
+ result.push_back(s);
+ continue;
}
- cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
}
_history.insert(s);
@@ -3518,58 +3518,58 @@ Slice::JavaGenerator::MetaDataVisitor::getMetaData(const ContainedPtr& cont)
void
Slice::JavaGenerator::MetaDataVisitor::validateType(const SyntaxTreeBasePtr& p, const StringList& metaData,
- const string& file, const string& line)
+ const string& file, const string& line)
{
for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
{
- //
- // Type metadata ("java:type:Foo") is only supported by sequences and dictionaries.
- //
- if(i->find("java:type:", 0) == 0 && (!SequencePtr::dynamicCast(p) && !DictionaryPtr::dynamicCast(p)))
- {
- string str;
- ContainedPtr cont = ContainedPtr::dynamicCast(p);
- if(cont)
- {
- str = cont->kindOf();
- }
- else
- {
- BuiltinPtr b = BuiltinPtr::dynamicCast(p);
- assert(b);
- str = b->typeId();
- }
- cout << file << ":" << line << ": warning: invalid metadata for " << str << endl;
- }
+ //
+ // Type metadata ("java:type:Foo") is only supported by sequences and dictionaries.
+ //
+ if(i->find("java:type:", 0) == 0 && (!SequencePtr::dynamicCast(p) && !DictionaryPtr::dynamicCast(p)))
+ {
+ string str;
+ ContainedPtr cont = ContainedPtr::dynamicCast(p);
+ if(cont)
+ {
+ str = cont->kindOf();
+ }
+ else
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast(p);
+ assert(b);
+ str = b->typeId();
+ }
+ cout << file << ":" << line << ": warning: invalid metadata for " << str << endl;
+ }
}
}
void
Slice::JavaGenerator::MetaDataVisitor::validateGetSet(const SyntaxTreeBasePtr& p, const StringList& metaData,
- const string& file, const string& line)
+ const string& file, const string& line)
{
for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
{
- //
- // The "getset" metadata can only be specified on a class, struct, exception or data member.
- //
- if((*i) == "java:getset" &&
- (!ClassDefPtr::dynamicCast(p) && !StructPtr::dynamicCast(p) && !ExceptionPtr::dynamicCast(p) &&
- !DataMemberPtr::dynamicCast(p)))
- {
- string str;
- ContainedPtr cont = ContainedPtr::dynamicCast(p);
- if(cont)
- {
- str = cont->kindOf();
- }
- else
- {
- BuiltinPtr b = BuiltinPtr::dynamicCast(p);
- assert(b);
- str = b->typeId();
- }
- cout << file << ":" << line << ": warning: invalid metadata for " << str << endl;
- }
+ //
+ // The "getset" metadata can only be specified on a class, struct, exception or data member.
+ //
+ if((*i) == "java:getset" &&
+ (!ClassDefPtr::dynamicCast(p) && !StructPtr::dynamicCast(p) && !ExceptionPtr::dynamicCast(p) &&
+ !DataMemberPtr::dynamicCast(p)))
+ {
+ string str;
+ ContainedPtr cont = ContainedPtr::dynamicCast(p);
+ if(cont)
+ {
+ str = cont->kindOf();
+ }
+ else
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast(p);
+ assert(b);
+ str = b->typeId();
+ }
+ cout << file << ":" << line << ": warning: invalid metadata for " << str << endl;
+ }
}
}
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 57e43c1738a..45ae1635d78 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -168,61 +168,61 @@ Slice::Builtin::typeId() const
{
switch(_kind)
{
- case KindByte:
- {
- return "byte";
- break;
- }
- case KindBool:
- {
- return "bool";
- break;
- }
- case KindShort:
- {
- return "short";
- break;
- }
- case KindInt:
- {
- return "int";
- break;
- }
- case KindLong:
- {
- return "long";
- break;
- }
- case KindFloat:
- {
- return "float";
- break;
- }
- case KindDouble:
- {
- return "double";
- break;
- }
- case KindString:
- {
- return "string";
- break;
- }
- case KindObject:
- {
- return "::Ice::Object";
- break;
- }
- case KindObjectProxy:
- {
- return "::Ice::Object*";
- break;
- }
- case KindLocalObject:
- {
- return "::Ice::LocalObject";
- break;
- }
+ case KindByte:
+ {
+ return "byte";
+ break;
+ }
+ case KindBool:
+ {
+ return "bool";
+ break;
+ }
+ case KindShort:
+ {
+ return "short";
+ break;
+ }
+ case KindInt:
+ {
+ return "int";
+ break;
+ }
+ case KindLong:
+ {
+ return "long";
+ break;
+ }
+ case KindFloat:
+ {
+ return "float";
+ break;
+ }
+ case KindDouble:
+ {
+ return "double";
+ break;
+ }
+ case KindString:
+ {
+ return "string";
+ break;
+ }
+ case KindObject:
+ {
+ return "::Ice::Object";
+ break;
+ }
+ case KindObjectProxy:
+ {
+ return "::Ice::Object*";
+ break;
+ }
+ case KindLocalObject:
+ {
+ return "::Ice::LocalObject";
+ break;
+ }
}
assert(false);
return ""; // Keep the compiler happy.
@@ -239,16 +239,16 @@ Slice::Builtin::minWireSize() const
{
static size_t minWireSizeTable[] =
{
- 1, // KindByte
- 1, // KindBool
- 2, // KindShort
- 4, // KindInt
- 8, // KindLong
- 4, // KindFloat
- 8, // KindDouble
- 1, // KindString: at least one byte for an empty string.
- 4, // KindObject: at least 4 bytes (to marshal an index instead of an instance).
- 2 // KindObjectProxy: at least an empty identity for a nil proxy, that is, 2 bytes.
+ 1, // KindByte
+ 1, // KindBool
+ 2, // KindShort
+ 4, // KindInt
+ 8, // KindLong
+ 4, // KindFloat
+ 8, // KindDouble
+ 1, // KindString: at least one byte for an empty string.
+ 4, // KindObject: at least 4 bytes (to marshal an index instead of an instance).
+ 2 // KindObjectProxy: at least an empty identity for a nil proxy, that is, 2 bytes.
};
assert(_kind != KindLocalObject);
@@ -275,17 +275,17 @@ Builtin::kindAsString() const
const char* Slice::Builtin::builtinTable[] =
{
- "byte",
- "bool",
- "short",
- "int",
- "long",
- "float",
- "double",
- "string",
- "Object",
- "Object*",
- "LocalObject"
+ "byte",
+ "bool",
+ "short",
+ "int",
+ "long",
+ "float",
+ "double",
+ "string",
+ "Object",
+ "Object*",
+ "LocalObject"
};
Slice::Builtin::Builtin(const UnitPtr& unit, Kind kind) :
@@ -336,7 +336,7 @@ Slice::Contained::flattenedScope() const
string flattenedScope;
for(string::const_iterator r = s.begin(); r != s.end(); ++r)
{
- flattenedScope += ((*r) == ':') ? '_' : *r;
+ flattenedScope += ((*r) == ':') ? '_' : *r;
}
return flattenedScope;
}
@@ -382,11 +382,11 @@ Slice::Contained::findMetaData(const string& prefix, string& meta) const
{
for(list<string>::const_iterator p = _metaData.begin(); p != _metaData.end(); ++p)
{
- if(p->find(prefix) == 0)
- {
- meta = *p;
- return true;
- }
+ if(p->find(prefix) == 0)
+ {
+ meta = *p;
+ return true;
+ }
}
return false;
@@ -439,7 +439,7 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) :
ContainedPtr cont = ContainedPtr::dynamicCast(_container);
if(cont)
{
- _scoped = cont->scoped();
+ _scoped = cont->scoped();
}
_scoped += "::" + _name;
assert(_unit);
@@ -475,37 +475,37 @@ Slice::Container::createModule(const string& name)
for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
- bool differsOnlyInCase = !_unit->caseSensitive() && matches.front()->name() != name;
- ModulePtr module = ModulePtr::dynamicCast(*p);
- if(module)
- {
- if(differsOnlyInCase) // Modules can be reopened only if they are capitalized correctly.
- {
- string msg = "module `" + name + "' is capitalized inconsistently with its previous name: `";
- msg += module->name() + "'";
- _unit->error(msg);
- return 0;
- }
- }
- else if(!differsOnlyInCase)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as module";
- _unit->error(msg);
- return 0;
- }
- else
- {
- string msg = "module `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
- _unit->error(msg);
- return 0;
- }
+ bool differsOnlyInCase = !_unit->caseSensitive() && matches.front()->name() != name;
+ ModulePtr module = ModulePtr::dynamicCast(*p);
+ if(module)
+ {
+ if(differsOnlyInCase) // Modules can be reopened only if they are capitalized correctly.
+ {
+ string msg = "module `" + name + "' is capitalized inconsistently with its previous name: `";
+ msg += module->name() + "'";
+ _unit->error(msg);
+ return 0;
+ }
+ }
+ else if(!differsOnlyInCase)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as module";
+ _unit->error(msg);
+ return 0;
+ }
+ else
+ {
+ string msg = "module `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ return 0;
+ }
}
if(!nameIsLegal(name, "module"))
{
- return 0;
+ return 0;
}
ModulePtr q = new Module(this, name);
@@ -520,65 +520,65 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
ContainedList matches = _unit->findContents(thisScope() + name);
for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
- ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*p);
- if(decl)
- {
- if(checkInterfaceAndLocal(name, false, intf, decl->isInterface(), local, decl->isLocal()))
- {
- continue;
- }
- return 0;
- }
-
- bool differsOnlyInCase = !_unit->caseSensitive() && matches.front()->name() != name;
- ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if(def)
- {
- if(differsOnlyInCase)
- {
- string msg = intf ? "interface" : "class";
- msg += " definition `" + name + "' is capitalized inconsistently with its previous name: `";
- msg += def->name() + "'";
- _unit->error(msg);
- }
- else
- {
- if(_unit->ignRedefs())
- {
- def->updateIncludeLevel();
- return def;
- }
-
- string msg = "redefinition of ";
- msg += intf ? "interface" : "class";
- msg += " `" + name + "'";
- _unit->error(msg);
- }
- }
- else if(!_unit->caseSensitive() && differsOnlyInCase)
- {
- string msg = intf ? "interface" : "class";
- msg = " definition `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
- else
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name() + "' as ";
- msg += intf ? "interface" : "class";
- _unit->error(msg);
- }
- return 0;
+ ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*p);
+ if(decl)
+ {
+ if(checkInterfaceAndLocal(name, false, intf, decl->isInterface(), local, decl->isLocal()))
+ {
+ continue;
+ }
+ return 0;
+ }
+
+ bool differsOnlyInCase = !_unit->caseSensitive() && matches.front()->name() != name;
+ ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
+ if(def)
+ {
+ if(differsOnlyInCase)
+ {
+ string msg = intf ? "interface" : "class";
+ msg += " definition `" + name + "' is capitalized inconsistently with its previous name: `";
+ msg += def->name() + "'";
+ _unit->error(msg);
+ }
+ else
+ {
+ if(_unit->ignRedefs())
+ {
+ def->updateIncludeLevel();
+ return def;
+ }
+
+ string msg = "redefinition of ";
+ msg += intf ? "interface" : "class";
+ msg += " `" + name + "'";
+ _unit->error(msg);
+ }
+ }
+ else if(!_unit->caseSensitive() && differsOnlyInCase)
+ {
+ string msg = intf ? "interface" : "class";
+ msg = " definition `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
+ else
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name() + "' as ";
+ msg += intf ? "interface" : "class";
+ _unit->error(msg);
+ }
+ return 0;
}
if(!nameIsLegal(name, intf ? "interface" : "class"))
{
- return 0;
+ return 0;
}
if(!checkForGlobalDef(name, intf ? "interface" : "class"))
{
- return 0;
+ return 0;
}
ClassDecl::checkBasesAreLegal(name, intf, local, bases, _unit);
@@ -588,8 +588,8 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
for(ContainedList::const_iterator q = matches.begin(); q != matches.end(); ++q)
{
- ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
- decl->_definition = def;
+ ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
+ decl->_definition = def;
}
//
@@ -613,54 +613,54 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
ContainedList matches = _unit->findContents(thisScope() + name);
for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
- ClassDefPtr clDef = ClassDefPtr::dynamicCast(*p);
- if(clDef)
- {
- if(checkInterfaceAndLocal(name, true, intf, clDef->isInterface(), local, clDef->isLocal()))
- {
- assert(!def);
- def = clDef;
- continue;
- }
- return 0;
- }
-
- ClassDeclPtr clDecl = ClassDeclPtr::dynamicCast(*p);
- if(clDecl)
- {
- if(checkInterfaceAndLocal(name, false, intf, clDecl->isInterface(), local, clDecl->isLocal()))
- {
- continue;
- }
- return 0;
- }
-
- bool differsOnlyInCase = !_unit->caseSensitive() && matches.front()->name() != name;
- if(differsOnlyInCase)
- {
- string msg = "class declaration `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
- else
- {
- string msg = "declaration of already defined `";
- msg += name;
- msg += "' as ";
- msg += intf ? "interface" : "class";
- _unit->error(msg);
- return 0;
- }
+ ClassDefPtr clDef = ClassDefPtr::dynamicCast(*p);
+ if(clDef)
+ {
+ if(checkInterfaceAndLocal(name, true, intf, clDef->isInterface(), local, clDef->isLocal()))
+ {
+ assert(!def);
+ def = clDef;
+ continue;
+ }
+ return 0;
+ }
+
+ ClassDeclPtr clDecl = ClassDeclPtr::dynamicCast(*p);
+ if(clDecl)
+ {
+ if(checkInterfaceAndLocal(name, false, intf, clDecl->isInterface(), local, clDecl->isLocal()))
+ {
+ continue;
+ }
+ return 0;
+ }
+
+ bool differsOnlyInCase = !_unit->caseSensitive() && matches.front()->name() != name;
+ if(differsOnlyInCase)
+ {
+ string msg = "class declaration `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
+ else
+ {
+ string msg = "declaration of already defined `";
+ msg += name;
+ msg += "' as ";
+ msg += intf ? "interface" : "class";
+ _unit->error(msg);
+ return 0;
+ }
}
if(!nameIsLegal(name, intf ? "interface" : "class"))
{
- return 0;
+ return 0;
}
if(!checkForGlobalDef(name, intf ? "interface" : "class"))
{
- return 0;
+ return 0;
}
//
@@ -670,16 +670,16 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
//
for(ContainedList::const_iterator q = _contents.begin(); q != _contents.end(); ++q)
{
- if((*q)->name() == name)
- {
- ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
- if(decl)
- {
- return decl;
- }
+ if((*q)->name() == name)
+ {
+ ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
+ if(decl)
+ {
+ return decl;
+ }
- assert(ClassDefPtr::dynamicCast(*q));
- }
+ assert(ClassDefPtr::dynamicCast(*q));
+ }
}
_unit->currentContainer();
@@ -688,7 +688,7 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
if(def)
{
- decl->_definition = def;
+ decl->_definition = def;
}
return decl;
@@ -702,27 +702,27 @@ Slice::Container::createException(const string& name, const ExceptionPtr& base,
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- ExceptionPtr p = ExceptionPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(matches.front()->name() == name)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as exception";
- _unit->error(msg);
- }
- else if(!_unit->caseSensitive())
- {
- string msg = "exception `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
+ ExceptionPtr p = ExceptionPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(matches.front()->name() == name)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as exception";
+ _unit->error(msg);
+ }
+ else if(!_unit->caseSensitive())
+ {
+ string msg = "exception `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
nameIsLegal(name, "exception"); // Don't return here -- we create the exception anyway
@@ -734,7 +734,7 @@ Slice::Container::createException(const string& name, const ExceptionPtr& base,
//
if(!local && base && base->isLocal())
{
- _unit->error("non-local exception `" + name + "' cannot have local base exception `" + base->name() + "'");
+ _unit->error("non-local exception `" + name + "' cannot have local base exception `" + base->name() + "'");
}
ExceptionPtr p = new Exception(this, name, base, local);
@@ -750,27 +750,27 @@ Slice::Container::createStruct(const string& name, bool local)
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- StructPtr p = StructPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(matches.front()->name() == name)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as struct";
- _unit->error(msg);
- }
- else if(!_unit->caseSensitive())
- {
- string msg = "struct `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
+ StructPtr p = StructPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(matches.front()->name() == name)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as struct";
+ _unit->error(msg);
+ }
+ else if(!_unit->caseSensitive())
+ {
+ string msg = "struct `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
nameIsLegal(name, "structure"); // Don't return here -- we create the struct anyway.
@@ -789,39 +789,39 @@ Slice::Container::createSequence(const string& name, const TypePtr& type, const
if(_unit->profile() == IceE && !local)
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type))
- {
- string msg = "Sequence `" + name + "' cannot contain object values.";
- _unit->error(msg);
- return 0;
- }
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type))
+ {
+ string msg = "Sequence `" + name + "' cannot contain object values.";
+ _unit->error(msg);
+ return 0;
+ }
}
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- SequencePtr p = SequencePtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(matches.front()->name() == name)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as sequence";
- _unit->error(msg);
- }
- else if(!_unit->caseSensitive())
- {
- string msg = "sequence `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
+ SequencePtr p = SequencePtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(matches.front()->name() == name)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as sequence";
+ _unit->error(msg);
+ }
+ else if(!_unit->caseSensitive())
+ {
+ string msg = "sequence `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
nameIsLegal(name, "sequence"); // Don't return here -- we create the sequence anyway.
@@ -833,8 +833,8 @@ Slice::Container::createSequence(const string& name, const TypePtr& type, const
//
if(!local && type->isLocal())
{
- string msg = "non-local sequence `" + name + "' cannot have local element type";
- _unit->error(msg);
+ string msg = "non-local sequence `" + name + "' cannot have local element type";
+ _unit->error(msg);
}
SequencePtr p = new Sequence(this, name, type, metaData, local);
@@ -844,45 +844,45 @@ Slice::Container::createSequence(const string& name, const TypePtr& type, const
DictionaryPtr
Slice::Container::createDictionary(const string& name, const TypePtr& keyType, const StringList& keyMetaData,
- const TypePtr& valueType, const StringList& valueMetaData, bool local)
+ const TypePtr& valueType, const StringList& valueMetaData, bool local)
{
checkPrefix(name);
if(_unit->profile() == IceE && !local)
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(valueType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(valueType))
- {
- string msg = "Dictionary `" + name + "' cannot contain object values.";
- _unit->error(msg);
- return 0;
- }
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(valueType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(valueType))
+ {
+ string msg = "Dictionary `" + name + "' cannot contain object values.";
+ _unit->error(msg);
+ return 0;
+ }
}
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- DictionaryPtr p = DictionaryPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(matches.front()->name() == name)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as dictionary";
- _unit->error(msg);
- }
- else if(!_unit->caseSensitive())
- {
- string msg = "dictionary `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
+ DictionaryPtr p = DictionaryPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(matches.front()->name() == name)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as dictionary";
+ _unit->error(msg);
+ }
+ else if(!_unit->caseSensitive())
+ {
+ string msg = "dictionary `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
nameIsLegal(name, "dictionary"); // Don't return here -- we create the dictionary anyway.
@@ -891,22 +891,22 @@ Slice::Container::createDictionary(const string& name, const TypePtr& keyType, c
if(!Dictionary::legalKeyType(keyType))
{
- _unit->error("dictionary `" + name + "' uses an illegal key type");
- return 0;
+ _unit->error("dictionary `" + name + "' uses an illegal key type");
+ return 0;
}
if(!local)
{
- if(keyType->isLocal())
- {
- string msg = "non-local dictionary `" + name + "' cannot have local key type";
- _unit->error(msg);
- }
- if(valueType->isLocal())
- {
- string msg = "non-local dictionary `" + name + "' cannot have local value type";
- _unit->error(msg);
- }
+ if(keyType->isLocal())
+ {
+ string msg = "non-local dictionary `" + name + "' cannot have local key type";
+ _unit->error(msg);
+ }
+ if(valueType->isLocal())
+ {
+ string msg = "non-local dictionary `" + name + "' cannot have local value type";
+ _unit->error(msg);
+ }
}
DictionaryPtr p = new Dictionary(this, name, keyType, keyMetaData, valueType, valueMetaData, local);
@@ -922,27 +922,27 @@ Slice::Container::createEnum(const string& name, bool local)
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- EnumPtr p = EnumPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(matches.front()->name() == name)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as enumeration";
- _unit->error(msg);
- }
- else if(!_unit->caseSensitive())
- {
- string msg = "enumeration `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
+ EnumPtr p = EnumPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(matches.front()->name() == name)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as enumeration";
+ _unit->error(msg);
+ }
+ else if(!_unit->caseSensitive())
+ {
+ string msg = "enumeration `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
nameIsLegal(name, "enumeration"); // Don't return here -- we create the enumeration anyway.
@@ -962,27 +962,27 @@ Slice::Container::createEnumerator(const string& name)
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- EnumeratorPtr p = EnumeratorPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(matches.front()->name() == name)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as enumerator";
- _unit->error(msg);
- }
- else if(!_unit->caseSensitive())
- {
- string msg = "enumerator `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
+ EnumeratorPtr p = EnumeratorPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(matches.front()->name() == name)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as enumerator";
+ _unit->error(msg);
+ }
+ else if(!_unit->caseSensitive())
+ {
+ string msg = "enumerator `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
nameIsLegal(name, "enumerator"); // Don't return here -- we create the enumerator anyway.
@@ -994,34 +994,34 @@ Slice::Container::createEnumerator(const string& name)
ConstPtr
Slice::Container::createConst(const string name, const TypePtr& constType, const StringList& metaData,
- const SyntaxTreeBasePtr& literalType, const string& value)
+ const SyntaxTreeBasePtr& literalType, const string& value)
{
checkPrefix(name);
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- ConstPtr p = ConstPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(matches.front()->name() == name)
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as constant";
- _unit->error(msg);
- }
- else if(!_unit->caseSensitive())
- {
- string msg = "constant `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
+ ConstPtr p = ConstPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(matches.front()->name() == name)
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as constant";
+ _unit->error(msg);
+ }
+ else if(!_unit->caseSensitive())
+ {
+ string msg = "constant `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
nameIsLegal(name, "constant"); // Don't return here -- we create the constant anyway.
@@ -1033,7 +1033,7 @@ Slice::Container::createConst(const string name, const TypePtr& constType, const
//
if(!Const::isLegalType(name, constType, _unit))
{
- return 0;
+ return 0;
}
//
@@ -1041,7 +1041,7 @@ Slice::Container::createConst(const string name, const TypePtr& constType, const
//
if(!Const::typesAreCompatible(name, constType, literalType, value, _unit))
{
- return 0;
+ return 0;
}
//
@@ -1049,7 +1049,7 @@ Slice::Container::createConst(const string name, const TypePtr& constType, const
//
if(!Const::isInRange(name, constType, value, _unit))
{
- return 0;
+ return 0;
}
ConstPtr p = new Const(this, name, constType, metaData, value);
@@ -1067,7 +1067,7 @@ Slice::Container::lookupType(const string& scoped, bool printError)
string::size_type pos;
while((pos = sc.find_first_of(" \t\r\n")) != string::npos)
{
- sc.erase(pos, 1);
+ sc.erase(pos, 1);
}
//
@@ -1075,12 +1075,12 @@ Slice::Container::lookupType(const string& scoped, bool printError)
//
for(unsigned int i = 0; i < sizeof(Builtin::builtinTable) / sizeof(const char*); ++i)
{
- if(sc == Builtin::builtinTable[i])
- {
- TypeList result;
- result.push_back(_unit->builtin(static_cast<Builtin::Kind>(i)));
- return result;
- }
+ if(sc == Builtin::builtinTable[i])
+ {
+ TypeList result;
+ result.push_back(_unit->builtin(static_cast<Builtin::Kind>(i)));
+ return result;
+ }
}
//
@@ -1099,7 +1099,7 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
string::size_type pos;
while((pos = sc.find_first_of(" \t\r\n")) != string::npos)
{
- sc.erase(pos, 1);
+ sc.erase(pos, 1);
}
//
@@ -1107,118 +1107,118 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
//
if(sc.size() >= 2 && sc[0] == ':')
{
- return _unit->lookupTypeNoBuiltin(sc.substr(2), printError);
+ return _unit->lookupTypeNoBuiltin(sc.substr(2), printError);
}
TypeList results;
if(sc.rfind('*') == sc.length() - 1)
{
- //
- // Proxies.
- //
- ContainedList matches = _unit->findContents(thisScope() + sc.substr(0, sc.length() - 1));
- for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
- {
- ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if(def)
- {
- continue; // Ignore class definitions.
- }
-
- if(printError && !_unit->caseSensitive() && matches.front()->scoped() != (thisScope() + sc))
- {
- string msg = (*p)->kindOf() + " name `" + scoped;
- msg += "' is capitalized inconsistently with its previous name: `";
- msg += matches.front()->scoped() + "'";
- _unit->error(msg);
- }
-
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if(!cl)
- {
- if(printError)
- {
- string msg = "`";
- msg += sc;
- msg += "' must be class or interface";
- _unit->error(msg);
- }
- return TypeList();
- }
- results.push_back(new Proxy(cl));
- }
+ //
+ // Proxies.
+ //
+ ContainedList matches = _unit->findContents(thisScope() + sc.substr(0, sc.length() - 1));
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ {
+ ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
+ if(def)
+ {
+ continue; // Ignore class definitions.
+ }
+
+ if(printError && !_unit->caseSensitive() && matches.front()->scoped() != (thisScope() + sc))
+ {
+ string msg = (*p)->kindOf() + " name `" + scoped;
+ msg += "' is capitalized inconsistently with its previous name: `";
+ msg += matches.front()->scoped() + "'";
+ _unit->error(msg);
+ }
+
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
+ if(!cl)
+ {
+ if(printError)
+ {
+ string msg = "`";
+ msg += sc;
+ msg += "' must be class or interface";
+ _unit->error(msg);
+ }
+ return TypeList();
+ }
+ results.push_back(new Proxy(cl));
+ }
}
else
{
- //
- // Non-Proxies.
- //
- ContainedList matches = _unit->findContents(thisScope() + sc);
- for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
- {
- ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if(def)
- {
- continue; // Ignore class definitions.
- }
-
- if(printError && !_unit->caseSensitive() && matches.front()->scoped() != (thisScope() + sc))
- {
- string msg = (*p)->kindOf() + " name `" + scoped;
- msg += "' is capitalized inconsistently with its previous name: `";
- msg += matches.front()->scoped() + "'";
- _unit->error(msg);
- }
-
-
- ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
- if(ex)
- {
- if(printError)
- {
- string msg = "`";
- msg += sc;
- msg += "' is an exception, which cannot be used as a type";
- _unit->error(msg);
- }
- return TypeList();
- }
-
- TypePtr type = TypePtr::dynamicCast(*p);
- if(!type)
- {
- if(printError)
- {
- string msg = "`";
- msg += sc;
- msg += "' is not a type";
- _unit->error(msg);
- }
- return TypeList();
- }
- results.push_back(type);
- }
+ //
+ // Non-Proxies.
+ //
+ ContainedList matches = _unit->findContents(thisScope() + sc);
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ {
+ ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
+ if(def)
+ {
+ continue; // Ignore class definitions.
+ }
+
+ if(printError && !_unit->caseSensitive() && matches.front()->scoped() != (thisScope() + sc))
+ {
+ string msg = (*p)->kindOf() + " name `" + scoped;
+ msg += "' is capitalized inconsistently with its previous name: `";
+ msg += matches.front()->scoped() + "'";
+ _unit->error(msg);
+ }
+
+
+ ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
+ if(ex)
+ {
+ if(printError)
+ {
+ string msg = "`";
+ msg += sc;
+ msg += "' is an exception, which cannot be used as a type";
+ _unit->error(msg);
+ }
+ return TypeList();
+ }
+
+ TypePtr type = TypePtr::dynamicCast(*p);
+ if(!type)
+ {
+ if(printError)
+ {
+ string msg = "`";
+ msg += sc;
+ msg += "' is not a type";
+ _unit->error(msg);
+ }
+ return TypeList();
+ }
+ results.push_back(type);
+ }
}
if(results.empty())
{
- ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if(!contained)
- {
- if(printError)
- {
- string msg = "`";
- msg += sc;
- msg += "' is not defined";
- _unit->error(msg);
- }
- return TypeList();
- }
- return contained->container()->lookupTypeNoBuiltin(sc, printError);
+ ContainedPtr contained = ContainedPtr::dynamicCast(this);
+ if(!contained)
+ {
+ if(printError)
+ {
+ string msg = "`";
+ msg += sc;
+ msg += "' is not defined";
+ _unit->error(msg);
+ }
+ return TypeList();
+ }
+ return contained->container()->lookupTypeNoBuiltin(sc, printError);
}
else
{
- return results;
+ return results;
}
}
@@ -1232,7 +1232,7 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
string::size_type pos;
while((pos = sc.find_first_of(" \t\r\n")) != string::npos)
{
- sc.erase(pos, 1);
+ sc.erase(pos, 1);
}
//
@@ -1240,45 +1240,45 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
//
if(sc.size() >= 2 && sc[0] == ':')
{
- return _unit->lookupContained(sc.substr(2), printError);
+ return _unit->lookupContained(sc.substr(2), printError);
}
ContainedList matches = _unit->findContents(thisScope() + sc);
ContainedList results;
for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
- if(!ClassDefPtr::dynamicCast(*p)) // Ignore class definitions.
- {
- results.push_back(*p);
+ if(!ClassDefPtr::dynamicCast(*p)) // Ignore class definitions.
+ {
+ results.push_back(*p);
- if(printError && !_unit->caseSensitive() && (*p)->scoped() != (thisScope() + sc))
- {
- string msg = (*p)->kindOf() + " name `" + scoped;
- msg += "' is capitalized inconsistently with its previous name: `" + (*p)->scoped() + "'";
- _unit->error(msg);
- }
- }
+ if(printError && !_unit->caseSensitive() && (*p)->scoped() != (thisScope() + sc))
+ {
+ string msg = (*p)->kindOf() + " name `" + scoped;
+ msg += "' is capitalized inconsistently with its previous name: `" + (*p)->scoped() + "'";
+ _unit->error(msg);
+ }
+ }
}
if(results.empty())
{
- ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if(!contained)
- {
- if(printError)
- {
- string msg = "`";
- msg += sc;
- msg += "' is not defined";
- _unit->error(msg);
- }
- return ContainedList();
- }
- return contained->container()->lookupContained(sc, printError);
+ ContainedPtr contained = ContainedPtr::dynamicCast(this);
+ if(!contained)
+ {
+ if(printError)
+ {
+ string msg = "`";
+ msg += sc;
+ msg += "' is not defined";
+ _unit->error(msg);
+ }
+ return ContainedList();
+ }
+ return contained->container()->lookupContained(sc, printError);
}
else
{
- return results;
+ return results;
}
}
@@ -1288,25 +1288,25 @@ Slice::Container::lookupException(const string& scoped, bool printError)
ContainedList contained = lookupContained(scoped, printError);
if(contained.empty())
{
- return 0;
+ return 0;
}
ExceptionList exceptions;
for(ContainedList::iterator p = contained.begin(); p != contained.end(); ++p)
{
- ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
- if(!ex)
- {
- if(printError)
- {
- string msg = "`";
- msg += scoped;
- msg += "' is not an exception";
- _unit->error(msg);
- }
- return 0;
- }
- exceptions.push_back(ex);
+ ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
+ if(!ex)
+ {
+ if(printError)
+ {
+ string msg = "`";
+ msg += scoped;
+ msg += "' is not an exception";
+ _unit->error(msg);
+ }
+ return 0;
+ }
+ exceptions.push_back(ex);
}
assert(exceptions.size() == 1);
return exceptions.front();
@@ -1318,11 +1318,11 @@ Slice::Container::modules() const
ModuleList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ModulePtr q = ModulePtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ ModulePtr q = ModulePtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -1333,11 +1333,11 @@ Slice::Container::classes() const
ClassList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ClassDefPtr q = ClassDefPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ ClassDefPtr q = ClassDefPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -1348,11 +1348,11 @@ Slice::Container::exceptions() const
ExceptionList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -1363,11 +1363,11 @@ Slice::Container::structs() const
StructList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- StructPtr q = StructPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ StructPtr q = StructPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -1378,11 +1378,11 @@ Slice::Container::sequences() const
SequenceList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- SequencePtr q = SequencePtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ SequencePtr q = SequencePtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -1393,11 +1393,11 @@ Slice::Container::dictionaries() const
DictionaryList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DictionaryPtr q = DictionaryPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ DictionaryPtr q = DictionaryPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -1408,11 +1408,11 @@ Slice::Container::enums() const
EnumList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- EnumPtr q = EnumPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ EnumPtr q = EnumPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -1428,17 +1428,17 @@ Slice::Container::hasNonLocalClassDecls() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if(cl && !cl->isLocal())
- {
- return true;
- }
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
+ if(cl && !cl->isLocal())
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasNonLocalClassDecls())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasNonLocalClassDecls())
+ {
+ return true;
+ }
}
return false;
@@ -1449,17 +1449,17 @@ Slice::Container::hasNonLocalClassDefs() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(*p);
- if(cl && !cl->isLocal())
- {
- return true;
- }
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(*p);
+ if(cl && !cl->isLocal())
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasNonLocalClassDefs())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasNonLocalClassDefs())
+ {
+ return true;
+ }
}
return false;
@@ -1470,17 +1470,17 @@ Slice::Container::hasNonLocalSequences() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- SequencePtr s = SequencePtr::dynamicCast(*p);
- if(s && !s->isLocal())
- {
- return true;
- }
+ SequencePtr s = SequencePtr::dynamicCast(*p);
+ if(s && !s->isLocal())
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasNonLocalSequences())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasNonLocalSequences())
+ {
+ return true;
+ }
}
return false;
@@ -1491,17 +1491,17 @@ Slice::Container::hasNonLocalDictionaries() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DictionaryPtr d = DictionaryPtr::dynamicCast(*p);
- if(d && !d->isLocal())
- {
- return true;
- }
+ DictionaryPtr d = DictionaryPtr::dynamicCast(*p);
+ if(d && !d->isLocal())
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasNonLocalDictionaries())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasNonLocalDictionaries())
+ {
+ return true;
+ }
}
return false;
@@ -1512,17 +1512,17 @@ Slice::Container::hasNonLocalExceptions() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
- if(q && !q->isLocal())
- {
- return true;
- }
+ ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
+ if(q && !q->isLocal())
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasNonLocalExceptions())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasNonLocalExceptions())
+ {
+ return true;
+ }
}
return false;
@@ -1533,16 +1533,16 @@ Slice::Container::hasClassDecls() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if(ClassDeclPtr::dynamicCast(*p))
- {
- return true;
- }
+ if(ClassDeclPtr::dynamicCast(*p))
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasClassDecls())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasClassDecls())
+ {
+ return true;
+ }
}
return false;
@@ -1553,16 +1553,16 @@ Slice::Container::hasClassDefs() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if(ClassDefPtr::dynamicCast(*p))
- {
- return true;
- }
+ if(ClassDefPtr::dynamicCast(*p))
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasClassDefs())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasClassDefs())
+ {
+ return true;
+ }
}
return false;
@@ -1573,17 +1573,17 @@ Slice::Container::hasAbstractClassDefs() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(*p);
- if(cl && cl->isAbstract())
- {
- return true;
- }
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(*p);
+ if(cl && cl->isAbstract())
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasAbstractClassDefs())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasAbstractClassDefs())
+ {
+ return true;
+ }
}
return false;
@@ -1594,20 +1594,20 @@ Slice::Container::hasDataOnlyClasses() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ClassDefPtr q = ClassDefPtr::dynamicCast(*p);
- if(q)
- {
- if(!q->isAbstract())
- {
- return true;
- }
- }
+ ClassDefPtr q = ClassDefPtr::dynamicCast(*p);
+ if(q)
+ {
+ if(!q->isAbstract())
+ {
+ return true;
+ }
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasDataOnlyClasses())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasDataOnlyClasses())
+ {
+ return true;
+ }
}
return false;
@@ -1618,26 +1618,26 @@ Slice::Container::hasOtherConstructedOrExceptions() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if(ConstructedPtr::dynamicCast(*p) && !ClassDeclPtr::dynamicCast(*p) && !ClassDefPtr::dynamicCast(*p))
- {
- return true;
- }
+ if(ConstructedPtr::dynamicCast(*p) && !ClassDeclPtr::dynamicCast(*p) && !ClassDefPtr::dynamicCast(*p))
+ {
+ return true;
+ }
- if(ExceptionPtr::dynamicCast(*p))
- {
- return true;
- }
+ if(ExceptionPtr::dynamicCast(*p))
+ {
+ return true;
+ }
- if(ConstPtr::dynamicCast(*p))
- {
- return true;
- }
+ if(ConstPtr::dynamicCast(*p))
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasOtherConstructedOrExceptions())
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasOtherConstructedOrExceptions())
+ {
+ return true;
+ }
}
return false;
@@ -1648,16 +1648,16 @@ Slice::Container::hasContentsWithMetaData(const string& meta) const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if((*p)->hasMetaData(meta))
- {
- return true;
- }
+ if((*p)->hasMetaData(meta))
+ {
+ return true;
+ }
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasContentsWithMetaData(meta))
- {
- return true;
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasContentsWithMetaData(meta))
+ {
+ return true;
+ }
}
return false;
@@ -1668,29 +1668,29 @@ Slice::Container::hasAsyncOps() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(*p);
- if(cl && !cl->isLocal())
- {
- OperationList ops = cl->operations();
- if(!ops.empty() && (cl->hasMetaData("ami") || cl->hasMetaData("amd")))
- {
- return true;
- }
- for(OperationList::const_iterator i = ops.begin(); i != ops.end(); ++i)
- {
- OperationPtr op = *i;
- if(op->hasMetaData("ami") || op->hasMetaData("amd"))
- {
- return true;
- }
- }
- }
-
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasAsyncOps())
- {
- return true;
- }
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(*p);
+ if(cl && !cl->isLocal())
+ {
+ OperationList ops = cl->operations();
+ if(!ops.empty() && (cl->hasMetaData("ami") || cl->hasMetaData("amd")))
+ {
+ return true;
+ }
+ for(OperationList::const_iterator i = ops.begin(); i != ops.end(); ++i)
+ {
+ OperationPtr op = *i;
+ if(op->hasMetaData("ami") || op->hasMetaData("amd"))
+ {
+ return true;
+ }
+ }
+ }
+
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container && container->hasAsyncOps())
+ {
+ return true;
+ }
}
return false;
@@ -1703,7 +1703,7 @@ Slice::Container::thisScope() const
ContainedPtr contained = ContainedPtr::dynamicCast(const_cast<Container*>(this));
if(contained)
{
- s = contained->scoped();
+ s = contained->scoped();
}
s += "::";
return s;
@@ -1714,34 +1714,34 @@ Slice::Container::mergeModules()
{
for(ContainedList::iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ModulePtr mod1 = ModulePtr::dynamicCast(*p);
- if(!mod1)
- {
- continue;
- }
-
+ ModulePtr mod1 = ModulePtr::dynamicCast(*p);
+ if(!mod1)
+ {
+ continue;
+ }
+
DefinitionContextPtr dc1 = mod1->definitionContext();
assert(dc1);
StringList metaData1 = dc1->getMetaData();
metaData1.sort();
metaData1.unique();
- ContainedList::iterator q = p;
- ++q;
- while(q != _contents.end())
- {
- ModulePtr mod2 = ModulePtr::dynamicCast(*q);
- if(!mod2)
- {
- ++q;
- continue;
- }
-
- if(mod1->name() != mod2->name())
- {
- ++q;
- continue;
- }
+ ContainedList::iterator q = p;
+ ++q;
+ while(q != _contents.end())
+ {
+ ModulePtr mod2 = ModulePtr::dynamicCast(*q);
+ if(!mod2)
+ {
+ ++q;
+ continue;
+ }
+
+ if(mod1->name() != mod2->name())
+ {
+ ++q;
+ continue;
+ }
//
// Compare the global metadata of the two modules being merged.
@@ -1757,20 +1757,20 @@ Slice::Container::mergeModules()
dc1->filename() + " and " + dc2->filename());
}
- mod1->_contents.splice(mod1->_contents.end(), mod2->_contents);
+ mod1->_contents.splice(mod1->_contents.end(), mod2->_contents);
- if(mod1->_comment.length() < mod2->_comment.length())
- {
- mod1->_comment.swap(mod2->_comment);
- }
+ if(mod1->_comment.length() < mod2->_comment.length())
+ {
+ mod1->_comment.swap(mod2->_comment);
+ }
- mod1->_includeLevel = min(mod1->_includeLevel, mod2->_includeLevel);
+ mod1->_includeLevel = min(mod1->_includeLevel, mod2->_includeLevel);
- _unit->removeContent(*q);
- q = _contents.erase(q);
- }
-
- mod1->mergeModules();
+ _unit->removeContent(*q);
+ q = _contents.erase(q);
+ }
+
+ mod1->mergeModules();
}
}
@@ -1785,28 +1785,28 @@ Slice::Container::sortContents(bool sortFields)
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container)
- {
- if(!sortFields)
- {
- if(StructPtr::dynamicCast(container) ||
- ClassDefPtr::dynamicCast(container) ||
- ExceptionPtr::dynamicCast(container))
- {
- continue;
- }
- }
- //
- // Don't sort operation definitions, otherwise parameters are shown in the
- // wrong order in the synopsis.
- //
- if(!OperationPtr::dynamicCast(container))
- {
- container->sort();
- }
- container->sortContents(sortFields);
- }
+ ContainerPtr container = ContainerPtr::dynamicCast(*p);
+ if(container)
+ {
+ if(!sortFields)
+ {
+ if(StructPtr::dynamicCast(container) ||
+ ClassDefPtr::dynamicCast(container) ||
+ ExceptionPtr::dynamicCast(container))
+ {
+ continue;
+ }
+ }
+ //
+ // Don't sort operation definitions, otherwise parameters are shown in the
+ // wrong order in the synopsis.
+ //
+ if(!OperationPtr::dynamicCast(container))
+ {
+ container->sort();
+ }
+ container->sortContents(sortFields);
+ }
}
}
@@ -1815,10 +1815,10 @@ Slice::Container::visit(ParserVisitor* visitor, bool all)
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if(all || (*p)->includeLevel() == 0)
- {
- (*p)->visit(visitor, all);
- }
+ if(all || (*p)->includeLevel() == 0)
+ {
+ (*p)->visit(visitor, all);
+ }
}
}
@@ -1828,12 +1828,12 @@ Slice::Container::containerRecDependencies(set<ConstructedPtr>& dependencies)
ContainedList::iterator p;
for(p = _contents.begin(); p != _contents.end(); ++p)
{
- ConstructedPtr constructed = ConstructedPtr::dynamicCast(*p);
- if(constructed && dependencies.find(constructed) != dependencies.end())
- {
- dependencies.insert(constructed);
- constructed->recDependencies(dependencies);
- }
+ ConstructedPtr constructed = ConstructedPtr::dynamicCast(*p);
+ if(constructed && dependencies.find(constructed) != dependencies.end())
+ {
+ dependencies.insert(constructed);
+ constructed->recDependencies(dependencies);
+ }
}
}
@@ -1842,7 +1842,7 @@ Slice::Container::checkIntroduced(const string& scoped, ContainedPtr namedThing)
{
if(scoped[0] == ':') // Only unscoped names introduce anything.
{
- return true;
+ return true;
}
//
@@ -1857,48 +1857,48 @@ Slice::Container::checkIntroduced(const string& scoped, ContainedPtr namedThing)
//
if(namedThing == 0)
{
- ContainedList cl = lookupContained(firstComponent, false);
- if(namedThing == 0)
- {
- if(cl.empty())
- {
- return true; // Ignore types whose creation failed previously.
- }
- }
- namedThing = cl.front();
+ ContainedList cl = lookupContained(firstComponent, false);
+ if(namedThing == 0)
+ {
+ if(cl.empty())
+ {
+ return true; // Ignore types whose creation failed previously.
+ }
+ }
+ namedThing = cl.front();
}
else
{
- //
- // For each scope, get the container until we have the container
- // for the first scope (which is the introduced one).
- //
- ContainerPtr c;
- bool first = true;
- while(pos != string::npos)
- {
- if(first)
- {
- c = namedThing->container();
- }
- else
- {
- ContainedPtr contained = ContainedPtr::dynamicCast(c);
- if(contained)
- {
- c = contained->container();
- }
- }
- first = false;
- if(pos != string::npos)
- {
- pos = scoped.find("::", pos + 2);
- }
- }
- if(ContainedPtr::dynamicCast(c))
- {
- namedThing = ContainedPtr::dynamicCast(c);
- }
+ //
+ // For each scope, get the container until we have the container
+ // for the first scope (which is the introduced one).
+ //
+ ContainerPtr c;
+ bool first = true;
+ while(pos != string::npos)
+ {
+ if(first)
+ {
+ c = namedThing->container();
+ }
+ else
+ {
+ ContainedPtr contained = ContainedPtr::dynamicCast(c);
+ if(contained)
+ {
+ c = contained->container();
+ }
+ }
+ first = false;
+ if(pos != string::npos)
+ {
+ pos = scoped.find("::", pos + 2);
+ }
+ }
+ if(ContainedPtr::dynamicCast(c))
+ {
+ namedThing = ContainedPtr::dynamicCast(c);
+ }
}
//
@@ -1907,22 +1907,22 @@ Slice::Container::checkIntroduced(const string& scoped, ContainedPtr namedThing)
map<string, ContainedPtr, CICompare>::const_iterator it = _introducedMap.find(firstComponent);
if(it == _introducedMap.end())
{
- //
- // We've just introduced the first component to the current scope.
- //
- _introducedMap[firstComponent] = namedThing; // No, insert it
+ //
+ // We've just introduced the first component to the current scope.
+ //
+ _introducedMap[firstComponent] = namedThing; // No, insert it
}
else
{
- //
- // We've previously introduced the first component to the current scope,
- // check that it has not changed meaning.
- //
- if(!_unit->caseSensitive() && it->second != namedThing)
- {
- _unit->error("`" + firstComponent + "' has changed meaning");
- return false;
- }
+ //
+ // We've previously introduced the first component to the current scope,
+ // check that it has not changed meaning.
+ //
+ if(!_unit->caseSensitive() && it->second != namedThing)
+ {
+ _unit->error("`" + firstComponent + "' has changed meaning");
+ return false;
+ }
}
return true;
}
@@ -1937,29 +1937,29 @@ Slice::Container::nameIsLegal(const string& newName, const char* newConstruct)
//
if(module)
{
- if(newName == module->name())
- {
- string msg = newConstruct;
- msg += " name `" + newName + "' must differ from the name of its immediately enclosing module";
- _unit->error(msg);
- return false;
- }
- if(!_unit->caseSensitive())
- {
- string name = newName;
- toLower(name);
- string thisName = module->name();
- toLower(thisName);
- if(name == thisName)
- {
- string msg = newConstruct;
- msg += " name `" + name + "' cannot differ only in capitalization from its immediately enclosing "
- "module name `" + module->name() + "'";
- _unit->error(msg);
- return false;
- }
- }
- module = ModulePtr::dynamicCast(module->container()); // Get enclosing module for test below.
+ if(newName == module->name())
+ {
+ string msg = newConstruct;
+ msg += " name `" + newName + "' must differ from the name of its immediately enclosing module";
+ _unit->error(msg);
+ return false;
+ }
+ if(!_unit->caseSensitive())
+ {
+ string name = newName;
+ toLower(name);
+ string thisName = module->name();
+ toLower(thisName);
+ if(name == thisName)
+ {
+ string msg = newConstruct;
+ msg += " name `" + name + "' cannot differ only in capitalization from its immediately enclosing "
+ "module name `" + module->name() + "'";
+ _unit->error(msg);
+ return false;
+ }
+ }
+ module = ModulePtr::dynamicCast(module->container()); // Get enclosing module for test below.
}
//
@@ -1967,30 +1967,30 @@ Slice::Container::nameIsLegal(const string& newName, const char* newConstruct)
//
while(module)
{
- if(newName == module->name())
- {
- string msg = newConstruct;
- msg += " name `" + newName + "' must differ from the name of enclosing module `" + module->name()
- + "' (first defined at " + module->file() + ":" + module->line() + ")";
- _unit->error(msg);
- return false;
- }
- if(!_unit->caseSensitive())
- {
- string name = newName;
- toLower(name);
- string thisName = module->name();
- toLower(thisName);
- if(name == thisName)
- {
- string msg = newConstruct;
- msg += " name `" + name + "' cannot differ only in capitalization from enclosing module `"
- + module->name() + "' (first defined at " + module->file() + ":" + module->line() + ")";
- _unit->error(msg);
- return false;
- }
- }
- module = ModulePtr::dynamicCast(module->container());
+ if(newName == module->name())
+ {
+ string msg = newConstruct;
+ msg += " name `" + newName + "' must differ from the name of enclosing module `" + module->name()
+ + "' (first defined at " + module->file() + ":" + module->line() + ")";
+ _unit->error(msg);
+ return false;
+ }
+ if(!_unit->caseSensitive())
+ {
+ string name = newName;
+ toLower(name);
+ string thisName = module->name();
+ toLower(thisName);
+ if(name == thisName)
+ {
+ string msg = newConstruct;
+ msg += " name `" + name + "' cannot differ only in capitalization from enclosing module `"
+ + module->name() + "' (first defined at " + module->file() + ":" + module->line() + ")";
+ _unit->error(msg);
+ return false;
+ }
+ }
+ module = ModulePtr::dynamicCast(module->container());
}
return true;
@@ -2001,15 +2001,15 @@ Slice::Container::checkForGlobalDef(const string& name, const char* newConstruct
{
if(dynamic_cast<Unit*>(this) && strcmp(newConstruct, "module"))
{
- static const string vowels = "aeiou";
- string glottalStop;
- if(vowels.find_first_of(newConstruct[0]) != string::npos)
- {
- glottalStop = "n";
- }
- _unit->error("`" + name + "': a" + glottalStop + " " + newConstruct +
- " can be defined only at module scope");
- return false;
+ static const string vowels = "aeiou";
+ string glottalStop;
+ if(vowels.find_first_of(newConstruct[0]) != string::npos)
+ {
+ glottalStop = "n";
+ }
+ _unit->error("`" + name + "': a" + glottalStop + " " + newConstruct +
+ " can be defined only at module scope");
+ return false;
}
return true;
}
@@ -2021,61 +2021,61 @@ Slice::Container::Container(const UnitPtr& unit) :
bool
Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
- bool intf, bool intfOther,
- bool local, bool localOther)
+ bool intf, bool intfOther,
+ bool local, bool localOther)
{
string definedOrDeclared;
if(defined)
{
- definedOrDeclared = "defined";
+ definedOrDeclared = "defined";
}
else
{
- definedOrDeclared = "declared";
+ definedOrDeclared = "declared";
}
if(!intf && intfOther)
{
- string msg = "class `";
- msg += name;
- msg += "' was ";
- msg += definedOrDeclared;
- msg += " as interface";
- _unit->error(msg);
- return false;
+ string msg = "class `";
+ msg += name;
+ msg += "' was ";
+ msg += definedOrDeclared;
+ msg += " as interface";
+ _unit->error(msg);
+ return false;
}
if(intf && !intfOther)
{
- string msg = "interface `";
- msg += name;
- msg += "' was ";
- msg += definedOrDeclared;
- msg += " as class";
- _unit->error(msg);
- return false;
+ string msg = "interface `";
+ msg += name;
+ msg += "' was ";
+ msg += definedOrDeclared;
+ msg += " as class";
+ _unit->error(msg);
+ return false;
}
if(!local && localOther)
{
- string msg = "non-local `";
- msg += name;
- msg += "' was ";
- msg += definedOrDeclared;
- msg += " local";
- _unit->error(msg);
- return false;
+ string msg = "non-local `";
+ msg += name;
+ msg += "' was ";
+ msg += definedOrDeclared;
+ msg += " local";
+ _unit->error(msg);
+ return false;
}
if(local && !localOther)
{
- string msg = "local `";
- msg += name;
- msg += "' was ";
- msg += definedOrDeclared;
- msg += " non-local";
- _unit->error(msg);
- return false;
+ string msg = "local `";
+ msg += name;
+ msg += "' was ";
+ msg += definedOrDeclared;
+ msg += " non-local";
+ _unit->error(msg);
+ return false;
}
return true;
@@ -2086,17 +2086,17 @@ Slice::Container::checkPrefix(const string& name) const
{
if(_unit->currentIncludeLevel() == 0 && !_unit->allowIcePrefix())
{
- if(name.size() >= 3)
- {
- string prefix3;
- prefix3 += ::tolower(name[0]);
- prefix3 += ::tolower(name[1]);
- prefix3 += ::tolower(name[2]);
- if(prefix3 == "ice")
- {
- _unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved");
- }
- }
+ if(name.size() >= 3)
+ {
+ string prefix3;
+ prefix3 += ::tolower(name[0]);
+ prefix3 += ::tolower(name[1]);
+ prefix3 += ::tolower(name[2]);
+ if(prefix3 == "ice")
+ {
+ _unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved");
+ }
+ }
}
}
@@ -2127,8 +2127,8 @@ Slice::Module::visit(ParserVisitor* visitor, bool all)
{
if(visitor->visitModuleStart(this))
{
- Container::visit(visitor, all);
- visitor->visitModuleEnd(this);
+ Container::visit(visitor, all);
+ visitor->visitModuleEnd(this);
}
}
@@ -2242,7 +2242,7 @@ Slice::ClassDecl::kindOf() const
string s;
if(isLocal())
{
- s += "local ";
+ s += "local ";
}
s += _interface ? "interface" : "class";
return s;
@@ -2259,33 +2259,33 @@ Slice::ClassDecl::recDependencies(set<ConstructedPtr>& dependencies)
{
if(_definition)
{
- _definition->containerRecDependencies(dependencies);
- ClassList bases = _definition->bases();
- ClassList::iterator p;
- for(p = bases.begin(); p != bases.end(); ++p)
- {
- (*p)->declaration()->recDependencies(dependencies);
- }
+ _definition->containerRecDependencies(dependencies);
+ ClassList bases = _definition->bases();
+ ClassList::iterator p;
+ for(p = bases.begin(); p != bases.end(); ++p)
+ {
+ (*p)->declaration()->recDependencies(dependencies);
+ }
}
}
void
Slice::ClassDecl::checkBasesAreLegal(const string& name, bool intf, bool local, const ClassList& bases,
- const UnitPtr& unit)
+ const UnitPtr& unit)
{
//
// Local definitions cannot have non-local bases, and vice versa.
//
for(ClassList::const_iterator p = bases.begin(); p != bases.end(); ++p)
{
- if(local != (*p)->isLocal())
- {
- ostringstream msg;
- msg << (local ? "local" : "non-local") << " " << (intf ? "interface" : "class") << " `"
- << name << "' cannot have " << ((*p)->isLocal() ? "local" : "non-local") << " base "
- << ((*p)->isInterface() ? "interface" : "class") << " `" << (*p)->name() << "'";
- unit->error(msg.str());
- }
+ if(local != (*p)->isLocal())
+ {
+ ostringstream msg;
+ msg << (local ? "local" : "non-local") << " " << (intf ? "interface" : "class") << " `"
+ << name << "' cannot have " << ((*p)->isLocal() ? "local" : "non-local") << " base "
+ << ((*p)->isInterface() ? "interface" : "class") << " `" << (*p)->name() << "'";
+ unit->error(msg.str());
+ }
}
//
@@ -2294,34 +2294,34 @@ Slice::ClassDecl::checkBasesAreLegal(const string& name, bool intf, bool local,
//
if(bases.size() > 1)
{
- //
- // We have multiple inheritance. Build a list of paths through the
- // inheritance graph, such that multiple inheritance is legal if
- // the union of the names defined in classes on each path are disjoint.
- //
- GraphPartitionList gpl;
- for(ClassList::const_iterator p = bases.begin(); p != bases.end(); ++p)
- {
- ClassList cl;
- gpl.push_back(cl);
- addPartition(gpl, gpl.rbegin(), *p);
- }
-
- //
- // We now have a list of partitions, with each partition containing
- // a list of class definitions. Turn the list of partitions of class
- // definitions into a list of sets of strings, with each
- // set containing the names of operations and data members defined in
- // the classes in each partition.
- //
- StringPartitionList spl = toStringPartitionList(gpl);
-
- //
- // Multiple inheritance is legal if no two partitions contain a common
- // name (that is, if the union of the intersections of all possible pairs
- // of partitions is empty).
- //
- checkPairIntersections(spl, name, unit);
+ //
+ // We have multiple inheritance. Build a list of paths through the
+ // inheritance graph, such that multiple inheritance is legal if
+ // the union of the names defined in classes on each path are disjoint.
+ //
+ GraphPartitionList gpl;
+ for(ClassList::const_iterator p = bases.begin(); p != bases.end(); ++p)
+ {
+ ClassList cl;
+ gpl.push_back(cl);
+ addPartition(gpl, gpl.rbegin(), *p);
+ }
+
+ //
+ // We now have a list of partitions, with each partition containing
+ // a list of class definitions. Turn the list of partitions of class
+ // definitions into a list of sets of strings, with each
+ // set containing the names of operations and data members defined in
+ // the classes in each partition.
+ //
+ StringPartitionList spl = toStringPartitionList(gpl);
+
+ //
+ // Multiple inheritance is legal if no two partitions contain a common
+ // name (that is, if the union of the intersections of all possible pairs
+ // of partitions is empty).
+ //
+ checkPairIntersections(spl, name, unit);
}
}
@@ -2343,25 +2343,25 @@ Slice::ClassDecl::isInList(const GraphPartitionList& gpl, const ClassDefPtr cdp)
{
for(GraphPartitionList::const_iterator i = gpl.begin(); i != gpl.end(); ++i)
{
- if(find(i->begin(), i->end(), cdp) != i->end())
- {
- return true;
- }
+ if(find(i->begin(), i->end(), cdp) != i->end())
+ {
+ return true;
+ }
}
return false;
}
void
Slice::ClassDecl::addPartition(GraphPartitionList& gpl,
- GraphPartitionList::reverse_iterator tail,
- const ClassDefPtr base)
+ GraphPartitionList::reverse_iterator tail,
+ const ClassDefPtr base)
{
//
// If this base is on one of the partition lists already, do nothing.
//
if(isInList(gpl, base))
{
- return;
+ return;
}
//
// Put the current base at the end of the current partition.
@@ -2373,7 +2373,7 @@ Slice::ClassDecl::addPartition(GraphPartitionList& gpl,
//
if(base->bases().size())
{
- addPartition(gpl, tail, *(base->bases().begin()));
+ addPartition(gpl, tail, *(base->bases().begin()));
}
//
// If the base has multiple bases, each of the "grandbases"
@@ -2382,14 +2382,14 @@ Slice::ClassDecl::addPartition(GraphPartitionList& gpl,
//
if(base->bases().size() > 1)
{
- ClassList grandBases = base->bases();
- ClassList::const_iterator i = grandBases.begin();
- while(++i != grandBases.end())
- {
- ClassList cl;
- gpl.push_back(cl);
- addPartition(gpl, gpl.rbegin(), *i);
- }
+ ClassList grandBases = base->bases();
+ ClassList::const_iterator i = grandBases.begin();
+ while(++i != grandBases.end())
+ {
+ ClassList cl;
+ gpl.push_back(cl);
+ addPartition(gpl, gpl.rbegin(), *i);
+ }
}
}
@@ -2404,16 +2404,16 @@ Slice::ClassDecl::toStringPartitionList(const GraphPartitionList& gpl)
StringPartitionList spl;
for(GraphPartitionList::const_iterator i = gpl.begin(); i != gpl.end(); ++i)
{
- StringList sl;
- spl.push_back(sl);
- for(ClassList::const_iterator j = i->begin(); j != i->end(); ++j)
- {
- OperationList operations = (*j)->operations();
- for(OperationList::const_iterator l = operations.begin(); l != operations.end(); ++l)
- {
- spl.rbegin()->push_back((*l)->name());
- }
- }
+ StringList sl;
+ spl.push_back(sl);
+ for(ClassList::const_iterator j = i->begin(); j != i->end(); ++j)
+ {
+ OperationList operations = (*j)->operations();
+ for(OperationList::const_iterator l = operations.begin(); l != operations.end(); ++l)
+ {
+ spl.rbegin()->push_back((*l)->name());
+ }
+ }
}
return spl;
}
@@ -2428,35 +2428,35 @@ Slice::ClassDecl::checkPairIntersections(const StringPartitionList& l, const str
set<string> reported;
for(StringPartitionList::const_iterator i = l.begin(); i != l.end(); ++i)
{
- StringPartitionList::const_iterator cursor = i;
- ++cursor;
- for(StringPartitionList::const_iterator j = cursor; j != l.end(); ++j)
- {
- for(StringList::const_iterator s1 = i->begin(); s1 != i->end(); ++s1)
- {
- for(StringList::const_iterator s2 = j->begin(); s2 != j->end(); ++s2)
- {
- if((*s1) == (*s2) && reported.find(*s1) == reported.end())
- {
- string msg = "ambiguous multiple inheritance: `" + name;
- msg += "' inherits operation `" + *s1 + "' from two or more unrelated base interfaces";
- unit->error(msg);
- reported.insert(*s1);
- }
- else if(!unit->caseSensitive() &&
- !CICompare()(*s1, *s2) && !CICompare()(*s2, *s1) &&
- reported.find(*s1) == reported.end() && reported.find(*s2) == reported.end())
- {
- string msg = "ambiguous multiple inheritance: `" + name;
- msg += "' inherits operations `" + *s1 + "' and `" + *s2;
- msg += "', which differ only in capitalization, from unrelated base interfaces";
- unit->error(msg);
- reported.insert(*s1);
- reported.insert(*s2);
- }
- }
- }
- }
+ StringPartitionList::const_iterator cursor = i;
+ ++cursor;
+ for(StringPartitionList::const_iterator j = cursor; j != l.end(); ++j)
+ {
+ for(StringList::const_iterator s1 = i->begin(); s1 != i->end(); ++s1)
+ {
+ for(StringList::const_iterator s2 = j->begin(); s2 != j->end(); ++s2)
+ {
+ if((*s1) == (*s2) && reported.find(*s1) == reported.end())
+ {
+ string msg = "ambiguous multiple inheritance: `" + name;
+ msg += "' inherits operation `" + *s1 + "' from two or more unrelated base interfaces";
+ unit->error(msg);
+ reported.insert(*s1);
+ }
+ else if(!unit->caseSensitive() &&
+ !CICompare()(*s1, *s2) && !CICompare()(*s2, *s1) &&
+ reported.find(*s1) == reported.end() && reported.find(*s2) == reported.end())
+ {
+ string msg = "ambiguous multiple inheritance: `" + name;
+ msg += "' inherits operations `" + *s1 + "' and `" + *s2;
+ msg += "', which differ only in capitalization, from unrelated base interfaces";
+ unit->error(msg);
+ reported.insert(*s1);
+ reported.insert(*s2);
+ }
+ }
+ }
+ }
}
}
@@ -2474,33 +2474,33 @@ Slice::ClassDef::destroy()
OperationPtr
Slice::ClassDef::createOperation(const string& name,
- const TypePtr& returnType,
- Operation::Mode mode)
+ const TypePtr& returnType,
+ Operation::Mode mode)
{
checkPrefix(name);
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- OperationPtr p = OperationPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(!_unit->caseSensitive() && matches.front()->name() != name)
- {
- string msg = "operation `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as operation `" + name + "'";
- _unit->error(msg);
- return 0;
+ OperationPtr p = OperationPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
+ {
+ string msg = "operation `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as operation `" + name + "'";
+ _unit->error(msg);
+ return 0;
}
//
@@ -2508,24 +2508,24 @@ Slice::ClassDef::createOperation(const string& name,
//
if(name == this->name())
{
- string msg = isInterface() ? "interface" : "class";
- msg += " name `" + name + "' cannot be used as operation name";
- _unit->error(msg);
- return 0;
+ string msg = isInterface() ? "interface" : "class";
+ msg += " name `" + name + "' cannot be used as operation name";
+ _unit->error(msg);
+ return 0;
}
if(!_unit->caseSensitive())
{
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
- {
- string msg = "operation `" + name + "' differs only in capitalization from enclosing ";
- msg += isInterface() ? "interface" : "class";
- msg += " name `" + this->name() + "'";
- _unit->error(msg);
- }
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "operation `" + name + "' differs only in capitalization from enclosing ";
+ msg += isInterface() ? "interface" : "class";
+ msg += " name `" + this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -2533,41 +2533,41 @@ Slice::ClassDef::createOperation(const string& name,
//
for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
- ContainedList cl;
- OperationList ol = (*p)->allOperations();
- copy(ol.begin(), ol.end(), back_inserter(cl));
- DataMemberList dml = (*p)->allDataMembers();
- copy(dml.begin(), dml.end(), back_inserter(cl));
- for(ContainedList::const_iterator q = cl.begin(); q != cl.end(); ++q)
- {
- if((*q)->name() == name)
- {
- string msg = "operation `" + name;
- msg += "' is already defined as a";
- static const string vowels = "aeiou";
- string kindOf = (*q)->kindOf();
- if(vowels.find_first_of(kindOf[0]) != string::npos)
- {
- msg += "n";
- }
- msg += " " + kindOf + " in a base interface or class";
- _unit->error(msg);
- return 0;
- }
- if(!_unit->caseSensitive())
- {
- string baseName = (*q)->name();
- toLower(baseName);
- string newName = name;
- toLower(newName);
- if(baseName == newName)
- {
- string msg = "operation `" + name + "' differs only in capitalization from " + (*q)->kindOf();
- msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
- _unit->error(msg);
- }
- }
- }
+ ContainedList cl;
+ OperationList ol = (*p)->allOperations();
+ copy(ol.begin(), ol.end(), back_inserter(cl));
+ DataMemberList dml = (*p)->allDataMembers();
+ copy(dml.begin(), dml.end(), back_inserter(cl));
+ for(ContainedList::const_iterator q = cl.begin(); q != cl.end(); ++q)
+ {
+ if((*q)->name() == name)
+ {
+ string msg = "operation `" + name;
+ msg += "' is already defined as a";
+ static const string vowels = "aeiou";
+ string kindOf = (*q)->kindOf();
+ if(vowels.find_first_of(kindOf[0]) != string::npos)
+ {
+ msg += "n";
+ }
+ msg += " " + kindOf + " in a base interface or class";
+ _unit->error(msg);
+ return 0;
+ }
+ if(!_unit->caseSensitive())
+ {
+ string baseName = (*q)->name();
+ toLower(baseName);
+ string newName = name;
+ toLower(newName);
+ if(baseName == newName)
+ {
+ string msg = "operation `" + name + "' differs only in capitalization from " + (*q)->kindOf();
+ msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
+ _unit->error(msg);
+ }
+ }
+ }
}
//
@@ -2575,9 +2575,9 @@ Slice::ClassDef::createOperation(const string& name,
//
if(!isLocal() && returnType && returnType->isLocal())
{
- string msg = "non-local " + this->kindOf() + " `" + this->name() + "' cannot have operation `";
- msg += name + "' with local return type";
- _unit->error(msg);
+ string msg = "non-local " + this->kindOf() + " `" + this->name() + "' cannot have operation `";
+ msg += name + "' with local return type";
+ _unit->error(msg);
}
_hasOperations = true;
@@ -2593,52 +2593,52 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
if(_unit->profile() == IceE)
{
- if(!isLocal())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if((builtin && builtin->kind() == Builtin::KindObject))
- {
- string msg = "Class data member `" + name + "' cannot be a value object.";
- _unit->error(msg);
- return 0;
- }
-
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
- if(classDecl != 0 && !classDecl->isLocal())
- {
- string msg = "Class data member `" + name + "' cannot be a value object.";
- _unit->error(msg);
- return 0;
- }
- }
+ if(!isLocal())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if((builtin && builtin->kind() == Builtin::KindObject))
+ {
+ string msg = "Class data member `" + name + "' cannot be a value object.";
+ _unit->error(msg);
+ return 0;
+ }
+
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
+ if(classDecl != 0 && !classDecl->isLocal())
+ {
+ string msg = "Class data member `" + name + "' cannot be a value object.";
+ _unit->error(msg);
+ return 0;
+ }
+ }
}
assert(!isInterface());
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(!_unit->caseSensitive() && matches.front()->name() != name)
- {
- string msg = "data member `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
- else
- {
- string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
- msg += "' as data member `" + name + "'";
- _unit->error(msg);
- return 0;
- }
+ DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
+ {
+ string msg = "data member `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
+ else
+ {
+ string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as data member `" + name + "'";
+ _unit->error(msg);
+ return 0;
+ }
}
//
@@ -2646,24 +2646,24 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
//
if(name == this->name())
{
- string msg = "class name `";
- msg += name;
- msg += "' cannot be used as data member name";
- _unit->error(msg);
- return 0;
+ string msg = "class name `";
+ msg += name;
+ msg += "' cannot be used as data member name";
+ _unit->error(msg);
+ return 0;
}
if(!_unit->caseSensitive())
{
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
- {
- string msg = "data member `" + name + "' differs only in capitalization from enclosing class name `";
- msg += this->name() + "'";
- _unit->error(msg);
- }
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "data member `" + name + "' differs only in capitalization from enclosing class name `";
+ msg += this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -2671,41 +2671,41 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
//
for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
- ContainedList cl;
- OperationList ol = (*p)->allOperations();
- copy(ol.begin(), ol.end(), back_inserter(cl));
- DataMemberList dml = (*p)->allDataMembers();
- copy(dml.begin(), dml.end(), back_inserter(cl));
- for(ContainedList::const_iterator q = cl.begin(); q != cl.end(); ++q)
- {
- if((*q)->name() == name)
- {
- string msg = "data member `" + name;
- msg += "' is already defined as a";
- static const string vowels = "aeiou";
- string kindOf = (*q)->kindOf();
- if(vowels.find_first_of(kindOf[0]) != string::npos)
- {
- msg += "n";
- }
- msg += " " + kindOf + " in a base interface or class";
- _unit->error(msg);
- return 0;
- }
- if(!_unit->caseSensitive())
- {
- string baseName = (*q)->name();
- toLower(baseName);
- string newName = name;
- toLower(newName);
- if(baseName == newName)
- {
- string msg = "data member `" + name + "' differs only in capitalization from " + (*q)->kindOf();
- msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
- _unit->error(msg);
- }
- }
- }
+ ContainedList cl;
+ OperationList ol = (*p)->allOperations();
+ copy(ol.begin(), ol.end(), back_inserter(cl));
+ DataMemberList dml = (*p)->allDataMembers();
+ copy(dml.begin(), dml.end(), back_inserter(cl));
+ for(ContainedList::const_iterator q = cl.begin(); q != cl.end(); ++q)
+ {
+ if((*q)->name() == name)
+ {
+ string msg = "data member `" + name;
+ msg += "' is already defined as a";
+ static const string vowels = "aeiou";
+ string kindOf = (*q)->kindOf();
+ if(vowels.find_first_of(kindOf[0]) != string::npos)
+ {
+ msg += "n";
+ }
+ msg += " " + kindOf + " in a base interface or class";
+ _unit->error(msg);
+ return 0;
+ }
+ if(!_unit->caseSensitive())
+ {
+ string baseName = (*q)->name();
+ toLower(baseName);
+ string newName = name;
+ toLower(newName);
+ if(baseName == newName)
+ {
+ string msg = "data member `" + name + "' differs only in capitalization from " + (*q)->kindOf();
+ msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
+ _unit->error(msg);
+ }
+ }
+ }
}
//
@@ -2713,8 +2713,8 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
//
if(!isLocal() && type->isLocal())
{
- string msg = "non-local " + kindOf() + "`" + this->name() + "' cannot contain local member `" + name + "'";
- _unit->error(msg);
+ string msg = "non-local " + kindOf() + "`" + this->name() + "' cannot contain local member `" + name + "'";
+ _unit->error(msg);
}
_hasDataMembers = true;
@@ -2743,9 +2743,9 @@ Slice::ClassDef::allBases() const
result.unique();
for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
- ClassList li = (*p)->allBases();
- result.merge(li);
- result.unique();
+ ClassList li = (*p)->allBases();
+ result.merge(li);
+ result.unique();
}
return result;
}
@@ -2756,11 +2756,11 @@ Slice::ClassDef::operations() const
OperationList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- OperationPtr q = OperationPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ OperationPtr q = OperationPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -2773,9 +2773,9 @@ Slice::ClassDef::allOperations() const
result.unique();
for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
- OperationList li = (*p)->allOperations();
- result.merge(li);
- result.unique();
+ OperationList li = (*p)->allOperations();
+ result.merge(li);
+ result.unique();
}
return result;
}
@@ -2786,11 +2786,11 @@ Slice::ClassDef::dataMembers() const
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -2809,7 +2809,7 @@ Slice::ClassDef::allDataMembers() const
//
if(!_bases.empty() && !_bases.front()->isInterface())
{
- result = _bases.front()->allDataMembers();
+ result = _bases.front()->allDataMembers();
}
//
@@ -2827,15 +2827,15 @@ Slice::ClassDef::classDataMembers() const
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
- {
- result.push_back(q);
- }
- }
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
}
return result;
}
@@ -2854,7 +2854,7 @@ Slice::ClassDef::allClassDataMembers() const
//
if(!_bases.empty() && !_bases.front()->isInterface())
{
- result = _bases.front()->allClassDataMembers();
+ result = _bases.front()->allClassDataMembers();
}
//
@@ -2871,15 +2871,15 @@ Slice::ClassDef::canBeCyclic() const
{
if(!_bases.empty() && !_bases.front()->isInterface() && _bases.front()->canBeCyclic())
{
- return true;
+ return true;
}
DataMemberList dml = dataMembers();
for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
{
- if((*i)->type()->usesClasses())
- {
- return true;
- }
+ if((*i)->type()->usesClasses())
+ {
+ return true;
+ }
}
return false;
}
@@ -2889,20 +2889,20 @@ Slice::ClassDef::isAbstract() const
{
if(isInterface() || _bases.size() > 1) // Is this an interface, or does it derive from interfaces?
{
- return true;
+ return true;
}
if(!_bases.empty() && _bases.front()->isAbstract())
{
- return true;
+ return true;
}
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if(OperationPtr::dynamicCast(*p))
- {
- return true;
- }
+ if(OperationPtr::dynamicCast(*p))
+ {
+ return true;
+ }
}
return false;
@@ -2969,7 +2969,7 @@ Slice::ClassDef::kindOf() const
string s;
if(isLocal())
{
- s += "local ";
+ s += "local ";
}
s += isInterface() ? "interface" : "class";
return s;
@@ -2980,13 +2980,13 @@ Slice::ClassDef::visit(ParserVisitor* visitor, bool all)
{
if(visitor->visitClassDefStart(this))
{
- Container::visit(visitor, all);
- visitor->visitClassDefEnd(this);
+ Container::visit(visitor, all);
+ visitor->visitClassDefEnd(this);
}
}
Slice::ClassDef::ClassDef(const ContainerPtr& container, const string& name, bool intf, const ClassList& bases,
- bool local) :
+ bool local) :
SyntaxTreeBase(container->unit()),
Container(container->unit()),
Contained(container, name),
@@ -3003,7 +3003,7 @@ Slice::ClassDef::ClassDef(const ContainerPtr& container, const string& name, boo
#ifndef NDEBUG
for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
- assert(p == _bases.begin() || (*p)->isInterface());
+ assert(p == _bases.begin() || (*p)->isInterface());
}
#endif
}
@@ -3073,50 +3073,50 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
if(_unit->profile() == IceE)
{
- if(!isLocal())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if((builtin && builtin->kind() == Builtin::KindObject))
- {
- string msg = "Exception data member `" + name + "' cannot be a value object.";
- _unit->error(msg);
- return 0;
- }
-
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
- if(classDecl != 0 && !classDecl->isLocal())
- {
- string msg = "Exception data member `" + name + "' cannot be a value object.";
- _unit->error(msg);
- return 0;
- }
- }
+ if(!isLocal())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if((builtin && builtin->kind() == Builtin::KindObject))
+ {
+ string msg = "Exception data member `" + name + "' cannot be a value object.";
+ _unit->error(msg);
+ return 0;
+ }
+
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
+ if(classDecl != 0 && !classDecl->isLocal())
+ {
+ string msg = "Exception data member `" + name + "' cannot be a value object.";
+ _unit->error(msg);
+ return 0;
+ }
+ }
}
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(!_unit->caseSensitive() && matches.front()->name() != name)
- {
- string msg = "exception member `" + name + "' differs only in capitalization from ";
- msg += "exception member `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
- else
- {
- string msg = "redefinition of exception member `" + name + "'";
- _unit->error(msg);
- return 0;
- }
+ DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
+ {
+ string msg = "exception member `" + name + "' differs only in capitalization from ";
+ msg += "exception member `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
+ else
+ {
+ string msg = "redefinition of exception member `" + name + "'";
+ _unit->error(msg);
+ return 0;
+ }
}
//
@@ -3124,24 +3124,24 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
//
if(name == this->name())
{
- string msg = "exception name `";
- msg += name;
- msg += "' cannot be used as exception member name";
- _unit->error(msg);
- return 0;
+ string msg = "exception name `";
+ msg += name;
+ msg += "' cannot be used as exception member name";
+ _unit->error(msg);
+ return 0;
}
if(!_unit->caseSensitive())
{
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
- {
- string msg = "exception member `" + name + "' differs only in capitalization ";
- msg += "from enclosing exception name `" + this->name() + "'";
- _unit->error(msg);
- }
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "exception member `" + name + "' differs only in capitalization ";
+ msg += "from enclosing exception name `" + this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -3150,31 +3150,31 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
ExceptionList bl = allBases();
for(ExceptionList::const_iterator q = bl.begin(); q != bl.end(); ++q)
{
- ContainedList cl;
- DataMemberList dml = (*q)->dataMembers();
- copy(dml.begin(), dml.end(), back_inserter(cl));
- for(ContainedList::const_iterator r = cl.begin(); r != cl.end(); ++r)
- {
- if((*r)->name() == name)
- {
- string msg = "exception member `" + name + "' is already defined in a base exception";
- _unit->error(msg);
- return 0;
- }
- if(!_unit->caseSensitive())
- {
- string baseName = (*r)->name();
- toLower(baseName);
- string newName = name;
- toLower(newName);
- if(baseName == newName)
- {
- string msg = "exception member `" + name + "' differs only in capitalization from exception member `";
- msg += (*r)->name() + "', which is defined in a base exception";
- _unit->error(msg);
- }
- }
- }
+ ContainedList cl;
+ DataMemberList dml = (*q)->dataMembers();
+ copy(dml.begin(), dml.end(), back_inserter(cl));
+ for(ContainedList::const_iterator r = cl.begin(); r != cl.end(); ++r)
+ {
+ if((*r)->name() == name)
+ {
+ string msg = "exception member `" + name + "' is already defined in a base exception";
+ _unit->error(msg);
+ return 0;
+ }
+ if(!_unit->caseSensitive())
+ {
+ string baseName = (*r)->name();
+ toLower(baseName);
+ string newName = name;
+ toLower(newName);
+ if(baseName == newName)
+ {
+ string msg = "exception member `" + name + "' differs only in capitalization from exception member `";
+ msg += (*r)->name() + "', which is defined in a base exception";
+ _unit->error(msg);
+ }
+ }
+ }
}
//
@@ -3182,8 +3182,8 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
//
if(!isLocal() && type->isLocal())
{
- string msg = "non-local " + kindOf() + "`" + this->name() + "' cannot contain local member `" + name + "'";
- _unit->error(msg);
+ string msg = "non-local " + kindOf() + "`" + this->name() + "' cannot contain local member `" + name + "'";
+ _unit->error(msg);
}
DataMemberPtr p = new DataMember(this, name, type);
@@ -3197,11 +3197,11 @@ Slice::Exception::dataMembers() const
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -3220,7 +3220,7 @@ Slice::Exception::allDataMembers() const
//
if(base())
{
- result = base()->allDataMembers();
+ result = base()->allDataMembers();
}
//
@@ -3238,15 +3238,15 @@ Slice::Exception::classDataMembers() const
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
- {
- result.push_back(q);
- }
- }
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
}
return result;
}
@@ -3265,7 +3265,7 @@ Slice::Exception::allClassDataMembers() const
//
if(base())
{
- result = base()->allClassDataMembers();
+ result = base()->allClassDataMembers();
}
//
@@ -3289,8 +3289,8 @@ Slice::Exception::allBases() const
ExceptionList result;
if(_base)
{
- result = _base->allBases();
- result.push_front(_base);
+ result = _base->allBases();
+ result.push_front(_base);
}
return result;
}
@@ -3300,15 +3300,15 @@ Slice::Exception::isBaseOf(const ExceptionPtr& other) const
{
if(this->scoped() == other->scoped())
{
- return false;
+ return false;
}
ExceptionList bases = other->allBases();
for(ExceptionList::const_iterator i = bases.begin(); i != bases.end(); ++i)
{
- if((*i)->scoped() == scoped())
- {
- return true;
- }
+ if((*i)->scoped() == scoped())
+ {
+ return true;
+ }
}
return false;
}
@@ -3338,14 +3338,14 @@ Slice::Exception::usesClasses() const
DataMemberList dml = dataMembers();
for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
{
- if((*i)->type()->usesClasses())
- {
- return true;
- }
+ if((*i)->type()->usesClasses())
+ {
+ return true;
+ }
}
if(_base)
{
- return _base->usesClasses();
+ return _base->usesClasses();
}
return false;
}
@@ -3361,8 +3361,8 @@ Slice::Exception::visit(ParserVisitor* visitor, bool all)
{
if(visitor->visitExceptionStart(this))
{
- Container::visit(visitor, all);
- visitor->visitExceptionEnd(this);
+ Container::visit(visitor, all);
+ visitor->visitExceptionEnd(this);
}
}
@@ -3386,49 +3386,49 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
if(_unit->profile() == IceE)
{
- if(!isLocal())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if((builtin && builtin->kind() == Builtin::KindObject))
- {
- string msg = "Struct data member `" + name + "' cannot be a value object.";
- _unit->error(msg);
- return 0;
- }
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
- if(classDecl != 0 && !classDecl->isLocal())
- {
- string msg = "Struct data member `" + name + "' cannot be a value object.";
- _unit->error(msg);
- return 0;
- }
- }
+ if(!isLocal())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if((builtin && builtin->kind() == Builtin::KindObject))
+ {
+ string msg = "Struct data member `" + name + "' cannot be a value object.";
+ _unit->error(msg);
+ return 0;
+ }
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
+ if(classDecl != 0 && !classDecl->isLocal())
+ {
+ string msg = "Struct data member `" + name + "' cannot be a value object.";
+ _unit->error(msg);
+ return 0;
+ }
+ }
}
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(!_unit->caseSensitive() && matches.front()->name() != name)
- {
- string msg = "member `" + name + "' differs only in capitalization from ";
- msg += "member `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
- else
- {
- string msg = "redefinition of struct member `" + name + "'";
- _unit->error(msg);
- return 0;
- }
+ DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
+ {
+ string msg = "member `" + name + "' differs only in capitalization from ";
+ msg += "member `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
+ else
+ {
+ string msg = "redefinition of struct member `" + name + "'";
+ _unit->error(msg);
+ return 0;
+ }
}
//
@@ -3436,24 +3436,24 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
//
if(name == this->name())
{
- string msg = "struct name `";
- msg += name;
- msg += "' cannot be used as member name";
- _unit->error(msg);
- return 0;
+ string msg = "struct name `";
+ msg += name;
+ msg += "' cannot be used as member name";
+ _unit->error(msg);
+ return 0;
}
if(!_unit->caseSensitive())
{
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
- {
- string msg = "struct member `" + name + "' differs only in capitalization from enclosing struct name `";
- msg += this->name() + "'";
- _unit->error(msg);
- }
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "struct member `" + name + "' differs only in capitalization from enclosing struct name `";
+ msg += this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -3461,11 +3461,11 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
//
if(type.get() == this)
{
- string msg = "struct `";
- msg += this->name();
- msg += "' cannot contain itself";
- _unit->error(msg);
- return 0;
+ string msg = "struct `";
+ msg += this->name();
+ msg += "' cannot contain itself";
+ _unit->error(msg);
+ return 0;
}
//
@@ -3473,8 +3473,8 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
//
if(!isLocal() && type->isLocal())
{
- string msg = "non-local " + kindOf() + "`" + this->name() + "' cannot contain local member `" + name + "'";
- _unit->error(msg);
+ string msg = "non-local " + kindOf() + "`" + this->name() + "' cannot contain local member `" + name + "'";
+ _unit->error(msg);
}
DataMemberPtr p = new DataMember(this, name, type);
@@ -3488,11 +3488,11 @@ Slice::Struct::dataMembers() const
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -3503,15 +3503,15 @@ Slice::Struct::classDataMembers() const
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
- {
- result.push_back(q);
- }
- }
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
}
return result;
}
@@ -3533,15 +3533,15 @@ Slice::Struct::usesClasses() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
- {
- TypePtr t = q->type();
- if(t->usesClasses())
- {
- return true;
- }
- }
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ TypePtr t = q->type();
+ if(t->usesClasses())
+ {
+ return true;
+ }
+ }
}
return false;
}
@@ -3556,7 +3556,7 @@ Slice::Struct::minWireSize() const
DataMemberList dml = dataMembers();
for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
{
- sz += (*i)->type()->minWireSize();
+ sz += (*i)->type()->minWireSize();
}
return sz;
}
@@ -3567,10 +3567,10 @@ Slice::Struct::isVariableLength() const
DataMemberList dml = dataMembers();
for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
{
- if((*i)->type()->isVariableLength())
- {
- return true;
- }
+ if((*i)->type()->isVariableLength())
+ {
+ return true;
+ }
}
return false;
}
@@ -3586,8 +3586,8 @@ Slice::Struct::visit(ParserVisitor* visitor, bool all)
{
if(visitor->visitStructStart(this))
{
- Container::visit(visitor, all);
- visitor->visitStructEnd(this);
+ Container::visit(visitor, all);
+ visitor->visitStructEnd(this);
}
}
@@ -3634,7 +3634,7 @@ Slice::Sequence::uses(const ContainedPtr& contained) const
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
if(contained2 && contained2 == contained)
{
- return true;
+ return true;
}
return false;
@@ -3676,13 +3676,13 @@ Slice::Sequence::recDependencies(set<ConstructedPtr>& dependencies)
ConstructedPtr constructed = ConstructedPtr::dynamicCast(_type);
if(constructed && dependencies.find(constructed) != dependencies.end())
{
- dependencies.insert(constructed);
- constructed->recDependencies(dependencies);
+ dependencies.insert(constructed);
+ constructed->recDependencies(dependencies);
}
}
Slice::Sequence::Sequence(const ContainerPtr& container, const string& name, const TypePtr& type,
- const StringList& typeMetaData, bool local) :
+ const StringList& typeMetaData, bool local) :
SyntaxTreeBase(container->unit()),
Type(container->unit()),
Contained(container, name),
@@ -3730,19 +3730,19 @@ bool
Slice::Dictionary::uses(const ContainedPtr& contained) const
{
{
- ContainedPtr contained2 = ContainedPtr::dynamicCast(_keyType);
- if(contained2 && contained2 == contained)
- {
- return true;
- }
+ ContainedPtr contained2 = ContainedPtr::dynamicCast(_keyType);
+ if(contained2 && contained2 == contained)
+ {
+ return true;
+ }
}
{
- ContainedPtr contained2 = ContainedPtr::dynamicCast(_valueType);
- if(contained2 && contained2 == contained)
- {
- return true;
- }
+ ContainedPtr contained2 = ContainedPtr::dynamicCast(_valueType);
+ if(contained2 && contained2 == contained)
+ {
+ return true;
+ }
}
return false;
@@ -3782,21 +3782,21 @@ void
Slice::Dictionary::recDependencies(set<ConstructedPtr>& dependencies)
{
{
- ConstructedPtr constructed = ConstructedPtr::dynamicCast(_keyType);
- if(constructed && dependencies.find(constructed) != dependencies.end())
- {
- dependencies.insert(constructed);
- constructed->recDependencies(dependencies);
- }
+ ConstructedPtr constructed = ConstructedPtr::dynamicCast(_keyType);
+ if(constructed && dependencies.find(constructed) != dependencies.end())
+ {
+ dependencies.insert(constructed);
+ constructed->recDependencies(dependencies);
+ }
}
{
- ConstructedPtr constructed = ConstructedPtr::dynamicCast(_valueType);
- if(constructed && dependencies.find(constructed) != dependencies.end())
- {
- dependencies.insert(constructed);
- constructed->recDependencies(dependencies);
- }
+ ConstructedPtr constructed = ConstructedPtr::dynamicCast(_valueType);
+ if(constructed && dependencies.find(constructed) != dependencies.end())
+ {
+ dependencies.insert(constructed);
+ constructed->recDependencies(dependencies);
+ }
}
}
@@ -3811,63 +3811,63 @@ Slice::Dictionary::legalKeyType(const TypePtr& type)
BuiltinPtr bp = BuiltinPtr::dynamicCast(type);
if(bp)
{
- switch(bp->kind())
- {
- case Builtin::KindByte:
- case Builtin::KindBool:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- case Builtin::KindString:
- {
- return true;
- break;
- }
-
- case Builtin::KindFloat:
- case Builtin::KindDouble:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- {
- return false;
- break;
- }
- }
+ switch(bp->kind())
+ {
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindString:
+ {
+ return true;
+ break;
+ }
+
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ return false;
+ break;
+ }
+ }
}
EnumPtr ep = EnumPtr::dynamicCast(type);
if(ep)
{
- return true;
+ return true;
}
SequencePtr seqp = SequencePtr::dynamicCast(type);
if(seqp && legalKeyType(seqp->type()))
{
- return true;
+ return true;
}
StructPtr strp = StructPtr::dynamicCast(type);
if(strp)
{
- DataMemberList dml = strp->dataMembers();
- for(DataMemberList::const_iterator mem = dml.begin(); mem != dml.end(); ++mem)
- {
- if(!legalKeyType((*mem)->type()))
- {
- return false;
- }
- }
- return true;
+ DataMemberList dml = strp->dataMembers();
+ for(DataMemberList::const_iterator mem = dml.begin(); mem != dml.end(); ++mem)
+ {
+ if(!legalKeyType((*mem)->type()))
+ {
+ return false;
+ }
+ }
+ return true;
}
return false;
}
Slice::Dictionary::Dictionary(const ContainerPtr& container, const string& name, const TypePtr& keyType,
- const StringList& keyMetaData, const TypePtr& valueType,
- const StringList& valueMetaData, bool local) :
+ const StringList& keyMetaData, const TypePtr& valueType,
+ const StringList& valueMetaData, bool local) :
SyntaxTreeBase(container->unit()),
Type(container->unit()),
Contained(container, name),
@@ -3930,11 +3930,11 @@ Slice::Enum::minWireSize() const
size_t sz = _enumerators.size();
if(sz <= 0x7f)
{
- return 1;
+ return 1;
}
if(sz <= 0x7fff)
{
- return 2;
+ return 2;
}
return 4;
}
@@ -4057,50 +4057,50 @@ Slice::Const::isLegalType(const string& name, const TypePtr& constType, const Un
{
if(constType == 0)
{
- return false;
+ return false;
}
BuiltinPtr ct = BuiltinPtr::dynamicCast(constType);
if(ct)
{
- switch(ct->kind())
- {
- case Builtin::KindBool:
- case Builtin::KindByte:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- case Builtin::KindFloat:
- case Builtin::KindDouble:
- case Builtin::KindString:
- {
- return true;
- break;
- }
- default:
- {
- string msg = "constant `" + name + "' has illegal type: `" + ct->kindAsString() + "'";
- unit->error(msg);
- return false;
- break;
- }
- }
+ switch(ct->kind())
+ {
+ case Builtin::KindBool:
+ case Builtin::KindByte:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ case Builtin::KindString:
+ {
+ return true;
+ break;
+ }
+ default:
+ {
+ string msg = "constant `" + name + "' has illegal type: `" + ct->kindAsString() + "'";
+ unit->error(msg);
+ return false;
+ break;
+ }
+ }
}
EnumPtr ep = EnumPtr::dynamicCast(constType);
if(!ep)
{
- string msg = "constant `" + name + "' has illegal type";
- unit->error(msg);
- return false;
+ string msg = "constant `" + name + "' has illegal type";
+ unit->error(msg);
+ return false;
}
return true;
}
bool
Slice::Const::typesAreCompatible(const string& name, const TypePtr& constType,
- const SyntaxTreeBasePtr& literalType, const string& value,
- const UnitPtr& unit)
+ const SyntaxTreeBasePtr& literalType, const string& value,
+ const UnitPtr& unit)
{
BuiltinPtr ct = BuiltinPtr::dynamicCast(constType);
@@ -4114,66 +4114,66 @@ Slice::Const::typesAreCompatible(const string& name, const TypePtr& constType,
if(ct && lt)
{
- switch(ct->kind())
- {
- case Builtin::KindBool:
- {
- if(lt->kind() == Builtin::KindBool)
- {
- return true;
- }
- break;
- }
- case Builtin::KindByte:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- {
- if(lt->kind() == Builtin::KindLong)
- {
- return true;
- }
- break;
- }
- case Builtin::KindFloat:
- case Builtin::KindDouble:
- {
- if(lt->kind() == Builtin::KindDouble)
- {
- return true;
- }
- break;
- }
- case Builtin::KindString:
- {
- if(lt->kind() == Builtin::KindString)
- {
- return true;
- }
- break;
- }
-
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- {
- assert(false);
- break;
- }
- }
-
- string msg = "initializer of type `" + lt->kindAsString();
- msg += "' is incompatible with the type `" + ct->kindAsString() + "' of constant `" + name + "'";
- unit->error(msg);
- return false;
+ switch(ct->kind())
+ {
+ case Builtin::KindBool:
+ {
+ if(lt->kind() == Builtin::KindBool)
+ {
+ return true;
+ }
+ break;
+ }
+ case Builtin::KindByte:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ {
+ if(lt->kind() == Builtin::KindLong)
+ {
+ return true;
+ }
+ break;
+ }
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ {
+ if(lt->kind() == Builtin::KindDouble)
+ {
+ return true;
+ }
+ break;
+ }
+ case Builtin::KindString:
+ {
+ if(lt->kind() == Builtin::KindString)
+ {
+ return true;
+ }
+ break;
+ }
+
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ string msg = "initializer of type `" + lt->kindAsString();
+ msg += "' is incompatible with the type `" + ct->kindAsString() + "' of constant `" + name + "'";
+ unit->error(msg);
+ return false;
}
if(ct && !lt)
{
- string msg = "type of initializer is incompatible with the type `" + ct->kindAsString();
- msg += "' of constant `" + name + "'";
- unit->error(msg);
- return false;
+ string msg = "type of initializer is incompatible with the type `" + ct->kindAsString();
+ msg += "' of constant `" + name + "'";
+ unit->error(msg);
+ return false;
}
EnumPtr enumP = EnumPtr::dynamicCast(constType);
@@ -4181,76 +4181,76 @@ Slice::Const::typesAreCompatible(const string& name, const TypePtr& constType,
EnumeratorPtr enumeratorP = EnumeratorPtr::dynamicCast(literalType);
if(!enumeratorP)
{
- string msg = "type of initializer is incompatible with the type of constant `" + name + "'";
- unit->error(msg);
- return false;
+ string msg = "type of initializer is incompatible with the type of constant `" + name + "'";
+ unit->error(msg);
+ return false;
}
EnumeratorList elist = enumP->getEnumerators();
if(find(elist.begin(), elist.end(), enumeratorP) == elist.end())
{
- string msg = "enumerator `" + value + "' is not defined in enumeration `" + enumP->scoped() + "'";
- unit->error(msg);
- return false;
+ string msg = "enumerator `" + value + "' is not defined in enumeration `" + enumP->scoped() + "'";
+ unit->error(msg);
+ return false;
}
return true;
}
bool
Slice::Const::isInRange(const string& name, const TypePtr& constType, const string& value,
- const UnitPtr& unit)
+ const UnitPtr& unit)
{
BuiltinPtr ct = BuiltinPtr::dynamicCast(constType);
if (!ct)
{
- return true; // Enums are checked elsewhere.
+ return true; // Enums are checked elsewhere.
}
switch(ct->kind())
{
- case Builtin::KindByte:
- {
- IceUtil::Int64 l = IceUtil::strToInt64(value.c_str(), 0, 0);
- if(l < ByteMin || l > ByteMax)
- {
- string msg = "initializer `" + value + "' for constant `" + name + "' out of range for type byte";
- unit->error(msg);
- return false;
- }
- break;
- }
- case Builtin::KindShort:
- {
- IceUtil::Int64 l = IceUtil::strToInt64(value.c_str(), 0, 0);
- if(l < Int16Min || l > Int16Max)
- {
- string msg = "initializer `" + value + "' for constant `" + name + "' out of range for type short";
- unit->error(msg);
- return false;
- }
- break;
- }
- case Builtin::KindInt:
- {
- IceUtil::Int64 l = IceUtil::strToInt64(value.c_str(), 0, 0);
- if(l < Int32Min || l > Int32Max)
- {
- string msg = "initializer `" + value + "' for constant `" + name + "' out of range for type int";
- unit->error(msg);
- return false;
- }
- break;
- }
-
- default:
- {
- break;
- }
+ case Builtin::KindByte:
+ {
+ IceUtil::Int64 l = IceUtil::strToInt64(value.c_str(), 0, 0);
+ if(l < ByteMin || l > ByteMax)
+ {
+ string msg = "initializer `" + value + "' for constant `" + name + "' out of range for type byte";
+ unit->error(msg);
+ return false;
+ }
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ IceUtil::Int64 l = IceUtil::strToInt64(value.c_str(), 0, 0);
+ if(l < Int16Min || l > Int16Max)
+ {
+ string msg = "initializer `" + value + "' for constant `" + name + "' out of range for type short";
+ unit->error(msg);
+ return false;
+ }
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ IceUtil::Int64 l = IceUtil::strToInt64(value.c_str(), 0, 0);
+ if(l < Int32Min || l > Int32Max)
+ {
+ string msg = "initializer `" + value + "' for constant `" + name + "' out of range for type int";
+ unit->error(msg);
+ return false;
+ }
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
}
return true; // Everything else is either in range or doesn't need checking.
}
Slice::Const::Const(const ContainerPtr& container, const string& name, const TypePtr& type,
- const StringList& typeMetaData, const string& value) :
+ const StringList& typeMetaData, const string& value) :
SyntaxTreeBase(container->unit()),
Contained(container, name),
_type(type),
@@ -4280,11 +4280,11 @@ Slice::Operation::sendMode() const
{
if(_mode == Operation::Idempotent && hasMetaData("nonmutating"))
{
- return Operation::Nonmutating;
+ return Operation::Nonmutating;
}
else
{
- return _mode;
+ return _mode;
}
}
@@ -4295,51 +4295,51 @@ Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool
if(_unit->profile() == IceE)
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(this->container());
- assert(cl);
- if(!cl->isLocal())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if((builtin && builtin->kind() == Builtin::KindObject))
- {
- string msg = "Object `" + name + "' cannot be passed by value.";
- _unit->error(msg);
- return 0;
- }
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
- if(classDecl != 0 && !classDecl->isLocal())
- {
- string msg = "Object `" + name + "' cannot be passed by value.";
- _unit->error(msg);
- return 0;
- }
- }
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(this->container());
+ assert(cl);
+ if(!cl->isLocal())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if((builtin && builtin->kind() == Builtin::KindObject))
+ {
+ string msg = "Object `" + name + "' cannot be passed by value.";
+ _unit->error(msg);
+ return 0;
+ }
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
+ if(classDecl != 0 && !classDecl->isLocal())
+ {
+ string msg = "Object `" + name + "' cannot be passed by value.";
+ _unit->error(msg);
+ return 0;
+ }
+ }
}
ContainedList matches = _unit->findContents(thisScope() + name);
if(!matches.empty())
{
- ParamDeclPtr p = ParamDeclPtr::dynamicCast(matches.front());
- if(p)
- {
- if(_unit->ignRedefs())
- {
- p->updateIncludeLevel();
- return p;
- }
- }
- if(!_unit->caseSensitive() && matches.front()->name() != name)
- {
- string msg = "parameter `" + name + "' differs only in capitalization from ";
- msg += "parameter `" + matches.front()->name() + "'";
- _unit->error(msg);
- }
- else
- {
- string msg = "redefinition of parameter `" + name + "'";
- _unit->error(msg);
- return 0;
- }
+ ParamDeclPtr p = ParamDeclPtr::dynamicCast(matches.front());
+ if(p)
+ {
+ if(_unit->ignRedefs())
+ {
+ p->updateIncludeLevel();
+ return p;
+ }
+ }
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
+ {
+ string msg = "parameter `" + name + "' differs only in capitalization from ";
+ msg += "parameter `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
+ else
+ {
+ string msg = "redefinition of parameter `" + name + "'";
+ _unit->error(msg);
+ return 0;
+ }
}
//
@@ -4347,24 +4347,24 @@ Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool
//
if(name == this->name())
{
- string msg = "operation name `";
- msg += name;
- msg += "' cannot be used as parameter name";
- _unit->error(msg);
- return 0;
+ string msg = "operation name `";
+ msg += name;
+ msg += "' cannot be used as parameter name";
+ _unit->error(msg);
+ return 0;
}
if(!_unit->caseSensitive())
{
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
- {
- string msg = "parameter `" + name + "' differs only in capitalization from operation name `";
- msg += this->name() + "'";
- _unit->error(msg);
- }
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "parameter `" + name + "' differs only in capitalization from operation name `";
+ msg += this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -4372,12 +4372,12 @@ Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool
//
if(!_contents.empty())
{
- ParamDeclPtr p = ParamDeclPtr::dynamicCast(_contents.back());
- assert(p);
- if(p->isOutParam() && !isOutParam)
- {
- _unit->error("`" + name + "': in parameters cannot follow out parameters");
- }
+ ParamDeclPtr p = ParamDeclPtr::dynamicCast(_contents.back());
+ assert(p);
+ if(p->isOutParam() && !isOutParam)
+ {
+ _unit->error("`" + name + "': in parameters cannot follow out parameters");
+ }
}
//
@@ -4387,9 +4387,9 @@ Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool
assert(cl);
if(type->isLocal() && !cl->isLocal())
{
- string msg = "non-local " + cl->kindOf() + " `" + cl->name() + "' cannot have local parameter `";
- msg += name + "' in operation `" + this->name() + "'";
- _unit->error(msg);
+ string msg = "non-local " + cl->kindOf() + " `" + cl->name() + "' cannot have local parameter `";
+ msg += name + "' in operation `" + this->name() + "'";
+ _unit->error(msg);
}
ParamDeclPtr p = new ParamDecl(this, name, type, isOutParam);
@@ -4403,11 +4403,11 @@ Slice::Operation::parameters() const
ParamDeclList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ParamDeclPtr q = ParamDeclPtr::dynamicCast(*p);
- if(q)
- {
- result.push_back(q);
- }
+ ParamDeclPtr q = ParamDeclPtr::dynamicCast(*p);
+ if(q)
+ {
+ result.push_back(q);
+ }
}
return result;
}
@@ -4431,32 +4431,32 @@ Slice::Operation::setExceptionList(const ExceptionList& el)
uniqueExceptions.unique();
if(uniqueExceptions.size() != el.size())
{
- //
- // At least one exception appears twice.
- //
- ExceptionList tmp = el;
- tmp.sort();
- ExceptionList duplicates;
- set_difference(tmp.begin(), tmp.end(),
- uniqueExceptions.begin(), uniqueExceptions.end(),
- back_inserter(duplicates));
- string msg = "operation `" + name() + "' has a throws clause with ";
- if(duplicates.size() == 1)
- {
- msg += "a ";
- }
- msg += "duplicate exception";
- if(duplicates.size() > 1)
- {
- msg += "s";
- }
- ExceptionList::const_iterator i = duplicates.begin();
- msg += ": `" + (*i)->name() + "'";
- for(i = ++i; i != duplicates.end(); ++i)
- {
- msg += ", `" + (*i)->name() + "'";
- }
- _unit->error(msg);
+ //
+ // At least one exception appears twice.
+ //
+ ExceptionList tmp = el;
+ tmp.sort();
+ ExceptionList duplicates;
+ set_difference(tmp.begin(), tmp.end(),
+ uniqueExceptions.begin(), uniqueExceptions.end(),
+ back_inserter(duplicates));
+ string msg = "operation `" + name() + "' has a throws clause with ";
+ if(duplicates.size() == 1)
+ {
+ msg += "a ";
+ }
+ msg += "duplicate exception";
+ if(duplicates.size() > 1)
+ {
+ msg += "s";
+ }
+ ExceptionList::const_iterator i = duplicates.begin();
+ msg += ": `" + (*i)->name() + "'";
+ for(i = ++i; i != duplicates.end(); ++i)
+ {
+ msg += ", `" + (*i)->name() + "'";
+ }
+ _unit->error(msg);
}
//
@@ -4466,15 +4466,15 @@ Slice::Operation::setExceptionList(const ExceptionList& el)
assert(cl);
if(!cl->isLocal())
{
- for(ExceptionList::const_iterator ep = el.begin(); ep != el.end(); ++ep)
- {
- if((*ep)->isLocal())
- {
- string msg = "non-local " + cl->kindOf() + " `" + cl->name() + "' cannot have operation `";
- msg += name() + "' throwing local exception `" + (*ep)->name() + "'";
- _unit->error(msg);
- }
- }
+ for(ExceptionList::const_iterator ep = el.begin(); ep != el.end(); ++ep)
+ {
+ if((*ep)->isLocal())
+ {
+ string msg = "non-local " + cl->kindOf() + " `" + cl->name() + "' cannot have operation `";
+ msg += name() + "' throwing local exception `" + (*ep)->name() + "'";
+ _unit->error(msg);
+ }
+ }
}
}
@@ -4488,22 +4488,22 @@ bool
Slice::Operation::uses(const ContainedPtr& contained) const
{
{
- ContainedPtr contained2 = ContainedPtr::dynamicCast(_returnType);
- if(contained2 && contained2 == contained)
- {
- return true;
- }
+ ContainedPtr contained2 = ContainedPtr::dynamicCast(_returnType);
+ if(contained2 && contained2 == contained)
+ {
+ return true;
+ }
}
ExceptionList::const_iterator q;
for(q = _throws.begin(); q != _throws.end(); ++q)
{
- ContainedPtr contained2 = ContainedPtr::dynamicCast(*q);
- if(contained2 && contained2 == contained)
- {
- return true;
- }
+ ContainedPtr contained2 = ContainedPtr::dynamicCast(*q);
+ if(contained2 && contained2 == contained)
+ {
+ return true;
+ }
}
return false;
@@ -4515,10 +4515,10 @@ Slice::Operation::sendsClasses() const
ParamDeclList pdl = parameters();
for(ParamDeclList::const_iterator i = pdl.begin(); i != pdl.end(); ++i)
{
- if(!(*i)->isOutParam() && (*i)->type()->usesClasses())
- {
- return true;
- }
+ if(!(*i)->isOutParam() && (*i)->type()->usesClasses())
+ {
+ return true;
+ }
}
return false;
}
@@ -4529,15 +4529,15 @@ Slice::Operation::returnsClasses() const
TypePtr t = returnType();
if(t && t->usesClasses())
{
- return true;
+ return true;
}
ParamDeclList pdl = parameters();
for(ParamDeclList::const_iterator i = pdl.begin(); i != pdl.end(); ++i)
{
- if((*i)->isOutParam() && (*i)->type()->usesClasses())
- {
- return true;
- }
+ if((*i)->isOutParam() && (*i)->type()->usesClasses())
+ {
+ return true;
+ }
}
return false;
}
@@ -4548,15 +4548,15 @@ Slice::Operation::returnsData() const
TypePtr t = returnType();
if(t)
{
- return true;
+ return true;
}
ParamDeclList pdl = parameters();
for(ParamDeclList::const_iterator i = pdl.begin(); i != pdl.end(); ++i)
{
- if((*i)->isOutParam())
- {
- return true;
- }
+ if((*i)->isOutParam())
+ {
+ return true;
+ }
}
if(!throws().empty())
{
@@ -4578,9 +4578,9 @@ Slice::Operation::visit(ParserVisitor* visitor, bool)
}
Slice::Operation::Operation(const ContainerPtr& container,
- const string& name,
- const TypePtr& returnType,
- Mode mode) :
+ const string& name,
+ const TypePtr& returnType,
+ Mode mode) :
SyntaxTreeBase(container->unit()),
Contained(container, name),
Container(container->unit()),
@@ -4589,23 +4589,23 @@ Slice::Operation::Operation(const ContainerPtr& container,
{
if(_unit->profile() == IceE)
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(this->container());
- assert(cl);
- if(!cl->isLocal())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(returnType);
- if((builtin && builtin->kind() == Builtin::KindObject))
- {
- string msg = "Method `" + name + "' cannot return an object by value.";
- _unit->error(msg);
- }
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(returnType);
- if(classDecl != 0 && !classDecl->isLocal())
- {
- string msg = "Method `" + name + "' cannot return an object by value.";
- _unit->error(msg);
- }
- }
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(this->container());
+ assert(cl);
+ if(!cl->isLocal())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(returnType);
+ if((builtin && builtin->kind() == Builtin::KindObject))
+ {
+ string msg = "Method `" + name + "' cannot return an object by value.";
+ _unit->error(msg);
+ }
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(returnType);
+ if(classDecl != 0 && !classDecl->isLocal())
+ {
+ string msg = "Method `" + name + "' cannot return an object by value.";
+ _unit->error(msg);
+ }
+ }
}
}
@@ -4637,7 +4637,7 @@ Slice::ParamDecl::uses(const ContainedPtr& contained) const
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
if(contained2 && contained2 == contained)
{
- return true;
+ return true;
}
return false;
@@ -4685,7 +4685,7 @@ Slice::DataMember::uses(const ContainedPtr& contained) const
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
if(contained2 && contained2 == contained)
{
- return true;
+ return true;
}
return false;
@@ -4716,7 +4716,7 @@ Slice::DataMember::DataMember(const ContainerPtr& container, const string& name,
UnitPtr
Slice::Unit::createUnit(bool ignRedefs, bool all, bool allowIcePrefix, bool caseSensitive,
- const StringList& defaultGlobalMetadata)
+ const StringList& defaultGlobalMetadata)
{
return new Unit(ignRedefs, all, allowIcePrefix, caseSensitive, defaultGlobalMetadata);
}
@@ -4746,32 +4746,32 @@ Slice::Unit::setComment(const string& comment)
string::size_type end = 0;
while(true)
{
- string::size_type begin = comment.find_first_not_of(" \t\r\n*", end);
- if(begin == string::npos)
- {
- break;
- }
-
- end = comment.find('\n', begin);
- if(end != string::npos)
- {
- if(end + 1 > begin)
- {
- _currentComment += comment.substr(begin, end + 1 - begin);
- }
- }
- else
- {
- end = comment.find_last_not_of(" \t\r\n*");
- if(end != string::npos)
- {
- if(end + 1 > begin)
- {
- _currentComment += comment.substr(begin, end + 1 - begin);
- }
- }
- break;
- }
+ string::size_type begin = comment.find_first_not_of(" \t\r\n*", end);
+ if(begin == string::npos)
+ {
+ break;
+ }
+
+ end = comment.find('\n', begin);
+ if(end != string::npos)
+ {
+ if(end + 1 > begin)
+ {
+ _currentComment += comment.substr(begin, end + 1 - begin);
+ }
+ }
+ else
+ {
+ end = comment.find_last_not_of(" \t\r\n*");
+ if(end != string::npos)
+ {
+ if(end + 1 > begin)
+ {
+ _currentComment += comment.substr(begin, end + 1 - begin);
+ }
+ }
+ break;
+ }
}
}
@@ -4814,12 +4814,12 @@ Slice::Unit::scanPosition(const char* s)
{
assert(*s == '#');
- string line(s + 1); // Skip leading #
+ string line(s + 1); // Skip leading #
eraseWhiteSpace(line);
- if(line.find("line", 0) == 0) // Erase optional "line"
+ if(line.find("line", 0) == 0) // Erase optional "line"
{
line.erase(0, 4);
- eraseWhiteSpace(line);
+ eraseWhiteSpace(line);
}
string::size_type idx;
@@ -4829,7 +4829,7 @@ Slice::Unit::scanPosition(const char* s)
idx = line.find_first_of(" \t\r"); // Erase line number
if(idx != string::npos)
{
- line.erase(0, idx);
+ line.erase(0, idx);
}
eraseWhiteSpace(line);
@@ -4843,71 +4843,71 @@ Slice::Unit::scanPosition(const char* s)
idx = line.find_last_of(" \t\r");
if(idx != string::npos)
{
- ++idx;
- if(line.substr(idx) == "1")
- {
- type = Push;
- line.erase(idx);
- eraseWhiteSpace(line);
+ ++idx;
+ if(line.substr(idx) == "1")
+ {
+ type = Push;
+ line.erase(idx);
+ eraseWhiteSpace(line);
- }
- else if(line.substr(idx) == "2")
- {
- type = Pop;
- line.erase(idx);
- eraseWhiteSpace(line);
- }
+ }
+ else if(line.substr(idx) == "2")
+ {
+ type = Pop;
+ line.erase(idx);
+ eraseWhiteSpace(line);
+ }
}
string currentFile;
if(!line.empty())
{
- if(line[0] == '"')
- {
- idx = line.rfind('"');
- if(idx != string::npos)
- {
- currentFile = line.substr(1, idx - 1);
- }
- }
- else
- {
- currentFile = line;
- }
+ if(line[0] == '"')
+ {
+ idx = line.rfind('"');
+ if(idx != string::npos)
+ {
+ currentFile = line.substr(1, idx - 1);
+ }
+ }
+ else
+ {
+ currentFile = line;
+ }
}
switch(type)
{
- case Push:
- {
- if(++_currentIncludeLevel == 1)
- {
- if(find(_includeFiles.begin(), _includeFiles.end(), currentFile) == _includeFiles.end())
- {
- _includeFiles.push_back(currentFile);
- }
- }
- pushDefinitionContext();
- _currentComment = "";
- break;
- }
- case Pop:
- {
- --_currentIncludeLevel;
- popDefinitionContext();
- _currentComment = "";
- break;
- }
+ case Push:
+ {
+ if(++_currentIncludeLevel == 1)
+ {
+ if(find(_includeFiles.begin(), _includeFiles.end(), currentFile) == _includeFiles.end())
+ {
+ _includeFiles.push_back(currentFile);
+ }
+ }
+ pushDefinitionContext();
+ _currentComment = "";
+ break;
+ }
+ case Pop:
+ {
+ --_currentIncludeLevel;
+ popDefinitionContext();
+ _currentComment = "";
+ break;
+ }
default:
- {
- break; // Do nothing
- }
+ {
+ break; // Do nothing
+ }
}
if(!currentFile.empty())
{
- DefinitionContextPtr dc = currentDefinitionContext();
- assert(dc);
- dc->setFilename(currentFile);
+ DefinitionContextPtr dc = currentDefinitionContext();
+ assert(dc);
+ dc->setFilename(currentFile);
}
}
@@ -4916,11 +4916,11 @@ Slice::Unit::currentIncludeLevel() const
{
if(_all)
{
- return 0;
+ return 0;
}
else
{
- return _currentIncludeLevel;
+ return _currentIncludeLevel;
}
}
@@ -4935,8 +4935,8 @@ Slice::Unit::addGlobalMetaData(const StringList& metaData)
}
else
{
- StringList l = dc->getMetaData();
- copy(metaData.begin(), metaData.end(), back_inserter(l));
+ StringList l = dc->getMetaData();
+ copy(metaData.begin(), metaData.end(), back_inserter(l));
dc->setMetaData(l);
}
}
@@ -5034,7 +5034,7 @@ Slice::Unit::addContent(const ContainedPtr& contained)
string scoped = contained->scoped();
if(!caseSensitive())
{
- toLower(scoped);
+ toLower(scoped);
}
_contentMap[scoped].push_back(contained);
}
@@ -5045,18 +5045,18 @@ Slice::Unit::removeContent(const ContainedPtr& contained)
string scoped = contained->scoped();
if(!caseSensitive())
{
- toLower(scoped);
+ toLower(scoped);
}
map<string, ContainedList>::iterator p = _contentMap.find(scoped);
assert(p != _contentMap.end());
ContainedList::iterator q;
for(q = p->second.begin(); q != p->second.end(); ++q)
{
- if(q->get() == contained.get())
- {
- p->second.erase(q);
- return;
- }
+ if(q->get() == contained.get())
+ {
+ p->second.erase(q);
+ return;
+ }
}
assert(false);
}
@@ -5070,17 +5070,17 @@ Slice::Unit::findContents(const string& scoped) const
string name = scoped;
if(!_unit->caseSensitive())
{
- toLower(name);
+ toLower(name);
}
map<string, ContainedList>::const_iterator p = _contentMap.find(name);
if(p != _contentMap.end())
{
- return p->second;
+ return p->second;
}
else
{
- return ContainedList();
+ return ContainedList();
}
}
@@ -5090,18 +5090,18 @@ Slice::Unit::findDerivedClasses(const ClassDefPtr& cl) const
ClassList derived;
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
- for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- ClassDefPtr r = ClassDefPtr::dynamicCast(*q);
- if(r)
- {
- ClassList bases = r->bases();
- if(find(bases.begin(), bases.end(), cl) != bases.end())
- {
- derived.push_back(r);
- }
- }
- }
+ for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ ClassDefPtr r = ClassDefPtr::dynamicCast(*q);
+ if(r)
+ {
+ ClassList bases = r->bases();
+ if(find(bases.begin(), bases.end(), cl) != bases.end())
+ {
+ derived.push_back(r);
+ }
+ }
+ }
}
derived.sort();
derived.unique();
@@ -5114,18 +5114,18 @@ Slice::Unit::findDerivedExceptions(const ExceptionPtr& ex) const
ExceptionList derived;
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
- for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- ExceptionPtr r = ExceptionPtr::dynamicCast(*q);
- if(r)
- {
- ExceptionPtr base = r->base();
- if(base && base == ex)
- {
- derived.push_back(r);
- }
- }
- }
+ for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ ExceptionPtr r = ExceptionPtr::dynamicCast(*q);
+ if(r)
+ {
+ ExceptionPtr base = r->base();
+ if(base && base == ex)
+ {
+ derived.push_back(r);
+ }
+ }
+ }
}
derived.sort();
derived.unique();
@@ -5138,13 +5138,13 @@ Slice::Unit::findUsedBy(const ContainedPtr& contained) const
ContainedList usedBy;
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
- for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- if((*q)->uses(contained))
- {
- usedBy.push_back(*q);
- }
- }
+ for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ if((*q)->uses(contained))
+ {
+ usedBy.push_back(*q);
+ }
+ }
}
usedBy.sort();
usedBy.unique();
@@ -5156,19 +5156,19 @@ Slice::Unit::usesProxies() const
{
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
- for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
- if(decl && !decl->isLocal())
- {
- return true;
- }
- }
+ for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
+ if(decl && !decl->isLocal())
+ {
+ return true;
+ }
+ }
}
if(_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
{
- return true;
+ return true;
}
return false;
@@ -5179,30 +5179,30 @@ Slice::Unit::usesNonLocals() const
{
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
- for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- ConstructedPtr constr = ConstructedPtr::dynamicCast(*q);
- if(constr && !constr->isLocal())
- {
- return true;
- }
+ for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ ConstructedPtr constr = ConstructedPtr::dynamicCast(*q);
+ if(constr && !constr->isLocal())
+ {
+ return true;
+ }
- ExceptionPtr exc = ExceptionPtr::dynamicCast(*q);
- if(exc && !exc->isLocal())
- {
- return true;
- }
- }
+ ExceptionPtr exc = ExceptionPtr::dynamicCast(*q);
+ if(exc && !exc->isLocal())
+ {
+ return true;
+ }
+ }
}
if(_builtins.find(Builtin::KindObject) != _builtins.end())
{
- return true;
+ return true;
}
if(_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
{
- return true;
+ return true;
}
return false;
@@ -5213,14 +5213,14 @@ Slice::Unit::usesConsts() const
{
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
- for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- ConstPtr cd = ConstPtr::dynamicCast(*q);
- if(cd)
- {
- return true;
- }
- }
+ for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ ConstPtr cd = ConstPtr::dynamicCast(*q);
+ if(cd)
+ {
+ return true;
+ }
+ }
}
return false;
@@ -5257,15 +5257,15 @@ Slice::Unit::parse(FILE* file, bool debug, Slice::FeatureProfile profile)
int status = slice_parse();
if(_errors)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(status == EXIT_FAILURE)
{
- while(!_containerStack.empty())
- {
- popContainer();
- }
+ while(!_containerStack.empty())
+ {
+ popContainer();
+ }
while(!_definitionContextStack.empty())
{
popDefinitionContext();
@@ -5273,8 +5273,8 @@ Slice::Unit::parse(FILE* file, bool debug, Slice::FeatureProfile profile)
}
else
{
- assert(_containerStack.size() == 1);
- popContainer();
+ assert(_containerStack.size() == 1);
+ popContainer();
assert(_definitionContextStack.size() == 1);
popDefinitionContext();
}
@@ -5296,8 +5296,8 @@ Slice::Unit::visit(ParserVisitor* visitor, bool all)
{
if(visitor->visitUnitStart(this))
{
- Container::visit(visitor, all);
- visitor->visitUnitEnd(this);
+ Container::visit(visitor, all);
+ visitor->visitUnitEnd(this);
}
}
@@ -5307,7 +5307,7 @@ Slice::Unit::builtin(Builtin::Kind kind)
map<Builtin::Kind, BuiltinPtr>::const_iterator p = _builtins.find(kind);
if(p != _builtins.end())
{
- return p->second;
+ return p->second;
}
BuiltinPtr builtin = new Builtin(this, kind);
_builtins.insert(make_pair(kind, builtin));
@@ -5315,7 +5315,7 @@ Slice::Unit::builtin(Builtin::Kind kind)
}
Slice::Unit::Unit(bool ignRedefs, bool all, bool allowIcePrefix, bool caseSensitive,
- const StringList& defaultGlobalMetadata) :
+ const StringList& defaultGlobalMetadata) :
SyntaxTreeBase(0),
Container(0),
_ignRedefs(ignRedefs),
@@ -5354,24 +5354,24 @@ Slice::CICompare::operator()(const string& s1, const string& s2) const
string::const_iterator p2 = s2.begin();
while(p1 != s1.end() && p2 != s2.end() && ::tolower(*p1) == ::tolower(*p2))
{
- ++p1;
- ++p2;
+ ++p1;
+ ++p2;
}
if(p1 == s1.end() && p2 == s2.end())
{
- return false;
+ return false;
}
else if(p1 == s1.end())
{
- return true;
+ return true;
}
else if(p2 == s2.end())
{
- return false;
+ return false;
}
else
{
- return ::tolower(*p1) < ::tolower(*p2);
+ return ::tolower(*p1) < ::tolower(*p2);
}
}
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index 69a5e30864b..e52188a4a7e 100644
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -34,7 +34,7 @@ Slice::Preprocessor::~Preprocessor()
{
if(_cppHandle)
{
- close();
+ close();
}
}
@@ -46,7 +46,7 @@ Slice::Preprocessor::getBaseName()
string::size_type pos = base.rfind('.');
if(pos != string::npos)
{
- base.erase(pos);
+ base.erase(pos);
}
return base;
}
@@ -68,19 +68,19 @@ Slice::Preprocessor::preprocess(bool keepComments)
{
if(!checkInputFile())
{
- return 0;
+ return 0;
}
string cmd = searchIceCpp();
if(cmd.empty())
{
- return 0;
+ return 0;
}
if(keepComments)
{
- cmd += " -C";
+ cmd += " -C";
}
cmd += " " + _args + " \"" + _fileName + "\"";
@@ -101,14 +101,14 @@ Slice::Preprocessor::printMakefileDependencies(Language lang)
{
if(!checkInputFile())
{
- return;
+ return;
}
string cmd = searchIceCpp();
if(cmd.empty())
{
- return;
+ return;
}
cmd += " -M " + _args + " \"" + _fileName + "\"";
@@ -126,17 +126,17 @@ Slice::Preprocessor::printMakefileDependencies(Language lang)
* x.cpp: /path/x.ice /path/y.ice
*
* x.cpp: /path/x.ice \
- * /path/y.ice
+ * /path/y.ice
*
* x.cpp: /path/x.ice /path/y.ice \
- * /path/z.ice
+ * /path/z.ice
*
* x.cpp: \
- * /path/x.ice
+ * /path/x.ice
*
* x.cpp: \
- * /path/x.ice \
- * /path/y.ice
+ * /path/x.ice \
+ * /path/y.ice
*
* Spaces embedded within filenames are escaped with a backslash. Note that
* Windows filenames may contain colons.
@@ -145,16 +145,16 @@ Slice::Preprocessor::printMakefileDependencies(Language lang)
switch(lang)
{
case CPlusPlus:
- {
- char buf[1024];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- fputs(buf, stdout);
- }
- break;
- }
- case Java:
- {
+ {
+ char buf[1024];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ fputs(buf, stdout);
+ }
+ break;
+ }
+ case Java:
+ {
//
// We want to shift the files left one position, so that
// "x.cpp: x.ice y.ice" becomes "x.ice: y.ice".
@@ -163,9 +163,9 @@ Slice::Preprocessor::printMakefileDependencies(Language lang)
// all of the output into one string before manipulating it.
//
string deps;
- char buf[1024];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
+ char buf[1024];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
deps.append(buf, strlen(buf));
}
@@ -209,75 +209,75 @@ Slice::Preprocessor::printMakefileDependencies(Language lang)
}
fputs(deps.c_str(), stdout);
- break;
- }
- case CSharp:
- {
- //
- // Change .cpp suffix to .cs suffix.
- //
- char buf[1024];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- char* dot;
- char* colon = strchr(buf, ':');
- if(colon != NULL)
- {
- *colon = '\0';
- dot = strrchr(buf, '.');
- *colon = ':';
- if(dot != NULL)
- {
- if(strncmp(dot, ".cpp:", 5) == 0)
- {
- *dot = '\0';
- fputs(buf, stdout);
- fputs(".cs", stdout);
- fputs(colon, stdout);
- continue;
- }
- }
- }
- fputs(buf, stdout);
- }
- break;
- }
- case VisualBasic:
- {
- //
- // Change .cpp suffix to .vb suffix.
- //
- char buf[1024];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- char* dot;
- char* colon = strchr(buf, ':');
- if(colon != NULL)
- {
- *colon = '\0';
- dot = strrchr(buf, '.');
- *colon = ':';
- if(dot != NULL)
- {
- if(strncmp(dot, ".cpp:", 5) == 0)
- {
- *dot = '\0';
- fputs(buf, stdout);
- fputs(".vb", stdout);
- fputs(colon, stdout);
- continue;
- }
- }
- }
- fputs(buf, stdout);
- }
- break;
- }
- default:
- {
- abort();
- break;
- }
+ break;
+ }
+ case CSharp:
+ {
+ //
+ // Change .cpp suffix to .cs suffix.
+ //
+ char buf[1024];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ char* dot;
+ char* colon = strchr(buf, ':');
+ if(colon != NULL)
+ {
+ *colon = '\0';
+ dot = strrchr(buf, '.');
+ *colon = ':';
+ if(dot != NULL)
+ {
+ if(strncmp(dot, ".cpp:", 5) == 0)
+ {
+ *dot = '\0';
+ fputs(buf, stdout);
+ fputs(".cs", stdout);
+ fputs(colon, stdout);
+ continue;
+ }
+ }
+ }
+ fputs(buf, stdout);
+ }
+ break;
+ }
+ case VisualBasic:
+ {
+ //
+ // Change .cpp suffix to .vb suffix.
+ //
+ char buf[1024];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ char* dot;
+ char* colon = strchr(buf, ':');
+ if(colon != NULL)
+ {
+ *colon = '\0';
+ dot = strrchr(buf, '.');
+ *colon = ':';
+ if(dot != NULL)
+ {
+ if(strncmp(dot, ".cpp:", 5) == 0)
+ {
+ *dot = '\0';
+ fputs(buf, stdout);
+ fputs(".vb", stdout);
+ fputs(colon, stdout);
+ continue;
+ }
+ }
+ }
+ fputs(buf, stdout);
+ }
+ break;
+ }
+ default:
+ {
+ abort();
+ break;
+ }
}
}
@@ -292,7 +292,7 @@ Slice::Preprocessor::close()
if(WIFEXITED(status) && WEXITSTATUS(status) != 0)
{
- return false;
+ return false;
}
#else
int status = _pclose(_cppHandle);
@@ -300,7 +300,7 @@ Slice::Preprocessor::close()
if(status != 0)
{
- return false;
+ return false;
}
#endif
@@ -315,20 +315,20 @@ Slice::Preprocessor::checkInputFile()
string::size_type pos = base.rfind('.');
if(pos != string::npos)
{
- suffix = base.substr(pos);
- transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
+ suffix = base.substr(pos);
+ transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
}
if(suffix != ".ice")
{
- cerr << _path << ": input files must end with `.ice'" << endl;
- return false;
+ cerr << _path << ": input files must end with `.ice'" << endl;
+ return false;
}
ifstream test(_fileName.c_str());
if(!test)
{
- cerr << _path << ": can't open `" << _fileName << "' for reading" << endl;
- return false;
+ cerr << _path << ": can't open `" << _fileName << "' for reading" << endl;
+ return false;
}
test.close();
@@ -347,21 +347,21 @@ Slice::Preprocessor::searchIceCpp()
string::size_type pos = _path.find_last_of("/\\");
if(pos != string::npos)
{
- string path = _path.substr(0, pos + 1);
- path += icecpp;
+ string path = _path.substr(0, pos + 1);
+ path += icecpp;
- struct stat st;
- if(stat(path.c_str(), &st) == 0)
- {
+ struct stat st;
+ if(stat(path.c_str(), &st) == 0)
+ {
#ifndef _WIN32
- if(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
+ if(st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
#else
- if(st.st_mode & (S_IEXEC))
+ if(st.st_mode & (S_IEXEC))
#endif
- {
- return path;
- }
- }
+ {
+ return path;
+ }
+ }
}
return icecpp;
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index c8cd601580b..426ceff6949 100644
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -144,7 +144,7 @@ private:
string fixedName;
TypePtr type;
bool inherited;
- StringList metaData;
+ StringList metaData;
};
typedef list<MemberInfo> MemberInfoList;
@@ -222,7 +222,7 @@ getDictLookup(const ContainedPtr& cont, const string& suffix = string())
string package = Slice::Python::getPackageMetadata(cont);
if(!package.empty())
{
- scope = package + "." + scope;
+ scope = package + "." + scope;
}
return "_M_" + scope + "__dict__.has_key('" + suffix + Slice::Python::fixIdent(cont->name()) + "')";
@@ -361,15 +361,15 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
string scoped = p->scoped();
if(_classHistory.count(scoped) == 0)
{
- _out << sp << nl << "if not " << getDictLookup(p) << ':';
- _out.inc();
+ _out << sp << nl << "if not " << getDictLookup(p) << ':';
+ _out.inc();
string type = getAbsolute(p, "_t_");
_out << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
- if(!p->isLocal())
- {
- _out << nl << "_M_" << type << "Prx = IcePy.declareProxy('" << scoped << "')";
- }
- _out.dec();
+ if(!p->isLocal())
+ {
+ _out << nl << "_M_" << type << "Prx = IcePy.declareProxy('" << scoped << "')";
+ }
+ _out.dec();
_classHistory.insert(scoped); // Avoid redundant declarations.
}
}
@@ -688,10 +688,10 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
if(_classHistory.count(scoped) == 0 && p->canBeCyclic())
{
- //
- // Emit a forward declaration for the class in case a data member refers to this type.
- //
- _out << sp << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
+ //
+ // Emit a forward declaration for the class in case a data member refers to this type.
+ //
+ _out << sp << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
}
DataMemberList members = p->dataMembers();
@@ -700,11 +700,11 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << ", " << (p->isAbstract() ? "True" : "False") << ", ";
if(!base)
{
- _out << "None";
+ _out << "None";
}
else
{
- _out << "_M_" << getAbsolute(base, "_t_");
+ _out << "_M_" << getAbsolute(base, "_t_");
}
_out << ", (";
//
@@ -713,19 +713,19 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
int interfaceCount = 0;
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
{
- if((*q)->isInterface())
- {
- if(interfaceCount > 0)
- {
- _out << ", ";
- }
- _out << "_M_" << getAbsolute(*q, "_t_");
- ++interfaceCount;
- }
+ if((*q)->isInterface())
+ {
+ if(interfaceCount > 0)
+ {
+ _out << ", ";
+ }
+ _out << "_M_" << getAbsolute(*q, "_t_");
+ ++interfaceCount;
+ }
}
if(interfaceCount == 1)
{
- _out << ',';
+ _out << ',';
}
//
// Members
@@ -739,29 +739,29 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << "), (";
if(members.size() > 1)
{
- _out.inc();
- _out << nl;
+ _out.inc();
+ _out << nl;
}
for(DataMemberList::iterator r = members.begin(); r != members.end(); ++r)
{
- if(r != members.begin())
- {
- _out << ',' << nl;
- }
- _out << "('" << fixIdent((*r)->name()) << "', ";
- writeMetaData((*r)->getMetaData());
- _out << ", ";
- writeType((*r)->type());
- _out << ')';
+ if(r != members.begin())
+ {
+ _out << ',' << nl;
+ }
+ _out << "('" << fixIdent((*r)->name()) << "', ";
+ writeMetaData((*r)->getMetaData());
+ _out << ", ";
+ writeType((*r)->type());
+ _out << ')';
}
if(members.size() == 1)
{
- _out << ',';
+ _out << ',';
}
else if(members.size() > 1)
{
- _out.dec();
- _out << nl;
+ _out.dec();
+ _out << nl;
}
_out << "))";
_out << nl << name << ".ice_type = _M_" << type;
@@ -776,100 +776,100 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
//
if(!p->isLocal())
{
- if(!ops.empty())
- {
- _out << sp;
- }
- for(OperationList::iterator s = ops.begin(); s != ops.end(); ++s)
- {
- ParamDeclList params = (*s)->parameters();
- ParamDeclList::iterator t;
- int count;
-
- _out << nl << name << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', "
- << getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", "
- << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", ";
- writeMetaData((*s)->getMetaData());
- _out << ", (";
- for(t = params.begin(), count = 0; t != params.end(); ++t)
- {
- if(!(*t)->isOutParam())
- {
- if(count > 0)
- {
- _out << ", ";
- }
- _out << '(';
- writeMetaData((*t)->getMetaData());
- _out << ", ";
- writeType((*t)->type());
- _out << ')';
- ++count;
- }
- }
- if(count == 1)
- {
- _out << ',';
- }
- _out << "), (";
- for(t = params.begin(), count = 0; t != params.end(); ++t)
- {
- if((*t)->isOutParam())
- {
- if(count > 0)
- {
- _out << ", ";
- }
- _out << '(';
- writeMetaData((*t)->getMetaData());
- _out << ", ";
- writeType((*t)->type());
- _out << ')';
- ++count;
- }
- }
- if(count == 1)
- {
- _out << ',';
- }
- _out << "), ";
- TypePtr returnType = (*s)->returnType();
- if(returnType)
- {
- writeType(returnType);
- }
- else
- {
- _out << "None";
- }
- _out << ", (";
- ExceptionList exceptions = (*s)->throws();
- for(ExceptionList::iterator u = exceptions.begin(); u != exceptions.end(); ++u)
- {
- if(u != exceptions.begin())
- {
- _out << ", ";
- }
- _out << "_M_" << getAbsolute(*u, "_t_");
- }
- if(exceptions.size() == 1)
- {
- _out << ',';
- }
- _out << "))";
-
- string deprecateMetadata;
- if((*s)->findMetaData("deprecate", deprecateMetadata) || p->findMetaData("deprecate", deprecateMetadata))
- {
- string msg;
- string::size_type pos = deprecateMetadata.find(':');
- if(pos != string::npos && pos < deprecateMetadata.size() - 1)
- {
- msg = deprecateMetadata.substr(pos + 1);
- }
- _out << nl << name << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
- }
- }
+ if(!ops.empty())
+ {
+ _out << sp;
+ }
+ for(OperationList::iterator s = ops.begin(); s != ops.end(); ++s)
+ {
+ ParamDeclList params = (*s)->parameters();
+ ParamDeclList::iterator t;
+ int count;
+
+ _out << nl << name << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', "
+ << getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", "
+ << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", ";
+ writeMetaData((*s)->getMetaData());
+ _out << ", (";
+ for(t = params.begin(), count = 0; t != params.end(); ++t)
+ {
+ if(!(*t)->isOutParam())
+ {
+ if(count > 0)
+ {
+ _out << ", ";
+ }
+ _out << '(';
+ writeMetaData((*t)->getMetaData());
+ _out << ", ";
+ writeType((*t)->type());
+ _out << ')';
+ ++count;
+ }
+ }
+ if(count == 1)
+ {
+ _out << ',';
+ }
+ _out << "), (";
+ for(t = params.begin(), count = 0; t != params.end(); ++t)
+ {
+ if((*t)->isOutParam())
+ {
+ if(count > 0)
+ {
+ _out << ", ";
+ }
+ _out << '(';
+ writeMetaData((*t)->getMetaData());
+ _out << ", ";
+ writeType((*t)->type());
+ _out << ')';
+ ++count;
+ }
+ }
+ if(count == 1)
+ {
+ _out << ',';
+ }
+ _out << "), ";
+ TypePtr returnType = (*s)->returnType();
+ if(returnType)
+ {
+ writeType(returnType);
+ }
+ else
+ {
+ _out << "None";
+ }
+ _out << ", (";
+ ExceptionList exceptions = (*s)->throws();
+ for(ExceptionList::iterator u = exceptions.begin(); u != exceptions.end(); ++u)
+ {
+ if(u != exceptions.begin())
+ {
+ _out << ", ";
+ }
+ _out << "_M_" << getAbsolute(*u, "_t_");
+ }
+ if(exceptions.size() == 1)
+ {
+ _out << ',';
+ }
+ _out << "))";
+
+ string deprecateMetadata;
+ if((*s)->findMetaData("deprecate", deprecateMetadata) || p->findMetaData("deprecate", deprecateMetadata))
+ {
+ string msg;
+ string::size_type pos = deprecateMetadata.find(':');
+ if(pos != string::npos && pos < deprecateMetadata.size() - 1)
+ {
+ msg = deprecateMetadata.substr(pos + 1);
+ }
+ _out << nl << name << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
+ }
+ }
}
registerName(name);
@@ -993,17 +993,17 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
_out << ", ";
if(!base)
{
- _out << "None";
+ _out << "None";
}
else
{
- _out << "_M_" << getAbsolute(base, "_t_");
+ _out << "_M_" << getAbsolute(base, "_t_");
}
_out << ", (";
if(members.size() > 1)
{
- _out.inc();
- _out << nl;
+ _out.inc();
+ _out << nl;
}
//
// Data members are represented as a tuple:
@@ -1014,24 +1014,24 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
//
for(dmli = members.begin(); dmli != members.end(); ++dmli)
{
- if(dmli != members.begin())
- {
- _out << ',' << nl;
- }
- _out << "('" << fixIdent((*dmli)->name()) << "', ";
- writeMetaData((*dmli)->getMetaData());
- _out << ", ";
- writeType((*dmli)->type());
- _out << ')';
+ if(dmli != members.begin())
+ {
+ _out << ',' << nl;
+ }
+ _out << "('" << fixIdent((*dmli)->name()) << "', ";
+ writeMetaData((*dmli)->getMetaData());
+ _out << ", ";
+ writeType((*dmli)->type());
+ _out << ')';
}
if(members.size() == 1)
{
- _out << ',';
+ _out << ',';
}
else if(members.size() > 1)
{
- _out.dec();
- _out << nl;
+ _out.dec();
+ _out << nl;
}
_out << "))";
_out << nl << name << ".ice_type = _M_" << type;
@@ -1132,29 +1132,29 @@ Slice::Python::CodeVisitor::visitStructStart(const StructPtr& p)
//
if(memberList.size() > 1)
{
- _out.inc();
- _out << nl;
+ _out.inc();
+ _out << nl;
}
for(r = memberList.begin(); r != memberList.end(); ++r)
{
- if(r != memberList.begin())
- {
- _out << ',' << nl;
- }
- _out << "('" << r->fixedName << "', ";
- writeMetaData(r->metaData);
- _out << ", ";
- writeType(r->type);
- _out << ')';
+ if(r != memberList.begin())
+ {
+ _out << ',' << nl;
+ }
+ _out << "('" << r->fixedName << "', ";
+ writeMetaData(r->metaData);
+ _out << ", ";
+ writeType(r->type);
+ _out << ')';
}
if(memberList.size() == 1)
{
- _out << ',';
+ _out << ',';
}
else if(memberList.size() > 1)
{
- _out.dec();
- _out << nl;
+ _out.dec();
+ _out << nl;
}
_out << "))";
@@ -1271,21 +1271,21 @@ Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p)
// Emit the type information.
//
_out << sp << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineEnum('" << scoped << "', " << name
- << ", ";
+ << ", ";
writeMetaData(p->getMetaData());
_out << ", (";
for(q = enums.begin(); q != enums.end(); ++q)
{
- if(q != enums.begin())
- {
- _out << ", ";
- }
- string fixedEnum = fixIdent((*q)->name());
- _out << name << '.' << fixedEnum;
+ if(q != enums.begin())
+ {
+ _out << ", ";
+ }
+ string fixedEnum = fixIdent((*q)->name());
+ _out << name << '.' << fixedEnum;
}
if(enums.size() == 1)
{
- _out << ',';
+ _out << ',';
}
_out << "))";
@@ -1400,13 +1400,13 @@ Slice::Python::CodeVisitor::visitConst(const ConstPtr& p)
if(charSet.find(*c) == charSet.end())
{
unsigned char uc = *c; // Char may be signed, so make it positive.
- stringstream s;
+ stringstream s;
s << "\\"; // Print as octal if not in basic source character set.
s.flags(ios_base::oct);
s.width(3);
s.fill('0');
s << static_cast<unsigned>(uc);
- _out << s.str();
+ _out << s.str();
}
else
{
@@ -1653,19 +1653,19 @@ Slice::Python::CodeVisitor::writeMetaData(const StringList& meta)
_out << '(';
for(StringList::const_iterator p = meta.begin(); p != meta.end(); ++p)
{
- if(p->find("python:") == 0)
- {
- if(i > 0)
- {
- _out << ", ";
- }
- _out << "'" << *p << "'";
- ++i;
- }
+ if(p->find("python:") == 0)
+ {
+ if(i > 0)
+ {
+ _out << ", ";
+ }
+ _out << "'" << *p << "'";
+ ++i;
+ }
}
if(i == 1)
{
- _out << ',';
+ _out << ',';
}
_out << ')';
}
@@ -1677,14 +1677,14 @@ Slice::Python::CodeVisitor::getOperationMode(Slice::Operation::Mode mode)
switch(mode)
{
case Operation::Normal:
- result = "Ice.OperationMode.Normal";
- break;
+ result = "Ice.OperationMode.Normal";
+ break;
case Operation::Nonmutating:
- result = "Ice.OperationMode.Nonmutating";
- break;
+ result = "Ice.OperationMode.Nonmutating";
+ break;
case Operation::Idempotent:
- result = "Ice.OperationMode.Idempotent";
- break;
+ result = "Ice.OperationMode.Idempotent";
+ break;
}
return result;
}
@@ -1706,7 +1706,7 @@ Slice::Python::CodeVisitor::collectClassMembers(const ClassDefPtr& p, MemberInfo
m.fixedName = fixIdent((*q)->name());
m.type = (*q)->type();
m.inherited = inherited;
- m.metaData = (*q)->getMetaData();
+ m.metaData = (*q)->getMetaData();
allMembers.push_back(m);
}
}
@@ -1728,7 +1728,7 @@ Slice::Python::CodeVisitor::collectExceptionMembers(const ExceptionPtr& p, Membe
m.fixedName = fixIdent((*q)->name());
m.type = (*q)->type();
m.inherited = inherited;
- m.metaData = (*q)->getMetaData();
+ m.metaData = (*q)->getMetaData();
allMembers.push_back(m);
}
}
@@ -1988,10 +1988,10 @@ Slice::Python::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
{
if(!ModulePtr::dynamicCast(p->container()))
{
- //
- // We only need to validate global metadata for top-level modules.
- //
- validateGlobal(p->definitionContext());
+ //
+ // We only need to validate global metadata for top-level modules.
+ //
+ validateGlobal(p->definitionContext());
}
reject(p);
return true;
@@ -2033,13 +2033,13 @@ Slice::Python::MetaDataVisitor::visitOperation(const OperationPtr& p)
TypePtr ret = p->returnType();
if(ret)
{
- validateSequence(dc, p->line(), ret, p->getMetaData());
+ validateSequence(dc, p->line(), ret, p->getMetaData());
}
ParamDeclList params = p->parameters();
for(ParamDeclList::iterator q = params.begin(); q != params.end(); ++q)
{
- validateSequence(dc, (*q)->line(), (*q)->type(), (*q)->getMetaData());
+ validateSequence(dc, (*q)->line(), (*q)->type(), (*q)->getMetaData());
}
}
@@ -2082,48 +2082,48 @@ Slice::Python::MetaDataVisitor::validateGlobal(const DefinitionContextPtr& dc)
for(StringList::const_iterator p = globalMetaData.begin(); p != globalMetaData.end(); ++p)
{
- string s = *p;
- if(_history.count(s) == 0)
- {
- if(s.find(prefix) == 0)
- {
- static const string packagePrefix = "python:package:";
- if(s.find(packagePrefix) != 0 || s.size() == packagePrefix.size())
- {
- cout << dc->filename() << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
- }
- }
- _history.insert(s);
- }
+ string s = *p;
+ if(_history.count(s) == 0)
+ {
+ if(s.find(prefix) == 0)
+ {
+ static const string packagePrefix = "python:package:";
+ if(s.find(packagePrefix) != 0 || s.size() == packagePrefix.size())
+ {
+ cout << dc->filename() << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
+ }
+ }
+ _history.insert(s);
+ }
}
}
void
Slice::Python::MetaDataVisitor::validateSequence(const DefinitionContextPtr& dc, const string& line,
- const TypePtr& type, const StringList& meta)
+ const TypePtr& type, const StringList& meta)
{
static const string prefix = "python:";
for(StringList::const_iterator p = meta.begin(); p != meta.end(); ++p)
{
string s = *p;
- if(s.find(prefix) == 0)
- {
- string::size_type pos = s.find(':', prefix.size());
- if(pos != string::npos && s.substr(prefix.size(), pos - prefix.size()) == "seq")
- {
- static const string seqPrefix = "python:seq:";
- string arg = s.substr(seqPrefix.size(), pos - seqPrefix.size());
- if(SequencePtr::dynamicCast(type))
- {
- if(arg == "tuple" || arg == "list" || arg == "default")
- {
- continue;
- }
- }
- }
- cout << dc->filename() << ":" << line << ": warning: ignoring metadata `" << s << "'" << endl;
- }
+ if(s.find(prefix) == 0)
+ {
+ string::size_type pos = s.find(':', prefix.size());
+ if(pos != string::npos && s.substr(prefix.size(), pos - prefix.size()) == "seq")
+ {
+ static const string seqPrefix = "python:seq:";
+ string arg = s.substr(seqPrefix.size(), pos - seqPrefix.size());
+ if(SequencePtr::dynamicCast(type))
+ {
+ if(arg == "tuple" || arg == "list" || arg == "default")
+ {
+ continue;
+ }
+ }
+ }
+ cout << dc->filename() << ":" << line << ": warning: ignoring metadata `" << s << "'" << endl;
+ }
}
}
@@ -2136,11 +2136,11 @@ Slice::Python::MetaDataVisitor::reject(const ContainedPtr& cont)
for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end(); ++p)
{
- if(p->find(prefix) == 0)
- {
- DefinitionContextPtr dc = cont->definitionContext();
- assert(dc);
- cout << dc->filename() << ":" << cont->line() << ": warning: ignoring metadata `" << *p << "'" << endl;
- }
+ if(p->find(prefix) == 0)
+ {
+ DefinitionContextPtr dc = cont->definitionContext();
+ assert(dc);
+ cout << dc->filename() << ":" << cont->line() << ": warning: ignoring metadata `" << *p << "'" << endl;
+ }
}
}
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index 1a3703ae94c..5251e5db3f5 100644
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -73,10 +73,10 @@ private:
struct MemberInfo
{
- string lowerName; // Mapped name beginning with a lower-case letter for use as the name of a local variable.
- string fixedName;
- TypePtr type;
- bool inherited;
+ string lowerName; // Mapped name beginning with a lower-case letter for use as the name of a local variable.
+ string fixedName;
+ TypePtr type;
+ bool inherited;
};
typedef list<MemberInfo> MemberInfoList;
@@ -105,14 +105,14 @@ lookupKwd(const string& name)
//
static const string keywordList[] =
{
- "BEGIN", "END", "alias", "and", "begin", "break", "case", "class", "clone", "def", "display", "do", "dup",
- "else", "elsif", "end", "ensure", "extend", "false", "for", "freeze", "hash", "if", "in", "inspect", "method",
- "methods", "module", "next", "new", "nil", "not", "or", "redo", "rescue", "retry", "return", "self", "send",
- "super", "taint", "then", "true", "undef", "unless", "untaint", "until", "when", "while", "yield"
+ "BEGIN", "END", "alias", "and", "begin", "break", "case", "class", "clone", "def", "display", "do", "dup",
+ "else", "elsif", "end", "ensure", "extend", "false", "for", "freeze", "hash", "if", "in", "inspect", "method",
+ "methods", "module", "next", "new", "nil", "not", "or", "redo", "rescue", "retry", "return", "self", "send",
+ "super", "taint", "then", "true", "undef", "unless", "untaint", "until", "when", "while", "yield"
};
bool found = binary_search(&keywordList[0],
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
- name);
+ &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
+ name);
return found ? "_" + name : name;
}
@@ -128,24 +128,24 @@ splitScopedName(const string& scoped)
string::size_type pos;
while((pos = scoped.find("::", next)) != string::npos)
{
- pos += 2;
- if(pos != scoped.size())
- {
- string::size_type endpos = scoped.find("::", pos);
- if(endpos != string::npos && endpos > pos)
- {
- ids.push_back(scoped.substr(pos, endpos - pos));
- }
- }
- next = pos;
+ pos += 2;
+ if(pos != scoped.size())
+ {
+ string::size_type endpos = scoped.find("::", pos);
+ if(endpos != string::npos && endpos > pos)
+ {
+ ids.push_back(scoped.substr(pos, endpos - pos));
+ }
+ }
+ next = pos;
}
if(next != scoped.size())
{
- ids.push_back(scoped.substr(next));
+ ids.push_back(scoped.substr(next));
}
else
{
- ids.push_back("");
+ ids.push_back("");
}
return ids;
@@ -183,17 +183,17 @@ Slice::Ruby::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
string scoped = p->scoped();
if(_classHistory.count(scoped) == 0)
{
- string name = "T_" + fixIdent(p->name(), IdentToUpper);
- _out << sp << nl << "if not defined?(" << getAbsolute(p, IdentToUpper, "T_") << ')';
- _out.inc();
- _out << nl << name << " = ::Ice::__declareClass('" << scoped << "')";
- if(!p->isLocal())
- {
- _out << nl << name << "Prx = ::Ice::__declareProxy('" << scoped << "')";
- }
- _out.dec();
- _out << nl << "end";
- _classHistory.insert(scoped); // Avoid redundant declarations.
+ string name = "T_" + fixIdent(p->name(), IdentToUpper);
+ _out << sp << nl << "if not defined?(" << getAbsolute(p, IdentToUpper, "T_") << ')';
+ _out.inc();
+ _out << nl << name << " = ::Ice::__declareClass('" << scoped << "')";
+ if(!p->isLocal())
+ {
+ _out << nl << name << "Prx = ::Ice::__declareProxy('" << scoped << "')";
+ }
+ _out.dec();
+ _out << nl << "end";
+ _classHistory.insert(scoped); // Avoid redundant declarations.
}
}
@@ -217,129 +217,129 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
- if(!bases.empty() && !bases.front()->isInterface())
- {
- base = bases.front();
- _out << nl << "include " << getAbsolute(bases.front(), IdentToUpper) << "_mixin";
- }
- else
- {
- _out << nl << "include ::Ice::Object_mixin";
- }
-
- //
- // ice_ids
- //
- ClassList allBases = p->allBases();
- StringList ids;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ base = bases.front();
+ _out << nl << "include " << getAbsolute(bases.front(), IdentToUpper) << "_mixin";
+ }
+ else
+ {
+ _out << nl << "include ::Ice::Object_mixin";
+ }
+
+ //
+ // ice_ids
+ //
+ ClassList allBases = p->allBases();
+ StringList ids;
#if defined(__IBMCPP__) && defined(NDEBUG)
//
// VisualAge C++ 6.0 does not see that ClassDef is a Contained,
// when inlining is on. The code below issues a warning: better
// than an error!
//
- transform(allBases.begin(), allBases.end(), back_inserter(ids),
- IceUtil::constMemFun<string,ClassDef>(&Contained::scoped));
+ transform(allBases.begin(), allBases.end(), back_inserter(ids),
+ IceUtil::constMemFun<string,ClassDef>(&Contained::scoped));
#else
- transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped));
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped));
#endif
- StringList other;
- other.push_back(scoped);
- other.push_back("::Ice::Object");
- other.sort();
- ids.merge(other);
- ids.unique();
- _out << sp << nl << "def ice_ids(current=nil)";
- _out.inc();
- _out << nl << "[";
- for(StringList::iterator q = ids.begin(); q != ids.end(); ++q)
- {
- if(q != ids.begin())
- {
- _out << ", ";
- }
- _out << "'" << *q << "'";
- }
- _out << ']';
- _out.dec();
- _out << nl << "end";
-
- //
- // ice_id
- //
- _out << sp << nl << "def ice_id(current=nil)";
- _out.inc();
- _out << nl << "'" << scoped << "'";
- _out.dec();
- _out << nl << "end";
+ StringList other;
+ other.push_back(scoped);
+ other.push_back("::Ice::Object");
+ other.sort();
+ ids.merge(other);
+ ids.unique();
+ _out << sp << nl << "def ice_ids(current=nil)";
+ _out.inc();
+ _out << nl << "[";
+ for(StringList::iterator q = ids.begin(); q != ids.end(); ++q)
+ {
+ if(q != ids.begin())
+ {
+ _out << ", ";
+ }
+ _out << "'" << *q << "'";
+ }
+ _out << ']';
+ _out.dec();
+ _out << nl << "end";
+
+ //
+ // ice_id
+ //
+ _out << sp << nl << "def ice_id(current=nil)";
+ _out.inc();
+ _out << nl << "'" << scoped << "'";
+ _out.dec();
+ _out << nl << "end";
}
if(!ops.empty())
{
- //
- // Emit a comment for each operation.
- //
- _out << sp
- << nl << "#"
- << nl << "# Operation signatures."
- << nl << "#";
- for(oli = ops.begin(); oli != ops.end(); ++oli)
- {
- string fixedOpName = fixIdent((*oli)->name(), IdentNormal);
+ //
+ // Emit a comment for each operation.
+ //
+ _out << sp
+ << nl << "#"
+ << nl << "# Operation signatures."
+ << nl << "#";
+ for(oli = ops.begin(); oli != ops.end(); ++oli)
+ {
+ string fixedOpName = fixIdent((*oli)->name(), IdentNormal);
/* If AMI/AMD is ever implemented...
- if(!p->isLocal() && (p->hasMetaData("amd") || (*oli)->hasMetaData("amd")))
- {
- _out << nl << "# def " << fixedOpName << "_async(_cb";
-
- ParamDeclList params = (*oli)->parameters();
-
- for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
- {
- if(!(*pli)->isOutParam())
- {
- _out << ", " << fixIdent((*pli)->name(), IdentToLower);
- }
- }
- if(!p->isLocal())
- {
- _out << ", current=nil";
- }
- _out << ")";
- }
- else
+ if(!p->isLocal() && (p->hasMetaData("amd") || (*oli)->hasMetaData("amd")))
+ {
+ _out << nl << "# def " << fixedOpName << "_async(_cb";
+
+ ParamDeclList params = (*oli)->parameters();
+
+ for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
+ {
+ if(!(*pli)->isOutParam())
+ {
+ _out << ", " << fixIdent((*pli)->name(), IdentToLower);
+ }
+ }
+ if(!p->isLocal())
+ {
+ _out << ", current=nil";
+ }
+ _out << ")";
+ }
+ else
*/
- {
- _out << nl << "# def " << fixedOpName << "(";
-
- ParamDeclList params = (*oli)->parameters();
-
- bool first = true;
- for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
- {
- if(!(*pli)->isOutParam())
- {
- if(first)
- {
- first = false;
- }
- else
- {
- _out << ", ";
- }
- _out << fixIdent((*pli)->name(), IdentToLower);
- }
- }
- if(!p->isLocal())
- {
- if(!first)
- {
- _out << ", ";
- }
- _out << "current=nil";
- }
- _out << ")";
- }
- }
+ {
+ _out << nl << "# def " << fixedOpName << "(";
+
+ ParamDeclList params = (*oli)->parameters();
+
+ bool first = true;
+ for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
+ {
+ if(!(*pli)->isOutParam())
+ {
+ if(first)
+ {
+ first = false;
+ }
+ else
+ {
+ _out << ", ";
+ }
+ _out << fixIdent((*pli)->name(), IdentToLower);
+ }
+ }
+ if(!p->isLocal())
+ {
+ if(!first)
+ {
+ _out << ", ";
+ }
+ _out << "current=nil";
+ }
+ _out << ")";
+ }
+ }
}
//
@@ -357,15 +357,15 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
DataMemberList members = p->dataMembers();
if(!members.empty())
{
- _out << sp << nl << "attr_accessor ";
- for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
- {
- if(q != members.begin())
- {
- _out << ", ";
- }
- _out << ":" << fixIdent((*q)->name(), IdentNormal);
- }
+ _out << sp << nl << "attr_accessor ";
+ for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
+ {
+ if(q != members.begin())
+ {
+ _out << ", ";
+ }
+ _out << ":" << fixIdent((*q)->name(), IdentNormal);
+ }
}
_out.dec();
@@ -373,65 +373,65 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface())
{
- //
- // Class.
- //
- _out << nl << "class " << name;
- if(base)
- {
- _out << " < " << getAbsolute(base, IdentToUpper);
- }
- _out.inc();
- _out << nl << "include " << name << "_mixin";
-
- //
- // initialize
- //
- MemberInfoList allMembers;
- collectClassMembers(p, allMembers, false);
- bool inheritsMembers = false;
- if(!allMembers.empty())
- {
- _out << sp << nl << "def initialize";
- _out << spar;
- MemberInfoList::iterator q;
- for(q = allMembers.begin(); q != allMembers.end(); ++q)
- {
- ostringstream ostr;
- ostr << q->lowerName << '=' << getDefaultValue(q->type);
- _out << ostr.str();
- if(q->inherited)
- {
- inheritsMembers = true;
- }
- }
- _out << epar;
- _out.inc();
- if(inheritsMembers)
- {
- _out << nl << "super" << spar;
- for(q = allMembers.begin(); q != allMembers.end(); ++q)
- {
- if(q->inherited)
- {
- _out << q->lowerName;
- }
- }
- _out << epar;
- }
- for(q = allMembers.begin(); q != allMembers.end(); ++q)
- {
- if(!q->inherited)
- {
- _out << nl << '@' << q->fixedName << " = " << q->lowerName;
- }
- }
- _out.dec();
- _out << nl << "end";
- }
-
- _out.dec();
- _out << nl << "end"; // End of class.
+ //
+ // Class.
+ //
+ _out << nl << "class " << name;
+ if(base)
+ {
+ _out << " < " << getAbsolute(base, IdentToUpper);
+ }
+ _out.inc();
+ _out << nl << "include " << name << "_mixin";
+
+ //
+ // initialize
+ //
+ MemberInfoList allMembers;
+ collectClassMembers(p, allMembers, false);
+ bool inheritsMembers = false;
+ if(!allMembers.empty())
+ {
+ _out << sp << nl << "def initialize";
+ _out << spar;
+ MemberInfoList::iterator q;
+ for(q = allMembers.begin(); q != allMembers.end(); ++q)
+ {
+ ostringstream ostr;
+ ostr << q->lowerName << '=' << getDefaultValue(q->type);
+ _out << ostr.str();
+ if(q->inherited)
+ {
+ inheritsMembers = true;
+ }
+ }
+ _out << epar;
+ _out.inc();
+ if(inheritsMembers)
+ {
+ _out << nl << "super" << spar;
+ for(q = allMembers.begin(); q != allMembers.end(); ++q)
+ {
+ if(q->inherited)
+ {
+ _out << q->lowerName;
+ }
+ }
+ _out << epar;
+ }
+ for(q = allMembers.begin(); q != allMembers.end(); ++q)
+ {
+ if(!q->inherited)
+ {
+ _out << nl << '@' << q->fixedName << " = " << q->lowerName;
+ }
+ }
+ _out.dec();
+ _out << nl << "end";
+ }
+
+ _out.dec();
+ _out << nl << "end"; // End of class.
}
//
@@ -440,87 +440,87 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
//
if(!p->isLocal())
{
- _out << nl << "module " << name << "Prx_mixin";
- _out.inc();
- for(ClassList::iterator cli = bases.begin(); cli != bases.end(); ++cli)
- {
- _out << nl << "include " << getAbsolute(*cli, IdentToUpper) << "Prx_mixin";
- }
- for(oli = ops.begin(); oli != ops.end(); ++oli)
- {
- string fixedOpName = fixIdent((*oli)->name(), IdentNormal);
- if(fixedOpName == "checkedCast" || fixedOpName == "uncheckedCast")
- {
- fixedOpName.insert(0, "_");
- }
- TypePtr ret = (*oli)->returnType();
- ParamDeclList paramList = (*oli)->parameters();
- string inParams;
-
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
- {
- if(!(*q)->isOutParam())
- {
- if(!inParams.empty())
- {
- inParams.append(", ");
- }
- inParams.append(fixIdent((*q)->name(), IdentToLower));
- }
- }
-
- _out << sp << nl << "def " << fixedOpName << "(";
- if(!inParams.empty())
- {
- _out << inParams << ", ";
- }
- _out << "_ctx=nil)";
- _out.inc();
- _out << nl << name << "_mixin::OP_" << (*oli)->name() << ".invoke(self, [" << inParams;
- _out << "], _ctx)";
- _out.dec();
- _out << nl << "end";
-
- if(p->hasMetaData("ami") || (*oli)->hasMetaData("ami"))
- {
- _out << sp << nl << "def " << fixedOpName << "_async(_cb";
- if(!inParams.empty())
- {
- _out << ", " << inParams;
- }
- _out << ", _ctx=nil)";
- _out.inc();
- _out << nl << name << "_mixin::OP_" << (*oli)->name() << ".invokeAsync(self, _cb, [" << inParams;
- if(!inParams.empty() && inParams.find(',') == string::npos)
- {
- _out << ", ";
- }
- _out << "], _ctx)";
- _out.dec();
- _out << nl << "end";
- }
- }
- _out.dec();
- _out << nl << "end"; // End of mix-in module for proxy.
-
- _out << nl << "class " << name << "Prx < ::Ice::ObjectPrx";
- _out.inc();
- _out << nl << "include " << name << "Prx_mixin";
-
- _out << sp << nl << "def " << name << "Prx.checkedCast(proxy, facetOrCtx=nil, _ctx=nil)";
- _out.inc();
- _out << nl << "ice_checkedCast(proxy, '" << scoped << "', facetOrCtx, _ctx)";
- _out.dec();
- _out << nl << "end";
-
- _out << sp << nl << "def " << name << "Prx.uncheckedCast(proxy, facet='')";
- _out.inc();
- _out << nl << "ice_uncheckedCast(proxy, facet)";
- _out.dec();
- _out << nl << "end";
-
- _out.dec();
- _out << nl << "end"; // End of proxy class.
+ _out << nl << "module " << name << "Prx_mixin";
+ _out.inc();
+ for(ClassList::iterator cli = bases.begin(); cli != bases.end(); ++cli)
+ {
+ _out << nl << "include " << getAbsolute(*cli, IdentToUpper) << "Prx_mixin";
+ }
+ for(oli = ops.begin(); oli != ops.end(); ++oli)
+ {
+ string fixedOpName = fixIdent((*oli)->name(), IdentNormal);
+ if(fixedOpName == "checkedCast" || fixedOpName == "uncheckedCast")
+ {
+ fixedOpName.insert(0, "_");
+ }
+ TypePtr ret = (*oli)->returnType();
+ ParamDeclList paramList = (*oli)->parameters();
+ string inParams;
+
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if(!(*q)->isOutParam())
+ {
+ if(!inParams.empty())
+ {
+ inParams.append(", ");
+ }
+ inParams.append(fixIdent((*q)->name(), IdentToLower));
+ }
+ }
+
+ _out << sp << nl << "def " << fixedOpName << "(";
+ if(!inParams.empty())
+ {
+ _out << inParams << ", ";
+ }
+ _out << "_ctx=nil)";
+ _out.inc();
+ _out << nl << name << "_mixin::OP_" << (*oli)->name() << ".invoke(self, [" << inParams;
+ _out << "], _ctx)";
+ _out.dec();
+ _out << nl << "end";
+
+ if(p->hasMetaData("ami") || (*oli)->hasMetaData("ami"))
+ {
+ _out << sp << nl << "def " << fixedOpName << "_async(_cb";
+ if(!inParams.empty())
+ {
+ _out << ", " << inParams;
+ }
+ _out << ", _ctx=nil)";
+ _out.inc();
+ _out << nl << name << "_mixin::OP_" << (*oli)->name() << ".invokeAsync(self, _cb, [" << inParams;
+ if(!inParams.empty() && inParams.find(',') == string::npos)
+ {
+ _out << ", ";
+ }
+ _out << "], _ctx)";
+ _out.dec();
+ _out << nl << "end";
+ }
+ }
+ _out.dec();
+ _out << nl << "end"; // End of mix-in module for proxy.
+
+ _out << nl << "class " << name << "Prx < ::Ice::ObjectPrx";
+ _out.inc();
+ _out << nl << "include " << name << "Prx_mixin";
+
+ _out << sp << nl << "def " << name << "Prx.checkedCast(proxy, facetOrCtx=nil, _ctx=nil)";
+ _out.inc();
+ _out << nl << "ice_checkedCast(proxy, '" << scoped << "', facetOrCtx, _ctx)";
+ _out.dec();
+ _out << nl << "end";
+
+ _out << sp << nl << "def " << name << "Prx.uncheckedCast(proxy, facet='')";
+ _out.inc();
+ _out << nl << "ice_uncheckedCast(proxy, facet)";
+ _out.dec();
+ _out << nl << "end";
+
+ _out.dec();
+ _out << nl << "end"; // End of proxy class.
}
//
@@ -531,21 +531,21 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "T_" << name << " = ::Ice::__declareClass('" << scoped << "')";
if(!p->isLocal())
{
- _out << nl << "T_" << name << "Prx = ::Ice::__declareProxy('" << scoped << "')";
+ _out << nl << "T_" << name << "Prx = ::Ice::__declareProxy('" << scoped << "')";
}
_out.dec();
_out << nl << "end";
_classHistory.insert(scoped); // Avoid redundant declarations.
_out << sp << nl << "T_" << name << ".defineClass(" << (p->isInterface() ? string("nil") : name) << ", "
- << (p->isAbstract() ? "true" : "false") << ", ";
+ << (p->isAbstract() ? "true" : "false") << ", ";
if(!base)
{
- _out << "nil";
+ _out << "nil";
}
else
{
- _out << getAbsolute(base, IdentToUpper, "T_");
+ _out << getAbsolute(base, IdentToUpper, "T_");
}
_out << ", [";
//
@@ -554,19 +554,19 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
// TODO: Necessary?
//
{
- int interfaceCount = 0;
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
- {
- if((*q)->isInterface())
- {
- if(interfaceCount > 0)
- {
- _out << ", ";
- }
- _out << getAbsolute(*q, IdentToUpper, "T_");
- ++interfaceCount;
- }
- }
+ int interfaceCount = 0;
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
+ {
+ if((*q)->isInterface())
+ {
+ if(interfaceCount > 0)
+ {
+ _out << ", ";
+ }
+ _out << getAbsolute(*q, IdentToUpper, "T_");
+ ++interfaceCount;
+ }
+ }
}
//
// Members
@@ -580,25 +580,25 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << "], [";
if(members.size() > 1)
{
- _out.inc();
- _out << nl;
+ _out.inc();
+ _out << nl;
}
{
- for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
- {
- if(q != members.begin())
- {
- _out << ',' << nl;
- }
- _out << "['" << fixIdent((*q)->name(), IdentNormal) << "', ";
- writeType((*q)->type());
- _out << ']';
- }
+ for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
+ {
+ if(q != members.begin())
+ {
+ _out << ',' << nl;
+ }
+ _out << "['" << fixIdent((*q)->name(), IdentNormal) << "', ";
+ writeType((*q)->type());
+ _out << ']';
+ }
}
if(members.size() > 1)
{
- _out.dec();
- _out << nl;
+ _out.dec();
+ _out << nl;
}
_out << "])";
_out << nl << name << "_mixin::ICE_TYPE = T_" << name;
@@ -613,106 +613,106 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
//
if(!p->isLocal())
{
- _out << sp << nl << "T_" << name << "Prx.defineProxy(" << name << "Prx, T_" << name << ')';
- _out << nl << name << "Prx::ICE_TYPE = T_" << name << "Prx";
-
- if(!ops.empty())
- {
- _out << sp;
- }
- for(OperationList::iterator s = ops.begin(); s != ops.end(); ++s)
- {
- ParamDeclList params = (*s)->parameters();
- ParamDeclList::iterator t;
- int count;
-
- _out << nl << name << "_mixin::OP_" << (*s)->name() << " = ::Ice::__defineOperation('"
- << (*s)->name() << "', ";
- switch((*s)->mode())
- {
- case Operation::Normal:
- _out << "::Ice::OperationMode::Normal";
- break;
- case Operation::Nonmutating:
- _out << "::Ice::OperationMode::Nonmutating";
- break;
- case Operation::Idempotent:
- _out << "::Ice::OperationMode::Idempotent";
- break;
- }
- _out << ", ";
- switch((*s)->sendMode())
- {
- case Operation::Normal:
- _out << "::Ice::OperationMode::Normal";
- break;
- case Operation::Nonmutating:
- _out << "::Ice::OperationMode::Nonmutating";
- break;
- case Operation::Idempotent:
- _out << "::Ice::OperationMode::Idempotent";
- break;
- }
- _out << ", " << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "true" : "false") << ", [";
- for(t = params.begin(), count = 0; t != params.end(); ++t)
- {
- if(!(*t)->isOutParam())
- {
- if(count > 0)
- {
- _out << ", ";
- }
- writeType((*t)->type());
- ++count;
- }
- }
- _out << "], [";
- for(t = params.begin(), count = 0; t != params.end(); ++t)
- {
- if((*t)->isOutParam())
- {
- if(count > 0)
- {
- _out << ", ";
- }
- writeType((*t)->type());
- ++count;
- }
- }
- _out << "], ";
- TypePtr returnType = (*s)->returnType();
- if(returnType)
- {
- writeType(returnType);
- }
- else
- {
- _out << "nil";
- }
- _out << ", [";
- ExceptionList exceptions = (*s)->throws();
- for(ExceptionList::iterator u = exceptions.begin(); u != exceptions.end(); ++u)
- {
- if(u != exceptions.begin())
- {
- _out << ", ";
- }
- _out << getAbsolute(*u, IdentToUpper, "T_");
- }
- _out << "])";
-
- string deprecateMetadata;
- if((*s)->findMetaData("deprecate", deprecateMetadata) || p->findMetaData("deprecate", deprecateMetadata))
- {
- string msg;
- string::size_type pos = deprecateMetadata.find(':');
- if(pos != string::npos && pos < deprecateMetadata.size() - 1)
- {
- msg = deprecateMetadata.substr(pos + 1);
- }
- _out << nl << name << "_mixin::OP_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
- }
- }
+ _out << sp << nl << "T_" << name << "Prx.defineProxy(" << name << "Prx, T_" << name << ')';
+ _out << nl << name << "Prx::ICE_TYPE = T_" << name << "Prx";
+
+ if(!ops.empty())
+ {
+ _out << sp;
+ }
+ for(OperationList::iterator s = ops.begin(); s != ops.end(); ++s)
+ {
+ ParamDeclList params = (*s)->parameters();
+ ParamDeclList::iterator t;
+ int count;
+
+ _out << nl << name << "_mixin::OP_" << (*s)->name() << " = ::Ice::__defineOperation('"
+ << (*s)->name() << "', ";
+ switch((*s)->mode())
+ {
+ case Operation::Normal:
+ _out << "::Ice::OperationMode::Normal";
+ break;
+ case Operation::Nonmutating:
+ _out << "::Ice::OperationMode::Nonmutating";
+ break;
+ case Operation::Idempotent:
+ _out << "::Ice::OperationMode::Idempotent";
+ break;
+ }
+ _out << ", ";
+ switch((*s)->sendMode())
+ {
+ case Operation::Normal:
+ _out << "::Ice::OperationMode::Normal";
+ break;
+ case Operation::Nonmutating:
+ _out << "::Ice::OperationMode::Nonmutating";
+ break;
+ case Operation::Idempotent:
+ _out << "::Ice::OperationMode::Idempotent";
+ break;
+ }
+ _out << ", " << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "true" : "false") << ", [";
+ for(t = params.begin(), count = 0; t != params.end(); ++t)
+ {
+ if(!(*t)->isOutParam())
+ {
+ if(count > 0)
+ {
+ _out << ", ";
+ }
+ writeType((*t)->type());
+ ++count;
+ }
+ }
+ _out << "], [";
+ for(t = params.begin(), count = 0; t != params.end(); ++t)
+ {
+ if((*t)->isOutParam())
+ {
+ if(count > 0)
+ {
+ _out << ", ";
+ }
+ writeType((*t)->type());
+ ++count;
+ }
+ }
+ _out << "], ";
+ TypePtr returnType = (*s)->returnType();
+ if(returnType)
+ {
+ writeType(returnType);
+ }
+ else
+ {
+ _out << "nil";
+ }
+ _out << ", [";
+ ExceptionList exceptions = (*s)->throws();
+ for(ExceptionList::iterator u = exceptions.begin(); u != exceptions.end(); ++u)
+ {
+ if(u != exceptions.begin())
+ {
+ _out << ", ";
+ }
+ _out << getAbsolute(*u, IdentToUpper, "T_");
+ }
+ _out << "])";
+
+ string deprecateMetadata;
+ if((*s)->findMetaData("deprecate", deprecateMetadata) || p->findMetaData("deprecate", deprecateMetadata))
+ {
+ string msg;
+ string::size_type pos = deprecateMetadata.find(':');
+ if(pos != string::npos && pos < deprecateMetadata.size() - 1)
+ {
+ msg = deprecateMetadata.substr(pos + 1);
+ }
+ _out << nl << name << "_mixin::OP_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
+ }
+ }
}
_out.dec();
@@ -734,16 +734,16 @@ Slice::Ruby::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
string baseName;
if(base)
{
- baseName = getAbsolute(base, IdentToUpper);
- _out << baseName;
+ baseName = getAbsolute(base, IdentToUpper);
+ _out << baseName;
}
else if(p->isLocal())
{
- _out << "Ice::LocalException";
+ _out << "Ice::LocalException";
}
else
{
- _out << "Ice::UserException";
+ _out << "Ice::UserException";
}
_out.inc();
@@ -759,41 +759,41 @@ Slice::Ruby::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
bool inheritsMembers = false;
if(!allMembers.empty())
{
- _out << spar;
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
- {
- ostringstream ostr;
- ostr << q->lowerName << '=' << getDefaultValue(q->type);
- _out << ostr.str();
- if(q->inherited)
- {
- inheritsMembers = true;
- }
- }
- _out << epar;
+ _out << spar;
+ for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
+ {
+ ostringstream ostr;
+ ostr << q->lowerName << '=' << getDefaultValue(q->type);
+ _out << ostr.str();
+ if(q->inherited)
+ {
+ inheritsMembers = true;
+ }
+ }
+ _out << epar;
}
_out.inc();
if(!allMembers.empty())
{
- if(inheritsMembers)
- {
- _out << nl << "super" << spar;
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
- {
- if(q->inherited)
- {
- _out << q->lowerName;
- }
- }
- _out << epar;
- }
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
- {
- if(!q->inherited)
- {
- _out << nl << '@' << q->fixedName << " = " << q->lowerName;
- }
- }
+ if(inheritsMembers)
+ {
+ _out << nl << "super" << spar;
+ for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
+ {
+ if(q->inherited)
+ {
+ _out << q->lowerName;
+ }
+ }
+ _out << epar;
+ }
+ for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
+ {
+ if(!q->inherited)
+ {
+ _out << nl << '@' << q->fixedName << " = " << q->lowerName;
+ }
+ }
}
_out.dec();
_out << nl << "end";
@@ -821,15 +821,15 @@ Slice::Ruby::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
//
if(!members.empty())
{
- _out << sp << nl << "attr_accessor ";
- for(dmli = members.begin(); dmli != members.end(); ++dmli)
- {
- if(dmli != members.begin())
- {
- _out << ", ";
- }
- _out << ':' << fixIdent((*dmli)->name(), IdentNormal);
- }
+ _out << sp << nl << "attr_accessor ";
+ for(dmli = members.begin(); dmli != members.end(); ++dmli)
+ {
+ if(dmli != members.begin())
+ {
+ _out << ", ";
+ }
+ _out << ':' << fixIdent((*dmli)->name(), IdentNormal);
+ }
}
_out.dec();
@@ -841,17 +841,17 @@ Slice::Ruby::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
_out << sp << nl << "T_" << name << " = ::Ice::__defineException('" << scoped << "', " << name << ", ";
if(!base)
{
- _out << "nil";
+ _out << "nil";
}
else
{
- _out << getAbsolute(base, IdentToUpper, "T_");
+ _out << getAbsolute(base, IdentToUpper, "T_");
}
_out << ", [";
if(members.size() > 1)
{
- _out.inc();
- _out << nl;
+ _out.inc();
+ _out << nl;
}
//
// Data members are represented as an array:
@@ -862,18 +862,18 @@ Slice::Ruby::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
//
for(dmli = members.begin(); dmli != members.end(); ++dmli)
{
- if(dmli != members.begin())
- {
- _out << ',' << nl;
- }
- _out << "[\"" << fixIdent((*dmli)->name(), IdentNormal) << "\", ";
- writeType((*dmli)->type());
- _out << ']';
+ if(dmli != members.begin())
+ {
+ _out << ',' << nl;
+ }
+ _out << "[\"" << fixIdent((*dmli)->name(), IdentNormal) << "\", ";
+ writeType((*dmli)->type());
+ _out << ']';
}
if(members.size() > 1)
{
- _out.dec();
- _out << nl;
+ _out.dec();
+ _out << nl;
}
_out << "])";
_out << nl << name << "::ICE_TYPE = T_" << name;
@@ -893,14 +893,14 @@ Slice::Ruby::CodeVisitor::visitStructStart(const StructPtr& p)
MemberInfoList::iterator r;
{
- DataMemberList members = p->dataMembers();
- for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
- {
- memberList.push_back(MemberInfo());
- memberList.back().lowerName = fixIdent((*q)->name(), IdentToLower);
- memberList.back().fixedName = fixIdent((*q)->name(), IdentNormal);
- memberList.back().type = (*q)->type();
- }
+ DataMemberList members = p->dataMembers();
+ for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
+ {
+ memberList.push_back(MemberInfo());
+ memberList.back().lowerName = fixIdent((*q)->name(), IdentToLower);
+ memberList.back().fixedName = fixIdent((*q)->name(), IdentNormal);
+ memberList.back().type = (*q)->type();
+ }
}
_out << sp << nl << "if not defined?(" << getAbsolute(p, IdentToUpper) << ')';
@@ -909,23 +909,23 @@ Slice::Ruby::CodeVisitor::visitStructStart(const StructPtr& p)
_out.inc();
if(!memberList.empty())
{
- _out << nl << "def initialize(";
- for(r = memberList.begin(); r != memberList.end(); ++r)
- {
- if(r != memberList.begin())
- {
- _out << ", ";
- }
- _out << r->lowerName << '=' << getDefaultValue(r->type);
- }
- _out << ")";
- _out.inc();
- for(r = memberList.begin(); r != memberList.end(); ++r)
- {
- _out << nl << '@' << r->fixedName << " = " << r->lowerName;
- }
- _out.dec();
- _out << nl << "end";
+ _out << nl << "def initialize(";
+ for(r = memberList.begin(); r != memberList.end(); ++r)
+ {
+ if(r != memberList.begin())
+ {
+ _out << ", ";
+ }
+ _out << r->lowerName << '=' << getDefaultValue(r->type);
+ }
+ _out << ")";
+ _out.inc();
+ for(r = memberList.begin(); r != memberList.end(); ++r)
+ {
+ _out << nl << '@' << r->fixedName << " = " << r->lowerName;
+ }
+ _out.dec();
+ _out << nl << "end";
}
//
@@ -937,7 +937,7 @@ Slice::Ruby::CodeVisitor::visitStructStart(const StructPtr& p)
int iter = 0;
for(r = memberList.begin(); r != memberList.end(); ++r)
{
- writeHash("@" + r->fixedName, r->type, iter);
+ writeHash("@" + r->fixedName, r->type, iter);
}
_out << nl << "_h % 0x7fffffff";
_out.dec();
@@ -952,11 +952,11 @@ Slice::Ruby::CodeVisitor::visitStructStart(const StructPtr& p)
_out.inc();
for(r = memberList.begin(); r != memberList.end(); ++r)
{
- if(r != memberList.begin())
- {
- _out << " or";
- }
- _out << nl << "@" << r->fixedName << " != other." << r->fixedName;
+ if(r != memberList.begin())
+ {
+ _out << " or";
+ }
+ _out << nl << "@" << r->fixedName << " != other." << r->fixedName;
}
_out.dec();
_out << nl << "true";
@@ -977,15 +977,15 @@ Slice::Ruby::CodeVisitor::visitStructStart(const StructPtr& p)
//
if(!memberList.empty())
{
- _out << sp << nl << "attr_accessor ";
- for(r = memberList.begin(); r != memberList.end(); ++r)
- {
- if(r != memberList.begin())
- {
- _out << ", ";
- }
- _out << ':' << r->fixedName;
- }
+ _out << sp << nl << "attr_accessor ";
+ for(r = memberList.begin(); r != memberList.end(); ++r)
+ {
+ if(r != memberList.begin())
+ {
+ _out << ", ";
+ }
+ _out << ':' << r->fixedName;
+ }
}
_out.dec();
@@ -1004,23 +1004,23 @@ Slice::Ruby::CodeVisitor::visitStructStart(const StructPtr& p)
//
if(memberList.size() > 1)
{
- _out.inc();
- _out << nl;
+ _out.inc();
+ _out << nl;
}
for(r = memberList.begin(); r != memberList.end(); ++r)
{
- if(r != memberList.begin())
- {
- _out << ',' << nl;
- }
- _out << "[\"" << r->fixedName << "\", ";
- writeType(r->type);
- _out << ']';
+ if(r != memberList.begin())
+ {
+ _out << ',' << nl;
+ }
+ _out << "[\"" << r->fixedName << "\", ";
+ writeType(r->type);
+ _out << ']';
}
if(memberList.size() > 1)
{
- _out.dec();
- _out << nl;
+ _out.dec();
+ _out << nl;
}
_out << "])";
@@ -1083,10 +1083,10 @@ Slice::Ruby::CodeVisitor::visitEnum(const EnumPtr& p)
_out << sp << nl << "def initialize(val)";
_out.inc();
{
- ostringstream assertion;
- assertion << "fail(\"invalid value #{val} for " << name << "\") unless(val >= 0 and val < "
- << enums.size() << ')';
- _out << nl << assertion.str();
+ ostringstream assertion;
+ assertion << "fail(\"invalid value #{val} for " << name << "\") unless(val >= 0 and val < "
+ << enums.size() << ')';
+ _out << nl << assertion.str();
}
_out << nl << "@val = val";
_out.dec();
@@ -1096,15 +1096,15 @@ Slice::Ruby::CodeVisitor::visitEnum(const EnumPtr& p)
// from_int
//
{
- _out << sp << nl << "def " << name << ".from_int(val)";
- ostringstream sz;
- sz << enums.size() - 1;
- _out.inc();
- _out << nl << "raise IndexError, \"#{val} is out of range 0.." << sz.str() << "\" if(val < 0 || val > "
- << sz.str() << ')';
- _out << nl << "@@_values[val]";
- _out.dec();
- _out << nl << "end";
+ _out << sp << nl << "def " << name << ".from_int(val)";
+ ostringstream sz;
+ sz << enums.size() - 1;
+ _out.inc();
+ _out << nl << "raise IndexError, \"#{val} is out of range 0.." << sz.str() << "\" if(val < 0 || val > "
+ << sz.str() << ')';
+ _out << nl << "@@_values[val]";
+ _out.dec();
+ _out << nl << "end";
}
//
@@ -1165,24 +1165,24 @@ Slice::Ruby::CodeVisitor::visitEnum(const EnumPtr& p)
_out << sp << nl << "@@_names = [";
for(q = enums.begin(); q != enums.end(); ++q)
{
- if(q != enums.begin())
- {
- _out << ", ";
- }
- _out << "'" << (*q)->name() << "'";
+ if(q != enums.begin())
+ {
+ _out << ", ";
+ }
+ _out << "'" << (*q)->name() << "'";
}
_out << ']';
_out << nl << "@@_values = [";
for(EnumeratorList::size_type j = 0; j < enums.size(); ++j)
{
- if(j > 0)
- {
- _out << ", ";
- }
- ostringstream idx;
- idx << j;
- _out << name << ".new(" << idx.str() << ')';
+ if(j > 0)
+ {
+ _out << ", ";
+ }
+ ostringstream idx;
+ idx << j;
+ _out << name << ".new(" << idx.str() << ')';
}
_out << ']';
@@ -1192,9 +1192,9 @@ Slice::Ruby::CodeVisitor::visitEnum(const EnumPtr& p)
_out << sp;
for(q = enums.begin(), i = 0; q != enums.end(); ++q, ++i)
{
- ostringstream idx;
- idx << i;
- _out << nl << fixIdent((*q)->name(), IdentToUpper) << " = @@_values[" << idx.str() << "]";
+ ostringstream idx;
+ idx << i;
+ _out << nl << fixIdent((*q)->name(), IdentToUpper) << " = @@_values[" << idx.str() << "]";
}
_out << sp << nl << "private_class_method :new";
@@ -1208,11 +1208,11 @@ Slice::Ruby::CodeVisitor::visitEnum(const EnumPtr& p)
_out << sp << nl << "T_" << name << " = ::Ice::__defineEnum('" << scoped << "', " << name << ", [";
for(q = enums.begin(); q != enums.end(); ++q)
{
- if(q != enums.begin())
- {
- _out << ", ";
- }
- _out << name << "::" << fixIdent((*q)->name(), IdentToUpper);
+ if(q != enums.begin())
+ {
+ _out << ", ";
+ }
+ _out << name << "::" << fixIdent((*q)->name(), IdentToUpper);
}
_out << "])";
@@ -1233,131 +1233,131 @@ Slice::Ruby::CodeVisitor::visitConst(const ConstPtr& p)
Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type);
if(b)
{
- switch(b->kind())
- {
- case Slice::Builtin::KindBool:
- {
- _out << value;
- break;
- }
- case Slice::Builtin::KindByte:
- case Slice::Builtin::KindShort:
- case Slice::Builtin::KindInt:
- case Slice::Builtin::KindFloat:
- case Slice::Builtin::KindDouble:
- {
- _out << value;
- break;
- }
- case Slice::Builtin::KindLong:
- {
- IceUtil::Int64 l;
- IceUtil::stringToInt64(value, l);
- _out << value;
- break;
- }
-
- case Slice::Builtin::KindString:
- {
- //
- // Expand strings into the basic source character set. We can't use isalpha() and the like
- // here because they are sensitive to the current locale.
- //
- static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789"
- "_{}[]#()<>%:;.?*+-/^&|~!=, '";
- static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
-
- _out << "\""; // Opening "
-
- for(string::const_iterator c = value.begin(); c != value.end(); ++c)
- {
- switch(*c)
- {
- case '"':
- {
- _out << "\\\"";
- break;
- }
- case '\\':
- {
- _out << "\\\\";
- break;
- }
- case '\r':
- {
- _out << "\\r";
- break;
- }
- case '\n':
- {
- _out << "\\n";
- break;
- }
- case '\t':
- {
- _out << "\\t";
- break;
- }
- case '\b':
- {
- _out << "\\b";
- break;
- }
- case '\f':
- {
- _out << "\\f";
- break;
- }
- default:
- {
- if(charSet.find(*c) == charSet.end())
- {
- unsigned char uc = *c; // Char may be signed, so make it positive.
- stringstream s;
- s << "\\"; // Print as octal if not in basic source character set.
- s.flags(ios_base::oct);
- s.width(3);
- s.fill('0');
- s << static_cast<unsigned>(uc);
- _out << s.str();
- }
- else
- {
- _out << *c; // Print normally if in basic source character set.
- }
- break;
- }
- }
- }
-
- _out << "\""; // Closing "
- break;
- }
-
- case Slice::Builtin::KindObject:
- case Slice::Builtin::KindObjectProxy:
- case Slice::Builtin::KindLocalObject:
- assert(false);
- }
+ switch(b->kind())
+ {
+ case Slice::Builtin::KindBool:
+ {
+ _out << value;
+ break;
+ }
+ case Slice::Builtin::KindByte:
+ case Slice::Builtin::KindShort:
+ case Slice::Builtin::KindInt:
+ case Slice::Builtin::KindFloat:
+ case Slice::Builtin::KindDouble:
+ {
+ _out << value;
+ break;
+ }
+ case Slice::Builtin::KindLong:
+ {
+ IceUtil::Int64 l;
+ IceUtil::stringToInt64(value, l);
+ _out << value;
+ break;
+ }
+
+ case Slice::Builtin::KindString:
+ {
+ //
+ // Expand strings into the basic source character set. We can't use isalpha() and the like
+ // here because they are sensitive to the current locale.
+ //
+ static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "_{}[]#()<>%:;.?*+-/^&|~!=, '";
+ static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
+
+ _out << "\""; // Opening "
+
+ for(string::const_iterator c = value.begin(); c != value.end(); ++c)
+ {
+ switch(*c)
+ {
+ case '"':
+ {
+ _out << "\\\"";
+ break;
+ }
+ case '\\':
+ {
+ _out << "\\\\";
+ break;
+ }
+ case '\r':
+ {
+ _out << "\\r";
+ break;
+ }
+ case '\n':
+ {
+ _out << "\\n";
+ break;
+ }
+ case '\t':
+ {
+ _out << "\\t";
+ break;
+ }
+ case '\b':
+ {
+ _out << "\\b";
+ break;
+ }
+ case '\f':
+ {
+ _out << "\\f";
+ break;
+ }
+ default:
+ {
+ if(charSet.find(*c) == charSet.end())
+ {
+ unsigned char uc = *c; // Char may be signed, so make it positive.
+ stringstream s;
+ s << "\\"; // Print as octal if not in basic source character set.
+ s.flags(ios_base::oct);
+ s.width(3);
+ s.fill('0');
+ s << static_cast<unsigned>(uc);
+ _out << s.str();
+ }
+ else
+ {
+ _out << *c; // Print normally if in basic source character set.
+ }
+ break;
+ }
+ }
+ }
+
+ _out << "\""; // Closing "
+ break;
+ }
+
+ case Slice::Builtin::KindObject:
+ case Slice::Builtin::KindObjectProxy:
+ case Slice::Builtin::KindLocalObject:
+ assert(false);
+ }
}
else if(en)
{
- _out << getAbsolute(en, IdentToUpper) << "::";
- string::size_type colon = value.rfind(':');
- if(colon != string::npos)
- {
- _out << fixIdent(value.substr(colon + 1), IdentToUpper);
- }
- else
- {
- _out << fixIdent(value, IdentToUpper);
- }
+ _out << getAbsolute(en, IdentToUpper) << "::";
+ string::size_type colon = value.rfind(':');
+ if(colon != string::npos)
+ {
+ _out << fixIdent(value.substr(colon + 1), IdentToUpper);
+ }
+ else
+ {
+ _out << fixIdent(value, IdentToUpper);
+ }
}
else
{
- assert(false); // Unknown const type.
+ assert(false); // Unknown const type.
}
}
@@ -1367,72 +1367,72 @@ Slice::Ruby::CodeVisitor::writeType(const TypePtr& p)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
if(builtin)
{
- switch(builtin->kind())
- {
- case Builtin::KindBool:
- {
- _out << "::Ice::T_bool";
- break;
- }
- case Builtin::KindByte:
- {
- _out << "::Ice::T_byte";
- break;
- }
- case Builtin::KindShort:
- {
- _out << "::Ice::T_short";
- break;
- }
- case Builtin::KindInt:
- {
- _out << "::Ice::T_int";
- break;
- }
- case Builtin::KindLong:
- {
- _out << "::Ice::T_long";
- break;
- }
- case Builtin::KindFloat:
- {
- _out << "::Ice::T_float";
- break;
- }
- case Builtin::KindDouble:
- {
- _out << "::Ice::T_double";
- break;
- }
- case Builtin::KindString:
- {
- _out << "::Ice::T_string";
- break;
- }
- case Builtin::KindObject:
- {
- _out << "::Ice::T_Object";
- break;
- }
- case Builtin::KindObjectProxy:
- {
- _out << "::Ice::T_ObjectPrx";
- break;
- }
- case Builtin::KindLocalObject:
- {
- _out << "::Ice::T_LocalObject";
- break;
- }
- }
- return;
+ switch(builtin->kind())
+ {
+ case Builtin::KindBool:
+ {
+ _out << "::Ice::T_bool";
+ break;
+ }
+ case Builtin::KindByte:
+ {
+ _out << "::Ice::T_byte";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ _out << "::Ice::T_short";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ _out << "::Ice::T_int";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ _out << "::Ice::T_long";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ _out << "::Ice::T_float";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ _out << "::Ice::T_double";
+ break;
+ }
+ case Builtin::KindString:
+ {
+ _out << "::Ice::T_string";
+ break;
+ }
+ case Builtin::KindObject:
+ {
+ _out << "::Ice::T_Object";
+ break;
+ }
+ case Builtin::KindObjectProxy:
+ {
+ _out << "::Ice::T_ObjectPrx";
+ break;
+ }
+ case Builtin::KindLocalObject:
+ {
+ _out << "::Ice::T_LocalObject";
+ break;
+ }
+ }
+ return;
}
ProxyPtr prx = ProxyPtr::dynamicCast(p);
if(prx)
{
- _out << getAbsolute(prx->_class(), IdentToUpper, "T_") << "Prx";
- return;
+ _out << getAbsolute(prx->_class(), IdentToUpper, "T_") << "Prx";
+ return;
}
ContainedPtr cont = ContainedPtr::dynamicCast(p);
@@ -1446,48 +1446,48 @@ Slice::Ruby::CodeVisitor::getDefaultValue(const TypePtr& p)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
if(builtin)
{
- switch(builtin->kind())
- {
- case Builtin::KindBool:
- {
- return "false";
- }
- case Builtin::KindByte:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- {
- return "0";
- }
- case Builtin::KindFloat:
- case Builtin::KindDouble:
- {
- return "0.0";
- }
- case Builtin::KindString:
- {
- return "''";
- }
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- {
- return "nil";
- }
- }
+ switch(builtin->kind())
+ {
+ case Builtin::KindBool:
+ {
+ return "false";
+ }
+ case Builtin::KindByte:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ {
+ return "0";
+ }
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ {
+ return "0.0";
+ }
+ case Builtin::KindString:
+ {
+ return "''";
+ }
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ return "nil";
+ }
+ }
}
EnumPtr en = EnumPtr::dynamicCast(p);
if(en)
{
- EnumeratorList enums = en->getEnumerators();
- return getAbsolute(en, IdentToUpper) + "::" + fixIdent(enums.front()->name(), IdentToUpper);
+ EnumeratorList enums = en->getEnumerators();
+ return getAbsolute(en, IdentToUpper) + "::" + fixIdent(enums.front()->name(), IdentToUpper);
}
StructPtr st = StructPtr::dynamicCast(p);
if(st)
{
- return getAbsolute(st, IdentToUpper) + ".new";
+ return getAbsolute(st, IdentToUpper) + ".new";
}
return "nil";
@@ -1505,19 +1505,19 @@ Slice::Ruby::CodeVisitor::collectClassMembers(const ClassDefPtr& p, MemberInfoLi
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
- collectClassMembers(bases.front(), allMembers, true);
+ collectClassMembers(bases.front(), allMembers, true);
}
DataMemberList members = p->dataMembers();
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
{
- MemberInfo m;
- m.lowerName = fixIdent((*q)->name(), IdentToLower);
- m.fixedName = fixIdent((*q)->name(), IdentNormal);
- m.type = (*q)->type();
- m.inherited = inherited;
- allMembers.push_back(m);
+ MemberInfo m;
+ m.lowerName = fixIdent((*q)->name(), IdentToLower);
+ m.fixedName = fixIdent((*q)->name(), IdentNormal);
+ m.type = (*q)->type();
+ m.inherited = inherited;
+ allMembers.push_back(m);
}
}
@@ -1527,19 +1527,19 @@ Slice::Ruby::CodeVisitor::collectExceptionMembers(const ExceptionPtr& p, MemberI
ExceptionPtr base = p->base();
if(base)
{
- collectExceptionMembers(base, allMembers, true);
+ collectExceptionMembers(base, allMembers, true);
}
DataMemberList members = p->dataMembers();
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
{
- MemberInfo m;
- m.lowerName = fixIdent((*q)->name(), IdentToLower);
- m.fixedName = fixIdent((*q)->name(), IdentNormal);
- m.type = (*q)->type();
- m.inherited = inherited;
- allMembers.push_back(m);
+ MemberInfo m;
+ m.lowerName = fixIdent((*q)->name(), IdentToLower);
+ m.fixedName = fixIdent((*q)->name(), IdentNormal);
+ m.type = (*q)->type();
+ m.inherited = inherited;
+ allMembers.push_back(m);
}
}
@@ -1551,7 +1551,7 @@ normalizePath(const string& path)
string::size_type pos;
while((pos = result.find("//")) != string::npos)
{
- result.replace(pos, 2, "/");
+ result.replace(pos, 2, "/");
}
return result;
}
@@ -1569,22 +1569,22 @@ changeInclude(const string& inc, const vector<string>& includePaths)
//
for(vector<string>::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p)
{
- string includePath = *p;
+ string includePath = *p;
- if(orig.compare(0, p->size(), *p) == 0)
- {
- string s = orig.substr(p->size());
- if(s.size() < curr.size())
- {
- curr = s;
- }
- }
+ if(orig.compare(0, p->size(), *p) == 0)
+ {
+ string s = orig.substr(p->size());
+ if(s.size() < curr.size())
+ {
+ curr = s;
+ }
+ }
}
string::size_type pos = curr.rfind('.');
if(pos != string::npos)
{
- curr.erase(pos);
+ curr.erase(pos);
}
return curr;
@@ -1597,22 +1597,22 @@ Slice::Ruby::generate(const UnitPtr& un, bool all, bool checksum, const vector<s
if(!all)
{
- vector<string> paths = includePaths;
- for(vector<string>::iterator p = paths.begin(); p != paths.end(); ++p)
- {
- if(p->size() && (*p)[p->size() - 1] != '/')
- {
- *p += '/';
- }
- *p = normalizePath(*p);
- }
+ vector<string> paths = includePaths;
+ for(vector<string>::iterator p = paths.begin(); p != paths.end(); ++p)
+ {
+ if(p->size() && (*p)[p->size() - 1] != '/')
+ {
+ *p += '/';
+ }
+ *p = normalizePath(*p);
+ }
- StringList includes = un->includeFiles();
- for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
- {
- string file = changeInclude(*q, paths);
- out << nl << "require '" << file << ".rb'";
- }
+ StringList includes = un->includeFiles();
+ for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
+ {
+ string file = changeInclude(*q, paths);
+ out << nl << "require '" << file << ".rb'";
+ }
}
CodeVisitor codeVisitor(out);
@@ -1620,23 +1620,23 @@ Slice::Ruby::generate(const UnitPtr& un, bool all, bool checksum, const vector<s
if(checksum)
{
- ChecksumMap checksums = createChecksums(un);
- if(!checksums.empty())
- {
- out << sp;
- for(ChecksumMap::const_iterator p = checksums.begin(); p != checksums.end(); ++p)
- {
- out << nl << "::Ice::SliceChecksums[\"" << p->first << "\"] = \"";
- ostringstream str;
- str.flags(ios_base::hex);
- str.fill('0');
- for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
- {
- str << (int)(*q);
- }
- out << str.str() << "\"";
- }
- }
+ ChecksumMap checksums = createChecksums(un);
+ if(!checksums.empty())
+ {
+ out << sp;
+ for(ChecksumMap::const_iterator p = checksums.begin(); p != checksums.end(); ++p)
+ {
+ out << nl << "::Ice::SliceChecksums[\"" << p->first << "\"] = \"";
+ ostringstream str;
+ str.flags(ios_base::hex);
+ str.fill('0');
+ for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ str << (int)(*q);
+ }
+ out << str.str() << "\"";
+ }
+ }
}
out << nl; // Trailing newline.
@@ -1649,36 +1649,36 @@ Slice::Ruby::splitString(const string& str, vector<string>& args, const string&
string::size_type end = 0;
while(true)
{
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- //
- // Check for quoted argument.
- //
- char ch = str[beg];
- if(ch == '"' || ch == '\'')
- {
- beg++;
- end = str.find(ch, beg);
- if(end == string::npos)
- {
- return false;
- }
- args.push_back(str.substr(beg, end - beg));
- end++; // Skip end quote.
- }
- else
- {
- end = str.find_first_of(delim + "'\"", beg);
- if(end == string::npos)
- {
- end = str.length();
- }
- args.push_back(str.substr(beg, end - beg));
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ //
+ // Check for quoted argument.
+ //
+ char ch = str[beg];
+ if(ch == '"' || ch == '\'')
+ {
+ beg++;
+ end = str.find(ch, beg);
+ if(end == string::npos)
+ {
+ return false;
+ }
+ args.push_back(str.substr(beg, end - beg));
+ end++; // Skip end quote.
+ }
+ else
+ {
+ end = str.find_first_of(delim + "'\"", beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+ args.push_back(str.substr(beg, end - beg));
+ }
}
return true;
@@ -1689,25 +1689,25 @@ Slice::Ruby::fixIdent(const string& ident, IdentStyle style)
{
if(ident[0] != ':')
{
- string id = ident;
- switch(style)
- {
- case IdentNormal:
- break;
- case IdentToUpper:
- if(id[0] >= 'a' && id[0] <= 'z')
- {
- id[0] += 'A' - 'a';
- }
- break;
- case IdentToLower:
- if(id[0] >= 'A' && id[0] <= 'Z')
- {
- id[0] += 'a' - 'A';
- }
- break;
- }
- return lookupKwd(id);
+ string id = ident;
+ switch(style)
+ {
+ case IdentNormal:
+ break;
+ case IdentToUpper:
+ if(id[0] >= 'a' && id[0] <= 'z')
+ {
+ id[0] += 'A' - 'a';
+ }
+ break;
+ case IdentToLower:
+ if(id[0] >= 'A' && id[0] <= 'Z')
+ {
+ id[0] += 'a' - 'A';
+ }
+ break;
+ }
+ return lookupKwd(id);
}
vector<string> ids = splitScopedName(ident);
@@ -1716,11 +1716,11 @@ Slice::Ruby::fixIdent(const string& ident, IdentStyle style)
ostringstream result;
for(vector<string>::size_type i = 0; i < ids.size() - 1; ++i)
{
- //
- // We assume all intermediate names must be upper-case (i.e., they represent
- // the names of modules or classes).
- //
- result << "::" << fixIdent(ids[i], IdentToUpper);
+ //
+ // We assume all intermediate names must be upper-case (i.e., they represent
+ // the names of modules or classes).
+ //
+ result << "::" << fixIdent(ids[i], IdentToUpper);
}
result << "::" << fixIdent(ids[ids.size() - 1], style);
return result.str();
@@ -1733,11 +1733,11 @@ Slice::Ruby::getAbsolute(const ContainedPtr& cont, IdentStyle style, const strin
if(prefix.empty())
{
- return scope + fixIdent(cont->name(), style);
+ return scope + fixIdent(cont->name(), style);
}
else
{
- return scope + prefix + fixIdent(cont->name(), style);
+ return scope + prefix + fixIdent(cont->name(), style);
}
}
@@ -1753,7 +1753,7 @@ Slice::Ruby::printHeader(IceUtil::Output& out)
"# ICE_LICENSE file included in this distribution.\n"
"#\n"
"# **********************************************************************\n"
- ;
+ ;
out << header;
out << "\n# Ice version " << ICE_STRING_VERSION;
diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp
index fe18bae01ef..68ce6b8942e 100755
--- a/cpp/src/Slice/VbUtil.cpp
+++ b/cpp/src/Slice/VbUtil.cpp
@@ -34,33 +34,33 @@ lookupKwd(const string& name, int baseTypes, bool mangleCasts = false)
//
static const string keywordList[] =
{
- "AddHandler", "AddressOf", "Alias", "And", "AndAlso", "Ansi", "As", "Assembly", "Auto",
- "Boolean", "ByRef", "Byte", "ByVal", "Call", "Case", "Catch", "CBool", "CByte", "CChar",
- "CDate", "CDbl", "CDec", "Char", "CInt", "Class", "CLng", "CObj", "Const", "CShort", "CSng",
- "CStr", "CType", "Date", "Decimal", "Declare", "Default", "Delegate", "Dim", "DirectCast",
- "Do", "Double", "Each", "Else", "ElseIf", "End", "EndIf", "Enum", "Erase", "Error", "Event",
- "Exit", "False", "Finally", "For", "Friend", "Function", "Get", "GetType", "GoSub", "GoTo",
- "Handles", "If", "Implements", "Imports", "In", "Inherits", "Integer", "Interface", "Is",
- "Let", "Lib", "Like", "Long", "Loop", "Me", "Mod", "Module", "MustInherit", "MustOverride",
- "MyBase", "MyClass", "Namespace", "New", "Next", "Not", "Nothing", "NotInheritable",
- "NotOverridable", "Object", "On", "Option", "Optional", "Or", "OrElse", "Overloads", "Overridable",
- "Overrides", "ParamArray", "Preserve", "Private", "Property", "Protected", "Public", "RaiseEvent",
- "ReadOnly", "ReDim", "REM", "RemoveHandler", "Resume", "Return", "Select", "Set",
- "Shadows", "Shared", "Short", "Single", "Static", "Step", "Stop", "String", "Structure",
- "Sub", "SyncLock", "Then", "Throw", "To", "True", "Try", "TypeOf", "Unicode", "Until",
- "Variant", "Wend", "When", "While", "With", "WithEvents", "WriteOnly", "Xor"
+ "AddHandler", "AddressOf", "Alias", "And", "AndAlso", "Ansi", "As", "Assembly", "Auto",
+ "Boolean", "ByRef", "Byte", "ByVal", "Call", "Case", "Catch", "CBool", "CByte", "CChar",
+ "CDate", "CDbl", "CDec", "Char", "CInt", "Class", "CLng", "CObj", "Const", "CShort", "CSng",
+ "CStr", "CType", "Date", "Decimal", "Declare", "Default", "Delegate", "Dim", "DirectCast",
+ "Do", "Double", "Each", "Else", "ElseIf", "End", "EndIf", "Enum", "Erase", "Error", "Event",
+ "Exit", "False", "Finally", "For", "Friend", "Function", "Get", "GetType", "GoSub", "GoTo",
+ "Handles", "If", "Implements", "Imports", "In", "Inherits", "Integer", "Interface", "Is",
+ "Let", "Lib", "Like", "Long", "Loop", "Me", "Mod", "Module", "MustInherit", "MustOverride",
+ "MyBase", "MyClass", "Namespace", "New", "Next", "Not", "Nothing", "NotInheritable",
+ "NotOverridable", "Object", "On", "Option", "Optional", "Or", "OrElse", "Overloads", "Overridable",
+ "Overrides", "ParamArray", "Preserve", "Private", "Property", "Protected", "Public", "RaiseEvent",
+ "ReadOnly", "ReDim", "REM", "RemoveHandler", "Resume", "Return", "Select", "Set",
+ "Shadows", "Shared", "Short", "Single", "Static", "Step", "Stop", "String", "Structure",
+ "Sub", "SyncLock", "Then", "Throw", "To", "True", "Try", "TypeOf", "Unicode", "Until",
+ "Variant", "Wend", "When", "While", "With", "WithEvents", "WriteOnly", "Xor"
};
bool found = binary_search(&keywordList[0],
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
- name,
- Slice::CICompare());
+ &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
+ name,
+ Slice::CICompare());
if(found)
{
return "[" + name + "]";
}
if(mangleCasts && (name == "checkedCast" || name == "uncheckedCast"))
{
- return string(DotNet::manglePrefix) + name;
+ return string(DotNet::manglePrefix) + name;
}
return Slice::DotNet::mangleName(name, baseTypes);
}
@@ -77,24 +77,24 @@ splitScopedName(const string& scoped)
string::size_type pos;
while((pos = scoped.find("::", next)) != string::npos)
{
- pos += 2;
- if(pos != scoped.size())
- {
- string::size_type endpos = scoped.find("::", pos);
- if(endpos != string::npos)
- {
- ids.push_back(scoped.substr(pos, endpos - pos));
- }
- }
- next = pos;
+ pos += 2;
+ if(pos != scoped.size())
+ {
+ string::size_type endpos = scoped.find("::", pos);
+ if(endpos != string::npos)
+ {
+ ids.push_back(scoped.substr(pos, endpos - pos));
+ }
+ }
+ next = pos;
}
if(next != scoped.size())
{
- ids.push_back(scoped.substr(next));
+ ids.push_back(scoped.substr(next));
}
else
{
- ids.push_back("");
+ ids.push_back("");
}
return ids;
@@ -113,26 +113,26 @@ Slice::VbGenerator::fixId(const string& name, int baseTypes, bool mangleCasts)
{
if(name.empty())
{
- return name;
+ return name;
}
if(name[0] != ':')
{
- return lookupKwd(name, baseTypes, mangleCasts);
+ return lookupKwd(name, baseTypes, mangleCasts);
}
StringList ids = splitScopedName(name);
StringList newIds;
for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
{
- newIds.push_back(lookupKwd(*i, baseTypes));
+ newIds.push_back(lookupKwd(*i, baseTypes));
}
stringstream result;
for(StringList::const_iterator j = ids.begin(); j != ids.end(); ++j)
{
- if(j != ids.begin())
- {
- result << '.';
- }
- result << *j;
+ if(j != ids.begin())
+ {
+ result << '.';
+ }
+ result << *j;
}
return result.str();
}
@@ -163,7 +163,7 @@ Slice::VbGenerator::typeToString(const TypePtr& type)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- return builtinTable[builtin->kind()];
+ return builtinTable[builtin->kind()];
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
@@ -175,7 +175,7 @@ Slice::VbGenerator::typeToString(const TypePtr& type)
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq && !seq->hasMetaData("clr:collection"))
{
- return typeToString(seq->type()) + "()";
+ return typeToString(seq->type()) + "()";
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
@@ -194,60 +194,60 @@ Slice::VbGenerator::isValueType(const TypePtr& type)
if(builtin)
{
switch(builtin->kind())
- {
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- {
- return false;
- break;
- }
- default:
- {
- return true;
- break;
- }
- }
+ {
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ return false;
+ break;
+ }
+ default:
+ {
+ return true;
+ break;
+ }
+ }
}
StructPtr s = StructPtr::dynamicCast(type);
if(s)
{
- if(s->hasMetaData("clr:class"))
- {
- return false;
- }
- DataMemberList dm = s->dataMembers();
- for(DataMemberList::const_iterator i = dm.begin(); i != dm.end(); ++i)
- {
- if(!isValueType((*i)->type()))
- {
- return false;
- }
- }
- return true;
+ if(s->hasMetaData("clr:class"))
+ {
+ return false;
+ }
+ DataMemberList dm = s->dataMembers();
+ for(DataMemberList::const_iterator i = dm.begin(); i != dm.end(); ++i)
+ {
+ if(!isValueType((*i)->type()))
+ {
+ return false;
+ }
+ }
+ return true;
}
if(EnumPtr::dynamicCast(type))
{
- return true;
+ return true;
}
return false;
}
void
Slice::VbGenerator::writeMarshalUnmarshalCode(Output &out,
- const TypePtr& type,
- const string& param,
- bool marshal,
- bool streamingAPI,
- bool isOutParam,
- const string& patchParams)
+ const TypePtr& type,
+ const string& param,
+ bool marshal,
+ bool streamingAPI,
+ bool isOutParam,
+ const string& patchParams)
{
string stream;
if(marshal)
{
- stream = streamingAPI ? "outS__" : "os__";
+ stream = streamingAPI ? "outS__" : "os__";
}
else
{
@@ -363,32 +363,32 @@ Slice::VbGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- if(isOutParam)
- {
- out << nl << "Dim " << param
- << "_PP As IceInternal.ParamPatcher = New IceInternal.ParamPatcher(GetType(Ice.Object), "
- << "\"::Ice::Object\")";
- if(streamingAPI)
- {
- out << nl << stream << ".readObject(CType(" << param << "_PP, Ice.ReadObjectCallback))";
- }
- else
- {
- out << nl << stream << ".readObject(" << param << "_PP)";
- }
- }
- else
- {
- if(streamingAPI)
- {
- out << nl << stream << ".readObject(CType(New Patcher__(" << patchParams
- << ", Ice.ReadObjectCallback)))";
- }
- else
- {
- out << nl << stream << ".readObject(New Patcher__(" << patchParams << "))";
- }
- }
+ if(isOutParam)
+ {
+ out << nl << "Dim " << param
+ << "_PP As IceInternal.ParamPatcher = New IceInternal.ParamPatcher(GetType(Ice.Object), "
+ << "\"::Ice::Object\")";
+ if(streamingAPI)
+ {
+ out << nl << stream << ".readObject(CType(" << param << "_PP, Ice.ReadObjectCallback))";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(" << param << "_PP)";
+ }
+ }
+ else
+ {
+ if(streamingAPI)
+ {
+ out << nl << stream << ".readObject(CType(New Patcher__(" << patchParams
+ << ", Ice.ReadObjectCallback)))";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(New Patcher__(" << patchParams << "))";
+ }
+ }
}
break;
}
@@ -416,25 +416,25 @@ Slice::VbGenerator::writeMarshalUnmarshalCode(Output &out,
ProxyPtr prx = ProxyPtr::dynamicCast(type);
if(prx)
{
- ContainedPtr contained = ContainedPtr::dynamicCast(type);
- string helperName = fixId((contained ? contained->scoped() : typeToString(type)) + "Helper");
+ ContainedPtr contained = ContainedPtr::dynamicCast(type);
+ string helperName = fixId((contained ? contained->scoped() : typeToString(type)) + "Helper");
if(marshal)
{
out << nl << helperName << ".write";
- if(!streamingAPI)
- {
- out << "__";
- }
- out << '(' << stream << ", " << param << ')';
+ if(!streamingAPI)
+ {
+ out << "__";
+ }
+ out << '(' << stream << ", " << param << ')';
}
else
{
out << nl << param << " = " << helperName << ".read";
- if(!streamingAPI)
- {
- out << "__";
- }
- out << "(" << stream << ')';
+ if(!streamingAPI)
+ {
+ out << "__";
+ }
+ out << "(" << stream << ')';
}
return;
}
@@ -448,33 +448,33 @@ Slice::VbGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- if(isOutParam)
- {
- ContainedPtr contained = ContainedPtr::dynamicCast(type);
- out << nl << "Dim " << param
- << "_PP As IceInternal.ParamPatcher = New IceInternal.ParamPatcher(GetType("
- << typeToString(type) << "), \"" << contained->scoped() << "\")";
- if(streamingAPI)
- {
- out << nl << stream << ".readObject(CType(" << param << "_PP, Ice.ReadObjectCallback))";
- }
- else
- {
- out << nl << stream << ".readObject(" << param << "_PP)";
- }
- }
- else
- {
- if(streamingAPI)
- {
- out << nl << stream << ".readObject(New Patcher__(CType(" << patchParams
- << ", Ice.ReadObjectCallback)))";
- }
- else
- {
- out << nl << stream << ".readObject(New Patcher__(" << patchParams << "))";
- }
- }
+ if(isOutParam)
+ {
+ ContainedPtr contained = ContainedPtr::dynamicCast(type);
+ out << nl << "Dim " << param
+ << "_PP As IceInternal.ParamPatcher = New IceInternal.ParamPatcher(GetType("
+ << typeToString(type) << "), \"" << contained->scoped() << "\")";
+ if(streamingAPI)
+ {
+ out << nl << stream << ".readObject(CType(" << param << "_PP, Ice.ReadObjectCallback))";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(" << param << "_PP)";
+ }
+ }
+ else
+ {
+ if(streamingAPI)
+ {
+ out << nl << stream << ".readObject(New Patcher__(CType(" << patchParams
+ << ", Ice.ReadObjectCallback)))";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(New Patcher__(" << patchParams << "))";
+ }
+ }
}
return;
}
@@ -484,27 +484,27 @@ Slice::VbGenerator::writeMarshalUnmarshalCode(Output &out,
{
if(marshal)
{
- if(streamingAPI)
- {
- out << nl << param << ".ice_write(" << stream << ')';
- }
- else
- {
- out << nl << param << ".write__(" << stream << ')';
- }
+ if(streamingAPI)
+ {
+ out << nl << param << ".ice_write(" << stream << ')';
+ }
+ else
+ {
+ out << nl << param << ".write__(" << stream << ')';
+ }
}
else
{
string typeS = typeToString(type);
out << nl << param << " = New " << typeS;
- if(streamingAPI)
- {
- out << nl << param << ".ice_read(" << stream << ")";
- }
- else
- {
- out << nl << param << ".read__(" << stream << ")";
- }
+ if(streamingAPI)
+ {
+ out << nl << param << ".ice_read(" << stream << ")";
+ }
+ else
+ {
+ out << nl << param << ".read__(" << stream << ")";
+ }
}
return;
}
@@ -512,32 +512,32 @@ Slice::VbGenerator::writeMarshalUnmarshalCode(Output &out,
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- string func;
- string cast;
- size_t sz = en->getEnumerators().size();
- if(sz <= 0x7f)
- {
- func = marshal ? "writeByte" : "readByte";
- cast = marshal ? string("Byte") : fixId(en->scoped());
- }
- else if(sz <= 0x7fff)
- {
- func = marshal ? "writeShort" : "readShort";
- cast = marshal ? string("Short") : fixId(en->scoped());
- }
- else
- {
- func = marshal ? "writeInt" : "readInt";
- cast = marshal ? string("Integer") : fixId(en->scoped());
- }
- if(marshal)
- {
- out << nl << stream << '.' << func << "(CType(" << param << ", " << cast << "))";
- }
- else
- {
- out << nl << param << " = CType(" << stream << '.' << func << "(), " << cast << ')';
- }
+ string func;
+ string cast;
+ size_t sz = en->getEnumerators().size();
+ if(sz <= 0x7f)
+ {
+ func = marshal ? "writeByte" : "readByte";
+ cast = marshal ? string("Byte") : fixId(en->scoped());
+ }
+ else if(sz <= 0x7fff)
+ {
+ func = marshal ? "writeShort" : "readShort";
+ cast = marshal ? string("Short") : fixId(en->scoped());
+ }
+ else
+ {
+ func = marshal ? "writeInt" : "readInt";
+ cast = marshal ? string("Integer") : fixId(en->scoped());
+ }
+ if(marshal)
+ {
+ out << nl << stream << '.' << func << "(CType(" << param << ", " << cast << "))";
+ }
+ else
+ {
+ out << nl << param << " = CType(" << stream << '.' << func << "(), " << cast << ')';
+ }
return;
}
@@ -565,7 +565,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
const SequencePtr& seq,
const string& param,
bool marshal,
- bool streamingAPI)
+ bool streamingAPI)
{
string stream;
if(marshal)
@@ -586,36 +586,36 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- switch(builtin->kind())
- {
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- {
- if(marshal)
- {
- out << nl << "If " << param << " Is Nothing Then";
- out.inc();
- out << nl << stream << ".writeSize(0)";
- out.dec();
- out << nl << "Else";
- out.inc();
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
- out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
- out.inc();
- string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy";
- out << nl << stream << '.' << func << '(' << param << "(ix__))";
- out.dec();
- out << nl << "Next";
- out.dec();
- out << nl << "End If";
- }
- else
- {
- out << nl << "For block__ As Integer = 0 To 0";
- out.inc();
- out << nl << "Dim lenx__ As Integer = " << stream << ".readSize()";
- if(!streamingAPI)
- {
+ switch(builtin->kind())
+ {
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ {
+ if(marshal)
+ {
+ out << nl << "If " << param << " Is Nothing Then";
+ out.inc();
+ out << nl << stream << ".writeSize(0)";
+ out.dec();
+ out << nl << "Else";
+ out.inc();
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
+ out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
+ out.inc();
+ string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy";
+ out << nl << stream << '.' << func << '(' << param << "(ix__))";
+ out.dec();
+ out << nl << "Next";
+ out.dec();
+ out << nl << "End If";
+ }
+ else
+ {
+ out << nl << "For block__ As Integer = 0 To 0";
+ out.inc();
+ out << nl << "Dim lenx__ As Integer = " << stream << ".readSize()";
+ if(!streamingAPI)
+ {
if(builtin->isVariableLength())
{
out << nl << stream << ".startSeq(lenx__, " << static_cast<unsigned>(builtin->minWireSize())
@@ -626,127 +626,127 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << stream << ".checkFixedSeq(lenx__, "
<< static_cast<unsigned>(builtin->minWireSize()) << ")";
}
- }
- out << nl << param << " = New ";
- if(builtin->kind() == Builtin::KindObject)
- {
- if(isArray)
- {
- out << "Ice.Object(lenx__ - 1) {}";
- }
- else
- {
- out << typeToString(seq);
- }
- out << nl << "For ix__ As Integer = 0 To lenx__ - 1";
- out.inc();
- if(streamingAPI)
- {
- out << nl << stream << ".readObject(CType(New IceInternal.SequencePatcher("
- << param << ", GetType(Ice.Object), ix__), Ice.ReadObjectCallback))";
- }
- else
- {
- out << nl << stream << ".readObject(New IceInternal.SequencePatcher("
- << param << ", GetType(Ice.Object), ix__))";
- }
- out.dec();
- out << nl << "Next";
- }
- else
- {
- if(isArray)
- {
- out << "Ice.ObjectPrx(lenx__ - 1) {}";
- }
- else
- {
- out << typeToString(seq);
- }
- out << nl << "For ix__ As Integer = 0 To lenx__ - 1";
- out.inc();
- if(isArray)
- {
- out << nl << param << "(ix__) = " << stream << ".readProxy()";
- }
- else
- {
- out << nl << "Dim val__ As Ice.ObjectPrx = New Ice.ObjectPrxHelperBase";
- out << nl << "val__ = " << stream << ".readProxy()";
- out << nl << param << ".Add(val__)";
- }
- out.dec();
- out << nl << "Next";
- }
- if(!streamingAPI && builtin->isVariableLength())
- {
- out << nl << stream << ".checkSeq()";
- out << nl << stream << ".endElement()";
- out << nl << stream << ".endSeq(lenx__)";
- }
- out.dec();
- out << nl << "Next";
- }
- break;
- }
- default:
- {
- string marshalName = builtin->kindAsString();
- marshalName[0] = toupper(marshalName[0]);
- if(marshal)
- {
- out << nl << stream << ".write" << marshalName << "Seq(" << param;
- if(!isArray)
- {
- out << ".ToArray()";
- }
- out << ')';
- }
- else
- {
- if(!isArray)
- {
- out << nl << param << " = New " << fixId(seq->scoped())
- << '(' << stream << ".read" << marshalName << "Seq())";
- }
- else
- {
- out << nl << param << " = " << stream << ".read" << marshalName << "Seq()";
- }
- }
- break;
- }
- }
- return;
+ }
+ out << nl << param << " = New ";
+ if(builtin->kind() == Builtin::KindObject)
+ {
+ if(isArray)
+ {
+ out << "Ice.Object(lenx__ - 1) {}";
+ }
+ else
+ {
+ out << typeToString(seq);
+ }
+ out << nl << "For ix__ As Integer = 0 To lenx__ - 1";
+ out.inc();
+ if(streamingAPI)
+ {
+ out << nl << stream << ".readObject(CType(New IceInternal.SequencePatcher("
+ << param << ", GetType(Ice.Object), ix__), Ice.ReadObjectCallback))";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(New IceInternal.SequencePatcher("
+ << param << ", GetType(Ice.Object), ix__))";
+ }
+ out.dec();
+ out << nl << "Next";
+ }
+ else
+ {
+ if(isArray)
+ {
+ out << "Ice.ObjectPrx(lenx__ - 1) {}";
+ }
+ else
+ {
+ out << typeToString(seq);
+ }
+ out << nl << "For ix__ As Integer = 0 To lenx__ - 1";
+ out.inc();
+ if(isArray)
+ {
+ out << nl << param << "(ix__) = " << stream << ".readProxy()";
+ }
+ else
+ {
+ out << nl << "Dim val__ As Ice.ObjectPrx = New Ice.ObjectPrxHelperBase";
+ out << nl << "val__ = " << stream << ".readProxy()";
+ out << nl << param << ".Add(val__)";
+ }
+ out.dec();
+ out << nl << "Next";
+ }
+ if(!streamingAPI && builtin->isVariableLength())
+ {
+ out << nl << stream << ".checkSeq()";
+ out << nl << stream << ".endElement()";
+ out << nl << stream << ".endSeq(lenx__)";
+ }
+ out.dec();
+ out << nl << "Next";
+ }
+ break;
+ }
+ default:
+ {
+ string marshalName = builtin->kindAsString();
+ marshalName[0] = toupper(marshalName[0]);
+ if(marshal)
+ {
+ out << nl << stream << ".write" << marshalName << "Seq(" << param;
+ if(!isArray)
+ {
+ out << ".ToArray()";
+ }
+ out << ')';
+ }
+ else
+ {
+ if(!isArray)
+ {
+ out << nl << param << " = New " << fixId(seq->scoped())
+ << '(' << stream << ".read" << marshalName << "Seq())";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".read" << marshalName << "Seq()";
+ }
+ }
+ break;
+ }
+ }
+ return;
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- out << nl << "For block__ As Integer = 0 To 0";
- out.inc();
+ out << nl << "For block__ As Integer = 0 To 0";
+ out.inc();
if(marshal)
{
- out << nl << "If " << param << " Is Nothing";
- out.inc();
- out << nl << stream << ".writeSize(0)";
- out.dec();
- out << nl << "Else";
- out.inc();
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
- out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
- out.inc();
+ out << nl << "If " << param << " Is Nothing";
+ out.inc();
+ out << nl << stream << ".writeSize(0)";
+ out.dec();
+ out << nl << "Else";
+ out.inc();
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
+ out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
+ out.inc();
out << nl << stream << ".writeObject(" << param << "(ix__))";
- out.dec();
- out << nl << "Next";
- out.dec();
- out << nl << "End If";
+ out.dec();
+ out << nl << "Next";
+ out.dec();
+ out << nl << "End If";
}
else
{
- out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
- if(!streamingAPI)
- {
+ out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
+ if(!streamingAPI)
+ {
if(type->isVariableLength())
{
out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ')';
@@ -755,79 +755,79 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ')';
}
- }
- out << nl << param << " = New ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << nl << "For ix__ As Integer = 0 To szx__ - 1";
- out.inc();
- out << nl << "Dim spx__ As IceInternal.SequencePatcher = New IceInternal.SequencePatcher("
- << param << ", " << "GetType(" << typeS << "), ix__)";
- if(streamingAPI)
- {
- out << nl << stream << ".readObject(CType(spx__, Ice.ReadObjectCallback))";
- }
- else
- {
- out << nl << stream << ".readObject(spx__)";
- }
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".checkSeq()";
- out << nl << stream << ".endElement()";
- }
- out.dec();
- out << nl << "Next";
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".endSeq(szx__)";
- }
+ }
+ out << nl << param << " = New ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << nl << "For ix__ As Integer = 0 To szx__ - 1";
+ out.inc();
+ out << nl << "Dim spx__ As IceInternal.SequencePatcher = New IceInternal.SequencePatcher("
+ << param << ", " << "GetType(" << typeS << "), ix__)";
+ if(streamingAPI)
+ {
+ out << nl << stream << ".readObject(CType(spx__, Ice.ReadObjectCallback))";
+ }
+ else
+ {
+ out << nl << stream << ".readObject(spx__)";
+ }
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".checkSeq()";
+ out << nl << stream << ".endElement()";
+ }
+ out.dec();
+ out << nl << "Next";
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(szx__)";
+ }
}
- out.dec();
- out << nl << "Next";
+ out.dec();
+ out << nl << "Next";
return;
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- out << nl << "For block__ As Integer = 0 To 0";
- out.inc();
+ out << nl << "For block__ As Integer = 0 To 0";
+ out.inc();
if(marshal)
- {
- out << nl << "If " << param << " Is Nothing";
- out.inc();
- out << nl << stream << ".writeSize(0)";
- out.dec();
- out << nl << "Else";
- out.inc();
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
- out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
- out.inc();
- if(streamingAPI)
- {
- out << nl << param << "(ix__).ice_write(" << stream << ")";
- }
- else
- {
- out << nl << param << "(ix__).write__(" << stream << ")";
- }
- out.dec();
- out << nl << "Next";
- out.dec();
- out << nl << "End If";
- }
- else
- {
- out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
- if(!streamingAPI)
- {
+ {
+ out << nl << "If " << param << " Is Nothing";
+ out.inc();
+ out << nl << stream << ".writeSize(0)";
+ out.dec();
+ out << nl << "Else";
+ out.inc();
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
+ out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
+ out.inc();
+ if(streamingAPI)
+ {
+ out << nl << param << "(ix__).ice_write(" << stream << ")";
+ }
+ else
+ {
+ out << nl << param << "(ix__).write__(" << stream << ")";
+ }
+ out.dec();
+ out << nl << "Next";
+ out.dec();
+ out << nl << "End If";
+ }
+ else
+ {
+ out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
+ if(!streamingAPI)
+ {
if(type->isVariableLength())
{
out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ')';
@@ -836,164 +836,164 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ')';
}
- }
- out << nl << param << " = New ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << nl << "For ix__ As Integer = 0 To szx__ - 1";
- out.inc();
- if(isArray)
- {
- if(!isValueType(st))
- {
- out << nl << param << "(ix__) = New " << typeS;
- }
- if(streamingAPI)
- {
- out << nl << param << "(ix__).ice_read(" << stream << ")";
- }
- else
- {
- out << nl << param << "(ix__).read__(" << stream << ")";
- }
- }
- else
- {
- out << nl << "Dim val__ As " << typeS << " = New " << typeS;
- if(streamingAPI)
- {
- out << nl << "val__.ice_read(" << stream << ')';
- }
- else
- {
- out << nl << "val__.read__(" << stream << ')';
- }
- out << nl << param << ".Add(val__)";
- }
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".checkSeq()";
- out << nl << stream << ".endElement()";
- }
- out.dec();
- out << nl << "Next";
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".endSeq(szx__)";
- }
- }
- out.dec();
- out << nl << "Next";
- return;
+ }
+ out << nl << param << " = New ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << nl << "For ix__ As Integer = 0 To szx__ - 1";
+ out.inc();
+ if(isArray)
+ {
+ if(!isValueType(st))
+ {
+ out << nl << param << "(ix__) = New " << typeS;
+ }
+ if(streamingAPI)
+ {
+ out << nl << param << "(ix__).ice_read(" << stream << ")";
+ }
+ else
+ {
+ out << nl << param << "(ix__).read__(" << stream << ")";
+ }
+ }
+ else
+ {
+ out << nl << "Dim val__ As " << typeS << " = New " << typeS;
+ if(streamingAPI)
+ {
+ out << nl << "val__.ice_read(" << stream << ')';
+ }
+ else
+ {
+ out << nl << "val__.read__(" << stream << ')';
+ }
+ out << nl << param << ".Add(val__)";
+ }
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".checkSeq()";
+ out << nl << stream << ".endElement()";
+ }
+ out.dec();
+ out << nl << "Next";
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(szx__)";
+ }
+ }
+ out.dec();
+ out << nl << "Next";
+ return;
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- out << nl << "For block__ As Integer = 0 To 0";
- out.inc();
- if(marshal)
- {
- out << nl << "If " << param << " Is Nothing";
- out.inc();
- out << nl << stream << ".writeSize(0)";
- out.dec();
- out << nl << "Else";
- out.inc();
- out << nl << stream << ".writeSize(" << param << '.'<< limitID << ')';
- out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
- out.inc();
- out << nl << stream << ".writeByte(CType(" << param << "(ix__), Byte))";
- out.dec();
- out << nl << "Next";
- out.dec();
- out << nl << "End If";
- }
- else
- {
- out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
- if(!streamingAPI)
- {
- out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ')';
- }
- out << nl << param << " = New ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << nl << "For ix__ As Integer = 0 To szx__ - 1";
- out.inc();
- if(isArray)
- {
- out << nl << param << "(ix__) = CType(" << stream << ".readByte(), " << typeS << ')';
- }
- else
- {
- out << nl << param << ".Add(CType(" << stream << ".readByte(), " << typeS << "))";
- }
- out.dec();
- out << nl << "Next";
- }
- out.dec();
- out << nl << "Next";
+ out << nl << "For block__ As Integer = 0 To 0";
+ out.inc();
+ if(marshal)
+ {
+ out << nl << "If " << param << " Is Nothing";
+ out.inc();
+ out << nl << stream << ".writeSize(0)";
+ out.dec();
+ out << nl << "Else";
+ out.inc();
+ out << nl << stream << ".writeSize(" << param << '.'<< limitID << ')';
+ out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
+ out.inc();
+ out << nl << stream << ".writeByte(CType(" << param << "(ix__), Byte))";
+ out.dec();
+ out << nl << "Next";
+ out.dec();
+ out << nl << "End If";
+ }
+ else
+ {
+ out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
+ if(!streamingAPI)
+ {
+ out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ')';
+ }
+ out << nl << param << " = New ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << nl << "For ix__ As Integer = 0 To szx__ - 1";
+ out.inc();
+ if(isArray)
+ {
+ out << nl << param << "(ix__) = CType(" << stream << ".readByte(), " << typeS << ')';
+ }
+ else
+ {
+ out << nl << param << ".Add(CType(" << stream << ".readByte(), " << typeS << "))";
+ }
+ out.dec();
+ out << nl << "Next";
+ }
+ out.dec();
+ out << nl << "Next";
return;
}
string helperName;
if(ProxyPtr::dynamicCast(type))
{
- helperName = fixId(ProxyPtr::dynamicCast(type)->_class()->scoped() + "PrxHelper");
+ helperName = fixId(ProxyPtr::dynamicCast(type)->_class()->scoped() + "PrxHelper");
}
else
{
- helperName = fixId(ContainedPtr::dynamicCast(type)->scoped() + "Helper");
+ helperName = fixId(ContainedPtr::dynamicCast(type)->scoped() + "Helper");
}
string func;
if(marshal)
{
- func = "write";
- if(!streamingAPI && ProxyPtr::dynamicCast(type))
- {
- func += "__";
- }
- out << nl << "If " << param << " Is Nothing";
- out.inc();
- out << nl << stream << ".writeSize(0)";
- out.dec();
- out << nl << "Else";
- out.inc();
- out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
- out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
- out.inc();
- out << nl << helperName << '.' << func << '(' << stream << ", " << param << "(ix__))";
- out.dec();
- out << nl << "Next";
- out.dec();
- out << nl << "End If";
+ func = "write";
+ if(!streamingAPI && ProxyPtr::dynamicCast(type))
+ {
+ func += "__";
+ }
+ out << nl << "If " << param << " Is Nothing";
+ out.inc();
+ out << nl << stream << ".writeSize(0)";
+ out.dec();
+ out << nl << "Else";
+ out.inc();
+ out << nl << stream << ".writeSize(" << param << '.' << limitID << ")";
+ out << nl << "For ix__ As Integer = 0 To " << param << '.' << limitID << " - 1";
+ out.inc();
+ out << nl << helperName << '.' << func << '(' << stream << ", " << param << "(ix__))";
+ out.dec();
+ out << nl << "Next";
+ out.dec();
+ out << nl << "End If";
}
else
{
func = "read";
- if(!streamingAPI && ProxyPtr::dynamicCast(type))
- {
- func += "__";
- }
- out << nl << "For block__ As Integer = 0 To 0";
- out.inc();
- out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
- if(!streamingAPI)
- {
+ if(!streamingAPI && ProxyPtr::dynamicCast(type))
+ {
+ func += "__";
+ }
+ out << nl << "For block__ As Integer = 0 To 0";
+ out.inc();
+ out << nl << "Dim szx__ As Integer = " << stream << ".readSize()";
+ if(!streamingAPI)
+ {
if(type->isVariableLength())
{
out << nl << stream << ".startSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ")";
@@ -1002,42 +1002,42 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << stream << ".checkFixedSeq(szx__, " << static_cast<unsigned>(type->minWireSize()) << ")";
}
- }
- out << nl << param << " = New ";
- if(isArray)
- {
- out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
- }
- else
- {
- out << fixId(seq->scoped()) << "(szx__)";
- }
- out << nl << "For ix__ As Integer = 0 To szx__ - 1";
- out.inc();
- if(isArray)
- {
- out << nl << param << "(ix__) = " << helperName << '.' << func << '(' << stream << ")";
- }
- else
- {
- out << nl << param << ".Add(" << helperName << '.' << func << '(' << stream << "))";
- }
- if(!streamingAPI && type->isVariableLength())
- {
- if(!SequencePtr::dynamicCast(type))
- {
- out << nl << stream << ".checkSeq()";
- }
+ }
+ out << nl << param << " = New ";
+ if(isArray)
+ {
+ out << toArrayAlloc(typeS + "()", "szx__ - 1") << " {}";
+ }
+ else
+ {
+ out << fixId(seq->scoped()) << "(szx__)";
+ }
+ out << nl << "For ix__ As Integer = 0 To szx__ - 1";
+ out.inc();
+ if(isArray)
+ {
+ out << nl << param << "(ix__) = " << helperName << '.' << func << '(' << stream << ")";
+ }
+ else
+ {
+ out << nl << param << ".Add(" << helperName << '.' << func << '(' << stream << "))";
+ }
+ if(!streamingAPI && type->isVariableLength())
+ {
+ if(!SequencePtr::dynamicCast(type))
+ {
+ out << nl << stream << ".checkSeq()";
+ }
out << nl << stream << ".endElement()";
- }
- out.dec();
- out << nl << "Next";
- if(!streamingAPI && type->isVariableLength())
- {
- out << nl << stream << ".endSeq(szx__)";
- }
- out.dec();
- out << nl << "Next";
+ }
+ out.dec();
+ out << nl << "Next";
+ if(!streamingAPI && type->isVariableLength())
+ {
+ out << nl << stream << ".endSeq(szx__)";
+ }
+ out.dec();
+ out << nl << "Next";
}
return;
@@ -1051,7 +1051,7 @@ Slice::VbGenerator::toArrayAlloc(const string& decl, const string& sz)
while(pos > 1 && decl.substr(pos - 2, 2) == "()")
{
++count;
- pos -= 2;
+ pos -= 2;
}
assert(count > 0);
@@ -1077,31 +1077,31 @@ Slice::VbGenerator::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
{
if(!_globalMetaDataDone)
{
- //
- // Validate global metadata.
- //
- DefinitionContextPtr dc = p->definitionContext();
- assert(dc);
- StringList globalMetaData = dc->getMetaData();
- string file = dc->filename();
- static const string prefix = "vb:";
- for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
- {
- string s = *q;
- if(_history.count(s) == 0)
- {
- if(s.find(prefix) == 0)
- {
- static const string attributePrefix = "vb:attribute:";
- if(s.find(attributePrefix) != 0 || s.size() == attributePrefix.size())
- {
- cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
- }
- }
- _history.insert(s);
- }
- }
- _globalMetaDataDone = true;
+ //
+ // Validate global metadata.
+ //
+ DefinitionContextPtr dc = p->definitionContext();
+ assert(dc);
+ StringList globalMetaData = dc->getMetaData();
+ string file = dc->filename();
+ static const string prefix = "vb:";
+ for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
+ {
+ string s = *q;
+ if(_history.count(s) == 0)
+ {
+ if(s.find(prefix) == 0)
+ {
+ static const string attributePrefix = "vb:attribute:";
+ if(s.find(attributePrefix) != 0 || s.size() == attributePrefix.size())
+ {
+ cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
+ }
+ }
+ _history.insert(s);
+ }
+ }
+ _globalMetaDataDone = true;
}
validate(p);
return true;
@@ -1209,83 +1209,83 @@ Slice::VbGenerator::MetaDataVisitor::validate(const ContainedPtr& cont)
for(p = localMetaData.begin(); p != localMetaData.end(); ++p)
{
- string s = *p;
+ string s = *p;
- if(s.find("vb:") == 0) // TODO: remove this statement once "vb:" is a hard error.
- {
- if(SequencePtr::dynamicCast(cont))
- {
- if(s.substr(3) == "collection")
- {
- cout << file << ":" << cont->line() << ": warning: `vb:' metadata prefix is deprecated; "
- << "use `clr:' instead" << endl;
- cont->addMetaData("clr:collection");
- }
- }
- else if(StructPtr::dynamicCast(cont))
- {
- if(s.substr(3) == "class")
- {
- cout << file << ":" << cont->line() << ": warning: `vb:' metadata prefix is deprecated; "
- << "use `clr:' instead" << endl;
- cont->addMetaData("clr:class");
- }
- }
- else if(s.find("vb:attribute:") == 0)
- {
- ; // Do nothing, "vb:attribute:" is OK
- }
- else
- {
- cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
- }
- } // End TODO
+ if(s.find("vb:") == 0) // TODO: remove this statement once "vb:" is a hard error.
+ {
+ if(SequencePtr::dynamicCast(cont))
+ {
+ if(s.substr(3) == "collection")
+ {
+ cout << file << ":" << cont->line() << ": warning: `vb:' metadata prefix is deprecated; "
+ << "use `clr:' instead" << endl;
+ cont->addMetaData("clr:collection");
+ }
+ }
+ else if(StructPtr::dynamicCast(cont))
+ {
+ if(s.substr(3) == "class")
+ {
+ cout << file << ":" << cont->line() << ": warning: `vb:' metadata prefix is deprecated; "
+ << "use `clr:' instead" << endl;
+ cont->addMetaData("clr:class");
+ }
+ }
+ else if(s.find("vb:attribute:") == 0)
+ {
+ ; // Do nothing, "vb:attribute:" is OK
+ }
+ else
+ {
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ }
+ } // End TODO
- string prefix = "clr:";
+ string prefix = "clr:";
if(_history.count(s) == 0)
{
if(s.find(prefix) == 0)
{
- if(SequencePtr::dynamicCast(cont))
- {
- if(s.substr(prefix.size()) == "collection")
- {
- continue;
- }
- }
- if(StructPtr::dynamicCast(cont))
- {
- if(s.substr(prefix.size()) == "class")
- {
- continue;
- }
- if(s.substr(prefix.size()) == "property")
- {
- continue;
- }
- }
- if(ClassDefPtr::dynamicCast(cont))
- {
- if(s.substr(prefix.size()) == "property")
- {
- continue;
- }
- }
- cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ if(SequencePtr::dynamicCast(cont))
+ {
+ if(s.substr(prefix.size()) == "collection")
+ {
+ continue;
+ }
+ }
+ if(StructPtr::dynamicCast(cont))
+ {
+ if(s.substr(prefix.size()) == "class")
+ {
+ continue;
+ }
+ if(s.substr(prefix.size()) == "property")
+ {
+ continue;
+ }
+ }
+ if(ClassDefPtr::dynamicCast(cont))
+ {
+ if(s.substr(prefix.size()) == "property")
+ {
+ continue;
+ }
+ }
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
}
_history.insert(s);
}
- prefix = "vb:";
+ prefix = "vb:";
if(_history.count(s) == 0)
{
if(s.find(prefix) == 0)
{
- if(s.substr(prefix.size()) == "attribute:")
- {
- continue;
- }
- cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ if(s.substr(prefix.size()) == "attribute:")
+ {
+ continue;
+ }
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
}
_history.insert(s);
}
diff --git a/cpp/src/ca/ImportKey.java b/cpp/src/ca/ImportKey.java
index 117de0f46fb..a8a41e0e932 100644
--- a/cpp/src/ca/ImportKey.java
+++ b/cpp/src/ca/ImportKey.java
@@ -23,108 +23,108 @@ public class ImportKey
static private char[]
readPassword(String f)
{
- try
- {
- java.io.InputStream s = new java.io.FileInputStream(f);
- int n = s.available();
- byte[] raw = new byte[n];
- s.read(raw);
- s.close();
-
- return (new String(raw)).toCharArray();
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- System.exit(1);
- }
- return null;
+ try
+ {
+ java.io.InputStream s = new java.io.FileInputStream(f);
+ int n = s.available();
+ byte[] raw = new byte[n];
+ s.read(raw);
+ s.close();
+
+ return (new String(raw)).toCharArray();
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ System.exit(1);
+ }
+ return null;
}
-
+
public static void
main(String[] args)
{
- if(args.length < 5)
- {
- //
- // Arguments:
- //
- // pkcs12-file A file in PKCS12 format that contains the
- // private key and certificate chain.
- //
- // alias The key's friendly name in pkcs12-file and the
- // alias for the key in the new keystore.
- //
- // cert-file The CA certificate file in DER format.
- //
- // keystore-file The name of the keystore file to update
- // or create.
- //
- // store-password The file containing the password to use
- // for the keystore.
- //
- // key-password The file containing the password to use
- // for the key.
- //
- // kstore-password The file containing the password to use
- // to store the key. If this isn't provided the
- // key-password is used. This is used to import an
- // unprotected private key.
- //
- System.err.println("Usage: ImportKey pkcs12-file alias cert-file " +
- "keystore-file store-password key-password [kstore-password]");
- System.exit(1);
- }
+ if(args.length < 5)
+ {
+ //
+ // Arguments:
+ //
+ // pkcs12-file A file in PKCS12 format that contains the
+ // private key and certificate chain.
+ //
+ // alias The key's friendly name in pkcs12-file and the
+ // alias for the key in the new keystore.
+ //
+ // cert-file The CA certificate file in DER format.
+ //
+ // keystore-file The name of the keystore file to update
+ // or create.
+ //
+ // store-password The file containing the password to use
+ // for the keystore.
+ //
+ // key-password The file containing the password to use
+ // for the key.
+ //
+ // kstore-password The file containing the password to use
+ // to store the key. If this isn't provided the
+ // key-password is used. This is used to import an
+ // unprotected private key.
+ //
+ System.err.println("Usage: ImportKey pkcs12-file alias cert-file " +
+ "keystore-file store-password key-password [kstore-password]");
+ System.exit(1);
+ }
- final String pkcs12File = args[0];
- final String alias = args[1];
- final String certFile = args[2];
- final String keystoreFile = args[3];
- final char[] storePassword = readPassword(args[4]);
- final char[] keyPassword = readPassword(args[5]);
- char[] kstorePassword = readPassword(args[5]);
- if(args.length > 6)
- {
- kstorePassword = readPassword(args[6]);
- }
- else
- {
- kstorePassword = keyPassword;
- }
+ final String pkcs12File = args[0];
+ final String alias = args[1];
+ final String certFile = args[2];
+ final String keystoreFile = args[3];
+ final char[] storePassword = readPassword(args[4]);
+ final char[] keyPassword = readPassword(args[5]);
+ char[] kstorePassword = readPassword(args[5]);
+ if(args.length > 6)
+ {
+ kstorePassword = readPassword(args[6]);
+ }
+ else
+ {
+ kstorePassword = keyPassword;
+ }
- try
- {
- KeyStore src = KeyStore.getInstance("PKCS12");
- src.load(new java.io.FileInputStream(pkcs12File), keyPassword);
+ try
+ {
+ KeyStore src = KeyStore.getInstance("PKCS12");
+ src.load(new java.io.FileInputStream(pkcs12File), keyPassword);
- KeyStore dest = KeyStore.getInstance("JKS");
- java.io.File f = new java.io.File(keystoreFile);
- if(f.exists())
- {
- dest.load(new java.io.FileInputStream(f), storePassword);
- }
- else
- {
- dest.load(null, null);
- }
- Certificate[] chain = src.getCertificateChain(alias);
- Key key = src.getKey(alias, keyPassword);
+ KeyStore dest = KeyStore.getInstance("JKS");
+ java.io.File f = new java.io.File(keystoreFile);
+ if(f.exists())
+ {
+ dest.load(new java.io.FileInputStream(f), storePassword);
+ }
+ else
+ {
+ dest.load(null, null);
+ }
+ Certificate[] chain = src.getCertificateChain(alias);
+ Key key = src.getKey(alias, keyPassword);
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate)
- cf.generateCertificate(new java.io.FileInputStream(certFile));
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ X509Certificate cert = (X509Certificate)
+ cf.generateCertificate(new java.io.FileInputStream(certFile));
- dest.setKeyEntry(alias, key, kstorePassword, chain);
- dest.setCertificateEntry("cacert", cert);
+ dest.setKeyEntry(alias, key, kstorePassword, chain);
+ dest.setCertificateEntry("cacert", cert);
- dest.store(new java.io.FileOutputStream(keystoreFile), storePassword);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- System.exit(1);
- }
+ dest.store(new java.io.FileOutputStream(keystoreFile), storePassword);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ System.exit(1);
+ }
- System.exit(0);
+ System.exit(0);
}
}
diff --git a/cpp/src/icecpp/cccp.c b/cpp/src/icecpp/cccp.c
index 2e95afb6a19..7c350441055 100644
--- a/cpp/src/icecpp/cccp.c
+++ b/cpp/src/icecpp/cccp.c
@@ -130,10 +130,10 @@ extern char *getenv ();
/* VMS-specific definitions */
#ifdef VMS
#include <descrip.h>
-#define open(fname,mode,prot) VMS_open (fname,mode,prot)
-#define fopen(fname,mode) VMS_fopen (fname,mode)
+#define open(fname,mode,prot) VMS_open (fname,mode,prot)
+#define fopen(fname,mode) VMS_fopen (fname,mode)
#define freopen(fname,mode,ofile) VMS_freopen (fname,mode,ofile)
-#define fstat(fd,stbuf) VMS_fstat (fd,stbuf)
+#define fstat(fd,stbuf) VMS_fstat (fd,stbuf)
static int VMS_fstat (), VMS_stat ();
static int VMS_open ();
static FILE *VMS_fopen ();
@@ -141,7 +141,7 @@ static FILE *VMS_freopen ();
static void hack_vms_include_specification ();
#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a)))
#define INO_T_HASH(a) 0
-#define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */
+#define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */
#endif /* VMS */
/* Windows does not natively support inodes, and neither does MSDOS. */
@@ -207,10 +207,10 @@ extern char *update_path PROTO((char *, char *));
//#ifndef HAVE_STRERROR
//extern int sys_nerr;
//extern char *sys_errlist[];
-//#else /* HAVE_STRERROR */
+//#else /* HAVE_STRERROR */
//char *strerror ();
//#endif
-//#else /* VMS */
+//#else /* VMS */
//char *strerror (int,...);
//#endif
HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
@@ -429,18 +429,18 @@ static struct file_buf {
char system_header_p;
} instack[INPUT_STACK_MAX];
-static int last_error_tick; /* Incremented each time we print it. */
+static int last_error_tick; /* Incremented each time we print it. */
static int input_file_stack_tick; /* Incremented when the status changes. */
/* Current nesting level of input sources.
`instack[indepth]' is the level currently being read. */
static int indepth = -1;
#define CHECK_DEPTH(code) \
- if (indepth >= (INPUT_STACK_MAX - 1)) \
- { \
- error_with_line (line_for_error (instack[indepth].lineno), \
- "macro or `#include' recursion too deep"); \
- code; \
+ if (indepth >= (INPUT_STACK_MAX - 1)) \
+ { \
+ error_with_line (line_for_error (instack[indepth].lineno), \
+ "macro or `#include' recursion too deep"); \
+ code; \
}
/* Current depth in #include directives that use <...>. */
@@ -452,7 +452,7 @@ typedef struct file_buf FILE_BUF;
for the buffer, not the number of chars actually present. To get
that, subtract outbuf.buf from outbuf.bufp. */
-#define OUTBUF_SIZE 10 /* initial size of output buffer */
+#define OUTBUF_SIZE 10 /* initial size of output buffer */
static FILE_BUF outbuf;
/* Grow output buffer OBUF points at
@@ -485,12 +485,12 @@ struct file_name_list
/* -I directories are added to the end, then the defaults are added. */
/* The */
static struct default_include {
- char *fname; /* The name of the directory. */
- char *component; /* The component containing the directory */
- int cplusplus; /* Only look here if we're compiling C++. */
- int cxx_aware; /* Includes in this directory don't need to
- be wrapped in extern "C" when compiling
- C++. */
+ char *fname; /* The name of the directory. */
+ char *component; /* The component containing the directory */
+ int cplusplus; /* Only look here if we're compiling C++. */
+ int cxx_aware; /* Includes in this directory don't need to
+ be wrapped in extern "C" when compiling
+ C++. */
} include_defaults_array[]
#ifdef INCLUDE_DEFAULTS
= INCLUDE_DEFAULTS;
@@ -542,23 +542,23 @@ static struct default_include {
variable specifies other defaults. */
static struct default_include *include_defaults = include_defaults_array;
-static struct file_name_list *include = 0; /* First dir to search */
- /* First dir to search for <file> */
+static struct file_name_list *include = 0; /* First dir to search */
+ /* First dir to search for <file> */
/* This is the first element to use for #include <...>.
If it is 0, use the entire chain for such includes. */
static struct file_name_list *first_bracket_include = 0;
/* This is the first element in the chain that corresponds to
a directory of system header files. */
static struct file_name_list *first_system_include = 0;
-static struct file_name_list *last_include = 0; /* Last in chain */
+static struct file_name_list *last_include = 0; /* Last in chain */
/* Chain of include directories to put at the end of the other chain. */
static struct file_name_list *after_include = 0;
-static struct file_name_list *last_after_include = 0; /* Last in chain */
+static struct file_name_list *last_after_include = 0; /* Last in chain */
/* Chain to put at the start of the system include files. */
static struct file_name_list *before_system = 0;
-static struct file_name_list *last_before_system = 0; /* Last in chain */
+static struct file_name_list *last_before_system = 0; /* Last in chain */
/* Directory prefix that should replace `/usr' in the standard
include file directories. */
@@ -606,18 +606,18 @@ struct macrodef
};
enum sharp_token_type {
- NO_SHARP_TOKEN = 0, /* token not present */
+ NO_SHARP_TOKEN = 0, /* token not present */
- SHARP_TOKEN = '#', /* token spelled with # only */
- WHITE_SHARP_TOKEN, /* token spelled with # and white space */
+ SHARP_TOKEN = '#', /* token spelled with # only */
+ WHITE_SHARP_TOKEN, /* token spelled with # and white space */
- PERCENT_COLON_TOKEN = '%', /* token spelled with %: only */
- WHITE_PERCENT_COLON_TOKEN /* token spelled with %: and white space */
+ PERCENT_COLON_TOKEN = '%', /* token spelled with %: only */
+ WHITE_PERCENT_COLON_TOKEN /* token spelled with %: and white space */
};
/* Structure allocated for every #define. For a simple replacement
such as
- #define foo bar ,
+ #define foo bar ,
nargs = -1, the `pattern' list is null, and the expansion is just
the replacement text. Nargs = 0 means a functionlike macro with no args,
e.g.,
@@ -639,24 +639,24 @@ enum sharp_token_type {
typedef struct definition DEFINITION;
struct definition {
int nargs;
- int length; /* length of expansion string */
- int predefined; /* True if the macro was builtin or */
- /* came from the command line */
+ int length; /* length of expansion string */
+ int predefined; /* True if the macro was builtin or */
+ /* came from the command line */
U_CHAR *expansion;
- int line; /* Line number of definition */
- char *file; /* File of definition */
- char rest_args; /* Nonzero if last arg. absorbs the rest */
+ int line; /* Line number of definition */
+ char *file; /* File of definition */
+ char rest_args; /* Nonzero if last arg. absorbs the rest */
struct reflist {
struct reflist *next;
- enum sharp_token_type stringify; /* set if a # operator before arg */
- enum sharp_token_type raw_before; /* set if a ## operator before arg */
- enum sharp_token_type raw_after; /* set if a ## operator after arg */
+ enum sharp_token_type stringify; /* set if a # operator before arg */
+ enum sharp_token_type raw_before; /* set if a ## operator before arg */
+ enum sharp_token_type raw_after; /* set if a ## operator after arg */
- char rest_args; /* Nonzero if this arg. absorbs the rest */
- int nchars; /* Number of literal chars to copy before
- this arg occurrence. */
- int argno; /* Number of arg to substitute (origin-0) */
+ char rest_args; /* Nonzero if this arg. absorbs the rest */
+ int nchars; /* Number of literal chars to copy before
+ this arg occurrence. */
+ int argno; /* Number of arg to substitute (origin-0) */
} *pattern;
union {
/* Names of macro args, concatenated in reverse order
@@ -678,17 +678,17 @@ union hashval {
/*
* special extension string that can be added to the last macro argument to
* allow it to absorb the "rest" of the arguments when expanded. Ex:
- * #define wow(a, b...) process (b, a, b)
- * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); }
- * { wow (one, two); } -> { process (two, one, two); }
+ * #define wow(a, b...) process (b, a, b)
+ * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); }
+ * { wow (one, two); } -> { process (two, one, two); }
* if this "rest_arg" is used with the concat token '##' and if it is not
* supplied then the token attached to with ## will not be outputted. Ex:
- * #define wow (a, b...) process (b ## , a, ## b)
- * { wow (1, 2); } -> { process (2, 1, 2); }
- * { wow (one); } -> { process (one); {
+ * #define wow (a, b...) process (b ## , a, ## b)
+ * { wow (1, 2); } -> { process (2, 1, 2); }
+ * { wow (one); } -> { process (one); {
*/
static char rest_extension[] = "...";
-#define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1)
+#define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1)
/* The structure of a node in the hash table. The hash table
has entries for all tokens defined by #define directives (type T_MACRO),
@@ -699,56 +699,56 @@ static char rest_extension[] = "...";
/* different flavors of hash nodes --- also used in keyword table */
enum node_type {
- T_DEFINE = 1, /* the `#define' keyword */
- T_INCLUDE, /* the `#include' keyword */
+ T_DEFINE = 1, /* the `#define' keyword */
+ T_INCLUDE, /* the `#include' keyword */
T_INCLUDE_NEXT, /* the `#include_next' keyword */
T_IMPORT, /* the `#import' keyword */
- T_IFDEF, /* the `#ifdef' keyword */
- T_IFNDEF, /* the `#ifndef' keyword */
- T_IF, /* the `#if' keyword */
- T_ELSE, /* `#else' */
- T_PRAGMA, /* `#pragma' */
- T_ELIF, /* `#elif' */
- T_UNDEF, /* `#undef' */
- T_LINE, /* `#line' */
- T_ERROR, /* `#error' */
- T_WARNING, /* `#warning' */
- T_ENDIF, /* `#endif' */
- T_SCCS, /* `#sccs', used on system V. */
- T_IDENT, /* `#ident', used on system V. */
- T_ASSERT, /* `#assert', taken from system V. */
- T_UNASSERT, /* `#unassert', taken from system V. */
- T_SPECLINE, /* special symbol `__LINE__' */
- T_DATE, /* `__DATE__' */
- T_FILE, /* `__FILE__' */
- T_BASE_FILE, /* `__BASE_FILE__' */
+ T_IFDEF, /* the `#ifdef' keyword */
+ T_IFNDEF, /* the `#ifndef' keyword */
+ T_IF, /* the `#if' keyword */
+ T_ELSE, /* `#else' */
+ T_PRAGMA, /* `#pragma' */
+ T_ELIF, /* `#elif' */
+ T_UNDEF, /* `#undef' */
+ T_LINE, /* `#line' */
+ T_ERROR, /* `#error' */
+ T_WARNING, /* `#warning' */
+ T_ENDIF, /* `#endif' */
+ T_SCCS, /* `#sccs', used on system V. */
+ T_IDENT, /* `#ident', used on system V. */
+ T_ASSERT, /* `#assert', taken from system V. */
+ T_UNASSERT, /* `#unassert', taken from system V. */
+ T_SPECLINE, /* special symbol `__LINE__' */
+ T_DATE, /* `__DATE__' */
+ T_FILE, /* `__FILE__' */
+ T_BASE_FILE, /* `__BASE_FILE__' */
T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
- T_VERSION, /* `__VERSION__' */
+ T_VERSION, /* `__VERSION__' */
T_SIZE_TYPE, /* `__SIZE_TYPE__' */
T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */
T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */
T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */
T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */
T_IMMEDIATE_PREFIX_TYPE, /* `__IMMEDIATE_PREFIX__' */
- T_TIME, /* `__TIME__' */
- T_CONST, /* Constant value, used by `__STDC__' */
- T_MACRO, /* macro defined by `#define' */
- T_DISABLED, /* macro temporarily turned off for rescan */
+ T_TIME, /* `__TIME__' */
+ T_CONST, /* Constant value, used by `__STDC__' */
+ T_MACRO, /* macro defined by `#define' */
+ T_DISABLED, /* macro temporarily turned off for rescan */
T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
- T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
- T_UNUSED /* Used for something not defined. */
+ T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
+ T_UNUSED /* Used for something not defined. */
};
struct hashnode {
- struct hashnode *next; /* double links for easy deletion */
+ struct hashnode *next; /* double links for easy deletion */
struct hashnode *prev;
- struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
- chain is kept, in case the node is the head
- of the chain and gets deleted. */
- enum node_type type; /* type of special token */
- int length; /* length of token, for quick comparison */
- U_CHAR *name; /* the actual name */
- union hashval value; /* pointer to expansion, or whatever */
+ struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
+ chain is kept, in case the node is the head
+ of the chain and gets deleted. */
+ enum node_type type; /* type of special token */
+ int length; /* length of token, for quick comparison */
+ U_CHAR *name; /* the actual name */
+ union hashval value; /* pointer to expansion, or whatever */
};
typedef struct hashnode HASHNODE;
@@ -828,14 +828,14 @@ struct tokenlist_list {
};
struct assertion_hashnode {
- struct assertion_hashnode *next; /* double links for easy deletion */
+ struct assertion_hashnode *next; /* double links for easy deletion */
struct assertion_hashnode *prev;
/* also, a back pointer to this node's hash
chain is kept, in case the node is the head
of the chain and gets deleted. */
struct assertion_hashnode **bucket_hdr;
- int length; /* length of token, for quick comparison */
- U_CHAR *name; /* the actual name */
+ int length; /* length of token, for quick comparison */
+ U_CHAR *name; /* the actual name */
/* List of token-sequences. */
struct tokenlist_list *value;
};
@@ -861,10 +861,10 @@ static int assertions_flag;
#define DO_PROTO PROTO((U_CHAR *, U_CHAR *, FILE_BUF *, struct directive *))
struct directive {
- int length; /* Length of name */
- int (*func) DO_PROTO; /* Function to handle directive */
- char *name; /* Name of directive */
- enum node_type type; /* Code which describes which directive. */
+ int length; /* Length of name */
+ int (*func) DO_PROTO; /* Function to handle directive */
+ char *name; /* Name of directive */
+ enum node_type type; /* Code which describes which directive. */
};
#define IS_INCLUDE_DIRECTIVE_TYPE(t) \
@@ -938,7 +938,7 @@ static char *char_name[256];
#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[*p]) p++; } while (0)
#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*p]) p++; } while (0)
-static int errors = 0; /* Error counter for exit code */
+static int errors = 0; /* Error counter for exit code */
/* Name of output file, for error messages. */
static char *out_fname;
@@ -948,14 +948,14 @@ static char *out_fname;
(including both successful and failing conditionals). */
struct if_stack {
- struct if_stack *next; /* for chaining to the next stack frame */
- char *fname; /* copied from input when frame is made */
- int lineno; /* similarly */
- int if_succeeded; /* true if a leg of this if-group
- has been passed through rescan */
- U_CHAR *control_macro; /* For #ifndef at start of file,
- this is the macro name tested. */
- enum node_type type; /* type of last directive seen in this group */
+ struct if_stack *next; /* for chaining to the next stack frame */
+ char *fname; /* copied from input when frame is made */
+ int lineno; /* similarly */
+ int if_succeeded; /* true if a leg of this if-group
+ has been passed through rescan */
+ U_CHAR *control_macro; /* For #ifndef at start of file,
+ this is the macro name tested. */
+ enum node_type type; /* type of last directive seen in this group */
};
typedef struct if_stack IF_STACK_FRAME;
static IF_STACK_FRAME *if_stack = NULL;
@@ -1147,10 +1147,10 @@ safe_read (desc, ptr, len)
if (nchars < 0)
{
#ifdef EINTR
- if (errno == EINTR)
- continue;
+ if (errno == EINTR)
+ continue;
#endif
- return nchars;
+ return nchars;
}
if (nchars == 0)
break;
@@ -1182,10 +1182,10 @@ safe_write (desc, ptr, len)
if (written < 0)
{
#ifdef EINTR
- if (errno == EINTR)
- continue;
+ if (errno == EINTR)
+ continue;
#endif
- pfatal_with_name (out_fname);
+ pfatal_with_name (out_fname);
}
ptr += written;
len -= written;
@@ -1257,12 +1257,12 @@ main (argc, argv)
char *p;
char *s = progname = savestring (progname);
- if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */
- if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */
- && (p[1] == 'e' || p[1] == 'E')
- && (p[2] == 'x' || p[2] == 'X')
- && (p[3] == 'e' || p[3] == 'E')
- && !p[4])
+ if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */
+ if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */
+ && (p[1] == 'e' || p[1] == 'E')
+ && (p[2] == 'x' || p[2] == 'X')
+ && (p[3] == 'e' || p[3] == 'E')
+ && !p[4])
*p = '\0';
}
#endif
@@ -1291,406 +1291,406 @@ main (argc, argv)
for (i = 1; i < argc; i++) {
if (argv[i][0] != '-') {
if (out_fname != NULL)
- fatal ("Usage: %s [switches] input output", argv[0]);
+ fatal ("Usage: %s [switches] input output", argv[0]);
else if (in_fname != NULL)
- out_fname = argv[i];
+ out_fname = argv[i];
else
- in_fname = argv[i];
+ in_fname = argv[i];
} else {
switch (argv[i][1]) {
case 'i':
- if (!strcmp (argv[i], "-include")) {
- if (i + 1 == argc)
- fatal ("Filename missing after `-include' option");
- else
- simplify_filename (pend_includes[i] = argv[++i]);
- }
- if (!strcmp (argv[i], "-imacros")) {
- if (i + 1 == argc)
- fatal ("Filename missing after `-imacros' option");
- else
- simplify_filename (pend_files[i] = argv[++i]);
- }
- if (!strcmp (argv[i], "-iprefix")) {
- if (i + 1 == argc)
- fatal ("Filename missing after `-iprefix' option");
- else
- include_prefix = argv[++i];
- }
- if (!strcmp (argv[i], "-ifoutput")) {
- output_conditionals = 1;
- }
- if (!strcmp (argv[i], "-isystem")) {
- struct file_name_list *dirtmp;
-
- if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR,
- "", argv[++i])))
- break;
- dirtmp->c_system_include_path = 1;
-
- if (before_system == 0)
- before_system = dirtmp;
- else
- last_before_system->next = dirtmp;
- last_before_system = dirtmp; /* Tail follows the last one */
- }
- /* Add directory to end of path for includes,
- with the default prefix at the front of its name. */
- if (!strcmp (argv[i], "-iwithprefix")) {
- struct file_name_list *dirtmp;
- char *prefix;
-
- if (include_prefix != 0)
- prefix = include_prefix;
- else {
- prefix = savestring (GCC_INCLUDE_DIR);
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
- prefix[strlen (prefix) - 7] = 0;
- }
-
- if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR,
- prefix, argv[++i])))
- break;
-
- if (after_include == 0)
- after_include = dirtmp;
- else
- last_after_include->next = dirtmp;
- last_after_include = dirtmp; /* Tail follows the last one */
- }
- /* Add directory to main path for includes,
- with the default prefix at the front of its name. */
- if (!strcmp (argv[i], "-iwithprefixbefore")) {
- struct file_name_list *dirtmp;
- char *prefix;
-
- if (include_prefix != 0)
- prefix = include_prefix;
- else {
- prefix = savestring (GCC_INCLUDE_DIR);
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
- prefix[strlen (prefix) - 7] = 0;
- }
-
- dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, prefix, argv[++i]);
- append_include_chain (dirtmp, dirtmp);
- }
- /* Add directory to end of path for includes. */
- if (!strcmp (argv[i], "-idirafter")) {
- struct file_name_list *dirtmp;
-
- if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR,
- "", argv[++i])))
- break;
-
- if (after_include == 0)
- after_include = dirtmp;
- else
- last_after_include->next = dirtmp;
- last_after_include = dirtmp; /* Tail follows the last one */
- }
- break;
+ if (!strcmp (argv[i], "-include")) {
+ if (i + 1 == argc)
+ fatal ("Filename missing after `-include' option");
+ else
+ simplify_filename (pend_includes[i] = argv[++i]);
+ }
+ if (!strcmp (argv[i], "-imacros")) {
+ if (i + 1 == argc)
+ fatal ("Filename missing after `-imacros' option");
+ else
+ simplify_filename (pend_files[i] = argv[++i]);
+ }
+ if (!strcmp (argv[i], "-iprefix")) {
+ if (i + 1 == argc)
+ fatal ("Filename missing after `-iprefix' option");
+ else
+ include_prefix = argv[++i];
+ }
+ if (!strcmp (argv[i], "-ifoutput")) {
+ output_conditionals = 1;
+ }
+ if (!strcmp (argv[i], "-isystem")) {
+ struct file_name_list *dirtmp;
+
+ if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR,
+ "", argv[++i])))
+ break;
+ dirtmp->c_system_include_path = 1;
+
+ if (before_system == 0)
+ before_system = dirtmp;
+ else
+ last_before_system->next = dirtmp;
+ last_before_system = dirtmp; /* Tail follows the last one */
+ }
+ /* Add directory to end of path for includes,
+ with the default prefix at the front of its name. */
+ if (!strcmp (argv[i], "-iwithprefix")) {
+ struct file_name_list *dirtmp;
+ char *prefix;
+
+ if (include_prefix != 0)
+ prefix = include_prefix;
+ else {
+ prefix = savestring (GCC_INCLUDE_DIR);
+ /* Remove the `include' from /usr/local/lib/gcc.../include. */
+ if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
+ prefix[strlen (prefix) - 7] = 0;
+ }
+
+ if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR,
+ prefix, argv[++i])))
+ break;
+
+ if (after_include == 0)
+ after_include = dirtmp;
+ else
+ last_after_include->next = dirtmp;
+ last_after_include = dirtmp; /* Tail follows the last one */
+ }
+ /* Add directory to main path for includes,
+ with the default prefix at the front of its name. */
+ if (!strcmp (argv[i], "-iwithprefixbefore")) {
+ struct file_name_list *dirtmp;
+ char *prefix;
+
+ if (include_prefix != 0)
+ prefix = include_prefix;
+ else {
+ prefix = savestring (GCC_INCLUDE_DIR);
+ /* Remove the `include' from /usr/local/lib/gcc.../include. */
+ if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
+ prefix[strlen (prefix) - 7] = 0;
+ }
+
+ dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, prefix, argv[++i]);
+ append_include_chain (dirtmp, dirtmp);
+ }
+ /* Add directory to end of path for includes. */
+ if (!strcmp (argv[i], "-idirafter")) {
+ struct file_name_list *dirtmp;
+
+ if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR,
+ "", argv[++i])))
+ break;
+
+ if (after_include == 0)
+ after_include = dirtmp;
+ else
+ last_after_include->next = dirtmp;
+ last_after_include = dirtmp; /* Tail follows the last one */
+ }
+ break;
case 'o':
- if (out_fname != NULL)
- fatal ("Output filename specified twice");
- if (i + 1 == argc)
- fatal ("Filename missing after -o option");
- out_fname = argv[++i];
- if (!strcmp (out_fname, "-"))
- out_fname = "";
- break;
+ if (out_fname != NULL)
+ fatal ("Output filename specified twice");
+ if (i + 1 == argc)
+ fatal ("Filename missing after -o option");
+ out_fname = argv[++i];
+ if (!strcmp (out_fname, "-"))
+ out_fname = "";
+ break;
case 'p':
- if (!strcmp (argv[i], "-pedantic"))
- pedantic = 1;
- else if (!strcmp (argv[i], "-pedantic-errors")) {
- pedantic = 1;
- pedantic_errors = 1;
- } else if (!strcmp (argv[i], "-pcp")) {
- char *pcp_fname;
- if (i + 1 == argc)
- fatal ("Filename missing after -pcp option");
- pcp_fname = argv[++i];
- pcp_outfile
- = ((pcp_fname[0] != '-' || pcp_fname[1] != '\0')
- ? fopen (pcp_fname, "w")
- : stdout);
- if (pcp_outfile == 0)
- pfatal_with_name (pcp_fname);
- no_precomp = 1;
- }
- break;
+ if (!strcmp (argv[i], "-pedantic"))
+ pedantic = 1;
+ else if (!strcmp (argv[i], "-pedantic-errors")) {
+ pedantic = 1;
+ pedantic_errors = 1;
+ } else if (!strcmp (argv[i], "-pcp")) {
+ char *pcp_fname;
+ if (i + 1 == argc)
+ fatal ("Filename missing after -pcp option");
+ pcp_fname = argv[++i];
+ pcp_outfile
+ = ((pcp_fname[0] != '-' || pcp_fname[1] != '\0')
+ ? fopen (pcp_fname, "w")
+ : stdout);
+ if (pcp_outfile == 0)
+ pfatal_with_name (pcp_fname);
+ no_precomp = 1;
+ }
+ break;
case 't':
- if (!strcmp (argv[i], "-traditional")) {
- traditional = 1;
- cplusplus_comments = 0;
- } else if (!strcmp (argv[i], "-trigraphs")) {
- no_trigraphs = 0;
- }
- break;
+ if (!strcmp (argv[i], "-traditional")) {
+ traditional = 1;
+ cplusplus_comments = 0;
+ } else if (!strcmp (argv[i], "-trigraphs")) {
+ no_trigraphs = 0;
+ }
+ break;
case 'l':
- if (! strcmp (argv[i], "-lang-c"))
- cplusplus = 0, cplusplus_comments = 1, c89 = 0, objc = 0;
- if (! strcmp (argv[i], "-lang-c89"))
- cplusplus = 0, cplusplus_comments = 0, c89 = 1, objc = 0;
- if (! strcmp (argv[i], "-lang-c++"))
- cplusplus = 1, cplusplus_comments = 1, c89 = 0, objc = 0;
- if (! strcmp (argv[i], "-lang-objc"))
- cplusplus = 0, cplusplus_comments = 1, c89 = 0, objc = 1;
- if (! strcmp (argv[i], "-lang-objc++"))
- cplusplus = 1, cplusplus_comments = 1, c89 = 0, objc = 1;
- if (! strcmp (argv[i], "-lang-asm"))
- lang_asm = 1;
- if (! strcmp (argv[i], "-lint"))
- for_lint = 1;
- break;
+ if (! strcmp (argv[i], "-lang-c"))
+ cplusplus = 0, cplusplus_comments = 1, c89 = 0, objc = 0;
+ if (! strcmp (argv[i], "-lang-c89"))
+ cplusplus = 0, cplusplus_comments = 0, c89 = 1, objc = 0;
+ if (! strcmp (argv[i], "-lang-c++"))
+ cplusplus = 1, cplusplus_comments = 1, c89 = 0, objc = 0;
+ if (! strcmp (argv[i], "-lang-objc"))
+ cplusplus = 0, cplusplus_comments = 1, c89 = 0, objc = 1;
+ if (! strcmp (argv[i], "-lang-objc++"))
+ cplusplus = 1, cplusplus_comments = 1, c89 = 0, objc = 1;
+ if (! strcmp (argv[i], "-lang-asm"))
+ lang_asm = 1;
+ if (! strcmp (argv[i], "-lint"))
+ for_lint = 1;
+ break;
case '+':
- cplusplus = 1, cplusplus_comments = 1;
- break;
+ cplusplus = 1, cplusplus_comments = 1;
+ break;
case 'w':
- inhibit_warnings = 1;
- break;
+ inhibit_warnings = 1;
+ break;
case 'W':
- if (!strcmp (argv[i], "-Wtrigraphs"))
- warn_trigraphs = 1;
- else if (!strcmp (argv[i], "-Wno-trigraphs"))
- warn_trigraphs = 0;
- else if (!strcmp (argv[i], "-Wcomment"))
- warn_comments = 1;
- else if (!strcmp (argv[i], "-Wno-comment"))
- warn_comments = 0;
- else if (!strcmp (argv[i], "-Wcomments"))
- warn_comments = 1;
- else if (!strcmp (argv[i], "-Wno-comments"))
- warn_comments = 0;
- else if (!strcmp (argv[i], "-Wtraditional"))
- warn_stringify = 1;
- else if (!strcmp (argv[i], "-Wno-traditional"))
- warn_stringify = 0;
- else if (!strcmp (argv[i], "-Wundef"))
- warn_undef = 1;
- else if (!strcmp (argv[i], "-Wno-undef"))
- warn_undef = 0;
- else if (!strcmp (argv[i], "-Wimport"))
- warn_import = 1;
- else if (!strcmp (argv[i], "-Wno-import"))
- warn_import = 0;
- else if (!strcmp (argv[i], "-Werror"))
- warnings_are_errors = 1;
- else if (!strcmp (argv[i], "-Wno-error"))
- warnings_are_errors = 0;
- else if (!strcmp (argv[i], "-Wall"))
- {
- warn_trigraphs = 1;
- warn_comments = 1;
- }
- break;
+ if (!strcmp (argv[i], "-Wtrigraphs"))
+ warn_trigraphs = 1;
+ else if (!strcmp (argv[i], "-Wno-trigraphs"))
+ warn_trigraphs = 0;
+ else if (!strcmp (argv[i], "-Wcomment"))
+ warn_comments = 1;
+ else if (!strcmp (argv[i], "-Wno-comment"))
+ warn_comments = 0;
+ else if (!strcmp (argv[i], "-Wcomments"))
+ warn_comments = 1;
+ else if (!strcmp (argv[i], "-Wno-comments"))
+ warn_comments = 0;
+ else if (!strcmp (argv[i], "-Wtraditional"))
+ warn_stringify = 1;
+ else if (!strcmp (argv[i], "-Wno-traditional"))
+ warn_stringify = 0;
+ else if (!strcmp (argv[i], "-Wundef"))
+ warn_undef = 1;
+ else if (!strcmp (argv[i], "-Wno-undef"))
+ warn_undef = 0;
+ else if (!strcmp (argv[i], "-Wimport"))
+ warn_import = 1;
+ else if (!strcmp (argv[i], "-Wno-import"))
+ warn_import = 0;
+ else if (!strcmp (argv[i], "-Werror"))
+ warnings_are_errors = 1;
+ else if (!strcmp (argv[i], "-Wno-error"))
+ warnings_are_errors = 0;
+ else if (!strcmp (argv[i], "-Wall"))
+ {
+ warn_trigraphs = 1;
+ warn_comments = 1;
+ }
+ break;
case 'M':
- /* The style of the choices here is a bit mixed.
- The chosen scheme is a hybrid of keeping all options in one string
- and specifying each option in a separate argument:
- -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
- -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
- -M[M][G][D file]. This is awkward to handle in specs, and is not
- as extensible. */
- /* ??? -MG must be specified in addition to one of -M or -MM.
- This can be relaxed in the future without breaking anything.
- The converse isn't true. */
-
- /* -MG isn't valid with -MD or -MMD. This is checked for later. */
- if (!strcmp (argv[i], "-MG"))
- {
- print_deps_missing_files = 1;
- break;
- }
- if (!strcmp (argv[i], "-M"))
- print_deps = 2;
- else if (!strcmp (argv[i], "-MM"))
- print_deps = 1;
- else if (!strcmp (argv[i], "-MD"))
- print_deps = 2;
- else if (!strcmp (argv[i], "-MMD"))
- print_deps = 1;
- /* For -MD and -MMD options, write deps on file named by next arg. */
- if (!strcmp (argv[i], "-MD")
- || !strcmp (argv[i], "-MMD")) {
- if (i + 1 == argc)
- fatal ("Filename missing after %s option", argv[i]);
- i++;
- deps_file = argv[i];
- deps_mode = "w";
- } else {
- /* For -M and -MM, write deps on standard output
- and suppress the usual output. */
- deps_stream = stdout;
- inhibit_output = 1;
- }
- break;
+ /* The style of the choices here is a bit mixed.
+ The chosen scheme is a hybrid of keeping all options in one string
+ and specifying each option in a separate argument:
+ -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
+ -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
+ -M[M][G][D file]. This is awkward to handle in specs, and is not
+ as extensible. */
+ /* ??? -MG must be specified in addition to one of -M or -MM.
+ This can be relaxed in the future without breaking anything.
+ The converse isn't true. */
+
+ /* -MG isn't valid with -MD or -MMD. This is checked for later. */
+ if (!strcmp (argv[i], "-MG"))
+ {
+ print_deps_missing_files = 1;
+ break;
+ }
+ if (!strcmp (argv[i], "-M"))
+ print_deps = 2;
+ else if (!strcmp (argv[i], "-MM"))
+ print_deps = 1;
+ else if (!strcmp (argv[i], "-MD"))
+ print_deps = 2;
+ else if (!strcmp (argv[i], "-MMD"))
+ print_deps = 1;
+ /* For -MD and -MMD options, write deps on file named by next arg. */
+ if (!strcmp (argv[i], "-MD")
+ || !strcmp (argv[i], "-MMD")) {
+ if (i + 1 == argc)
+ fatal ("Filename missing after %s option", argv[i]);
+ i++;
+ deps_file = argv[i];
+ deps_mode = "w";
+ } else {
+ /* For -M and -MM, write deps on standard output
+ and suppress the usual output. */
+ deps_stream = stdout;
+ inhibit_output = 1;
+ }
+ break;
case 'd':
- {
- char *p = argv[i] + 2;
- char c;
- while ((c = *p++)) {
- /* Arg to -d specifies what parts of macros to dump */
- switch (c) {
- case 'M':
- dump_macros = dump_only;
- no_output = 1;
- break;
- case 'N':
- dump_macros = dump_names;
- break;
- case 'D':
- dump_macros = dump_definitions;
- break;
- case 'I':
- dump_includes = 1;
- break;
- }
- }
- }
- break;
+ {
+ char *p = argv[i] + 2;
+ char c;
+ while ((c = *p++)) {
+ /* Arg to -d specifies what parts of macros to dump */
+ switch (c) {
+ case 'M':
+ dump_macros = dump_only;
+ no_output = 1;
+ break;
+ case 'N':
+ dump_macros = dump_names;
+ break;
+ case 'D':
+ dump_macros = dump_definitions;
+ break;
+ case 'I':
+ dump_includes = 1;
+ break;
+ }
+ }
+ }
+ break;
case 'g':
- if (argv[i][2] == '3')
- debug_output = 1;
- break;
+ if (argv[i][2] == '3')
+ debug_output = 1;
+ break;
case 'v':
- fprintf (stderr, "GNU CPP version %s", version_string);
+ fprintf (stderr, "GNU CPP version %s", version_string);
#ifdef TARGET_VERSION
- TARGET_VERSION;
+ TARGET_VERSION;
#endif
- fprintf (stderr, "\n");
- verbose = 1;
- break;
+ fprintf (stderr, "\n");
+ verbose = 1;
+ break;
case 'H':
- print_include_names = 1;
- break;
+ print_include_names = 1;
+ break;
case 'D':
- if (argv[i][2] != 0)
- pend_defs[i] = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("Macro name missing after -D option");
- else
- i++, pend_defs[i] = argv[i];
- break;
+ if (argv[i][2] != 0)
+ pend_defs[i] = argv[i] + 2;
+ else if (i + 1 == argc)
+ fatal ("Macro name missing after -D option");
+ else
+ i++, pend_defs[i] = argv[i];
+ break;
case 'A':
- {
- char *p;
-
- if (argv[i][2] != 0)
- p = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("Assertion missing after -A option");
- else
- p = argv[++i];
-
- if (!strcmp (p, "-")) {
- /* -A- eliminates all predefined macros and assertions.
- Let's include also any that were specified earlier
- on the command line. That way we can get rid of any
- that were passed automatically in from GCC. */
- int j;
- inhibit_predefs = 1;
- for (j = 0; j < i; j++)
- pend_defs[j] = pend_assertions[j] = 0;
- } else {
- pend_assertions[i] = p;
- pend_assertion_options[i] = "-A";
- }
- }
- break;
-
- case 'U': /* JF #undef something */
- if (argv[i][2] != 0)
- pend_undefs[i] = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("Macro name missing after -U option");
- else
- pend_undefs[i] = argv[i+1], i++;
- break;
+ {
+ char *p;
+
+ if (argv[i][2] != 0)
+ p = argv[i] + 2;
+ else if (i + 1 == argc)
+ fatal ("Assertion missing after -A option");
+ else
+ p = argv[++i];
+
+ if (!strcmp (p, "-")) {
+ /* -A- eliminates all predefined macros and assertions.
+ Let's include also any that were specified earlier
+ on the command line. That way we can get rid of any
+ that were passed automatically in from GCC. */
+ int j;
+ inhibit_predefs = 1;
+ for (j = 0; j < i; j++)
+ pend_defs[j] = pend_assertions[j] = 0;
+ } else {
+ pend_assertions[i] = p;
+ pend_assertion_options[i] = "-A";
+ }
+ }
+ break;
+
+ case 'U': /* JF #undef something */
+ if (argv[i][2] != 0)
+ pend_undefs[i] = argv[i] + 2;
+ else if (i + 1 == argc)
+ fatal ("Macro name missing after -U option");
+ else
+ pend_undefs[i] = argv[i+1], i++;
+ break;
case 'C':
- put_out_comments = 1;
- break;
+ put_out_comments = 1;
+ break;
- case 'E': /* -E comes from cc -E; ignore it. */
- break;
+ case 'E': /* -E comes from cc -E; ignore it. */
+ break;
case 'P':
- no_line_directives = 1;
- break;
-
- case '$': /* Don't include $ in identifiers. */
- is_idchar['$'] = is_idstart['$'] = 0;
- break;
-
- case 'I': /* Add directory to path for includes. */
- {
- struct file_name_list *dirtmp;
-
- if (! ignore_srcdir && !strcmp (argv[i] + 2, "-")) {
- ignore_srcdir = 1;
- /* Don't use any preceding -I directories for #include <...>. */
- first_bracket_include = 0;
- }
- else {
- dirtmp = new_include_prefix (last_include, NULL_PTR, "",
- argv[i][2] ? argv[i] + 2 : argv[++i]);
- append_include_chain (dirtmp, dirtmp);
- }
- }
- break;
+ no_line_directives = 1;
+ break;
+
+ case '$': /* Don't include $ in identifiers. */
+ is_idchar['$'] = is_idstart['$'] = 0;
+ break;
+
+ case 'I': /* Add directory to path for includes. */
+ {
+ struct file_name_list *dirtmp;
+
+ if (! ignore_srcdir && !strcmp (argv[i] + 2, "-")) {
+ ignore_srcdir = 1;
+ /* Don't use any preceding -I directories for #include <...>. */
+ first_bracket_include = 0;
+ }
+ else {
+ dirtmp = new_include_prefix (last_include, NULL_PTR, "",
+ argv[i][2] ? argv[i] + 2 : argv[++i]);
+ append_include_chain (dirtmp, dirtmp);
+ }
+ }
+ break;
case 'n':
- if (!strcmp (argv[i], "-nostdinc"))
- /* -nostdinc causes no default include directories.
- You must specify all include-file directories with -I. */
- no_standard_includes = 1;
- else if (!strcmp (argv[i], "-nostdinc++"))
- /* -nostdinc++ causes no default C++-specific include directories. */
- no_standard_cplusplus_includes = 1;
- else if (!strcmp (argv[i], "-noprecomp"))
- no_precomp = 1;
- break;
+ if (!strcmp (argv[i], "-nostdinc"))
+ /* -nostdinc causes no default include directories.
+ You must specify all include-file directories with -I. */
+ no_standard_includes = 1;
+ else if (!strcmp (argv[i], "-nostdinc++"))
+ /* -nostdinc++ causes no default C++-specific include directories. */
+ no_standard_cplusplus_includes = 1;
+ else if (!strcmp (argv[i], "-noprecomp"))
+ no_precomp = 1;
+ break;
case 'r':
- if (!strcmp (argv[i], "-remap"))
- remap = 1;
- break;
+ if (!strcmp (argv[i], "-remap"))
+ remap = 1;
+ break;
case 'u':
- /* Sun compiler passes undocumented switch "-undef".
- Let's assume it means to inhibit the predefined symbols. */
- inhibit_predefs = 1;
- break;
+ /* Sun compiler passes undocumented switch "-undef".
+ Let's assume it means to inhibit the predefined symbols. */
+ inhibit_predefs = 1;
+ break;
case '\0': /* JF handle '-' as file name meaning stdin or stdout */
- if (in_fname == NULL) {
- in_fname = "";
- break;
- } else if (out_fname == NULL) {
- out_fname = "";
- break;
- } /* else fall through into error */
+ if (in_fname == NULL) {
+ in_fname = "";
+ break;
+ } else if (out_fname == NULL) {
+ out_fname = "";
+ break;
+ } /* else fall through into error */
default:
- fatal ("Invalid option `%s'", argv[i]);
+ fatal ("Invalid option `%s'", argv[i]);
}
}
}
@@ -1738,65 +1738,65 @@ main (argc, argv)
while (*p) {
char *q;
while (*p == ' ' || *p == '\t')
- p++;
+ p++;
/* Handle -D options. */
if (p[0] == '-' && p[1] == 'D') {
- q = &p[2];
- while (*p && *p != ' ' && *p != '\t')
- p++;
- if (*p != 0)
- *p++= 0;
- if (debug_output)
- output_line_directive (fp, &outbuf, 0, same_file);
- make_definition (q, &outbuf);
- while (*p == ' ' || *p == '\t')
- p++;
+ q = &p[2];
+ while (*p && *p != ' ' && *p != '\t')
+ p++;
+ if (*p != 0)
+ *p++= 0;
+ if (debug_output)
+ output_line_directive (fp, &outbuf, 0, same_file);
+ make_definition (q, &outbuf);
+ while (*p == ' ' || *p == '\t')
+ p++;
} else if (p[0] == '-' && p[1] == 'A') {
- /* Handle -A options (assertions). */
- char *assertion;
- char *past_name;
- char *value;
- char *past_value;
- char *termination;
- int save_char;
-
- assertion = &p[2];
- past_name = assertion;
- /* Locate end of name. */
- while (*past_name && *past_name != ' '
- && *past_name != '\t' && *past_name != '(')
- past_name++;
- /* Locate `(' at start of value. */
- value = past_name;
- while (*value && (*value == ' ' || *value == '\t'))
- value++;
- if (*value++ != '(')
- abort ();
- while (*value && (*value == ' ' || *value == '\t'))
- value++;
- past_value = value;
- /* Locate end of value. */
- while (*past_value && *past_value != ' '
- && *past_value != '\t' && *past_value != ')')
- past_value++;
- termination = past_value;
- while (*termination && (*termination == ' ' || *termination == '\t'))
- termination++;
- if (*termination++ != ')')
- abort ();
- if (*termination && *termination != ' ' && *termination != '\t')
- abort ();
- /* Temporarily null-terminate the value. */
- save_char = *termination;
- *termination = '\0';
- /* Install the assertion. */
- make_assertion ("-A", assertion);
- *termination = (char) save_char;
- p = termination;
- while (*p == ' ' || *p == '\t')
- p++;
+ /* Handle -A options (assertions). */
+ char *assertion;
+ char *past_name;
+ char *value;
+ char *past_value;
+ char *termination;
+ int save_char;
+
+ assertion = &p[2];
+ past_name = assertion;
+ /* Locate end of name. */
+ while (*past_name && *past_name != ' '
+ && *past_name != '\t' && *past_name != '(')
+ past_name++;
+ /* Locate `(' at start of value. */
+ value = past_name;
+ while (*value && (*value == ' ' || *value == '\t'))
+ value++;
+ if (*value++ != '(')
+ abort ();
+ while (*value && (*value == ' ' || *value == '\t'))
+ value++;
+ past_value = value;
+ /* Locate end of value. */
+ while (*past_value && *past_value != ' '
+ && *past_value != '\t' && *past_value != ')')
+ past_value++;
+ termination = past_value;
+ while (*termination && (*termination == ' ' || *termination == '\t'))
+ termination++;
+ if (*termination++ != ')')
+ abort ();
+ if (*termination && *termination != ' ' && *termination != '\t')
+ abort ();
+ /* Temporarily null-terminate the value. */
+ save_char = *termination;
+ *termination = '\0';
+ /* Install the assertion. */
+ make_assertion ("-A", assertion);
+ *termination = (char) save_char;
+ p = termination;
+ while (*p == ' ' || *p == '\t')
+ p++;
} else {
- abort ();
+ abort ();
}
}
}
@@ -1827,17 +1827,17 @@ main (argc, argv)
switch ((objc << 1) + cplusplus)
{
case 0:
- epath = getenv ("C_INCLUDE_PATH");
- break;
+ epath = getenv ("C_INCLUDE_PATH");
+ break;
case 1:
- epath = getenv ("CPLUS_INCLUDE_PATH");
- break;
+ epath = getenv ("CPLUS_INCLUDE_PATH");
+ break;
case 2:
- epath = getenv ("OBJC_INCLUDE_PATH");
- break;
+ epath = getenv ("OBJC_INCLUDE_PATH");
+ break;
case 3:
- epath = getenv ("OBJCPLUS_INCLUDE_PATH");
- break;
+ epath = getenv ("OBJCPLUS_INCLUDE_PATH");
+ break;
}
/* If the environment var for this language is set,
add to the default list of include directories. */
@@ -1846,34 +1846,34 @@ main (argc, argv)
char *startp, *endp;
for (num_dirs = 1, startp = epath; *startp; startp++)
- if (*startp == PATH_SEPARATOR)
- num_dirs++;
+ if (*startp == PATH_SEPARATOR)
+ num_dirs++;
include_defaults
- = (struct default_include *) xmalloc ((num_dirs
- * sizeof (struct default_include))
- + sizeof (include_defaults_array));
+ = (struct default_include *) xmalloc ((num_dirs
+ * sizeof (struct default_include))
+ + sizeof (include_defaults_array));
startp = endp = epath;
num_dirs = 0;
while (1) {
- char c = *endp++;
- if (c == PATH_SEPARATOR || !c) {
- endp[-1] = 0;
- include_defaults[num_dirs].fname
- = startp == endp ? "." : savestring (startp);
- endp[-1] = c;
- include_defaults[num_dirs].component = 0;
- include_defaults[num_dirs].cplusplus = cplusplus;
- include_defaults[num_dirs].cxx_aware = 1;
- num_dirs++;
- if (!c)
- break;
- startp = endp;
- }
+ char c = *endp++;
+ if (c == PATH_SEPARATOR || !c) {
+ endp[-1] = 0;
+ include_defaults[num_dirs].fname
+ = startp == endp ? "." : savestring (startp);
+ endp[-1] = c;
+ include_defaults[num_dirs].component = 0;
+ include_defaults[num_dirs].cplusplus = cplusplus;
+ include_defaults[num_dirs].cxx_aware = 1;
+ num_dirs++;
+ if (!c)
+ break;
+ startp = endp;
+ }
}
/* Put the usual defaults back in at the end. */
bcopy ((char *) include_defaults_array,
- (char *) &include_defaults[num_dirs],
- sizeof (include_defaults_array));
+ (char *) &include_defaults[num_dirs],
+ sizeof (include_defaults_array));
}
}
@@ -1896,35 +1896,35 @@ main (argc, argv)
These have /usr/local/lib/gcc... replaced by specd_prefix. */
if (specd_prefix != 0 && default_len != 0)
for (p = include_defaults; p->fname; p++) {
- /* Some standard dirs are only for C++. */
- if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) {
- /* Does this dir start with the prefix? */
- if (!strncmp (p->fname, default_prefix, default_len)) {
- /* Yes; change prefix and add to search list. */
- struct file_name_list *new
- = new_include_prefix (NULL_PTR, NULL_PTR, specd_prefix,
- p->fname + default_len);
- if (new) {
- new->c_system_include_path = !p->cxx_aware;
- append_include_chain (new, new);
- if (first_system_include == 0)
- first_system_include = new;
- }
- }
- }
+ /* Some standard dirs are only for C++. */
+ if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) {
+ /* Does this dir start with the prefix? */
+ if (!strncmp (p->fname, default_prefix, default_len)) {
+ /* Yes; change prefix and add to search list. */
+ struct file_name_list *new
+ = new_include_prefix (NULL_PTR, NULL_PTR, specd_prefix,
+ p->fname + default_len);
+ if (new) {
+ new->c_system_include_path = !p->cxx_aware;
+ append_include_chain (new, new);
+ if (first_system_include == 0)
+ first_system_include = new;
+ }
+ }
+ }
}
/* Search ordinary names for GNU include directories. */
for (p = include_defaults; p->fname; p++) {
/* Some standard dirs are only for C++. */
if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) {
- struct file_name_list *new
- = new_include_prefix (NULL_PTR, p->component, "", p->fname);
- if (new) {
- new->c_system_include_path = !p->cxx_aware;
- append_include_chain (new, new);
- if (first_system_include == 0)
- first_system_include = new;
- }
+ struct file_name_list *new
+ = new_include_prefix (NULL_PTR, p->component, "", p->fname);
+ if (new) {
+ new->c_system_include_path = !p->cxx_aware;
+ append_include_chain (new, new);
+ if (first_system_include == 0)
+ first_system_include = new;
+ }
}
}
}
@@ -1940,14 +1940,14 @@ main (argc, argv)
fprintf (stderr, "#include \"...\" search starts here:\n");
for (p = include; p; p = p->next) {
if (p == first_bracket_include)
- fprintf (stderr, "#include <...> search starts here:\n");
+ fprintf (stderr, "#include <...> search starts here:\n");
if (!p->fname[0])
- fprintf (stderr, " .\n");
+ fprintf (stderr, " .\n");
else if (!strcmp (p->fname, "/") || !strcmp (p->fname, "//"))
- fprintf (stderr, " %s\n", p->fname);
+ fprintf (stderr, " %s\n", p->fname);
else
- /* Omit trailing '/'. */
- fprintf (stderr, " %.*s\n", (int) strlen (p->fname) - 1, p->fname);
+ /* Omit trailing '/'. */
+ fprintf (stderr, " %.*s\n", (int) strlen (p->fname) - 1, p->fname);
}
fprintf (stderr, "End of search list.\n");
}
@@ -1965,7 +1965,7 @@ main (argc, argv)
if (print_deps == 0
&& (getenv ("SUNPRO_DEPENDENCIES") != 0
- || getenv ("DEPENDENCIES_OUTPUT") != 0)) {
+ || getenv ("DEPENDENCIES_OUTPUT") != 0)) {
char *spec = getenv ("DEPENDENCIES_OUTPUT");
char *s;
char *output_file;
@@ -2023,35 +2023,35 @@ main (argc, argv)
len = strlen (p);
q = p + len;
if (len >= 2
- && p[len - 2] == '.'
- && index("cCsSm", p[len - 1]))
- q = p + (len - 2);
+ && p[len - 2] == '.'
+ && index("cCsSm", p[len - 1]))
+ q = p + (len - 2);
else if (len >= 3
- && p[len - 3] == '.'
- && p[len - 2] == 'c'
- && p[len - 1] == 'c')
- q = p + (len - 3);
+ && p[len - 3] == '.'
+ && p[len - 2] == 'c'
+ && p[len - 1] == 'c')
+ q = p + (len - 3);
else if (len >= 4
- && p[len - 4] == '.'
- && p[len - 3] == 'c'
- && p[len - 2] == 'x'
- && p[len - 1] == 'x')
- q = p + (len - 4);
+ && p[len - 4] == '.'
+ && p[len - 3] == 'c'
+ && p[len - 2] == 'x'
+ && p[len - 1] == 'x')
+ q = p + (len - 4);
else if (len >= 4
- && p[len - 4] == '.'
- && p[len - 3] == 'c'
- && p[len - 2] == 'p'
- && p[len - 1] == 'p')
- q = p + (len - 4);
+ && p[len - 4] == '.'
+ && p[len - 3] == 'c'
+ && p[len - 2] == 'p'
+ && p[len - 1] == 'p')
+ q = p + (len - 4);
/*
* The slice suffix.
*/
else if (len >= 4
- && p[len - 4] == '.'
- && p[len - 3] == 'i'
- && p[len - 2] == 'c'
- && p[len - 1] == 'e')
- q = p + (len - 4);
+ && p[len - 4] == '.'
+ && p[len - 3] == 'i'
+ && p[len - 2] == 'c'
+ && p[len - 1] == 'e')
+ q = p + (len - 4);
/* Supply our own suffix. */
strcpy (q, OBJECT_SUFFIX);
@@ -2071,8 +2071,8 @@ main (argc, argv)
struct include_file *inc;
int fd = open_include_file (pend_files[i], NULL_PTR, NULL_PTR, &inc);
if (fd < 0) {
- perror_with_name (pend_files[i]);
- return FATAL_EXIT_CODE;
+ perror_with_name (pend_files[i]);
+ return FATAL_EXIT_CODE;
}
finclude (fd, inc, &outbuf, 0, NULL_PTR);
}
@@ -2110,9 +2110,9 @@ main (argc, argv)
fp->buf = (U_CHAR *) xmalloc (bsize + 2);
for (;;) {
cnt = safe_read (f, (char *) fp->buf + size, bsize - size);
- if (cnt < 0) goto perror; /* error! */
+ if (cnt < 0) goto perror; /* error! */
size += cnt;
- if (size != bsize) break; /* End of file */
+ if (size != bsize) break; /* End of file */
bsize *= 2;
fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
}
@@ -2162,8 +2162,8 @@ main (argc, argv)
struct include_file *inc;
int fd = open_include_file (pend_includes[i], NULL_PTR, NULL_PTR, &inc);
if (fd < 0) {
- perror_with_name (pend_includes[i]);
- return FATAL_EXIT_CODE;
+ perror_with_name (pend_includes[i]);
+ return FATAL_EXIT_CODE;
}
finclude (fd, inc, &outbuf, 0, NULL_PTR);
}
@@ -2192,12 +2192,12 @@ main (argc, argv)
/* Don't actually write the deps file if compilation has failed. */
if (errors == 0) {
if (deps_file && ! (deps_stream = fopen (deps_file, deps_mode)))
- pfatal_with_name (deps_file);
+ pfatal_with_name (deps_file);
fputs (deps_buffer, deps_stream);
putc ('\n', deps_stream);
if (deps_file) {
- if (ferror (deps_stream) || fclose (deps_stream) != 0)
- fatal ("I/O error on output");
+ if (ferror (deps_stream) || fclose (deps_stream) != 0)
+ fatal ("I/O error on output");
}
}
}
@@ -2237,18 +2237,18 @@ path_include (path)
/* Find the end of this name. */
while ((c = *q++) != PATH_SEPARATOR && c)
- continue;
+ continue;
q[-1] = 0;
dirtmp = new_include_prefix (last_include, NULL_PTR,
- "", p == q ? "." : p);
+ "", p == q ? "." : p);
q[-1] = c;
append_include_chain (dirtmp, dirtmp);
/* Advance past this name. */
p = q;
if (! c)
- break;
+ break;
}
}
@@ -2272,7 +2272,7 @@ index0 (s, c, n)
else {
size_t l = strlen (p);
if (l == n)
- return 0;
+ return 0;
l++;
p += l;
n -= l;
@@ -2353,7 +2353,7 @@ trigraph_pcp (buf)
buf->buf[buf->length] = '\0';
if (warn_trigraphs && fptr != bptr)
warning_with_line (0, "%lu trigraph(s) encountered",
- (unsigned long) (fptr - bptr) / 2);
+ (unsigned long) (fptr - bptr) / 2);
}
/* Move all backslash-newline pairs out of embarrassing places.
@@ -2439,11 +2439,11 @@ static char *
get_lintcmd (ibp, limit, argstart, arglen, cmdlen)
register U_CHAR *ibp;
register U_CHAR *limit;
- U_CHAR **argstart; /* point to command arg */
- int *arglen, *cmdlen; /* how long they are */
+ U_CHAR **argstart; /* point to command arg */
+ int *arglen, *cmdlen; /* how long they are */
{
HOST_WIDE_INT linsize;
- register U_CHAR *numptr; /* temp for arg parsing */
+ register U_CHAR *numptr; /* temp for arg parsing */
*arglen = 0;
@@ -2473,7 +2473,7 @@ get_lintcmd (ibp, limit, argstart, arglen, cmdlen)
/* OK, read a number */
for (numptr = *argstart = ibp; (numptr < limit) && isdigit (*numptr);
- numptr++);
+ numptr++);
*arglen = numptr - *argstart;
return "VARARGS";
}
@@ -2564,20 +2564,20 @@ rescan (op, output_marks)
/* Pop the innermost input stack level, assuming it is a macro expansion. */
#define POPMACRO \
-do { ip->macro->type = T_MACRO; \
- if (ip->free_ptr) free (ip->free_ptr); \
+do { ip->macro->type = T_MACRO; \
+ if (ip->free_ptr) free (ip->free_ptr); \
--indepth; } while (0)
/* Reload `rescan's local variables that describe the current
level of the input stack. */
#define RECACHE \
-do { ip = &instack[indepth]; \
- ibp = ip->bufp; \
- limit = ip->buf + ip->length; \
- op->bufp = obp; \
- check_expand (op, limit - ibp); \
- beg_of_line = 0; \
+do { ip = &instack[indepth]; \
+ ibp = ip->bufp; \
+ limit = ip->buf + ip->length; \
+ op->bufp = obp; \
+ check_expand (op, limit - ibp); \
+ beg_of_line = 0; \
obp = op->bufp; } while (0)
if (no_output && instack[indepth].fname != 0)
@@ -2600,176 +2600,176 @@ do { ip = &instack[indepth]; \
switch (c) {
case '\\':
if (*ibp == '\n' && !ip->macro) {
- /* At the top level, always merge lines ending with backslash-newline,
- even in middle of identifier. But do not merge lines in a macro,
- since backslash might be followed by a newline-space marker. */
- ++ibp;
- ++ip->lineno;
- --obp; /* remove backslash from obuf */
- break;
+ /* At the top level, always merge lines ending with backslash-newline,
+ even in middle of identifier. But do not merge lines in a macro,
+ since backslash might be followed by a newline-space marker. */
+ ++ibp;
+ ++ip->lineno;
+ --obp; /* remove backslash from obuf */
+ break;
}
/* If ANSI, backslash is just another character outside a string. */
if (!traditional)
- goto randomchar;
+ goto randomchar;
/* Otherwise, backslash suppresses specialness of following char,
- so copy it here to prevent the switch from seeing it.
- But first get any pending identifier processed. */
+ so copy it here to prevent the switch from seeing it.
+ But first get any pending identifier processed. */
if (ident_length > 0)
- goto specialchar;
+ goto specialchar;
if (ibp < limit)
- *obp++ = *ibp++;
+ *obp++ = *ibp++;
break;
case '%':
if (ident_length || ip->macro || traditional)
- goto randomchar;
+ goto randomchar;
while (*ibp == '\\' && ibp[1] == '\n') {
- ibp += 2;
- ++ip->lineno;
+ ibp += 2;
+ ++ip->lineno;
}
if (*ibp != ':')
- break;
+ break;
/* Treat this %: digraph as if it were #. */
/* Fall through. */
case '#':
if (assertions_flag) {
- if (ident_length)
- goto specialchar;
- /* Copy #foo (bar lose) without macro expansion. */
- obp[-1] = '#'; /* In case it was '%'. */
- SKIP_WHITE_SPACE (ibp);
- while (is_idchar[*ibp])
- *obp++ = *ibp++;
- SKIP_WHITE_SPACE (ibp);
- if (*ibp == '(') {
- ip->bufp = ibp;
- skip_paren_group (ip);
- bcopy ((char *) ibp, (char *) obp, ip->bufp - ibp);
- obp += ip->bufp - ibp;
- ibp = ip->bufp;
- }
- break;
+ if (ident_length)
+ goto specialchar;
+ /* Copy #foo (bar lose) without macro expansion. */
+ obp[-1] = '#'; /* In case it was '%'. */
+ SKIP_WHITE_SPACE (ibp);
+ while (is_idchar[*ibp])
+ *obp++ = *ibp++;
+ SKIP_WHITE_SPACE (ibp);
+ if (*ibp == '(') {
+ ip->bufp = ibp;
+ skip_paren_group (ip);
+ bcopy ((char *) ibp, (char *) obp, ip->bufp - ibp);
+ obp += ip->bufp - ibp;
+ ibp = ip->bufp;
+ }
+ break;
}
/* If this is expanding a macro definition, don't recognize
- preprocessing directives. */
+ preprocessing directives. */
if (ip->macro != 0)
- goto randomchar;
+ goto randomchar;
/* If this is expand_into_temp_buffer,
- don't recognize them either. Warn about them
- only after an actual newline at this level,
- not at the beginning of the input level. */
+ don't recognize them either. Warn about them
+ only after an actual newline at this level,
+ not at the beginning of the input level. */
if (! ip->fname) {
- if (ip->buf != beg_of_line)
- warning ("preprocessing directive not recognized within macro arg");
- goto randomchar;
+ if (ip->buf != beg_of_line)
+ warning ("preprocessing directive not recognized within macro arg");
+ goto randomchar;
}
if (ident_length)
- goto specialchar;
+ goto specialchar;
/* # keyword: a # must be first nonblank char on the line */
if (beg_of_line == 0)
- goto randomchar;
+ goto randomchar;
{
- U_CHAR *bp;
-
- /* Scan from start of line, skipping whitespace, comments
- and backslash-newlines, and see if we reach this #.
- If not, this # is not special. */
- bp = beg_of_line;
- /* If -traditional, require # to be at beginning of line. */
- if (!traditional) {
- while (1) {
- if (is_hor_space[*bp])
- bp++;
- else if (*bp == '\\' && bp[1] == '\n')
- bp += 2;
- else if (*bp == '/' && bp[1] == '*') {
- bp += 2;
- while (!(*bp == '*' && bp[1] == '/'))
- bp++;
- bp += 2;
- }
- /* There is no point in trying to deal with C++ // comments here,
- because if there is one, then this # must be part of the
- comment and we would never reach here. */
- else break;
- }
- if (c == '%') {
- if (bp[0] != '%')
- break;
- while (bp[1] == '\\' && bp[2] == '\n')
- bp += 2;
- if (bp + 1 != ibp)
- break;
- /* %: appears at start of line; skip past the ':' too. */
- bp++;
- ibp++;
- }
- }
- if (bp + 1 != ibp)
- goto randomchar;
+ U_CHAR *bp;
+
+ /* Scan from start of line, skipping whitespace, comments
+ and backslash-newlines, and see if we reach this #.
+ If not, this # is not special. */
+ bp = beg_of_line;
+ /* If -traditional, require # to be at beginning of line. */
+ if (!traditional) {
+ while (1) {
+ if (is_hor_space[*bp])
+ bp++;
+ else if (*bp == '\\' && bp[1] == '\n')
+ bp += 2;
+ else if (*bp == '/' && bp[1] == '*') {
+ bp += 2;
+ while (!(*bp == '*' && bp[1] == '/'))
+ bp++;
+ bp += 2;
+ }
+ /* There is no point in trying to deal with C++ // comments here,
+ because if there is one, then this # must be part of the
+ comment and we would never reach here. */
+ else break;
+ }
+ if (c == '%') {
+ if (bp[0] != '%')
+ break;
+ while (bp[1] == '\\' && bp[2] == '\n')
+ bp += 2;
+ if (bp + 1 != ibp)
+ break;
+ /* %: appears at start of line; skip past the ':' too. */
+ bp++;
+ ibp++;
+ }
+ }
+ if (bp + 1 != ibp)
+ goto randomchar;
}
/* This # can start a directive. */
- --obp; /* Don't copy the '#' */
+ --obp; /* Don't copy the '#' */
ip->bufp = ibp;
op->bufp = obp;
if (! handle_directive (ip, op)) {
#ifdef USE_C_ALLOCA
- alloca (0);
+ alloca (0);
#endif
- /* Not a known directive: treat it as ordinary text.
- IP, OP, IBP, etc. have not been changed. */
- if (no_output && instack[indepth].fname) {
- /* If not generating expanded output,
- what we do with ordinary text is skip it.
- Discard everything until next # directive. */
- skip_if_group (&instack[indepth], 1, 0);
- RECACHE;
- beg_of_line = ibp;
- break;
- }
- *obp++ = '#'; /* Copy # (even if it was originally %:). */
- /* Don't expand an identifier that could be a macro directive.
- (Section 3.8.3 of the ANSI C standard) */
- SKIP_WHITE_SPACE (ibp);
- if (is_idstart[*ibp])
- {
- *obp++ = *ibp++;
- while (is_idchar[*ibp])
- *obp++ = *ibp++;
- }
- goto randomchar;
+ /* Not a known directive: treat it as ordinary text.
+ IP, OP, IBP, etc. have not been changed. */
+ if (no_output && instack[indepth].fname) {
+ /* If not generating expanded output,
+ what we do with ordinary text is skip it.
+ Discard everything until next # directive. */
+ skip_if_group (&instack[indepth], 1, 0);
+ RECACHE;
+ beg_of_line = ibp;
+ break;
+ }
+ *obp++ = '#'; /* Copy # (even if it was originally %:). */
+ /* Don't expand an identifier that could be a macro directive.
+ (Section 3.8.3 of the ANSI C standard) */
+ SKIP_WHITE_SPACE (ibp);
+ if (is_idstart[*ibp])
+ {
+ *obp++ = *ibp++;
+ while (is_idchar[*ibp])
+ *obp++ = *ibp++;
+ }
+ goto randomchar;
}
#ifdef USE_C_ALLOCA
alloca (0);
#endif
/* A # directive has been successfully processed. */
/* If not generating expanded output, ignore everything until
- next # directive. */
+ next # directive. */
if (no_output && instack[indepth].fname)
- skip_if_group (&instack[indepth], 1, 0);
+ skip_if_group (&instack[indepth], 1, 0);
obp = op->bufp;
RECACHE;
beg_of_line = ibp;
break;
- case '\"': /* skip quoted string */
+ case '\"': /* skip quoted string */
case '\'':
/* A single quoted string is treated like a double -- some
- programs (e.g., troff) are perverse this way */
+ programs (e.g., troff) are perverse this way */
/* Handle any pending identifier;
- but the L in L'...' or L"..." is not an identifier. */
+ but the L in L'...' or L"..." is not an identifier. */
if (ident_length) {
- if (! (ident_length == 1 && hash == HASHSTEP (0, 'L')))
- goto specialchar;
- ident_length = hash = 0;
+ if (! (ident_length == 1 && hash == HASHSTEP (0, 'L')))
+ goto specialchar;
+ ident_length = hash = 0;
}
start_line = ip->lineno;
@@ -2777,274 +2777,274 @@ do { ip = &instack[indepth]; \
/* Skip ahead to a matching quote. */
while (1) {
- if (ibp >= limit) {
- if (ip->macro != 0) {
- /* try harder: this string crosses a macro expansion boundary.
- This can happen naturally if -traditional.
- Otherwise, only -D can make a macro with an unmatched quote. */
- POPMACRO;
- RECACHE;
- continue;
- }
- if (!traditional) {
- error_with_line (line_for_error (start_line),
- "unterminated string or character constant");
- if (multiline_string_line) {
- error_with_line (multiline_string_line,
- "possible real start of unterminated constant");
- multiline_string_line = 0;
- }
- }
- break;
- }
- *obp++ = *ibp;
- switch (*ibp++) {
- case '\n':
- ++ip->lineno;
- ++op->lineno;
- /* Traditionally, end of line ends a string constant with no error.
- So exit the loop and record the new line. */
- if (traditional) {
- beg_of_line = ibp;
- goto while2end;
- }
- if (c == '\'') {
- error_with_line (line_for_error (start_line),
- "unterminated character constant");
- goto while2end;
- }
- if (multiline_string_line == 0) {
- if (pedantic)
- pedwarn_with_line (line_for_error (start_line),
- "string constant runs past end of line");
- multiline_string_line = ip->lineno - 1;
- }
- break;
-
- case '\\':
- if (*ibp == '\n') {
- /* Backslash newline is replaced by nothing at all, but
- keep the line counts correct. But if we are reading
- from a macro, keep the backslash newline, since backslash
- newlines have already been processed. */
- if (ip->macro)
- *obp++ = '\n';
- else
- --obp;
- ++ibp;
- ++ip->lineno;
- } else {
- /* ANSI stupidly requires that in \\ the second \
- is *not* prevented from combining with a newline. */
- if (!ip->macro) {
- while (*ibp == '\\' && ibp[1] == '\n') {
- ibp += 2;
- ++ip->lineno;
- }
- }
- *obp++ = *ibp++;
- }
- break;
-
- case '\"':
- case '\'':
- if (ibp[-1] == c)
- goto while2end;
- break;
- }
+ if (ibp >= limit) {
+ if (ip->macro != 0) {
+ /* try harder: this string crosses a macro expansion boundary.
+ This can happen naturally if -traditional.
+ Otherwise, only -D can make a macro with an unmatched quote. */
+ POPMACRO;
+ RECACHE;
+ continue;
+ }
+ if (!traditional) {
+ error_with_line (line_for_error (start_line),
+ "unterminated string or character constant");
+ if (multiline_string_line) {
+ error_with_line (multiline_string_line,
+ "possible real start of unterminated constant");
+ multiline_string_line = 0;
+ }
+ }
+ break;
+ }
+ *obp++ = *ibp;
+ switch (*ibp++) {
+ case '\n':
+ ++ip->lineno;
+ ++op->lineno;
+ /* Traditionally, end of line ends a string constant with no error.
+ So exit the loop and record the new line. */
+ if (traditional) {
+ beg_of_line = ibp;
+ goto while2end;
+ }
+ if (c == '\'') {
+ error_with_line (line_for_error (start_line),
+ "unterminated character constant");
+ goto while2end;
+ }
+ if (multiline_string_line == 0) {
+ if (pedantic)
+ pedwarn_with_line (line_for_error (start_line),
+ "string constant runs past end of line");
+ multiline_string_line = ip->lineno - 1;
+ }
+ break;
+
+ case '\\':
+ if (*ibp == '\n') {
+ /* Backslash newline is replaced by nothing at all, but
+ keep the line counts correct. But if we are reading
+ from a macro, keep the backslash newline, since backslash
+ newlines have already been processed. */
+ if (ip->macro)
+ *obp++ = '\n';
+ else
+ --obp;
+ ++ibp;
+ ++ip->lineno;
+ } else {
+ /* ANSI stupidly requires that in \\ the second \
+ is *not* prevented from combining with a newline. */
+ if (!ip->macro) {
+ while (*ibp == '\\' && ibp[1] == '\n') {
+ ibp += 2;
+ ++ip->lineno;
+ }
+ }
+ *obp++ = *ibp++;
+ }
+ break;
+
+ case '\"':
+ case '\'':
+ if (ibp[-1] == c)
+ goto while2end;
+ break;
+ }
}
while2end:
break;
case '/':
if (ip->macro != 0)
- goto randomchar;
+ goto randomchar;
if (*ibp == '\\' && ibp[1] == '\n')
- newline_fix (ibp);
+ newline_fix (ibp);
if (*ibp != '*'
- && !(cplusplus_comments && *ibp == '/'))
- goto randomchar;
+ && !(cplusplus_comments && *ibp == '/'))
+ goto randomchar;
if (ident_length)
- goto specialchar;
+ goto specialchar;
if (*ibp == '/') {
- /* C++ style comment... */
- start_line = ip->lineno;
-
- /* Comments are equivalent to spaces. */
- if (! put_out_comments)
- obp[-1] = ' ';
-
- {
- U_CHAR *before_bp = ibp;
-
- while (++ibp < limit) {
- if (*ibp == '\n') {
- if (ibp[-1] != '\\') {
- if (put_out_comments) {
- bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
- obp += ibp - before_bp;
- }
- break;
- }
- if (warn_comments)
- warning ("multiline `//' comment");
- ++ip->lineno;
- /* Copy the newline into the output buffer, in order to
- avoid the pain of a #line every time a multiline comment
- is seen. */
- if (!put_out_comments)
- *obp++ = '\n';
- ++op->lineno;
- }
- }
- break;
- }
+ /* C++ style comment... */
+ start_line = ip->lineno;
+
+ /* Comments are equivalent to spaces. */
+ if (! put_out_comments)
+ obp[-1] = ' ';
+
+ {
+ U_CHAR *before_bp = ibp;
+
+ while (++ibp < limit) {
+ if (*ibp == '\n') {
+ if (ibp[-1] != '\\') {
+ if (put_out_comments) {
+ bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
+ obp += ibp - before_bp;
+ }
+ break;
+ }
+ if (warn_comments)
+ warning ("multiline `//' comment");
+ ++ip->lineno;
+ /* Copy the newline into the output buffer, in order to
+ avoid the pain of a #line every time a multiline comment
+ is seen. */
+ if (!put_out_comments)
+ *obp++ = '\n';
+ ++op->lineno;
+ }
+ }
+ break;
+ }
}
/* Ordinary C comment. Skip it, optionally copying it to output. */
start_line = ip->lineno;
- ++ibp; /* Skip the star. */
+ ++ibp; /* Skip the star. */
/* If this cpp is for lint, we peek inside the comments: */
if (for_lint) {
- U_CHAR *argbp;
- int cmdlen, arglen;
- char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen);
-
- if (lintcmd != NULL) {
- op->bufp = obp;
- check_expand (op, cmdlen + arglen + 14);
- obp = op->bufp;
- /* I believe it is always safe to emit this newline: */
- obp[-1] = '\n';
- bcopy ("#pragma lint ", (char *) obp, 13);
- obp += 13;
- bcopy (lintcmd, (char *) obp, cmdlen);
- obp += cmdlen;
-
- if (arglen != 0) {
- *(obp++) = ' ';
- bcopy (argbp, (char *) obp, arglen);
- obp += arglen;
- }
-
- /* OK, now bring us back to the state we were in before we entered
- this branch. We need #line because the #pragma's newline always
- messes up the line count. */
- op->bufp = obp;
- output_line_directive (ip, op, 0, same_file);
- check_expand (op, limit - ibp + 2);
- obp = op->bufp;
- *(obp++) = '/';
- }
+ U_CHAR *argbp;
+ int cmdlen, arglen;
+ char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen);
+
+ if (lintcmd != NULL) {
+ op->bufp = obp;
+ check_expand (op, cmdlen + arglen + 14);
+ obp = op->bufp;
+ /* I believe it is always safe to emit this newline: */
+ obp[-1] = '\n';
+ bcopy ("#pragma lint ", (char *) obp, 13);
+ obp += 13;
+ bcopy (lintcmd, (char *) obp, cmdlen);
+ obp += cmdlen;
+
+ if (arglen != 0) {
+ *(obp++) = ' ';
+ bcopy (argbp, (char *) obp, arglen);
+ obp += arglen;
+ }
+
+ /* OK, now bring us back to the state we were in before we entered
+ this branch. We need #line because the #pragma's newline always
+ messes up the line count. */
+ op->bufp = obp;
+ output_line_directive (ip, op, 0, same_file);
+ check_expand (op, limit - ibp + 2);
+ obp = op->bufp;
+ *(obp++) = '/';
+ }
}
/* Comments are equivalent to spaces.
- Note that we already output the slash; we might not want it.
- For -traditional, a comment is equivalent to nothing. */
+ Note that we already output the slash; we might not want it.
+ For -traditional, a comment is equivalent to nothing. */
if (! put_out_comments) {
- if (traditional)
- obp--;
- else
- obp[-1] = ' ';
+ if (traditional)
+ obp--;
+ else
+ obp[-1] = ' ';
}
else
- *obp++ = '*';
+ *obp++ = '*';
{
- U_CHAR *before_bp = ibp;
-
- for (;;) {
- switch (*ibp++) {
- case '*':
- if (ibp[-2] == '/' && warn_comments)
- warning ("`/*' within comment");
- if (*ibp == '\\' && ibp[1] == '\n')
- newline_fix (ibp);
- if (*ibp == '/')
- goto comment_end;
- break;
-
- case '\n':
- ++ip->lineno;
- /* Copy the newline into the output buffer, in order to
- avoid the pain of a #line every time a multiline comment
- is seen. */
- if (!put_out_comments)
- *obp++ = '\n';
- ++op->lineno;
- break;
-
- case 0:
- if (limit < ibp) {
- error_with_line (line_for_error (start_line),
- "unterminated comment");
- goto limit_reached;
- }
- break;
- }
- }
+ U_CHAR *before_bp = ibp;
+
+ for (;;) {
+ switch (*ibp++) {
+ case '*':
+ if (ibp[-2] == '/' && warn_comments)
+ warning ("`/*' within comment");
+ if (*ibp == '\\' && ibp[1] == '\n')
+ newline_fix (ibp);
+ if (*ibp == '/')
+ goto comment_end;
+ break;
+
+ case '\n':
+ ++ip->lineno;
+ /* Copy the newline into the output buffer, in order to
+ avoid the pain of a #line every time a multiline comment
+ is seen. */
+ if (!put_out_comments)
+ *obp++ = '\n';
+ ++op->lineno;
+ break;
+
+ case 0:
+ if (limit < ibp) {
+ error_with_line (line_for_error (start_line),
+ "unterminated comment");
+ goto limit_reached;
+ }
+ break;
+ }
+ }
comment_end:
- ibp++;
- if (put_out_comments) {
- bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
- obp += ibp - before_bp;
- }
+ ibp++;
+ if (put_out_comments) {
+ bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
+ obp += ibp - before_bp;
+ }
}
break;
case '$':
if (! is_idchar['$'])
- goto randomchar;
+ goto randomchar;
if (pedantic)
- pedwarn ("`$' in identifier");
+ pedwarn ("`$' in identifier");
goto letter;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
/* If digit is not part of identifier, it starts a number,
- which means that following letters are not an identifier.
- "0x5" does not refer to an identifier "x5".
- So copy all alphanumerics that follow without accumulating
- as an identifier. Periods also, for sake of "3.e7". */
+ which means that following letters are not an identifier.
+ "0x5" does not refer to an identifier "x5".
+ So copy all alphanumerics that follow without accumulating
+ as an identifier. Periods also, for sake of "3.e7". */
if (ident_length == 0) {
- for (;;) {
- if (!ip->macro) {
- while (ibp[0] == '\\' && ibp[1] == '\n') {
- ++ip->lineno;
- ibp += 2;
- }
- }
- c = *ibp++;
- if (!is_idchar[c] && c != '.') {
- --ibp;
- break;
- }
- *obp++ = c;
- /* A sign can be part of a preprocessing number
- if it follows an `e' or `p'. */
- if (c == 'e' || c == 'E' || c == 'p' || c == 'P') {
- if (!ip->macro) {
- while (ibp[0] == '\\' && ibp[1] == '\n') {
- ++ip->lineno;
- ibp += 2;
- }
- }
- if (*ibp == '+' || *ibp == '-') {
- *obp++ = *ibp++;
- /* But traditional C does not let the token go past the sign,
- and C89 does not allow `p'. */
- if (traditional || (c89 && (c == 'p' || c == 'P')))
- break;
- }
- }
- }
- break;
+ for (;;) {
+ if (!ip->macro) {
+ while (ibp[0] == '\\' && ibp[1] == '\n') {
+ ++ip->lineno;
+ ibp += 2;
+ }
+ }
+ c = *ibp++;
+ if (!is_idchar[c] && c != '.') {
+ --ibp;
+ break;
+ }
+ *obp++ = c;
+ /* A sign can be part of a preprocessing number
+ if it follows an `e' or `p'. */
+ if (c == 'e' || c == 'E' || c == 'p' || c == 'P') {
+ if (!ip->macro) {
+ while (ibp[0] == '\\' && ibp[1] == '\n') {
+ ++ip->lineno;
+ ibp += 2;
+ }
+ }
+ if (*ibp == '+' || *ibp == '-') {
+ *obp++ = *ibp++;
+ /* But traditional C does not let the token go past the sign,
+ and C89 does not allow `p'. */
+ if (traditional || (c89 && (c == 'p' || c == 'P')))
+ break;
+ }
+ }
+ }
+ break;
}
/* fall through */
@@ -3067,56 +3067,56 @@ do { ip = &instack[indepth]; \
case '\n':
if (ip->fname == 0 && *ibp == '-') {
- /* Newline - inhibits expansion of preceding token.
- If expanding a macro arg, we keep the newline -.
- In final output, it is deleted.
- We recognize Newline - in macro bodies and macro args. */
- if (! concatenated) {
- ident_length = 0;
- hash = 0;
- }
- ibp++;
- if (!output_marks) {
- obp--;
- } else {
- /* If expanding a macro arg, keep the newline -. */
- *obp++ = '-';
- }
- break;
+ /* Newline - inhibits expansion of preceding token.
+ If expanding a macro arg, we keep the newline -.
+ In final output, it is deleted.
+ We recognize Newline - in macro bodies and macro args. */
+ if (! concatenated) {
+ ident_length = 0;
+ hash = 0;
+ }
+ ibp++;
+ if (!output_marks) {
+ obp--;
+ } else {
+ /* If expanding a macro arg, keep the newline -. */
+ *obp++ = '-';
+ }
+ break;
}
/* If reprocessing a macro expansion, newline is a special marker. */
else if (ip->macro != 0) {
- /* Newline White is a "funny space" to separate tokens that are
- supposed to be separate but without space between.
- Here White means any whitespace character.
- Newline - marks a recursive macro use that is not
- supposed to be expandable. */
-
- if (is_space[*ibp]) {
- /* Newline Space does not prevent expansion of preceding token
- so expand the preceding token and then come back. */
- if (ident_length > 0)
- goto specialchar;
-
- /* If generating final output, newline space makes a space. */
- if (!output_marks) {
- obp[-1] = *ibp++;
- /* And Newline Newline makes a newline, so count it. */
- if (obp[-1] == '\n')
- op->lineno++;
- } else {
- /* If expanding a macro arg, keep the newline space.
- If the arg gets stringified, newline space makes nothing. */
- *obp++ = *ibp++;
- }
- } else abort (); /* Newline followed by something random? */
- break;
+ /* Newline White is a "funny space" to separate tokens that are
+ supposed to be separate but without space between.
+ Here White means any whitespace character.
+ Newline - marks a recursive macro use that is not
+ supposed to be expandable. */
+
+ if (is_space[*ibp]) {
+ /* Newline Space does not prevent expansion of preceding token
+ so expand the preceding token and then come back. */
+ if (ident_length > 0)
+ goto specialchar;
+
+ /* If generating final output, newline space makes a space. */
+ if (!output_marks) {
+ obp[-1] = *ibp++;
+ /* And Newline Newline makes a newline, so count it. */
+ if (obp[-1] == '\n')
+ op->lineno++;
+ } else {
+ /* If expanding a macro arg, keep the newline space.
+ If the arg gets stringified, newline space makes nothing. */
+ *obp++ = *ibp++;
+ }
+ } else abort (); /* Newline followed by something random? */
+ break;
}
/* If there is a pending identifier, handle it and come back here. */
if (ident_length > 0)
- goto specialchar;
+ goto specialchar;
beg_of_line = ibp;
@@ -3124,59 +3124,59 @@ do { ip = &instack[indepth]; \
++ip->lineno;
++op->lineno;
if (ip->lineno != op->lineno) {
- op->bufp = obp;
- output_line_directive (ip, op, 1, same_file);
- check_expand (op, limit - ibp);
- obp = op->bufp;
+ op->bufp = obp;
+ output_line_directive (ip, op, 1, same_file);
+ check_expand (op, limit - ibp);
+ obp = op->bufp;
}
break;
/* Come here either after (1) a null character that is part of the input
- or (2) at the end of the input, because there is a null there. */
+ or (2) at the end of the input, because there is a null there. */
case 0:
if (ibp <= limit)
- /* Our input really contains a null character. */
- goto randomchar;
+ /* Our input really contains a null character. */
+ goto randomchar;
limit_reached:
/* At end of a macro-expansion level, pop it and read next level. */
if (ip->macro != 0) {
- obp--;
- ibp--;
- /* If traditional, and we have an identifier that ends here,
- process it now, so we get the right error for recursion. */
- if (traditional && ident_length
- && ! is_idchar[*instack[indepth - 1].bufp]) {
- redo_char = 1;
- goto randomchar;
- }
- POPMACRO;
- RECACHE;
- break;
+ obp--;
+ ibp--;
+ /* If traditional, and we have an identifier that ends here,
+ process it now, so we get the right error for recursion. */
+ if (traditional && ident_length
+ && ! is_idchar[*instack[indepth - 1].bufp]) {
+ redo_char = 1;
+ goto randomchar;
+ }
+ POPMACRO;
+ RECACHE;
+ break;
}
/* If we don't have a pending identifier,
- return at end of input. */
+ return at end of input. */
if (ident_length == 0) {
- obp--;
- ibp--;
- op->bufp = obp;
- ip->bufp = ibp;
- goto ending;
+ obp--;
+ ibp--;
+ op->bufp = obp;
+ ip->bufp = ibp;
+ goto ending;
}
/* If we do have a pending identifier, just consider this null
- a special character and arrange to dispatch on it again.
- The second time, IDENT_LENGTH will be zero so we will return. */
+ a special character and arrange to dispatch on it again.
+ The second time, IDENT_LENGTH will be zero so we will return. */
/* Fall through */
specialchar:
/* Handle the case of a character such as /, ', " or null
- seen following an identifier. Back over it so that
- after the identifier is processed the special char
- will be dispatched on again. */
+ seen following an identifier. Back over it so that
+ after the identifier is processed the special char
+ will be dispatched on again. */
ibp--;
obp--;
@@ -3187,258 +3187,258 @@ specialchar:
randomchar:
if (ident_length > 0) {
- register HASHNODE *hp;
-
- /* We have just seen an identifier end. If it's a macro, expand it.
-
- IDENT_LENGTH is the length of the identifier
- and HASH is its hash code.
-
- The identifier has already been copied to the output,
- so if it is a macro we must remove it.
-
- If REDO_CHAR is 0, the char that terminated the identifier
- has been skipped in the output and the input.
- OBP-IDENT_LENGTH-1 points to the identifier.
- If the identifier is a macro, we must back over the terminator.
-
- If REDO_CHAR is 1, the terminating char has already been
- backed over. OBP-IDENT_LENGTH points to the identifier. */
-
- if (!pcp_outfile || pcp_inside_if) {
- for (hp = hashtab[MAKE_POS (hash) % HASHSIZE]; hp != NULL;
- hp = hp->next) {
-
- if (hp->length == ident_length) {
- int obufp_before_macroname;
- int op_lineno_before_macroname;
- register int i = ident_length;
- register U_CHAR *p = hp->name;
- register U_CHAR *q = obp - i;
- int disabled;
-
- if (! redo_char)
- q--;
-
- do { /* All this to avoid a strncmp () */
- if (*p++ != *q++)
- goto hashcollision;
- } while (--i);
-
- /* We found a use of a macro name.
- see if the context shows it is a macro call. */
-
- /* Back up over terminating character if not already done. */
- if (! redo_char) {
- ibp--;
- obp--;
- }
-
- /* Save this as a displacement from the beginning of the output
- buffer. We can not save this as a position in the output
- buffer, because it may get realloc'ed by RECACHE. */
- obufp_before_macroname = (obp - op->buf) - ident_length;
- op_lineno_before_macroname = op->lineno;
-
- if (hp->type == T_PCSTRING) {
- pcstring_used (hp); /* Mark the definition of this key
- as needed, ensuring that it
- will be output. */
- break; /* Exit loop, since the key cannot have a
- definition any longer. */
- }
-
- /* Record whether the macro is disabled. */
- disabled = hp->type == T_DISABLED;
-
- /* This looks like a macro ref, but if the macro was disabled,
- just copy its name and put in a marker if requested. */
-
- if (disabled) {
+ register HASHNODE *hp;
+
+ /* We have just seen an identifier end. If it's a macro, expand it.
+
+ IDENT_LENGTH is the length of the identifier
+ and HASH is its hash code.
+
+ The identifier has already been copied to the output,
+ so if it is a macro we must remove it.
+
+ If REDO_CHAR is 0, the char that terminated the identifier
+ has been skipped in the output and the input.
+ OBP-IDENT_LENGTH-1 points to the identifier.
+ If the identifier is a macro, we must back over the terminator.
+
+ If REDO_CHAR is 1, the terminating char has already been
+ backed over. OBP-IDENT_LENGTH points to the identifier. */
+
+ if (!pcp_outfile || pcp_inside_if) {
+ for (hp = hashtab[MAKE_POS (hash) % HASHSIZE]; hp != NULL;
+ hp = hp->next) {
+
+ if (hp->length == ident_length) {
+ int obufp_before_macroname;
+ int op_lineno_before_macroname;
+ register int i = ident_length;
+ register U_CHAR *p = hp->name;
+ register U_CHAR *q = obp - i;
+ int disabled;
+
+ if (! redo_char)
+ q--;
+
+ do { /* All this to avoid a strncmp () */
+ if (*p++ != *q++)
+ goto hashcollision;
+ } while (--i);
+
+ /* We found a use of a macro name.
+ see if the context shows it is a macro call. */
+
+ /* Back up over terminating character if not already done. */
+ if (! redo_char) {
+ ibp--;
+ obp--;
+ }
+
+ /* Save this as a displacement from the beginning of the output
+ buffer. We can not save this as a position in the output
+ buffer, because it may get realloc'ed by RECACHE. */
+ obufp_before_macroname = (obp - op->buf) - ident_length;
+ op_lineno_before_macroname = op->lineno;
+
+ if (hp->type == T_PCSTRING) {
+ pcstring_used (hp); /* Mark the definition of this key
+ as needed, ensuring that it
+ will be output. */
+ break; /* Exit loop, since the key cannot have a
+ definition any longer. */
+ }
+
+ /* Record whether the macro is disabled. */
+ disabled = hp->type == T_DISABLED;
+
+ /* This looks like a macro ref, but if the macro was disabled,
+ just copy its name and put in a marker if requested. */
+
+ if (disabled) {
#if 0
- /* This error check caught useful cases such as
- #define foo(x,y) bar (x (y,0), y)
- foo (foo, baz) */
- if (traditional)
- error ("recursive use of macro `%s'", hp->name);
+ /* This error check caught useful cases such as
+ #define foo(x,y) bar (x (y,0), y)
+ foo (foo, baz) */
+ if (traditional)
+ error ("recursive use of macro `%s'", hp->name);
#endif
-
- if (output_marks) {
- check_expand (op, limit - ibp + 2);
- *obp++ = '\n';
- *obp++ = '-';
- }
- break;
- }
-
- /* If macro wants an arglist, verify that a '(' follows.
- first skip all whitespace, copying it to the output
- after the macro name. Then, if there is no '(',
- decide this is not a macro call and leave things that way. */
- if ((hp->type == T_MACRO || hp->type == T_DISABLED)
- && hp->value.defn->nargs >= 0)
- {
- U_CHAR *old_ibp = ibp;
- U_CHAR *old_obp = obp;
- int old_iln = ip->lineno;
- int old_oln = op->lineno;
-
- while (1) {
- /* Scan forward over whitespace, copying it to the output. */
- if (ibp == limit && ip->macro != 0) {
- POPMACRO;
- RECACHE;
- old_ibp = ibp;
- old_obp = obp;
- old_iln = ip->lineno;
- old_oln = op->lineno;
- }
- else if (is_space[*ibp]) {
- *obp++ = *ibp++;
- if (ibp[-1] == '\n') {
- if (ip->macro == 0) {
- /* Newline in a file. Count it. */
- ++ip->lineno;
- ++op->lineno;
- } else if (!output_marks) {
- /* A newline mark, and we don't want marks
- in the output. If it is newline-hyphen,
- discard it entirely. Otherwise, it is
- newline-whitechar, so keep the whitechar. */
- obp--;
- if (*ibp == '-')
- ibp++;
- else {
- if (*ibp == '\n')
- ++op->lineno;
- *obp++ = *ibp++;
- }
- } else {
- /* A newline mark; copy both chars to the output. */
- *obp++ = *ibp++;
- }
- }
- }
- else if (ip->macro)
- break;
- else if (*ibp == '/') {
- /* If a comment, copy it unchanged or discard it. */
- if (ibp[1] == '\\' && ibp[2] == '\n')
- newline_fix (ibp + 1);
- if (ibp[1] == '*') {
- if (put_out_comments) {
- *obp++ = '/';
- *obp++ = '*';
- } else if (! traditional) {
- *obp++ = ' ';
- }
- for (ibp += 2; ibp < limit; ibp++) {
- /* We need not worry about newline-marks,
- since they are never found in comments. */
- if (ibp[0] == '*') {
- if (ibp[1] == '\\' && ibp[2] == '\n')
- newline_fix (ibp + 1);
- if (ibp[1] == '/') {
- ibp += 2;
- if (put_out_comments) {
- *obp++ = '*';
- *obp++ = '/';
- }
- break;
- }
- }
- if (*ibp == '\n') {
- /* Newline in a file. Count it. */
- ++ip->lineno;
- ++op->lineno;
- }
- if (put_out_comments)
- *obp++ = *ibp;
- }
- } else if (ibp[1] == '/' && cplusplus_comments) {
- if (put_out_comments) {
- *obp++ = '/';
- *obp++ = '/';
- } else if (! traditional) {
- *obp++ = ' ';
- }
- for (ibp += 2; *ibp != '\n' || ibp[-1] == '\\'; ibp++)
- if (put_out_comments)
- *obp++ = *ibp;
- } else
- break;
- }
- else if (ibp[0] == '\\' && ibp[1] == '\n') {
- ibp += 2;
- ++ip->lineno;
- }
- else break;
- }
- if (*ibp != '(') {
- /* It isn't a macro call.
- Put back the space that we just skipped. */
- ibp = old_ibp;
- obp = old_obp;
- ip->lineno = old_iln;
- op->lineno = old_oln;
- /* Exit the for loop. */
- break;
- }
- }
-
- /* This is now known to be a macro call.
- Discard the macro name from the output,
- along with any following whitespace just copied,
- but preserve newlines if not outputting marks since this
- is more likely to do the right thing with line numbers. */
- obp = op->buf + obufp_before_macroname;
- if (output_marks)
- op->lineno = op_lineno_before_macroname;
- else {
- int newlines = op->lineno - op_lineno_before_macroname;
- while (0 < newlines--)
- *obp++ = '\n';
- }
-
- /* Prevent accidental token-pasting with a character
- before the macro call. */
- if (!traditional && obp != op->buf) {
- switch (obp[-1]) {
- case '!': case '%': case '&': case '*':
- case '+': case '-': case '.': case '/':
- case ':': case '<': case '=': case '>':
- case '^': case '|':
- /* If we are expanding a macro arg, make a newline marker
- to separate the tokens. If we are making real output,
- a plain space will do. */
- if (output_marks)
- *obp++ = '\n';
- *obp++ = ' ';
- }
- }
-
- /* Expand the macro, reading arguments as needed,
- and push the expansion on the input stack. */
- ip->bufp = ibp;
- op->bufp = obp;
- macroexpand (hp, op);
-
- /* Reexamine input stack, since macroexpand has pushed
- a new level on it. */
- obp = op->bufp;
- RECACHE;
- break;
- }
+
+ if (output_marks) {
+ check_expand (op, limit - ibp + 2);
+ *obp++ = '\n';
+ *obp++ = '-';
+ }
+ break;
+ }
+
+ /* If macro wants an arglist, verify that a '(' follows.
+ first skip all whitespace, copying it to the output
+ after the macro name. Then, if there is no '(',
+ decide this is not a macro call and leave things that way. */
+ if ((hp->type == T_MACRO || hp->type == T_DISABLED)
+ && hp->value.defn->nargs >= 0)
+ {
+ U_CHAR *old_ibp = ibp;
+ U_CHAR *old_obp = obp;
+ int old_iln = ip->lineno;
+ int old_oln = op->lineno;
+
+ while (1) {
+ /* Scan forward over whitespace, copying it to the output. */
+ if (ibp == limit && ip->macro != 0) {
+ POPMACRO;
+ RECACHE;
+ old_ibp = ibp;
+ old_obp = obp;
+ old_iln = ip->lineno;
+ old_oln = op->lineno;
+ }
+ else if (is_space[*ibp]) {
+ *obp++ = *ibp++;
+ if (ibp[-1] == '\n') {
+ if (ip->macro == 0) {
+ /* Newline in a file. Count it. */
+ ++ip->lineno;
+ ++op->lineno;
+ } else if (!output_marks) {
+ /* A newline mark, and we don't want marks
+ in the output. If it is newline-hyphen,
+ discard it entirely. Otherwise, it is
+ newline-whitechar, so keep the whitechar. */
+ obp--;
+ if (*ibp == '-')
+ ibp++;
+ else {
+ if (*ibp == '\n')
+ ++op->lineno;
+ *obp++ = *ibp++;
+ }
+ } else {
+ /* A newline mark; copy both chars to the output. */
+ *obp++ = *ibp++;
+ }
+ }
+ }
+ else if (ip->macro)
+ break;
+ else if (*ibp == '/') {
+ /* If a comment, copy it unchanged or discard it. */
+ if (ibp[1] == '\\' && ibp[2] == '\n')
+ newline_fix (ibp + 1);
+ if (ibp[1] == '*') {
+ if (put_out_comments) {
+ *obp++ = '/';
+ *obp++ = '*';
+ } else if (! traditional) {
+ *obp++ = ' ';
+ }
+ for (ibp += 2; ibp < limit; ibp++) {
+ /* We need not worry about newline-marks,
+ since they are never found in comments. */
+ if (ibp[0] == '*') {
+ if (ibp[1] == '\\' && ibp[2] == '\n')
+ newline_fix (ibp + 1);
+ if (ibp[1] == '/') {
+ ibp += 2;
+ if (put_out_comments) {
+ *obp++ = '*';
+ *obp++ = '/';
+ }
+ break;
+ }
+ }
+ if (*ibp == '\n') {
+ /* Newline in a file. Count it. */
+ ++ip->lineno;
+ ++op->lineno;
+ }
+ if (put_out_comments)
+ *obp++ = *ibp;
+ }
+ } else if (ibp[1] == '/' && cplusplus_comments) {
+ if (put_out_comments) {
+ *obp++ = '/';
+ *obp++ = '/';
+ } else if (! traditional) {
+ *obp++ = ' ';
+ }
+ for (ibp += 2; *ibp != '\n' || ibp[-1] == '\\'; ibp++)
+ if (put_out_comments)
+ *obp++ = *ibp;
+ } else
+ break;
+ }
+ else if (ibp[0] == '\\' && ibp[1] == '\n') {
+ ibp += 2;
+ ++ip->lineno;
+ }
+ else break;
+ }
+ if (*ibp != '(') {
+ /* It isn't a macro call.
+ Put back the space that we just skipped. */
+ ibp = old_ibp;
+ obp = old_obp;
+ ip->lineno = old_iln;
+ op->lineno = old_oln;
+ /* Exit the for loop. */
+ break;
+ }
+ }
+
+ /* This is now known to be a macro call.
+ Discard the macro name from the output,
+ along with any following whitespace just copied,
+ but preserve newlines if not outputting marks since this
+ is more likely to do the right thing with line numbers. */
+ obp = op->buf + obufp_before_macroname;
+ if (output_marks)
+ op->lineno = op_lineno_before_macroname;
+ else {
+ int newlines = op->lineno - op_lineno_before_macroname;
+ while (0 < newlines--)
+ *obp++ = '\n';
+ }
+
+ /* Prevent accidental token-pasting with a character
+ before the macro call. */
+ if (!traditional && obp != op->buf) {
+ switch (obp[-1]) {
+ case '!': case '%': case '&': case '*':
+ case '+': case '-': case '.': case '/':
+ case ':': case '<': case '=': case '>':
+ case '^': case '|':
+ /* If we are expanding a macro arg, make a newline marker
+ to separate the tokens. If we are making real output,
+ a plain space will do. */
+ if (output_marks)
+ *obp++ = '\n';
+ *obp++ = ' ';
+ }
+ }
+
+ /* Expand the macro, reading arguments as needed,
+ and push the expansion on the input stack. */
+ ip->bufp = ibp;
+ op->bufp = obp;
+ macroexpand (hp, op);
+
+ /* Reexamine input stack, since macroexpand has pushed
+ a new level on it. */
+ obp = op->bufp;
+ RECACHE;
+ break;
+ }
hashcollision:
- ;
- } /* End hash-table-search loop */
- }
- ident_length = hash = 0; /* Stop collecting identifier */
- redo_char = 0;
- concatenated = 0;
- } /* End if (ident_length > 0) */
- } /* End switch */
- } /* End per-char loop */
+ ;
+ } /* End hash-table-search loop */
+ }
+ ident_length = hash = 0; /* Stop collecting identifier */
+ redo_char = 0;
+ concatenated = 0;
+ } /* End if (ident_length > 0) */
+ } /* End switch */
+ } /* End per-char loop */
/* Come here to return -- but first give an error message
if there was an unterminated successful conditional. */
@@ -3448,28 +3448,28 @@ hashcollision:
char *str;
switch (if_stack->type)
- {
- case T_IF:
- str = "if";
- break;
- case T_IFDEF:
- str = "ifdef";
- break;
- case T_IFNDEF:
- str = "ifndef";
- break;
- case T_ELSE:
- str = "else";
- break;
- case T_ELIF:
- str = "elif";
- break;
- default:
- abort ();
- }
+ {
+ case T_IF:
+ str = "if";
+ break;
+ case T_IFDEF:
+ str = "ifdef";
+ break;
+ case T_IFNDEF:
+ str = "ifndef";
+ break;
+ case T_ELSE:
+ str = "else";
+ break;
+ case T_ELIF:
+ str = "elif";
+ break;
+ default:
+ abort ();
+ }
error_with_line (line_for_error (if_stack->lineno),
- "unterminated `#%s' conditional", str);
+ "unterminated `#%s' conditional", str);
}
if_stack = ip->if_stack;
}
@@ -3591,13 +3591,13 @@ handle_directive (ip, op)
while (1) {
if (is_hor_space[*bp]) {
if (*bp != ' ' && *bp != '\t' && pedantic)
- pedwarn ("%s in preprocessing directive", char_name[*bp]);
+ pedwarn ("%s in preprocessing directive", char_name[*bp]);
bp++;
} else if (*bp == '/') {
if (bp[1] == '\\' && bp[2] == '\n')
- newline_fix (bp + 1);
+ newline_fix (bp + 1);
if (! (bp[1] == '*' || (cplusplus_comments && bp[1] == '/')))
- break;
+ break;
ip->bufp = bp + 2;
skip_to_end_of_comment (ip, &ip->lineno, 0);
bp = ip->bufp;
@@ -3616,9 +3616,9 @@ handle_directive (ip, op)
cp++;
else {
if (*cp == '\\' && cp[1] == '\n')
- name_newline_fix (cp);
+ name_newline_fix (cp);
if (is_idchar[*cp])
- cp++;
+ cp++;
else break;
}
}
@@ -3637,16 +3637,16 @@ handle_directive (ip, op)
U_CHAR *p = ident;
while (is_idchar[*p]) {
if (*p < '0' || *p > '9')
- break;
+ break;
p++;
}
/* Handle # followed by a line number. */
if (p != ident && !is_idchar[*p]) {
static struct directive line_directive_table[] = {
- { 4, do_line, "line", T_LINE},
+ { 4, do_line, "line", T_LINE},
};
if (pedantic)
- pedwarn ("`#' followed by integer");
+ pedwarn ("`#' followed by integer");
after_ident = ident;
kt = line_directive_table;
goto old_linenum;
@@ -3656,9 +3656,9 @@ handle_directive (ip, op)
if (p == ident) {
while (*p == '#' || is_hor_space[*p]) p++;
if (*p == '\n') {
- if (pedantic && !lang_asm)
- warning ("invalid preprocessing directive");
- return 0;
+ if (pedantic && !lang_asm)
+ warning ("invalid preprocessing directive");
+ return 0;
}
}
@@ -3681,7 +3681,7 @@ handle_directive (ip, op)
int *already_output;
/* Nonzero means do not delete comments within the directive.
- #define needs this when -traditional. */
+ #define needs this when -traditional. */
int keep_comments;
old_linenum:
@@ -3692,286 +3692,286 @@ handle_directive (ip, op)
keep_comments = traditional && kt->type == T_DEFINE;
/* #import is defined only in Objective C, or when on the NeXT. */
if (kt->type == T_IMPORT
- && !(objc || lookup ((U_CHAR *) "__NeXT__", -1, -1)))
- break;
+ && !(objc || lookup ((U_CHAR *) "__NeXT__", -1, -1)))
+ break;
/* Find the end of this directive (first newline not backslashed
- and not in a string or comment).
- Set COPY_DIRECTIVE if the directive must be copied
- (it contains a backslash-newline or a comment). */
+ and not in a string or comment).
+ Set COPY_DIRECTIVE if the directive must be copied
+ (it contains a backslash-newline or a comment). */
buf = bp = after_ident;
while (bp < limit) {
- register U_CHAR c = *bp++;
- switch (c) {
- case '\\':
- if (bp < limit) {
- if (*bp == '\n') {
- ip->lineno++;
- copy_directive = 1;
- bp++;
- } else if (traditional)
- bp++;
- }
- break;
-
- case '"':
- /* "..." is special for #include. */
- if (IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) {
- while (bp < limit && *bp != '\n') {
- if (*bp == '"') {
- bp++;
- break;
- }
- if (*bp == '\\' && bp[1] == '\n') {
- ip->lineno++;
- copy_directive = 1;
- bp++;
- }
- bp++;
- }
- break;
- }
- /* Fall through. */
- case '\'':
- bp = skip_quoted_string (bp - 1, limit, ip->lineno, &ip->lineno, &copy_directive, &unterminated);
- /* Don't bother calling the directive if we already got an error
- message due to unterminated string. Skip everything and pretend
- we called the directive. */
- if (unterminated) {
- if (traditional) {
- /* Traditional preprocessing permits unterminated strings. */
- ip->bufp = bp;
- goto endloop1;
- }
- ip->bufp = bp;
- return 1;
- }
- break;
-
- /* <...> is special for #include. */
- case '<':
- if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type))
- break;
- while (bp < limit && *bp != '>' && *bp != '\n') {
- if (*bp == '\\' && bp[1] == '\n') {
- ip->lineno++;
- copy_directive = 1;
- bp++;
- }
- bp++;
- }
- break;
-
- case '/':
- if (*bp == '\\' && bp[1] == '\n')
- newline_fix (bp);
- if (*bp == '*'
- || (cplusplus_comments && *bp == '/')) {
- U_CHAR *obp = bp - 1;
- ip->bufp = bp + 1;
- skip_to_end_of_comment (ip, &ip->lineno, 0);
- bp = ip->bufp;
- /* No need to copy the directive because of a comment at the end;
- just don't include the comment in the directive. */
- if (!put_out_comments) {
- U_CHAR *p;
- for (p = bp; *p == ' ' || *p == '\t'; p++)
- continue;
- if (*p == '\n') {
- bp = obp;
- goto endloop1;
- }
- }
- /* Don't remove the comments if -traditional. */
- if (! keep_comments)
- copy_directive++;
- }
- break;
-
- case '\f':
- case '\r':
- case '\v':
- if (pedantic)
- pedwarn ("%s in preprocessing directive", char_name[c]);
- break;
-
- case '\n':
- --bp; /* Point to the newline */
- ip->bufp = bp;
- goto endloop1;
- }
+ register U_CHAR c = *bp++;
+ switch (c) {
+ case '\\':
+ if (bp < limit) {
+ if (*bp == '\n') {
+ ip->lineno++;
+ copy_directive = 1;
+ bp++;
+ } else if (traditional)
+ bp++;
+ }
+ break;
+
+ case '"':
+ /* "..." is special for #include. */
+ if (IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) {
+ while (bp < limit && *bp != '\n') {
+ if (*bp == '"') {
+ bp++;
+ break;
+ }
+ if (*bp == '\\' && bp[1] == '\n') {
+ ip->lineno++;
+ copy_directive = 1;
+ bp++;
+ }
+ bp++;
+ }
+ break;
+ }
+ /* Fall through. */
+ case '\'':
+ bp = skip_quoted_string (bp - 1, limit, ip->lineno, &ip->lineno, &copy_directive, &unterminated);
+ /* Don't bother calling the directive if we already got an error
+ message due to unterminated string. Skip everything and pretend
+ we called the directive. */
+ if (unterminated) {
+ if (traditional) {
+ /* Traditional preprocessing permits unterminated strings. */
+ ip->bufp = bp;
+ goto endloop1;
+ }
+ ip->bufp = bp;
+ return 1;
+ }
+ break;
+
+ /* <...> is special for #include. */
+ case '<':
+ if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type))
+ break;
+ while (bp < limit && *bp != '>' && *bp != '\n') {
+ if (*bp == '\\' && bp[1] == '\n') {
+ ip->lineno++;
+ copy_directive = 1;
+ bp++;
+ }
+ bp++;
+ }
+ break;
+
+ case '/':
+ if (*bp == '\\' && bp[1] == '\n')
+ newline_fix (bp);
+ if (*bp == '*'
+ || (cplusplus_comments && *bp == '/')) {
+ U_CHAR *obp = bp - 1;
+ ip->bufp = bp + 1;
+ skip_to_end_of_comment (ip, &ip->lineno, 0);
+ bp = ip->bufp;
+ /* No need to copy the directive because of a comment at the end;
+ just don't include the comment in the directive. */
+ if (!put_out_comments) {
+ U_CHAR *p;
+ for (p = bp; *p == ' ' || *p == '\t'; p++)
+ continue;
+ if (*p == '\n') {
+ bp = obp;
+ goto endloop1;
+ }
+ }
+ /* Don't remove the comments if -traditional. */
+ if (! keep_comments)
+ copy_directive++;
+ }
+ break;
+
+ case '\f':
+ case '\r':
+ case '\v':
+ if (pedantic)
+ pedwarn ("%s in preprocessing directive", char_name[c]);
+ break;
+
+ case '\n':
+ --bp; /* Point to the newline */
+ ip->bufp = bp;
+ goto endloop1;
+ }
}
ip->bufp = bp;
endloop1:
resume_p = ip->bufp;
/* BP is the end of the directive.
- RESUME_P is the next interesting data after the directive.
- A comment may come between. */
+ RESUME_P is the next interesting data after the directive.
+ A comment may come between. */
/* If a directive should be copied through, and -C was given,
- pass it through before removing comments. */
+ pass it through before removing comments. */
if (!no_output && put_out_comments
- && (kt->type == T_DEFINE ? dump_macros == dump_definitions
- : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes
- : kt->type == T_PRAGMA)) {
+ && (kt->type == T_DEFINE ? dump_macros == dump_definitions
+ : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes
+ : kt->type == T_PRAGMA)) {
int len;
- /* Output directive name. */
+ /* Output directive name. */
check_expand (op, kt->length + 2);
- /* Make sure # is at the start of a line */
- if (op->bufp > op->buf && op->bufp[-1] != '\n') {
- op->lineno++;
- *op->bufp++ = '\n';
- }
+ /* Make sure # is at the start of a line */
+ if (op->bufp > op->buf && op->bufp[-1] != '\n') {
+ op->lineno++;
+ *op->bufp++ = '\n';
+ }
*op->bufp++ = '#';
bcopy (kt->name, op->bufp, kt->length);
op->bufp += kt->length;
- /* Output arguments. */
- len = (bp - buf);
- check_expand (op, len);
- bcopy (buf, (char *) op->bufp, len);
- op->bufp += len;
- /* Take account of any (escaped) newlines just output. */
- while (--len >= 0)
- if (buf[len] == '\n')
- op->lineno++;
+ /* Output arguments. */
+ len = (bp - buf);
+ check_expand (op, len);
+ bcopy (buf, (char *) op->bufp, len);
+ op->bufp += len;
+ /* Take account of any (escaped) newlines just output. */
+ while (--len >= 0)
+ if (buf[len] == '\n')
+ op->lineno++;
- already_output = &junk;
- } /* Don't we need a newline or #line? */
+ already_output = &junk;
+ } /* Don't we need a newline or #line? */
if (copy_directive) {
- register U_CHAR *xp = buf;
- /* Need to copy entire directive into temp buffer before dispatching */
-
- cp = (U_CHAR *) alloca (bp - buf + 5); /* room for directive plus
- some slop */
- buf = cp;
-
- /* Copy to the new buffer, deleting comments
- and backslash-newlines (and whitespace surrounding the latter). */
-
- while (xp < bp) {
- register U_CHAR c = *xp++;
- *cp++ = c;
-
- switch (c) {
- case '\n':
- abort (); /* A bare newline should never part of the line. */
- break;
-
- /* <...> is special for #include. */
- case '<':
- if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type))
- break;
- while (xp < bp && c != '>') {
- c = *xp++;
- if (c == '\\' && xp < bp && *xp == '\n')
- xp++;
- else
- *cp++ = c;
- }
- break;
-
- case '\\':
- if (*xp == '\n') {
- xp++;
- cp--;
- if (cp != buf && is_hor_space[cp[-1]]) {
- while (cp - 1 != buf && is_hor_space[cp[-2]])
- cp--;
- SKIP_WHITE_SPACE (xp);
- } else if (is_hor_space[*xp]) {
- *cp++ = *xp++;
- SKIP_WHITE_SPACE (xp);
- }
- } else if (traditional && xp < bp) {
- *cp++ = *xp++;
- }
- break;
-
- case '\'':
- case '\"':
- {
- register U_CHAR *bp1
- = skip_quoted_string (xp - 1, bp, ip->lineno,
- NULL_PTR, NULL_PTR, NULL_PTR);
- while (xp != bp1)
- *cp++ = *xp++;
- }
- break;
-
- case '/':
- if (*xp == '*'
- || (cplusplus_comments && *xp == '/')) {
- ip->bufp = xp + 1;
- /* If we already copied the directive through,
- already_output != 0 prevents outputting comment now. */
- skip_to_end_of_comment (ip, already_output, 0);
- if (keep_comments)
- while (xp != ip->bufp)
- *cp++ = *xp++;
- /* Delete or replace the slash. */
- else if (traditional)
- cp--;
- else
- cp[-1] = ' ';
- xp = ip->bufp;
- }
- }
- }
-
- /* Null-terminate the copy. */
-
- *cp = 0;
+ register U_CHAR *xp = buf;
+ /* Need to copy entire directive into temp buffer before dispatching */
+
+ cp = (U_CHAR *) alloca (bp - buf + 5); /* room for directive plus
+ some slop */
+ buf = cp;
+
+ /* Copy to the new buffer, deleting comments
+ and backslash-newlines (and whitespace surrounding the latter). */
+
+ while (xp < bp) {
+ register U_CHAR c = *xp++;
+ *cp++ = c;
+
+ switch (c) {
+ case '\n':
+ abort (); /* A bare newline should never part of the line. */
+ break;
+
+ /* <...> is special for #include. */
+ case '<':
+ if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type))
+ break;
+ while (xp < bp && c != '>') {
+ c = *xp++;
+ if (c == '\\' && xp < bp && *xp == '\n')
+ xp++;
+ else
+ *cp++ = c;
+ }
+ break;
+
+ case '\\':
+ if (*xp == '\n') {
+ xp++;
+ cp--;
+ if (cp != buf && is_hor_space[cp[-1]]) {
+ while (cp - 1 != buf && is_hor_space[cp[-2]])
+ cp--;
+ SKIP_WHITE_SPACE (xp);
+ } else if (is_hor_space[*xp]) {
+ *cp++ = *xp++;
+ SKIP_WHITE_SPACE (xp);
+ }
+ } else if (traditional && xp < bp) {
+ *cp++ = *xp++;
+ }
+ break;
+
+ case '\'':
+ case '\"':
+ {
+ register U_CHAR *bp1
+ = skip_quoted_string (xp - 1, bp, ip->lineno,
+ NULL_PTR, NULL_PTR, NULL_PTR);
+ while (xp != bp1)
+ *cp++ = *xp++;
+ }
+ break;
+
+ case '/':
+ if (*xp == '*'
+ || (cplusplus_comments && *xp == '/')) {
+ ip->bufp = xp + 1;
+ /* If we already copied the directive through,
+ already_output != 0 prevents outputting comment now. */
+ skip_to_end_of_comment (ip, already_output, 0);
+ if (keep_comments)
+ while (xp != ip->bufp)
+ *cp++ = *xp++;
+ /* Delete or replace the slash. */
+ else if (traditional)
+ cp--;
+ else
+ cp[-1] = ' ';
+ xp = ip->bufp;
+ }
+ }
+ }
+
+ /* Null-terminate the copy. */
+
+ *cp = 0;
} else
- cp = bp;
+ cp = bp;
ip->bufp = resume_p;
/* Some directives should be written out for cc1 to process,
- just as if they were not defined. And sometimes we're copying
- directives through. */
+ just as if they were not defined. And sometimes we're copying
+ directives through. */
if (!no_output && already_output == 0
- && (kt->type == T_DEFINE ? (int) dump_names <= (int) dump_macros
- : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes
- : kt->type == T_PRAGMA)) {
+ && (kt->type == T_DEFINE ? (int) dump_names <= (int) dump_macros
+ : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes
+ : kt->type == T_PRAGMA)) {
int len;
- /* Output directive name. */
+ /* Output directive name. */
check_expand (op, kt->length + 1);
*op->bufp++ = '#';
bcopy (kt->name, (char *) op->bufp, kt->length);
op->bufp += kt->length;
- if (kt->type == T_DEFINE && dump_macros == dump_names) {
- /* Output `#define name' only. */
- U_CHAR *xp = buf;
- U_CHAR *yp;
- SKIP_WHITE_SPACE (xp);
- yp = xp;
- while (is_idchar[*xp]) xp++;
- len = (xp - yp);
- check_expand (op, len + 1);
- *op->bufp++ = ' ';
- bcopy (yp, (char *) op->bufp, len);
- } else {
- /* Output entire directive. */
- len = (cp - buf);
- check_expand (op, len);
- bcopy (buf, (char *) op->bufp, len);
- }
- op->bufp += len;
- } /* Don't we need a newline or #line? */
+ if (kt->type == T_DEFINE && dump_macros == dump_names) {
+ /* Output `#define name' only. */
+ U_CHAR *xp = buf;
+ U_CHAR *yp;
+ SKIP_WHITE_SPACE (xp);
+ yp = xp;
+ while (is_idchar[*xp]) xp++;
+ len = (xp - yp);
+ check_expand (op, len + 1);
+ *op->bufp++ = ' ';
+ bcopy (yp, (char *) op->bufp, len);
+ } else {
+ /* Output entire directive. */
+ len = (cp - buf);
+ check_expand (op, len);
+ bcopy (buf, (char *) op->bufp, len);
+ }
+ op->bufp += len;
+ } /* Don't we need a newline or #line? */
/* Call the appropriate directive handler. buf now points to
- either the appropriate place in the input buffer, or to
- the temp buffer if it was necessary to make one. cp
- points to the first char after the contents of the (possibly
- copied) directive, in either case. */
+ either the appropriate place in the input buffer, or to
+ the temp buffer if it was necessary to make one. cp
+ points to the first char after the contents of the (possibly
+ copied) directive, in either case. */
(*kt->func) (buf, cp, op, kt);
check_expand (op, ip->length - (ip->bufp - ip->buf));
@@ -3996,8 +3996,8 @@ timestamp ()
}
static char *monthnames[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- };
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+ };
/*
* expand things like __FILE__. Place the expansion into the output
@@ -4015,12 +4015,12 @@ special_symbol (hp, op)
FILE_BUF *ip = NULL;
struct tm *timebuf;
- int paren = 0; /* For special `defined' keyword */
+ int paren = 0; /* For special `defined' keyword */
if (pcp_outfile && pcp_inside_if
&& hp->type != T_SPEC_DEFINED && hp->type != T_CONST)
error ("Predefined macro `%s' used inside `#if' during precompilation",
- hp->name);
+ hp->name);
for (i = indepth; i >= 0; i--)
if (instack[i].fname != NULL) {
@@ -4029,7 +4029,7 @@ special_symbol (hp, op)
}
if (ip == NULL) {
error ("cccp error: not in any file?!");
- return; /* the show must go on */
+ return; /* the show must go on */
}
switch (hp->type) {
@@ -4038,17 +4038,17 @@ special_symbol (hp, op)
{
char *string;
if (hp->type == T_FILE)
- string = ip->nominal_fname;
+ string = ip->nominal_fname;
else
- string = instack[0].nominal_fname;
+ string = instack[0].nominal_fname;
if (string)
- {
- buf = (char *) alloca (3 + 4 * strlen (string));
- quote_string (buf, string);
- }
+ {
+ buf = (char *) alloca (3 + 4 * strlen (string));
+ quote_string (buf, string);
+ }
else
- buf = "\"\"";
+ buf = "\"\"";
break;
}
@@ -4059,7 +4059,7 @@ special_symbol (hp, op)
if (instack[i].fname != NULL)
true_indepth++;
- buf = (char *) alloca (8); /* Eight bytes ought to be more than enough */
+ buf = (char *) alloca (8); /* Eight bytes ought to be more than enough */
sprintf (buf, "%d", true_indepth - 1);
break;
@@ -4100,8 +4100,8 @@ special_symbol (hp, op)
buf = hp->value.cpval;
#ifdef STDC_0_IN_SYSTEM_HEADERS
if (ip->system_header_p
- && hp->length == 8 && bcmp (hp->name, "__STDC__", 8) == 0
- && !lookup ((U_CHAR *) "__STRICT_ANSI__", -1, -1))
+ && hp->length == 8 && bcmp (hp->name, "__STDC__", 8) == 0
+ && !lookup ((U_CHAR *) "__STRICT_ANSI__", -1, -1))
buf = "0";
#endif
if (pcp_inside_if && pcp_outfile)
@@ -4120,19 +4120,19 @@ special_symbol (hp, op)
timebuf = timestamp ();
if (hp->type == T_DATE)
sprintf (buf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon],
- timebuf->tm_mday, timebuf->tm_year + 1900);
+ timebuf->tm_mday, timebuf->tm_year + 1900);
else
sprintf (buf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min,
- timebuf->tm_sec);
+ timebuf->tm_sec);
break;
case T_SPEC_DEFINED:
- buf = " 0 "; /* Assume symbol is not defined */
+ buf = " 0 "; /* Assume symbol is not defined */
ip = &instack[indepth];
SKIP_WHITE_SPACE (ip->bufp);
if (*ip->bufp == '(') {
paren++;
- ip->bufp++; /* Skip over the paren */
+ ip->bufp++; /* Skip over the paren */
SKIP_WHITE_SPACE (ip->bufp);
}
@@ -4142,27 +4142,27 @@ special_symbol (hp, op)
goto oops;
if ((hp = lookup (ip->bufp, -1, -1))) {
if (pcp_outfile && pcp_inside_if
- && (hp->type == T_CONST
- || (hp->type == T_MACRO && hp->value.defn->predefined)))
- /* Output a precondition for this macro use. */
- fprintf (pcp_outfile, "#define %s\n", hp->name);
+ && (hp->type == T_CONST
+ || (hp->type == T_MACRO && hp->value.defn->predefined)))
+ /* Output a precondition for this macro use. */
+ fprintf (pcp_outfile, "#define %s\n", hp->name);
buf = " 1 ";
}
else
- if (pcp_outfile && pcp_inside_if) {
- /* Output a precondition for this macro use */
- U_CHAR *cp = ip->bufp;
- fprintf (pcp_outfile, "#undef ");
- while (is_idchar[*cp]) /* Ick! */
- fputc (*cp++, pcp_outfile);
- putc ('\n', pcp_outfile);
+ if (pcp_outfile && pcp_inside_if) {
+ /* Output a precondition for this macro use */
+ U_CHAR *cp = ip->bufp;
+ fprintf (pcp_outfile, "#undef ");
+ while (is_idchar[*cp]) /* Ick! */
+ fputc (*cp++, pcp_outfile);
+ putc ('\n', pcp_outfile);
}
while (is_idchar[*ip->bufp])
++ip->bufp;
SKIP_WHITE_SPACE (ip->bufp);
if (paren) {
if (*ip->bufp != ')')
- goto oops;
+ goto oops;
++ip->bufp;
}
break;
@@ -4199,25 +4199,25 @@ do_include (buf, limit, op, keyword)
U_CHAR *importing = keyword->type == T_IMPORT ? (U_CHAR *) "" : (U_CHAR *) 0;
int skip_dirs = (keyword->type == T_INCLUDE_NEXT);
static int import_warning = 0;
- char *fname; /* Dynamically allocated fname buffer */
+ char *fname; /* Dynamically allocated fname buffer */
char *pcftry;
char *pcfname;
- char *fbeg, *fend; /* Beginning and end of fname */
+ char *fbeg, *fend; /* Beginning and end of fname */
U_CHAR *fin;
struct file_name_list *search_start = include; /* Chain of dirs to search */
- struct file_name_list *dsp; /* First in chain, if #include "..." */
+ struct file_name_list *dsp; /* First in chain, if #include "..." */
struct file_name_list *searchptr = 0;
size_t flen;
- int f = -3; /* file number */
+ int f = -3; /* file number */
struct include_file *inc = 0;
- int retried = 0; /* Have already tried macro
- expanding the include line*/
- int angle_brackets = 0; /* 0 for "...", 1 for <...> */
+ int retried = 0; /* Have already tried macro
+ expanding the include line*/
+ int angle_brackets = 0; /* 0 for "...", 1 for <...> */
#ifdef VMS
- int vaxc_include = 0; /* 1 for token without punctuation */
+ int vaxc_include = 0; /* 1 for token without punctuation */
#endif
int pcf = -1;
char *pcfbuf;
@@ -4227,9 +4227,9 @@ do_include (buf, limit, op, keyword)
if (pedantic && !instack[indepth].system_header_p)
{
if (importing)
- pedwarn ("ANSI C does not allow `#import'");
+ pedwarn ("ANSI C does not allow `#import'");
if (skip_dirs)
- pedwarn ("ANSI C does not allow `#include_next'");
+ pedwarn ("ANSI C does not allow `#include_next'");
}
if (importing && warn_import && !inhibit_warnings
@@ -4263,60 +4263,60 @@ get_filename:
FILE_BUF *fp;
/* Copy the operand text, concatenating the strings. */
{
- for (;;) {
- for (;;) {
- if (fin == limit)
- goto invalid_include_file_name;
- *fend = *fin++;
- if (*fend == '"')
- break;
- fend++;
- }
- if (fin == limit)
- break;
- /* If not at the end, there had better be another string. */
- /* Skip just horiz space, and don't go past limit. */
- while (fin != limit && is_hor_space[*fin]) fin++;
- if (fin != limit && *fin == '\"')
- fin++;
- else
- goto fail;
- }
+ for (;;) {
+ for (;;) {
+ if (fin == limit)
+ goto invalid_include_file_name;
+ *fend = *fin++;
+ if (*fend == '"')
+ break;
+ fend++;
+ }
+ if (fin == limit)
+ break;
+ /* If not at the end, there had better be another string. */
+ /* Skip just horiz space, and don't go past limit. */
+ while (fin != limit && is_hor_space[*fin]) fin++;
+ if (fin != limit && *fin == '\"')
+ fin++;
+ else
+ goto fail;
+ }
}
/* We have "filename". Figure out directory this source
- file is coming from and put it on the front of the list. */
+ file is coming from and put it on the front of the list. */
/* If -I- was specified, don't search current dir, only spec'd ones. */
if (ignore_srcdir) break;
for (fp = &instack[indepth]; fp >= instack; fp--)
- {
- int n;
- char *nam;
-
- if ((nam = fp->nominal_fname) != NULL) {
- /* Found a named file. Figure out dir of the file,
- and put it in front of the search list. */
- dsp = ((struct file_name_list *)
- alloca (sizeof (struct file_name_list) + strlen (nam)));
- strcpy (dsp->fname, nam);
- simplify_filename (dsp->fname);
- nam = base_name (dsp->fname);
- *nam = 0;
- /* But for efficiency's sake, do not insert the dir
- if it matches the search list's first dir. */
- dsp->next = search_start;
- if (!search_start || strcmp (dsp->fname, search_start->fname)) {
- search_start = dsp;
- n = nam - dsp->fname;
- if (n + INCLUDE_LEN_FUDGE > max_include_len)
- max_include_len = n + INCLUDE_LEN_FUDGE;
- }
- dsp[0].got_name_map = 0;
- break;
- }
- }
+ {
+ int n;
+ char *nam;
+
+ if ((nam = fp->nominal_fname) != NULL) {
+ /* Found a named file. Figure out dir of the file,
+ and put it in front of the search list. */
+ dsp = ((struct file_name_list *)
+ alloca (sizeof (struct file_name_list) + strlen (nam)));
+ strcpy (dsp->fname, nam);
+ simplify_filename (dsp->fname);
+ nam = base_name (dsp->fname);
+ *nam = 0;
+ /* But for efficiency's sake, do not insert the dir
+ if it matches the search list's first dir. */
+ dsp->next = search_start;
+ if (!search_start || strcmp (dsp->fname, search_start->fname)) {
+ search_start = dsp;
+ n = nam - dsp->fname;
+ if (n + INCLUDE_LEN_FUDGE > max_include_len)
+ max_include_len = n + INCLUDE_LEN_FUDGE;
+ }
+ dsp[0].got_name_map = 0;
+ break;
+ }
+ }
break;
}
@@ -4341,14 +4341,14 @@ get_filename:
*/
if (retried && isalpha(*(U_CHAR *) (--fbeg))) {
while (fin != limit && (!isspace(*fin)))
- *fend++ = *fin++;
+ *fend++ = *fin++;
warning ("VAX-C-style include specification found, use '#include <filename.h>' !");
vaxc_include = 1;
if (fin == limit) {
- angle_brackets = 1;
- /* If -I-, start with the first -I dir after the -I-. */
- search_start = first_bracket_include;
- break;
+ angle_brackets = 1;
+ /* If -I-, start with the first -I dir after the -I-. */
+ search_start = first_bracket_include;
+ break;
}
}
#endif
@@ -4356,36 +4356,36 @@ get_filename:
fail:
if (! retried) {
/* Expand buffer and then remove any newline markers.
- We can't just tell expand_to_temp_buffer to omit the markers,
- since it would put extra spaces in include file names. */
+ We can't just tell expand_to_temp_buffer to omit the markers,
+ since it would put extra spaces in include file names. */
FILE_BUF trybuf;
U_CHAR *src;
int errors_before_expansion = errors;
trybuf = expand_to_temp_buffer (buf, limit, 1, 0);
if (errors != errors_before_expansion) {
- free (trybuf.buf);
- goto invalid_include_file_name;
+ free (trybuf.buf);
+ goto invalid_include_file_name;
}
src = trybuf.buf;
buf = (U_CHAR *) alloca (trybuf.bufp - trybuf.buf + 1);
limit = buf;
while (src != trybuf.bufp) {
- switch ((*limit++ = *src++)) {
- case '\n':
- limit--;
- src++;
- break;
-
- case '\'':
- case '\"':
- {
- U_CHAR *src1 = skip_quoted_string (src - 1, trybuf.bufp, 0,
- NULL_PTR, NULL_PTR, NULL_PTR);
- while (src != src1)
- *limit++ = *src++;
- }
- break;
- }
+ switch ((*limit++ = *src++)) {
+ case '\n':
+ limit--;
+ src++;
+ break;
+
+ case '\'':
+ case '\"':
+ {
+ U_CHAR *src1 = skip_quoted_string (src - 1, trybuf.bufp, 0,
+ NULL_PTR, NULL_PTR, NULL_PTR);
+ while (src != src1)
+ *limit++ = *src++;
+ }
+ break;
+ }
}
*limit = 0;
free (trybuf.buf);
@@ -4404,11 +4404,11 @@ get_filename:
FILE_BUF *fp;
for (fp = &instack[indepth]; fp >= instack; fp--)
if (fp->fname != NULL) {
- /* fp->dir is null if the containing file was specified
- with an absolute file name. In that case, don't skip anything. */
- if (fp->dir)
- search_start = fp->dir->next;
- break;
+ /* fp->dir is null if the containing file was specified
+ with an absolute file name. In that case, don't skip anything. */
+ if (fp->dir)
+ search_start = fp->dir->next;
+ break;
}
}
@@ -4447,17 +4447,17 @@ get_filename:
for (searchptr = search_start; searchptr; searchptr = searchptr->next) {
if (searchptr == first_bracket_include) {
- /* Go to bypass directory if we know we've seen this file before. */
- static struct bypass_dir *bypass_hashtab[INCLUDE_HASHSIZE];
- struct bypass_dir *p;
- bypass_slot = &bypass_hashtab[hashf ((U_CHAR *) fbeg, flen,
- INCLUDE_HASHSIZE)];
- for (p = *bypass_slot; p; p = p->next)
- if (!strcmp (fbeg, p->fname)) {
- searchptr = p->searchptr;
- bypass_slot = 0;
- break;
- }
+ /* Go to bypass directory if we know we've seen this file before. */
+ static struct bypass_dir *bypass_hashtab[INCLUDE_HASHSIZE];
+ struct bypass_dir *p;
+ bypass_slot = &bypass_hashtab[hashf ((U_CHAR *) fbeg, flen,
+ INCLUDE_HASHSIZE)];
+ for (p = *bypass_slot; p; p = p->next)
+ if (!strcmp (fbeg, p->fname)) {
+ searchptr = p->searchptr;
+ bypass_slot = 0;
+ break;
+ }
}
strcpy (fname, searchptr->fname);
@@ -4466,40 +4466,40 @@ get_filename:
/* Change this 1/2 Unix 1/2 VMS file specification into a
full VMS file specification */
if (searchptr->fname[0]) {
- /* Fix up the filename */
- hack_vms_include_specification (fname, vaxc_include);
+ /* Fix up the filename */
+ hack_vms_include_specification (fname, vaxc_include);
} else {
- /* This is a normal VMS filespec, so use it unchanged. */
- strcpy (fname, fbeg);
- /* if it's '#include filename', add the missing .h */
- if (vaxc_include && index(fname,'.')==NULL) {
- strcat (fname, ".h");
- }
+ /* This is a normal VMS filespec, so use it unchanged. */
+ strcpy (fname, fbeg);
+ /* if it's '#include filename', add the missing .h */
+ if (vaxc_include && index(fname,'.')==NULL) {
+ strcat (fname, ".h");
+ }
}
#endif /* VMS */
f = open_include_file (fname, searchptr, importing, &inc);
if (f != -1) {
- if (bypass_slot && searchptr != first_bracket_include) {
- /* This is the first time we found this include file,
- and we found it after first_bracket_include.
- Record its location so that we can bypass to here next time. */
- struct bypass_dir *p
- = (struct bypass_dir *) xmalloc (sizeof (struct bypass_dir));
- p->next = *bypass_slot;
- p->fname = fname + strlen (searchptr->fname);
- p->searchptr = searchptr;
- *bypass_slot = p;
- }
- break;
+ if (bypass_slot && searchptr != first_bracket_include) {
+ /* This is the first time we found this include file,
+ and we found it after first_bracket_include.
+ Record its location so that we can bypass to here next time. */
+ struct bypass_dir *p
+ = (struct bypass_dir *) xmalloc (sizeof (struct bypass_dir));
+ p->next = *bypass_slot;
+ p->fname = fname + strlen (searchptr->fname);
+ p->searchptr = searchptr;
+ *bypass_slot = p;
+ }
+ break;
}
#ifdef VMS
/* Our VMS hacks can produce invalid filespecs, so don't worry
- about errors other than EACCES. */
+ about errors other than EACCES. */
if (errno == EACCES)
- break;
+ break;
#else
if (errno != ENOENT && errno != ENOTDIR)
- break;
+ break;
#endif
}
}
@@ -4515,26 +4515,26 @@ get_filename:
or other similar place; these missing files may be generated from
other files and may not exist yet (eg: y.tab.h). */
} else if (print_deps_missing_files
- && (system_include_depth != 0) < print_deps)
+ && (system_include_depth != 0) < print_deps)
{
- /* If it was requested as a system header file,
- then assume it belongs in the first place to look for such. */
- if (angle_brackets)
- {
- if (search_start) {
- char *p = (char *) alloca (strlen (search_start->fname)
- + strlen (fbeg) + 1);
- strcpy (p, search_start->fname);
- strcat (p, fbeg);
- deps_output (p, ' ');
- }
- }
- else
- {
- /* Otherwise, omit the directory, as if the file existed
- in the directory with the source. */
- deps_output (fbeg, ' ');
- }
+ /* If it was requested as a system header file,
+ then assume it belongs in the first place to look for such. */
+ if (angle_brackets)
+ {
+ if (search_start) {
+ char *p = (char *) alloca (strlen (search_start->fname)
+ + strlen (fbeg) + 1);
+ strcpy (p, search_start->fname);
+ strcat (p, fbeg);
+ deps_output (p, ' ');
+ }
+ }
+ else
+ {
+ /* Otherwise, omit the directory, as if the file existed
+ in the directory with the source. */
+ deps_output (fbeg, ' ');
+ }
}
/* If -M was specified, and this header file won't be added to the
dependency list, then don't count this as an error, because we can
@@ -4558,31 +4558,31 @@ get_filename:
if (!no_precomp)
{
- do {
- sprintf (pcftry, "%s%d", fname, pcfnum++);
-
- pcf = open (pcftry, O_RDONLY, 0666);
- if (pcf != -1)
- {
- struct stat s;
-
- if (fstat (pcf, &s) != 0)
- pfatal_with_name (pcftry);
- if (! INO_T_EQ (inc->st.st_ino, s.st_ino)
- || inc->st.st_dev != s.st_dev)
- {
- pcfbuf = check_precompiled (pcf, &s, fname, &pcfbuflimit);
- /* Don't need it any more. */
- close (pcf);
- }
- else
- {
- /* Don't need it at all. */
- close (pcf);
- break;
- }
- }
- } while (pcf != -1 && !pcfbuf);
+ do {
+ sprintf (pcftry, "%s%d", fname, pcfnum++);
+
+ pcf = open (pcftry, O_RDONLY, 0666);
+ if (pcf != -1)
+ {
+ struct stat s;
+
+ if (fstat (pcf, &s) != 0)
+ pfatal_with_name (pcftry);
+ if (! INO_T_EQ (inc->st.st_ino, s.st_ino)
+ || inc->st.st_dev != s.st_dev)
+ {
+ pcfbuf = check_precompiled (pcf, &s, fname, &pcfbuflimit);
+ /* Don't need it any more. */
+ close (pcf);
+ }
+ else
+ {
+ /* Don't need it at all. */
+ close (pcf);
+ break;
+ }
+ }
+ } while (pcf != -1 && !pcfbuf);
}
/* Actually process the file */
@@ -4590,7 +4590,7 @@ get_filename:
pcfname = xmalloc (strlen (pcftry) + 1);
strcpy (pcfname, pcftry);
pcfinclude ((U_CHAR *) pcfbuf, (U_CHAR *) pcfbuflimit,
- (U_CHAR *) fname, op);
+ (U_CHAR *) fname, op);
}
else
finclude (f, inc, op, is_system_include (fname), searchptr);
@@ -4637,9 +4637,9 @@ base_name (fname)
if (isalpha (s[0]) && s[1] == ':') s += 2;
#endif
#ifdef VMS
- if ((p = rindex (s, ':'))) s = p + 1; /* Skip device. */
- if ((p = rindex (s, ']'))) s = p + 1; /* Skip directory. */
- if ((p = rindex (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */
+ if ((p = rindex (s, ':'))) s = p + 1; /* Skip device. */
+ if ((p = rindex (s, ']'))) s = p + 1; /* Skip directory. */
+ if ((p = rindex (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */
if (s != fname)
return s;
#endif
@@ -4691,21 +4691,21 @@ simplify_filename (filename)
*to++ = '/';
if (*++from == '/') {
if (*++from == '/') {
- /* 3 or more initial /s are equivalent to 1 /. */
- while (*++from == '/')
- continue;
+ /* 3 or more initial /s are equivalent to 1 /. */
+ while (*++from == '/')
+ continue;
} else {
- /* On some hosts // differs from /; Posix allows this. */
- static int slashslash_vs_slash;
- if (slashslash_vs_slash == 0) {
- struct stat s1, s2;
- slashslash_vs_slash = ((stat ("/", &s1) == 0 && stat ("//", &s2) == 0
- && INO_T_EQ (s1.st_ino, s2.st_ino)
- && s1.st_dev == s2.st_dev)
- ? 1 : -1);
- }
- if (slashslash_vs_slash < 0)
- *to++ = '/';
+ /* On some hosts // differs from /; Posix allows this. */
+ static int slashslash_vs_slash;
+ if (slashslash_vs_slash == 0) {
+ struct stat s1, s2;
+ slashslash_vs_slash = ((stat ("/", &s1) == 0 && stat ("//", &s2) == 0
+ && INO_T_EQ (s1.st_ino, s2.st_ino)
+ && s1.st_dev == s2.st_dev)
+ ? 1 : -1);
+ }
+ if (slashslash_vs_slash < 0)
+ *to++ = '/';
}
}
}
@@ -4717,17 +4717,17 @@ simplify_filename (filename)
else {
/* Copy this component and trailing /, if any. */
while ((*to++ = *from++) != '/') {
- if (!to[-1]) {
- /* Trim . component at end of nonempty name. */
- to -= filename <= to - 3 && to[-3] == '/' && to[-2] == '.';
+ if (!to[-1]) {
+ /* Trim . component at end of nonempty name. */
+ to -= filename <= to - 3 && to[-3] == '/' && to[-2] == '.';
- /* Trim unnecessary trailing /s. */
- while (to0 < --to && to[-1] == '/')
- continue;
+ /* Trim unnecessary trailing /s. */
+ while (to0 < --to && to[-1] == '/')
+ continue;
- *to = 0;
- return to - filename;
- }
+ *to = 0;
+ return to - filename;
+ }
}
}
@@ -4771,15 +4771,15 @@ read_filename_string (ch, f)
{
*set++ = ch;
while ((ch = getc (f)) != EOF && ! is_space[ch])
- {
- if (set - alloc == len)
- {
- len *= 2;
- alloc = xrealloc (alloc, len + 1);
- set = alloc + len / 2;
- }
- *set++ = ch;
- }
+ {
+ if (set - alloc == len)
+ {
+ len *= 2;
+ alloc = xrealloc (alloc, len + 1);
+ set = alloc + len / 2;
+ }
+ *set++ = ch;
+ }
}
*set = '\0';
ungetc (ch, f);
@@ -4814,7 +4814,7 @@ read_name_map (dirname)
return map_list_ptr->map_list_map;
map_list_ptr = ((struct file_name_map_list *)
- xmalloc (sizeof (struct file_name_map_list)));
+ xmalloc (sizeof (struct file_name_map_list)));
map_list_ptr->map_list_name = savestring (dirname);
map_list_ptr->map_list_map = NULL;
@@ -4830,43 +4830,43 @@ read_name_map (dirname)
int ch;
while ((ch = getc (f)) != EOF)
- {
- char *from, *to;
- struct file_name_map *ptr;
- size_t tolen;
-
- if (is_space[ch])
- continue;
- from = read_filename_string (ch, f);
- while ((ch = getc (f)) != EOF && is_hor_space[ch])
- ;
- to = read_filename_string (ch, f);
-
- simplify_filename (from);
- tolen = simplify_filename (to);
-
- ptr = ((struct file_name_map *)
- xmalloc (sizeof (struct file_name_map)));
- ptr->map_from = from;
-
- /* Make the real filename absolute. */
- if (absolute_filename (to))
- ptr->map_to = to;
- else
- {
- ptr->map_to = xmalloc (dirlen + tolen + 1);
- strcpy (ptr->map_to, dirname);
- strcat (ptr->map_to, to);
- free (to);
- }
-
- ptr->map_next = map_list_ptr->map_list_map;
- map_list_ptr->map_list_map = ptr;
-
- while ((ch = getc (f)) != '\n')
- if (ch == EOF)
- break;
- }
+ {
+ char *from, *to;
+ struct file_name_map *ptr;
+ size_t tolen;
+
+ if (is_space[ch])
+ continue;
+ from = read_filename_string (ch, f);
+ while ((ch = getc (f)) != EOF && is_hor_space[ch])
+ ;
+ to = read_filename_string (ch, f);
+
+ simplify_filename (from);
+ tolen = simplify_filename (to);
+
+ ptr = ((struct file_name_map *)
+ xmalloc (sizeof (struct file_name_map)));
+ ptr->map_from = from;
+
+ /* Make the real filename absolute. */
+ if (absolute_filename (to))
+ ptr->map_to = to;
+ else
+ {
+ ptr->map_to = xmalloc (dirlen + tolen + 1);
+ strcpy (ptr->map_to, dirname);
+ strcat (ptr->map_to, to);
+ free (to);
+ }
+
+ ptr->map_next = map_list_ptr->map_list_map;
+ map_list_ptr->map_list_map = ptr;
+
+ while ((ch = getc (f)) != '\n')
+ if (ch == EOF)
+ break;
+ }
fclose (f);
}
@@ -4898,8 +4898,8 @@ open_include_file (filename, searchptr, importing, pinc)
/* Look up FNAME in include_hashtab. */
struct include_file **phead = &include_hashtab[hashf ((U_CHAR *) fname,
- strlen (fname),
- INCLUDE_HASHSIZE)];
+ strlen (fname),
+ INCLUDE_HASHSIZE)];
struct include_file *inc, *head = *phead;
for (inc = head; inc; inc = inc->next)
if (!strcmp (fname, inc->fname))
@@ -4922,15 +4922,15 @@ open_include_file (filename, searchptr, importing, pinc)
inc->control_macro = 0;
inc->deps_output = 0;
if (fstat (fd, &inc->st) != 0)
- pfatal_with_name (fname);
+ pfatal_with_name (fname);
*phead = inc;
/* Look for another file with the same inode and device. */
if (lookup_ino_include (inc)
- && inc->control_macro
- && (!inc->control_macro[0] || lookup (inc->control_macro, -1, -1))) {
- close (fd);
- fd = -2;
+ && inc->control_macro
+ && (!inc->control_macro[0] || lookup (inc->control_macro, -1, -1))) {
+ close (fd);
+ fd = -2;
}
}
@@ -4966,16 +4966,16 @@ remap_include_file (filename, searchptr)
if (searchptr)
{
if (! searchptr->got_name_map)
- {
- searchptr->name_map = read_name_map (searchptr->fname);
- searchptr->got_name_map = 1;
- }
+ {
+ searchptr->name_map = read_name_map (searchptr->fname);
+ searchptr->got_name_map = 1;
+ }
/* Check the mapping for the directory we are using. */
from = filename + strlen (searchptr->fname);
for (map = searchptr->name_map; map; map = map->map_next)
- if (! strcmp (map->map_from, from))
- return map->map_to;
+ if (! strcmp (map->map_from, from))
+ return map->map_to;
}
from = base_name (filename);
@@ -4983,17 +4983,17 @@ remap_include_file (filename, searchptr)
if (from != filename || !searchptr)
{
/* Try to find a mapping file for the particular directory we are
- looking in. Thus #include <sys/types.h> will look up sys/types.h
- in /usr/include/header.gcc and look up types.h in
- /usr/include/sys/header.gcc. */
+ looking in. Thus #include <sys/types.h> will look up sys/types.h
+ in /usr/include/header.gcc and look up types.h in
+ /usr/include/sys/header.gcc. */
char *dir = (char *) alloca (from - filename + 1);
bcopy (filename, dir, from - filename);
dir[from - filename] = '\0';
for (map = read_name_map (dir); map; map = map->map_next)
- if (! strcmp (map->map_from, from))
- return map->map_to;
+ if (! strcmp (map->map_from, from))
+ return map->map_to;
}
return filename;
@@ -5008,14 +5008,14 @@ lookup_ino_include (inc)
struct include_file *inc;
{
int hash = ((unsigned) (inc->st.st_dev + INO_T_HASH (inc->st.st_ino))
- % INCLUDE_HASHSIZE);
+ % INCLUDE_HASHSIZE);
struct include_file *i = include_ino_hashtab[hash];
inc->next_ino = i;
include_ino_hashtab[hash] = inc;
for (; i; i = i->next_ino)
if (INO_T_EQ (inc->st.st_ino, i->st.st_ino)
- && inc->st.st_dev == i->st.st_dev) {
+ && inc->st.st_dev == i->st.st_dev) {
inc->control_macro = i->control_macro;
return 1;
}
@@ -5041,7 +5041,7 @@ finclude (f, inc, op, system_header_p, dirptr)
{
char *fname = inc->fname;
int i;
- FILE_BUF *fp; /* For input stack frame */
+ FILE_BUF *fp; /* For input stack frame */
int missing_newline = 0;
CHECK_DEPTH (return;);
@@ -5085,10 +5085,10 @@ finclude (f, inc, op, system_header_p, dirptr)
for (;;) {
i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size);
if (i < 0)
- goto nope; /* error! */
+ goto nope; /* error! */
st_size += i;
if (st_size != bsize)
- break; /* End of file */
+ break; /* End of file */
bsize *= 2;
fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
}
@@ -5182,11 +5182,11 @@ check_precompiled (pcf, st, fname, limit)
{
size_t s = (size_t) st->st_size;
if (s != st->st_size || s + 2 < s)
- memory_full ();
+ memory_full ();
buf = xmalloc (s + 2);
length = safe_read (pcf, buf, s);
if (length < 0)
- goto nope;
+ goto nope;
}
else
abort ();
@@ -5241,30 +5241,30 @@ check_preconditions (prec)
mdef = create_definition ((U_CHAR *) prec, (U_CHAR *) lineend, NULL_PTR);
if (mdef.defn == 0)
- abort ();
+ abort ();
if ((hp = lookup (mdef.symnam, mdef.symlen, -1)) == NULL
- || (hp->type != T_MACRO && hp->type != T_CONST)
- || (hp->type == T_MACRO
- && !compare_defs (mdef.defn, hp->value.defn)
- && (mdef.defn->length != 2
- || mdef.defn->expansion[0] != '\n'
- || mdef.defn->expansion[1] != ' ')))
- return 0;
+ || (hp->type != T_MACRO && hp->type != T_CONST)
+ || (hp->type == T_MACRO
+ && !compare_defs (mdef.defn, hp->value.defn)
+ && (mdef.defn->length != 2
+ || mdef.defn->expansion[0] != '\n'
+ || mdef.defn->expansion[1] != ' ')))
+ return 0;
} else if (!strncmp (prec, "undef", 5)) {
char *name;
int len;
prec += 5;
while (is_hor_space[(U_CHAR) *prec])
- prec++;
+ prec++;
name = prec;
while (is_idchar[(U_CHAR) *prec])
- prec++;
+ prec++;
len = prec - name;
if (lookup ((U_CHAR *) name, len, -1))
- return 0;
+ return 0;
} else {
error ("Bad format encountered while reading precompiled file");
return 0;
@@ -5319,7 +5319,7 @@ pcfinclude (buf, limit, name, op)
str = (STRINGDEF *) (GENERIC_PTR) cp;
string_start = cp += sizeof (STRINGDEF);
- for (; *cp; cp++) /* skip the string */
+ for (; *cp; cp++) /* skip the string */
;
/* We need to macro expand the string here to ensure that the
@@ -5351,40 +5351,40 @@ pcfinclude (buf, limit, name, op)
else
/* Otherwise, for each key, */
for (; nkeys--; free (tmpbuf.buf), cp = endofthiskey + 1) {
- KEYDEF *kp = (KEYDEF *) (GENERIC_PTR) cp;
- HASHNODE *hp;
-
- /* It starts with a KEYDEF structure */
- cp += sizeof (KEYDEF);
-
- /* Find the end of the key. At the end of this for loop we
- advance CP to the start of the next key using this variable. */
- endofthiskey = cp + strlen ((char *) cp);
- kp->str = str;
-
- /* Expand the key, and enter it into the hash table. */
- tmpbuf = expand_to_temp_buffer (cp, endofthiskey, 0, 0);
- tmpbuf.bufp = tmpbuf.buf;
-
- while (is_hor_space[*tmpbuf.bufp])
- tmpbuf.bufp++;
- if (!is_idstart[*tmpbuf.bufp]
- || tmpbuf.bufp == tmpbuf.buf + tmpbuf.length) {
- str->writeflag = 1;
- continue;
- }
-
- hp = lookup (tmpbuf.bufp, -1, -1);
- if (hp == NULL) {
- kp->chain = 0;
- install (tmpbuf.bufp, -1, T_PCSTRING, (char *) kp, -1);
- }
- else if (hp->type == T_PCSTRING) {
- kp->chain = hp->value.keydef;
- hp->value.keydef = kp;
- }
- else
- str->writeflag = 1;
+ KEYDEF *kp = (KEYDEF *) (GENERIC_PTR) cp;
+ HASHNODE *hp;
+
+ /* It starts with a KEYDEF structure */
+ cp += sizeof (KEYDEF);
+
+ /* Find the end of the key. At the end of this for loop we
+ advance CP to the start of the next key using this variable. */
+ endofthiskey = cp + strlen ((char *) cp);
+ kp->str = str;
+
+ /* Expand the key, and enter it into the hash table. */
+ tmpbuf = expand_to_temp_buffer (cp, endofthiskey, 0, 0);
+ tmpbuf.bufp = tmpbuf.buf;
+
+ while (is_hor_space[*tmpbuf.bufp])
+ tmpbuf.bufp++;
+ if (!is_idstart[*tmpbuf.bufp]
+ || tmpbuf.bufp == tmpbuf.buf + tmpbuf.length) {
+ str->writeflag = 1;
+ continue;
+ }
+
+ hp = lookup (tmpbuf.bufp, -1, -1);
+ if (hp == NULL) {
+ kp->chain = 0;
+ install (tmpbuf.bufp, -1, T_PCSTRING, (char *) kp, -1);
+ }
+ else if (hp->type == T_PCSTRING) {
+ kp->chain = hp->value.keydef;
+ hp->value.keydef = kp;
+ }
+ else
+ str->writeflag = 1;
}
}
/* This output_line_directive serves to switch us back to the current
@@ -5428,27 +5428,27 @@ write_output ()
while (cur_buf_loc < outbuf.bufp || next_string) {
if (next_string
- && cur_buf_loc - outbuf.buf == next_string->output_mark) {
+ && cur_buf_loc - outbuf.buf == next_string->output_mark) {
if (next_string->writeflag) {
- len = 4 * strlen ((char *) next_string->filename) + 32;
- while (len > line_directive_len)
- line_directive = xrealloc (line_directive,
- line_directive_len *= 2);
- sprintf (line_directive, "\n# %d ", next_string->lineno);
- strcpy (quote_string (line_directive + strlen (line_directive),
- (char *) next_string->filename),
- "\n");
- safe_write (fileno (stdout), line_directive, strlen (line_directive));
- safe_write (fileno (stdout),
- (char *) next_string->contents, next_string->len);
- }
+ len = 4 * strlen ((char *) next_string->filename) + 32;
+ while (len > line_directive_len)
+ line_directive = xrealloc (line_directive,
+ line_directive_len *= 2);
+ sprintf (line_directive, "\n# %d ", next_string->lineno);
+ strcpy (quote_string (line_directive + strlen (line_directive),
+ (char *) next_string->filename),
+ "\n");
+ safe_write (fileno (stdout), line_directive, strlen (line_directive));
+ safe_write (fileno (stdout),
+ (char *) next_string->contents, next_string->len);
+ }
next_string = next_string->chain;
}
else {
len = (next_string
- ? (next_string->output_mark
- - (cur_buf_loc - outbuf.buf))
- : outbuf.bufp - cur_buf_loc);
+ ? (next_string->output_mark
+ - (cur_buf_loc - outbuf.buf))
+ : outbuf.bufp - cur_buf_loc);
safe_write (fileno (stdout), (char *) cur_buf_loc, len);
cur_buf_loc += len;
@@ -5513,16 +5513,16 @@ create_definition (buf, limit, op)
U_CHAR *buf, *limit;
FILE_BUF *op;
{
- U_CHAR *bp; /* temp ptr into input buffer */
- U_CHAR *symname; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
+ U_CHAR *bp; /* temp ptr into input buffer */
+ U_CHAR *symname; /* remember where symbol name starts */
+ int sym_length; /* and how long it is */
int line = instack[indepth].lineno;
char *file = instack[indepth].nominal_fname;
int rest_args = 0;
DEFINITION *defn;
- int arglengths = 0; /* Accumulate lengths of arg names
- plus number of args. */
+ int arglengths = 0; /* Accumulate lengths of arg names
+ plus number of args. */
MACRODEF mdef;
bp = buf;
@@ -5530,7 +5530,7 @@ create_definition (buf, limit, op)
while (is_hor_space[*bp])
bp++;
- symname = bp; /* remember where it starts */
+ symname = bp; /* remember where it starts */
sym_length = check_macro_name (bp, "macro");
bp += sym_length;
@@ -5542,7 +5542,7 @@ create_definition (buf, limit, op)
struct arglist *arg_ptrs = NULL;
int argno = 0;
- bp++; /* skip '(' */
+ bp++; /* skip '(' */
SKIP_WHITE_SPACE (bp);
/* Loop over macro argument names. */
@@ -5557,59 +5557,59 @@ create_definition (buf, limit, op)
arg_ptrs = temp;
if (rest_args)
- pedwarn ("another parameter follows `%s'",
- rest_extension);
+ pedwarn ("another parameter follows `%s'",
+ rest_extension);
if (!is_idstart[*bp])
- pedwarn ("invalid character in macro parameter name");
+ pedwarn ("invalid character in macro parameter name");
/* Find the end of the arg name. */
while (is_idchar[*bp]) {
- bp++;
- /* do we have a "special" rest-args extension here? */
- if (limit - bp > REST_EXTENSION_LENGTH
- && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) {
- rest_args = 1;
- temp->rest_args = 1;
- break;
- }
+ bp++;
+ /* do we have a "special" rest-args extension here? */
+ if (limit - bp > REST_EXTENSION_LENGTH
+ && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) {
+ rest_args = 1;
+ temp->rest_args = 1;
+ break;
+ }
}
temp->length = bp - temp->name;
if (rest_args == 1)
- bp += REST_EXTENSION_LENGTH;
+ bp += REST_EXTENSION_LENGTH;
arglengths += temp->length + 2;
SKIP_WHITE_SPACE (bp);
if (temp->length == 0 || (*bp != ',' && *bp != ')')) {
- error ("badly punctuated parameter list in `#define'");
- goto nope;
+ error ("badly punctuated parameter list in `#define'");
+ goto nope;
}
if (*bp == ',') {
- bp++;
- SKIP_WHITE_SPACE (bp);
- /* A comma at this point can only be followed by an identifier. */
- if (!is_idstart[*bp]) {
- error ("badly punctuated parameter list in `#define'");
- goto nope;
- }
+ bp++;
+ SKIP_WHITE_SPACE (bp);
+ /* A comma at this point can only be followed by an identifier. */
+ if (!is_idstart[*bp]) {
+ error ("badly punctuated parameter list in `#define'");
+ goto nope;
+ }
}
if (bp >= limit) {
- error ("unterminated parameter list in `#define'");
- goto nope;
+ error ("unterminated parameter list in `#define'");
+ goto nope;
}
{
- struct arglist *otemp;
-
- for (otemp = temp->next; otemp != NULL; otemp = otemp->next)
- if (temp->length == otemp->length
- && bcmp (temp->name, otemp->name, temp->length) == 0) {
- error ("duplicate argument name `%.*s' in `#define'",
- temp->length, temp->name);
- goto nope;
- }
+ struct arglist *otemp;
+
+ for (otemp = temp->next; otemp != NULL; otemp = otemp->next)
+ if (temp->length == otemp->length
+ && bcmp (temp->name, otemp->name, temp->length) == 0) {
+ error ("duplicate argument name `%.*s' in `#define'",
+ temp->length, temp->name);
+ goto nope;
+ }
}
}
- ++bp; /* skip paren */
+ ++bp; /* skip paren */
SKIP_WHITE_SPACE (bp);
/* now everything from bp before limit is the definition. */
defn = collect_expansion (bp, limit, argno, arg_ptrs);
@@ -5623,12 +5623,12 @@ create_definition (buf, limit, op)
struct arglist *temp;
int i = 0;
for (temp = arg_ptrs; temp; temp = temp->next) {
- bcopy (temp->name, &defn->args.argnames[i], temp->length);
- i += temp->length;
- if (temp->next != 0) {
- defn->args.argnames[i++] = ',';
- defn->args.argnames[i++] = ' ';
- }
+ bcopy (temp->name, &defn->args.argnames[i], temp->length);
+ i += temp->length;
+ if (temp->next != 0) {
+ defn->args.argnames[i++] = ',';
+ defn->args.argnames[i++] = ' ';
+ }
}
defn->args.argnames[i] = 0;
}
@@ -5637,26 +5637,26 @@ create_definition (buf, limit, op)
if (bp < limit)
{
- if (is_hor_space[*bp]) {
- bp++;
- SKIP_WHITE_SPACE (bp);
- } else if (sym_length) {
- switch (*bp) {
- case '!': case '"': case '#': case '%': case '&': case '\'':
- case ')': case '*': case '+': case ',': case '-': case '.':
- case '/': case ':': case ';': case '<': case '=': case '>':
- case '?': case '[': case '\\': case ']': case '^': case '{':
- case '|': case '}': case '~':
- warning ("missing white space after `#define %.*s'",
- sym_length, symname);
- break;
-
- default:
- pedwarn ("missing white space after `#define %.*s'",
- sym_length, symname);
- break;
- }
- }
+ if (is_hor_space[*bp]) {
+ bp++;
+ SKIP_WHITE_SPACE (bp);
+ } else if (sym_length) {
+ switch (*bp) {
+ case '!': case '"': case '#': case '%': case '&': case '\'':
+ case ')': case '*': case '+': case ',': case '-': case '.':
+ case '/': case ':': case ';': case '<': case '=': case '>':
+ case '?': case '[': case '\\': case ']': case '^': case '{':
+ case '|': case '}': case '~':
+ warning ("missing white space after `#define %.*s'",
+ sym_length, symname);
+ break;
+
+ default:
+ pedwarn ("missing white space after `#define %.*s'",
+ sym_length, symname);
+ break;
+ }
+ }
}
/* Now everything from bp before limit is the definition. */
defn = collect_expansion (bp, limit, -1, NULL_PTR);
@@ -5709,35 +5709,35 @@ do_define (buf, limit, op, keyword)
int ok = 0;
/* Redefining a precompiled key is ok. */
if (hp->type == T_PCSTRING)
- ok = 1;
+ ok = 1;
/* Redefining a macro is ok if the definitions are the same. */
else if (hp->type == T_MACRO)
- ok = ! compare_defs (mdef.defn, hp->value.defn);
+ ok = ! compare_defs (mdef.defn, hp->value.defn);
/* Redefining a constant is ok with -D. */
else if (hp->type == T_CONST)
ok = ! done_initializing;
/* Print the warning if it's not ok. */
if (!ok) {
/* If we are passing through #define and #undef directives, do
- that for this re-definition now. */
+ that for this re-definition now. */
if (debug_output && op)
- pass_thru_directive (buf, limit, op, keyword);
+ pass_thru_directive (buf, limit, op, keyword);
- pedwarn ("`%.*s' redefined", mdef.symlen, mdef.symnam);
- if (hp->type == T_MACRO)
- pedwarn_with_file_and_line (hp->value.defn->file, hp->value.defn->line,
- "this is the location of the previous definition");
+ pedwarn ("`%.*s' redefined", mdef.symlen, mdef.symnam);
+ if (hp->type == T_MACRO)
+ pedwarn_with_file_and_line (hp->value.defn->file, hp->value.defn->line,
+ "this is the location of the previous definition");
}
/* Replace the old definition. */
hp->type = T_MACRO;
hp->value.defn = mdef.defn;
} else {
/* If we are passing through #define and #undef directives, do
- that for this new definition now. */
+ that for this new definition now. */
if (debug_output && op)
- pass_thru_directive (buf, limit, op, keyword);
+ pass_thru_directive (buf, limit, op, keyword);
install (mdef.symnam, mdef.symlen, T_MACRO,
- (char *) mdef.defn, hashcode);
+ (char *) mdef.defn, hashcode);
}
}
@@ -5766,7 +5766,7 @@ check_macro_name (symname, usage)
|| (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"')))
error ("invalid %s name", usage);
else if (!is_idstart[*symname]
- || (sym_length == 7 && ! bcmp (symname, "defined", 7)))
+ || (sym_length == 7 && ! bcmp (symname, "defined", 7)))
error ("invalid %s name `%.*s'", usage, sym_length, symname);
return sym_length;
}
@@ -5790,11 +5790,11 @@ compare_defs (d1, d2)
for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2;
a1 = a1->next, a2 = a2->next) {
if (!((a1->nchars == a2->nchars && ! bcmp (p1, p2, a1->nchars))
- || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0))
- || a1->argno != a2->argno
- || a1->stringify != a2->stringify
- || a1->raw_before != a2->raw_before
- || a1->raw_after != a2->raw_after)
+ || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0))
+ || a1->argno != a2->argno
+ || a1->stringify != a2->stringify
+ || a1->raw_before != a2->raw_before
+ || a1->raw_after != a2->raw_after)
return 1;
first = 0;
p1 += a1->nchars;
@@ -5803,7 +5803,7 @@ compare_defs (d1, d2)
if (a1 != a2)
return 1;
if (comp_def_part (first, p1, d1->length - (p1 - d1->expansion),
- p2, d2->length - (p2 - d2->expansion), 1))
+ p2, d2->length - (p2 - d2->expansion), 1))
return 1;
return 0;
}
@@ -5897,7 +5897,7 @@ collect_expansion (buf, end, nargs, arglist)
so this is an upper bound.
The extra 3 are for invented trailing newline-marker and final null. */
maxsize = (sizeof (DEFINITION)
- + (limit - p) + 3);
+ + (limit - p) + 3);
defn = (DEFINITION *) xcalloc (1, maxsize);
defn->nargs = nargs;
@@ -5927,121 +5927,121 @@ collect_expansion (buf, end, nargs, arglist)
expected_delimiter = '\0';
} else
expected_delimiter = c;
- break;
+ break;
case '\\':
- if (p < limit && expected_delimiter) {
- /* In a string, backslash goes through
- and makes next char ordinary. */
- *exp_p++ = *p++;
- }
- break;
+ if (p < limit && expected_delimiter) {
+ /* In a string, backslash goes through
+ and makes next char ordinary. */
+ *exp_p++ = *p++;
+ }
+ break;
case '%':
- if (!expected_delimiter && *p == ':') {
- /* %: is not a digraph if preceded by an odd number of '<'s. */
- U_CHAR *p0 = p - 1;
- while (buf < p0 && p0[-1] == '<')
- p0--;
- if ((p - p0) & 1) {
- /* Treat %:%: as ## and %: as #. */
- if (p[1] == '%' && p[2] == ':') {
- p += 2;
- goto sharp_sharp_token;
- }
- if (nargs >= 0) {
- p++;
- goto sharp_token;
- }
- }
- }
- break;
+ if (!expected_delimiter && *p == ':') {
+ /* %: is not a digraph if preceded by an odd number of '<'s. */
+ U_CHAR *p0 = p - 1;
+ while (buf < p0 && p0[-1] == '<')
+ p0--;
+ if ((p - p0) & 1) {
+ /* Treat %:%: as ## and %: as #. */
+ if (p[1] == '%' && p[2] == ':') {
+ p += 2;
+ goto sharp_sharp_token;
+ }
+ if (nargs >= 0) {
+ p++;
+ goto sharp_token;
+ }
+ }
+ }
+ break;
case '#':
- /* # is ordinary inside a string. */
- if (expected_delimiter)
- break;
- if (*p == '#') {
- sharp_sharp_token:
- /* ##: concatenate preceding and following tokens. */
- /* Take out the first #, discard preceding whitespace. */
- exp_p--;
- while (exp_p > lastp && is_hor_space[exp_p[-1]])
- --exp_p;
- /* Skip the second #. */
- p++;
- concat_sharp_token_type = c;
- if (is_hor_space[*p]) {
- concat_sharp_token_type = c + 1;
- p++;
- SKIP_WHITE_SPACE (p);
- }
- concat = p;
- if (p == limit)
- error ("`##' at end of macro definition");
- } else if (nargs >= 0) {
- /* Single #: stringify following argument ref.
- Don't leave the # in the expansion. */
- sharp_token:
- exp_p--;
- stringify_sharp_token_type = c;
- if (is_hor_space[*p]) {
- stringify_sharp_token_type = c + 1;
- p++;
- SKIP_WHITE_SPACE (p);
- }
- if (! is_idstart[*p] || nargs == 0
- || (*p == 'L' && (p[1] == '\'' || p[1] == '"')))
- error ("`#' operator is not followed by a macro argument name");
- else
- stringify = p;
- }
- break;
+ /* # is ordinary inside a string. */
+ if (expected_delimiter)
+ break;
+ if (*p == '#') {
+ sharp_sharp_token:
+ /* ##: concatenate preceding and following tokens. */
+ /* Take out the first #, discard preceding whitespace. */
+ exp_p--;
+ while (exp_p > lastp && is_hor_space[exp_p[-1]])
+ --exp_p;
+ /* Skip the second #. */
+ p++;
+ concat_sharp_token_type = c;
+ if (is_hor_space[*p]) {
+ concat_sharp_token_type = c + 1;
+ p++;
+ SKIP_WHITE_SPACE (p);
+ }
+ concat = p;
+ if (p == limit)
+ error ("`##' at end of macro definition");
+ } else if (nargs >= 0) {
+ /* Single #: stringify following argument ref.
+ Don't leave the # in the expansion. */
+ sharp_token:
+ exp_p--;
+ stringify_sharp_token_type = c;
+ if (is_hor_space[*p]) {
+ stringify_sharp_token_type = c + 1;
+ p++;
+ SKIP_WHITE_SPACE (p);
+ }
+ if (! is_idstart[*p] || nargs == 0
+ || (*p == 'L' && (p[1] == '\'' || p[1] == '"')))
+ error ("`#' operator is not followed by a macro argument name");
+ else
+ stringify = p;
+ }
+ break;
}
} else {
/* In -traditional mode, recognize arguments inside strings and
- and character constants, and ignore special properties of #.
- Arguments inside strings are considered "stringified", but no
- extra quote marks are supplied. */
+ and character constants, and ignore special properties of #.
+ Arguments inside strings are considered "stringified", but no
+ extra quote marks are supplied. */
switch (c) {
case '\'':
case '\"':
- if (expected_delimiter != '\0') {
- if (c == expected_delimiter)
- expected_delimiter = '\0';
- } else
- expected_delimiter = c;
- break;
+ if (expected_delimiter != '\0') {
+ if (c == expected_delimiter)
+ expected_delimiter = '\0';
+ } else
+ expected_delimiter = c;
+ break;
case '\\':
- /* Backslash quotes delimiters and itself, but not macro args. */
- if (expected_delimiter != 0 && p < limit
- && (*p == expected_delimiter || *p == '\\')) {
- *exp_p++ = *p++;
- continue;
- }
- break;
+ /* Backslash quotes delimiters and itself, but not macro args. */
+ if (expected_delimiter != 0 && p < limit
+ && (*p == expected_delimiter || *p == '\\')) {
+ *exp_p++ = *p++;
+ continue;
+ }
+ break;
case '/':
- if (expected_delimiter != '\0') /* No comments inside strings. */
- break;
- if (*p == '*') {
- /* If we find a comment that wasn't removed by handle_directive,
- this must be -traditional. So replace the comment with
- nothing at all. */
- exp_p--;
- while (++p < limit) {
- if (p[0] == '*' && p[1] == '/') {
- p += 2;
- break;
- }
- }
+ if (expected_delimiter != '\0') /* No comments inside strings. */
+ break;
+ if (*p == '*') {
+ /* If we find a comment that wasn't removed by handle_directive,
+ this must be -traditional. So replace the comment with
+ nothing at all. */
+ exp_p--;
+ while (++p < limit) {
+ if (p[0] == '*' && p[1] == '/') {
+ p += 2;
+ break;
+ }
+ }
#if 0
- /* Mark this as a concatenation-point, as if it had been ##. */
- concat = p;
+ /* Mark this as a concatenation-point, as if it had been ##. */
+ concat = p;
#endif
- }
- break;
+ }
+ break;
}
}
@@ -6055,76 +6055,76 @@ collect_expansion (buf, end, nargs, arglist)
id_len = p - id_beg;
if (is_idstart[c]
- && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) {
- register struct arglist *arg;
-
- for (arg = arglist; arg != NULL; arg = arg->next) {
- struct reflist *tpat;
-
- if (arg->name[0] == c
- && arg->length == id_len
- && bcmp (arg->name, id_beg, id_len) == 0) {
- enum sharp_token_type tpat_stringify;
- if (expected_delimiter) {
- if (warn_stringify) {
- if (traditional) {
- warning ("macro argument `%.*s' is stringified.",
- id_len, arg->name);
- } else {
- warning ("macro arg `%.*s' would be stringified with -traditional.",
- id_len, arg->name);
- }
- }
- /* If ANSI, don't actually substitute inside a string. */
- if (!traditional)
- break;
- tpat_stringify = SHARP_TOKEN;
- } else {
- tpat_stringify
- = (stringify == id_beg
- ? stringify_sharp_token_type : NO_SHARP_TOKEN);
- }
- /* make a pat node for this arg and append it to the end of
- the pat list */
- tpat = (struct reflist *) xmalloc (sizeof (struct reflist));
- tpat->next = NULL;
- tpat->raw_before
- = concat == id_beg ? concat_sharp_token_type : NO_SHARP_TOKEN;
- tpat->raw_after = NO_SHARP_TOKEN;
- tpat->rest_args = arg->rest_args;
- tpat->stringify = tpat_stringify;
-
- if (endpat == NULL)
- defn->pattern = tpat;
- else
- endpat->next = tpat;
- endpat = tpat;
-
- tpat->argno = arg->argno;
- tpat->nchars = exp_p - lastp;
- {
- register U_CHAR *p1 = p;
- SKIP_WHITE_SPACE (p1);
- if (p1[0]=='#'
- ? p1[1]=='#'
- : p1[0]=='%' && p1[1]==':' && p1[2]=='%' && p1[3]==':')
- tpat->raw_after = p1[0] + (p != p1);
- }
- lastp = exp_p; /* place to start copying from next time */
- skipped_arg = 1;
- break;
- }
- }
+ && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) {
+ register struct arglist *arg;
+
+ for (arg = arglist; arg != NULL; arg = arg->next) {
+ struct reflist *tpat;
+
+ if (arg->name[0] == c
+ && arg->length == id_len
+ && bcmp (arg->name, id_beg, id_len) == 0) {
+ enum sharp_token_type tpat_stringify;
+ if (expected_delimiter) {
+ if (warn_stringify) {
+ if (traditional) {
+ warning ("macro argument `%.*s' is stringified.",
+ id_len, arg->name);
+ } else {
+ warning ("macro arg `%.*s' would be stringified with -traditional.",
+ id_len, arg->name);
+ }
+ }
+ /* If ANSI, don't actually substitute inside a string. */
+ if (!traditional)
+ break;
+ tpat_stringify = SHARP_TOKEN;
+ } else {
+ tpat_stringify
+ = (stringify == id_beg
+ ? stringify_sharp_token_type : NO_SHARP_TOKEN);
+ }
+ /* make a pat node for this arg and append it to the end of
+ the pat list */
+ tpat = (struct reflist *) xmalloc (sizeof (struct reflist));
+ tpat->next = NULL;
+ tpat->raw_before
+ = concat == id_beg ? concat_sharp_token_type : NO_SHARP_TOKEN;
+ tpat->raw_after = NO_SHARP_TOKEN;
+ tpat->rest_args = arg->rest_args;
+ tpat->stringify = tpat_stringify;
+
+ if (endpat == NULL)
+ defn->pattern = tpat;
+ else
+ endpat->next = tpat;
+ endpat = tpat;
+
+ tpat->argno = arg->argno;
+ tpat->nchars = exp_p - lastp;
+ {
+ register U_CHAR *p1 = p;
+ SKIP_WHITE_SPACE (p1);
+ if (p1[0]=='#'
+ ? p1[1]=='#'
+ : p1[0]=='%' && p1[1]==':' && p1[2]=='%' && p1[3]==':')
+ tpat->raw_after = p1[0] + (p != p1);
+ }
+ lastp = exp_p; /* place to start copying from next time */
+ skipped_arg = 1;
+ break;
+ }
+ }
}
/* If this was not a macro arg, copy it into the expansion. */
if (! skipped_arg) {
- register U_CHAR *lim1 = p;
- p = id_beg;
- while (p != lim1)
- *exp_p++ = *p++;
- if (stringify == id_beg)
- error ("`#' operator should be followed by a macro argument name");
+ register U_CHAR *lim1 = p;
+ p = id_beg;
+ while (p != lim1)
+ *exp_p++ = *p++;
+ if (stringify == id_beg)
+ error ("`#' operator should be followed by a macro argument name");
}
}
}
@@ -6160,9 +6160,9 @@ do_assert (buf, limit, op, keyword)
FILE_BUF *op;
struct directive *keyword;
{
- U_CHAR *bp; /* temp ptr into input buffer */
- U_CHAR *symname; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
+ U_CHAR *bp; /* temp ptr into input buffer */
+ U_CHAR *symname; /* remember where symbol name starts */
+ int sym_length; /* and how long it is */
struct arglist *tokens = NULL;
if (pedantic && done_initializing && !instack[indepth].system_header_p)
@@ -6173,7 +6173,7 @@ do_assert (buf, limit, op, keyword)
while (is_hor_space[*bp])
bp++;
- symname = bp; /* remember where it starts */
+ symname = bp; /* remember where it starts */
sym_length = check_macro_name (bp, "assertion");
bp += sym_length;
/* #define doesn't do this, but we should. */
@@ -6191,7 +6191,7 @@ do_assert (buf, limit, op, keyword)
{
int error_flag = 0;
- bp++; /* skip '(' */
+ bp++; /* skip '(' */
SKIP_WHITE_SPACE (bp);
tokens = read_token_list (&bp, limit, &error_flag);
@@ -6202,7 +6202,7 @@ do_assert (buf, limit, op, keyword)
return 1;
}
- ++bp; /* skip paren */
+ ++bp; /* skip paren */
SKIP_WHITE_SPACE (bp);
}
@@ -6218,7 +6218,7 @@ do_assert (buf, limit, op, keyword)
hp = assertion_lookup (symname, sym_length, hashcode);
if (hp == NULL) {
if (sym_length == 7 && ! bcmp (symname, "defined", 7))
- error ("`defined' redefined as assertion");
+ error ("`defined' redefined as assertion");
hp = assertion_install (symname, sym_length, hashcode);
}
@@ -6237,9 +6237,9 @@ do_unassert (buf, limit, op, keyword)
FILE_BUF *op;
struct directive *keyword;
{
- U_CHAR *bp; /* temp ptr into input buffer */
- U_CHAR *symname; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
+ U_CHAR *bp; /* temp ptr into input buffer */
+ U_CHAR *symname; /* remember where symbol name starts */
+ int sym_length; /* and how long it is */
struct arglist *tokens = NULL;
int tokens_specified = 0;
@@ -6252,7 +6252,7 @@ do_unassert (buf, limit, op, keyword)
while (is_hor_space[*bp])
bp++;
- symname = bp; /* remember where it starts */
+ symname = bp; /* remember where it starts */
sym_length = check_macro_name (bp, "assertion");
bp += sym_length;
/* #define doesn't do this, but we should. */
@@ -6265,7 +6265,7 @@ do_unassert (buf, limit, op, keyword)
if (*bp == '(') {
int error_flag = 0;
- bp++; /* skip '(' */
+ bp++; /* skip '(' */
SKIP_WHITE_SPACE (bp);
tokens = read_token_list (&bp, limit, &error_flag);
@@ -6278,7 +6278,7 @@ do_unassert (buf, limit, op, keyword)
tokens_specified = 1;
- ++bp; /* skip paren */
+ ++bp; /* skip paren */
SKIP_WHITE_SPACE (bp);
}
@@ -6296,9 +6296,9 @@ do_unassert (buf, limit, op, keyword)
if (! tokens_specified) {
struct tokenlist_list *next;
for (tail = hp->value; tail; tail = next) {
- next = tail->next;
- free_token_list (tail->tokens);
- free (tail);
+ next = tail->next;
+ free_token_list (tail->tokens);
+ free (tail);
}
delete_assertion (hp);
} else {
@@ -6307,18 +6307,18 @@ do_unassert (buf, limit, op, keyword)
tail = hp->value;
prev = 0;
while (tail) {
- struct tokenlist_list *next = tail->next;
- if (compare_token_lists (tail->tokens, tokens)) {
- if (prev)
- prev->next = next;
- else
- hp->value = tail->next;
- free_token_list (tail->tokens);
- free (tail);
- } else {
- prev = tail;
- }
- tail = next;
+ struct tokenlist_list *next = tail->next;
+ if (compare_token_lists (tail->tokens, tokens)) {
+ if (prev)
+ prev->next = next;
+ else
+ hp->value = tail->next;
+ free_token_list (tail->tokens);
+ free (tail);
+ } else {
+ prev = tail;
+ }
+ tail = next;
}
}
}
@@ -6363,7 +6363,7 @@ check_assertion (name, sym_length, tokens_specified, tokens)
while (tail) {
if (compare_token_lists (tail->tokens, tokens))
- return 1;
+ return 1;
tail = tail->next;
}
@@ -6422,14 +6422,14 @@ read_token_list (bpp, limit, error_flag)
} else if (*bp == ')') {
depth--;
if (depth == 0)
- break;
+ break;
bp++;
} else if (*bp == '"' || *bp == '\'')
bp = skip_quoted_string (bp, limit, 0, NULL_PTR, NULL_PTR, &eofp);
else
while (! is_hor_space[*bp] && *bp != '(' && *bp != ')'
- && *bp != '"' && *bp != '\'' && bp != limit)
- bp++;
+ && *bp != '"' && *bp != '\'' && bp != limit)
+ bp++;
temp = (struct arglist *) xmalloc (sizeof (struct arglist));
temp->name = (U_CHAR *) xmalloc (bp - beg + 1);
@@ -6622,24 +6622,24 @@ do_line (buf, limit, op, keyword)
for (;;)
switch ((*p++ = *bp++)) {
case '\0':
- error ("invalid format `#line' directive");
- return 0;
+ error ("invalid format `#line' directive");
+ return 0;
case '\\':
- {
- char *bpc = (char *) bp;
- HOST_WIDE_INT c = parse_escape (&bpc, (HOST_WIDE_INT) (U_CHAR) (-1));
- bp = (U_CHAR *) bpc;
- if (c < 0)
- p--;
- else
- p[-1] = c;
- }
- break;
+ {
+ char *bpc = (char *) bp;
+ HOST_WIDE_INT c = parse_escape (&bpc, (HOST_WIDE_INT) (U_CHAR) (-1));
+ bp = (U_CHAR *) bpc;
+ if (c < 0)
+ p--;
+ else
+ p[-1] = c;
+ }
+ break;
case '\"':
- p[-1] = 0;
- goto fname_done;
+ p[-1] = 0;
+ goto fname_done;
}
fname_done:
fname_length = p - fname;
@@ -6647,44 +6647,44 @@ do_line (buf, limit, op, keyword)
SKIP_WHITE_SPACE (bp);
if (*bp) {
if (pedantic)
- pedwarn ("garbage at end of `#line' directive");
+ pedwarn ("garbage at end of `#line' directive");
if (*bp == '1')
- file_change = enter_file;
+ file_change = enter_file;
else if (*bp == '2')
- file_change = leave_file;
+ file_change = leave_file;
else if (*bp == '3')
- ip->system_header_p = 1;
+ ip->system_header_p = 1;
else if (*bp == '4')
- ip->system_header_p = 2;
+ ip->system_header_p = 2;
else {
- error ("invalid format `#line' directive");
- return 0;
+ error ("invalid format `#line' directive");
+ return 0;
}
bp++;
SKIP_WHITE_SPACE (bp);
if (*bp == '3') {
- ip->system_header_p = 1;
- bp++;
- SKIP_WHITE_SPACE (bp);
+ ip->system_header_p = 1;
+ bp++;
+ SKIP_WHITE_SPACE (bp);
}
if (*bp == '4') {
- ip->system_header_p = 2;
- bp++;
- SKIP_WHITE_SPACE (bp);
+ ip->system_header_p = 2;
+ bp++;
+ SKIP_WHITE_SPACE (bp);
}
if (*bp) {
- error ("invalid format `#line' directive");
- return 0;
+ error ("invalid format `#line' directive");
+ return 0;
}
}
hash_bucket = &fname_table[hashf (fname, fname_length, FNAME_HASHSIZE)];
for (hp = *hash_bucket; hp != NULL; hp = hp->next)
if (hp->length == fname_length &&
- bcmp (hp->value.cpval, fname, fname_length) == 0) {
- ip->nominal_fname = hp->value.cpval;
- break;
+ bcmp (hp->value.cpval, fname, fname_length) == 0) {
+ ip->nominal_fname = hp->value.cpval;
+ break;
}
if (hp == 0) {
/* Didn't find it; cons up a new one. */
@@ -6867,10 +6867,10 @@ do_pragma (buf, limit, op, keyword)
for (h = 0; h < INCLUDE_HASHSIZE; h++) {
struct include_file *inc;
for (inc = include_hashtab[h]; inc; inc = inc->next) {
- if (!strcmp (base_name (inc->fname), (char *) fname)) {
- warning ("`#pragma implementation' for \"%s\" appears after its #include",fname);
- return 0;
- }
+ if (!strcmp (base_name (inc->fname), (char *) fname)) {
+ warning ("`#pragma implementation' for \"%s\" appears after its #include",fname);
+ return 0;
+ }
}
}
}
@@ -6921,8 +6921,8 @@ do_sccs (buf, limit, op, keyword)
/* Handle #if directive by
1) inserting special `defined' keyword into the hash table
- that gets turned into 0 or 1 by special_symbol (thus,
- if the luser has a symbol called `defined' already, it won't
+ that gets turned into 0 or 1 by special_symbol (thus,
+ if the luser has a symbol called `defined' already, it won't
work inside the #if directive)
2) rescan the input into a temporary output buffer
3) pass the output buffer to the yacc parser and collect a value
@@ -6964,8 +6964,8 @@ do_elif (buf, limit, op, keyword)
error ("`#elif' after `#else'");
fprintf (stderr, " (matches line %d", if_stack->lineno);
if (if_stack->fname != NULL && ip->fname != NULL
- && strcmp (if_stack->fname, ip->nominal_fname) != 0)
- fprintf (stderr, ", file %s", if_stack->fname);
+ && strcmp (if_stack->fname, ip->nominal_fname) != 0)
+ fprintf (stderr, ", file %s", if_stack->fname);
fprintf (stderr, ")\n");
}
if_stack->type = T_ELIF;
@@ -6978,7 +6978,7 @@ do_elif (buf, limit, op, keyword)
if (value == 0)
skip_if_group (ip, 0, op);
else {
- ++if_stack->if_succeeded; /* continue processing input */
+ ++if_stack->if_succeeded; /* continue processing input */
output_line_directive (ip, op, 1, same_file);
}
}
@@ -6998,15 +6998,15 @@ eval_if_expression (buf, length)
HOST_WIDE_INT value;
save_defined = install ((U_CHAR *) "defined", -1, T_SPEC_DEFINED,
- NULL_PTR, -1);
+ NULL_PTR, -1);
pcp_inside_if = 1;
temp_obuf = expand_to_temp_buffer (buf, buf + length, 0, 1);
pcp_inside_if = 0;
- delete_macro (save_defined); /* clean up special symbol */
+ delete_macro (save_defined); /* clean up special symbol */
temp_obuf.buf[temp_obuf.length] = '\n';
value = parse_c_expression ((char *) temp_obuf.buf,
- warn_undef && !instack[indepth].system_header_p);
+ warn_undef && !instack[indepth].system_header_p);
free (temp_obuf.buf);
@@ -7035,20 +7035,20 @@ do_xifdef (buf, limit, op, keyword)
while (p != directive_start) {
U_CHAR c = *p++;
if (is_space[c])
- ;
+ ;
/* Make no special provision for backslash-newline here; this is
- slower if backslash-newlines are present, but it's correct,
- and it's not worth it to tune for the rare backslash-newline. */
+ slower if backslash-newlines are present, but it's correct,
+ and it's not worth it to tune for the rare backslash-newline. */
else if (c == '/'
- && (*p == '*' || (cplusplus_comments && *p == '/'))) {
- /* Skip this comment. */
- int junk = 0;
- U_CHAR *save_bufp = ip->bufp;
- ip->bufp = p + 1;
- p = skip_to_end_of_comment (ip, &junk, 1);
- ip->bufp = save_bufp;
+ && (*p == '*' || (cplusplus_comments && *p == '/'))) {
+ /* Skip this comment. */
+ int junk = 0;
+ U_CHAR *save_bufp = ip->bufp;
+ ip->bufp = p + 1;
+ p = skip_to_end_of_comment (ip, &junk, 1);
+ ip->bufp = save_bufp;
} else {
- goto fail;
+ goto fail;
}
}
/* If we get here, this conditional is the beginning of the file. */
@@ -7067,16 +7067,16 @@ do_xifdef (buf, limit, op, keyword)
skip = (keyword->type == T_IFDEF);
if (! traditional)
pedwarn (end == limit ? "`#%s' with no argument"
- : "`#%s' argument starts with punctuation",
- keyword->name);
+ : "`#%s' argument starts with punctuation",
+ keyword->name);
} else {
HASHNODE *hp;
if (! traditional) {
if (isdigit (buf[0]))
- pedwarn ("`#%s' argument starts with a digit", keyword->name);
+ pedwarn ("`#%s' argument starts with a digit", keyword->name);
else if (end != limit)
- pedwarn ("garbage at end of `#%s' argument", keyword->name);
+ pedwarn ("garbage at end of `#%s' argument", keyword->name);
}
hp = lookup (buf, end-buf, -1);
@@ -7084,15 +7084,15 @@ do_xifdef (buf, limit, op, keyword)
if (pcp_outfile) {
/* Output a precondition for this macro. */
if (hp
- && (hp->type == T_CONST
- || (hp->type == T_MACRO && hp->value.defn->predefined)))
- fprintf (pcp_outfile, "#define %s\n", hp->name);
+ && (hp->type == T_CONST
+ || (hp->type == T_MACRO && hp->value.defn->predefined)))
+ fprintf (pcp_outfile, "#define %s\n", hp->name);
else {
- U_CHAR *cp = buf;
- fprintf (pcp_outfile, "#undef ");
- while (is_idchar[*cp]) /* Ick! */
- fputc (*cp++, pcp_outfile);
- putc ('\n', pcp_outfile);
+ U_CHAR *cp = buf;
+ fprintf (pcp_outfile, "#undef ");
+ while (is_idchar[*cp]) /* Ick! */
+ fputc (*cp++, pcp_outfile);
+ putc ('\n', pcp_outfile);
}
}
@@ -7169,8 +7169,8 @@ skip_if_group (ip, any, op)
if (op->bufp > op->buf && op->bufp[-1] != '\n')
{
- *op->bufp++ = '\n';
- op->lineno++;
+ *op->bufp++ = '\n';
+ op->lineno++;
}
check_expand (op, len);
bcopy (ptr, (char *) op->bufp, len);
@@ -7181,53 +7181,53 @@ skip_if_group (ip, any, op)
while (bp < endb) {
switch (*bp++) {
- case '/': /* possible comment */
+ case '/': /* possible comment */
if (*bp == '\\' && bp[1] == '\n')
- newline_fix (bp);
+ newline_fix (bp);
if (*bp == '*'
- || (cplusplus_comments && *bp == '/')) {
- ip->bufp = ++bp;
- bp = skip_to_end_of_comment (ip, &ip->lineno, 0);
+ || (cplusplus_comments && *bp == '/')) {
+ ip->bufp = ++bp;
+ bp = skip_to_end_of_comment (ip, &ip->lineno, 0);
}
break;
case '<':
if (skipping_include_directive) {
- while (bp < endb && *bp != '>' && *bp != '\n') {
- if (*bp == '\\' && bp[1] == '\n') {
- ip->lineno++;
- bp++;
- }
- bp++;
- }
+ while (bp < endb && *bp != '>' && *bp != '\n') {
+ if (*bp == '\\' && bp[1] == '\n') {
+ ip->lineno++;
+ bp++;
+ }
+ bp++;
+ }
}
break;
case '\"':
if (skipping_include_directive) {
- while (bp < endb && *bp != '\n') {
- if (*bp == '"') {
- bp++;
- break;
- }
- if (*bp == '\\' && bp[1] == '\n') {
- ip->lineno++;
- bp++;
- }
- bp++;
- }
- break;
+ while (bp < endb && *bp != '\n') {
+ if (*bp == '"') {
+ bp++;
+ break;
+ }
+ if (*bp == '\\' && bp[1] == '\n') {
+ ip->lineno++;
+ bp++;
+ }
+ bp++;
+ }
+ break;
}
/* Fall through. */
case '\'':
bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno,
- NULL_PTR, NULL_PTR);
+ NULL_PTR, NULL_PTR);
break;
case '\\':
/* Char after backslash loses its special meaning in some cases. */
if (*bp == '\n') {
- ++ip->lineno;
- bp++;
+ ++ip->lineno;
+ bp++;
} else if (traditional && bp < endb)
- bp++;
+ bp++;
break;
case '\n':
++ip->lineno;
@@ -7236,112 +7236,112 @@ skip_if_group (ip, any, op)
break;
case '%':
if (beg_of_line == 0 || traditional)
- break;
+ break;
ip->bufp = bp - 1;
while (bp[0] == '\\' && bp[1] == '\n')
- bp += 2;
+ bp += 2;
if (*bp == ':')
- goto sharp_token;
+ goto sharp_token;
break;
case '#':
/* # keyword: a # must be first nonblank char on the line */
if (beg_of_line == 0)
- break;
+ break;
ip->bufp = bp - 1;
sharp_token:
/* Scan from start of line, skipping whitespace, comments
- and backslash-newlines, and see if we reach this #.
- If not, this # is not special. */
+ and backslash-newlines, and see if we reach this #.
+ If not, this # is not special. */
bp = beg_of_line;
/* If -traditional, require # to be at beginning of line. */
if (!traditional) {
- while (1) {
- if (is_hor_space[*bp])
- bp++;
- else if (*bp == '\\' && bp[1] == '\n')
- bp += 2;
- else if (*bp == '/' && bp[1] == '*') {
- bp += 2;
- while (!(*bp == '*' && bp[1] == '/'))
- bp++;
- bp += 2;
- }
- /* There is no point in trying to deal with C++ // comments here,
- because if there is one, then this # must be part of the
- comment and we would never reach here. */
- else break;
- }
+ while (1) {
+ if (is_hor_space[*bp])
+ bp++;
+ else if (*bp == '\\' && bp[1] == '\n')
+ bp += 2;
+ else if (*bp == '/' && bp[1] == '*') {
+ bp += 2;
+ while (!(*bp == '*' && bp[1] == '/'))
+ bp++;
+ bp += 2;
+ }
+ /* There is no point in trying to deal with C++ // comments here,
+ because if there is one, then this # must be part of the
+ comment and we would never reach here. */
+ else break;
+ }
}
if (bp != ip->bufp) {
- bp = ip->bufp + 1; /* Reset bp to after the #. */
- break;
+ bp = ip->bufp + 1; /* Reset bp to after the #. */
+ break;
}
- bp = ip->bufp + 1; /* Point after the '#' */
+ bp = ip->bufp + 1; /* Point after the '#' */
if (ip->bufp[0] == '%') {
- /* Skip past the ':' again. */
- while (*bp == '\\') {
- ip->lineno++;
- bp += 2;
- }
- bp++;
+ /* Skip past the ':' again. */
+ while (*bp == '\\') {
+ ip->lineno++;
+ bp += 2;
+ }
+ bp++;
}
/* Skip whitespace and \-newline. */
while (1) {
- if (is_hor_space[*bp])
- bp++;
- else if (*bp == '\\' && bp[1] == '\n')
- bp += 2;
- else if (*bp == '/') {
- if (bp[1] == '\\' && bp[2] == '\n')
- newline_fix (bp + 1);
- if (bp[1] == '*') {
- for (bp += 2; ; bp++) {
- if (*bp == '\n')
- ip->lineno++;
- else if (*bp == '*') {
- if (bp[-1] == '/' && warn_comments)
- warning ("`/*' within comment");
- if (bp[1] == '\\' && bp[2] == '\n')
- newline_fix (bp + 1);
- if (bp[1] == '/')
- break;
- }
- }
- bp += 2;
- } else if (bp[1] == '/' && cplusplus_comments) {
- for (bp += 2; ; bp++) {
- if (*bp == '\n') {
- if (bp[-1] != '\\')
- break;
- if (warn_comments)
- warning ("multiline `//' comment");
- ip->lineno++;
- }
- }
- } else
- break;
+ if (is_hor_space[*bp])
+ bp++;
+ else if (*bp == '\\' && bp[1] == '\n')
+ bp += 2;
+ else if (*bp == '/') {
+ if (bp[1] == '\\' && bp[2] == '\n')
+ newline_fix (bp + 1);
+ if (bp[1] == '*') {
+ for (bp += 2; ; bp++) {
+ if (*bp == '\n')
+ ip->lineno++;
+ else if (*bp == '*') {
+ if (bp[-1] == '/' && warn_comments)
+ warning ("`/*' within comment");
+ if (bp[1] == '\\' && bp[2] == '\n')
+ newline_fix (bp + 1);
+ if (bp[1] == '/')
+ break;
+ }
+ }
+ bp += 2;
+ } else if (bp[1] == '/' && cplusplus_comments) {
+ for (bp += 2; ; bp++) {
+ if (*bp == '\n') {
+ if (bp[-1] != '\\')
+ break;
+ if (warn_comments)
+ warning ("multiline `//' comment");
+ ip->lineno++;
+ }
+ }
+ } else
+ break;
} else
- break;
+ break;
}
cp = bp;
/* Now find end of directive name.
- If we encounter a backslash-newline, exchange it with any following
- symbol-constituents so that we end up with a contiguous name. */
+ If we encounter a backslash-newline, exchange it with any following
+ symbol-constituents so that we end up with a contiguous name. */
while (1) {
- if (is_idchar[*bp])
- bp++;
- else {
- if (*bp == '\\' && bp[1] == '\n')
- name_newline_fix (bp);
- if (is_idchar[*bp])
- bp++;
- else break;
- }
+ if (is_idchar[*bp])
+ bp++;
+ else {
+ if (*bp == '\\' && bp[1] == '\n')
+ name_newline_fix (bp);
+ if (is_idchar[*bp])
+ bp++;
+ else break;
+ }
}
ident_length = bp - cp;
ident = cp;
@@ -7350,96 +7350,96 @@ skip_if_group (ip, any, op)
/* A line of just `#' becomes blank. */
if (ident_length == 0 && *after_ident == '\n') {
- continue;
+ continue;
}
if (ident_length == 0 || !is_idstart[*ident]) {
- U_CHAR *p = ident;
- while (is_idchar[*p]) {
- if (*p < '0' || *p > '9')
- break;
- p++;
- }
- /* Handle # followed by a line number. */
- if (p != ident && !is_idchar[*p]) {
- if (pedantic)
- pedwarn ("`#' followed by integer");
- continue;
- }
-
- /* Avoid error for `###' and similar cases unless -pedantic. */
- if (p == ident) {
- while (*p == '#' || is_hor_space[*p]) p++;
- if (*p == '\n') {
- if (pedantic && !lang_asm)
- pedwarn ("invalid preprocessing directive");
- continue;
- }
- }
-
- if (!lang_asm && pedantic)
- pedwarn ("invalid preprocessing directive name");
- continue;
+ U_CHAR *p = ident;
+ while (is_idchar[*p]) {
+ if (*p < '0' || *p > '9')
+ break;
+ p++;
+ }
+ /* Handle # followed by a line number. */
+ if (p != ident && !is_idchar[*p]) {
+ if (pedantic)
+ pedwarn ("`#' followed by integer");
+ continue;
+ }
+
+ /* Avoid error for `###' and similar cases unless -pedantic. */
+ if (p == ident) {
+ while (*p == '#' || is_hor_space[*p]) p++;
+ if (*p == '\n') {
+ if (pedantic && !lang_asm)
+ pedwarn ("invalid preprocessing directive");
+ continue;
+ }
+ }
+
+ if (!lang_asm && pedantic)
+ pedwarn ("invalid preprocessing directive name");
+ continue;
}
for (kt = directive_table; kt->length >= 0; kt++) {
- IF_STACK_FRAME *temp;
- if (ident_length == kt->length
- && bcmp (cp, kt->name, kt->length) == 0) {
- /* If we are asked to return on next directive, do so now. */
- if (any)
- goto done;
-
- switch (kt->type) {
- case T_IF:
- case T_IFDEF:
- case T_IFNDEF:
- temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME));
- temp->next = if_stack;
- if_stack = temp;
- temp->lineno = ip->lineno;
- temp->fname = ip->nominal_fname;
- temp->type = kt->type;
- break;
- case T_ELSE:
- case T_ENDIF:
- if (pedantic && if_stack != save_if_stack)
- validate_else (bp, endb);
- case T_ELIF:
- if (if_stack == instack[indepth].if_stack) {
- error ("`#%s' not within a conditional", kt->name);
- break;
- }
- else if (if_stack == save_if_stack)
- goto done; /* found what we came for */
-
- if (kt->type != T_ENDIF) {
- if (if_stack->type == T_ELSE)
- error ("`#else' or `#elif' after `#else'");
- if_stack->type = kt->type;
- break;
- }
-
- temp = if_stack;
- if_stack = if_stack->next;
- free (temp);
- break;
-
- case T_INCLUDE:
- case T_INCLUDE_NEXT:
- case T_IMPORT:
- skipping_include_directive = 1;
- break;
-
- default:
- break;
- }
- break;
- }
+ IF_STACK_FRAME *temp;
+ if (ident_length == kt->length
+ && bcmp (cp, kt->name, kt->length) == 0) {
+ /* If we are asked to return on next directive, do so now. */
+ if (any)
+ goto done;
+
+ switch (kt->type) {
+ case T_IF:
+ case T_IFDEF:
+ case T_IFNDEF:
+ temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME));
+ temp->next = if_stack;
+ if_stack = temp;
+ temp->lineno = ip->lineno;
+ temp->fname = ip->nominal_fname;
+ temp->type = kt->type;
+ break;
+ case T_ELSE:
+ case T_ENDIF:
+ if (pedantic && if_stack != save_if_stack)
+ validate_else (bp, endb);
+ case T_ELIF:
+ if (if_stack == instack[indepth].if_stack) {
+ error ("`#%s' not within a conditional", kt->name);
+ break;
+ }
+ else if (if_stack == save_if_stack)
+ goto done; /* found what we came for */
+
+ if (kt->type != T_ENDIF) {
+ if (if_stack->type == T_ELSE)
+ error ("`#else' or `#elif' after `#else'");
+ if_stack->type = kt->type;
+ break;
+ }
+
+ temp = if_stack;
+ if_stack = if_stack->next;
+ free (temp);
+ break;
+
+ case T_INCLUDE:
+ case T_INCLUDE_NEXT:
+ case T_IMPORT:
+ skipping_include_directive = 1;
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
}
/* Don't let erroneous code go by. */
if (kt->length < 0 && !lang_asm && pedantic)
- pedwarn ("invalid preprocessing directive name");
+ pedwarn ("invalid preprocessing directive name");
}
}
@@ -7455,12 +7455,12 @@ skip_if_group (ip, any, op)
if (op->bufp > op->buf && op->bufp[-1] != '\n')
{
- *op->bufp++ = '\n';
- op->lineno++;
+ *op->bufp++ = '\n';
+ op->lineno++;
}
check_expand (op, beg_of_line - beg_of_group);
bcopy ((char *) beg_of_group, (char *) op->bufp,
- beg_of_line - beg_of_group);
+ beg_of_line - beg_of_group);
op->bufp += beg_of_line - beg_of_group;
op->lineno += ip->lineno - beg_lineno;
check_expand (op, len);
@@ -7501,7 +7501,7 @@ do_else (buf, limit, op, keyword)
error ("`#else' after `#else'");
fprintf (stderr, " (matches line %d", if_stack->lineno);
if (strcmp (if_stack->fname, ip->nominal_fname) != 0)
- fprintf (stderr, ", file %s", if_stack->fname);
+ fprintf (stderr, ", file %s", if_stack->fname);
fprintf (stderr, ")\n");
}
if_stack->type = T_ELSE;
@@ -7510,7 +7510,7 @@ do_else (buf, limit, op, keyword)
if (if_stack->if_succeeded)
skip_if_group (ip, 0, op);
else {
- ++if_stack->if_succeeded; /* continue processing input */
+ ++if_stack->if_succeeded; /* continue processing input */
output_line_directive (ip, op, 1, same_file);
}
return 0;
@@ -7537,37 +7537,37 @@ do_endif (buf, limit, op, keyword)
if_stack = if_stack->next;
if (temp->control_macro != 0) {
/* This #endif matched a #ifndef at the start of the file.
- See if it is at the end of the file. */
+ See if it is at the end of the file. */
FILE_BUF *ip = &instack[indepth];
U_CHAR *p = ip->bufp;
U_CHAR *ep = ip->buf + ip->length;
while (p != ep) {
- U_CHAR c = *p++;
- if (!is_space[c]) {
- if (c == '/'
- && (*p == '*' || (cplusplus_comments && *p == '/'))) {
- /* Skip this comment. */
- int junk = 0;
- U_CHAR *save_bufp = ip->bufp;
- ip->bufp = p + 1;
- p = skip_to_end_of_comment (ip, &junk, 1);
- ip->bufp = save_bufp;
- } else
- goto fail;
- }
+ U_CHAR c = *p++;
+ if (!is_space[c]) {
+ if (c == '/'
+ && (*p == '*' || (cplusplus_comments && *p == '/'))) {
+ /* Skip this comment. */
+ int junk = 0;
+ U_CHAR *save_bufp = ip->bufp;
+ ip->bufp = p + 1;
+ p = skip_to_end_of_comment (ip, &junk, 1);
+ ip->bufp = save_bufp;
+ } else
+ goto fail;
+ }
}
/* If we get here, this #endif ends a #ifndef
- that contains all of the file (aside from whitespace).
- Arrange not to include the file again
- if the macro that was tested is defined.
+ that contains all of the file (aside from whitespace).
+ Arrange not to include the file again
+ if the macro that was tested is defined.
- Do not do this for the top-level file in a -include or any
- file in a -imacros. */
+ Do not do this for the top-level file in a -include or any
+ file in a -imacros. */
if (indepth != 0
- && ! (indepth == 1 && no_record_file)
- && ! (no_record_file && no_output))
- record_control_macro (ip->inc, temp->control_macro);
+ && ! (indepth == 1 && no_record_file)
+ && ! (no_record_file && no_output))
+ record_control_macro (ip->inc, temp->control_macro);
fail: ;
}
free (temp);
@@ -7594,25 +7594,25 @@ validate_else (p, limit)
p++;
else if (*p == '/') {
while (p[1] == '\\' && p[2] == '\n')
- p += 2;
+ p += 2;
if (p[1] == '*') {
- /* Don't bother warning about unterminated comments
- since that will happen later. Just be sure to exit. */
- for (p += 2; ; p++) {
- if (p == limit)
- return;
- if (*p == '*') {
- while (p[1] == '\\' && p[2] == '\n')
- p += 2;
- if (p[1] == '/') {
- p += 2;
- break;
- }
- }
- }
+ /* Don't bother warning about unterminated comments
+ since that will happen later. Just be sure to exit. */
+ for (p += 2; ; p++) {
+ if (p == limit)
+ return;
+ if (*p == '*') {
+ while (p[1] == '\\' && p[2] == '\n')
+ p += 2;
+ if (p[1] == '/') {
+ p += 2;
+ break;
+ }
+ }
+ }
}
else if (cplusplus_comments && p[1] == '/')
- return;
+ return;
else break;
} else break;
}
@@ -7635,7 +7635,7 @@ validate_else (p, limit)
static U_CHAR *
skip_to_end_of_comment (ip, line_counter, nowarn)
register FILE_BUF *ip;
- int *line_counter; /* place to remember newlines, or NULL */
+ int *line_counter; /* place to remember newlines, or NULL */
int nowarn;
{
register U_CHAR *limit = ip->buf + ip->length;
@@ -7643,9 +7643,9 @@ skip_to_end_of_comment (ip, line_counter, nowarn)
FILE_BUF *op = put_out_comments && !line_counter ? &outbuf : (FILE_BUF *) 0;
int start_line = line_counter ? *line_counter : 0;
- /* JF this line_counter stuff is a crock to make sure the
- comment is only put out once, no matter how many times
- the comment is skipped. It almost works */
+ /* JF this line_counter stuff is a crock to make sure the
+ comment is only put out once, no matter how many times
+ the comment is skipped. It almost works */
if (op) {
*op->bufp++ = '/';
*op->bufp++ = bp[-1];
@@ -7653,17 +7653,17 @@ skip_to_end_of_comment (ip, line_counter, nowarn)
if (cplusplus_comments && bp[-1] == '/') {
for (; bp < limit; bp++) {
if (*bp == '\n') {
- if (bp[-1] != '\\')
- break;
- if (!nowarn && warn_comments)
- warning ("multiline `//' comment");
- if (line_counter)
- ++*line_counter;
- if (op)
- ++op->lineno;
+ if (bp[-1] != '\\')
+ break;
+ if (!nowarn && warn_comments)
+ warning ("multiline `//' comment");
+ if (line_counter)
+ ++*line_counter;
+ if (op)
+ ++op->lineno;
}
if (op)
- *op->bufp++ = *bp;
+ *op->bufp++ = *bp;
}
ip->bufp = bp;
return bp;
@@ -7674,29 +7674,29 @@ skip_to_end_of_comment (ip, line_counter, nowarn)
switch (*bp++) {
case '\n':
/* If this is the end of the file, we have an unterminated comment.
- Don't swallow the newline. We are guaranteed that there will be a
- trailing newline and various pieces assume it's there. */
+ Don't swallow the newline. We are guaranteed that there will be a
+ trailing newline and various pieces assume it's there. */
if (bp == limit)
- {
- --bp;
- --limit;
- break;
- }
+ {
+ --bp;
+ --limit;
+ break;
+ }
if (line_counter != NULL)
- ++*line_counter;
+ ++*line_counter;
if (op)
- ++op->lineno;
+ ++op->lineno;
break;
case '*':
if (bp[-2] == '/' && !nowarn && warn_comments)
- warning ("`/*' within comment");
+ warning ("`/*' within comment");
if (*bp == '\\' && bp[1] == '\n')
- newline_fix (bp);
+ newline_fix (bp);
if (*bp == '/') {
if (op)
- *op->bufp++ = '/';
- ip->bufp = ++bp;
- return bp;
+ *op->bufp++ = '/';
+ ip->bufp = ++bp;
+ return bp;
}
break;
}
@@ -7738,54 +7738,54 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p,
while (1) {
if (bp >= limit) {
error_with_line (line_for_error (start_line),
- "unterminated string or character constant");
+ "unterminated string or character constant");
error_with_line (multiline_string_line,
- "possible real start of unterminated constant");
+ "possible real start of unterminated constant");
multiline_string_line = 0;
if (eofp)
- *eofp = 1;
+ *eofp = 1;
break;
}
c = *bp++;
if (c == '\\') {
while (*bp == '\\' && bp[1] == '\n') {
- if (backslash_newlines_p)
- *backslash_newlines_p = 1;
- if (count_newlines)
- ++*count_newlines;
- bp += 2;
+ if (backslash_newlines_p)
+ *backslash_newlines_p = 1;
+ if (count_newlines)
+ ++*count_newlines;
+ bp += 2;
}
if (*bp == '\n') {
- if (backslash_newlines_p)
- *backslash_newlines_p = 1;
- if (count_newlines)
- ++*count_newlines;
+ if (backslash_newlines_p)
+ *backslash_newlines_p = 1;
+ if (count_newlines)
+ ++*count_newlines;
}
bp++;
} else if (c == '\n') {
if (traditional) {
- /* Unterminated strings and character constants are 'valid'. */
- bp--; /* Don't consume the newline. */
- if (eofp)
- *eofp = 1;
- break;
+ /* Unterminated strings and character constants are 'valid'. */
+ bp--; /* Don't consume the newline. */
+ if (eofp)
+ *eofp = 1;
+ break;
}
if (match == '\'') {
- error_with_line (line_for_error (start_line),
- "unterminated string or character constant");
- bp--;
- if (eofp)
- *eofp = 1;
- break;
+ error_with_line (line_for_error (start_line),
+ "unterminated string or character constant");
+ bp--;
+ if (eofp)
+ *eofp = 1;
+ break;
}
/* If not traditional, then allow newlines inside strings. */
if (count_newlines)
- ++*count_newlines;
+ ++*count_newlines;
if (multiline_string_line == 0) {
- if (pedantic)
- pedwarn_with_line (line_for_error (start_line),
- "string constant runs past end of line");
- multiline_string_line = start_line;
+ if (pedantic)
+ pedwarn_with_line (line_for_error (start_line),
+ "string constant runs past end of line");
+ multiline_string_line = start_line;
}
} else if (c == match)
break;
@@ -7808,24 +7808,24 @@ quote_string (dst, src)
{
default:
if (isprint (c))
- *dst++ = c;
- else
- {
- sprintf (dst, "\\%03o", c);
- dst += 4;
- }
- break;
+ *dst++ = c;
+ else
+ {
+ sprintf (dst, "\\%03o", c);
+ dst += 4;
+ }
+ break;
case '\"':
case '\\':
- *dst++ = '\\';
- *dst++ = c;
- break;
+ *dst++ = '\\';
+ *dst++ = c;
+ break;
case '\0':
- *dst++ = '\"';
- *dst = '\0';
- return dst;
+ *dst++ = '\"';
+ *dst = '\0';
+ return dst;
}
}
@@ -7854,23 +7854,23 @@ skip_paren_group (ip)
case ')':
depth--;
if (depth == 0)
- return ip->bufp = p;
+ return ip->bufp = p;
break;
case '/':
if (*p == '*') {
- ip->bufp = p;
- p = skip_to_end_of_comment (ip, &lines_dummy, 0);
- p = ip->bufp;
+ ip->bufp = p;
+ p = skip_to_end_of_comment (ip, &lines_dummy, 0);
+ p = ip->bufp;
}
case '"':
case '\'':
{
- int eofp = 0;
- p = skip_quoted_string (p - 1, limit, 0, NULL_PTR, NULL_PTR, &eofp);
- if (eofp)
- return ip->bufp = p;
+ int eofp = 0;
+ p = skip_quoted_string (p - 1, limit, 0, NULL_PTR, NULL_PTR, &eofp);
+ if (eofp)
+ return ip->bufp = p;
}
break;
}
@@ -7911,8 +7911,8 @@ output_line_directive (ip, op, conditional, file_change)
if (ip->lineno > op->lineno && ip->lineno < op->lineno + 8) {
check_expand (op, 10);
while (ip->lineno > op->lineno) {
- *op->bufp++ = '\n';
- op->lineno++;
+ *op->bufp++ = '\n';
+ op->lineno++;
}
return;
}
@@ -7920,7 +7920,7 @@ output_line_directive (ip, op, conditional, file_change)
/* Output a positive line number if possible. */
while (ip->lineno <= 0 && ip->bufp - ip->buf < ip->length
- && *ip->bufp == '\n') {
+ && *ip->bufp == '\n') {
ip->lineno++;
ip->bufp++;
}
@@ -7928,7 +7928,7 @@ output_line_directive (ip, op, conditional, file_change)
line_directive_buf = (char *) alloca (4 * strlen (ip->nominal_fname) + 100);
sprintf (line_directive_buf, "# %d ", ip->lineno);
line_end = quote_string (line_directive_buf + strlen (line_directive_buf),
- ip->nominal_fname);
+ ip->nominal_fname);
if (file_change != same_file) {
*line_end++ = ' ';
*line_end++ = file_change == enter_file ? '1' : '2';
@@ -8022,7 +8022,7 @@ macroexpand (hp, op)
args[i].raw = (U_CHAR *) "";
args[i].expanded = 0;
args[i].raw_length = args[i].expand_length
- = args[i].stringified_length = 0;
+ = args[i].stringified_length = 0;
args[i].free1 = args[i].free2 = 0;
args[i].use_count = 0;
}
@@ -8038,18 +8038,18 @@ macroexpand (hp, op)
/* Discard the open-parenthesis or comma before the next arg. */
++instack[indepth].bufp;
if (rest_args)
- continue;
+ continue;
if (i < nargs || (nargs == 0 && i == 0)) {
- /* If we are working on last arg which absorbs rest of args... */
- if (i == nargs - 1 && defn->rest_args)
- rest_args = 1;
- parse_error = macarg (&args[i], rest_args);
+ /* If we are working on last arg which absorbs rest of args... */
+ if (i == nargs - 1 && defn->rest_args)
+ rest_args = 1;
+ parse_error = macarg (&args[i], rest_args);
}
else
- parse_error = macarg (NULL_PTR, 0);
+ parse_error = macarg (NULL_PTR, 0);
if (parse_error) {
- error_with_line (line_for_error (start_line), parse_error);
- break;
+ error_with_line (line_for_error (start_line), parse_error);
+ break;
}
i++;
} while (*instack[indepth].bufp != ')');
@@ -8059,11 +8059,11 @@ macroexpand (hp, op)
register U_CHAR *bp = args[0].raw;
register U_CHAR *lim = bp + args[0].raw_length;
/* cpp.texi says for foo ( ) we provide one argument.
- However, if foo wants just 0 arguments, treat this as 0. */
+ However, if foo wants just 0 arguments, treat this as 0. */
if (nargs == 0)
- while (bp != lim && is_space[*bp]) bp++;
+ while (bp != lim && is_space[*bp]) bp++;
if (bp == lim)
- i = 0;
+ i = 0;
}
/* Don't output an error message if we have already output one for
@@ -8071,25 +8071,25 @@ macroexpand (hp, op)
rest_zero = 0;
if (nargs == 0 && i > 0) {
if (! parse_error)
- error ("arguments given to macro `%s'", hp->name);
+ error ("arguments given to macro `%s'", hp->name);
} else if (i < nargs) {
/* traditional C allows foo() if foo wants one argument. */
if (nargs == 1 && i == 0 && traditional)
- ;
+ ;
/* the rest args token is allowed to absorb 0 tokens */
else if (i == nargs - 1 && defn->rest_args)
- rest_zero = 1;
+ rest_zero = 1;
else if (parse_error)
- ;
+ ;
else if (i == 0)
- error ("macro `%s' used without args", hp->name);
+ error ("macro `%s' used without args", hp->name);
else if (i == 1)
- error ("macro `%s' used with just one arg", hp->name);
+ error ("macro `%s' used with just one arg", hp->name);
else
- error ("macro `%s' used with only %d args", hp->name, i);
+ error ("macro `%s' used with only %d args", hp->name, i);
} else if (i > nargs) {
if (! parse_error)
- error ("macro `%s' used with too many (%d) args", hp->name, i);
+ error ("macro `%s' used with too many (%d) args", hp->name, i);
}
/* Swallow the closeparen. */
@@ -8102,241 +8102,241 @@ macroexpand (hp, op)
xbuf_len = defn->length;
} else {
register U_CHAR *exp = defn->expansion;
- register int offset; /* offset in expansion,
- copied a piece at a time */
- register int totlen; /* total amount of exp buffer filled so far */
+ register int offset; /* offset in expansion,
+ copied a piece at a time */
+ register int totlen; /* total amount of exp buffer filled so far */
register struct reflist *ap, *last_ap;
/* Macro really takes args. Compute the expansion of this call. */
/* Compute length in characters of the macro's expansion.
- Also count number of times each arg is used. */
+ Also count number of times each arg is used. */
xbuf_len = defn->length;
for (ap = defn->pattern; ap != NULL; ap = ap->next) {
- if (ap->stringify)
- xbuf_len += args[ap->argno].stringified_length;
- else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional)
- /* Add 4 for two newline-space markers to prevent
- token concatenation. */
- xbuf_len += args[ap->argno].raw_length + 4;
- else {
- /* We have an ordinary (expanded) occurrence of the arg.
- So compute its expansion, if we have not already. */
- if (args[ap->argno].expanded == 0) {
- FILE_BUF obuf;
- obuf = expand_to_temp_buffer (args[ap->argno].raw,
- args[ap->argno].raw + args[ap->argno].raw_length,
- 1, 0);
-
- args[ap->argno].expanded = obuf.buf;
- args[ap->argno].expand_length = obuf.length;
- args[ap->argno].free2 = obuf.buf;
- }
-
- /* Add 4 for two newline-space markers to prevent
- token concatenation. */
- xbuf_len += args[ap->argno].expand_length + 4;
- }
- if (args[ap->argno].use_count < 10)
- args[ap->argno].use_count++;
+ if (ap->stringify)
+ xbuf_len += args[ap->argno].stringified_length;
+ else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional)
+ /* Add 4 for two newline-space markers to prevent
+ token concatenation. */
+ xbuf_len += args[ap->argno].raw_length + 4;
+ else {
+ /* We have an ordinary (expanded) occurrence of the arg.
+ So compute its expansion, if we have not already. */
+ if (args[ap->argno].expanded == 0) {
+ FILE_BUF obuf;
+ obuf = expand_to_temp_buffer (args[ap->argno].raw,
+ args[ap->argno].raw + args[ap->argno].raw_length,
+ 1, 0);
+
+ args[ap->argno].expanded = obuf.buf;
+ args[ap->argno].expand_length = obuf.length;
+ args[ap->argno].free2 = obuf.buf;
+ }
+
+ /* Add 4 for two newline-space markers to prevent
+ token concatenation. */
+ xbuf_len += args[ap->argno].expand_length + 4;
+ }
+ if (args[ap->argno].use_count < 10)
+ args[ap->argno].use_count++;
}
xbuf = (U_CHAR *) xmalloc (xbuf_len + 1);
/* Generate in XBUF the complete expansion
- with arguments substituted in.
- TOTLEN is the total size generated so far.
- OFFSET is the index in the definition
- of where we are copying from. */
+ with arguments substituted in.
+ TOTLEN is the total size generated so far.
+ OFFSET is the index in the definition
+ of where we are copying from. */
offset = totlen = 0;
for (last_ap = NULL, ap = defn->pattern; ap != NULL;
- last_ap = ap, ap = ap->next) {
- register struct argdata *arg = &args[ap->argno];
- int count_before = totlen;
-
- /* Add chars to XBUF. */
- for (i = 0; i < ap->nchars; i++, offset++)
- xbuf[totlen++] = exp[offset];
-
- /* If followed by an empty rest arg with concatenation,
- delete the last run of nonwhite chars. */
- if (rest_zero && totlen > count_before
- && ((ap->rest_args && ap->raw_before != 0)
- || (last_ap != NULL && last_ap->rest_args
- && last_ap->raw_after != 0))) {
- /* Delete final whitespace. */
- while (totlen > count_before && is_space[xbuf[totlen - 1]]) {
- totlen--;
- }
-
- /* Delete the nonwhites before them. */
- while (totlen > count_before && ! is_space[xbuf[totlen - 1]]) {
- totlen--;
- }
- }
-
- if (ap->stringify != 0) {
- int arglen = arg->raw_length;
- int escaped = 0;
- int in_string = 0;
- int c;
- i = 0;
- while (i < arglen
- && (c = arg->raw[i], is_space[c]))
- i++;
- while (i < arglen
- && (c = arg->raw[arglen - 1], is_space[c]))
- arglen--;
- if (!traditional)
- xbuf[totlen++] = '\"'; /* insert beginning quote */
- for (; i < arglen; i++) {
- c = arg->raw[i];
-
- if (! in_string) {
- /* Special markers Newline Space
- generate nothing for a stringified argument. */
- if (c == '\n' && arg->raw[i+1] != '\n') {
- i++;
- continue;
- }
-
- /* Internal sequences of whitespace are replaced by one space
- except within an string or char token. */
- if (c == '\n' ? arg->raw[i+1] == '\n' : is_space[c]) {
- while (1) {
- /* Note that Newline Space does occur within whitespace
- sequences; consider it part of the sequence. */
- if (c == '\n' && is_space[arg->raw[i+1]])
- i += 2;
- else if (c != '\n' && is_space[c])
- i++;
- else break;
- c = arg->raw[i];
- }
- i--;
- c = ' ';
- }
- }
-
- if (escaped)
- escaped = 0;
- else {
- if (c == '\\')
- escaped = 1;
- if (in_string) {
- if (c == in_string)
- in_string = 0;
- } else if (c == '\"' || c == '\'')
- in_string = c;
- }
-
- /* Escape these chars */
- if (c == '\"' || (in_string && c == '\\'))
- xbuf[totlen++] = '\\';
- /* We used to output e.g. \008 for control characters here,
- but this doesn't conform to the C Standard.
- Just output the characters as-is. */
- xbuf[totlen++] = c;
- }
- if (!traditional)
- xbuf[totlen++] = '\"'; /* insert ending quote */
- } else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional) {
- U_CHAR *p1 = arg->raw;
- U_CHAR *l1 = p1 + arg->raw_length;
- if (ap->raw_before != 0) {
- while (p1 != l1 && is_space[*p1]) p1++;
- while (p1 != l1 && is_idchar[*p1])
- xbuf[totlen++] = *p1++;
- /* Delete any no-reexpansion marker that follows
- an identifier at the beginning of the argument
- if the argument is concatenated with what precedes it. */
- if (p1[0] == '\n' && p1[1] == '-')
- p1 += 2;
- } else if (!traditional) {
- /* Ordinary expanded use of the argument.
- Put in newline-space markers to prevent token pasting. */
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- if (ap->raw_after != 0) {
- /* Arg is concatenated after: delete trailing whitespace,
- whitespace markers, and no-reexpansion markers. */
- while (p1 != l1) {
- if (is_space[l1[-1]]) l1--;
- else if (l1[-1] == '-') {
- U_CHAR *p2 = l1 - 1;
- /* If a `-' is preceded by an odd number of newlines then it
- and the last newline are a no-reexpansion marker. */
- while (p2 != p1 && p2[-1] == '\n') p2--;
- if ((l1 - 1 - p2) & 1) {
- l1 -= 2;
- }
- else break;
- }
- else break;
- }
- }
-
- bcopy ((char *) p1, (char *) (xbuf + totlen), l1 - p1);
- totlen += l1 - p1;
- if (!traditional && ap->raw_after == 0) {
- /* Ordinary expanded use of the argument.
- Put in newline-space markers to prevent token pasting. */
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- } else {
- /* Ordinary expanded use of the argument.
- Put in newline-space markers to prevent token pasting. */
- if (!traditional) {
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- bcopy ((char *) arg->expanded, (char *) (xbuf + totlen),
- arg->expand_length);
- totlen += arg->expand_length;
- if (!traditional) {
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- /* If a macro argument with newlines is used multiple times,
- then only expand the newlines once. This avoids creating output
- lines which don't correspond to any input line, which confuses
- gdb and gcov. */
- if (arg->use_count > 1 && arg->newlines > 0) {
- /* Don't bother doing change_newlines for subsequent
- uses of arg. */
- arg->use_count = 1;
- arg->expand_length
- = change_newlines (arg->expanded, arg->expand_length);
- }
- }
-
- if (totlen > xbuf_len)
- abort ();
+ last_ap = ap, ap = ap->next) {
+ register struct argdata *arg = &args[ap->argno];
+ int count_before = totlen;
+
+ /* Add chars to XBUF. */
+ for (i = 0; i < ap->nchars; i++, offset++)
+ xbuf[totlen++] = exp[offset];
+
+ /* If followed by an empty rest arg with concatenation,
+ delete the last run of nonwhite chars. */
+ if (rest_zero && totlen > count_before
+ && ((ap->rest_args && ap->raw_before != 0)
+ || (last_ap != NULL && last_ap->rest_args
+ && last_ap->raw_after != 0))) {
+ /* Delete final whitespace. */
+ while (totlen > count_before && is_space[xbuf[totlen - 1]]) {
+ totlen--;
+ }
+
+ /* Delete the nonwhites before them. */
+ while (totlen > count_before && ! is_space[xbuf[totlen - 1]]) {
+ totlen--;
+ }
+ }
+
+ if (ap->stringify != 0) {
+ int arglen = arg->raw_length;
+ int escaped = 0;
+ int in_string = 0;
+ int c;
+ i = 0;
+ while (i < arglen
+ && (c = arg->raw[i], is_space[c]))
+ i++;
+ while (i < arglen
+ && (c = arg->raw[arglen - 1], is_space[c]))
+ arglen--;
+ if (!traditional)
+ xbuf[totlen++] = '\"'; /* insert beginning quote */
+ for (; i < arglen; i++) {
+ c = arg->raw[i];
+
+ if (! in_string) {
+ /* Special markers Newline Space
+ generate nothing for a stringified argument. */
+ if (c == '\n' && arg->raw[i+1] != '\n') {
+ i++;
+ continue;
+ }
+
+ /* Internal sequences of whitespace are replaced by one space
+ except within an string or char token. */
+ if (c == '\n' ? arg->raw[i+1] == '\n' : is_space[c]) {
+ while (1) {
+ /* Note that Newline Space does occur within whitespace
+ sequences; consider it part of the sequence. */
+ if (c == '\n' && is_space[arg->raw[i+1]])
+ i += 2;
+ else if (c != '\n' && is_space[c])
+ i++;
+ else break;
+ c = arg->raw[i];
+ }
+ i--;
+ c = ' ';
+ }
+ }
+
+ if (escaped)
+ escaped = 0;
+ else {
+ if (c == '\\')
+ escaped = 1;
+ if (in_string) {
+ if (c == in_string)
+ in_string = 0;
+ } else if (c == '\"' || c == '\'')
+ in_string = c;
+ }
+
+ /* Escape these chars */
+ if (c == '\"' || (in_string && c == '\\'))
+ xbuf[totlen++] = '\\';
+ /* We used to output e.g. \008 for control characters here,
+ but this doesn't conform to the C Standard.
+ Just output the characters as-is. */
+ xbuf[totlen++] = c;
+ }
+ if (!traditional)
+ xbuf[totlen++] = '\"'; /* insert ending quote */
+ } else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional) {
+ U_CHAR *p1 = arg->raw;
+ U_CHAR *l1 = p1 + arg->raw_length;
+ if (ap->raw_before != 0) {
+ while (p1 != l1 && is_space[*p1]) p1++;
+ while (p1 != l1 && is_idchar[*p1])
+ xbuf[totlen++] = *p1++;
+ /* Delete any no-reexpansion marker that follows
+ an identifier at the beginning of the argument
+ if the argument is concatenated with what precedes it. */
+ if (p1[0] == '\n' && p1[1] == '-')
+ p1 += 2;
+ } else if (!traditional) {
+ /* Ordinary expanded use of the argument.
+ Put in newline-space markers to prevent token pasting. */
+ xbuf[totlen++] = '\n';
+ xbuf[totlen++] = ' ';
+ }
+ if (ap->raw_after != 0) {
+ /* Arg is concatenated after: delete trailing whitespace,
+ whitespace markers, and no-reexpansion markers. */
+ while (p1 != l1) {
+ if (is_space[l1[-1]]) l1--;
+ else if (l1[-1] == '-') {
+ U_CHAR *p2 = l1 - 1;
+ /* If a `-' is preceded by an odd number of newlines then it
+ and the last newline are a no-reexpansion marker. */
+ while (p2 != p1 && p2[-1] == '\n') p2--;
+ if ((l1 - 1 - p2) & 1) {
+ l1 -= 2;
+ }
+ else break;
+ }
+ else break;
+ }
+ }
+
+ bcopy ((char *) p1, (char *) (xbuf + totlen), l1 - p1);
+ totlen += l1 - p1;
+ if (!traditional && ap->raw_after == 0) {
+ /* Ordinary expanded use of the argument.
+ Put in newline-space markers to prevent token pasting. */
+ xbuf[totlen++] = '\n';
+ xbuf[totlen++] = ' ';
+ }
+ } else {
+ /* Ordinary expanded use of the argument.
+ Put in newline-space markers to prevent token pasting. */
+ if (!traditional) {
+ xbuf[totlen++] = '\n';
+ xbuf[totlen++] = ' ';
+ }
+ bcopy ((char *) arg->expanded, (char *) (xbuf + totlen),
+ arg->expand_length);
+ totlen += arg->expand_length;
+ if (!traditional) {
+ xbuf[totlen++] = '\n';
+ xbuf[totlen++] = ' ';
+ }
+ /* If a macro argument with newlines is used multiple times,
+ then only expand the newlines once. This avoids creating output
+ lines which don't correspond to any input line, which confuses
+ gdb and gcov. */
+ if (arg->use_count > 1 && arg->newlines > 0) {
+ /* Don't bother doing change_newlines for subsequent
+ uses of arg. */
+ arg->use_count = 1;
+ arg->expand_length
+ = change_newlines (arg->expanded, arg->expand_length);
+ }
+ }
+
+ if (totlen > xbuf_len)
+ abort ();
}
/* If there is anything left of the definition after handling
- the arg list, copy that in too. */
+ the arg list, copy that in too. */
for (i = offset; i < defn->length; i++) {
- /* if we've reached the end of the macro */
- if (exp[i] == ')')
- rest_zero = 0;
- if (! (rest_zero && last_ap != NULL && last_ap->rest_args
- && last_ap->raw_after != 0))
- xbuf[totlen++] = exp[i];
+ /* if we've reached the end of the macro */
+ if (exp[i] == ')')
+ rest_zero = 0;
+ if (! (rest_zero && last_ap != NULL && last_ap->rest_args
+ && last_ap->raw_after != 0))
+ xbuf[totlen++] = exp[i];
}
xbuf[totlen] = 0;
xbuf_len = totlen;
for (i = 0; i < nargs; i++) {
- if (args[i].free1 != 0)
- free (args[i].free1);
- if (args[i].free2 != 0)
- free (args[i].free2);
+ if (args[i].free1 != 0)
+ free (args[i].free1);
+ if (args[i].free2 != 0)
+ free (args[i].free2);
}
}
} else {
@@ -8392,7 +8392,7 @@ macarg (argptr, rest_args)
/* Try to parse as much of the argument as exists at this
input stack level. */
U_CHAR *bp = macarg1 (ip->bufp, ip->buf + ip->length, ip->macro,
- &paren, &newlines, &comments, rest_args);
+ &paren, &newlines, &comments, rest_args);
/* If we find the end of the argument at this level,
set up *ARGPTR to point at it in the input stack. */
@@ -8420,23 +8420,23 @@ macarg (argptr, rest_args)
while (bp == ip->buf + ip->length) {
if (instack[indepth].macro == 0) {
- result = "unterminated macro call";
- break;
+ result = "unterminated macro call";
+ break;
}
ip->macro->type = T_MACRO;
if (ip->free_ptr)
- free (ip->free_ptr);
+ free (ip->free_ptr);
ip = &instack[--indepth];
newlines = 0;
comments = 0;
bp = macarg1 (ip->bufp, ip->buf + ip->length, ip->macro, &paren,
- &newlines, &comments, rest_args);
+ &newlines, &comments, rest_args);
final_start = bufsize;
bufsize += bp - ip->bufp;
extra += newlines;
buffer = (U_CHAR *) xrealloc (buffer, bufsize + extra + 1);
bcopy ((char *) ip->bufp, (char *) (buffer + bufsize - (bp - ip->bufp)),
- bp - ip->bufp);
+ bp - ip->bufp);
ip->bufp = bp;
ip->lineno += newlines;
}
@@ -8452,14 +8452,14 @@ macarg (argptr, rest_args)
argptr->free1 = buffer;
argptr->newlines = newlines;
if ((newlines || comments) && ip->fname != 0)
- argptr->raw_length
- = final_start +
- discard_comments (argptr->raw + final_start,
- argptr->raw_length - final_start,
- newlines);
+ argptr->raw_length
+ = final_start +
+ discard_comments (argptr->raw + final_start,
+ argptr->raw_length - final_start,
+ newlines);
argptr->raw[argptr->raw_length] = 0;
if (argptr->raw_length > bufsize + extra)
- abort ();
+ abort ();
}
}
@@ -8478,20 +8478,20 @@ macarg (argptr, rest_args)
buf++;
while (buf != lim && is_space[lim[-1]])
lim--;
- totlen = traditional ? 0 : 2; /* Count opening and closing quote. */
+ totlen = traditional ? 0 : 2; /* Count opening and closing quote. */
while (buf != lim) {
register U_CHAR c = *buf++;
totlen++;
/* Internal sequences of whitespace are replaced by one space
- in most cases, but not always. So count all the whitespace
- in case we need to keep it all. */
+ in most cases, but not always. So count all the whitespace
+ in case we need to keep it all. */
#if 0
if (is_space[c])
- SKIP_ALL_WHITE_SPACE (buf);
+ SKIP_ALL_WHITE_SPACE (buf);
else
#endif
if (c == '\"' || c == '\\') /* escape these chars */
- totlen++;
+ totlen++;
}
argptr->stringified_length = totlen;
}
@@ -8529,77 +8529,77 @@ macarg1 (start, limit, macro, depthptr, newlines, comments, rest_args)
break;
case ')':
if (--(*depthptr) < 0)
- return bp;
+ return bp;
break;
case '\\':
/* Traditionally, backslash makes following char not special. */
if (traditional && bp + 1 < limit && bp[1] != '\n')
- bp++;
+ bp++;
break;
case '\n':
++*newlines;
break;
case '/':
if (macro)
- break;
+ break;
if (bp[1] == '\\' && bp[2] == '\n')
- newline_fix (bp + 1);
+ newline_fix (bp + 1);
if (bp[1] == '*') {
- *comments = 1;
- for (bp += 2; bp < limit; bp++) {
- if (*bp == '\n')
- ++*newlines;
- else if (*bp == '*') {
- if (bp[-1] == '/' && warn_comments)
- warning ("`/*' within comment");
- if (bp[1] == '\\' && bp[2] == '\n')
- newline_fix (bp + 1);
- if (bp[1] == '/') {
- bp++;
- break;
- }
- }
- }
+ *comments = 1;
+ for (bp += 2; bp < limit; bp++) {
+ if (*bp == '\n')
+ ++*newlines;
+ else if (*bp == '*') {
+ if (bp[-1] == '/' && warn_comments)
+ warning ("`/*' within comment");
+ if (bp[1] == '\\' && bp[2] == '\n')
+ newline_fix (bp + 1);
+ if (bp[1] == '/') {
+ bp++;
+ break;
+ }
+ }
+ }
} else if (bp[1] == '/' && cplusplus_comments) {
- *comments = 1;
- for (bp += 2; bp < limit; bp++) {
- if (*bp == '\n') {
- ++*newlines;
- if (bp[-1] != '\\')
- break;
- if (warn_comments)
- warning ("multiline `//' comment");
- }
- }
+ *comments = 1;
+ for (bp += 2; bp < limit; bp++) {
+ if (*bp == '\n') {
+ ++*newlines;
+ if (bp[-1] != '\\')
+ break;
+ if (warn_comments)
+ warning ("multiline `//' comment");
+ }
+ }
}
break;
case '\'':
case '\"':
{
- int quotec;
- for (quotec = *bp++; bp + 1 < limit && *bp != quotec; bp++) {
- if (*bp == '\\') {
- bp++;
- if (*bp == '\n')
- ++*newlines;
- if (!macro) {
- while (*bp == '\\' && bp[1] == '\n') {
- bp += 2;
- ++*newlines;
- }
- }
- } else if (*bp == '\n') {
- ++*newlines;
- if (quotec == '\'')
- break;
- }
- }
+ int quotec;
+ for (quotec = *bp++; bp + 1 < limit && *bp != quotec; bp++) {
+ if (*bp == '\\') {
+ bp++;
+ if (*bp == '\n')
+ ++*newlines;
+ if (!macro) {
+ while (*bp == '\\' && bp[1] == '\n') {
+ bp += 2;
+ ++*newlines;
+ }
+ }
+ } else if (*bp == '\n') {
+ ++*newlines;
+ if (quotec == '\'')
+ break;
+ }
+ }
}
break;
case ',':
/* if we've returned to lowest level and we aren't absorbing all args */
if ((*depthptr) == 0 && rest_args == 0)
- return bp;
+ return bp;
break;
}
bp++;
@@ -8657,68 +8657,68 @@ discard_comments (start, length, newlines)
case '\\':
if (*ibp == '\n') {
- obp--;
- ibp++;
+ obp--;
+ ibp++;
}
break;
case '/':
if (*ibp == '\\' && ibp[1] == '\n')
- newline_fix (ibp);
+ newline_fix (ibp);
/* Delete any comment. */
if (cplusplus_comments && ibp[0] == '/') {
- /* Comments are equivalent to spaces. */
- obp[-1] = ' ';
- ibp++;
- while (ibp < limit && (*ibp != '\n' || ibp[-1] == '\\'))
- ibp++;
- break;
+ /* Comments are equivalent to spaces. */
+ obp[-1] = ' ';
+ ibp++;
+ while (ibp < limit && (*ibp != '\n' || ibp[-1] == '\\'))
+ ibp++;
+ break;
}
if (ibp[0] != '*' || ibp + 1 >= limit)
- break;
+ break;
/* Comments are equivalent to spaces.
- For -traditional, a comment is equivalent to nothing. */
+ For -traditional, a comment is equivalent to nothing. */
if (traditional)
- obp--;
+ obp--;
else
- obp[-1] = ' ';
+ obp[-1] = ' ';
while (++ibp < limit) {
- if (ibp[0] == '*') {
- if (ibp[1] == '\\' && ibp[2] == '\n')
- newline_fix (ibp + 1);
- if (ibp[1] == '/') {
- ibp += 2;
- break;
- }
- }
+ if (ibp[0] == '*') {
+ if (ibp[1] == '\\' && ibp[2] == '\n')
+ newline_fix (ibp + 1);
+ if (ibp[1] == '/') {
+ ibp += 2;
+ break;
+ }
+ }
}
break;
case '\'':
case '\"':
/* Notice and skip strings, so that we don't
- think that comments start inside them,
- and so we don't duplicate newlines in them. */
+ think that comments start inside them,
+ and so we don't duplicate newlines in them. */
{
- int quotec = c;
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- if (c == quotec)
- break;
- if (c == '\n' && quotec == '\'')
- break;
- if (c == '\\') {
- if (ibp < limit && *ibp == '\n') {
- ibp++;
- obp--;
- } else {
- while (*ibp == '\\' && ibp[1] == '\n')
- ibp += 2;
- if (ibp < limit)
- *obp++ = *ibp++;
- }
- }
- }
+ int quotec = c;
+ while (ibp < limit) {
+ *obp++ = c = *ibp++;
+ if (c == quotec)
+ break;
+ if (c == '\n' && quotec == '\'')
+ break;
+ if (c == '\\') {
+ if (ibp < limit && *ibp == '\n') {
+ ibp++;
+ obp--;
+ } else {
+ while (*ibp == '\\' && ibp[1] == '\n')
+ ibp += 2;
+ if (ibp < limit)
+ *obp++ = *ibp++;
+ }
+ }
+ }
}
break;
}
@@ -8750,28 +8750,28 @@ change_newlines (start, length)
switch (c) {
case '\n':
/* If this is a NEWLINE NEWLINE, then this is a real newline in the
- string. Skip past the newline and its duplicate.
- Put a space in the output. */
+ string. Skip past the newline and its duplicate.
+ Put a space in the output. */
if (*ibp == '\n')
- {
- ibp++;
- obp--;
- *obp++ = ' ';
- }
+ {
+ ibp++;
+ obp--;
+ *obp++ = ' ';
+ }
break;
case '\'':
case '\"':
/* Notice and skip strings, so that we don't delete newlines in them. */
{
- int quotec = c;
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- if (c == quotec && ibp[-2] != '\\')
- break;
- if (c == '\n' && quotec == '\'')
- break;
- }
+ int quotec = c;
+ while (ibp < limit) {
+ *obp++ = c = *ibp++;
+ if (c == quotec && ibp[-2] != '\\')
+ break;
+ if (c == '\n' && quotec == '\'')
+ break;
+ }
}
break;
}
@@ -8795,7 +8795,7 @@ my_strerror (errnum)
#else
result = strerror (errnum);
#endif
-#else /* VMS */
+#else /* VMS */
/* VAXCRTL's strerror() takes an optional second argument, which only
matters when the first argument is EVMSERR. However, it's simplest
just to pass it unconditionally. `vaxc$errno' is declared in
@@ -9096,10 +9096,10 @@ print_containing_files ()
if (instack[i].fname != NULL) {
ip = &instack[i];
if (first) {
- first = 0;
- fprintf (stderr, "In file included");
+ first = 0;
+ fprintf (stderr, "In file included");
} else {
- fprintf (stderr, ",\n ");
+ fprintf (stderr, ",\n ");
}
fprintf (stderr, " from %s:%d", ip->nominal_fname, ip->lineno);
@@ -9363,7 +9363,7 @@ dump_single_macro (hp, of)
for (i = 0; i < defn->nargs; i++) {
dump_arg_n (defn, i, of);
if (i + 1 < defn->nargs)
- fprintf (of, ", ");
+ fprintf (of, ", ");
}
fprintf (of, ")");
}
@@ -9377,35 +9377,35 @@ dump_single_macro (hp, of)
offset += ap->nchars;
if (!traditional) {
if (ap->nchars != 0)
- concat = 0;
+ concat = 0;
if (ap->stringify) {
- switch (ap->stringify) {
- case SHARP_TOKEN: fprintf (of, "#"); break;
- case WHITE_SHARP_TOKEN: fprintf (of, "# "); break;
- case PERCENT_COLON_TOKEN: fprintf (of, "%%:"); break;
- case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%: "); break;
- default: abort ();
- }
+ switch (ap->stringify) {
+ case SHARP_TOKEN: fprintf (of, "#"); break;
+ case WHITE_SHARP_TOKEN: fprintf (of, "# "); break;
+ case PERCENT_COLON_TOKEN: fprintf (of, "%%:"); break;
+ case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%: "); break;
+ default: abort ();
+ }
}
if (ap->raw_before != 0) {
- if (concat) {
- switch (ap->raw_before) {
- case WHITE_SHARP_TOKEN:
- case WHITE_PERCENT_COLON_TOKEN:
- fprintf (of, " ");
- break;
- default:
- break;
- }
- } else {
- switch (ap->raw_before) {
- case SHARP_TOKEN: fprintf (of, "##"); break;
- case WHITE_SHARP_TOKEN: fprintf (of, "## "); break;
- case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break;
- case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%:%%: "); break;
- default: abort ();
- }
- }
+ if (concat) {
+ switch (ap->raw_before) {
+ case WHITE_SHARP_TOKEN:
+ case WHITE_PERCENT_COLON_TOKEN:
+ fprintf (of, " ");
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch (ap->raw_before) {
+ case SHARP_TOKEN: fprintf (of, "##"); break;
+ case WHITE_SHARP_TOKEN: fprintf (of, "## "); break;
+ case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break;
+ case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%:%%: "); break;
+ default: abort ();
+ }
+ }
}
concat = 0;
}
@@ -9437,7 +9437,7 @@ dump_all_macros ()
for (hp = hashtab[bucket]; hp; hp= hp->next) {
if (hp->type == T_MACRO)
- dump_single_macro (hp, stdout);
+ dump_single_macro (hp, stdout);
}
}
}
@@ -9463,14 +9463,14 @@ dump_defn_1 (base, start, length, of)
else {
while (p < limit) {
if (*p == '\"' || *p =='\'') {
- U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR,
- NULL_PTR, NULL_PTR);
- fwrite (p, sizeof (*p), p1 - p, of);
- p = p1;
+ U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR,
+ NULL_PTR, NULL_PTR);
+ fwrite (p, sizeof (*p), p1 - p, of);
+ p = p1;
} else {
- if (*p != '\n')
- putc (*p, of);
- p++;
+ if (*p != '\n')
+ putc (*p, of);
+ p++;
}
}
}
@@ -9565,11 +9565,11 @@ initialize_builtins (inp, outp)
#endif
install ((U_CHAR *) "__WCHAR_TYPE__", -1, T_WCHAR_TYPE, NULL_PTR, -1);
install ((U_CHAR *) "__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE,
- NULL_PTR, -1);
+ NULL_PTR, -1);
install ((U_CHAR *) "__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE,
- NULL_PTR, -1);
+ NULL_PTR, -1);
install ((U_CHAR *) "__IMMEDIATE_PREFIX__", -1, T_IMMEDIATE_PREFIX_TYPE,
- NULL_PTR, -1);
+ NULL_PTR, -1);
install ((U_CHAR *) "__TIME__", -1, T_TIME, NULL_PTR, -1);
if (!traditional) {
install ((U_CHAR *) "__STDC__", -1, T_CONST, "1", -1);
@@ -9590,62 +9590,62 @@ initialize_builtins (inp, outp)
struct tm *timebuf = timestamp ();
sprintf (directive, " __BASE_FILE__ \"%s\"\n",
- instack[0].nominal_fname);
+ instack[0].nominal_fname);
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
+ outp, dp);
sprintf (directive, " __VERSION__ \"%s\"\n", version_string);
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
+ outp, dp);
#ifndef NO_BUILTIN_SIZE_TYPE
sprintf (directive, " __SIZE_TYPE__ %s\n", SIZE_TYPE);
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
+ outp, dp);
#endif
#ifndef NO_BUILTIN_PTRDIFF_TYPE
sprintf (directive, " __PTRDIFF_TYPE__ %s\n", PTRDIFF_TYPE);
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
+ outp, dp);
#endif
sprintf (directive, " __WCHAR_TYPE__ %s\n", wchar_type);
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
+ outp, dp);
sprintf (directive, " __DATE__ \"%s %2d %4d\"\n",
- monthnames[timebuf->tm_mon],
- timebuf->tm_mday, timebuf->tm_year + 1900);
+ monthnames[timebuf->tm_mon],
+ timebuf->tm_mday, timebuf->tm_year + 1900);
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
+ outp, dp);
sprintf (directive, " __TIME__ \"%02d:%02d:%02d\"\n",
- timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec);
+ timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec);
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
+ outp, dp);
if (!traditional)
- {
+ {
sprintf (directive, " __STDC__ 1");
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
- }
+ outp, dp);
+ }
if (objc)
- {
+ {
sprintf (directive, " __OBJC__ 1");
output_line_directive (inp, outp, 0, same_file);
pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
- }
+ outp, dp);
+ }
}
}
@@ -9676,7 +9676,7 @@ make_definition (str, op)
while (is_idchar[*++p] || *p == ',' || is_hor_space[*p])
;
if (*p++ != ')')
- p = (U_CHAR *) str; /* Error */
+ p = (U_CHAR *) str; /* Error */
}
if (*p == 0) {
buf = (U_CHAR *) alloca (p - buf + 4);
@@ -9697,24 +9697,24 @@ make_definition (str, op)
q = &buf[p - (U_CHAR *) str];
while (*p) {
if (*p == '\"' || *p == '\'') {
- int unterminated = 0;
- U_CHAR *p1 = skip_quoted_string (p, p + strlen ((char *) p), 0,
- NULL_PTR, NULL_PTR, &unterminated);
- if (unterminated)
- return;
- while (p != p1)
- *q++ = *p++;
+ int unterminated = 0;
+ U_CHAR *p1 = skip_quoted_string (p, p + strlen ((char *) p), 0,
+ NULL_PTR, NULL_PTR, &unterminated);
+ if (unterminated)
+ return;
+ while (p != p1)
+ *q++ = *p++;
} else if (*p == '\\' && p[1] == '\n')
- p += 2;
+ p += 2;
/* Change newline chars into newline-markers. */
else if (*p == '\n')
- {
- *q++ = '\n';
- *q++ = '\n';
- p++;
- }
+ {
+ *q++ = '\n';
+ *q++ = '\n';
+ p++;
+ }
else
- *q++ = *p++;
+ *q++ = *p++;
}
*q = 0;
}
@@ -9856,8 +9856,8 @@ new_include_prefix (prev_file_name, component, prefix, name)
{
struct file_name_list *dir
= ((struct file_name_list *)
- xmalloc (sizeof (struct file_name_list)
- + strlen (prefix) + strlen (name) + 2));
+ xmalloc (sizeof (struct file_name_list)
+ + strlen (prefix) + strlen (name) + 2));
size_t len;
strcpy (dir->fname, prefix);
strcat (dir->fname, name);
@@ -9866,9 +9866,9 @@ new_include_prefix (prev_file_name, component, prefix, name)
/* Convert directory name to a prefix. */
if (dir->fname[len - 1] != DIR_SEPARATOR) {
if (len == 1 && dir->fname[len - 1] == '.')
- len = 0;
+ len = 0;
else
- dir->fname[len++] = DIR_SEPARATOR;
+ dir->fname[len++] = DIR_SEPARATOR;
dir->fname[len] = 0;
}
@@ -9876,7 +9876,7 @@ new_include_prefix (prev_file_name, component, prefix, name)
if (prev_file_name && !strcmp (prev_file_name->fname, dir->fname)) {
/* But treat `-Idir -I- -Idir' as `-I- -Idir'. */
if (!first_bracket_include)
- first_bracket_include = prev_file_name;
+ first_bracket_include = prev_file_name;
free (dir);
return 0;
}
@@ -9888,14 +9888,14 @@ new_include_prefix (prev_file_name, component, prefix, name)
of systems that can stat directories. We remove it below. */
if (len != 0)
{
- dir->fname[len] = '.';
- dir->fname[len + 1] = 0;
+ dir->fname[len] = '.';
+ dir->fname[len + 1] = 0;
}
/* Ignore a nonexistent directory. */
if (stat (len ? dir->fname : ".", &dir->st) != 0) {
if (errno != ENOENT && errno != ENOTDIR)
- error_from_errno (dir->fname);
+ error_from_errno (dir->fname);
free (dir);
return 0;
}
@@ -9905,11 +9905,11 @@ new_include_prefix (prev_file_name, component, prefix, name)
/* Ignore a directory whose identity matches the previous one. */
if (prev_file_name
- && INO_T_EQ (prev_file_name->st.st_ino, dir->st.st_ino)
- && prev_file_name->st.st_dev == dir->st.st_dev) {
+ && INO_T_EQ (prev_file_name->st.st_ino, dir->st.st_ino)
+ && prev_file_name->st.st_dev == dir->st.st_dev) {
/* But treat `-Idir -I- -Idir' as `-I- -Idir'. */
if (!first_bracket_include)
- first_bracket_include = prev_file_name;
+ first_bracket_include = prev_file_name;
free (dir);
return 0;
}
@@ -9969,50 +9969,50 @@ quote_string_for_make (dst, src)
{
char c = *p++;
switch (c)
- {
- case '\0':
- case ' ':
- case '\t':
- {
- /* GNU make uses a weird quoting scheme for white space.
- A space or tab preceded by 2N+1 backslashes represents
- N backslashes followed by space; a space or tab
- preceded by 2N backslashes represents N backslashes at
- the end of a file name; and backslashes in other
- contexts should not be doubled. */
- char *q;
- for (q = p - 1; src < q && q[-1] == '\\'; q--)
- {
- if (dst)
- dst[i] = '\\';
- i++;
- }
- }
- if (!c)
- return i;
- if (dst)
- dst[i] = '\\';
- i++;
- goto ordinary_char;
-
- case '$':
- if (dst)
- dst[i] = c;
- i++;
- /* Fall through. This can mishandle things like "$(" but
- there's no easy fix. */
- default:
- ordinary_char:
- /* This can mishandle characters in the string "\0\n%*?[\\~";
- exactly which chars are mishandled depends on the `make' version.
- We know of no portable solution for this;
- even GNU make 3.76.1 doesn't solve the problem entirely.
- (Also, '\0' is mishandled due to our calling conventions.) */
- if (dst)
- dst[i] = c;
- i++;
- break;
- }
+ {
+ case '\0':
+ case ' ':
+ case '\t':
+ {
+ /* GNU make uses a weird quoting scheme for white space.
+ A space or tab preceded by 2N+1 backslashes represents
+ N backslashes followed by space; a space or tab
+ preceded by 2N backslashes represents N backslashes at
+ the end of a file name; and backslashes in other
+ contexts should not be doubled. */
+ char *q;
+ for (q = p - 1; src < q && q[-1] == '\\'; q--)
+ {
+ if (dst)
+ dst[i] = '\\';
+ i++;
+ }
+ }
+ if (!c)
+ return i;
+ if (dst)
+ dst[i] = '\\';
+ i++;
+ goto ordinary_char;
+
+ case '$':
+ if (dst)
+ dst[i] = c;
+ i++;
+ /* Fall through. This can mishandle things like "$(" but
+ there's no easy fix. */
+ default:
+ ordinary_char:
+ /* This can mishandle characters in the string "\0\n%*?[\\~";
+ exactly which chars are mishandled depends on the `make' version.
+ We know of no portable solution for this;
+ even GNU make 3.76.1 doesn't solve the problem entirely.
+ (Also, '\0' is mishandled due to our calling conventions.) */
+ if (dst)
+ dst[i] = c;
+ i++;
+ break;
+ }
}
}
@@ -10190,7 +10190,7 @@ hack_vms_include_specification (fname, vaxc_include)
if (vaxc_include && !index (cp,'.'))
strcat (cp, ".h");
- cp2 = Local; /* initialize */
+ cp2 = Local; /* initialize */
/* We are trying to do a number of things here. First of all, we are
trying to hammer the filenames into a standard format, such that later
@@ -10204,8 +10204,8 @@ hack_vms_include_specification (fname, vaxc_include)
a device name (or a rooted logical). */
/* See if we found that 1st slash */
- if (cp == 0) return; /* Nothing to do!!! */
- if (*cp != '/') return; /* Nothing to do!!! */
+ if (cp == 0) return; /* Nothing to do!!! */
+ if (*cp != '/') return; /* Nothing to do!!! */
/* Point to the UNIX filename part (which needs to be fixed!) */
cp1 = cp+1;
/* If the directory spec is not rooted, we can just copy
@@ -10218,8 +10218,8 @@ hack_vms_include_specification (fname, vaxc_include)
* usual way. Given the default locations for include files in cccp.c,
* we will only use this code if the user specifies alternate locations
* with the /include (-I) switch on the command line. */
- cp -= 1; /* Strip "]" */
- cp1--; /* backspace */
+ cp -= 1; /* Strip "]" */
+ cp1--; /* backspace */
} else {
/*
* The VMS part has a ".]" at the end, and this will not do. Later
@@ -10229,8 +10229,8 @@ hack_vms_include_specification (fname, vaxc_include)
* generation of the 000000 root directory spec (which does not belong here
* in this case).
*/
- cp -= 2; /* Strip ".]" */
- cp1--; }; /* backspace */
+ cp -= 2; /* Strip ".]" */
+ cp1--; }; /* backspace */
} else {
/* We drop in here if there is no VMS style directory specification yet.
@@ -10242,7 +10242,7 @@ hack_vms_include_specification (fname, vaxc_include)
* processing will fill this in, and close the bracket.
*/
if (cp[-1] != ':') *cp2++ = ':'; /* dev not in spec. take first dir */
- *cp2++ = '['; /* Open the directory specification */
+ *cp2++ = '['; /* Open the directory specification */
}
/* at this point we assume that we have the device spec, and (at least
@@ -10262,25 +10262,25 @@ hack_vms_include_specification (fname, vaxc_include)
while (index (cp1, '/') != 0) {
/* If this token is "." we can ignore it */
if ((cp1[0] == '.') && (cp1[1] == '/')) {
- cp1 += 2;
- continue;
+ cp1 += 2;
+ continue;
}
/* Add a subdirectory spec. Do not duplicate "." */
if (cp2[-1] != '.' && cp2[-1] != '[' && cp2[-1] != '<')
- *cp2++ = '.';
+ *cp2++ = '.';
/* If this is ".." then the spec becomes "-" */
if ((cp1[0] == '.') && (cp1[1] == '.') && (cp[2] == '/')) {
- /* Add "-" and skip the ".." */
- *cp2++ = '-';
- cp1 += 3;
- continue;
+ /* Add "-" and skip the ".." */
+ *cp2++ = '-';
+ cp1 += 3;
+ continue;
}
/* Copy the subdirectory */
while (*cp1 != '/') *cp2++= *cp1++;
- cp1++; /* Skip the "/" */
+ cp1++; /* Skip the "/" */
}
/* Close the directory specification */
- if (cp2[-1] == '.') /* no trailing periods */
+ if (cp2[-1] == '.') /* no trailing periods */
cp2--;
*cp2++ = ']';
}
@@ -10306,13 +10306,13 @@ hack_vms_include_specification (fname, vaxc_include)
and return it. */
cp = index (fname, '[');
cp2 = index (fname, ']') + 1;
- strcpy (cp, cp2); /* this gets rid of it */
+ strcpy (cp, cp2); /* this gets rid of it */
}
return;
}
-#endif /* VMS */
+#endif /* VMS */
-#ifdef VMS
+#ifdef VMS
/* The following wrapper functions supply additional arguments to the VMS
I/O routines to optimize performance with file handling. The arguments
@@ -10328,10 +10328,10 @@ VMS_freopen (fname, type, oldfile)
char *type;
FILE *oldfile;
{
-#undef freopen /* Get back the real freopen routine. */
+#undef freopen /* Get back the real freopen routine. */
if (strcmp (type, "w") == 0)
return freopen (fname, type, oldfile,
- "mbc=16", "deq=64", "fop=tef", "shr=nil");
+ "mbc=16", "deq=64", "fop=tef", "shr=nil");
return freopen (fname, type, oldfile, "mbc=16");
}
@@ -10340,7 +10340,7 @@ VMS_fopen (fname, type)
char *fname;
char *type;
{
-#undef fopen /* Get back the real fopen routine. */
+#undef fopen /* Get back the real fopen routine. */
/* The gcc-vms-1.42 distribution's header files prototype fopen with two
fixed arguments, which matches ANSI's specification but not VAXCRTL's
pre-ANSI implementation. This hack circumvents the mismatch problem. */
@@ -10348,7 +10348,7 @@ VMS_fopen (fname, type)
if (*type == 'w')
return (*vmslib_fopen) (fname, type, "mbc=32",
- "deq=64", "fop=tef", "shr=nil");
+ "deq=64", "fop=tef", "shr=nil");
else
return (*vmslib_fopen) (fname, type, "mbc=32");
}
@@ -10359,7 +10359,7 @@ VMS_open (fname, flags, prot)
int flags;
int prot;
{
-#undef open /* Get back the real open routine. */
+#undef open /* Get back the real open routine. */
return open (fname, flags, prot, "mbc=16", "deq=64", "fop=tef");
}
@@ -10381,7 +10381,7 @@ extern unsigned long sys$parse(), sys$search();
bad enough, but then compounding the problem by reporting the reason for
failure as "normal successful completion." */
-#undef fstat /* Get back to the library version. */
+#undef fstat /* Get back to the library version. */
static int
VMS_fstat (fd, statbuf)
@@ -10396,7 +10396,7 @@ VMS_fstat (fd, statbuf)
char nambuf[NAM$C_MAXRSS+1];
if ((fp = fdopen (fd, "r")) != 0 && fgetname (fp, nambuf) != 0)
- result = VMS_stat (nambuf, statbuf);
+ result = VMS_stat (nambuf, statbuf);
/* No fclose(fp) here; that would close(fd) as well. */
}
@@ -10415,7 +10415,7 @@ VMS_stat (name, statbuf)
struct FAB fab;
struct NAM nam;
char exp_nam[NAM$C_MAXRSS+1], /* expanded name buffer for sys$parse */
- res_nam[NAM$C_MAXRSS+1]; /* resultant name buffer for sys$search */
+ res_nam[NAM$C_MAXRSS+1]; /* resultant name buffer for sys$search */
fab = cc$rms_fab;
fab.fab$l_fna = (char *) name;
@@ -10426,17 +10426,17 @@ VMS_stat (name, statbuf)
nam.nam$l_rsa = res_nam, nam.nam$b_rss = sizeof res_nam - 1;
nam.nam$b_nop = NAM$M_PWD | NAM$M_NOCONCEAL;
if (sys$parse (&fab) & 1)
- {
- if (sys$search (&fab) & 1)
- {
- res_nam[nam.nam$b_rsl] = '\0';
- result = stat (res_nam, statbuf);
- }
- /* Clean up searchlist context cached by the system. */
- nam.nam$b_nop = NAM$M_SYNCHK;
- fab.fab$l_fna = 0, fab.fab$b_fns = 0;
- (void) sys$parse (&fab);
- }
+ {
+ if (sys$search (&fab) & 1)
+ {
+ res_nam[nam.nam$b_rsl] = '\0';
+ result = stat (res_nam, statbuf);
+ }
+ /* Clean up searchlist context cached by the system. */
+ nam.nam$b_nop = NAM$M_SYNCHK;
+ fab.fab$l_fna = 0, fab.fab$b_fns = 0;
+ (void) sys$parse (&fab);
+ }
}
return result;
diff --git a/cpp/src/icecpp/gansidecl.h b/cpp/src/icecpp/gansidecl.h
index ad4b66403ba..770386f84a6 100644
--- a/cpp/src/icecpp/gansidecl.h
+++ b/cpp/src/icecpp/gansidecl.h
@@ -22,8 +22,8 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
in binutils and gdb releases.
??? Over time the two should be merged into one. */
-#ifndef ANSIDECL_H
-#define ANSIDECL_H
+#ifndef ANSIDECL_H
+#define ANSIDECL_H
/* Add prototype support. */
#ifndef PROTO
@@ -36,11 +36,11 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef VPROTO
#ifdef __STDC__
-#define PVPROTO(ARGS) ARGS
+#define PVPROTO(ARGS) ARGS
#define VPROTO(ARGS) ARGS
#define VA_START(va_list,var) va_start(va_list,var)
#else
-#define PVPROTO(ARGS) ()
+#define PVPROTO(ARGS) ()
#define VPROTO(ARGS) (va_alist) va_dcl
#define VA_START(va_list,var) va_start(va_list)
#endif
@@ -66,11 +66,11 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef __STDC__
-#define PTR void *
+#define PTR void *
#else
-#define PTR char *
+#define PTR char *
#ifndef const
#define const
#endif
diff --git a/cpp/src/icecpp/pcp.h b/cpp/src/icecpp/pcp.h
index 2bced48066b..fabd88dbe7c 100644
--- a/cpp/src/icecpp/pcp.h
+++ b/cpp/src/icecpp/pcp.h
@@ -24,13 +24,13 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
typedef struct stringdef STRINGDEF;
struct stringdef
{
- U_CHAR *contents; /* String to include */
- int len; /* Its length */
- int writeflag; /* Whether we write this */
- int lineno; /* Linenumber of source file */
- U_CHAR *filename; /* Name of source file */
- STRINGDEF *chain; /* Global list of strings in natural order */
- int output_mark; /* Where in the output this goes */
+ U_CHAR *contents; /* String to include */
+ int len; /* Its length */
+ int writeflag; /* Whether we write this */
+ int lineno; /* Linenumber of source file */
+ U_CHAR *filename; /* Name of source file */
+ STRINGDEF *chain; /* Global list of strings in natural order */
+ int output_mark; /* Where in the output this goes */
};
typedef struct keydef KEYDEF;
diff --git a/cpp/src/icecpp/prefix.c b/cpp/src/icecpp/prefix.c
index bf08496cd4e..5516d376360 100644
--- a/cpp/src/icecpp/prefix.c
+++ b/cpp/src/icecpp/prefix.c
@@ -79,13 +79,13 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#include <windows.h>
#endif
-static char *get_key_value PROTO((char *));
-static char *translate_name PROTO((char *));
-static char *concat PVPROTO((char *, ...));
-static char *save_string PROTO((char *, int));
+static char *get_key_value PROTO((char *));
+static char *translate_name PROTO((char *));
+static char *concat PVPROTO((char *, ...));
+static char *save_string PROTO((char *, int));
#ifdef _WIN32
-static char *lookup_key PROTO((char *));
+static char *lookup_key PROTO((char *));
static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE;
#endif
@@ -158,7 +158,7 @@ concat VPROTO((char *first, ...))
while (arg != 0)
{
while (*arg)
- *end++ = *arg++;
+ *end++ = *arg++;
arg = va_arg (args, char *);
}
*end = '\000';
@@ -197,11 +197,11 @@ lookup_key (key)
if (reg_key == (HKEY) INVALID_HANDLE_VALUE)
{
res = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE", 0,
- KEY_READ, &reg_key);
+ KEY_READ, &reg_key);
if (res == ERROR_SUCCESS)
- res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0,
- KEY_READ, &reg_key);
+ res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0,
+ KEY_READ, &reg_key);
if (res != ERROR_SUCCESS)
{
@@ -247,9 +247,9 @@ translate_name (name)
for (keylen = 0;
(name[keylen + 1] != 0 && name[keylen + 1] != '/'
#ifdef DIR_SEPARATOR
- && name[keylen + 1] != DIR_SEPARATOR
+ && name[keylen + 1] != DIR_SEPARATOR
#endif
- );
+ );
keylen++)
;
@@ -291,12 +291,12 @@ update_path (path, key)
if (! strncmp (path, PREFIX, strlen (PREFIX)) && key != 0)
{
if (key[0] != '$')
- key = concat ("@", key, NULL_PTR);
+ key = concat ("@", key, NULL_PTR);
path = concat (key, &path[strlen (PREFIX)], NULL_PTR);
while (path[0] == '@' || path[0] == '$')
- path = translate_name (path);
+ path = translate_name (path);
}
#ifdef DIR_SEPARATOR
@@ -307,8 +307,8 @@ update_path (path, key)
path = save_string (path, len);
for (i = 0; i < len; i++)
- if (path[i] == '/')
- path[i] = DIR_SEPARATOR;
+ if (path[i] == '/')
+ path[i] = DIR_SEPARATOR;
}
#endif
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 654838c5217..0f376838af2 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -27,15 +27,15 @@ getDeprecateSymbol(const ContainedPtr& p1, const ContainedPtr& p2)
if(p1->findMetaData("deprecate", deprecateMetadata) ||
(p2 != 0 && p2->findMetaData("deprecate", deprecateMetadata)))
{
- deprecateSymbol = "ICE_DEPRECATED_API ";
+ deprecateSymbol = "ICE_DEPRECATED_API ";
}
return deprecateSymbol;
}
-Slice::Gen::Gen(const string& name, const string& base, const string& headerExtension,
- const string& sourceExtension, const vector<string>& extraHeaders, const string& include,
- const vector<string>& includePaths, const string& dllExport, const string& dir,
- bool imp, bool checksum, bool stream, bool ice) :
+Slice::Gen::Gen(const string& name, const string& base, const string& headerExtension,
+ const string& sourceExtension, const vector<string>& extraHeaders, const string& include,
+ const vector<string>& includePaths, const string& dllExport, const string& dir,
+ bool imp, bool checksum, bool stream, bool ice) :
_base(base),
_headerExtension(headerExtension),
_sourceExtension(sourceExtension),
@@ -50,16 +50,16 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
{
for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
- if(p->length() && (*p)[p->length() - 1] != '/')
- {
- *p += '/';
- }
+ if(p->length() && (*p)[p->length() - 1] != '/')
+ {
+ *p += '/';
+ }
}
string::size_type pos = _base.find_last_of("/\\");
if(pos != string::npos)
{
- _base.erase(0, pos + 1);
+ _base.erase(0, pos + 1);
}
if(_impl)
@@ -113,22 +113,22 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
string fileC = _base + "." + _sourceExtension;
if(!dir.empty())
{
- fileH = dir + '/' + fileH;
- fileC = dir + '/' + fileC;
+ fileH = dir + '/' + fileH;
+ fileC = dir + '/' + fileC;
}
H.open(fileH.c_str());
if(!H)
{
- cerr << name << ": can't open `" << fileH << "' for writing" << endl;
- return;
+ cerr << name << ": can't open `" << fileH << "' for writing" << endl;
+ return;
}
C.open(fileC.c_str());
if(!C)
{
- cerr << name << ": can't open `" << fileC << "' for writing" << endl;
- return;
+ cerr << name << ": can't open `" << fileC << "' for writing" << endl;
+ return;
}
printHeader(H);
@@ -139,7 +139,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
string s = fileH;
if(_include.size())
{
- s = _include + '/' + s;
+ s = _include + '/' + s;
}
transform(s.begin(), s.end(), s.begin(), ToIfdef());
H << "\n#ifndef __" << s << "__";
@@ -183,7 +183,7 @@ Slice::Gen::generate(const UnitPtr& p)
C << "\n#include <";
if(_include.size())
{
- C << _include << '/';
+ C << _include << '/';
}
C << _base << "." << _headerExtension << ">";
@@ -195,57 +195,57 @@ Slice::Gen::generate(const UnitPtr& p)
if(p->usesProxies())
{
- H << "\n#include <Ice/Proxy.h>";
+ H << "\n#include <Ice/Proxy.h>";
}
if(p->hasNonLocalClassDefs())
{
- H << "\n#include <Ice/Object.h>";
- H << "\n#include <Ice/Outgoing.h>";
- if(p->hasContentsWithMetaData("ami"))
- {
- H << "\n#include <Ice/OutgoingAsync.h>";
- }
- H << "\n#include <Ice/Incoming.h>";
- if(p->hasContentsWithMetaData("amd"))
- {
- H << "\n#include <Ice/IncomingAsync.h>";
- }
- H << "\n#include <Ice/Direct.h>";
+ H << "\n#include <Ice/Object.h>";
+ H << "\n#include <Ice/Outgoing.h>";
+ if(p->hasContentsWithMetaData("ami"))
+ {
+ H << "\n#include <Ice/OutgoingAsync.h>";
+ }
+ H << "\n#include <Ice/Incoming.h>";
+ if(p->hasContentsWithMetaData("amd"))
+ {
+ H << "\n#include <Ice/IncomingAsync.h>";
+ }
+ H << "\n#include <Ice/Direct.h>";
- C << "\n#include <Ice/LocalException.h>";
- C << "\n#include <Ice/ObjectFactory.h>";
+ C << "\n#include <Ice/LocalException.h>";
+ C << "\n#include <Ice/ObjectFactory.h>";
}
if(p->hasNonLocalExceptions())
{
- H << "\n#include <Ice/UserExceptionFactory.h>";
+ H << "\n#include <Ice/UserExceptionFactory.h>";
}
if(p->hasDataOnlyClasses() || p->hasNonLocalExceptions())
{
- H << "\n#include <Ice/FactoryTable.h>";
+ H << "\n#include <Ice/FactoryTable.h>";
}
if(p->usesNonLocals())
{
- C << "\n#include <Ice/BasicStream.h>";
- C << "\n#include <Ice/Object.h>";
+ C << "\n#include <Ice/BasicStream.h>";
+ C << "\n#include <Ice/Object.h>";
}
if(_stream || p->hasNonLocalClassDefs() || p->hasNonLocalExceptions())
{
- H << "\n#include <Ice/StreamF.h>";
+ H << "\n#include <Ice/StreamF.h>";
- if(!p->hasNonLocalClassDefs())
- {
- C << "\n#include <Ice/LocalException.h>";
- }
+ if(!p->hasNonLocalClassDefs())
+ {
+ C << "\n#include <Ice/LocalException.h>";
+ }
- if(_stream)
- {
- C << "\n#include <Ice/Stream.h>";
- }
+ if(_stream)
+ {
+ C << "\n#include <Ice/Stream.h>";
+ }
}
if(_checksum)
@@ -260,7 +260,7 @@ Slice::Gen::generate(const UnitPtr& p)
for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
{
- H << "\n#include <" << changeInclude(*q, _includePaths) << "." << _headerExtension << ">";
+ H << "\n#include <" << changeInclude(*q, _includePaths) << "." << _headerExtension << ">";
}
H << "\n#include <Ice/UndefSysMacros.h>";
@@ -279,7 +279,7 @@ Slice::Gen::generate(const UnitPtr& p)
printDllExportStuff(H, _dllExport);
if(_dllExport.size())
{
- _dllExport += " ";
+ _dllExport += " ";
}
ProxyDeclVisitor proxyDeclVisitor(H, C, _dllExport);
@@ -327,7 +327,7 @@ Slice::Gen::generate(const UnitPtr& p)
}
implH << _base << ".h>";
- writeExtraHeaders(implC);
+ writeExtraHeaders(implC);
implC << "\n#include <";
if(_include.size())
@@ -371,29 +371,29 @@ Slice::Gen::writeExtraHeaders(IceUtil::Output& out)
{
for(vector<string>::const_iterator i = _extraHeaders.begin(); i != _extraHeaders.end(); ++i)
{
- string hdr = *i;
- string guard;
- string::size_type pos = hdr.rfind(',');
- if(pos != string::npos)
- {
- hdr = i->substr(0, pos);
- guard = i->substr(pos + 1);
- }
- if(!guard.empty())
- {
- out << "\n#ifndef " << guard;
- out << "\n#define " << guard;
- }
- out << "\n#include <";
- if(!_include.empty())
- {
- out << _include << '/';
- }
- out << hdr << '>';
- if(!guard.empty())
- {
- out << "\n#endif";
- }
+ string hdr = *i;
+ string guard;
+ string::size_type pos = hdr.rfind(',');
+ if(pos != string::npos)
+ {
+ hdr = i->substr(0, pos);
+ guard = i->substr(pos + 1);
+ }
+ if(!guard.empty())
+ {
+ out << "\n#ifndef " << guard;
+ out << "\n#define " << guard;
+ }
+ out << "\n#include <";
+ if(!_include.empty())
+ {
+ out << _include << '/';
+ }
+ out << hdr << '>';
+ if(!guard.empty())
+ {
+ out << "\n#endif";
+ }
}
}
@@ -418,10 +418,10 @@ Slice::Gen::GlobalIncludeVisitor::visitModuleStart(const ModulePtr& p)
string s = *q;
if(s.find(includePrefix) == 0)
{
- H << nl << "#include <" << s.substr(includePrefix.size()) << ">";
+ H << nl << "#include <" << s.substr(includePrefix.size()) << ">";
}
}
- _finished = true;
+ _finished = true;
}
return false;
@@ -457,32 +457,32 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(!p->isLocal())
{
- string name = fixKwd(p->name());
- string scope = fixKwd(p->scope());
-
- C << sp << nl << "void";
- C << nl << scope.substr(2) << "__addObject(const " << name << "Ptr& p, ::IceInternal::GCCountMap& c)";
- C << sb;
- C << nl << "p->__addObject(c);";
- C << eb;
-
- C << sp << nl << "bool";
- C << nl << scope.substr(2) << "__usesClasses(const " << name << "Ptr& p)";
- C << sb;
- C << nl << "return p->__usesClasses();";
- C << eb;
-
- C << sp << nl << "void";
- C << nl << scope.substr(2) << "__decRefUnsafe(const " << name << "Ptr& p)";
- C << sb;
- C << nl << "p->__decRefUnsafe();";
- C << eb;
-
- C << sp << nl << "void";
- C << nl << scope.substr(2) << "__clearHandleUnsafe(" << name << "Ptr& p)";
- C << sb;
- C << nl << "p.__clearHandleUnsafe();";
- C << eb;
+ string name = fixKwd(p->name());
+ string scope = fixKwd(p->scope());
+
+ C << sp << nl << "void";
+ C << nl << scope.substr(2) << "__addObject(const " << name << "Ptr& p, ::IceInternal::GCCountMap& c)";
+ C << sb;
+ C << nl << "p->__addObject(c);";
+ C << eb;
+
+ C << sp << nl << "bool";
+ C << nl << scope.substr(2) << "__usesClasses(const " << name << "Ptr& p)";
+ C << sb;
+ C << nl << "return p->__usesClasses();";
+ C << eb;
+
+ C << sp << nl << "void";
+ C << nl << scope.substr(2) << "__decRefUnsafe(const " << name << "Ptr& p)";
+ C << sb;
+ C << nl << "p->__decRefUnsafe();";
+ C << eb;
+
+ C << sp << nl << "void";
+ C << nl << scope.substr(2) << "__clearHandleUnsafe(" << name << "Ptr& p)";
+ C << sb;
+ C << nl << "p.__clearHandleUnsafe();";
+ C << eb;
}
return false;
}
@@ -507,23 +507,23 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- params.push_back(fixKwd((*q)->name()));
+ params.push_back(fixKwd((*q)->name()));
}
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
- allTypes.push_back(typeName);
- allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
+ string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
+ allTypes.push_back(typeName);
+ allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
}
if(base)
{
- DataMemberList baseDataMembers = base->allDataMembers();
- for(q = baseDataMembers.begin(); q != baseDataMembers.end(); ++q)
- {
- baseParams.push_back("__ice_" + (*q)->name());
- }
+ DataMemberList baseDataMembers = base->allDataMembers();
+ for(q = baseDataMembers.begin(); q != baseDataMembers.end(); ++q)
+ {
+ baseParams.push_back("__ice_" + (*q)->name());
+ }
}
H << sp << nl << "class " << _dllExport << name << " : ";
@@ -531,11 +531,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << "public ";
if(!base)
{
- H << (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException");
+ H << (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException");
}
else
{
- H << fixKwd(base->scoped());
+ H << fixKwd(base->scoped());
}
H.restoreIndent();
H << sb;
@@ -547,96 +547,96 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << sp << nl << name << spar;
if(p->isLocal())
{
- H << "const char*" << "int";
+ H << "const char*" << "int";
}
H << epar;
if(!p->isLocal())
{
- H << " {}";
+ H << " {}";
}
else
{
- H << ';';
+ H << ';';
}
if(!allTypes.empty())
{
- H << nl;
- if(!p->isLocal() && allTypes.size() == 1)
- {
- H << "explicit ";
- }
- H << name << spar;
- if(p->isLocal())
- {
- H << "const char*" << "int";
- }
- H << allTypes << epar << ';';
+ H << nl;
+ if(!p->isLocal() && allTypes.size() == 1)
+ {
+ H << "explicit ";
+ }
+ H << name << spar;
+ if(p->isLocal())
+ {
+ H << "const char*" << "int";
+ }
+ H << allTypes << epar << ';';
}
H << nl << "virtual ~" << name << "() throw();";
H << sp;
if(p->isLocal())
{
- C << sp << nl << scoped.substr(2) << "::" << name << spar << "const char* __file" << "int __line" << epar
- << " :";
- C.inc();
- emitUpcall(base, "(__file, __line)", true);
- C.dec();
- C << sb;
- C << eb;
+ C << sp << nl << scoped.substr(2) << "::" << name << spar << "const char* __file" << "int __line" << epar
+ << " :";
+ C.inc();
+ emitUpcall(base, "(__file, __line)", true);
+ C.dec();
+ C << sb;
+ C << eb;
}
if(!allTypes.empty())
{
- C << sp << nl;
- C << scoped.substr(2) << "::" << name << spar;
- if(p->isLocal())
- {
- C << "const char* __file" << "int __line";
- }
- C << allParamDecls << epar;
- if(p->isLocal() || !baseParams.empty() || !params.empty())
- {
- C << " :";
- C.inc();
- string upcall;
- if(!allParamDecls.empty())
- {
- upcall = "(";
- if(p->isLocal())
- {
- upcall += "__file, __line";
- }
- for(pi = baseParams.begin(); pi != baseParams.end(); ++pi)
- {
- if(p->isLocal() || pi != baseParams.begin())
- {
- upcall += ", ";
- }
- upcall += *pi;
- }
- upcall += ")";
- }
- if(!params.empty())
- {
- upcall += ",";
- }
- emitUpcall(base, upcall, p->isLocal());
- }
- for(pi = params.begin(); pi != params.end(); ++pi)
- {
- if(pi != params.begin())
- {
- C << ",";
- }
- C << nl << *pi << "(__ice_" << *pi << ')';
- }
- if(p->isLocal() || !baseParams.empty() || !params.empty())
- {
- C.dec();
- }
- C << sb;
- C << eb;
+ C << sp << nl;
+ C << scoped.substr(2) << "::" << name << spar;
+ if(p->isLocal())
+ {
+ C << "const char* __file" << "int __line";
+ }
+ C << allParamDecls << epar;
+ if(p->isLocal() || !baseParams.empty() || !params.empty())
+ {
+ C << " :";
+ C.inc();
+ string upcall;
+ if(!allParamDecls.empty())
+ {
+ upcall = "(";
+ if(p->isLocal())
+ {
+ upcall += "__file, __line";
+ }
+ for(pi = baseParams.begin(); pi != baseParams.end(); ++pi)
+ {
+ if(p->isLocal() || pi != baseParams.begin())
+ {
+ upcall += ", ";
+ }
+ upcall += *pi;
+ }
+ upcall += ")";
+ }
+ if(!params.empty())
+ {
+ upcall += ",";
+ }
+ emitUpcall(base, upcall, p->isLocal());
+ }
+ for(pi = params.begin(); pi != params.end(); ++pi)
+ {
+ if(pi != params.begin())
+ {
+ C << ",";
+ }
+ C << nl << *pi << "(__ice_" << *pi << ')';
+ }
+ if(p->isLocal() || !baseParams.empty() || !params.empty())
+ {
+ C.dec();
+ }
+ C << sb;
+ C << eb;
}
C << sp << nl;
@@ -656,7 +656,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(p->isLocal())
{
- H << nl << "virtual void ice_print(::std::ostream&) const;";
+ H << nl << "virtual void ice_print(::std::ostream&) const;";
}
H << nl << "virtual ::Ice::Exception* ice_clone() const;";
@@ -673,11 +673,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(!p->isLocal())
{
- H << sp << nl << "static const ::IceInternal::UserExceptionFactoryPtr& ice_factory();";
+ H << sp << nl << "static const ::IceInternal::UserExceptionFactoryPtr& ice_factory();";
}
if(!dataMembers.empty())
{
- H << sp;
+ H << sp;
}
return true;
}
@@ -695,65 +695,65 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(!p->isLocal())
{
- ExceptionPtr base = p->base();
+ ExceptionPtr base = p->base();
- H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
- H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
+ H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
+ H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
H << sp << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
- C << nl << "__os->write(::std::string(\"" << p->scoped() << "\"), false);";
- C << nl << "__os->startWriteSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
- }
- C << nl << "__os->endWriteSlice();";
- if(base)
- {
- emitUpcall(base, "::__write(__os);");
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)";
- C << sb;
- C << nl << "if(__rid)";
- C << sb;
- C << nl << "::std::string myId;";
- C << nl << "__is->read(myId, false);";
- C << eb;
- C << nl << "__is->startReadSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
- }
- C << nl << "__is->endReadSlice();";
- if(base)
- {
- emitUpcall(base, "::__read(__is, true);");
- }
- C << eb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
+ C << sb;
+ C << nl << "__os->write(::std::string(\"" << p->scoped() << "\"), false);";
+ C << nl << "__os->startWriteSlice();";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
+ }
+ C << nl << "__os->endWriteSlice();";
+ if(base)
+ {
+ emitUpcall(base, "::__write(__os);");
+ }
+ C << eb;
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)";
+ C << sb;
+ C << nl << "if(__rid)";
+ C << sb;
+ C << nl << "::std::string myId;";
+ C << nl << "__is->read(myId, false);";
+ C << eb;
+ C << nl << "__is->startReadSlice();";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
+ }
+ C << nl << "__is->endReadSlice();";
+ if(base)
+ {
+ emitUpcall(base, "::__read(__is, true);");
+ }
+ C << eb;
if(_stream)
{
C << sp << nl << "void" << nl << scoped.substr(2)
- << "::__write(const ::Ice::OutputStreamPtr& __outS) const";
+ << "::__write(const ::Ice::OutputStreamPtr& __outS) const";
C << sb;
C << nl << "__outS->writeString(::std::string(\"" << p->scoped() << "\"));";
C << nl << "__outS->startSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring,
- (*q)->getMetaData());
- }
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring,
+ (*q)->getMetaData());
+ }
C << nl << "__outS->endSlice();";
- if(base)
- {
- emitUpcall(base, "::__write(__outS);");
- }
+ if(base)
+ {
+ emitUpcall(base, "::__write(__outS);");
+ }
C << eb;
C << sp << nl << "void" << nl << scoped.substr(2)
@@ -764,16 +764,16 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
C << nl << "__inS->readString();";
C << eb;
C << nl << "__inS->startSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring,
- (*q)->getMetaData());
- }
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring,
+ (*q)->getMetaData());
+ }
C << nl << "__inS->endSlice();";
- if(base)
- {
- emitUpcall(base, "::__read(__inS, true);");
- }
+ if(base)
+ {
+ emitUpcall(base, "::__read(__inS, true);");
+ }
C << eb;
}
else
@@ -796,76 +796,76 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
C << eb;
}
- if(p->usesClasses())
- {
- if(!base || (base && !base->usesClasses()))
- {
- H << nl << "virtual bool __usesClasses() const;";
-
- C << sp << nl << "bool";
- C << nl << scoped.substr(2) << "::__usesClasses() const";
- C << sb;
- C << nl << "return true;";
- C << eb;
- }
- }
-
- factoryName = "__F" + p->flattenedScope() + p->name();
-
- C << sp << nl << "struct " << factoryName << " : public ::IceInternal::UserExceptionFactory";
- C << sb;
- C << sp << nl << "virtual void";
- C << nl << "createAndThrow()";
- C << sb;
- C << nl << "throw " << scoped << "();";
- C << eb;
- C << eb << ';';
-
- C << sp << nl << "static ::IceInternal::UserExceptionFactoryPtr " << factoryName
- << "__Ptr = new " << factoryName << ';';
-
- C << sp << nl << "const ::IceInternal::UserExceptionFactoryPtr&";
- C << nl << scoped.substr(2) << "::ice_factory()";
- C << sb;
- C << nl << "return " << factoryName << "__Ptr;";
- C << eb;
-
- C << sp << nl << "class " << factoryName << "__Init";
- C << sb;
- C.dec();
- C << nl << "public:";
- C.inc();
- C << sp << nl << factoryName << "__Init()";
- C << sb;
- C << nl << "::IceInternal::factoryTable->addExceptionFactory(\"" << p->scoped() << "\", " << scoped
- << "::ice_factory());";
- C << eb;
- C << sp << nl << "~" << factoryName << "__Init()";
- C << sb;
- C << nl << "::IceInternal::factoryTable->removeExceptionFactory(\"" << p->scoped() << "\");";
- C << eb;
- C << eb << ';';
- C << sp << nl << "static " << factoryName << "__Init "<< factoryName << "__i;";
- C << sp << nl << "#ifdef __APPLE__";
-
- string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer";
- C << nl << "extern \"C\" { void " << initfuncname << "() {} }";
- C << nl << "#endif";
+ if(p->usesClasses())
+ {
+ if(!base || (base && !base->usesClasses()))
+ {
+ H << nl << "virtual bool __usesClasses() const;";
+
+ C << sp << nl << "bool";
+ C << nl << scoped.substr(2) << "::__usesClasses() const";
+ C << sb;
+ C << nl << "return true;";
+ C << eb;
+ }
+ }
+
+ factoryName = "__F" + p->flattenedScope() + p->name();
+
+ C << sp << nl << "struct " << factoryName << " : public ::IceInternal::UserExceptionFactory";
+ C << sb;
+ C << sp << nl << "virtual void";
+ C << nl << "createAndThrow()";
+ C << sb;
+ C << nl << "throw " << scoped << "();";
+ C << eb;
+ C << eb << ';';
+
+ C << sp << nl << "static ::IceInternal::UserExceptionFactoryPtr " << factoryName
+ << "__Ptr = new " << factoryName << ';';
+
+ C << sp << nl << "const ::IceInternal::UserExceptionFactoryPtr&";
+ C << nl << scoped.substr(2) << "::ice_factory()";
+ C << sb;
+ C << nl << "return " << factoryName << "__Ptr;";
+ C << eb;
+
+ C << sp << nl << "class " << factoryName << "__Init";
+ C << sb;
+ C.dec();
+ C << nl << "public:";
+ C.inc();
+ C << sp << nl << factoryName << "__Init()";
+ C << sb;
+ C << nl << "::IceInternal::factoryTable->addExceptionFactory(\"" << p->scoped() << "\", " << scoped
+ << "::ice_factory());";
+ C << eb;
+ C << sp << nl << "~" << factoryName << "__Init()";
+ C << sb;
+ C << nl << "::IceInternal::factoryTable->removeExceptionFactory(\"" << p->scoped() << "\");";
+ C << eb;
+ C << eb << ';';
+ C << sp << nl << "static " << factoryName << "__Init "<< factoryName << "__i;";
+ C << sp << nl << "#ifdef __APPLE__";
+
+ string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer";
+ C << nl << "extern \"C\" { void " << initfuncname << "() {} }";
+ C << nl << "#endif";
}
H << eb << ';';
if(!p->isLocal())
{
- //
- // We need an instance here to trigger initialization if the implementation is in a shared libarry.
- // But we do this only once per source file, because a single instance is sufficient to initialize
- // all of the globals in a shared library.
- //
- if(!_doneStaticSymbol)
- {
- _doneStaticSymbol = true;
- H << sp << nl << "static " << name << " __" << p->name() << "_init;";
- }
+ //
+ // We need an instance here to trigger initialization if the implementation is in a shared libarry.
+ // But we do this only once per source file, because a single instance is sufficient to initialize
+ // all of the globals in a shared library.
+ //
+ if(!_doneStaticSymbol)
+ {
+ _doneStaticSymbol = true;
+ H << sp << nl << "static " << name << " __" << p->name() << "_init;";
+ }
}
_useWstring = resetUseWstring(_useWstringHist);
@@ -880,56 +880,56 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
if(findMetaData(p->getMetaData(), false) == "class")
{
- H << sp << nl << "class " << _dllExport << name << " : public IceUtil::Shared";
- H << sb;
- H.dec();
- H << nl << "public:";
- H.inc();
- H << nl;
- H << nl << name << "() {}";
-
- DataMemberList dataMembers = p->dataMembers();
- if(!dataMembers.empty())
- {
- DataMemberList::const_iterator q;
- vector<string> paramDecls;
- vector<string> types;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
- types.push_back(typeName);
- paramDecls.push_back(typeName + " __ice_" + (*q)->name());
- }
-
- H << nl;
- if(paramDecls.size() == 1)
- {
- H << "explicit ";
- }
- H << name << spar << types << epar << ';';
-
- C << sp << nl << p->scoped().substr(2) << "::" << fixKwd(p->name()) << spar << paramDecls << epar << " :";
- C.inc();
-
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- if(q != dataMembers.begin())
- {
- C << ',' << nl;
- }
- string memberName = fixKwd((*q)->name());
- C << memberName << '(' << "__ice_" << (*q)->name() << ')';
- }
-
- C.dec();
- C << sb;
- C << eb;
- }
+ H << sp << nl << "class " << _dllExport << name << " : public IceUtil::Shared";
+ H << sb;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
+ H << nl;
+ H << nl << name << "() {}";
+
+ DataMemberList dataMembers = p->dataMembers();
+ if(!dataMembers.empty())
+ {
+ DataMemberList::const_iterator q;
+ vector<string> paramDecls;
+ vector<string> types;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
+ types.push_back(typeName);
+ paramDecls.push_back(typeName + " __ice_" + (*q)->name());
+ }
+
+ H << nl;
+ if(paramDecls.size() == 1)
+ {
+ H << "explicit ";
+ }
+ H << name << spar << types << epar << ';';
+
+ C << sp << nl << p->scoped().substr(2) << "::" << fixKwd(p->name()) << spar << paramDecls << epar << " :";
+ C.inc();
+
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ if(q != dataMembers.begin())
+ {
+ C << ',' << nl;
+ }
+ string memberName = fixKwd((*q)->name());
+ C << memberName << '(' << "__ice_" << (*q)->name() << ')';
+ }
+
+ C.dec();
+ C << sb;
+ C << eb;
+ }
}
else
{
- H << sp << nl << "struct " << name;
- H << sb;
+ H << sp << nl << "struct " << name;
+ H << sb;
}
return true;
@@ -950,13 +950,13 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- params.push_back(fixKwd((*q)->name()));
+ params.push_back(fixKwd((*q)->name()));
}
string dllExport;
if(findMetaData(p->getMetaData(), false) != "class")
{
- dllExport = _dllExport;
+ dllExport = _dllExport;
}
H << sp;
@@ -988,10 +988,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << eb;
for(pi = params.begin(); pi != params.end(); ++pi)
{
- C << nl << "if(" << *pi << " != __rhs." << *pi << ')';
- C << sb;
- C << nl << "return true;";
- C << eb;
+ C << nl << "if(" << *pi << " != __rhs." << *pi << ')';
+ C << sb;
+ C << nl << "return true;";
+ C << eb;
}
C << nl << "return false;";
C << eb;
@@ -1003,25 +1003,25 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << eb;
for(pi = params.begin(); pi != params.end(); ++pi)
{
- C << nl << "if(" << *pi << " < __rhs." << *pi << ')';
- C << sb;
- C << nl << "return true;";
- C << eb;
- C << nl << "else if(__rhs." << *pi << " < " << *pi << ')';
- C << sb;
- C << nl << "return false;";
- C << eb;
+ C << nl << "if(" << *pi << " < __rhs." << *pi << ')';
+ C << sb;
+ C << nl << "return true;";
+ C << eb;
+ C << nl << "else if(__rhs." << *pi << " < " << *pi << ')';
+ C << sb;
+ C << nl << "return false;";
+ C << eb;
}
C << nl << "return false;";
C << eb;
if(!p->isLocal())
{
- //
- // None of these member functions is virtual!
- //
- H << sp << nl << dllExport << "void __write(::IceInternal::BasicStream*) const;";
- H << nl << dllExport << "void __read(::IceInternal::BasicStream*);";
+ //
+ // None of these member functions is virtual!
+ //
+ H << sp << nl << dllExport << "void __write(::IceInternal::BasicStream*) const;";
+ H << nl << dllExport << "void __read(::IceInternal::BasicStream*);";
if(_stream)
{
@@ -1029,92 +1029,92 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
H << nl << dllExport << "void ice_read(const ::Ice::InputStreamPtr&);";
}
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
+ C << sb;
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
}
- C << eb;
+ C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
- C << sb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
+ C << sb;
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
}
- C << eb;
-
- if(_stream)
- {
- C << sp << nl << "void" << nl << scoped.substr(2)
- << "::ice_write(const ::Ice::OutputStreamPtr& __outS) const";
- C << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring,
- (*q)->getMetaData());
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::ice_read(const ::Ice::InputStreamPtr& __inS)";
- C << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring,
- (*q)->getMetaData());
- }
- C << eb;
- }
+ C << eb;
+
+ if(_stream)
+ {
+ C << sp << nl << "void" << nl << scoped.substr(2)
+ << "::ice_write(const ::Ice::OutputStreamPtr& __outS) const";
+ C << sb;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring,
+ (*q)->getMetaData());
+ }
+ C << eb;
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::ice_read(const ::Ice::InputStreamPtr& __inS)";
+ C << sb;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring,
+ (*q)->getMetaData());
+ }
+ C << eb;
+ }
}
H << eb << ';';
if(findMetaData(p->getMetaData(), false) == "class")
{
- H << sp << nl << "typedef ::IceUtil::Handle< " << scoped << "> " << name << "Ptr;";
-
- if(!p->isLocal() && _stream)
- {
- H << sp << nl << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
- << name << "Ptr&);";
- H << nl << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name
- << "Ptr&);";
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "Ptr& __v)";
- C << sb;
- C << nl << "__v->ice_write(__outS);";
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
- << "(const ::Ice::InputStreamPtr& __inS, " << scoped << "Ptr& __v)";
- C << sb;
- C << nl << "__v->ice_read(__inS);";
- C << eb;
- }
+ H << sp << nl << "typedef ::IceUtil::Handle< " << scoped << "> " << name << "Ptr;";
+
+ if(!p->isLocal() && _stream)
+ {
+ H << sp << nl << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
+ << name << "Ptr&);";
+ H << nl << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name
+ << "Ptr&);";
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
+ << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "Ptr& __v)";
+ C << sb;
+ C << nl << "__v->ice_write(__outS);";
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
+ << "(const ::Ice::InputStreamPtr& __inS, " << scoped << "Ptr& __v)";
+ C << sb;
+ C << nl << "__v->ice_read(__inS);";
+ C << eb;
+ }
}
else
{
- if(!p->isLocal() && _stream)
- {
- H << sp << nl << dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
- << name << "&);";
- H << nl << dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "& __v)";
- C << sb;
- C << nl << "__v.ice_write(__outS);";
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
- << "(const ::Ice::InputStreamPtr& __inS, " << scoped << "& __v)";
- C << sb;
- C << nl << "__v.ice_read(__inS);";
- C << eb;
- }
- }
-
+ if(!p->isLocal() && _stream)
+ {
+ H << sp << nl << dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
+ << name << "&);";
+ H << nl << dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
+ << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "& __v)";
+ C << sb;
+ C << nl << "__v.ice_write(__outS);";
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
+ << "(const ::Ice::InputStreamPtr& __inS, " << scoped << "& __v)";
+ C << sb;
+ C << nl << "__v.ice_read(__inS);";
+ C << eb;
+ }
+ }
+
_useWstring = resetUseWstring(_useWstringHist);
}
@@ -1146,10 +1146,10 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(!p->isLocal())
{
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
- H << sp << nl << "class __U__" << name << " { };";
+ H << sp << nl << "class __U__" << name << " { };";
if(!seqType.empty())
{
@@ -1162,7 +1162,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
H << nl << _dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
<< name << "&);";
H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name
- << "&);";
+ << "&);";
}
C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
@@ -1251,75 +1251,75 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
}
else if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)
{
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << s << "*, const " << s
- << "*, __U__" << name << ");";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");";
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << s << "*, const " << s
+ << "*, __U__" << name << ");";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");";
if(_stream)
{
H << nl << _dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
<< name << "&);";
H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name
- << "&);";
+ << "&);";
}
- C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << s << "* begin, const " << s << "* end, " << scope << "__U__" << name << ")";
- C << sb;
- C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(end - begin);";
- C << nl << "__os->writeSize(size);";
- C << nl << "for(int i = 0; i < size; ++i)";
- C << sb;
- writeMarshalUnmarshalCode(C, type, "begin[i]", true);
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
- << "& v, " << scope << "__U__" << name << ')';
- C << sb;
- C << nl << "::Ice::Int sz;";
- C << nl << "__is->readSize(sz);";
- if(type->isVariableLength())
- {
- // Protect against bogus sequence sizes.
- C << nl << "__is->startSeq(sz, " << type->minWireSize() << ");";
- }
- else
- {
- C << nl << "__is->checkFixedSeq(sz, " << type->minWireSize() << ");";
- }
- C << nl << "v.resize(sz);";
- C << nl << "for(int i = 0; i < sz; ++i)";
- C << sb;
- writeMarshalUnmarshalCode(C, type, "v[i]", false);
-
- //
- // After unmarshaling each element, check that there are still enough bytes left in the stream
- // to unmarshal the remainder of the sequence, and decrement the count of elements
- // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
- // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
- // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
- // (For fixed-length sequences, we don't need to do this because the prediction of how many
- // bytes will be taken up by the sequence is accurate.)
- //
- if(type->isVariableLength())
- {
- if(!SequencePtr::dynamicCast(type))
- {
- //
- // No need to check for directly nested sequences because, at the start of each
- // sequence, we check anyway.
- //
- C << nl << "__is->checkSeq();";
- }
- C << nl << "__is->endElement();";
- }
- C << eb;
- if(type->isVariableLength())
- {
- C << nl << "__is->endSeq(sz);";
- }
- C << eb;
+ C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << s << "* begin, const " << s << "* end, " << scope << "__U__" << name << ")";
+ C << sb;
+ C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(end - begin);";
+ C << nl << "__os->writeSize(size);";
+ C << nl << "for(int i = 0; i < size; ++i)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, type, "begin[i]", true);
+ C << eb;
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
+ C << sb;
+ C << nl << "::Ice::Int sz;";
+ C << nl << "__is->readSize(sz);";
+ if(type->isVariableLength())
+ {
+ // Protect against bogus sequence sizes.
+ C << nl << "__is->startSeq(sz, " << type->minWireSize() << ");";
+ }
+ else
+ {
+ C << nl << "__is->checkFixedSeq(sz, " << type->minWireSize() << ");";
+ }
+ C << nl << "v.resize(sz);";
+ C << nl << "for(int i = 0; i < sz; ++i)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, type, "v[i]", false);
+
+ //
+ // After unmarshaling each element, check that there are still enough bytes left in the stream
+ // to unmarshal the remainder of the sequence, and decrement the count of elements
+ // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
+ // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
+ // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
+ // (For fixed-length sequences, we don't need to do this because the prediction of how many
+ // bytes will be taken up by the sequence is accurate.)
+ //
+ if(type->isVariableLength())
+ {
+ if(!SequencePtr::dynamicCast(type))
+ {
+ //
+ // No need to check for directly nested sequences because, at the start of each
+ // sequence, we check anyway.
+ //
+ C << nl << "__is->checkSeq();";
+ }
+ C << nl << "__is->endElement();";
+ }
+ C << eb;
+ if(type->isVariableLength())
+ {
+ C << nl << "__is->endSeq(sz);";
+ }
+ C << eb;
if(_stream)
{
@@ -1345,7 +1345,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
C << eb;
C << eb;
}
- }
+ }
}
}
@@ -1358,83 +1358,83 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
string ks = typeToString(keyType, _useWstring, p->keyMetaData());
if(ks[0] == ':')
{
- ks.insert(0, " ");
+ ks.insert(0, " ");
}
string vs = typeToString(valueType, _useWstring, p->valueMetaData());
H << sp << nl << "typedef ::std::map<" << ks << ", " << vs << "> " << name << ';';
if(!p->isLocal())
{
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- H << sp << nl << "class __U__" << name << " { };";
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name
- << "&, __U__" << name << ");";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name
- << "&, __U__" << name << ");";
-
- if(_stream)
- {
- H << nl << _dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << name
- << "&);";
- H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
- }
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << scoped << "& v, " << scope << "__U__" << name << ")";
- C << sb;
- C << nl << "__os->writeSize(::Ice::Int(v.size()));";
- C << nl << scoped << "::const_iterator p;";
- C << nl << "for(p = v.begin(); p != v.end(); ++p)";
- C << sb;
- writeMarshalUnmarshalCode(C, keyType, "p->first", true);
- writeMarshalUnmarshalCode(C, valueType, "p->second", true);
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
- << "& v, " << scope << "__U__" << name << ')';
- C << sb;
- C << nl << "::Ice::Int sz;";
- C << nl << "__is->readSize(sz);";
- C << nl << "while(sz--)";
- C << sb;
- C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
- const string pf = string("const_cast<") + ks + "&>(pair.first)";
- writeMarshalUnmarshalCode(C, keyType, pf, false);
- C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);";
- writeMarshalUnmarshalCode(C, valueType, "__i->second", false);
- C << eb;
- C << eb;
-
- if(_stream)
- {
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "& v)";
- C << sb;
- C << nl << "__outS->writeSize(::Ice::Int(v.size()));";
- C << nl << scoped << "::const_iterator p;";
- C << nl << "for(p = v.begin(); p != v.end(); ++p)";
- C << sb;
- writeStreamMarshalUnmarshalCode(C, keyType, "p->first", true, "", _useWstring, p->keyMetaData());
- writeStreamMarshalUnmarshalCode(C, valueType, "p->second", true, "", _useWstring, p->valueMetaData());
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
- << "(const ::Ice::InputStreamPtr& __inS, " << scoped << "& v)";
- C << sb;
- C << nl << "::Ice::Int sz = __inS->readSize();";
- C << nl << "while(sz--)";
- C << sb;
- C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
- writeStreamMarshalUnmarshalCode(C, keyType, pf, false, "", _useWstring, p->keyMetaData());
- C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);";
- writeStreamMarshalUnmarshalCode(C, valueType, "__i->second", false, "", _useWstring, p->valueMetaData());
- C << eb;
- C << eb;
- }
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
+
+ H << sp << nl << "class __U__" << name << " { };";
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name
+ << "&, __U__" << name << ");";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name
+ << "&, __U__" << name << ");";
+
+ if(_stream)
+ {
+ H << nl << _dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << name
+ << "&);";
+ H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
+ }
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << scoped << "& v, " << scope << "__U__" << name << ")";
+ C << sb;
+ C << nl << "__os->writeSize(::Ice::Int(v.size()));";
+ C << nl << scoped << "::const_iterator p;";
+ C << nl << "for(p = v.begin(); p != v.end(); ++p)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, keyType, "p->first", true);
+ writeMarshalUnmarshalCode(C, valueType, "p->second", true);
+ C << eb;
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
+ C << sb;
+ C << nl << "::Ice::Int sz;";
+ C << nl << "__is->readSize(sz);";
+ C << nl << "while(sz--)";
+ C << sb;
+ C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
+ const string pf = string("const_cast<") + ks + "&>(pair.first)";
+ writeMarshalUnmarshalCode(C, keyType, pf, false);
+ C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);";
+ writeMarshalUnmarshalCode(C, valueType, "__i->second", false);
+ C << eb;
+ C << eb;
+
+ if(_stream)
+ {
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
+ << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "& v)";
+ C << sb;
+ C << nl << "__outS->writeSize(::Ice::Int(v.size()));";
+ C << nl << scoped << "::const_iterator p;";
+ C << nl << "for(p = v.begin(); p != v.end(); ++p)";
+ C << sb;
+ writeStreamMarshalUnmarshalCode(C, keyType, "p->first", true, "", _useWstring, p->keyMetaData());
+ writeStreamMarshalUnmarshalCode(C, valueType, "p->second", true, "", _useWstring, p->valueMetaData());
+ C << eb;
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
+ << "(const ::Ice::InputStreamPtr& __inS, " << scoped << "& v)";
+ C << sb;
+ C << nl << "::Ice::Int sz = __inS->readSize();";
+ C << nl << "while(sz--)";
+ C << sb;
+ C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
+ writeStreamMarshalUnmarshalCode(C, keyType, pf, false, "", _useWstring, p->keyMetaData());
+ C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);";
+ writeStreamMarshalUnmarshalCode(C, valueType, "__i->second", false, "", _useWstring, p->valueMetaData());
+ C << eb;
+ C << eb;
+ }
}
}
@@ -1448,111 +1448,111 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
EnumeratorList::const_iterator en = enumerators.begin();
while(en != enumerators.end())
{
- H << nl << fixKwd((*en)->name());
- if(++en != enumerators.end())
- {
- H << ',';
- }
+ H << nl << fixKwd((*en)->name());
+ if(++en != enumerators.end())
+ {
+ H << ',';
+ }
}
H << eb << ';';
if(!p->isLocal())
{
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- size_t sz = enumerators.size();
- assert(sz <= 0x7fffffff); // 64-bit enums are not supported
-
- H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*, " << name << ");";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&);";
-
- if(_stream)
- {
- H << sp << nl << _dllExport << "void ice_write" << p->name()
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
+
+ size_t sz = enumerators.size();
+ assert(sz <= 0x7fffffff); // 64-bit enums are not supported
+
+ H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*, " << name << ");";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&);";
+
+ if(_stream)
+ {
+ H << sp << nl << _dllExport << "void ice_write" << p->name()
<< "(const ::Ice::OutputStreamPtr&, " << name << ");";
- H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
- }
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped
- << " v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "__os->write(static_cast< ::Ice::Byte>(v));";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "__os->write(static_cast< ::Ice::Short>(v));";
- }
- else
- {
- C << nl << "__os->write(static_cast< ::Ice::Int>(v));";
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
- << "& v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "::Ice::Byte val;";
- C << nl << "__is->read(val);";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "::Ice::Short val;";
- C << nl << "__is->read(val);";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else
- {
- C << nl << "::Ice::Int val;";
- C << nl << "__is->read(val);";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- C << eb;
-
- if(_stream)
- {
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
+ H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
+ }
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped
+ << " v)";
+ C << sb;
+ if(sz <= 0x7f)
+ {
+ C << nl << "__os->write(static_cast< ::Ice::Byte>(v));";
+ }
+ else if(sz <= 0x7fff)
+ {
+ C << nl << "__os->write(static_cast< ::Ice::Short>(v));";
+ }
+ else
+ {
+ C << nl << "__os->write(static_cast< ::Ice::Int>(v));";
+ }
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
+ << "& v)";
+ C << sb;
+ if(sz <= 0x7f)
+ {
+ C << nl << "::Ice::Byte val;";
+ C << nl << "__is->read(val);";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ else if(sz <= 0x7fff)
+ {
+ C << nl << "::Ice::Short val;";
+ C << nl << "__is->read(val);";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ else
+ {
+ C << nl << "::Ice::Int val;";
+ C << nl << "__is->read(val);";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ C << eb;
+
+ if(_stream)
+ {
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
<< "(const ::Ice::OutputStreamPtr& __outS, " << scoped << " v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "__outS->writeByte(static_cast< ::Ice::Byte>(v));";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "__outS->writeShort(static_cast< ::Ice::Short>(v));";
- }
- else
- {
- C << nl << "__outS->writeInt(static_cast< ::Ice::Int>(v));";
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
+ C << sb;
+ if(sz <= 0x7f)
+ {
+ C << nl << "__outS->writeByte(static_cast< ::Ice::Byte>(v));";
+ }
+ else if(sz <= 0x7fff)
+ {
+ C << nl << "__outS->writeShort(static_cast< ::Ice::Short>(v));";
+ }
+ else
+ {
+ C << nl << "__outS->writeInt(static_cast< ::Ice::Int>(v));";
+ }
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
<< "(const ::Ice::InputStreamPtr& __inS, " << scoped << "& v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "::Ice::Byte val = __inS->readByte();";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "::Ice::Short val = __inS->readShort();";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else
- {
- C << nl << "::Ice::Int val = __inS->readInt();";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- C << eb;
- }
+ C << sb;
+ if(sz <= 0x7f)
+ {
+ C << nl << "::Ice::Byte val = __inS->readByte();";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ else if(sz <= 0x7fff)
+ {
+ C << nl << "::Ice::Short val = __inS->readShort();";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ else
+ {
+ C << nl << "::Ice::Int val = __inS->readInt();";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ C << eb;
+ }
}
}
@@ -1566,59 +1566,59 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
BuiltinPtr bp = BuiltinPtr::dynamicCast(p->type());
if(bp && bp->kind() == Builtin::KindString)
{
- //
- // Expand strings into the basic source character set. We can't use isalpha() and the like
- // here because they are sensitive to the current locale.
- //
- static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789"
- "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
- static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
-
- if(_useWstring || findMetaData(p->typeMetaData(), true) == "wstring")
- {
- H << 'L';
- }
- H << "\""; // Opening "
-
- const string val = p->value();
- for(string::const_iterator c = val.begin(); c != val.end(); ++c)
- {
- if(charSet.find(*c) == charSet.end())
- {
- unsigned char uc = *c; // char may be signed, so make it positive
- ostringstream s;
- s << "\\"; // Print as octal if not in basic source character set
- s.width(3);
- s.fill('0');
- s << oct;
- s << static_cast<unsigned>(uc);
- H << s.str();
- }
- else
- {
- H << *c; // Print normally if in basic source character set
- }
- }
-
- H << "\""; // Closing "
+ //
+ // Expand strings into the basic source character set. We can't use isalpha() and the like
+ // here because they are sensitive to the current locale.
+ //
+ static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
+ static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
+
+ if(_useWstring || findMetaData(p->typeMetaData(), true) == "wstring")
+ {
+ H << 'L';
+ }
+ H << "\""; // Opening "
+
+ const string val = p->value();
+ for(string::const_iterator c = val.begin(); c != val.end(); ++c)
+ {
+ if(charSet.find(*c) == charSet.end())
+ {
+ unsigned char uc = *c; // char may be signed, so make it positive
+ ostringstream s;
+ s << "\\"; // Print as octal if not in basic source character set
+ s.width(3);
+ s.fill('0');
+ s << oct;
+ s << static_cast<unsigned>(uc);
+ H << s.str();
+ }
+ else
+ {
+ H << *c; // Print normally if in basic source character set
+ }
+ }
+
+ H << "\""; // Closing "
}
else if(bp && bp->kind() == Builtin::KindLong)
{
- H << "ICE_INT64(" << p->value() << ")";
+ H << "ICE_INT64(" << p->value() << ")";
}
else
{
- EnumPtr ep = EnumPtr::dynamicCast(p->type());
- if(ep)
- {
- H << fixKwd(p->value());
- }
- else
- {
- H << p->value();
- }
+ EnumPtr ep = EnumPtr::dynamicCast(p->type());
+ if(ep)
+ {
+ H << fixKwd(p->value());
+ }
+ else
+ {
+ H << p->value();
+ }
}
H << ';';
@@ -1651,7 +1651,7 @@ Slice::Gen::ProxyDeclVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceProxy" << nl << '{';
@@ -1670,7 +1670,7 @@ Slice::Gen::ProxyDeclVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
string name = fixKwd(p->name());
@@ -1691,7 +1691,7 @@ Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
if(p->isLocal())
{
- return;
+ return;
}
string name = fixKwd(p->name());
@@ -1715,7 +1715,7 @@ Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceProxy" << nl << '{';
@@ -1734,7 +1734,7 @@ Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -1759,7 +1759,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -1771,21 +1771,21 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp << nl << "class " << _dllExport << name << " : ";
if(bases.empty())
{
- H << "virtual public ::IceProxy::Ice::Object";
+ H << "virtual public ::IceProxy::Ice::Object";
}
else
{
- H.useCurrentPosAsIndent();
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- H << "virtual public ::IceProxy" << fixKwd((*q)->scoped());
- if(++q != bases.end())
- {
- H << ',' << nl;
- }
- }
- H.restoreIndent();
+ H.useCurrentPosAsIndent();
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ H << "virtual public ::IceProxy" << fixKwd((*q)->scoped());
+ if(++q != bases.end())
+ {
+ H << ',' << nl;
+ }
+ }
+ H.restoreIndent();
}
H << sb;
@@ -1895,39 +1895,39 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd((*q)->name());
+ string paramName = fixKwd((*q)->name());
- StringList metaData = (*q)->getMetaData();
+ StringList metaData = (*q)->getMetaData();
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
- //
- // Work around for Sun CC 5.5 bug #4853566
- //
- string typeString;
- if((*q)->isOutParam())
- {
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ //
+ // Work around for Sun CC 5.5 bug #4853566
+ //
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
#else
- string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
- : inputTypeToString((*q)->type(), _useWstring, metaData);
+ string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
+ : inputTypeToString((*q)->type(), _useWstring, metaData);
#endif
- params.push_back(typeString);
- paramsDecl.push_back(typeString + ' ' + paramName);
- args.push_back(paramName);
+ params.push_back(typeString);
+ paramsDecl.push_back(typeString + ' ' + paramName);
+ args.push_back(paramName);
- if(!(*q)->isOutParam())
- {
- string inputTypeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ if(!(*q)->isOutParam())
+ {
+ string inputTypeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- paramsAMI.push_back(inputTypeString);
- paramsDeclAMI.push_back(inputTypeString + ' ' + paramName);
- argsAMI.push_back(paramName);
- }
+ paramsAMI.push_back(inputTypeString);
+ paramsDeclAMI.push_back(inputTypeString + ' ' + paramName);
+ argsAMI.push_back(paramName);
+ }
}
string thisPointer = fixKwd(scope.substr(0, scope.size() - 2)) + "*";
@@ -1938,7 +1938,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
H << nl;
if(ret)
{
- H << "return ";
+ H << "return ";
}
H << fixKwd(name) << spar << args << "0" << epar << ';';
H << eb;
@@ -1947,7 +1947,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
H << nl;
if(ret)
{
- H << "return ";
+ H << "return ";
}
H << fixKwd(name) << spar << args << "&__ctx" << epar << ';';
H << eb;
@@ -1980,23 +1980,23 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << nl;
if(ret)
{
- C << "return ";
+ C << "return ";
}
C << "__del->" << fixKwd(name) << spar << args << "__ctx" << epar << ';';
if(!ret)
{
- C << nl << "return;";
+ C << nl << "return;";
}
C << eb;
C << nl << "catch(const ::IceInternal::LocalExceptionWrapper& __ex)";
C << sb;
if(p->mode() == Operation::Idempotent || p->mode() == Operation::Nonmutating)
{
- C << nl << "__handleExceptionWrapperRelaxed(__delBase, __ex, __cnt);";
+ C << nl << "__handleExceptionWrapperRelaxed(__delBase, __ex, __cnt);";
}
else
{
- C << nl << "__handleExceptionWrapper(__delBase, __ex);";
+ C << nl << "__handleExceptionWrapper(__delBase, __ex);";
}
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
@@ -2008,27 +2008,27 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
if(cl->hasMetaData("ami") || p->hasMetaData("ami"))
{
- string classNameAMI = "AMI_" + cl->name();
- string classScope = fixKwd(cl->scope());
- string classScopedAMI = classScope + classNameAMI;
+ string classNameAMI = "AMI_" + cl->name();
+ string classScope = fixKwd(cl->scope());
+ string classScopedAMI = classScope + classNameAMI;
- H << nl << "void " << name << "_async" << spar << ("const " + classScopedAMI + '_' + name + "Ptr&")
- << paramsAMI << epar << ';';
- H << nl << "void " << name << "_async" << spar << ("const " + classScopedAMI + '_' + name + "Ptr&")
- << paramsAMI << "const ::Ice::Context&" << epar << ';';
+ H << nl << "void " << name << "_async" << spar << ("const " + classScopedAMI + '_' + name + "Ptr&")
+ << paramsAMI << epar << ';';
+ H << nl << "void " << name << "_async" << spar << ("const " + classScopedAMI + '_' + name + "Ptr&")
+ << paramsAMI << "const ::Ice::Context&" << epar << ';';
- C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar
- << ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << epar;
- C << sb;
- C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "0" << epar << ';';
- C << eb;
+ C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar
+ << ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << epar;
+ C << sb;
+ C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "0" << epar << ';';
+ C << eb;
- C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar
- << ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << "const ::Ice::Context& __ctx"
- << epar;
- C << sb;
- C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "&__ctx" << epar << ';';
- C << eb;
+ C << sp << nl << "void" << nl << "IceProxy" << scope << name << "_async" << spar
+ << ("const " + classScopedAMI + '_' + name + "Ptr& __cb") << paramsDeclAMI << "const ::Ice::Context& __ctx"
+ << epar;
+ C << sb;
+ C << nl << "__cb->__invoke" << spar << "this" << argsAMI << "&__ctx" << epar << ';';
+ C << eb;
}
@@ -2045,7 +2045,7 @@ Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceDelegate" << nl << '{';
@@ -2064,7 +2064,7 @@ Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -2089,7 +2089,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -2100,21 +2100,21 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp << nl << "class " << _dllExport << name << " : ";
if(bases.empty())
{
- H << "virtual public ::IceDelegate::Ice::Object";
+ H << "virtual public ::IceDelegate::Ice::Object";
}
else
{
- H.useCurrentPosAsIndent();
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- H << "virtual public ::IceDelegate" << fixKwd((*q)->scoped());
- if(++q != bases.end())
- {
- H << ',' << nl;
- }
- }
- H.restoreIndent();
+ H.useCurrentPosAsIndent();
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ H << "virtual public ::IceDelegate" << fixKwd((*q)->scoped());
+ if(++q != bases.end())
+ {
+ H << ',' << nl;
+ }
+ }
+ H.restoreIndent();
}
H << sb;
H.dec();
@@ -2147,24 +2147,24 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
{
StringList metaData = (*q)->getMetaData();
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
- //
- // Work around for Sun CC 5.5 bug #4853566
- //
- string typeString;
- if((*q)->isOutParam())
- {
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ //
+ // Work around for Sun CC 5.5 bug #4853566
+ //
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
#else
- string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
- : inputTypeToString((*q)->type(), _useWstring, metaData);
+ string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
+ : inputTypeToString((*q)->type(), _useWstring, metaData);
#endif
- params.push_back(typeString);
+ params.push_back(typeString);
}
params.push_back("const ::Ice::Context*");
@@ -2182,7 +2182,7 @@ Slice::Gen::DelegateMVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceDelegateM" << nl << '{';
@@ -2201,7 +2201,7 @@ Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -2226,7 +2226,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -2240,19 +2240,19 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
H << "virtual public ::IceDelegate" << scoped << ',';
if(bases.empty())
{
- H << nl << "virtual public ::IceDelegateM::Ice::Object";
+ H << nl << "virtual public ::IceDelegateM::Ice::Object";
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- H << nl << "virtual public ::IceDelegateM" << fixKwd((*q)->scoped());
- if(++q != bases.end())
- {
- H << ',';
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ H << nl << "virtual public ::IceDelegateM" << fixKwd((*q)->scoped());
+ if(++q != bases.end())
+ {
+ H << ',';
+ }
+ }
}
H.restoreIndent();
H << sb;
@@ -2288,24 +2288,24 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd((*q)->name());
- TypePtr type = (*q)->type();
- bool isOutParam = (*q)->isOutParam();
- StringList metaData = (*q)->getMetaData();
- string typeString;
- if(isOutParam)
- {
- outParams.push_back(*q);
- typeString = outputTypeToString(type, _useWstring, metaData);
- }
- else
- {
- inParams.push_back(*q);
- typeString = inputTypeToString(type, _useWstring, metaData);
- }
-
- params.push_back(typeString);
- paramsDecl.push_back(typeString + ' ' + paramName);
+ string paramName = fixKwd((*q)->name());
+ TypePtr type = (*q)->type();
+ bool isOutParam = (*q)->isOutParam();
+ StringList metaData = (*q)->getMetaData();
+ string typeString;
+ if(isOutParam)
+ {
+ outParams.push_back(*q);
+ typeString = outputTypeToString(type, _useWstring, metaData);
+ }
+ else
+ {
+ inParams.push_back(*q);
+ typeString = inputTypeToString(type, _useWstring, metaData);
+ }
+
+ params.push_back(typeString);
+ paramsDecl.push_back(typeString + ' ' + paramName);
}
params.push_back("const ::Ice::Context*");
@@ -2320,19 +2320,19 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
<< operationModeToString(p->sendMode()) << ", __context, __compress);";
if(!inParams.empty())
{
- C << nl << "try";
- C << sb;
- C << nl << "::IceInternal::BasicStream* __os = __og.os();";
- writeMarshalCode(C, inParams, 0, StringList(), true);
- if(p->sendsClasses())
- {
- C << nl << "__os->writePendingObjects();";
- }
- C << eb;
- C << nl << "catch(const ::Ice::LocalException& __ex)";
- C << sb;
- C << nl << "__og.abort(__ex);";
- C << eb;
+ C << nl << "try";
+ C << sb;
+ C << nl << "::IceInternal::BasicStream* __os = __og.os();";
+ writeMarshalCode(C, inParams, 0, StringList(), true);
+ if(p->sendsClasses())
+ {
+ C << nl << "__os->writePendingObjects();";
+ }
+ C << eb;
+ C << nl << "catch(const ::Ice::LocalException& __ex)";
+ C << sb;
+ C << nl << "__og.abort(__ex);";
+ C << eb;
}
C << nl << "bool __ok = __og.invoke();";
C << nl << "try";
@@ -2378,10 +2378,10 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
#endif
for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
{
- C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)";
- C << sb;
- C << nl << "throw;";
- C << eb;
+ C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)";
+ C << sb;
+ C << nl << "throw;";
+ C << eb;
}
C << nl << "catch(const ::Ice::UserException& __ex)";
C << sb;
@@ -2392,20 +2392,20 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
writeAllocateCode(C, ParamDeclList(), ret, p->getMetaData(), _useWstring);
for(ParamDeclList::const_iterator opi = outParams.begin(); opi != outParams.end(); ++opi)
{
- StructPtr st = StructPtr::dynamicCast((*opi)->type());
- if(st && findMetaData(st->getMetaData(), false) == "class")
- {
- C << nl << fixKwd((*opi)->name()) << " = new " << fixKwd(st->scoped()) << ";";
- }
+ StructPtr st = StructPtr::dynamicCast((*opi)->type());
+ if(st && findMetaData(st->getMetaData(), false) == "class")
+ {
+ C << nl << fixKwd((*opi)->name()) << " = new " << fixKwd(st->scoped()) << ";";
+ }
}
writeUnmarshalCode(C, outParams, ret, p->getMetaData());
if(p->returnsClasses())
{
- C << nl << "__is->readPendingObjects();";
+ C << nl << "__is->readPendingObjects();";
}
if(ret)
{
- C << nl << "return __ret;";
+ C << nl << "return __ret;";
}
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
@@ -2425,7 +2425,7 @@ Slice::Gen::DelegateDVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceDelegateD" << nl << '{';
@@ -2444,7 +2444,7 @@ Slice::Gen::DelegateDVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -2469,7 +2469,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -2483,19 +2483,19 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
H << "virtual public ::IceDelegate" << scoped << ',';
if(bases.empty())
{
- H << nl << "virtual public ::IceDelegateD::Ice::Object";
+ H << nl << "virtual public ::IceDelegateD::Ice::Object";
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- H << nl << "virtual public ::IceDelegateD" << fixKwd((*q)->scoped());
- if(++q != bases.end())
- {
- H << ',';
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ H << nl << "virtual public ::IceDelegateD" << fixKwd((*q)->scoped());
+ if(++q != bases.end())
+ {
+ H << ',';
+ }
+ }
}
H.restoreIndent();
H << sb;
@@ -2530,30 +2530,30 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd((*q)->name());
+ string paramName = fixKwd((*q)->name());
- StringList metaData = (*q)->getMetaData();
+ StringList metaData = (*q)->getMetaData();
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
- //
- // Work around for Sun CC 5.5 bug #4853566
- //
- string typeString;
- if((*q)->isOutParam())
- {
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ //
+ // Work around for Sun CC 5.5 bug #4853566
+ //
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
#else
- string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
- : inputTypeToString((*q)->type(), _useWstring, metaData);
+ string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
+ : inputTypeToString((*q)->type(), _useWstring, metaData);
#endif
- params.push_back(typeString);
- paramsDecl.push_back(typeString + ' ' + paramName);
- args.push_back(paramName);
+ params.push_back(typeString);
+ paramsDecl.push_back(typeString + ' ' + paramName);
+ args.push_back(paramName);
}
params.push_back("const ::Ice::Context*");
@@ -2570,70 +2570,70 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
bool amd = !cl->isLocal() && (cl->hasMetaData("amd") || p->hasMetaData("amd"));
if(amd)
{
- C << sp << nl << retS << nl << "IceDelegateD" << scoped << spar << params << epar;
- C << sb;
- C << nl << "throw ::Ice::CollocationOptimizationException(__FILE__, __LINE__);";
- if(ret != 0)
- {
- C << nl << "return " << retS << "(); // to avoid a warning with some compilers;";
- }
- C << eb;
+ C << sp << nl << retS << nl << "IceDelegateD" << scoped << spar << params << epar;
+ C << sb;
+ C << nl << "throw ::Ice::CollocationOptimizationException(__FILE__, __LINE__);";
+ if(ret != 0)
+ {
+ C << nl << "return " << retS << "(); // to avoid a warning with some compilers;";
+ }
+ C << eb;
}
else
{
- C << sp << nl << retS << nl << "IceDelegateD" << scoped << spar << paramsDecl << epar;
- C << sb;
- C << nl << "::Ice::Current __current;";
- C << nl << "__initCurrent(__current, " << p->flattenedScope() + p->name() + "_name, "
- << operationModeToString(p->sendMode()) << ", __context);";
- C << nl << "while(true)";
- C << sb;
- C << nl << "::IceInternal::Direct __direct(__current);";
- if(ret)
- {
- C << nl << retS << " __ret;";
- }
- C << nl << "try";
- C << sb;
- C << nl << thisPointer << " __servant = dynamic_cast< " << thisPointer << ">(__direct.servant().get());";
- C << nl << "if(!__servant)";
- C << sb;
- C << nl << "::Ice::OperationNotExistException __opEx(__FILE__, __LINE__);";
- C << nl << "__opEx.id = __current.id;";
- C << nl << "__opEx.facet = __current.facet;";
- C << nl << "__opEx.operation = __current.operation;";
- C << nl << "throw __opEx;";
- C << eb;
+ C << sp << nl << retS << nl << "IceDelegateD" << scoped << spar << paramsDecl << epar;
+ C << sb;
+ C << nl << "::Ice::Current __current;";
+ C << nl << "__initCurrent(__current, " << p->flattenedScope() + p->name() + "_name, "
+ << operationModeToString(p->sendMode()) << ", __context);";
+ C << nl << "while(true)";
+ C << sb;
+ C << nl << "::IceInternal::Direct __direct(__current);";
+ if(ret)
+ {
+ C << nl << retS << " __ret;";
+ }
+ C << nl << "try";
+ C << sb;
+ C << nl << thisPointer << " __servant = dynamic_cast< " << thisPointer << ">(__direct.servant().get());";
+ C << nl << "if(!__servant)";
+ C << sb;
+ C << nl << "::Ice::OperationNotExistException __opEx(__FILE__, __LINE__);";
+ C << nl << "__opEx.id = __current.id;";
+ C << nl << "__opEx.facet = __current.facet;";
+ C << nl << "__opEx.operation = __current.operation;";
+ C << nl << "throw __opEx;";
+ C << eb;
C << nl << "try";
C << sb;
- C << nl;
- if(ret)
- {
- C << "__ret = ";
- }
- C << "__servant->" << name << spar << args << epar << ';';
- C << eb;
+ C << nl;
+ if(ret)
+ {
+ C << "__ret = ";
+ }
+ C << "__servant->" << name << spar << args << epar << ';';
+ C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
C << nl << "throw ::IceInternal::LocalExceptionWrapper(__ex, false);";
- C << eb;
- C << eb;
- C << nl << "catch(...)";
- C << sb;
- C << nl << "__direct.destroy();";
- C << nl << "throw;";
- C << eb;
- C << nl << "__direct.destroy();";
- if(ret)
- {
- C << nl << "return __ret;";
- }
- else
- {
- C << nl << "return;";
- }
- C << eb;
- C << eb;
+ C << eb;
+ C << eb;
+ C << nl << "catch(...)";
+ C << sb;
+ C << nl << "__direct.destroy();";
+ C << nl << "throw;";
+ C << eb;
+ C << nl << "__direct.destroy();";
+ if(ret)
+ {
+ C << nl << "return __ret;";
+ }
+ else
+ {
+ C << nl << "return;";
+ }
+ C << eb;
+ C << eb;
}
}
@@ -2647,7 +2647,7 @@ Slice::Gen::ObjectDeclVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasClassDecls())
{
- return false;
+ return false;
}
string name = fixKwd(p->name());
@@ -2694,7 +2694,7 @@ Slice::Gen::ObjectVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasClassDefs())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -2726,7 +2726,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDefPtr base;
if(!bases.empty() && !bases.front()->isInterface())
{
- base = bases.front();
+ base = bases.front();
}
DataMemberList dataMembers = p->dataMembers();
DataMemberList allDataMembers = p->allDataMembers();
@@ -2735,26 +2735,26 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H.useCurrentPosAsIndent();
if(bases.empty())
{
- if(p->isLocal())
- {
- H << "virtual public ::Ice::LocalObject";
- }
- else
- {
- H << "virtual public ::Ice::Object";
- }
+ if(p->isLocal())
+ {
+ H << "virtual public ::Ice::LocalObject";
+ }
+ else
+ {
+ H << "virtual public ::Ice::Object";
+ }
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- H << "virtual public " << fixKwd((*q)->scoped());
- if(++q != bases.end())
- {
- H << ',' << nl;
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ H << "virtual public " << fixKwd((*q)->scoped());
+ if(++q != bases.end())
+ {
+ H << ',' << nl;
+ }
+ }
}
H.restoreIndent();
H << sb;
@@ -2776,249 +2776,249 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- params.push_back(fixKwd((*q)->name()));
+ params.push_back(fixKwd((*q)->name()));
}
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
- allTypes.push_back(typeName);
- allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
+ string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
+ allTypes.push_back(typeName);
+ allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
}
if(!p->isInterface())
{
- H << nl << name << "() {}";
- if(!allParamDecls.empty())
- {
- H << nl;
- if(allParamDecls.size() == 1)
- {
- H << "explicit ";
- }
- H << name << spar << allTypes << epar << ';';
- }
-
- /*
- * Strong guarantee: commented-out code marked "Strong guarantee" generates
- * a copy-assignment operator that provides the strong exception guarantee.
- * For now, this is commented out, and we use the compiler-generated
- * copy-assignment operator. However, that one does not provide the strong
- * guarantee.
-
- H << ';';
- if(!p->isAbstract())
- {
- H << nl << name << "& operator=(const " << name << "&)";
- if(allDataMembers.empty())
- {
- H << " { return *this; }";
- }
- H << ';';
- }
-
- //
- // __swap() is static because classes may be abstract, so we
- // can't use a non-static member function when we do an upcall
- // from a non-abstract derived __swap to the __swap in an abstract base.
- //
- H << sp << nl << "static void __swap(" << name << "&, " << name << "&) throw()";
- if(allDataMembers.empty())
- {
- H << " {}";
- }
- H << ';';
- H << nl << "void swap(" << name << "& rhs) throw()";
- H << sb;
- if(!allDataMembers.empty())
- {
- H << nl << "__swap(*this, rhs);";
- }
- H << eb;
-
- * Strong guarantee
- */
+ H << nl << name << "() {}";
+ if(!allParamDecls.empty())
+ {
+ H << nl;
+ if(allParamDecls.size() == 1)
+ {
+ H << "explicit ";
+ }
+ H << name << spar << allTypes << epar << ';';
+ }
+
+ /*
+ * Strong guarantee: commented-out code marked "Strong guarantee" generates
+ * a copy-assignment operator that provides the strong exception guarantee.
+ * For now, this is commented out, and we use the compiler-generated
+ * copy-assignment operator. However, that one does not provide the strong
+ * guarantee.
+
+ H << ';';
+ if(!p->isAbstract())
+ {
+ H << nl << name << "& operator=(const " << name << "&)";
+ if(allDataMembers.empty())
+ {
+ H << " { return *this; }";
+ }
+ H << ';';
+ }
+
+ //
+ // __swap() is static because classes may be abstract, so we
+ // can't use a non-static member function when we do an upcall
+ // from a non-abstract derived __swap to the __swap in an abstract base.
+ //
+ H << sp << nl << "static void __swap(" << name << "&, " << name << "&) throw()";
+ if(allDataMembers.empty())
+ {
+ H << " {}";
+ }
+ H << ';';
+ H << nl << "void swap(" << name << "& rhs) throw()";
+ H << sb;
+ if(!allDataMembers.empty())
+ {
+ H << nl << "__swap(*this, rhs);";
+ }
+ H << eb;
+
+ * Strong guarantee
+ */
emitOneShotConstructor(p);
- /*
- * Strong guarantee
-
- if(!allDataMembers.empty())
- {
- C << sp << nl << "void";
- C << nl << scoped.substr(2) << "::__swap(" << name << "& __lhs, " << name << "& __rhs) throw()";
- C << sb;
-
- if(base)
- {
- emitUpcall(base, "::__swap(__lhs, __rhs);");
- }
-
- //
- // We use a map to remember for which types we have already declared
- // a temporary variable and reuse that variable if a class has
- // more than one member of the same type. That way, we don't use more
- // temporaries than necessary. (::std::swap() instantiates a new temporary
- // each time it is used.)
- //
- map<string, int> tmpMap;
- map<string, int>::iterator pos;
- int tmpCount = 0;
-
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- string memberName = fixKwd((*q)->name());
- TypePtr type = (*q)->type();
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin && builtin->kind() != Builtin::KindString
- || EnumPtr::dynamicCast(type) || ProxyPtr::dynamicCast(type)
- || ClassDeclPtr::dynamicCast(type) || StructPtr::dynamicCast(type))
- {
- //
- // For built-in types (except string), enums, proxies, structs, and classes,
- // do the swap via a temporary variable.
- //
- string typeName = typeToString(type);
- pos = tmpMap.find(typeName);
- if(pos == tmpMap.end())
- {
- pos = tmpMap.insert(pos, make_pair(typeName, tmpCount));
- C << nl << typeName << " __tmp" << tmpCount << ';';
- tmpCount++;
- }
- C << nl << "__tmp" << pos->second << " = __rhs." << memberName << ';';
- C << nl << "__rhs." << memberName << " = __lhs." << memberName << ';';
- C << nl << "__lhs." << memberName << " = __tmp" << pos->second << ';';
- }
- else
- {
- //
- // For dictionaries, vectors, and maps, use the standard container's
- // swap() (which is usually optimized).
- //
- C << nl << "__lhs." << memberName << ".swap(__rhs." << memberName << ");";
- }
- }
- C << eb;
-
- if(!p->isAbstract())
- {
- C << sp << nl << scoped << "&";
- C << nl << scoped.substr(2) << "::operator=(const " << name << "& __rhs)";
- C << sb;
- C << nl << name << " __tmp(__rhs);";
- C << nl << "__swap(*this, __tmp);";
- C << nl << "return *this;";
- C << eb;
- }
- }
-
- * Strong guarantee
- */
+ /*
+ * Strong guarantee
+
+ if(!allDataMembers.empty())
+ {
+ C << sp << nl << "void";
+ C << nl << scoped.substr(2) << "::__swap(" << name << "& __lhs, " << name << "& __rhs) throw()";
+ C << sb;
+
+ if(base)
+ {
+ emitUpcall(base, "::__swap(__lhs, __rhs);");
+ }
+
+ //
+ // We use a map to remember for which types we have already declared
+ // a temporary variable and reuse that variable if a class has
+ // more than one member of the same type. That way, we don't use more
+ // temporaries than necessary. (::std::swap() instantiates a new temporary
+ // each time it is used.)
+ //
+ map<string, int> tmpMap;
+ map<string, int>::iterator pos;
+ int tmpCount = 0;
+
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ string memberName = fixKwd((*q)->name());
+ TypePtr type = (*q)->type();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin && builtin->kind() != Builtin::KindString
+ || EnumPtr::dynamicCast(type) || ProxyPtr::dynamicCast(type)
+ || ClassDeclPtr::dynamicCast(type) || StructPtr::dynamicCast(type))
+ {
+ //
+ // For built-in types (except string), enums, proxies, structs, and classes,
+ // do the swap via a temporary variable.
+ //
+ string typeName = typeToString(type);
+ pos = tmpMap.find(typeName);
+ if(pos == tmpMap.end())
+ {
+ pos = tmpMap.insert(pos, make_pair(typeName, tmpCount));
+ C << nl << typeName << " __tmp" << tmpCount << ';';
+ tmpCount++;
+ }
+ C << nl << "__tmp" << pos->second << " = __rhs." << memberName << ';';
+ C << nl << "__rhs." << memberName << " = __lhs." << memberName << ';';
+ C << nl << "__lhs." << memberName << " = __tmp" << pos->second << ';';
+ }
+ else
+ {
+ //
+ // For dictionaries, vectors, and maps, use the standard container's
+ // swap() (which is usually optimized).
+ //
+ C << nl << "__lhs." << memberName << ".swap(__rhs." << memberName << ");";
+ }
+ }
+ C << eb;
+
+ if(!p->isAbstract())
+ {
+ C << sp << nl << scoped << "&";
+ C << nl << scoped.substr(2) << "::operator=(const " << name << "& __rhs)";
+ C << sb;
+ C << nl << name << " __tmp(__rhs);";
+ C << nl << "__swap(*this, __tmp);";
+ C << nl << "return *this;";
+ C << eb;
+ }
+ }
+
+ * Strong guarantee
+ */
}
if(!p->isLocal())
{
- H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
-
- C << sp;
- C << nl << "::Ice::ObjectPtr";
- C << nl << fixKwd(p->scoped()).substr(2) << "::ice_clone() const";
- C << sb;
- if(!p->isAbstract())
- {
- C << nl << fixKwd(p->scope()) << p->name() << "Ptr __p = new " << fixKwd(p->scoped()) << "(*this);";
- C << nl << "return __p;";
- }
- else
- {
- C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);";
- C << nl << "return 0; // to avoid a warning with some compilers";
- }
- C << eb;
-
- ClassList allBases = p->allBases();
- StringList ids;
+ H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
+
+ C << sp;
+ C << nl << "::Ice::ObjectPtr";
+ C << nl << fixKwd(p->scoped()).substr(2) << "::ice_clone() const";
+ C << sb;
+ if(!p->isAbstract())
+ {
+ C << nl << fixKwd(p->scope()) << p->name() << "Ptr __p = new " << fixKwd(p->scoped()) << "(*this);";
+ C << nl << "return __p;";
+ }
+ else
+ {
+ C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);";
+ C << nl << "return 0; // to avoid a warning with some compilers";
+ }
+ C << eb;
+
+ ClassList allBases = p->allBases();
+ StringList ids;
#if defined(__IBMCPP__) && defined(NDEBUG)
//
// VisualAge C++ 6.0 does not see that ClassDef is a Contained,
// when inlining is on. The code below issues a warning: better
// than an error!
//
- transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped));
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped));
#else
- transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped));
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped));
#endif
- StringList other;
- other.push_back(p->scoped());
- other.push_back("::Ice::Object");
- other.sort();
- ids.merge(other);
- ids.unique();
+ StringList other;
+ other.push_back(p->scoped());
+ other.push_back("::Ice::Object");
+ other.sort();
+ ids.merge(other);
+ ids.unique();
StringList::const_iterator firstIter = ids.begin();
StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped());
assert(scopedIter != ids.end());
StringList::difference_type scopedPos = ice_distance(firstIter, scopedIter);
- H << sp;
- H << nl << "virtual bool ice_isA"
- << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "virtual ::std::vector< ::std::string> ice_ids"
- << "(const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "static const ::std::string& ice_staticId();";
- if(!dataMembers.empty())
- {
- H << sp;
- }
-
- string flatName = p->flattenedScope() + p->name() + "_ids";
-
- C << sp;
- C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] =";
- C << sb;
-
- StringList::const_iterator r = ids.begin();
- while(r != ids.end())
- {
- C << nl << '"' << *r << '"';
- if(++r != ids.end())
- {
- C << ',';
- }
- }
- C << eb << ';';
-
- C << sp;
- C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2)
+ H << sp;
+ H << nl << "virtual bool ice_isA"
+ << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "virtual ::std::vector< ::std::string> ice_ids"
+ << "(const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "static const ::std::string& ice_staticId();";
+ if(!dataMembers.empty())
+ {
+ H << sp;
+ }
+
+ string flatName = p->flattenedScope() + p->name() + "_ids";
+
+ C << sp;
+ C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] =";
+ C << sb;
+
+ StringList::const_iterator r = ids.begin();
+ while(r != ids.end())
+ {
+ C << nl << '"' << *r << '"';
+ if(++r != ids.end())
+ {
+ C << ',';
+ }
+ }
+ C << eb << ';';
+
+ C << sp;
+ C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2)
<< "::ice_isA(const ::std::string& _s, const ::Ice::Current&) const";
- C << sb;
- C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", _s);";
- C << eb;
-
- C << sp;
- C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2)
- << "::ice_ids(const ::Ice::Current&) const";
- C << sb;
- C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName
- << '[' << ids.size() << "]);";
- C << eb;
-
- C << sp;
- C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2)
- << "::ice_id(const ::Ice::Current&) const";
- C << sb;
- C << nl << "return " << flatName << '[' << scopedPos << "];";
- C << eb;
-
- C << sp;
- C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()";
- C << sb;
- C << nl << "return " << flatName << '[' << scopedPos << "];";
- C << eb;
-
- emitGCFunctions(p);
+ C << sb;
+ C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", _s);";
+ C << eb;
+
+ C << sp;
+ C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2)
+ << "::ice_ids(const ::Ice::Current&) const";
+ C << sb;
+ C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName
+ << '[' << ids.size() << "]);";
+ C << eb;
+
+ C << sp;
+ C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2)
+ << "::ice_id(const ::Ice::Current&) const";
+ C << sb;
+ C << nl << "return " << flatName << '[' << scopedPos << "];";
+ C << eb;
+
+ C << sp;
+ C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()";
+ C << sb;
+ C << nl << "return " << flatName << '[' << scopedPos << "];";
+ C << eb;
+
+ emitGCFunctions(p);
}
return true;
@@ -3031,383 +3031,383 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
string scope = fixKwd(p->scope());
if(!p->isLocal())
- {
- ClassList bases = p->bases();
- ClassDefPtr base;
- if(!bases.empty() && !bases.front()->isInterface())
- {
- base = bases.front();
- }
+ {
+ ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ base = bases.front();
+ }
- OperationList allOps = p->allOperations();
- if(!allOps.empty())
- {
- StringList allOpNames;
+ OperationList allOps = p->allOperations();
+ if(!allOps.empty())
+ {
+ StringList allOpNames;
#if defined(__IBMCPP__) && defined(NDEBUG)
//
// See comment for transform above
//
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
- ::IceUtil::constMemFun<string,Operation>(&Contained::name));
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
+ ::IceUtil::constMemFun<string,Operation>(&Contained::name));
#else
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
::IceUtil::constMemFun(&Contained::name));
#endif
- allOpNames.push_back("ice_id");
- allOpNames.push_back("ice_ids");
- allOpNames.push_back("ice_isA");
- allOpNames.push_back("ice_ping");
- allOpNames.sort();
- allOpNames.unique();
-
- StringList::const_iterator q;
-
- H << sp;
- H << nl
- << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
-
- string flatName = p->flattenedScope() + p->name() + "_all";
- C << sp;
- C << nl << "static ::std::string " << flatName << "[] =";
- C << sb;
- q = allOpNames.begin();
- while(q != allOpNames.end())
- {
- C << nl << '"' << *q << '"';
- if(++q != allOpNames.end())
- {
- C << ',';
- }
- }
- C << eb << ';';
- C << sp;
- C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
- << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
- C << sb;
-
- C << nl << "::std::pair< ::std::string*, ::std::string*> r = "
- << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size()
- << ", current.operation);";
- C << nl << "if(r.first == r.second)";
- C << sb;
- C << nl << "return ::IceInternal::DispatchOperationNotExist;";
- C << eb;
- C << sp;
- C << nl << "switch(r.first - " << flatName << ')';
- C << sb;
- int i = 0;
- for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
- {
- C << nl << "case " << i++ << ':';
- C << sb;
- C << nl << "return ___" << *q << "(in, current);";
- C << eb;
- }
- C << eb;
- C << sp;
- C << nl << "assert(false);";
- C << nl << "return ::IceInternal::DispatchOperationNotExist;";
- C << eb;
-
-
- //
- // Check if we need to generate ice_operationAttributes()
- //
-
- StringList freezeWriteOpNames;
- for(OperationList::iterator r = allOps.begin(); r != allOps.end(); ++r)
- {
- ClassDefPtr classDef = ClassDefPtr::dynamicCast((*r)->container());
- assert(classDef != 0);
-
- if((*r)->hasMetaData("freeze:write") ||
- (classDef->hasMetaData("freeze:write") && !(*r)->hasMetaData("freeze:read")))
- {
- freezeWriteOpNames.push_back((*r)->name());
- }
- }
-
- if(!freezeWriteOpNames.empty())
- {
- freezeWriteOpNames.sort();
-
- H << sp;
- H << nl
- << "virtual ::Ice::Int ice_operationAttributes(const ::std::string&) const;";
-
- flatName = p->flattenedScope() + p->name() + "_freezeWriteOperations";
- C << sp;
- C << nl << "static ::std::string " << flatName << "[] =";
- C << sb;
- q = freezeWriteOpNames.begin();
- while(q != freezeWriteOpNames.end())
- {
- C << nl << '"' << *q << '"';
- if(++q != freezeWriteOpNames.end())
- {
- C << ',';
- }
- }
- C << eb << ';';
- C << sp;
-
- C << nl << "::Ice::Int" << nl << scoped.substr(2)
- << "::ice_operationAttributes(const ::std::string& opName) const";
- C << sb;
-
- C << nl << "::std::string* end = " << flatName << " + " << freezeWriteOpNames.size() << ";";
- C << nl << "::std::string* r = ::std::find(" << flatName << ", end, opName);";
-
- C << nl << "return r == end ? 0 : 1;";
- C << eb;
- }
- }
-
- H << sp;
- H << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
- H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
+ allOpNames.push_back("ice_id");
+ allOpNames.push_back("ice_ids");
+ allOpNames.push_back("ice_isA");
+ allOpNames.push_back("ice_ping");
+ allOpNames.sort();
+ allOpNames.unique();
+
+ StringList::const_iterator q;
+
+ H << sp;
+ H << nl
+ << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
+
+ string flatName = p->flattenedScope() + p->name() + "_all";
+ C << sp;
+ C << nl << "static ::std::string " << flatName << "[] =";
+ C << sb;
+ q = allOpNames.begin();
+ while(q != allOpNames.end())
+ {
+ C << nl << '"' << *q << '"';
+ if(++q != allOpNames.end())
+ {
+ C << ',';
+ }
+ }
+ C << eb << ';';
+ C << sp;
+ C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
+ << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
+ C << sb;
+
+ C << nl << "::std::pair< ::std::string*, ::std::string*> r = "
+ << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size()
+ << ", current.operation);";
+ C << nl << "if(r.first == r.second)";
+ C << sb;
+ C << nl << "return ::IceInternal::DispatchOperationNotExist;";
+ C << eb;
+ C << sp;
+ C << nl << "switch(r.first - " << flatName << ')';
+ C << sb;
+ int i = 0;
+ for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ {
+ C << nl << "case " << i++ << ':';
+ C << sb;
+ C << nl << "return ___" << *q << "(in, current);";
+ C << eb;
+ }
+ C << eb;
+ C << sp;
+ C << nl << "assert(false);";
+ C << nl << "return ::IceInternal::DispatchOperationNotExist;";
+ C << eb;
+
+
+ //
+ // Check if we need to generate ice_operationAttributes()
+ //
+
+ StringList freezeWriteOpNames;
+ for(OperationList::iterator r = allOps.begin(); r != allOps.end(); ++r)
+ {
+ ClassDefPtr classDef = ClassDefPtr::dynamicCast((*r)->container());
+ assert(classDef != 0);
+
+ if((*r)->hasMetaData("freeze:write") ||
+ (classDef->hasMetaData("freeze:write") && !(*r)->hasMetaData("freeze:read")))
+ {
+ freezeWriteOpNames.push_back((*r)->name());
+ }
+ }
+
+ if(!freezeWriteOpNames.empty())
+ {
+ freezeWriteOpNames.sort();
+
+ H << sp;
+ H << nl
+ << "virtual ::Ice::Int ice_operationAttributes(const ::std::string&) const;";
+
+ flatName = p->flattenedScope() + p->name() + "_freezeWriteOperations";
+ C << sp;
+ C << nl << "static ::std::string " << flatName << "[] =";
+ C << sb;
+ q = freezeWriteOpNames.begin();
+ while(q != freezeWriteOpNames.end())
+ {
+ C << nl << '"' << *q << '"';
+ if(++q != freezeWriteOpNames.end())
+ {
+ C << ',';
+ }
+ }
+ C << eb << ';';
+ C << sp;
+
+ C << nl << "::Ice::Int" << nl << scoped.substr(2)
+ << "::ice_operationAttributes(const ::std::string& opName) const";
+ C << sb;
+
+ C << nl << "::std::string* end = " << flatName << " + " << freezeWriteOpNames.size() << ";";
+ C << nl << "::std::string* r = ::std::find(" << flatName << ", end, opName);";
+
+ C << nl << "return r == end ? 0 : 1;";
+ C << eb;
+ }
+ }
+
+ H << sp;
+ H << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
+ H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);";
- C << sp;
- C << nl << "void" << nl << scoped.substr(2)
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2)
<< "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
- C << nl << "__os->writeTypeId(ice_staticId());";
- C << nl << "__os->startWriteSlice();";
- DataMemberList dataMembers = p->dataMembers();
- DataMemberList::const_iterator q;
+ C << sb;
+ C << nl << "__os->writeTypeId(ice_staticId());";
+ C << nl << "__os->startWriteSlice();";
+ DataMemberList dataMembers = p->dataMembers();
+ DataMemberList::const_iterator q;
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
}
- C << nl << "__os->endWriteSlice();";
- emitUpcall(base, "::__write(__os);");
- C << eb;
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)";
- C << sb;
- C << nl << "if(__rid)";
- C << sb;
- C << nl << "::std::string myId;";
- C << nl << "__is->readTypeId(myId);";
- C << eb;
- C << nl << "__is->startReadSlice();";
+ C << nl << "__os->endWriteSlice();";
+ emitUpcall(base, "::__write(__os);");
+ C << eb;
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)";
+ C << sb;
+ C << nl << "if(__rid)";
+ C << sb;
+ C << nl << "::std::string myId;";
+ C << nl << "__is->readTypeId(myId);";
+ C << eb;
+ C << nl << "__is->startReadSlice();";
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
}
- C << nl << "__is->endReadSlice();";
- emitUpcall(base, "::__read(__is, true);");
- C << eb;
-
- if(_stream)
- {
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __outS) const";
- C << sb;
- C << nl << "__outS->writeTypeId(ice_staticId());";
- C << nl << "__outS->startSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring,
- (*q)->getMetaData());
- }
- C << nl << "__outS->endSlice();";
- emitUpcall(base, "::__write(__outS);");
- C << eb;
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __inS, bool __rid)";
- C << sb;
- C << nl << "if(__rid)";
- C << sb;
- C << nl << "__inS->readTypeId();";
- C << eb;
- C << nl << "__inS->startSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring,
- (*q)->getMetaData());
- }
- C << nl << "__inS->endSlice();";
- emitUpcall(base, "::__read(__inS, true);");
- C << eb;
- }
+ C << nl << "__is->endReadSlice();";
+ emitUpcall(base, "::__read(__is, true);");
+ C << eb;
+
+ if(_stream)
+ {
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __outS) const";
+ C << sb;
+ C << nl << "__outS->writeTypeId(ice_staticId());";
+ C << nl << "__outS->startSlice();";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring,
+ (*q)->getMetaData());
+ }
+ C << nl << "__outS->endSlice();";
+ emitUpcall(base, "::__write(__outS);");
+ C << eb;
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __inS, bool __rid)";
+ C << sb;
+ C << nl << "if(__rid)";
+ C << sb;
+ C << nl << "__inS->readTypeId();";
+ C << eb;
+ C << nl << "__inS->startSlice();";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring,
+ (*q)->getMetaData());
+ }
+ C << nl << "__inS->endSlice();";
+ emitUpcall(base, "::__read(__inS, true);");
+ C << eb;
+ }
else
- {
+ {
//
// Emit placeholder functions to catch errors.
//
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
- C << sb;
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
+ C << sb;
C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
C << nl << "throw ex;";
- C << eb;
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&, bool)";
- C << sb;
+ C << eb;
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&, bool)";
+ C << sb;
C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
C << nl << "throw ex;";
- C << eb;
- }
-
- if(!p->isAbstract())
- {
- H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();";
-
- string factoryName = "__F" + p->flattenedScope() + p->name();
- C << sp;
- C << nl << "class " << factoryName << " : public ::Ice::ObjectFactory";
- C << sb;
- C.dec();
- C << nl << "public:";
- C.inc();
- C << sp << nl << "virtual ::Ice::ObjectPtr" << nl << "create(const ::std::string& type)";
- C << sb;
- C << nl << "assert(type == " << scoped << "::ice_staticId());";
- C << nl << "return new " << scoped << ';';
- C << eb;
- C << sp << nl << "virtual void" << nl << "destroy()";
- C << sb;
- C << eb;
- C << eb << ';';
-
- string flatName = factoryName + "_Ptr";
- C << sp;
- C << nl << "static ::Ice::ObjectFactoryPtr " << flatName << " = new " << factoryName << ';';
-
- C << sp << nl << "const ::Ice::ObjectFactoryPtr&" << nl << scoped.substr(2) << "::ice_factory()";
- C << sb;
- C << nl << "return " << flatName << ';';
- C << eb;
-
- C << sp;
- C << nl << "class " << factoryName << "__Init";
- C << sb;
- C.dec();
- C << nl << "public:";
- C.inc();
- C << sp << nl << factoryName << "__Init()";
- C << sb;
- C << nl << "::IceInternal::factoryTable->addObjectFactory(" << scoped << "::ice_staticId(), "
- << scoped << "::ice_factory());";
- C << eb;
- C << sp << nl << "~" << factoryName << "__Init()";
- C << sb;
- C << nl << "::IceInternal::factoryTable->removeObjectFactory(" << scoped << "::ice_staticId());";
- C << eb;
- C << eb << ';';
-
- C << sp;
- C << nl << "static " << factoryName << "__Init " << factoryName << "__i;";
- C << sp << nl << "#ifdef __APPLE__";
- std::string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer";
- C << nl << "extern \"C\" { void " << initfuncname << "() {} }";
- C << nl << "#endif";
- }
+ C << eb;
+ }
+
+ if(!p->isAbstract())
+ {
+ H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();";
+
+ string factoryName = "__F" + p->flattenedScope() + p->name();
+ C << sp;
+ C << nl << "class " << factoryName << " : public ::Ice::ObjectFactory";
+ C << sb;
+ C.dec();
+ C << nl << "public:";
+ C.inc();
+ C << sp << nl << "virtual ::Ice::ObjectPtr" << nl << "create(const ::std::string& type)";
+ C << sb;
+ C << nl << "assert(type == " << scoped << "::ice_staticId());";
+ C << nl << "return new " << scoped << ';';
+ C << eb;
+ C << sp << nl << "virtual void" << nl << "destroy()";
+ C << sb;
+ C << eb;
+ C << eb << ';';
+
+ string flatName = factoryName + "_Ptr";
+ C << sp;
+ C << nl << "static ::Ice::ObjectFactoryPtr " << flatName << " = new " << factoryName << ';';
+
+ C << sp << nl << "const ::Ice::ObjectFactoryPtr&" << nl << scoped.substr(2) << "::ice_factory()";
+ C << sb;
+ C << nl << "return " << flatName << ';';
+ C << eb;
+
+ C << sp;
+ C << nl << "class " << factoryName << "__Init";
+ C << sb;
+ C.dec();
+ C << nl << "public:";
+ C.inc();
+ C << sp << nl << factoryName << "__Init()";
+ C << sb;
+ C << nl << "::IceInternal::factoryTable->addObjectFactory(" << scoped << "::ice_staticId(), "
+ << scoped << "::ice_factory());";
+ C << eb;
+ C << sp << nl << "~" << factoryName << "__Init()";
+ C << sb;
+ C << nl << "::IceInternal::factoryTable->removeObjectFactory(" << scoped << "::ice_staticId());";
+ C << eb;
+ C << eb << ';';
+
+ C << sp;
+ C << nl << "static " << factoryName << "__Init " << factoryName << "__i;";
+ C << sp << nl << "#ifdef __APPLE__";
+ std::string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer";
+ C << nl << "extern \"C\" { void " << initfuncname << "() {} }";
+ C << nl << "#endif";
+ }
}
if(!p->isAbstract())
{
- //
- // We add a protected destructor to force heap instantiation of the class.
- //
- H.dec();
- H << sp << nl << "protected:";
- H.inc();
- H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() {}";
+ //
+ // We add a protected destructor to force heap instantiation of the class.
+ //
+ H.dec();
+ H << sp << nl << "protected:";
+ H.inc();
+ H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() {}";
- if(!_doneStaticSymbol)
- {
- H << sp << nl << "friend class " << p->name() << "__staticInit;";
- }
+ if(!_doneStaticSymbol)
+ {
+ H << sp << nl << "friend class " << p->name() << "__staticInit;";
+ }
}
H << eb << ';';
if(!p->isAbstract() && !_doneStaticSymbol)
{
- //
- // We need an instance here to trigger initialization if the implementation is in a shared library.
- // But we do this only once per source file, because a single instance is sufficient to initialize
- // all of the globals in a shared library.
- // For a Slice class Foo, we instantiate a dummy class Foo__staticInit instead of using a static
- // Foo instance directly because Foo has a protected destructor.
- //
- H << sp << nl << "class " << p->name() << "__staticInit";
- H << sb;
- H.dec();
- H << nl << "public:";
- H.inc();
- H << sp << nl << scoped << " _init;";
- H << eb << ';';
- _doneStaticSymbol = true;
- H << sp << nl << "static " << scoped << "__staticInit _" << p->name() << "_init;";
+ //
+ // We need an instance here to trigger initialization if the implementation is in a shared library.
+ // But we do this only once per source file, because a single instance is sufficient to initialize
+ // all of the globals in a shared library.
+ // For a Slice class Foo, we instantiate a dummy class Foo__staticInit instead of using a static
+ // Foo instance directly because Foo has a protected destructor.
+ //
+ H << sp << nl << "class " << p->name() << "__staticInit";
+ H << sb;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
+ H << sp << nl << scoped << " _init;";
+ H << eb << ';';
+ _doneStaticSymbol = true;
+ H << sp << nl << "static " << scoped << "__staticInit _" << p->name() << "_init;";
}
if(p->isLocal())
{
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) == static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) != static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) < static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::LocalObject&>(l) == static_cast<const ::Ice::LocalObject&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::LocalObject&>(l) != static_cast<const ::Ice::LocalObject&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::LocalObject&>(l) < static_cast<const ::Ice::LocalObject&>(r);";
+ C << eb;
}
else
{
- string name = p->name();
-
- H << sp << nl << "void " << _dllExport << "__patch__" << name << "Ptr(void*, ::Ice::ObjectPtr&);";
-
- C << sp << nl << "void " << _dllExport;
- C << nl << scope.substr(2) << "__patch__" << name << "Ptr(void* __addr, ::Ice::ObjectPtr& v)";
- C << sb;
- C << nl << scope << name << "Ptr* p = static_cast< " << scope << name << "Ptr*>(__addr);";
- C << nl << "assert(p);";
- C << nl << "*p = " << scope << name << "Ptr::dynamicCast(v);";
- C << nl << "if(v && !*p)";
- C << sb;
- C << nl << "::Ice::UnexpectedObjectException e(__FILE__, __LINE__);";
- C << nl << "e.type = v->ice_id();";
- C << nl << "e.expectedType = " << scope << fixKwd(name) << "::ice_staticId();";
- C << nl << "throw e;";
- C << eb;
- C << eb;
-
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) != static_cast<const ::Ice::Object&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);";
- C << eb;
+ string name = p->name();
+
+ H << sp << nl << "void " << _dllExport << "__patch__" << name << "Ptr(void*, ::Ice::ObjectPtr&);";
+
+ C << sp << nl << "void " << _dllExport;
+ C << nl << scope.substr(2) << "__patch__" << name << "Ptr(void* __addr, ::Ice::ObjectPtr& v)";
+ C << sb;
+ C << nl << scope << name << "Ptr* p = static_cast< " << scope << name << "Ptr*>(__addr);";
+ C << nl << "assert(p);";
+ C << nl << "*p = " << scope << name << "Ptr::dynamicCast(v);";
+ C << nl << "if(v && !*p)";
+ C << sb;
+ C << nl << "::Ice::UnexpectedObjectException e(__FILE__, __LINE__);";
+ C << nl << "e.type = v->ice_id();";
+ C << nl << "e.expectedType = " << scope << fixKwd(name) << "::ice_staticId();";
+ C << nl << "throw e;";
+ C << eb;
+ C << eb;
+
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) != static_cast<const ::Ice::Object&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);";
+ C << eb;
}
C << sp;
@@ -3470,65 +3470,65 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd((*q)->name());
- TypePtr type = (*q)->type();
- bool isOutParam = (*q)->isOutParam();
- string typeString;
- if(isOutParam)
- {
- outParams.push_back(*q);
- typeString = outputTypeToString(type, _useWstring, (*q)->getMetaData());
- }
- else
- {
- inParams.push_back(*q);
- typeString = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
- }
-
- if(q != paramList.begin())
- {
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
- }
-
- params += typeString;
- paramsDecl += typeString;
- paramsDecl += ' ';
- paramsDecl += paramName;
- args += paramName;
-
- if(!isOutParam)
- {
- paramsAMD += typeString;
- paramsAMD += ", ";
- paramsDeclAMD += typeString;
- paramsDeclAMD += ' ';
- paramsDeclAMD += paramName;
- paramsDeclAMD += ", ";
- argsAMD += paramName;
- argsAMD += ", ";
- }
+ string paramName = fixKwd((*q)->name());
+ TypePtr type = (*q)->type();
+ bool isOutParam = (*q)->isOutParam();
+ string typeString;
+ if(isOutParam)
+ {
+ outParams.push_back(*q);
+ typeString = outputTypeToString(type, _useWstring, (*q)->getMetaData());
+ }
+ else
+ {
+ inParams.push_back(*q);
+ typeString = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
+ }
+
+ if(q != paramList.begin())
+ {
+ params += ", ";
+ paramsDecl += ", ";
+ args += ", ";
+ }
+
+ params += typeString;
+ paramsDecl += typeString;
+ paramsDecl += ' ';
+ paramsDecl += paramName;
+ args += paramName;
+
+ if(!isOutParam)
+ {
+ paramsAMD += typeString;
+ paramsAMD += ", ";
+ paramsDeclAMD += typeString;
+ paramsDeclAMD += ' ';
+ paramsDeclAMD += paramName;
+ paramsDeclAMD += ", ";
+ argsAMD += paramName;
+ argsAMD += ", ";
+ }
}
if(!cl->isLocal())
{
- if(!paramList.empty())
- {
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
- }
+ if(!paramList.empty())
+ {
+ params += ", ";
+ paramsDecl += ", ";
+ args += ", ";
+ }
- params += "const ::Ice::Current& = ::Ice::Current())";
- paramsDecl += "const ::Ice::Current& __current)";
- args += "__current)";
+ params += "const ::Ice::Current& = ::Ice::Current())";
+ paramsDecl += "const ::Ice::Current& __current)";
+ args += "__current)";
}
else
{
- params += ')';
- paramsDecl += ')';
- args += ')';
+ params += ')';
+ paramsDecl += ')';
+ args += ')';
}
paramsAMD += "const ::Ice::Current& = ::Ice::Current())";
@@ -3543,132 +3543,132 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
H << sp;
if(!amd)
{
- H << nl << deprecateSymbol << "virtual " << retS << ' ' << fixKwd(name) << params
- << (isConst ? " const" : "") << " = 0;";
+ H << nl << deprecateSymbol << "virtual " << retS << ' ' << fixKwd(name) << params
+ << (isConst ? " const" : "") << " = 0;";
}
else
{
- H << nl << deprecateSymbol << "virtual void " << name << "_async" << paramsAMD
- << (isConst ? " const" : "") << " = 0;";
- }
+ H << nl << deprecateSymbol << "virtual void " << name << "_async" << paramsAMD
+ << (isConst ? " const" : "") << " = 0;";
+ }
if(!cl->isLocal())
{
- H << nl << "::IceInternal::DispatchStatus ___" << name
- << "(::IceInternal::Incoming&, const ::Ice::Current&)" << (isConst ? " const" : "") << ';';
-
- C << sp;
- C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
- << "(::IceInternal::Incoming&";
- if(!paramList.empty() || !p->throws().empty() || ret || amd)
- {
- C << "__inS";
- }
- C << ", const ::Ice::Current& __current)" << (isConst ? " const" : "");
- C << sb;
- if(!amd)
- {
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ H << nl << "::IceInternal::DispatchStatus ___" << name
+ << "(::IceInternal::Incoming&, const ::Ice::Current&)" << (isConst ? " const" : "") << ';';
+
+ C << sp;
+ C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
+ << "(::IceInternal::Incoming&";
+ if(!paramList.empty() || !p->throws().empty() || ret || amd)
+ {
+ C << "__inS";
+ }
+ C << ", const ::Ice::Current& __current)" << (isConst ? " const" : "");
+ C << sb;
+ if(!amd)
+ {
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(derivedToBaseCompare);
+ throws.sort(derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
-
- if(!inParams.empty())
- {
- C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
- }
- if(ret || !outParams.empty() || !throws.empty())
- {
- C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
- }
- writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
- writeUnmarshalCode(C, inParams, 0, StringList(), true);
- if(p->sendsClasses())
- {
- C << nl << "__is->readPendingObjects();";
- }
- writeAllocateCode(C, outParams, 0, StringList(), _useWstring);
- if(!throws.empty())
- {
- C << nl << "try";
- C << sb;
- }
- C << nl;
- if(ret)
- {
- C << retS << " __ret = ";
- }
- C << fixKwd(name) << args << ';';
- writeMarshalCode(C, outParams, ret, p->getMetaData());
- if(p->returnsClasses())
- {
- C << nl << "__os->writePendingObjects();";
- }
- if(!throws.empty())
- {
- C << eb;
- ExceptionList::const_iterator r;
- for(r = throws.begin(); r != throws.end(); ++r)
- {
- C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
- C << sb;
- C << nl << "__os->write(__ex);";
- C << nl << "return ::IceInternal::DispatchUserException;";
- C << eb;
- }
- }
- C << nl << "return ::IceInternal::DispatchOK;";
- }
- else
- {
- C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
-
- if(!inParams.empty())
- {
- C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
- }
- writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
- writeUnmarshalCode(C, inParams, 0, StringList(), true);
- if(p->sendsClasses())
- {
- C << nl << "__is->readPendingObjects();";
- }
- C << nl << classScopedAMD << '_' << name << "Ptr __cb = new IceAsync" << classScopedAMD << '_' << name
- << "(__inS);";
- C << nl << "try";
- C << sb;
- C << nl << name << "_async" << argsAMD << ';';
- C << eb;
- C << nl << "catch(const ::Ice::Exception& __ex)";
- C << sb;
- C << nl << "__cb->ice_exception(__ex);";
- C << eb;
- C << nl << "catch(const ::std::exception& __ex)";
- C << sb;
- C << nl << "__cb->ice_exception(__ex);";
- C << eb;
- C << nl << "catch(...)";
- C << sb;
- C << nl << "__cb->ice_exception();";
- C << eb;
- C << nl << "return ::IceInternal::DispatchAsync;";
- }
- C << eb;
- }
+ C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
+ }
+ if(ret || !outParams.empty() || !throws.empty())
+ {
+ C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
+ }
+ writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
+ writeUnmarshalCode(C, inParams, 0, StringList(), true);
+ if(p->sendsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ writeAllocateCode(C, outParams, 0, StringList(), _useWstring);
+ if(!throws.empty())
+ {
+ C << nl << "try";
+ C << sb;
+ }
+ C << nl;
+ if(ret)
+ {
+ C << retS << " __ret = ";
+ }
+ C << fixKwd(name) << args << ';';
+ writeMarshalCode(C, outParams, ret, p->getMetaData());
+ if(p->returnsClasses())
+ {
+ C << nl << "__os->writePendingObjects();";
+ }
+ if(!throws.empty())
+ {
+ C << eb;
+ ExceptionList::const_iterator r;
+ for(r = throws.begin(); r != throws.end(); ++r)
+ {
+ C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
+ C << sb;
+ C << nl << "__os->write(__ex);";
+ C << nl << "return ::IceInternal::DispatchUserException;";
+ C << eb;
+ }
+ }
+ C << nl << "return ::IceInternal::DispatchOK;";
+ }
+ else
+ {
+ C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
+ }
+ writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
+ writeUnmarshalCode(C, inParams, 0, StringList(), true);
+ if(p->sendsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ C << nl << classScopedAMD << '_' << name << "Ptr __cb = new IceAsync" << classScopedAMD << '_' << name
+ << "(__inS);";
+ C << nl << "try";
+ C << sb;
+ C << nl << name << "_async" << argsAMD << ';';
+ C << eb;
+ C << nl << "catch(const ::Ice::Exception& __ex)";
+ C << sb;
+ C << nl << "__cb->ice_exception(__ex);";
+ C << eb;
+ C << nl << "catch(const ::std::exception& __ex)";
+ C << sb;
+ C << nl << "__cb->ice_exception(__ex);";
+ C << eb;
+ C << nl << "catch(...)";
+ C << sb;
+ C << nl << "__cb->ice_exception();";
+ C << eb;
+ C << nl << "return ::IceInternal::DispatchAsync;";
+ }
+ C << eb;
+ }
}
void
@@ -3699,41 +3699,41 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
if(override)
{
- H << nl << "virtual void __incRef();";
+ H << nl << "virtual void __incRef();";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__incRef()";
- C << sb;
- C << nl << "__gcIncRef();";
- C << eb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__incRef()";
+ C << sb;
+ C << nl << "__gcIncRef();";
+ C << eb;
- H << nl << "virtual void __decRef();";
+ H << nl << "virtual void __decRef();";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__decRef()";
- C << sb;
- C << nl << "__gcDecRef();";
- C << eb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__decRef()";
+ C << sb;
+ C << nl << "__gcDecRef();";
+ C << eb;
- H << nl << "virtual void __addObject(::IceInternal::GCCountMap&);";
+ H << nl << "virtual void __addObject(::IceInternal::GCCountMap&);";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__addObject(::IceInternal::GCCountMap& _c)";
- C << sb;
- C << nl << "::IceInternal::GCCountMap::iterator pos = _c.find(this);";
- C << nl << "if(pos == _c.end())";
- C << sb;
- C << nl << "_c[this] = 1;";
- C << eb;
- C << nl << "else";
- C << sb;
- C << nl << "++pos->second;";
- C << eb;
- C << eb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__addObject(::IceInternal::GCCountMap& _c)";
+ C << sb;
+ C << nl << "::IceInternal::GCCountMap::iterator pos = _c.find(this);";
+ C << nl << "if(pos == _c.end())";
+ C << sb;
+ C << nl << "_c[this] = 1;";
+ C << eb;
+ C << nl << "else";
+ C << sb;
+ C << nl << "++pos->second;";
+ C << eb;
+ C << eb;
- H << nl << "virtual bool __usesClasses();";
+ H << nl << "virtual bool __usesClasses();";
- C << sp << nl << "bool" << nl << scoped.substr(2) << "::__usesClasses()";
- C << sb;
- C << nl << "return true;";
- C << eb;
+ C << sp << nl << "bool" << nl << scoped.substr(2) << "::__usesClasses()";
+ C << sb;
+ C << nl << "return true;";
+ C << eb;
}
//
@@ -3742,41 +3742,41 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
//
if(canBeCyclic)
{
- H << nl << "virtual void __gcReachable(::IceInternal::GCCountMap&) const;";
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcReachable(::IceInternal::GCCountMap& _c) const";
- C << sb;
-
- bool hasCyclicBase = hasBaseClass && bases.front()->canBeCyclic();
- if(hasCyclicBase)
- {
- emitUpcall(bases.front(), "::__gcReachable(_c);");
- }
- for(DataMemberList::const_iterator i = dataMembers.begin(); i != dataMembers.end(); ++i)
- {
- if((*i)->type()->usesClasses())
- {
- emitGCInsertCode((*i)->type(), fixKwd((*i)->name()), "", 0);
- }
- }
- C << eb;
-
- H << nl << "virtual void __gcClear();";
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcClear()";
- C << sb;
- if(hasCyclicBase)
- {
- emitUpcall(bases.front(), "::__gcClear();");
- }
- for(DataMemberList::const_iterator j = dataMembers.begin(); j != dataMembers.end(); ++j)
- {
- if((*j)->type()->usesClasses())
- {
- emitGCClearCode((*j)->type(), fixKwd((*j)->name()), "", 0);
- }
- }
- C << eb;
+ H << nl << "virtual void __gcReachable(::IceInternal::GCCountMap&) const;";
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcReachable(::IceInternal::GCCountMap& _c) const";
+ C << sb;
+
+ bool hasCyclicBase = hasBaseClass && bases.front()->canBeCyclic();
+ if(hasCyclicBase)
+ {
+ emitUpcall(bases.front(), "::__gcReachable(_c);");
+ }
+ for(DataMemberList::const_iterator i = dataMembers.begin(); i != dataMembers.end(); ++i)
+ {
+ if((*i)->type()->usesClasses())
+ {
+ emitGCInsertCode((*i)->type(), fixKwd((*i)->name()), "", 0);
+ }
+ }
+ C << eb;
+
+ H << nl << "virtual void __gcClear();";
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcClear()";
+ C << sb;
+ if(hasCyclicBase)
+ {
+ emitUpcall(bases.front(), "::__gcClear();");
+ }
+ for(DataMemberList::const_iterator j = dataMembers.begin(); j != dataMembers.end(); ++j)
+ {
+ if((*j)->type()->usesClasses())
+ {
+ emitGCClearCode((*j)->type(), fixKwd((*j)->name()), "", 0);
+ }
+ }
+ C << eb;
}
}
@@ -3786,60 +3786,60 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& pref
if((BuiltinPtr::dynamicCast(p) && BuiltinPtr::dynamicCast(p)->kind() == Builtin::KindObject)
|| ClassDeclPtr::dynamicCast(p))
{
- C << nl << "if(" << prefix << name << ')';
- C << sb;
- ClassDeclPtr decl = ClassDeclPtr::dynamicCast(p);
- if(decl)
- {
- C << nl << decl->scope() << "__addObject(" << prefix << name << ", _c);";
- }
- else
- {
- C << nl << prefix << name << "->__addObject(_c);";
- }
- C << eb;
+ C << nl << "if(" << prefix << name << ')';
+ C << sb;
+ ClassDeclPtr decl = ClassDeclPtr::dynamicCast(p);
+ if(decl)
+ {
+ C << nl << decl->scope() << "__addObject(" << prefix << name << ", _c);";
+ }
+ else
+ {
+ C << nl << prefix << name << "->__addObject(_c);";
+ }
+ C << eb;
}
else if(StructPtr::dynamicCast(p))
{
StructPtr s = StructPtr::dynamicCast(p);
- DataMemberList dml = s->dataMembers();
- for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
- {
- if((*i)->type()->usesClasses())
- {
- emitGCInsertCode((*i)->type(), prefix + name + ".", fixKwd((*i)->name()), ++level);
- }
- }
+ DataMemberList dml = s->dataMembers();
+ for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
+ {
+ if((*i)->type()->usesClasses())
+ {
+ emitGCInsertCode((*i)->type(), prefix + name + ".", fixKwd((*i)->name()), ++level);
+ }
+ }
}
else if(DictionaryPtr::dynamicCast(p))
{
DictionaryPtr d = DictionaryPtr::dynamicCast(p);
- string scoped = fixKwd(d->scoped());
- ostringstream tmp;
- tmp << "_i" << level;
- string iterName = tmp.str();
- C << sb;
- C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << prefix + name
+ string scoped = fixKwd(d->scoped());
+ ostringstream tmp;
+ tmp << "_i" << level;
+ string iterName = tmp.str();
+ C << sb;
+ C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << prefix + name
<< ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
- C << sb;
- emitGCInsertCode(d->valueType(), "", string("(*") + iterName + ").second", ++level);
- C << eb;
- C << eb;
+ C << sb;
+ emitGCInsertCode(d->valueType(), "", string("(*") + iterName + ").second", ++level);
+ C << eb;
+ C << eb;
}
else if(SequencePtr::dynamicCast(p))
{
- SequencePtr s = SequencePtr::dynamicCast(p);
- string scoped = fixKwd(s->scoped());
- ostringstream tmp;
- tmp << "_i" << level;
- string iterName = tmp.str();
- C << sb;
- C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << prefix + name
+ SequencePtr s = SequencePtr::dynamicCast(p);
+ string scoped = fixKwd(s->scoped());
+ ostringstream tmp;
+ tmp << "_i" << level;
+ string iterName = tmp.str();
+ C << sb;
+ C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << prefix + name
<< ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
- C << sb;
- emitGCInsertCode(s->type(), string("(*") + iterName + ")", "", ++level);
- C << eb;
- C << eb;
+ C << sb;
+ emitGCInsertCode(s->type(), string("(*") + iterName + ")", "", ++level);
+ C << eb;
+ C << eb;
}
}
@@ -3849,71 +3849,71 @@ Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& prefi
if((BuiltinPtr::dynamicCast(p) && BuiltinPtr::dynamicCast(p)->kind() == Builtin::KindObject)
|| ClassDeclPtr::dynamicCast(p))
{
- C << nl << "if(" << prefix << name << ")";
- C << sb;
- ClassDeclPtr decl = ClassDeclPtr::dynamicCast(p);
- if(decl)
- {
- C << nl << "if(" << decl->scope() << "__usesClasses(" << prefix << name << "))";
- C << sb;
- C << nl << decl->scope() << "__decRefUnsafe(" << prefix << name << ");";
- C << nl << decl->scope() << "__clearHandleUnsafe(" << prefix << name << ");";
- }
- else
- {
- C << nl << "if(" << prefix << name << "->__usesClasses())";
- C << sb;
- C << nl << prefix << name << "->__decRefUnsafe();";
- C << nl << prefix << name << ".__clearHandleUnsafe();";
- }
- C << eb;
- C << nl << "else";
- C << sb;
- C << nl << prefix << name << " = 0;";
- C << eb;
- C << eb;
+ C << nl << "if(" << prefix << name << ")";
+ C << sb;
+ ClassDeclPtr decl = ClassDeclPtr::dynamicCast(p);
+ if(decl)
+ {
+ C << nl << "if(" << decl->scope() << "__usesClasses(" << prefix << name << "))";
+ C << sb;
+ C << nl << decl->scope() << "__decRefUnsafe(" << prefix << name << ");";
+ C << nl << decl->scope() << "__clearHandleUnsafe(" << prefix << name << ");";
+ }
+ else
+ {
+ C << nl << "if(" << prefix << name << "->__usesClasses())";
+ C << sb;
+ C << nl << prefix << name << "->__decRefUnsafe();";
+ C << nl << prefix << name << ".__clearHandleUnsafe();";
+ }
+ C << eb;
+ C << nl << "else";
+ C << sb;
+ C << nl << prefix << name << " = 0;";
+ C << eb;
+ C << eb;
}
else if(StructPtr::dynamicCast(p))
{
- StructPtr s = StructPtr::dynamicCast(p);
- DataMemberList dml = s->dataMembers();
- for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
- {
- if((*i)->type()->usesClasses())
- {
- emitGCClearCode((*i)->type(), prefix + name + ".", fixKwd((*i)->name()), ++level);
- }
- }
+ StructPtr s = StructPtr::dynamicCast(p);
+ DataMemberList dml = s->dataMembers();
+ for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
+ {
+ if((*i)->type()->usesClasses())
+ {
+ emitGCClearCode((*i)->type(), prefix + name + ".", fixKwd((*i)->name()), ++level);
+ }
+ }
}
else if(DictionaryPtr::dynamicCast(p))
{
- DictionaryPtr d = DictionaryPtr::dynamicCast(p);
- string scoped = fixKwd(d->scoped());
- ostringstream tmp;
- tmp << "_i" << level;
- string iterName = tmp.str();
- C << sb;
- C << nl << "for(" << scoped << "::iterator " << iterName << " = " << prefix + name
+ DictionaryPtr d = DictionaryPtr::dynamicCast(p);
+ string scoped = fixKwd(d->scoped());
+ ostringstream tmp;
+ tmp << "_i" << level;
+ string iterName = tmp.str();
+ C << sb;
+ C << nl << "for(" << scoped << "::iterator " << iterName << " = " << prefix + name
<< ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
- C << sb;
- emitGCClearCode(d->valueType(), "", string("(*") + iterName + ").second", ++level);
- C << eb;
- C << eb;
+ C << sb;
+ emitGCClearCode(d->valueType(), "", string("(*") + iterName + ").second", ++level);
+ C << eb;
+ C << eb;
}
else if(SequencePtr::dynamicCast(p))
{
- SequencePtr s = SequencePtr::dynamicCast(p);
- string scoped = fixKwd(s->scoped());
- ostringstream tmp;
- tmp << "_i" << level;
- string iterName = tmp.str();
- C << sb;
- C << nl << "for(" << scoped << "::iterator " << iterName << " = " << prefix + name
+ SequencePtr s = SequencePtr::dynamicCast(p);
+ string scoped = fixKwd(s->scoped());
+ ostringstream tmp;
+ tmp << "_i" << level;
+ string iterName = tmp.str();
+ C << sb;
+ C << nl << "for(" << scoped << "::iterator " << iterName << " = " << prefix + name
<< ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
- C << sb;
- emitGCClearCode(s->type(), "", string("(*") + iterName + ")", ++level);
- C << eb;
- C << eb;;
+ C << sb;
+ emitGCClearCode(s->type(), "", string("(*") + iterName + ")", ++level);
+ C << eb;
+ C << eb;;
}
}
@@ -3929,21 +3929,21 @@ Slice::Gen::ObjectVisitor::emitVirtualBaseInitializers(const ClassDefPtr& p)
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
- if(emitVirtualBaseInitializers(bases.front()))
- {
- C << ',';
- }
+ if(emitVirtualBaseInitializers(bases.front()))
+ {
+ C << ',';
+ }
}
string upcall = "(";
DataMemberList::const_iterator q;
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- if(q != allDataMembers.begin())
- {
- upcall += ", ";
- }
- upcall += "__ice_" + (*q)->name();
+ if(q != allDataMembers.begin())
+ {
+ upcall += ", ";
+ }
+ upcall += "__ice_" + (*q)->name();
}
upcall += ")";
@@ -3973,47 +3973,47 @@ Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
- allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
+ string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
+ allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
}
if(!allDataMembers.empty())
{
- C << sp << nl << p->scoped().substr(2) << "::" << fixKwd(p->name()) << spar << allParamDecls << epar << " :";
- C.inc();
-
- DataMemberList dataMembers = p->dataMembers();
-
- ClassList bases = p->bases();
- ClassDefPtr base;
- if(!bases.empty() && !bases.front()->isInterface())
- {
- if(emitVirtualBaseInitializers(bases.front()))
- {
- if(!dataMembers.empty())
- {
- C << ',';
- }
- }
- }
-
- if(!dataMembers.empty())
- {
- C << nl;
- }
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- if(q != dataMembers.begin())
- {
- C << ',' << nl;
- }
- string memberName = fixKwd((*q)->name());
- C << memberName << '(' << "__ice_" << (*q)->name() << ')';
- }
-
- C.dec();
- C << sb;
- C << eb;
+ C << sp << nl << p->scoped().substr(2) << "::" << fixKwd(p->name()) << spar << allParamDecls << epar << " :";
+ C.inc();
+
+ DataMemberList dataMembers = p->dataMembers();
+
+ ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ if(emitVirtualBaseInitializers(bases.front()))
+ {
+ if(!dataMembers.empty())
+ {
+ C << ',';
+ }
+ }
+ }
+
+ if(!dataMembers.empty())
+ {
+ C << nl;
+ }
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ if(q != dataMembers.begin())
+ {
+ C << ',' << nl;
+ }
+ string memberName = fixKwd((*q)->name());
+ C << memberName << '(' << "__ice_" << (*q)->name() << ')';
+ }
+
+ C.dec();
+ C << sb;
+ C << eb;
}
}
@@ -4043,7 +4043,7 @@ Slice::Gen::IceInternalVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasClassDecls())
{
- return false;
+ return false;
}
H << sp;
@@ -4069,9 +4069,9 @@ Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p)
H << nl << _dllExport << "void decRef(" << scoped << "*);";
if(!p->isLocal())
{
- H << sp;
- H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);";
- H << nl << _dllExport << "void decRef(::IceProxy" << scoped << "*);";
+ H << sp;
+ H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);";
+ H << nl << _dllExport << "void decRef(::IceProxy" << scoped << "*);";
}
}
@@ -4094,17 +4094,17 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
- C << sp;
- C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)";
- C << sb;
- C << nl << "p->__incRef();";
- C << eb;
+ C << sp;
+ C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)";
+ C << sb;
+ C << nl << "p->__incRef();";
+ C << eb;
- C << sp;
- C << nl << "void" << nl << "IceInternal::decRef(::IceProxy" << scoped << "* p)";
- C << sb;
- C << nl << "p->__decRef();";
- C << eb;
+ C << sp;
+ C << nl << "void" << nl << "IceInternal::decRef(::IceProxy" << scoped << "* p)";
+ C << sb;
+ C << nl << "p->__decRef();";
+ C << eb;
}
return true;
@@ -4120,7 +4120,7 @@ Slice::Gen::HandleVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasClassDecls())
{
- return false;
+ return false;
}
string name = fixKwd(p->name());
@@ -4149,30 +4149,30 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
if(!p->isLocal())
{
- H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
+ H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
- H << sp;
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Prx&);";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Ptr&);";
- H << nl << _dllExport << "void __patch__" << name << "Ptr(void*, ::Ice::ObjectPtr&);";
- if(_stream)
- {
+ H << sp;
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Prx&);";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Ptr&);";
+ H << nl << _dllExport << "void __patch__" << name << "Ptr(void*, ::Ice::ObjectPtr&);";
+ if(_stream)
+ {
H << sp;
- H << nl << _dllExport << "void ice_write" << name << "Prx(const ::Ice::OutputStreamPtr&, const " << name
+ H << nl << _dllExport << "void ice_write" << name << "Prx(const ::Ice::OutputStreamPtr&, const " << name
<< "Prx&);";
- H << nl << _dllExport << "void ice_read" << name << "Prx(const ::Ice::InputStreamPtr&, " << name
+ H << nl << _dllExport << "void ice_read" << name << "Prx(const ::Ice::InputStreamPtr&, " << name
<< "Prx&);";
H << nl << _dllExport << "void ice_write" << name << "(const ::Ice::OutputStreamPtr&, const "
<< name << "Ptr&);";
H << nl << _dllExport << "void ice_read" << name << "(const ::Ice::InputStreamPtr&, " << name << "Ptr&);";
- }
+ }
- H << sp << nl << _dllExport << "void __addObject(const " << name << "Ptr&, ::IceInternal::GCCountMap&);";
- H << nl << _dllExport << "bool __usesClasses(const " << name << "Ptr&);";
- H << nl << _dllExport << "void __decRefUnsafe(const " << name << "Ptr&);";
- H << nl << _dllExport << "void __clearHandleUnsafe(" << name << "Ptr&);";
+ H << sp << nl << _dllExport << "void __addObject(const " << name << "Ptr&, ::IceInternal::GCCountMap&);";
+ H << nl << _dllExport << "bool __usesClasses(const " << name << "Ptr&);";
+ H << nl << _dllExport << "void __decRefUnsafe(const " << name << "Ptr&);";
+ H << nl << _dllExport << "void __clearHandleUnsafe(" << name << "Ptr&);";
}
}
@@ -4182,84 +4182,84 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
string name = p->name();
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- string factory;
- string type;
- if(!p->isAbstract())
- {
- type = scoped + "::ice_staticId()";
- factory = scoped + "::ice_factory()";
- }
- else
- {
- type = "\"\"";
- factory = "0";
- }
-
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << scope << name << "Prx& v)";
- C << sb;
- C << nl << "__os->write(::Ice::ObjectPrx(v));";
- C << eb;
-
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
- << scope << name << "Prx& v)";
- C << sb;
- C << nl << "::Ice::ObjectPrx proxy;";
- C << nl << "__is->read(proxy);";
- C << nl << "if(!proxy)";
- C << sb;
- C << nl << "v = 0;";
- C << eb;
- C << nl << "else";
- C << sb;
- C << nl << "v = new ::IceProxy" << scoped << ';';
- C << nl << "v->__copyFrom(proxy);";
- C << eb;
- C << eb;
-
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << scope << name << "Ptr& v)";
- C << sb;
- C << nl << "__os->write(::Ice::ObjectPtr(v));";
- C << eb;
-
- if(_stream)
- {
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "ice_write" << name
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
+
+ string factory;
+ string type;
+ if(!p->isAbstract())
+ {
+ type = scoped + "::ice_staticId()";
+ factory = scoped + "::ice_factory()";
+ }
+ else
+ {
+ type = "\"\"";
+ factory = "0";
+ }
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << scope << name << "Prx& v)";
+ C << sb;
+ C << nl << "__os->write(::Ice::ObjectPrx(v));";
+ C << eb;
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
+ << scope << name << "Prx& v)";
+ C << sb;
+ C << nl << "::Ice::ObjectPrx proxy;";
+ C << nl << "__is->read(proxy);";
+ C << nl << "if(!proxy)";
+ C << sb;
+ C << nl << "v = 0;";
+ C << eb;
+ C << nl << "else";
+ C << sb;
+ C << nl << "v = new ::IceProxy" << scoped << ';';
+ C << nl << "v->__copyFrom(proxy);";
+ C << eb;
+ C << eb;
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << scope << name << "Ptr& v)";
+ C << sb;
+ C << nl << "__os->write(::Ice::ObjectPtr(v));";
+ C << eb;
+
+ if(_stream)
+ {
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "ice_write" << name
<< "Prx(const ::Ice::OutputStreamPtr& __outS, const " << scope << name << "Prx& v)";
- C << sb;
- C << nl << "__outS->writeProxy(v);";
- C << eb;
+ C << sb;
+ C << nl << "__outS->writeProxy(v);";
+ C << eb;
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "ice_read" << name
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "ice_read" << name
<< "Prx(const ::Ice::InputStreamPtr& __inS, " << scope << name << "Prx& v)";
- C << sb;
- C << nl << "::Ice::ObjectPrx proxy = __inS->readProxy();";
- C << nl << "if(!proxy)";
- C << sb;
- C << nl << "v = 0;";
- C << eb;
- C << nl << "else";
- C << sb;
- C << nl << "v = new ::IceProxy" << scoped << ';';
- C << nl << "v->__copyFrom(proxy);";
- C << eb;
- C << eb;
-
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "ice_write" << name
+ C << sb;
+ C << nl << "::Ice::ObjectPrx proxy = __inS->readProxy();";
+ C << nl << "if(!proxy)";
+ C << sb;
+ C << nl << "v = 0;";
+ C << eb;
+ C << nl << "else";
+ C << sb;
+ C << nl << "v = new ::IceProxy" << scoped << ';';
+ C << nl << "v->__copyFrom(proxy);";
+ C << eb;
+ C << eb;
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "ice_write" << name
<< "(const ::Ice::OutputStreamPtr& __outS, const " << scope << name << "Ptr& v)";
- C << sb;
- C << nl << "__outS->writeObject(v);";
- C << eb;
+ C << sb;
+ C << nl << "__outS->writeObject(v);";
+ C << eb;
C << sp;
C << nl << "void" << nl << scope.substr(2) << "ice_read" << name << "(const ::Ice::InputStreamPtr& __inS, "
@@ -4269,7 +4269,7 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
<< name << "Ptr, &__v);";
C << nl << "__inS->readObject(__cb);";
C << eb;
- }
+ }
}
return true;
@@ -4375,48 +4375,48 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const Str
{
ProxyPtr prx = ProxyPtr::dynamicCast(type);
if(prx)
- {
- out << nl << "return 0;";
- }
- else
- {
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
- {
- out << nl << "return 0;";
- }
- else
- {
- StructPtr st = StructPtr::dynamicCast(type);
- if(st)
- {
- out << nl << "return " << fixKwd(st->scoped()) << "();";
- }
- else
- {
- EnumPtr en = EnumPtr::dynamicCast(type);
- if(en)
- {
- EnumeratorList enumerators = en->getEnumerators();
- out << nl << "return " << fixKwd(en->scope()) << fixKwd(enumerators.front()->name()) << ';';
- }
- else
- {
- SequencePtr seq = SequencePtr::dynamicCast(type);
- if(seq)
- {
- out << nl << "return " << typeToString(seq, _useWstring, metaData) << "();";
- }
- else
- {
- DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
- assert(dict);
- out << nl << "return " << fixKwd(dict->scoped()) << "();";
- }
- }
- }
- }
- }
+ {
+ out << nl << "return 0;";
+ }
+ else
+ {
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ if(cl)
+ {
+ out << nl << "return 0;";
+ }
+ else
+ {
+ StructPtr st = StructPtr::dynamicCast(type);
+ if(st)
+ {
+ out << nl << "return " << fixKwd(st->scoped()) << "();";
+ }
+ else
+ {
+ EnumPtr en = EnumPtr::dynamicCast(type);
+ if(en)
+ {
+ EnumeratorList enumerators = en->getEnumerators();
+ out << nl << "return " << fixKwd(en->scope()) << fixKwd(enumerators.front()->name()) << ';';
+ }
+ else
+ {
+ SequencePtr seq = SequencePtr::dynamicCast(type);
+ if(seq)
+ {
+ out << nl << "return " << typeToString(seq, _useWstring, metaData) << "();";
+ }
+ else
+ {
+ DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
+ assert(dict);
+ out << nl << "return " << fixKwd(dict->scoped()) << "();";
+ }
+ }
+ }
+ }
+ }
}
}
@@ -4475,14 +4475,14 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
{
H << ',' << nl << "virtual public " << fixKwd((*q)->scope());
- if((*q)->isAbstract())
- {
- H << (*q)->name() << "I";
- }
- else
- {
- H << fixKwd((*q)->name());
- }
+ if((*q)->isAbstract())
+ {
+ H << (*q)->name() << "I";
+ }
+ else
+ {
+ H << fixKwd((*q)->name());
+ }
}
H.restoreIndent();
@@ -4531,7 +4531,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!(*q)->isOutParam())
{
C << ',' << nl << inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData()) << ' '
- << fixKwd((*q)->name());
+ << fixKwd((*q)->name());
}
}
C << ',' << nl << "const Ice::Current& current";
@@ -4592,23 +4592,23 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
H << ',' << nl;
}
- StringList metaData = (*q)->getMetaData();
+ StringList metaData = (*q)->getMetaData();
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
- //
- // Work around for Sun CC 5.5 bug #4853566
- //
- string typeString;
- if((*q)->isOutParam())
- {
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ //
+ // Work around for Sun CC 5.5 bug #4853566
+ //
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
#else
string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
- : inputTypeToString((*q)->type(), _useWstring, metaData);
+ : inputTypeToString((*q)->type(), _useWstring, metaData);
#endif
H << typeString;
}
@@ -4627,7 +4627,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
H << ")" << (isConst ? " const" : "") << ';';
C << sp << nl << retS << nl;
- C << scope.substr(2) << name << "I::" << fixKwd(opName) << '(';
+ C << scope.substr(2) << name << "I::" << fixKwd(opName) << '(';
C.useCurrentPosAsIndent();
for(q = paramList.begin(); q != paramList.end(); ++q)
{
@@ -4635,23 +4635,23 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
C << ',' << nl;
}
- StringList metaData = (*q)->getMetaData();
+ StringList metaData = (*q)->getMetaData();
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
- //
- // Work around for Sun CC 5.5 bug #4853566
- //
- string typeString;
- if((*q)->isOutParam())
- {
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ //
+ // Work around for Sun CC 5.5 bug #4853566
+ //
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
#else
string typeString = (*q)->isOutParam() ? outputTypeToString((*q)->type(), _useWstring, metaData)
- : inputTypeToString((*q)->type(), _useWstring, metaData);
+ : inputTypeToString((*q)->type(), _useWstring, metaData);
#endif
C << typeString << ' ' << fixKwd((*q)->name());
}
@@ -4665,7 +4665,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
}
C.restoreIndent();
C << ')';
- C << (isConst ? " const" : "");
+ C << (isConst ? " const" : "");
C << sb;
if(ret)
@@ -4694,7 +4694,7 @@ Slice::Gen::AsyncVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls() || (!p->hasContentsWithMetaData("ami") && !p->hasContentsWithMetaData("amd")))
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -4736,7 +4736,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
if(cl->isLocal() ||
(!cl->hasMetaData("ami") && !p->hasMetaData("ami") && !cl->hasMetaData("amd") && !p->hasMetaData("amd")))
{
- return;
+ return;
}
string name = p->name();
@@ -4765,10 +4765,10 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
if(ret)
{
- params.push_back(retS);
- paramsAMD.push_back(inputTypeToString(ret, _useWstring, p->getMetaData()));
- paramsDecl.push_back(retS + " __ret");
- args.push_back("__ret");
+ params.push_back(retS);
+ paramsAMD.push_back(inputTypeToString(ret, _useWstring, p->getMetaData()));
+ paramsDecl.push_back(retS + " __ret");
+ args.push_back("__ret");
}
ParamDeclList inParams;
@@ -4776,26 +4776,26 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd((*q)->name());
- TypePtr type = (*q)->type();
- string typeString = inputTypeToString(type, _useWstring, (*q)->getMetaData());
+ string paramName = fixKwd((*q)->name());
+ TypePtr type = (*q)->type();
+ string typeString = inputTypeToString(type, _useWstring, (*q)->getMetaData());
- if((*q)->isOutParam())
- {
- params.push_back(typeString);
- paramsAMD.push_back(inputTypeToString(type, _useWstring, (*q)->getMetaData()));
- paramsDecl.push_back(typeString + ' ' + paramName);
- args.push_back(paramName);
+ if((*q)->isOutParam())
+ {
+ params.push_back(typeString);
+ paramsAMD.push_back(inputTypeToString(type, _useWstring, (*q)->getMetaData()));
+ paramsDecl.push_back(typeString + ' ' + paramName);
+ args.push_back(paramName);
- outParams.push_back(*q);
- }
- else
- {
- paramsInvoke.push_back(typeString);
- paramsDeclInvoke.push_back(typeString + ' ' + paramName);
+ outParams.push_back(*q);
+ }
+ else
+ {
+ paramsInvoke.push_back(typeString);
+ paramsDeclInvoke.push_back(typeString + ' ' + paramName);
- inParams.push_back(*q);
- }
+ inParams.push_back(*q);
+ }
}
paramsInvoke.push_back("const ::Ice::Context*");
@@ -4803,123 +4803,123 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
if(cl->hasMetaData("ami") || p->hasMetaData("ami"))
{
- H << sp << nl << "class " << _dllExport << classNameAMI << '_' << name
- << " : public ::IceInternal::OutgoingAsync";
- H << sb;
- H.dec();
- H << nl << "public:";
- H.inc();
- H << sp;
- H << nl << "virtual void ice_response" << spar << params << epar << " = 0;";
- H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;";
- H << sp;
- H << nl << "void __invoke" << spar << paramsInvoke << epar << ';';
- H << sp;
- H.dec();
- H << nl << "protected:";
- H.inc();
- H << sp;
- H << nl << "virtual void __response(bool);";
- H << eb << ';';
- H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMI << '_' << name << "> " << classNameAMI
- << '_' << name << "Ptr;";
-
- string flatName = p->flattenedScope() + name + "_name";
-
- C << sp << nl << "void" << nl << classScopedAMI.substr(2) << '_' << name << "::__invoke" << spar
- << paramsDeclInvoke << epar;
- C << sb;
- C << nl << "try";
- C << sb;
- C << nl << "__prepare(__prx, " << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);";
- writeMarshalCode(C, inParams, 0, StringList(), true);
- if(p->sendsClasses())
- {
- C << nl << "__os->writePendingObjects();";
- }
- C << nl << "__os->endWriteEncaps();";
- C << eb;
- C << nl << "catch(const ::Ice::LocalException& __ex)";
- C << sb;
- C << nl << "__finished(__ex);";
- C << nl << "return;";
- C << eb;
- C << nl << "__send();";
- C << eb;
-
- C << sp << nl << "void" << nl << classScopedAMI.substr(2) << '_' << name << "::__response(bool __ok)";
- C << sb;
- writeAllocateCode(C, outParams, ret, p->getMetaData(), _useWstring, true);
- C << nl << "try";
- C << sb;
- C << nl << "if(!__ok)";
- C << sb;
- C << nl << "try";
- C << sb;
- C << nl << "__is->throwException();";
- C << eb;
- //
- // Generate a catch block for each legal user exception.
- // (See comment in DelegateMVisitor::visitOperation() for details.)
- //
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
+ H << sp << nl << "class " << _dllExport << classNameAMI << '_' << name
+ << " : public ::IceInternal::OutgoingAsync";
+ H << sb;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
+ H << sp;
+ H << nl << "virtual void ice_response" << spar << params << epar << " = 0;";
+ H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;";
+ H << sp;
+ H << nl << "void __invoke" << spar << paramsInvoke << epar << ';';
+ H << sp;
+ H.dec();
+ H << nl << "protected:";
+ H.inc();
+ H << sp;
+ H << nl << "virtual void __response(bool);";
+ H << eb << ';';
+ H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMI << '_' << name << "> " << classNameAMI
+ << '_' << name << "Ptr;";
+
+ string flatName = p->flattenedScope() + name + "_name";
+
+ C << sp << nl << "void" << nl << classScopedAMI.substr(2) << '_' << name << "::__invoke" << spar
+ << paramsDeclInvoke << epar;
+ C << sb;
+ C << nl << "try";
+ C << sb;
+ C << nl << "__prepare(__prx, " << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);";
+ writeMarshalCode(C, inParams, 0, StringList(), true);
+ if(p->sendsClasses())
+ {
+ C << nl << "__os->writePendingObjects();";
+ }
+ C << nl << "__os->endWriteEncaps();";
+ C << eb;
+ C << nl << "catch(const ::Ice::LocalException& __ex)";
+ C << sb;
+ C << nl << "__finished(__ex);";
+ C << nl << "return;";
+ C << eb;
+ C << nl << "__send();";
+ C << eb;
+
+ C << sp << nl << "void" << nl << classScopedAMI.substr(2) << '_' << name << "::__response(bool __ok)";
+ C << sb;
+ writeAllocateCode(C, outParams, ret, p->getMetaData(), _useWstring, true);
+ C << nl << "try";
+ C << sb;
+ C << nl << "if(!__ok)";
+ C << sb;
+ C << nl << "try";
+ C << sb;
+ C << nl << "__is->throwException();";
+ C << eb;
+ //
+ // Generate a catch block for each legal user exception.
+ // (See comment in DelegateMVisitor::visitOperation() for details.)
+ //
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
#if defined(__SUNPRO_CC)
- throws.sort(derivedToBaseCompare);
+ throws.sort(derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
- {
- string scoped = (*i)->scoped();
- C << nl << "catch(const " << fixKwd((*i)->scoped()) << "& __ex)";
- C << sb;
- C << nl << "ice_exception(__ex);";
- C << nl << "return;";
- C << eb;
- }
- C << nl << "catch(const ::Ice::UserException& __ex)";
- C << sb;
- C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());";
- C << eb;
- C << eb;
-
- writeUnmarshalCode(C, outParams, 0, StringList(), true);
- if(ret)
- {
- writeMarshalUnmarshalCode(C, ret, "__ret", false, "", true, p->getMetaData(), true);
- }
- if(p->returnsClasses())
- {
- C << nl << "__is->readPendingObjects();";
- }
- C << eb;
- C << nl << "catch(const ::Ice::LocalException& __ex)";
- C << sb;
- C << nl << "__finished(__ex);";
- C << nl << "return;";
- C << eb;
- C << nl << "ice_response" << spar << args << epar << ';';
- C << eb;
+ for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
+ {
+ string scoped = (*i)->scoped();
+ C << nl << "catch(const " << fixKwd((*i)->scoped()) << "& __ex)";
+ C << sb;
+ C << nl << "ice_exception(__ex);";
+ C << nl << "return;";
+ C << eb;
+ }
+ C << nl << "catch(const ::Ice::UserException& __ex)";
+ C << sb;
+ C << nl << "throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());";
+ C << eb;
+ C << eb;
+
+ writeUnmarshalCode(C, outParams, 0, StringList(), true);
+ if(ret)
+ {
+ writeMarshalUnmarshalCode(C, ret, "__ret", false, "", true, p->getMetaData(), true);
+ }
+ if(p->returnsClasses())
+ {
+ C << nl << "__is->readPendingObjects();";
+ }
+ C << eb;
+ C << nl << "catch(const ::Ice::LocalException& __ex)";
+ C << sb;
+ C << nl << "__finished(__ex);";
+ C << nl << "return;";
+ C << eb;
+ C << nl << "ice_response" << spar << args << epar << ';';
+ C << eb;
}
if(cl->hasMetaData("amd") || p->hasMetaData("amd"))
{
- H << sp << nl << "class " << _dllExport << classNameAMD << '_' << name
- << " : virtual public ::IceUtil::Shared";
- H << sb;
- H.dec();
- H << nl << "public:";
- H.inc();
- H << sp;
- H << nl << "virtual void ice_response" << spar << paramsAMD << epar << " = 0;";
- H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;";
- H << nl << "virtual void ice_exception(const ::std::exception&) = 0;";
- H << nl << "virtual void ice_exception() = 0;";
- H << eb << ';';
- H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMD << '_' << name << "> "
- << classNameAMD << '_' << name << "Ptr;";
+ H << sp << nl << "class " << _dllExport << classNameAMD << '_' << name
+ << " : virtual public ::IceUtil::Shared";
+ H << sb;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
+ H << sp;
+ H << nl << "virtual void ice_response" << spar << paramsAMD << epar << " = 0;";
+ H << nl << "virtual void ice_exception(const ::Ice::Exception&) = 0;";
+ H << nl << "virtual void ice_exception(const ::std::exception&) = 0;";
+ H << nl << "virtual void ice_exception() = 0;";
+ H << eb << ';';
+ H << sp << nl << "typedef ::IceUtil::Handle< " << classScopedAMD << '_' << name << "> "
+ << classNameAMD << '_' << name << "Ptr;";
}
}
@@ -4933,7 +4933,7 @@ Slice::Gen::AsyncImplVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls() || !p->hasContentsWithMetaData("amd"))
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceAsync" << nl << '{';
@@ -4952,7 +4952,7 @@ Slice::Gen::AsyncImplVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls() || !p->hasContentsWithMetaData("amd"))
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -4993,7 +4993,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
if(cl->isLocal() || (!cl->hasMetaData("amd") && !p->hasMetaData("amd")))
{
- return;
+ return;
}
string name = p->name();
@@ -5027,38 +5027,38 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
if(ret)
{
- params += retS;
- paramsDecl += retS;
- paramsDecl += ' ';
- paramsDecl += "__ret";
- args += "__ret";
+ params += retS;
+ paramsDecl += retS;
+ paramsDecl += ' ';
+ paramsDecl += "__ret";
+ args += "__ret";
}
ParamDeclList outParams;
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if((*q)->isOutParam())
- {
- string paramName = fixKwd((*q)->name());
- TypePtr type = (*q)->type();
- string typeString = inputTypeToString(type, _useWstring, (*q)->getMetaData());
-
- if(ret || !outParams.empty())
- {
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
- }
-
- params += typeString;
- paramsDecl += typeString;
- paramsDecl += ' ';
- paramsDecl += paramName;
- args += paramName;
-
- outParams.push_back(*q);
- }
+ if((*q)->isOutParam())
+ {
+ string paramName = fixKwd((*q)->name());
+ TypePtr type = (*q)->type();
+ string typeString = inputTypeToString(type, _useWstring, (*q)->getMetaData());
+
+ if(ret || !outParams.empty())
+ {
+ params += ", ";
+ paramsDecl += ", ";
+ args += ", ";
+ }
+
+ params += typeString;
+ paramsDecl += typeString;
+ paramsDecl += ' ';
+ paramsDecl += paramName;
+ args += paramName;
+
+ outParams.push_back(*q);
+ }
}
H << sp << nl << "class " << _dllExport << classNameAMD << '_' << name
@@ -5091,24 +5091,24 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
C << sb;
if(ret || !outParams.empty())
{
- C << nl << "try";
- C << sb;
- C << nl << "::IceInternal::BasicStream* __os = this->__os();";
- writeMarshalCode(C, outParams, 0, StringList(), true);
- if(ret)
- {
- writeMarshalUnmarshalCode(C, ret, "__ret", true, "", true, p->getMetaData(), true);
- }
- if(p->returnsClasses())
- {
- C << nl << "__os->writePendingObjects();";
- }
- C << eb;
- C << nl << "catch(const ::Ice::Exception& __ex)";
- C << sb;
- C << nl << "__exception(__ex);";
- C << nl << "return;";
- C << eb;
+ C << nl << "try";
+ C << sb;
+ C << nl << "::IceInternal::BasicStream* __os = this->__os();";
+ writeMarshalCode(C, outParams, 0, StringList(), true);
+ if(ret)
+ {
+ writeMarshalUnmarshalCode(C, ret, "__ret", true, "", true, p->getMetaData(), true);
+ }
+ if(p->returnsClasses())
+ {
+ C << nl << "__os->writePendingObjects();";
+ }
+ C << eb;
+ C << nl << "catch(const ::Ice::Exception& __ex)";
+ C << sb;
+ C << nl << "__exception(__ex);";
+ C << nl << "return;";
+ C << eb;
}
C << nl << "__response(true);";
C << eb;
@@ -5118,31 +5118,31 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
C << sb;
if(throws.empty())
{
- C << nl << "__exception(ex);";
+ C << nl << "__exception(ex);";
}
else
{
- C << nl << "try";
- C << sb;
- C << nl << "ex.ice_throw();";
- C << eb;
- ExceptionList::const_iterator r;
- for(r = throws.begin(); r != throws.end(); ++r)
- {
- C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
- C << sb;
- C << nl << "__os()->write(__ex);";
- if((*r)->usesClasses())
- {
- C << nl << "__os()->writePendingObjects();";
- }
- C << nl << "__response(false);";
- C << eb;
- }
- C << nl << "catch(const ::Ice::Exception& __ex)";
- C << sb;
- C << nl << "__exception(__ex);";
- C << eb;
+ C << nl << "try";
+ C << sb;
+ C << nl << "ex.ice_throw();";
+ C << eb;
+ ExceptionList::const_iterator r;
+ for(r = throws.begin(); r != throws.end(); ++r)
+ {
+ C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
+ C << sb;
+ C << nl << "__os()->write(__ex);";
+ if((*r)->usesClasses())
+ {
+ C << nl << "__os()->writePendingObjects();";
+ }
+ C << nl << "__response(false);";
+ C << eb;
+ }
+ C << nl << "catch(const ::Ice::Exception& __ex)";
+ C << sb;
+ C << nl << "__exception(__ex);";
+ C << eb;
}
C << eb;
@@ -5185,10 +5185,10 @@ Slice::Gen::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
if(s.find(prefix) == 0)
{
string ss = s.substr(prefix.size());
- if(ss.find("include:") == 0)
- {
- continue;
- }
+ if(ss.find("include:") == 0)
+ {
+ continue;
+ }
cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
}
_history.insert(s);
@@ -5275,7 +5275,7 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p)
}
else
{
- validate(returnType, metaData, p->definitionContext()->filename(), p->line(), ami);
+ validate(returnType, metaData, p->definitionContext()->filename(), p->line(), ami);
}
}
@@ -5325,7 +5325,7 @@ Slice::Gen::MetaDataVisitor::visitConst(const ConstPtr& p)
void
Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const StringList& metaData,
- const string& file, const string& line, bool inParam)
+ const string& file, const string& line, bool inParam)
{
static const string prefix = "cpp:";
for(StringList::const_iterator p = metaData.begin(); p != metaData.end(); ++p)
@@ -5335,19 +5335,19 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin
{
if(s.find(prefix) == 0)
{
- string ss = s.substr(prefix.size());
- if(ss.find("type:wstring") == 0 || ss.find("type:string") == 0)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(cont);
- ModulePtr module = ModulePtr::dynamicCast(cont);
- ClassDefPtr clss = ClassDefPtr::dynamicCast(cont);
- StructPtr strct = StructPtr::dynamicCast(cont);
- ExceptionPtr exception = ExceptionPtr::dynamicCast(cont);
- if((builtin && builtin->kind() == Builtin::KindString) || module || clss || strct || exception)
- {
- continue;
- }
- }
+ string ss = s.substr(prefix.size());
+ if(ss.find("type:wstring") == 0 || ss.find("type:string") == 0)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(cont);
+ ModulePtr module = ModulePtr::dynamicCast(cont);
+ ClassDefPtr clss = ClassDefPtr::dynamicCast(cont);
+ StructPtr strct = StructPtr::dynamicCast(cont);
+ ExceptionPtr exception = ExceptionPtr::dynamicCast(cont);
+ if((builtin && builtin->kind() == Builtin::KindString) || module || clss || strct || exception)
+ {
+ continue;
+ }
+ }
if(SequencePtr::dynamicCast(cont))
{
if(ss.find("type:") == 0 || (inParam && (ss == "array" || ss.find("range") == 0)))
@@ -5356,9 +5356,9 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin
}
}
if(StructPtr::dynamicCast(cont) && ss.find("class") == 0)
- {
- continue;
- }
+ {
+ continue;
+ }
cout << file << ":" << line << ": warning: ignoring invalid metadata `" << s << "'" << endl;
}
diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h
index be675175fff..11ae44bf575 100644
--- a/cpp/src/slice2cpp/Gen.h
+++ b/cpp/src/slice2cpp/Gen.h
@@ -21,18 +21,18 @@ class Gen : private ::IceUtil::noncopyable
public:
Gen(const std::string&,
- const std::string&,
- const std::string&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&,
- const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&,
+ const std::string&,
bool,
bool,
bool,
- bool);
+ bool);
~Gen();
bool operator!() const; // Returns true if there was a constructor error
@@ -68,255 +68,255 @@ private:
{
public:
- GlobalIncludeVisitor(::IceUtil::Output&);
+ GlobalIncludeVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
private:
- ::IceUtil::Output& H;
+ ::IceUtil::Output& H;
- bool _finished;
+ bool _finished;
};
class TypesVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
-
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
+ TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
private:
- void emitUpcall(const ExceptionPtr&, const std::string&, bool = false);
+ void emitUpcall(const ExceptionPtr&, const std::string&, bool = false);
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
bool _stream;
- bool _doneStaticSymbol;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ bool _doneStaticSymbol;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class ProxyDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ProxyDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ProxyDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
};
class ProxyVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ProxyVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ProxyVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class DelegateVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- DelegateVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ DelegateVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class DelegateMVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- DelegateMVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ DelegateMVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class DelegateDVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- DelegateDVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ DelegateDVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class ObjectDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ObjectDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ObjectDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
};
class ObjectVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
+ ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
private:
- void emitGCFunctions(const ClassDefPtr&);
- void emitGCInsertCode(const TypePtr&, const std::string&, const std::string&, int);
- void emitGCClearCode(const TypePtr&, const std::string&, const std::string&, int);
- bool emitVirtualBaseInitializers(const ClassDefPtr&);
- void emitOneShotConstructor(const ClassDefPtr&);
- void emitUpcall(const ClassDefPtr&, const std::string&);
+ void emitGCFunctions(const ClassDefPtr&);
+ void emitGCInsertCode(const TypePtr&, const std::string&, const std::string&, int);
+ void emitGCClearCode(const TypePtr&, const std::string&, const std::string&, int);
+ bool emitVirtualBaseInitializers(const ClassDefPtr&);
+ void emitOneShotConstructor(const ClassDefPtr&);
+ void emitUpcall(const ClassDefPtr&, const std::string&);
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
bool _stream;
- bool _doneStaticSymbol;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ bool _doneStaticSymbol;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class IceInternalVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- IceInternalVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ IceInternalVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
};
class HandleVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
+ HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
bool _stream;
};
@@ -324,20 +324,20 @@ private:
{
public:
- ImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
//
// Generate code to emit a local variable declaration and initialize it
@@ -355,46 +355,46 @@ private:
{
public:
- AsyncVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ AsyncVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class AsyncImplVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- AsyncImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ AsyncImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
private:
@@ -423,7 +423,7 @@ private:
private:
void validate(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&,
- bool = false);
+ bool = false);
StringSet _history;
};
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index 0be665f5b6a..8d3c6db4d78 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -18,18 +18,18 @@ void
usage(const char* n)
{
cerr << "Usage: " << n << " [options] slice-files...\n";
- cerr <<
+ cerr <<
"Options:\n"
"-h, --help Show this message.\n"
"-v, --version Display the Ice version.\n"
"--header-ext EXT Use EXT instead of the default `h' extension.\n"
"--source-ext EXT Use EXT instead of the default `cpp' extension.\n"
- "--add-header HDR[,GUARD] Add #include for HDR (with guard GUARD) to generated source file.\n"
+ "--add-header HDR[,GUARD] Add #include for HDR (with guard GUARD) to generated source file.\n"
"-DNAME Define NAME as 1.\n"
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--include-dir DIR Use DIR as the header include directory in source files.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--dll-export SYMBOL Use SYMBOL for DLL exports.\n"
@@ -74,21 +74,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string headerExtension = opts.optArg("header-ext");
@@ -101,20 +101,20 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths;
includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -141,75 +141,75 @@ main(int argc, char* argv[])
if(args.empty())
{
- cerr << argv[0] << ": no input file" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no input file" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
int status = EXIT_SUCCESS;
for(i = args.begin(); i != args.end(); ++i)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::CPlusPlus);
- }
- else
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- return EXIT_FAILURE;
- }
-
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr u = Unit::createUnit(false, false, ice, caseSensitive);
- int parseStatus = u->parse(cppHandle, debug);
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- Gen gen(argv[0], icecpp.getBaseName(), headerExtension, sourceExtension, extraHeaders, include,
- includePaths, dllExport, output, impl, checksum, stream, ice);
- if(!gen)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- gen.generate(u);
- }
-
- u->destroy();
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::CPlusPlus);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ return EXIT_FAILURE;
+ }
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr u = Unit::createUnit(false, false, ice, caseSensitive);
+ int parseStatus = u->parse(cppHandle, debug);
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ Gen gen(argv[0], icecpp.getBaseName(), headerExtension, sourceExtension, extraHeaders, include,
+ includePaths, dllExport, output, impl, checksum, stream, ice);
+ if(!gen)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ gen.generate(u);
+ }
+
+ u->destroy();
+ }
+ }
}
return status;
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index f4f4c341824..f616f28d264 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -53,10 +53,10 @@ getDeprecateSymbol(const ContainedPtr& p1, const ContainedPtr& p2)
return deprecateSymbol;
}
-Slice::Gen::Gen(const string& name, const string& base, const string& headerExtension,
- const string& sourceExtension, const vector<string>& extraHeaders, const string& include,
- const vector<string>& includePaths, const string& dllExport, const string& dir, bool imp,
- bool ice) :
+Slice::Gen::Gen(const string& name, const string& base, const string& headerExtension,
+ const string& sourceExtension, const vector<string>& extraHeaders, const string& include,
+ const vector<string>& includePaths, const string& dllExport, const string& dir, bool imp,
+ bool ice) :
_base(base),
_headerExtension(headerExtension),
_sourceExtension(sourceExtension),
@@ -69,16 +69,16 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
{
for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
- if(p->length() && (*p)[p->length() - 1] != '/')
- {
- *p += '/';
- }
+ if(p->length() && (*p)[p->length() - 1] != '/')
+ {
+ *p += '/';
+ }
}
string::size_type pos = _base.find_last_of("/\\");
if(pos != string::npos)
{
- _base.erase(0, pos + 1);
+ _base.erase(0, pos + 1);
}
if(_impl)
@@ -132,22 +132,22 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
string fileC = _base + "." + _sourceExtension;
if(!dir.empty())
{
- fileH = dir + '/' + fileH;
- fileC = dir + '/' + fileC;
+ fileH = dir + '/' + fileH;
+ fileC = dir + '/' + fileC;
}
H.open(fileH.c_str());
if(!H)
{
- cerr << name << ": can't open `" << fileH << "' for writing" << endl;
- return;
+ cerr << name << ": can't open `" << fileH << "' for writing" << endl;
+ return;
}
C.open(fileC.c_str());
if(!C)
{
- cerr << name << ": can't open `" << fileC << "' for writing" << endl;
- return;
+ cerr << name << ": can't open `" << fileC << "' for writing" << endl;
+ return;
}
printHeader(H);
@@ -158,7 +158,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
string s = fileH;
if(_include.size())
{
- s = _include + '/' + s;
+ s = _include + '/' + s;
}
transform(s.begin(), s.end(), s.begin(), ToIfdef());
H << "\n#ifndef __" << s << "__";
@@ -202,7 +202,7 @@ Slice::Gen::generate(const UnitPtr& p)
C << "\n#include <";
if(_include.size())
{
- C << _include << '/';
+ C << _include << '/';
}
C << _base << "." << _headerExtension << ">";
@@ -217,35 +217,35 @@ Slice::Gen::generate(const UnitPtr& p)
if(p->usesProxies())
{
- H << "\n#include <IceE/Proxy.h>";
+ H << "\n#include <IceE/Proxy.h>";
}
if(p->hasNonLocalClassDefs())
{
H << "\n#ifndef ICEE_PURE_CLIENT";
- H << "\n# include <IceE/Object.h>";
- H << "\n# include <IceE/Incoming.h>";
+ H << "\n# include <IceE/Object.h>";
+ H << "\n# include <IceE/Incoming.h>";
H << "\n#endif";
- H << "\n#include <IceE/Outgoing.h>";
- C << "\n#include <IceE/Connection.h>";
- C << "\n#include <IceE/LocalException.h>";
+ H << "\n#include <IceE/Outgoing.h>";
+ C << "\n#include <IceE/Connection.h>";
+ C << "\n#include <IceE/LocalException.h>";
}
if(p->hasNonLocalExceptions())
{
- H << "\n#include <IceE/UserExceptionFactory.h>";
+ H << "\n#include <IceE/UserExceptionFactory.h>";
}
if(p->hasDataOnlyClasses() || p->hasNonLocalExceptions())
{
- H << "\n#include <IceE/FactoryTable.h>";
+ H << "\n#include <IceE/FactoryTable.h>";
}
if(p->usesNonLocals())
{
- C << "\n#include <IceE/BasicStream.h>";
+ C << "\n#include <IceE/BasicStream.h>";
C << "\n#ifndef ICEE_PURE_CLIENT";
- C << "\n# include <IceE/Object.h>";
+ C << "\n# include <IceE/Object.h>";
C << "\n#endif";
}
@@ -260,7 +260,7 @@ Slice::Gen::generate(const UnitPtr& p)
for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
{
- H << "\n#include <" << changeInclude(*q, _includePaths) << "." << _headerExtension << ">";
+ H << "\n#include <" << changeInclude(*q, _includePaths) << "." << _headerExtension << ">";
}
H << "\n#include <IceE/UndefSysMacros.h>";
@@ -279,7 +279,7 @@ Slice::Gen::generate(const UnitPtr& p)
printDllExportStuff(H, _dllExport);
if(_dllExport.size())
{
- _dllExport += " ";
+ _dllExport += " ";
}
ProxyDeclVisitor proxyDeclVisitor(H, C, _dllExport);
@@ -312,7 +312,7 @@ Slice::Gen::generate(const UnitPtr& p)
}
implH << _base << ".h>";
- writeExtraHeaders(implC);
+ writeExtraHeaders(implC);
implC << "\n#include <";
if(_include.size())
@@ -331,29 +331,29 @@ Slice::Gen::writeExtraHeaders(Output& out)
{
for(vector<string>::const_iterator i = _extraHeaders.begin(); i != _extraHeaders.end(); ++i)
{
- string hdr = *i;
- string guard;
- string::size_type pos = hdr.rfind(',');
- if(pos != string::npos)
- {
- hdr = i->substr(0, pos);
- guard = i->substr(pos + 1);
- }
- if(!guard.empty())
- {
- out << "\n#ifndef " << guard;
- out << "\n#define " << guard;
- }
- out << "\n#include <";
- if(!_include.empty())
- {
- out << _include << '/';
- }
- out << hdr << '>';
- if(!guard.empty())
- {
- out << "\n#endif";
- }
+ string hdr = *i;
+ string guard;
+ string::size_type pos = hdr.rfind(',');
+ if(pos != string::npos)
+ {
+ hdr = i->substr(0, pos);
+ guard = i->substr(pos + 1);
+ }
+ if(!guard.empty())
+ {
+ out << "\n#ifndef " << guard;
+ out << "\n#define " << guard;
+ }
+ out << "\n#include <";
+ if(!_include.empty())
+ {
+ out << _include << '/';
+ }
+ out << hdr << '>';
+ if(!guard.empty())
+ {
+ out << "\n#endif";
+ }
}
}
@@ -378,7 +378,7 @@ Slice::Gen::GlobalIncludeVisitor::visitModuleStart(const ModulePtr& p)
string s = *q;
if(s.find(includePrefix) == 0)
{
- H << nl << "#include <" << s.substr(includePrefix.size()) << ">";
+ H << nl << "#include <" << s.substr(includePrefix.size()) << ">";
}
}
_finished = true;
@@ -438,23 +438,23 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- params.push_back(fixKwd((*q)->name()));
+ params.push_back(fixKwd((*q)->name()));
}
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
- allTypes.push_back(typeName);
- allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
+ string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
+ allTypes.push_back(typeName);
+ allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
}
if(base)
{
- DataMemberList baseDataMembers = base->allDataMembers();
- for(q = baseDataMembers.begin(); q != baseDataMembers.end(); ++q)
- {
- baseParams.push_back("__ice_" + (*q)->name());
- }
+ DataMemberList baseDataMembers = base->allDataMembers();
+ for(q = baseDataMembers.begin(); q != baseDataMembers.end(); ++q)
+ {
+ baseParams.push_back("__ice_" + (*q)->name());
+ }
}
H << sp << nl << "class " << _dllExport << name << " : ";
@@ -462,11 +462,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << "public ";
if(!base)
{
- H << (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException");
+ H << (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException");
}
else
{
- H << fixKwd(base->scoped());
+ H << fixKwd(base->scoped());
}
H.restoreIndent();
H << sb;
@@ -478,96 +478,96 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << sp << nl << name << spar;
if(p->isLocal())
{
- H << "const char*" << "int";
+ H << "const char*" << "int";
}
H << epar;
if(!p->isLocal())
{
- H << " {}";
+ H << " {}";
}
else
{
- H << ';';
+ H << ';';
}
if(!allTypes.empty())
{
- H << nl;
- if(!p->isLocal() && allTypes.size() == 1)
- {
- H << "explicit ";
- }
- H << name << spar;
- if(p->isLocal())
- {
- H << "const char*" << "int";
- }
- H << allTypes << epar << ';';
+ H << nl;
+ if(!p->isLocal() && allTypes.size() == 1)
+ {
+ H << "explicit ";
+ }
+ H << name << spar;
+ if(p->isLocal())
+ {
+ H << "const char*" << "int";
+ }
+ H << allTypes << epar << ';';
}
H << nl << "virtual ~" << name << "() throw();";
H << sp;
if(p->isLocal())
{
- C << sp << nl << scoped.substr(2) << "::" << name << spar << "const char* __file" << "int __line" << epar
- << " :";
- C.inc();
- emitUpcall(base, "(__file, __line)", true);
- C.dec();
- C << sb;
- C << eb;
+ C << sp << nl << scoped.substr(2) << "::" << name << spar << "const char* __file" << "int __line" << epar
+ << " :";
+ C.inc();
+ emitUpcall(base, "(__file, __line)", true);
+ C.dec();
+ C << sb;
+ C << eb;
}
if(!allTypes.empty())
{
- C << sp << nl;
- C << scoped.substr(2) << "::" << name << spar;
- if(p->isLocal())
- {
- C << "const char* __file" << "int __line";
- }
- C << allParamDecls << epar;
- if(p->isLocal() || !baseParams.empty() || !params.empty())
- {
- C << " :";
- C.inc();
- string upcall;
- if(!allParamDecls.empty())
- {
- upcall = "(";
- if(p->isLocal())
- {
- upcall += "__file, __line";
- }
- for(pi = baseParams.begin(); pi != baseParams.end(); ++pi)
- {
- if(p->isLocal() || pi != baseParams.begin())
- {
- upcall += ", ";
- }
- upcall += *pi;
- }
- upcall += ")";
- }
- if(!params.empty())
- {
- upcall += ",";
- }
- emitUpcall(base, upcall, p->isLocal());
- }
- for(pi = params.begin(); pi != params.end(); ++pi)
- {
- if(pi != params.begin())
- {
- C << ",";
- }
- C << nl << *pi << "(__ice_" << *pi << ')';
- }
- if(p->isLocal() || !baseParams.empty() || !params.empty())
- {
- C.dec();
- }
- C << sb;
- C << eb;
+ C << sp << nl;
+ C << scoped.substr(2) << "::" << name << spar;
+ if(p->isLocal())
+ {
+ C << "const char* __file" << "int __line";
+ }
+ C << allParamDecls << epar;
+ if(p->isLocal() || !baseParams.empty() || !params.empty())
+ {
+ C << " :";
+ C.inc();
+ string upcall;
+ if(!allParamDecls.empty())
+ {
+ upcall = "(";
+ if(p->isLocal())
+ {
+ upcall += "__file, __line";
+ }
+ for(pi = baseParams.begin(); pi != baseParams.end(); ++pi)
+ {
+ if(p->isLocal() || pi != baseParams.begin())
+ {
+ upcall += ", ";
+ }
+ upcall += *pi;
+ }
+ upcall += ")";
+ }
+ if(!params.empty())
+ {
+ upcall += ",";
+ }
+ emitUpcall(base, upcall, p->isLocal());
+ }
+ for(pi = params.begin(); pi != params.end(); ++pi)
+ {
+ if(pi != params.begin())
+ {
+ C << ",";
+ }
+ C << nl << *pi << "(__ice_" << *pi << ')';
+ }
+ if(p->isLocal() || !baseParams.empty() || !params.empty())
+ {
+ C.dec();
+ }
+ C << sb;
+ C << eb;
}
C << sp << nl;
@@ -587,7 +587,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(p->isLocal())
{
- H << nl << "virtual ::std::string toString() const;";
+ H << nl << "virtual ::std::string toString() const;";
}
H << nl << "virtual ::Ice::Exception* ice_clone() const;";
@@ -604,11 +604,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(!p->isLocal())
{
- H << sp << nl << "static const ::IceInternal::UserExceptionFactoryPtr& ice_factory();";
+ H << sp << nl << "static const ::IceInternal::UserExceptionFactoryPtr& ice_factory();";
}
if(!dataMembers.empty())
{
- H << sp;
+ H << sp;
}
return true;
}
@@ -626,100 +626,100 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(!p->isLocal())
{
- ExceptionPtr base = p->base();
+ ExceptionPtr base = p->base();
- H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
- H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
- C << nl << "__os->write(::std::string(\"" << p->scoped() << "\"), false);";
- C << nl << "__os->startWriteSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
- }
- C << nl << "__os->endWriteSlice();";
- if(base)
- {
- emitUpcall(base, "::__write(__os);");
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)";
- C << sb;
- C << nl << "if(__rid)";
- C << sb;
- C << nl << "::std::string myId;";
- C << nl << "__is->read(myId, false);";
- C << eb;
- C << nl << "__is->startReadSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
- }
- C << nl << "__is->endReadSlice();";
- if(base)
- {
- emitUpcall(base, "::__read(__is, true);");
- }
- C << eb;
-
- factoryName = "__F" + p->flattenedScope() + p->name();
-
- C << sp << nl << "struct " << factoryName << " : public ::IceInternal::UserExceptionFactory";
- C << sb;
- C << sp << nl << "virtual void";
- C << nl << "createAndThrow()";
- C << sb;
- C << nl << "throw " << scoped << "();";
- C << eb;
- C << eb << ';';
-
- C << sp << nl << "static ::IceInternal::UserExceptionFactoryPtr " << factoryName
- << "__Ptr = new " << factoryName << ';';
-
- C << sp << nl << "const ::IceInternal::UserExceptionFactoryPtr&";
- C << nl << scoped.substr(2) << "::ice_factory()";
- C << sb;
- C << nl << "return " << factoryName << "__Ptr;";
- C << eb;
-
- C << sp << nl << "class " << factoryName << "__Init";
- C << sb;
- C.dec();
- C << nl << "public:";
- C.inc();
- C << sp << nl << factoryName << "__Init()";
- C << sb;
- C << nl << "::IceInternal::factoryTable->addExceptionFactory(\"" << p->scoped() << "\", " << scoped
- << "::ice_factory());";
- C << eb;
- C << sp << nl << "~" << factoryName << "__Init()";
- C << sb;
- C << nl << "::IceInternal::factoryTable->removeExceptionFactory(\"" << p->scoped() << "\");";
- C << eb;
- C << eb << ';';
- C << sp << nl << "static " << factoryName << "__Init "<< factoryName << "__i;";
- C << sp << nl << "#ifdef __APPLE__";
-
- string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer";
- C << nl << "extern \"C\" { void " << initfuncname << "() {} }";
- C << nl << "#endif";
+ H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
+ H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
+ C << sb;
+ C << nl << "__os->write(::std::string(\"" << p->scoped() << "\"), false);";
+ C << nl << "__os->startWriteSlice();";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
+ }
+ C << nl << "__os->endWriteSlice();";
+ if(base)
+ {
+ emitUpcall(base, "::__write(__os);");
+ }
+ C << eb;
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)";
+ C << sb;
+ C << nl << "if(__rid)";
+ C << sb;
+ C << nl << "::std::string myId;";
+ C << nl << "__is->read(myId, false);";
+ C << eb;
+ C << nl << "__is->startReadSlice();";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
+ }
+ C << nl << "__is->endReadSlice();";
+ if(base)
+ {
+ emitUpcall(base, "::__read(__is, true);");
+ }
+ C << eb;
+
+ factoryName = "__F" + p->flattenedScope() + p->name();
+
+ C << sp << nl << "struct " << factoryName << " : public ::IceInternal::UserExceptionFactory";
+ C << sb;
+ C << sp << nl << "virtual void";
+ C << nl << "createAndThrow()";
+ C << sb;
+ C << nl << "throw " << scoped << "();";
+ C << eb;
+ C << eb << ';';
+
+ C << sp << nl << "static ::IceInternal::UserExceptionFactoryPtr " << factoryName
+ << "__Ptr = new " << factoryName << ';';
+
+ C << sp << nl << "const ::IceInternal::UserExceptionFactoryPtr&";
+ C << nl << scoped.substr(2) << "::ice_factory()";
+ C << sb;
+ C << nl << "return " << factoryName << "__Ptr;";
+ C << eb;
+
+ C << sp << nl << "class " << factoryName << "__Init";
+ C << sb;
+ C.dec();
+ C << nl << "public:";
+ C.inc();
+ C << sp << nl << factoryName << "__Init()";
+ C << sb;
+ C << nl << "::IceInternal::factoryTable->addExceptionFactory(\"" << p->scoped() << "\", " << scoped
+ << "::ice_factory());";
+ C << eb;
+ C << sp << nl << "~" << factoryName << "__Init()";
+ C << sb;
+ C << nl << "::IceInternal::factoryTable->removeExceptionFactory(\"" << p->scoped() << "\");";
+ C << eb;
+ C << eb << ';';
+ C << sp << nl << "static " << factoryName << "__Init "<< factoryName << "__i;";
+ C << sp << nl << "#ifdef __APPLE__";
+
+ string initfuncname = "__F" + p->flattenedScope() + p->name() + "__initializer";
+ C << nl << "extern \"C\" { void " << initfuncname << "() {} }";
+ C << nl << "#endif";
}
H << eb << ';';
if(!p->isLocal())
{
- //
- // We need an instance here to trigger initialization if the implementation is in a shared libarry.
- // But we do this only once per source file, because a single instance is sufficient to initialize
- // all of the globals in a shared library.
- //
- if(!_doneStaticSymbol)
- {
- _doneStaticSymbol = true;
- H << sp << nl << "static " << name << " __" << p->name() << "_init;";
- }
+ //
+ // We need an instance here to trigger initialization if the implementation is in a shared libarry.
+ // But we do this only once per source file, because a single instance is sufficient to initialize
+ // all of the globals in a shared library.
+ //
+ if(!_doneStaticSymbol)
+ {
+ _doneStaticSymbol = true;
+ H << sp << nl << "static " << name << " __" << p->name() << "_init;";
+ }
}
_useWstring = resetUseWstring(_useWstringHist);
@@ -753,7 +753,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- params.push_back(fixKwd((*q)->name()));
+ params.push_back(fixKwd((*q)->name()));
}
H << sp;
@@ -785,10 +785,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << eb;
for(pi = params.begin(); pi != params.end(); ++pi)
{
- C << nl << "if(" << *pi << " != __rhs." << *pi << ')';
- C << sb;
- C << nl << "return true;";
- C << eb;
+ C << nl << "if(" << *pi << " != __rhs." << *pi << ')';
+ C << sb;
+ C << nl << "return true;";
+ C << eb;
}
C << nl << "return false;";
C << eb;
@@ -800,41 +800,41 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << eb;
for(pi = params.begin(); pi != params.end(); ++pi)
{
- C << nl << "if(" << *pi << " < __rhs." << *pi << ')';
- C << sb;
- C << nl << "return true;";
- C << eb;
- C << nl << "else if(__rhs." << *pi << " < " << *pi << ')';
- C << sb;
- C << nl << "return false;";
- C << eb;
+ C << nl << "if(" << *pi << " < __rhs." << *pi << ')';
+ C << sb;
+ C << nl << "return true;";
+ C << eb;
+ C << nl << "else if(__rhs." << *pi << " < " << *pi << ')';
+ C << sb;
+ C << nl << "return false;";
+ C << eb;
}
C << nl << "return false;";
C << eb;
if(!p->isLocal())
{
- //
- // None of these member functions is virtual!
- //
- H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*) const;";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*);";
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
- C << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
- }
- C << eb;
+ //
+ // None of these member functions is virtual!
+ //
+ H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*) const;";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*);";
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
+ C << sb;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
+ }
+ C << eb;
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
+ C << sb;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
+ }
+ C << eb;
}
H << eb << ';';
@@ -870,139 +870,139 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(!p->isLocal())
{
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- H << sp << nl << "class __U__" << name << " { };";
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
+
+ H << sp << nl << "class __U__" << name << " { };";
if(!seqType.empty())
- {
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "&, __U__"
- << name << ");";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");";
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << scoped << "& v, " << scope << "__U__" << name << ")";
- C << sb;
- C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(v.size());";
- C << nl << "__os->writeSize(size);";
- C << nl << "for(" << name << "::const_iterator p = v.begin(); p != v.end(); ++p)";
- C << sb;
- writeMarshalUnmarshalCode(C, type, "(*p)", true);
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
- << "& v, " << scope << "__U__" << name << ')';
- C << sb;
- C << nl << "::Ice::Int sz;";
- C << nl << "__is->readSize(sz);";
- C << nl << name << "(sz).swap(v);";
- if(type->isVariableLength())
- {
- // Protect against bogus sequence sizes.
- C << nl << "__is->startSeq(sz, " << type->minWireSize() << ");";
- }
- else
- {
- C << nl << "__is->checkFixedSeq(sz, " << type->minWireSize() << ");";
- }
- C << nl << "for(" << name << "::iterator p = v.begin(); p != v.end(); ++p)";
- C << sb;
- writeMarshalUnmarshalCode(C, type, "(*p)", false);
-
- //
- // After unmarshaling each element, check that there are still enough bytes left in the stream
- // to unmarshal the remainder of the sequence, and decrement the count of elements
- // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
- // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
- // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
- // (For fixed-length sequences, we don't need to do this because the prediction of how many
- // bytes will be taken up by the sequence is accurate.)
- //
- if(type->isVariableLength())
- {
- if(!SequencePtr::dynamicCast(type))
- {
- //
- // No need to check for directly nested sequences because, at the start of each
- // sequence, we check anyway.
- //
- C << nl << "__is->checkSeq();";
- }
- C << nl << "__is->endElement();";
- }
- C << eb;
- if(type->isVariableLength())
- {
- C << nl << "__is->endSeq(sz);";
- }
- C << eb;
- }
- else if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)
- {
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << s << "*, const " << s
- << "*, __U__" << name << ");";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");";
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << s << "* begin, const " << s << "* end, " << scope << "__U__" << name << ")";
- C << sb;
- C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(end - begin);";
- C << nl << "__os->writeSize(size);";
- C << nl << "for(int i = 0; i < size; ++i)";
- C << sb;
- writeMarshalUnmarshalCode(C, type, "begin[i]", true);
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
- << "& v, " << scope << "__U__" << name << ')';
- C << sb;
- C << nl << "::Ice::Int sz;";
- C << nl << "__is->readSize(sz);";
- if(type->isVariableLength())
- {
- // Protect against bogus sequence sizes.
- C << nl << "__is->startSeq(sz, " << type->minWireSize() << ");";
- }
- else
- {
- C << nl << "__is->checkFixedSeq(sz, " << type->minWireSize() << ");";
- }
- C << nl << "v.resize(sz);";
- C << nl << "for(int i = 0; i < sz; ++i)";
- C << sb;
- writeMarshalUnmarshalCode(C, type, "v[i]", false);
-
- //
- // After unmarshaling each element, check that there are still enough bytes left in the stream
- // to unmarshal the remainder of the sequence, and decrement the count of elements
- // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
- // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
- // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
- // (For fixed-length sequences, we don't need to do this because the prediction of how many
- // bytes will be taken up by the sequence is accurate.)
- //
- if(type->isVariableLength())
- {
- if(!SequencePtr::dynamicCast(type))
- {
- //
- // No need to check for directly nested sequences because, at the start of each
- // sequence, we check anyway.
- //
- C << nl << "__is->checkSeq();";
- }
- C << nl << "__is->endElement();";
- }
- C << eb;
- if(type->isVariableLength())
- {
- C << nl << "__is->endSeq(sz);";
- }
- C << eb;
- }
+ {
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "&, __U__"
+ << name << ");";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");";
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << scoped << "& v, " << scope << "__U__" << name << ")";
+ C << sb;
+ C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(v.size());";
+ C << nl << "__os->writeSize(size);";
+ C << nl << "for(" << name << "::const_iterator p = v.begin(); p != v.end(); ++p)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, type, "(*p)", true);
+ C << eb;
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
+ C << sb;
+ C << nl << "::Ice::Int sz;";
+ C << nl << "__is->readSize(sz);";
+ C << nl << name << "(sz).swap(v);";
+ if(type->isVariableLength())
+ {
+ // Protect against bogus sequence sizes.
+ C << nl << "__is->startSeq(sz, " << type->minWireSize() << ");";
+ }
+ else
+ {
+ C << nl << "__is->checkFixedSeq(sz, " << type->minWireSize() << ");";
+ }
+ C << nl << "for(" << name << "::iterator p = v.begin(); p != v.end(); ++p)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, type, "(*p)", false);
+
+ //
+ // After unmarshaling each element, check that there are still enough bytes left in the stream
+ // to unmarshal the remainder of the sequence, and decrement the count of elements
+ // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
+ // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
+ // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
+ // (For fixed-length sequences, we don't need to do this because the prediction of how many
+ // bytes will be taken up by the sequence is accurate.)
+ //
+ if(type->isVariableLength())
+ {
+ if(!SequencePtr::dynamicCast(type))
+ {
+ //
+ // No need to check for directly nested sequences because, at the start of each
+ // sequence, we check anyway.
+ //
+ C << nl << "__is->checkSeq();";
+ }
+ C << nl << "__is->endElement();";
+ }
+ C << eb;
+ if(type->isVariableLength())
+ {
+ C << nl << "__is->endSeq(sz);";
+ }
+ C << eb;
+ }
+ else if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)
+ {
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << s << "*, const " << s
+ << "*, __U__" << name << ");";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");";
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << s << "* begin, const " << s << "* end, " << scope << "__U__" << name << ")";
+ C << sb;
+ C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(end - begin);";
+ C << nl << "__os->writeSize(size);";
+ C << nl << "for(int i = 0; i < size; ++i)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, type, "begin[i]", true);
+ C << eb;
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
+ C << sb;
+ C << nl << "::Ice::Int sz;";
+ C << nl << "__is->readSize(sz);";
+ if(type->isVariableLength())
+ {
+ // Protect against bogus sequence sizes.
+ C << nl << "__is->startSeq(sz, " << type->minWireSize() << ");";
+ }
+ else
+ {
+ C << nl << "__is->checkFixedSeq(sz, " << type->minWireSize() << ");";
+ }
+ C << nl << "v.resize(sz);";
+ C << nl << "for(int i = 0; i < sz; ++i)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, type, "v[i]", false);
+
+ //
+ // After unmarshaling each element, check that there are still enough bytes left in the stream
+ // to unmarshal the remainder of the sequence, and decrement the count of elements
+ // yet to be unmarshaled for sequences with variable-length element type (that is, for sequences
+ // of classes, structs, dictionaries, sequences, strings, or proxies). This allows us to
+ // abort unmarshaling for bogus sequence sizes at the earliest possible moment.
+ // (For fixed-length sequences, we don't need to do this because the prediction of how many
+ // bytes will be taken up by the sequence is accurate.)
+ //
+ if(type->isVariableLength())
+ {
+ if(!SequencePtr::dynamicCast(type))
+ {
+ //
+ // No need to check for directly nested sequences because, at the start of each
+ // sequence, we check anyway.
+ //
+ C << nl << "__is->checkSeq();";
+ }
+ C << nl << "__is->endElement();";
+ }
+ C << eb;
+ if(type->isVariableLength())
+ {
+ C << nl << "__is->endSeq(sz);";
+ }
+ C << eb;
+ }
}
}
@@ -1015,48 +1015,48 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
string ks = typeToString(keyType, _useWstring, p->keyMetaData());
if(ks[0] == ':')
{
- ks.insert(0, " ");
+ ks.insert(0, " ");
}
string vs = typeToString(valueType, _useWstring, p->valueMetaData());
H << sp << nl << "typedef ::std::map<" << ks << ", " << vs << "> " << name << ';';
if(!p->isLocal())
{
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- H << sp << nl << "class __U__" << name << " { };";
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name
- << "&, __U__" << name << ");";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name
- << "&, __U__" << name << ");";
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << scoped << "& v, " << scope << "__U__" << name << ")";
- C << sb;
- C << nl << "__os->writeSize(::Ice::Int(v.size()));";
- C << nl << scoped << "::const_iterator p;";
- C << nl << "for(p = v.begin(); p != v.end(); ++p)";
- C << sb;
- writeMarshalUnmarshalCode(C, keyType, "p->first", true);
- writeMarshalUnmarshalCode(C, valueType, "p->second", true);
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
- << "& v, " << scope << "__U__" << name << ')';
- C << sb;
- C << nl << "::Ice::Int sz;";
- C << nl << "__is->readSize(sz);";
- C << nl << "while(sz--)";
- C << sb;
- C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
- string pf = string("const_cast<") + ks + "&>(pair.first)";
- writeMarshalUnmarshalCode(C, keyType, pf, false);
- C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);";
- writeMarshalUnmarshalCode(C, valueType, "__i->second", false);
- C << eb;
- C << eb;
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
+
+ H << sp << nl << "class __U__" << name << " { };";
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name
+ << "&, __U__" << name << ");";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name
+ << "&, __U__" << name << ");";
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << scoped << "& v, " << scope << "__U__" << name << ")";
+ C << sb;
+ C << nl << "__os->writeSize(::Ice::Int(v.size()));";
+ C << nl << scoped << "::const_iterator p;";
+ C << nl << "for(p = v.begin(); p != v.end(); ++p)";
+ C << sb;
+ writeMarshalUnmarshalCode(C, keyType, "p->first", true);
+ writeMarshalUnmarshalCode(C, valueType, "p->second", true);
+ C << eb;
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
+ C << sb;
+ C << nl << "::Ice::Int sz;";
+ C << nl << "__is->readSize(sz);";
+ C << nl << "while(sz--)";
+ C << sb;
+ C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
+ string pf = string("const_cast<") + ks + "&>(pair.first)";
+ writeMarshalUnmarshalCode(C, keyType, pf, false);
+ C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);";
+ writeMarshalUnmarshalCode(C, valueType, "__i->second", false);
+ C << eb;
+ C << eb;
}
}
@@ -1070,64 +1070,64 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
EnumeratorList::const_iterator en = enumerators.begin();
while(en != enumerators.end())
{
- H << nl << fixKwd((*en)->name());
- if(++en != enumerators.end())
- {
- H << ',';
- }
+ H << nl << fixKwd((*en)->name());
+ if(++en != enumerators.end())
+ {
+ H << ',';
+ }
}
H << eb << ';';
if(!p->isLocal())
{
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- size_t sz = enumerators.size();
- assert(sz <= 0x7fffffff); // 64-bit enums are not supported
-
- H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*, " << name << ");";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&);";
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped
- << " v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "__os->write(static_cast< ::Ice::Byte>(v));";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "__os->write(static_cast< ::Ice::Short>(v));";
- }
- else
- {
- C << nl << "__os->write(static_cast< ::Ice::Int>(v));";
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
- << "& v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "::Ice::Byte val;";
- C << nl << "__is->read(val);";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "::Ice::Short val;";
- C << nl << "__is->read(val);";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else
- {
- C << nl << "::Ice::Int val;";
- C << nl << "__is->read(val);";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- C << eb;
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
+
+ size_t sz = enumerators.size();
+ assert(sz <= 0x7fffffff); // 64-bit enums are not supported
+
+ H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*, " << name << ");";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&);";
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped
+ << " v)";
+ C << sb;
+ if(sz <= 0x7f)
+ {
+ C << nl << "__os->write(static_cast< ::Ice::Byte>(v));";
+ }
+ else if(sz <= 0x7fff)
+ {
+ C << nl << "__os->write(static_cast< ::Ice::Short>(v));";
+ }
+ else
+ {
+ C << nl << "__os->write(static_cast< ::Ice::Int>(v));";
+ }
+ C << eb;
+
+ C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
+ << "& v)";
+ C << sb;
+ if(sz <= 0x7f)
+ {
+ C << nl << "::Ice::Byte val;";
+ C << nl << "__is->read(val);";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ else if(sz <= 0x7fff)
+ {
+ C << nl << "::Ice::Short val;";
+ C << nl << "__is->read(val);";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ else
+ {
+ C << nl << "::Ice::Int val;";
+ C << nl << "__is->read(val);";
+ C << nl << "v = static_cast< " << scoped << ">(val);";
+ }
+ C << eb;
}
}
@@ -1141,59 +1141,59 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
BuiltinPtr bp = BuiltinPtr::dynamicCast(p->type());
if(bp && bp->kind() == Builtin::KindString)
{
- //
- // Expand strings into the basic source character set. We can't use isalpha() and the like
- // here because they are sensitive to the current locale.
- //
- static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789"
- "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
- static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
-
- if(_useWstring || findMetaData(p->typeMetaData(), true) == "wstring")
- {
- H << 'L';
- }
- H << "\""; // Opening "
-
- const string val = p->value();
- for(string::const_iterator c = val.begin(); c != val.end(); ++c)
- {
- if(charSet.find(*c) == charSet.end())
- {
- unsigned char uc = *c; // char may be signed, so make it positive
- ostringstream s;
- s << "\\"; // Print as octal if not in basic source character set
- s.flags(ios_base::oct);
- s.width(3);
- s.fill('0');
- s << static_cast<unsigned>(uc);
- H << s.str();
- }
- else
- {
- H << *c; // Print normally if in basic source character set
- }
- }
-
- H << "\""; // Closing "
+ //
+ // Expand strings into the basic source character set. We can't use isalpha() and the like
+ // here because they are sensitive to the current locale.
+ //
+ static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
+ static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
+
+ if(_useWstring || findMetaData(p->typeMetaData(), true) == "wstring")
+ {
+ H << 'L';
+ }
+ H << "\""; // Opening "
+
+ const string val = p->value();
+ for(string::const_iterator c = val.begin(); c != val.end(); ++c)
+ {
+ if(charSet.find(*c) == charSet.end())
+ {
+ unsigned char uc = *c; // char may be signed, so make it positive
+ ostringstream s;
+ s << "\\"; // Print as octal if not in basic source character set
+ s.flags(ios_base::oct);
+ s.width(3);
+ s.fill('0');
+ s << static_cast<unsigned>(uc);
+ H << s.str();
+ }
+ else
+ {
+ H << *c; // Print normally if in basic source character set
+ }
+ }
+
+ H << "\""; // Closing "
}
else if(bp && bp->kind() == Builtin::KindLong)
{
- H << "ICE_INT64(" << p->value() << ")";
+ H << "ICE_INT64(" << p->value() << ")";
}
else
{
- EnumPtr ep = EnumPtr::dynamicCast(p->type());
- if(ep)
- {
- H << fixKwd(p->value());
- }
- else
- {
- H << p->value();
- }
+ EnumPtr ep = EnumPtr::dynamicCast(p->type());
+ if(ep)
+ {
+ H << fixKwd(p->value());
+ }
+ else
+ {
+ H << p->value();
+ }
}
H << ';';
@@ -1225,7 +1225,7 @@ Slice::Gen::ProxyDeclVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceProxy" << nl << '{';
@@ -1244,7 +1244,7 @@ Slice::Gen::ProxyDeclVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
string name = fixKwd(p->name());
@@ -1265,7 +1265,7 @@ Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
if(p->isLocal())
{
- return;
+ return;
}
string name = fixKwd(p->name());
@@ -1289,7 +1289,7 @@ Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
H << sp << nl << "namespace IceProxy" << nl << '{';
@@ -1308,7 +1308,7 @@ Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -1333,7 +1333,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -1345,21 +1345,21 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp << nl << "class " << _dllExport << name << " : ";
if(bases.empty())
{
- H << "virtual public ::IceProxy::Ice::Object";
+ H << "virtual public ::IceProxy::Ice::Object";
}
else
{
- H.useCurrentPosAsIndent();
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- H << "virtual public ::IceProxy" << fixKwd((*q)->scoped());
- if(++q != bases.end())
- {
- H << ',' << nl;
- }
- }
- H.restoreIndent();
+ H.useCurrentPosAsIndent();
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ H << "virtual public ::IceProxy" << fixKwd((*q)->scoped());
+ if(++q != bases.end())
+ {
+ H << ',' << nl;
+ }
+ }
+ H.restoreIndent();
}
H << sb;
@@ -1458,25 +1458,25 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd((*q)->name());
- StringList metaData = (*q)->getMetaData();
+ string paramName = fixKwd((*q)->name());
+ StringList metaData = (*q)->getMetaData();
- string typeString;
- if((*q)->isOutParam())
- {
- outParams.push_back(*q);
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- inParams.push_back(*q);
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ outParams.push_back(*q);
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ inParams.push_back(*q);
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
- params.push_back(typeString);
- paramsDecl.push_back(typeString + ' ' + paramName);
- paramsName.push_back(paramName);
- args.push_back(paramName);
+ params.push_back(typeString);
+ paramsDecl.push_back(typeString + ' ' + paramName);
+ paramsName.push_back(paramName);
+ args.push_back(paramName);
}
paramsName.push_back("__outS");
@@ -1491,7 +1491,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
H << nl;
if(ret)
{
- H << "return ";
+ H << "return ";
}
H << fixKwd(name) << spar << args << "__defaultContext()" << epar << ';';
H << eb;
@@ -1608,18 +1608,18 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C.restoreIndent();
if(!ret)
{
- C << nl << "return;";
+ C << nl << "return;";
}
C << eb;
C << nl << "catch(const ::IceInternal::LocalExceptionWrapper& __ex)";
C << sb;
if(p->mode() == Operation::Idempotent || p->mode() == Operation::Nonmutating)
{
- C << nl << "__handleExceptionWrapperRelaxed(__connection, __ex, __cnt);";
+ C << nl << "__handleExceptionWrapperRelaxed(__connection, __ex, __cnt);";
}
else
{
- C << nl << "__handleExceptionWrapper(__connection, __ex);";
+ C << nl << "__handleExceptionWrapper(__connection, __ex);";
}
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
@@ -1652,7 +1652,7 @@ Slice::Gen::ObjectDeclVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasClassDecls())
{
- return false;
+ return false;
}
string name = fixKwd(p->name());
@@ -1703,7 +1703,7 @@ Slice::Gen::ObjectVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasClassDefs())
{
- return false;
+ return false;
}
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
@@ -1735,7 +1735,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDefPtr base;
if(!bases.empty() && !bases.front()->isInterface())
{
- base = bases.front();
+ base = bases.front();
}
DataMemberList dataMembers = p->dataMembers();
DataMemberList allDataMembers = p->allDataMembers();
@@ -1749,26 +1749,26 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H.useCurrentPosAsIndent();
if(bases.empty())
{
- if(p->isLocal())
- {
- H << "virtual public ::Ice::LocalObject";
- }
- else
- {
- H << "virtual public ::Ice::Object";
- }
+ if(p->isLocal())
+ {
+ H << "virtual public ::Ice::LocalObject";
+ }
+ else
+ {
+ H << "virtual public ::Ice::Object";
+ }
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- H << "virtual public " << fixKwd((*q)->scoped());
- if(++q != bases.end())
- {
- H << ',' << nl;
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ H << "virtual public " << fixKwd((*q)->scoped());
+ if(++q != bases.end())
+ {
+ H << ',' << nl;
+ }
+ }
}
H.restoreIndent();
H << sb;
@@ -1790,217 +1790,217 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- params.push_back(fixKwd((*q)->name()));
+ params.push_back(fixKwd((*q)->name()));
}
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
- allTypes.push_back(typeName);
- allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
+ string typeName = inputTypeToString((*q)->type(), _useWstring, (*q)->getMetaData());
+ allTypes.push_back(typeName);
+ allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
}
if(!p->isInterface())
{
- H << nl << name << "() {}";
- if(!allParamDecls.empty())
- {
- H << nl;
- if(allParamDecls.size() == 1)
- {
- H << "explicit ";
- }
- H << name << spar << allTypes << epar << ';';
- }
-
- /*
- * Strong guarantee: commented-out code marked "Strong guarantee" generates
- * a copy-assignment operator that provides the strong exception guarantee.
- * For now, this is commented out, and we use the compiler-generated
- * copy-assignment operator. However, that one does not provide the strong
- * guarantee.
-
- H << ';';
- if(!p->isAbstract())
- {
- H << nl << name << "& operator=(const " << name << "&)";
- if(allDataMembers.empty())
- {
- H << " { return *this; }";
- }
- H << ';';
- }
-
- //
- // __swap() is static because classes may be abstract, so we
- // can't use a non-static member function when we do an upcall
- // from a non-abstract derived __swap to the __swap in an abstract base.
- //
- H << sp << nl << "static void __swap(" << name << "&, " << name << "&) throw()";
- if(allDataMembers.empty())
- {
- H << " {}";
- }
- H << ';';
- H << nl << "void swap(" << name << "& rhs) throw()";
- H << sb;
- if(!allDataMembers.empty())
- {
- H << nl << "__swap(*this, rhs);";
- }
- H << eb;
-
- * Strong guarantee
- */
+ H << nl << name << "() {}";
+ if(!allParamDecls.empty())
+ {
+ H << nl;
+ if(allParamDecls.size() == 1)
+ {
+ H << "explicit ";
+ }
+ H << name << spar << allTypes << epar << ';';
+ }
+
+ /*
+ * Strong guarantee: commented-out code marked "Strong guarantee" generates
+ * a copy-assignment operator that provides the strong exception guarantee.
+ * For now, this is commented out, and we use the compiler-generated
+ * copy-assignment operator. However, that one does not provide the strong
+ * guarantee.
+
+ H << ';';
+ if(!p->isAbstract())
+ {
+ H << nl << name << "& operator=(const " << name << "&)";
+ if(allDataMembers.empty())
+ {
+ H << " { return *this; }";
+ }
+ H << ';';
+ }
+
+ //
+ // __swap() is static because classes may be abstract, so we
+ // can't use a non-static member function when we do an upcall
+ // from a non-abstract derived __swap to the __swap in an abstract base.
+ //
+ H << sp << nl << "static void __swap(" << name << "&, " << name << "&) throw()";
+ if(allDataMembers.empty())
+ {
+ H << " {}";
+ }
+ H << ';';
+ H << nl << "void swap(" << name << "& rhs) throw()";
+ H << sb;
+ if(!allDataMembers.empty())
+ {
+ H << nl << "__swap(*this, rhs);";
+ }
+ H << eb;
+
+ * Strong guarantee
+ */
emitOneShotConstructor(p);
- /*
- * Strong guarantee
-
- if(!allDataMembers.empty())
- {
- C << sp << nl << "void";
- C << nl << scoped.substr(2) << "::__swap(" << name << "& __lhs, " << name << "& __rhs) throw()";
- C << sb;
-
- if(base)
- {
- emitUpcall(base, "::__swap(__lhs, __rhs);");
- }
-
- //
- // We use a map to remember for which types we have already declared
- // a temporary variable and reuse that variable if a class has
- // more than one member of the same type. That way, we don't use more
- // temporaries than necessary. (::std::swap() instantiates a new temporary
- // each time it is used.)
- //
- map<string, int> tmpMap;
- map<string, int>::iterator pos;
- int tmpCount = 0;
-
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- string memberName = fixKwd((*q)->name());
- TypePtr type = (*q)->type();
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin && builtin->kind() != Builtin::KindString
- || EnumPtr::dynamicCast(type) || ProxyPtr::dynamicCast(type)
- || ClassDeclPtr::dynamicCast(type) || StructPtr::dynamicCast(type))
- {
- //
- // For built-in types (except string), enums, proxies, structs, and classes,
- // do the swap via a temporary variable.
- //
- string typeName = typeToString(type);
- pos = tmpMap.find(typeName);
- if(pos == tmpMap.end())
- {
- pos = tmpMap.insert(pos, make_pair(typeName, tmpCount));
- C << nl << typeName << " __tmp" << tmpCount << ';';
- tmpCount++;
- }
- C << nl << "__tmp" << pos->second << " = __rhs." << memberName << ';';
- C << nl << "__rhs." << memberName << " = __lhs." << memberName << ';';
- C << nl << "__lhs." << memberName << " = __tmp" << pos->second << ';';
- }
- else
- {
- //
- // For dictionaries, vectors, and maps, use the standard container's
- // swap() (which is usually optimized).
- //
- C << nl << "__lhs." << memberName << ".swap(__rhs." << memberName << ");";
- }
- }
- C << eb;
-
- if(!p->isAbstract())
- {
- C << sp << nl << scoped << "&";
- C << nl << scoped.substr(2) << "::operator=(const " << name << "& __rhs)";
- C << sb;
- C << nl << name << " __tmp(__rhs);";
- C << nl << "__swap(*this, __tmp);";
- C << nl << "return *this;";
- C << eb;
- }
- }
-
- * Strong guarantee
- */
+ /*
+ * Strong guarantee
+
+ if(!allDataMembers.empty())
+ {
+ C << sp << nl << "void";
+ C << nl << scoped.substr(2) << "::__swap(" << name << "& __lhs, " << name << "& __rhs) throw()";
+ C << sb;
+
+ if(base)
+ {
+ emitUpcall(base, "::__swap(__lhs, __rhs);");
+ }
+
+ //
+ // We use a map to remember for which types we have already declared
+ // a temporary variable and reuse that variable if a class has
+ // more than one member of the same type. That way, we don't use more
+ // temporaries than necessary. (::std::swap() instantiates a new temporary
+ // each time it is used.)
+ //
+ map<string, int> tmpMap;
+ map<string, int>::iterator pos;
+ int tmpCount = 0;
+
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ string memberName = fixKwd((*q)->name());
+ TypePtr type = (*q)->type();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin && builtin->kind() != Builtin::KindString
+ || EnumPtr::dynamicCast(type) || ProxyPtr::dynamicCast(type)
+ || ClassDeclPtr::dynamicCast(type) || StructPtr::dynamicCast(type))
+ {
+ //
+ // For built-in types (except string), enums, proxies, structs, and classes,
+ // do the swap via a temporary variable.
+ //
+ string typeName = typeToString(type);
+ pos = tmpMap.find(typeName);
+ if(pos == tmpMap.end())
+ {
+ pos = tmpMap.insert(pos, make_pair(typeName, tmpCount));
+ C << nl << typeName << " __tmp" << tmpCount << ';';
+ tmpCount++;
+ }
+ C << nl << "__tmp" << pos->second << " = __rhs." << memberName << ';';
+ C << nl << "__rhs." << memberName << " = __lhs." << memberName << ';';
+ C << nl << "__lhs." << memberName << " = __tmp" << pos->second << ';';
+ }
+ else
+ {
+ //
+ // For dictionaries, vectors, and maps, use the standard container's
+ // swap() (which is usually optimized).
+ //
+ C << nl << "__lhs." << memberName << ".swap(__rhs." << memberName << ");";
+ }
+ }
+ C << eb;
+
+ if(!p->isAbstract())
+ {
+ C << sp << nl << scoped << "&";
+ C << nl << scoped.substr(2) << "::operator=(const " << name << "& __rhs)";
+ C << sb;
+ C << nl << name << " __tmp(__rhs);";
+ C << nl << "__swap(*this, __tmp);";
+ C << nl << "return *this;";
+ C << eb;
+ }
+ }
+
+ * Strong guarantee
+ */
}
if(!p->isLocal())
{
- StringList ids;
- getIds(p, ids);
+ StringList ids;
+ getIds(p, ids);
StringList::const_iterator firstIter = ids.begin();
StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped());
assert(scopedIter != ids.end());
StringList::difference_type scopedPos = ice_distance(firstIter, scopedIter);
- StringList::const_iterator q;
-
- H << sp;
- H << nl << "virtual bool ice_isA"
- << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "virtual ::std::vector< ::std::string> ice_ids"
- << "(const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "static const ::std::string& ice_staticId();";
- if(!dataMembers.empty())
- {
- H << sp;
- }
-
- string flatName = p->flattenedScope() + p->name() + "_ids";
-
- C << sp;
- C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] =";
- C << sb;
- q = ids.begin();
- while(q != ids.end())
- {
- C << nl << '"' << *q << '"';
- if(++q != ids.end())
- {
- C << ',';
- }
- }
- C << eb << ';';
-
- C << sp << nl << "#ifndef ICEE_PURE_CLIENT";
-
- C << sp;
- C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2)
+ StringList::const_iterator q;
+
+ H << sp;
+ H << nl << "virtual bool ice_isA"
+ << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "virtual ::std::vector< ::std::string> ice_ids"
+ << "(const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "static const ::std::string& ice_staticId();";
+ if(!dataMembers.empty())
+ {
+ H << sp;
+ }
+
+ string flatName = p->flattenedScope() + p->name() + "_ids";
+
+ C << sp;
+ C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] =";
+ C << sb;
+ q = ids.begin();
+ while(q != ids.end())
+ {
+ C << nl << '"' << *q << '"';
+ if(++q != ids.end())
+ {
+ C << ',';
+ }
+ }
+ C << eb << ';';
+
+ C << sp << nl << "#ifndef ICEE_PURE_CLIENT";
+
+ C << sp;
+ C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2)
<< "::ice_isA(const ::std::string& _s, const ::Ice::Current&) const";
- C << sb;
- C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", _s);";
- C << eb;
-
- C << sp;
- C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2)
- << "::ice_ids(const ::Ice::Current&) const";
- C << sb;
- C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName
- << '[' << ids.size() << "]);";
- C << eb;
-
- C << sp;
- C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2)
- << "::ice_id(const ::Ice::Current&) const";
- C << sb;
- C << nl << "return " << flatName << '[' << scopedPos << "];";
- C << eb;
-
- C << sp;
- C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()";
- C << sb;
- C << nl << "return " << flatName << '[' << scopedPos << "];";
- C << eb;
+ C << sb;
+ C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", _s);";
+ C << eb;
+
+ C << sp;
+ C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2)
+ << "::ice_ids(const ::Ice::Current&) const";
+ C << sb;
+ C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName
+ << '[' << ids.size() << "]);";
+ C << eb;
+
+ C << sp;
+ C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2)
+ << "::ice_id(const ::Ice::Current&) const";
+ C << sb;
+ C << nl << "return " << flatName << '[' << scopedPos << "];";
+ C << eb;
+
+ C << sp;
+ C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()";
+ C << sb;
+ C << nl << "return " << flatName << '[' << scopedPos << "];";
+ C << eb;
}
return true;
@@ -2013,85 +2013,85 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
string scope = fixKwd(p->scope());
if(!p->isLocal())
- {
- ClassList bases = p->bases();
- ClassDefPtr base;
- if(!bases.empty() && !bases.front()->isInterface())
- {
- base = bases.front();
- }
+ {
+ ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ base = bases.front();
+ }
- OperationList allOps = p->allOperations();
- if(!allOps.empty())
- {
- StringList allOpNames;
+ OperationList allOps = p->allOperations();
+ if(!allOps.empty())
+ {
+ StringList allOpNames;
#if defined(__IBMCPP__) && defined(NDEBUG)
//
// See comment for transform above
//
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
- ::IceUtil::constMemFun<string,Operation>(&Contained::name));
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
+ ::IceUtil::constMemFun<string,Operation>(&Contained::name));
#else
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
::IceUtil::constMemFun(&Contained::name));
#endif
- allOpNames.push_back("ice_id");
- allOpNames.push_back("ice_ids");
- allOpNames.push_back("ice_isA");
- allOpNames.push_back("ice_ping");
- allOpNames.sort();
- allOpNames.unique();
-
- StringList::const_iterator q;
-
- H << sp;
- H << nl
- << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
-
- string flatName = p->flattenedScope() + p->name() + "_all";
- C << sp;
- C << nl << "static ::std::string " << flatName << "[] =";
- C << sb;
- q = allOpNames.begin();
- while(q != allOpNames.end())
- {
- C << nl << '"' << *q << '"';
- if(++q != allOpNames.end())
- {
- C << ',';
- }
- }
- C << eb << ';';
- C << sp;
- C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
- << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
- C << sb;
-
- C << nl << "::std::pair< ::std::string*, ::std::string*> r = "
- << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size()
- << ", current.operation);";
- C << nl << "if(r.first == r.second)";
- C << sb;
- C << nl << "return ::IceInternal::DispatchOperationNotExist;";
- C << eb;
- C << sp;
- C << nl << "switch(r.first - " << flatName << ')';
- C << sb;
- int i = 0;
- for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
- {
- C << nl << "case " << i++ << ':';
- C << sb;
- C << nl << "return ___" << *q << "(in, current);";
- C << eb;
- }
- C << eb;
- C << sp;
- C << nl << "assert(false);";
- C << nl << "return ::IceInternal::DispatchOperationNotExist;";
- C << eb;
- }
-
+ allOpNames.push_back("ice_id");
+ allOpNames.push_back("ice_ids");
+ allOpNames.push_back("ice_isA");
+ allOpNames.push_back("ice_ping");
+ allOpNames.sort();
+ allOpNames.unique();
+
+ StringList::const_iterator q;
+
+ H << sp;
+ H << nl
+ << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
+
+ string flatName = p->flattenedScope() + p->name() + "_all";
+ C << sp;
+ C << nl << "static ::std::string " << flatName << "[] =";
+ C << sb;
+ q = allOpNames.begin();
+ while(q != allOpNames.end())
+ {
+ C << nl << '"' << *q << '"';
+ if(++q != allOpNames.end())
+ {
+ C << ',';
+ }
+ }
+ C << eb << ';';
+ C << sp;
+ C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
+ << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
+ C << sb;
+
+ C << nl << "::std::pair< ::std::string*, ::std::string*> r = "
+ << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size()
+ << ", current.operation);";
+ C << nl << "if(r.first == r.second)";
+ C << sb;
+ C << nl << "return ::IceInternal::DispatchOperationNotExist;";
+ C << eb;
+ C << sp;
+ C << nl << "switch(r.first - " << flatName << ')';
+ C << sb;
+ int i = 0;
+ for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ {
+ C << nl << "case " << i++ << ':';
+ C << sb;
+ C << nl << "return ___" << *q << "(in, current);";
+ C << eb;
+ }
+ C << eb;
+ C << sp;
+ C << nl << "assert(false);";
+ C << nl << "return ::IceInternal::DispatchOperationNotExist;";
+ C << eb;
+ }
+
}
//
@@ -2099,10 +2099,10 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
//
if(!p->isAbstract())
{
- H.dec();
- H << sp << nl << "protected:";
- H.inc();
- H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() {}";
+ H.dec();
+ H << sp << nl << "protected:";
+ H.inc();
+ H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() {}";
}
H << eb << ';';
@@ -2114,47 +2114,47 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(p->isLocal())
{
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) == static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) != static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) < static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::LocalObject&>(l) == static_cast<const ::Ice::LocalObject&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::LocalObject&>(l) != static_cast<const ::Ice::LocalObject&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::LocalObject&>(l) < static_cast<const ::Ice::LocalObject&>(r);";
+ C << eb;
}
else
{
- string name = p->name();
-
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) != static_cast<const ::Ice::Object&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);";
- C << eb;
+ string name = p->name();
+
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) != static_cast<const ::Ice::Object&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);";
+ C << eb;
}
C << sp;
@@ -2215,55 +2215,55 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
ParamDeclList paramList = p->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd((*q)->name());
- TypePtr type = (*q)->type();
- bool isOutParam = (*q)->isOutParam();
- StringList metaData = (*q)->getMetaData();
-
- string typeString;
- if(isOutParam)
- {
- outParams.push_back(*q);
- typeString = outputTypeToString(type, _useWstring, metaData);
- }
- else
- {
- inParams.push_back(*q);
- typeString = inputTypeToString(type, _useWstring, metaData);
- }
-
- if(q != paramList.begin())
- {
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
- }
-
- params += typeString;
- paramsDecl += typeString;
- paramsDecl += ' ';
- paramsDecl += paramName;
- args += paramName;
+ string paramName = fixKwd((*q)->name());
+ TypePtr type = (*q)->type();
+ bool isOutParam = (*q)->isOutParam();
+ StringList metaData = (*q)->getMetaData();
+
+ string typeString;
+ if(isOutParam)
+ {
+ outParams.push_back(*q);
+ typeString = outputTypeToString(type, _useWstring, metaData);
+ }
+ else
+ {
+ inParams.push_back(*q);
+ typeString = inputTypeToString(type, _useWstring, metaData);
+ }
+
+ if(q != paramList.begin())
+ {
+ params += ", ";
+ paramsDecl += ", ";
+ args += ", ";
+ }
+
+ params += typeString;
+ paramsDecl += typeString;
+ paramsDecl += ' ';
+ paramsDecl += paramName;
+ args += paramName;
}
if(!cl->isLocal())
{
- if(!paramList.empty())
- {
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
- }
+ if(!paramList.empty())
+ {
+ params += ", ";
+ paramsDecl += ", ";
+ args += ", ";
+ }
- params += "const ::Ice::Current& = ::Ice::Current())";
- paramsDecl += "const ::Ice::Current& __current)";
- args += "__current)";
+ params += "const ::Ice::Current& = ::Ice::Current())";
+ paramsDecl += "const ::Ice::Current& __current)";
+ args += "__current)";
}
else
{
- params += ')';
- paramsDecl += ')';
- args += ')';
+ params += ')';
+ paramsDecl += ')';
+ args += ')';
}
bool isConst = (p->mode() == Operation::Nonmutating) || p->hasMetaData("cpp:const");
@@ -2276,73 +2276,73 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
if(!cl->isLocal())
{
- H << nl << "::IceInternal::DispatchStatus ___" << name
- << "(::IceInternal::Incoming&, const ::Ice::Current&)" << (isConst ? " const" : "") << ';';
+ H << nl << "::IceInternal::DispatchStatus ___" << name
+ << "(::IceInternal::Incoming&, const ::Ice::Current&)" << (isConst ? " const" : "") << ';';
- C << sp;
- C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
- << "(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)" << (isConst ? " const" : "");
- C << sb;
+ C << sp;
+ C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
+ << "(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)" << (isConst ? " const" : "");
+ C << sb;
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(derivedToBaseCompare);
+ throws.sort(derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
-
- if(!inParams.empty())
- {
- C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
- }
- if(ret || !outParams.empty() || !throws.empty())
- {
- C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
- }
-
- writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
- writeUnmarshalCode(C, inParams, 0, StringList(), true);
- writeAllocateCode(C, outParams, 0, StringList(), _useWstring);
- if(!throws.empty())
- {
- C << nl << "try";
- C << sb;
- }
- C << nl;
- if(ret)
- {
- C << retS << " __ret = ";
- }
- C << fixKwd(name) << args << ';';
- writeMarshalCode(C, outParams, ret, p->getMetaData());
- if(!throws.empty())
- {
- C << eb;
- ExceptionList::const_iterator r;
- for(r = throws.begin(); r != throws.end(); ++r)
- {
- C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
- C << sb;
- C << nl << "__os->write(__ex);";
- C << nl << "return ::IceInternal::DispatchUserException;";
- C << eb;
- }
- }
- C << nl << "return ::IceInternal::DispatchOK;";
- C << eb;
- }
+ C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
+ }
+ if(ret || !outParams.empty() || !throws.empty())
+ {
+ C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
+ }
+
+ writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
+ writeUnmarshalCode(C, inParams, 0, StringList(), true);
+ writeAllocateCode(C, outParams, 0, StringList(), _useWstring);
+ if(!throws.empty())
+ {
+ C << nl << "try";
+ C << sb;
+ }
+ C << nl;
+ if(ret)
+ {
+ C << retS << " __ret = ";
+ }
+ C << fixKwd(name) << args << ';';
+ writeMarshalCode(C, outParams, ret, p->getMetaData());
+ if(!throws.empty())
+ {
+ C << eb;
+ ExceptionList::const_iterator r;
+ for(r = throws.begin(); r != throws.end(); ++r)
+ {
+ C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
+ C << sb;
+ C << nl << "__os->write(__ex);";
+ C << nl << "return ::IceInternal::DispatchUserException;";
+ C << eb;
+ }
+ }
+ C << nl << "return ::IceInternal::DispatchOK;";
+ C << eb;
+ }
}
void
@@ -2365,21 +2365,21 @@ Slice::Gen::ObjectVisitor::emitVirtualBaseInitializers(const ClassDefPtr& p)
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
- if(emitVirtualBaseInitializers(bases.front()))
- {
- C << ',';
- }
+ if(emitVirtualBaseInitializers(bases.front()))
+ {
+ C << ',';
+ }
}
string upcall = "(";
DataMemberList::const_iterator q;
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- if(q != allDataMembers.begin())
- {
- upcall += ", ";
- }
- upcall += "__ice_" + (*q)->name();
+ if(q != allDataMembers.begin())
+ {
+ upcall += ", ";
+ }
+ upcall += "__ice_" + (*q)->name();
}
upcall += ")";
@@ -2409,47 +2409,47 @@ Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
for(q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), _useWstring);
- allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
+ string typeName = inputTypeToString((*q)->type(), _useWstring);
+ allParamDecls.push_back(typeName + " __ice_" + (*q)->name());
}
if(!allDataMembers.empty())
{
- C << sp << nl << p->scoped().substr(2) << "::" << fixKwd(p->name()) << spar << allParamDecls << epar << " :";
- C.inc();
-
- DataMemberList dataMembers = p->dataMembers();
-
- ClassList bases = p->bases();
- ClassDefPtr base;
- if(!bases.empty() && !bases.front()->isInterface())
- {
- if(emitVirtualBaseInitializers(bases.front()))
- {
- if(!dataMembers.empty())
- {
- C << ',';
- }
- }
- }
-
- if(!dataMembers.empty())
- {
- C << nl;
- }
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- if(q != dataMembers.begin())
- {
- C << ',' << nl;
- }
- string memberName = fixKwd((*q)->name());
- C << memberName << '(' << "__ice_" << (*q)->name() << ')';
- }
-
- C.dec();
- C << sb;
- C << eb;
+ C << sp << nl << p->scoped().substr(2) << "::" << fixKwd(p->name()) << spar << allParamDecls << epar << " :";
+ C.inc();
+
+ DataMemberList dataMembers = p->dataMembers();
+
+ ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ if(emitVirtualBaseInitializers(bases.front()))
+ {
+ if(!dataMembers.empty())
+ {
+ C << ',';
+ }
+ }
+ }
+
+ if(!dataMembers.empty())
+ {
+ C << nl;
+ }
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ if(q != dataMembers.begin())
+ {
+ C << ',' << nl;
+ }
+ string memberName = fixKwd((*q)->name());
+ C << memberName << '(' << "__ice_" << (*q)->name() << ')';
+ }
+
+ C.dec();
+ C << sb;
+ C << eb;
}
}
@@ -2479,7 +2479,7 @@ Slice::Gen::IceInternalVisitor::visitUnitStart(const UnitPtr& p)
{
if(!p->hasClassDecls())
{
- return false;
+ return false;
}
H << sp;
@@ -2514,9 +2514,9 @@ Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p)
{
H << sp << nl << "#endif // ICEE_PURE_CLIENT";
- H << sp;
- H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);";
- H << nl << _dllExport << "void decRef(::IceProxy" << scoped << "*);";
+ H << sp;
+ H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);";
+ H << nl << _dllExport << "void decRef(::IceProxy" << scoped << "*);";
}
}
@@ -2546,17 +2546,17 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
{
C << sp << nl << "#endif // ICEE_PURE_CLIENT";
- C << sp;
- C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)";
- C << sb;
- C << nl << "p->__incRef();";
- C << eb;
+ C << sp;
+ C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)";
+ C << sb;
+ C << nl << "p->__incRef();";
+ C << eb;
- C << sp;
- C << nl << "void" << nl << "IceInternal::decRef(::IceProxy" << scoped << "* p)";
- C << sb;
- C << nl << "p->__decRef();";
- C << eb;
+ C << sp;
+ C << nl << "void" << nl << "IceInternal::decRef(::IceProxy" << scoped << "* p)";
+ C << sb;
+ C << nl << "p->__decRef();";
+ C << eb;
}
return true;
@@ -2572,7 +2572,7 @@ Slice::Gen::HandleVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasClassDecls())
{
- return false;
+ return false;
}
string name = fixKwd(p->name());
@@ -2608,11 +2608,11 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
{
H << sp << nl << "#endif // ICEE_PURE_CLIENT" << sp;
- H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
+ H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
- H << sp;
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Prx&);";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
+ H << sp;
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Prx&);";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
}
}
@@ -2622,45 +2622,45 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
string name = p->name();
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- string factory;
- string type;
- if(!p->isAbstract())
- {
- type = scoped + "::ice_staticId()";
- factory = scoped + "::ice_factory()";
- }
- else
- {
- type = "\"\"";
- factory = "0";
- }
-
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
- << scope << name << "Prx& v)";
- C << sb;
- C << nl << "__os->write(::Ice::ObjectPrx(v));";
- C << eb;
-
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
- << scope << name << "Prx& v)";
- C << sb;
- C << nl << "::Ice::ObjectPrx proxy;";
- C << nl << "__is->read(proxy);";
- C << nl << "if(!proxy)";
- C << sb;
- C << nl << "v = 0;";
- C << eb;
- C << nl << "else";
- C << sb;
- C << nl << "v = new ::IceProxy" << scoped << ';';
- C << nl << "v->__copyFrom(proxy);";
- C << eb;
- C << eb;
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
+
+ string factory;
+ string type;
+ if(!p->isAbstract())
+ {
+ type = scoped + "::ice_staticId()";
+ factory = scoped + "::ice_factory()";
+ }
+ else
+ {
+ type = "\"\"";
+ factory = "0";
+ }
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
+ << scope << name << "Prx& v)";
+ C << sb;
+ C << nl << "__os->write(::Ice::ObjectPrx(v));";
+ C << eb;
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
+ << scope << name << "Prx& v)";
+ C << sb;
+ C << nl << "::Ice::ObjectPrx proxy;";
+ C << nl << "__is->read(proxy);";
+ C << nl << "if(!proxy)";
+ C << sb;
+ C << nl << "v = 0;";
+ C << eb;
+ C << nl << "else";
+ C << sb;
+ C << nl << "v = new ::IceProxy" << scoped << ';';
+ C << nl << "v->__copyFrom(proxy);";
+ C << eb;
+ C << eb;
}
return true;
@@ -2704,9 +2704,9 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const Str
out << nl << "return ::std::string();";
break;
}
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
{
out << nl << "return 0;";
break;
@@ -2717,48 +2717,48 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const Str
{
ProxyPtr prx = ProxyPtr::dynamicCast(type);
if(prx)
- {
- out << nl << "return 0;";
- }
- else
- {
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
- {
- out << nl << "return 0;";
- }
- else
- {
- StructPtr st = StructPtr::dynamicCast(type);
- if(st)
- {
- out << nl << "return " << fixKwd(st->scoped()) << "();";
- }
- else
- {
- EnumPtr en = EnumPtr::dynamicCast(type);
- if(en)
- {
- EnumeratorList enumerators = en->getEnumerators();
- out << nl << "return " << fixKwd(en->scope()) << fixKwd(enumerators.front()->name()) << ';';
- }
- else
- {
- SequencePtr seq = SequencePtr::dynamicCast(type);
- if(seq)
- {
- out << nl << "return " << typeToString(seq, _useWstring, metaData) << "();";
- }
- else
- {
- DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
- assert(dict);
- out << nl << "return " << fixKwd(dict->scoped()) << "();";
- }
- }
- }
- }
- }
+ {
+ out << nl << "return 0;";
+ }
+ else
+ {
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ if(cl)
+ {
+ out << nl << "return 0;";
+ }
+ else
+ {
+ StructPtr st = StructPtr::dynamicCast(type);
+ if(st)
+ {
+ out << nl << "return " << fixKwd(st->scoped()) << "();";
+ }
+ else
+ {
+ EnumPtr en = EnumPtr::dynamicCast(type);
+ if(en)
+ {
+ EnumeratorList enumerators = en->getEnumerators();
+ out << nl << "return " << fixKwd(en->scope()) << fixKwd(enumerators.front()->name()) << ';';
+ }
+ else
+ {
+ SequencePtr seq = SequencePtr::dynamicCast(type);
+ if(seq)
+ {
+ out << nl << "return " << typeToString(seq, _useWstring, metaData) << "();";
+ }
+ else
+ {
+ DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
+ assert(dict);
+ out << nl << "return " << fixKwd(dict->scoped()) << "();";
+ }
+ }
+ }
+ }
+ }
}
}
@@ -2816,14 +2816,14 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
{
H << ',' << nl << "virtual public " << fixKwd((*q)->scope());
- if((*q)->isAbstract())
- {
- H << (*q)->name() << "I";
- }
- else
- {
- H << fixKwd((*q)->name());
- }
+ if((*q)->isAbstract())
+ {
+ H << (*q)->name() << "I";
+ }
+ else
+ {
+ H << fixKwd((*q)->name());
+ }
}
H.restoreIndent();
@@ -2854,20 +2854,20 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
H << ',' << nl;
}
- StringList metaData = (*q)->getMetaData();
+ StringList metaData = (*q)->getMetaData();
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
- //
- // Work around for Sun CC 5.5 bug #4853566
- //
- string typeString;
- if((*q)->isOutParam())
- {
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ //
+ // Work around for Sun CC 5.5 bug #4853566
+ //
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
#else
string typeString = (*q)->isOutParam() ?
outputTypeToString((*q)->type(), _useWstring, metaData) : inputTypeToString((*q)->type(), _useWstring, metaData);
@@ -2884,12 +2884,12 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
}
H.restoreIndent();
- bool isConst = (op->mode() == Operation::Nonmutating) || op->hasMetaData("cpp:const");
+ bool isConst = (op->mode() == Operation::Nonmutating) || op->hasMetaData("cpp:const");
H << ")" << (isConst ? " const" : "") << ';';
C << sp << nl << retS << nl;
- C << scope.substr(2) << name << "I::" << fixKwd(opName) << '(';
+ C << scope.substr(2) << name << "I::" << fixKwd(opName) << '(';
C.useCurrentPosAsIndent();
for(q = paramList.begin(); q != paramList.end(); ++q)
{
@@ -2898,20 +2898,20 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
C << ',' << nl;
}
- StringList metaData = (*q)->getMetaData();
+ StringList metaData = (*q)->getMetaData();
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
- //
- // Work around for Sun CC 5.5 bug #4853566
- //
- string typeString;
- if((*q)->isOutParam())
- {
- typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
- }
- else
- {
- typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
- }
+ //
+ // Work around for Sun CC 5.5 bug #4853566
+ //
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outputTypeToString((*q)->type(), _useWstring, metaData);
+ }
+ else
+ {
+ typeString = inputTypeToString((*q)->type(), _useWstring, metaData);
+ }
#else
string typeString = (*q)->isOutParam() ?
outputTypeToString((*q)->type(), _useWstring, metaData) : inputTypeToString((*q)->type(), _useWstring, metaData);
@@ -2928,7 +2928,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
}
C.restoreIndent();
C << ')';
- C << (isConst ? " const" : "");
+ C << (isConst ? " const" : "");
C << sb;
if(ret)
@@ -2967,7 +2967,7 @@ Slice::Gen::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
{
continue;
}
- cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
+ cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
}
_history.insert(s);
}
@@ -3053,7 +3053,7 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p)
for(ParamDeclList::iterator q = params.begin(); q != params.end(); ++q)
{
validate((*q)->type(), (*q)->getMetaData(), p->definitionContext()->filename(), (*q)->line(),
- !(*q)->isOutParam());
+ !(*q)->isOutParam());
}
}
@@ -3095,12 +3095,12 @@ Slice::Gen::MetaDataVisitor::visitConst(const ConstPtr& p)
void
Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const StringList& metaData,
- const string& file, const string& line, bool inParam)
+ const string& file, const string& line, bool inParam)
{
static const string prefix = "cpp:";
for(StringList::const_iterator p = metaData.begin(); p != metaData.end(); ++p)
{
- string s = *p;
+ string s = *p;
if(_history.count(s) == 0)
{
if(s.find(prefix) == 0)
@@ -3118,14 +3118,14 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin
continue;
}
}
- if(SequencePtr::dynamicCast(cont))
- {
- if(ss.find("type:") == 0 || (inParam && (ss == "array" || ss.find("range") == 0)))
- {
- continue;
- }
- }
- cout << file << ":" << line << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ if(SequencePtr::dynamicCast(cont))
+ {
+ if(ss.find("type:") == 0 || (inParam && (ss == "array" || ss.find("range") == 0)))
+ {
+ continue;
+ }
+ }
+ cout << file << ":" << line << ": warning: ignoring invalid metadata `" << s << "'" << endl;
}
_history.insert(s);
}
@@ -3200,13 +3200,13 @@ Slice::Gen::printDllExportStuff(Output& out, const string& dllExport)
{
if(dllExport.size())
{
- out << sp;
- out << "\n#ifndef " << dllExport;
- out << "\n# ifdef " << dllExport << "_EXPORTS";
- out << "\n# define " << dllExport << " ICE_DECLSPEC_EXPORT";
- out << "\n# else";
- out << "\n# define " << dllExport << " ICE_DECLSPEC_IMPORT";
- out << "\n# endif";
- out << "\n#endif";
+ out << sp;
+ out << "\n#ifndef " << dllExport;
+ out << "\n# ifdef " << dllExport << "_EXPORTS";
+ out << "\n# define " << dllExport << " ICE_DECLSPEC_EXPORT";
+ out << "\n# else";
+ out << "\n# define " << dllExport << " ICE_DECLSPEC_IMPORT";
+ out << "\n# endif";
+ out << "\n#endif";
}
}
diff --git a/cpp/src/slice2cppe/Gen.h b/cpp/src/slice2cppe/Gen.h
index 5922aa76b47..a6308a7e430 100644
--- a/cpp/src/slice2cppe/Gen.h
+++ b/cpp/src/slice2cppe/Gen.h
@@ -27,16 +27,16 @@ class Gen : private ::IceUtil::noncopyable
public:
Gen(const std::string&,
- const std::string&,
- const std::string&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&,
- const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&,
+ const std::string&,
bool,
- bool);
+ bool);
~Gen();
bool operator!() const; // Returns true if there was a constructor error
@@ -84,181 +84,181 @@ private:
{
public:
- TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
+ TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
private:
- void emitUpcall(const ExceptionPtr&, const std::string&, bool = false);
+ void emitUpcall(const ExceptionPtr&, const std::string&, bool = false);
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _doneStaticSymbol;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _doneStaticSymbol;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class ProxyDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ProxyDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ProxyDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
};
class ProxyVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ProxyVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ProxyVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class ObjectDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ObjectDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ObjectDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
};
class ObjectVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
private:
- bool emitVirtualBaseInitializers(const ClassDefPtr&);
- void emitOneShotConstructor(const ClassDefPtr&);
- void emitUpcall(const ClassDefPtr&, const std::string&);
+ bool emitVirtualBaseInitializers(const ClassDefPtr&);
+ void emitOneShotConstructor(const ClassDefPtr&);
+ void emitUpcall(const ClassDefPtr&, const std::string&);
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
};
class IceInternalVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- IceInternalVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ IceInternalVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
};
class HandleVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
+ std::string _dllExport;
};
class ImplVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
- ImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+ ImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
- std::string _dllExport;
- bool _useWstring;
- std::list<bool> _useWstringHist;
+ std::string _dllExport;
+ bool _useWstring;
+ std::list<bool> _useWstringHist;
//
// Generate code to return a dummy value
@@ -290,7 +290,7 @@ private:
private:
void validate(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&,
- bool = false);
+ bool = false);
StringSet _history;
};
diff --git a/cpp/src/slice2cppe/Main.cpp b/cpp/src/slice2cppe/Main.cpp
index ff2dfe7f93e..1fda6e41dcd 100644
--- a/cpp/src/slice2cppe/Main.cpp
+++ b/cpp/src/slice2cppe/Main.cpp
@@ -18,18 +18,18 @@ void
usage(const char* n)
{
cerr << "Usage: " << n << " [options] slice-files...\n";
- cerr <<
+ cerr <<
"Options:\n"
"-h, --help Show this message.\n"
"-v, --version Display the Ice version.\n"
"--header-ext EXT Use EXT instead of the default `h' extension.\n"
"--source-ext EXT Use EXT instead of the default `cpp' extension.\n"
- "--add-header HDR[,GUARD] Add #include for HDR (with guard GUARD) to generated source file.\n"
+ "--add-header HDR[,GUARD] Add #include for HDR (with guard GUARD) to generated source file.\n"
"-DNAME Define NAME as 1.\n"
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--include-dir DIR Use DIR as the header include directory in source files.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--dll-export SYMBOL Use SYMBOL for DLL exports.\n"
@@ -70,21 +70,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICEE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICEE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string headerExtension = opts.optArg("header-ext");
@@ -97,19 +97,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -132,74 +132,74 @@ main(int argc, char* argv[])
if(args.empty())
{
- cerr << argv[0] << ": no input file" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no input file" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
int status = EXIT_SUCCESS;
for(i = args.begin(); i != args.end(); ++i)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::CPlusPlus);
- }
- else
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- return EXIT_FAILURE;
- }
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr u = Unit::createUnit(false, false, ice, caseSensitive);
- int parseStatus = u->parse(cppHandle, debug, Slice::IceE);
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- Gen gen(argv[0], icecpp.getBaseName(), headerExtension, sourceExtension, extraHeaders, include,
- includePaths, dllExport, output, impl, ice);
- if(!gen)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- gen.generate(u);
- }
-
- u->destroy();
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::CPlusPlus);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ return EXIT_FAILURE;
+ }
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr u = Unit::createUnit(false, false, ice, caseSensitive);
+ int parseStatus = u->parse(cppHandle, debug, Slice::IceE);
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ Gen gen(argv[0], icecpp.getBaseName(), headerExtension, sourceExtension, extraHeaders, include,
+ includePaths, dllExport, output, impl, ice);
+ if(!gen)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ gen.generate(u);
+ }
+
+ u->destroy();
+ }
+ }
}
return status;
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index a60479dd0d1..82a9ac5f2f8 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -45,26 +45,26 @@ sliceModeToIceMode(Operation::Mode opMode)
string mode;
switch(opMode)
{
- case Operation::Normal:
- {
- mode = "Ice.OperationMode.Normal";
- break;
- }
- case Operation::Nonmutating:
- {
- mode = "Ice.OperationMode.Nonmutating";
- break;
- }
- case Operation::Idempotent:
- {
- mode = "Ice.OperationMode.Idempotent";
- break;
- }
- default:
- {
- assert(false);
- break;
- }
+ case Operation::Normal:
+ {
+ mode = "Ice.OperationMode.Normal";
+ break;
+ }
+ case Operation::Nonmutating:
+ {
+ mode = "Ice.OperationMode.Nonmutating";
+ break;
+ }
+ case Operation::Idempotent:
+ {
+ mode = "Ice.OperationMode.Idempotent";
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
}
return mode;
}
@@ -76,12 +76,12 @@ emitDeprecate(const ContainedPtr& p1, const ContainedPtr& p2, Output& out, const
if(p1->findMetaData("deprecate", deprecateMetadata) ||
(p2 != 0 && p2->findMetaData("deprecate", deprecateMetadata)))
{
- string deprecateReason = "This " + type + " has been deprecated.";
- if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
- {
- deprecateReason = deprecateMetadata.substr(10);
- }
- out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
+ string deprecateReason = "This " + type + " has been deprecated.";
+ if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
+ {
+ deprecateReason = deprecateMetadata.substr(10);
+ }
+ out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
}
}
@@ -99,64 +99,64 @@ Slice::CsVisitor::writeInheritedOperations(const ClassDefPtr& p)
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
- bases.pop_front();
+ bases.pop_front();
}
if(!bases.empty())
{
- _out << sp << nl << "#region Inherited Slice operations";
+ _out << sp << nl << "#region Inherited Slice operations";
OperationList allOps;
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
- {
- OperationList tmp = (*q)->allOperations();
- allOps.splice(allOps.end(), tmp);
- }
- allOps.sort();
- allOps.unique();
- for(OperationList::const_iterator op = allOps.begin(); op != allOps.end(); ++op)
- {
- ClassDefPtr containingClass = ClassDefPtr::dynamicCast((*op)->container());
- bool amd = containingClass->hasMetaData("amd") || (*op)->hasMetaData("amd");
- string name = fixId((*op)->name(), DotNet::ICloneable, true);
- if(!amd)
- {
- vector<string> params = getParams(*op);
- vector<string> args = getArgs(*op);
- string retS = typeToString((*op)->returnType());
-
- _out << sp << nl << "public " << retS << ' ' << name << spar << params << epar;
- _out << sb;
- _out << nl;
- if((*op)->returnType())
- {
- _out << "return ";
- }
- _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';';
- _out << eb;
-
- _out << sp << nl << "public abstract " << retS << ' ' << name << spar << params;
- if(!containingClass->isLocal())
- {
- _out << "Ice.Current current__";
- }
- _out << epar << ';';
- }
- else
- {
- vector<string> params = getParamsAsync(*op, true);
- vector<string> args = getArgsAsync(*op);
-
- _out << sp << nl << "public void " << name << "_async" << spar << params << epar;
- _out << sb;
- _out << nl << name << "_async" << spar << args << epar << ';';
- _out << eb;
-
- _out << sp << nl << "public abstract void " << name << "_async"
- << spar << params << "Ice.Current current__" << epar << ';';
- }
- }
-
- _out << sp << nl << "#endregion"; // Inherited Slice operations
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
+ {
+ OperationList tmp = (*q)->allOperations();
+ allOps.splice(allOps.end(), tmp);
+ }
+ allOps.sort();
+ allOps.unique();
+ for(OperationList::const_iterator op = allOps.begin(); op != allOps.end(); ++op)
+ {
+ ClassDefPtr containingClass = ClassDefPtr::dynamicCast((*op)->container());
+ bool amd = containingClass->hasMetaData("amd") || (*op)->hasMetaData("amd");
+ string name = fixId((*op)->name(), DotNet::ICloneable, true);
+ if(!amd)
+ {
+ vector<string> params = getParams(*op);
+ vector<string> args = getArgs(*op);
+ string retS = typeToString((*op)->returnType());
+
+ _out << sp << nl << "public " << retS << ' ' << name << spar << params << epar;
+ _out << sb;
+ _out << nl;
+ if((*op)->returnType())
+ {
+ _out << "return ";
+ }
+ _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';';
+ _out << eb;
+
+ _out << sp << nl << "public abstract " << retS << ' ' << name << spar << params;
+ if(!containingClass->isLocal())
+ {
+ _out << "Ice.Current current__";
+ }
+ _out << epar << ';';
+ }
+ else
+ {
+ vector<string> params = getParamsAsync(*op, true);
+ vector<string> args = getArgsAsync(*op);
+
+ _out << sp << nl << "public void " << name << "_async" << spar << params << epar;
+ _out << sb;
+ _out << nl << name << "_async" << spar << args << epar << ';';
+ _out << eb;
+
+ _out << sp << nl << "public abstract void " << name << "_async"
+ << spar << params << "Ice.Current current__" << epar << ';';
+ }
+ }
+
+ _out << sp << nl << "#endregion"; // Inherited Slice operations
}
}
@@ -207,15 +207,15 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << sb;
{
- StringList::const_iterator q = ids.begin();
- while(q != ids.end())
- {
- _out << nl << '"' << *q << '"';
- if(++q != ids.end())
- {
- _out << ',';
- }
- }
+ StringList::const_iterator q = ids.begin();
+ while(q != ids.end())
+ {
+ _out << nl << '"' << *q << '"';
+ if(++q != ids.end())
+ {
+ _out << ',';
+ }
+ }
}
_out << eb << ";";
@@ -309,406 +309,406 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
OperationList ops = p->operations();
if(!p->isInterface() || ops.size() != 0)
{
- _out << sp << nl << "#region Operation dispatch";
+ _out << sp << nl << "#region Operation dispatch";
}
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = *r;
- ContainerPtr container = op->container();
+ ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
assert(cl);
string opName = op->name();
_out << sp << nl << "public static IceInternal.DispatchStatus " << opName << "___(" << name
- << " obj__, IceInternal.Incoming inS__, Ice.Current current__)";
+ << " obj__, IceInternal.Incoming inS__, Ice.Current current__)";
_out << sb;
- bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
- if(!amd)
- {
- TypePtr ret = op->returnType();
-
- TypeStringList inParams;
- TypeStringList outParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- else
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
+ if(!amd)
+ {
+ TypePtr ret = op->returnType();
+
+ TypeStringList inParams;
+ TypeStringList outParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ else
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- TypeStringList::const_iterator q;
-
- _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode);";
- if(!inParams.empty())
- {
- _out << nl << "IceInternal.BasicStream is__ = inS__.istr();";
- }
- if(!outParams.empty() || ret || !throws.empty())
- {
- _out << nl << "IceInternal.BasicStream os__ = inS__.ostr();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- string param = fixId(q->second);
- string typeS = typeToString(q->first);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- if(!isClass)
- {
- _out << nl << typeS << ' ' << param << ';';
- }
- writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
- }
- if(op->sendsClasses())
- {
- _out << nl << "is__.readPendingObjects();";
- }
-
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string typeS = typeToString(q->first);
- _out << nl << typeS << ' ' << fixId(q->second) << ";";
- }
-
- //
- // Call on the servant.
- //
- if(!throws.empty())
- {
- _out << nl << "try";
- _out << sb;
- }
- _out << nl;
- if(ret)
- {
- string retS = typeToString(ret);
- _out << retS << " ret__ = ";
- }
- _out << "obj__." << fixId(opName, DotNet::ICloneable, true) << spar;
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
-
- string arg;
- if(isClass)
- {
- arg += "(" + typeToString(q->first) + ")";
- }
- arg += fixId(q->second);
- if(isClass)
- {
- arg += "_PP.value";
- }
- _out << arg;
- }
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- _out << "out " + fixId(q->second);
- }
- _out << "current__" << epar << ';';
-
- //
- // Marshal 'out' parameters and return value.
- //
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, true, "");
- }
- if(ret)
- {
- writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, true, "");
- }
- if(op->returnsClasses())
- {
- _out << nl << "os__.writePendingObjects();";
- }
- _out << nl << "return IceInternal.DispatchStatus.DispatchOK;";
-
- //
- // Handle user exceptions.
- //
- if(!throws.empty())
- {
- _out << eb;
- ExceptionList::const_iterator t;
- for(t = throws.begin(); t != throws.end(); ++t)
- {
- string exS = fixId((*t)->scoped());
- _out << nl << "catch(" << exS << " ex)";
- _out << sb;
- _out << nl << "os__.writeUserException(ex);";
- _out << nl << "return IceInternal.DispatchStatus.DispatchUserException;";
- _out << eb;
- }
- }
-
- _out << eb;
- }
- else
- {
- TypeStringList inParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if(!(*pli)->isOutParam())
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- TypeStringList::const_iterator q;
- _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode);";
+ TypeStringList::const_iterator q;
+
+ _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode);";
+ if(!inParams.empty())
+ {
+ _out << nl << "IceInternal.BasicStream is__ = inS__.istr();";
+ }
+ if(!outParams.empty() || ret || !throws.empty())
+ {
+ _out << nl << "IceInternal.BasicStream os__ = inS__.ostr();";
+ }
+
+ //
+ // Unmarshal 'in' parameters.
+ //
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ string typeS = typeToString(q->first);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ if(!isClass)
+ {
+ _out << nl << typeS << ' ' << param << ';';
+ }
+ writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
+ }
+ if(op->sendsClasses())
+ {
+ _out << nl << "is__.readPendingObjects();";
+ }
+
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string typeS = typeToString(q->first);
+ _out << nl << typeS << ' ' << fixId(q->second) << ";";
+ }
+
+ //
+ // Call on the servant.
+ //
+ if(!throws.empty())
+ {
+ _out << nl << "try";
+ _out << sb;
+ }
+ _out << nl;
+ if(ret)
+ {
+ string retS = typeToString(ret);
+ _out << retS << " ret__ = ";
+ }
+ _out << "obj__." << fixId(opName, DotNet::ICloneable, true) << spar;
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+
+ string arg;
+ if(isClass)
+ {
+ arg += "(" + typeToString(q->first) + ")";
+ }
+ arg += fixId(q->second);
+ if(isClass)
+ {
+ arg += "_PP.value";
+ }
+ _out << arg;
+ }
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ _out << "out " + fixId(q->second);
+ }
+ _out << "current__" << epar << ';';
+
+ //
+ // Marshal 'out' parameters and return value.
+ //
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, true, "");
+ }
+ if(ret)
+ {
+ writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, true, "");
+ }
+ if(op->returnsClasses())
+ {
+ _out << nl << "os__.writePendingObjects();";
+ }
+ _out << nl << "return IceInternal.DispatchStatus.DispatchOK;";
+
+ //
+ // Handle user exceptions.
+ //
+ if(!throws.empty())
+ {
+ _out << eb;
+ ExceptionList::const_iterator t;
+ for(t = throws.begin(); t != throws.end(); ++t)
+ {
+ string exS = fixId((*t)->scoped());
+ _out << nl << "catch(" << exS << " ex)";
+ _out << sb;
+ _out << nl << "os__.writeUserException(ex);";
+ _out << nl << "return IceInternal.DispatchStatus.DispatchUserException;";
+ _out << eb;
+ }
+ }
+
+ _out << eb;
+ }
+ else
+ {
+ TypeStringList inParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if(!(*pli)->isOutParam())
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ TypeStringList::const_iterator q;
+ _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode);";
- if(!inParams.empty())
- {
- _out << nl << "IceInternal.BasicStream is__ = inS__.istr();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- if(!isClass)
- {
- _out << nl << typeToString(q->first) << ' ' << fixId(q->second) << ';';
- }
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
- }
- if(op->sendsClasses())
- {
- _out << nl << "is__.readPendingObjects();";
- }
-
- //
- // Call on the servant.
- //
- string classNameAMD = "AMD_" + p->name();
- _out << nl << classNameAMD << '_' << opName << " cb__ = new _" << classNameAMD << '_' << opName
- << "(inS__);";
+ if(!inParams.empty())
+ {
+ _out << nl << "IceInternal.BasicStream is__ = inS__.istr();";
+ }
+
+ //
+ // Unmarshal 'in' parameters.
+ //
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ if(!isClass)
+ {
+ _out << nl << typeToString(q->first) << ' ' << fixId(q->second) << ';';
+ }
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
+ }
+ if(op->sendsClasses())
+ {
+ _out << nl << "is__.readPendingObjects();";
+ }
+
+ //
+ // Call on the servant.
+ //
+ string classNameAMD = "AMD_" + p->name();
+ _out << nl << classNameAMD << '_' << opName << " cb__ = new _" << classNameAMD << '_' << opName
+ << "(inS__);";
_out << nl << "try";
_out << sb;
- _out << nl << "obj__.";
- if(amd)
- {
- _out << opName << "_async";
- }
- else
- {
- _out << fixId(opName, DotNet::ICloneable, true);
- }
- _out << spar;
- if(amd)
- {
- _out << "cb__";
- }
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- string arg;
- if(isClass)
- {
- arg += "(" + typeToString(q->first) + ")";
- }
- arg += fixId(q->second);
- if(isClass)
- {
- arg += "_PP.value";
- }
- _out << arg;
- }
- _out << "current__" << epar << ';';
- _out << eb;
- _out << nl << "catch(_System.Exception ex)";
- _out << sb;
- _out << nl << "cb__.ice_exception(ex);";
- _out << eb;
- _out << nl << "return IceInternal.DispatchStatus.DispatchAsync;";
-
- _out << eb;
- }
+ _out << nl << "obj__.";
+ if(amd)
+ {
+ _out << opName << "_async";
+ }
+ else
+ {
+ _out << fixId(opName, DotNet::ICloneable, true);
+ }
+ _out << spar;
+ if(amd)
+ {
+ _out << "cb__";
+ }
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ string arg;
+ if(isClass)
+ {
+ arg += "(" + typeToString(q->first) + ")";
+ }
+ arg += fixId(q->second);
+ if(isClass)
+ {
+ arg += "_PP.value";
+ }
+ _out << arg;
+ }
+ _out << "current__" << epar << ';';
+ _out << eb;
+ _out << nl << "catch(_System.Exception ex)";
+ _out << sb;
+ _out << nl << "cb__.ice_exception(ex);";
+ _out << eb;
+ _out << nl << "return IceInternal.DispatchStatus.DispatchAsync;";
+
+ _out << eb;
+ }
}
OperationList allOps = p->allOperations();
if(!allOps.empty())
{
- StringList allOpNames;
+ StringList allOpNames;
#if defined(__IBMCPP__) && defined(NDEBUG)
- //
- // See comment for transform above
- //
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun<string,Operation>(&Contained::name));
+ //
+ // See comment for transform above
+ //
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun<string,Operation>(&Contained::name));
#else
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name));
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name));
#endif
- allOpNames.push_back("ice_id");
- allOpNames.push_back("ice_ids");
- allOpNames.push_back("ice_isA");
- allOpNames.push_back("ice_ping");
-
- //
- // We sort into case-insensitive order here because, at run time,
- // the sort order must match the sort order used by System.Array.Sort().
- // (C# has no notion of the default ASCII ordering.)
- //
+ allOpNames.push_back("ice_id");
+ allOpNames.push_back("ice_ids");
+ allOpNames.push_back("ice_isA");
+ allOpNames.push_back("ice_ping");
+
+ //
+ // We sort into case-insensitive order here because, at run time,
+ // the sort order must match the sort order used by System.Array.Sort().
+ // (C# has no notion of the default ASCII ordering.)
+ //
#if defined(__SUNPRO_CC)
- allOpNames.sort(Slice::cICompare);
+ allOpNames.sort(Slice::cICompare);
#else
- allOpNames.sort(Slice::CICompare());
+ allOpNames.sort(Slice::CICompare());
#endif
- allOpNames.unique();
-
- StringList::const_iterator q;
-
- _out << sp << nl << "private static string[] all__ =";
- _out << sb;
- q = allOpNames.begin();
- while(q != allOpNames.end())
- {
- _out << nl << '"' << *q << '"';
- if(++q != allOpNames.end())
- {
- _out << ',';
- }
- }
- _out << eb << ';';
-
- _out << sp << nl << "public override IceInternal.DispatchStatus "
- << "dispatch__(IceInternal.Incoming inS__, Ice.Current current__)";
- _out << sb;
- _out << nl << "int pos;";
- //
- // TODO: Remove linear search for Mono once this bug is fixed.
- //
- _out << nl << "if(IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono)";
- _out << sb;
- _out << nl << "// Mono bug: System.Array.BinarySearch() uses the wrong collation sequence,";
- _out << nl << "// so we do a linear search for the time being";
- _out << nl << "pos = 0;";
- _out << nl << "while(pos < all__.Length)";
- _out << sb;
- _out << nl << "if(all__[pos] == current__.operation)";
- _out << sb;
- _out << nl << "break;";
- _out << eb;
- _out << nl << "++pos;";
- _out << eb;
- _out << nl << "if(pos == all__.Length)";
- _out << sb;
- _out << nl << "pos = -1;";
- _out << eb;
- _out << eb;
- _out << nl << "else";
- _out << sb;
- _out << nl << "pos = _System.Array.BinarySearch(all__, current__.operation, "
- << "_System.Collections.Comparer.DefaultInvariant);";
- _out << eb;
- _out << nl << "if(pos < 0)";
- _out << sb;
- _out << nl << "return IceInternal.DispatchStatus.DispatchOperationNotExist;";
- _out << eb;
- _out << sp << nl << "switch(pos)";
- _out << sb;
- int i = 0;
- for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
- {
- string opName = *q;
-
- _out << nl << "case " << i++ << ':';
- _out << sb;
- if(opName == "ice_id")
- {
- _out << nl << "return ice_id___(this, inS__, current__);";
- }
- else if(opName == "ice_ids")
- {
- _out << nl << "return ice_ids___(this, inS__, current__);";
- }
- else if(opName == "ice_isA")
- {
- _out << nl << "return ice_isA___(this, inS__, current__);";
- }
- else if(opName == "ice_ping")
- {
- _out << nl << "return ice_ping___(this, inS__, current__);";
- }
- else
- {
- //
- // There's probably a better way to do this
- //
- for(OperationList::const_iterator t = allOps.begin(); t != allOps.end(); ++t)
- {
- if((*t)->name() == (*q))
- {
- ContainerPtr container = (*t)->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- assert(cl);
- if(cl->scoped() == p->scoped())
- {
- _out << nl << "return " << opName << "___(this, inS__, current__);";
- }
- else
- {
- string base = cl->scoped();
- if(cl->isInterface())
- {
- base += "Disp_";
- }
- _out << nl << "return " << fixId(base) << "." << opName << "___(this, inS__, current__);";
- }
- break;
- }
- }
- }
- _out << eb;
- }
- _out << eb;
- _out << sp << nl << "_System.Diagnostics.Debug.Assert(false);";
- _out << nl << "return IceInternal.DispatchStatus.DispatchOperationNotExist;";
- _out << eb;
+ allOpNames.unique();
+
+ StringList::const_iterator q;
+
+ _out << sp << nl << "private static string[] all__ =";
+ _out << sb;
+ q = allOpNames.begin();
+ while(q != allOpNames.end())
+ {
+ _out << nl << '"' << *q << '"';
+ if(++q != allOpNames.end())
+ {
+ _out << ',';
+ }
+ }
+ _out << eb << ';';
+
+ _out << sp << nl << "public override IceInternal.DispatchStatus "
+ << "dispatch__(IceInternal.Incoming inS__, Ice.Current current__)";
+ _out << sb;
+ _out << nl << "int pos;";
+ //
+ // TODO: Remove linear search for Mono once this bug is fixed.
+ //
+ _out << nl << "if(IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono)";
+ _out << sb;
+ _out << nl << "// Mono bug: System.Array.BinarySearch() uses the wrong collation sequence,";
+ _out << nl << "// so we do a linear search for the time being";
+ _out << nl << "pos = 0;";
+ _out << nl << "while(pos < all__.Length)";
+ _out << sb;
+ _out << nl << "if(all__[pos] == current__.operation)";
+ _out << sb;
+ _out << nl << "break;";
+ _out << eb;
+ _out << nl << "++pos;";
+ _out << eb;
+ _out << nl << "if(pos == all__.Length)";
+ _out << sb;
+ _out << nl << "pos = -1;";
+ _out << eb;
+ _out << eb;
+ _out << nl << "else";
+ _out << sb;
+ _out << nl << "pos = _System.Array.BinarySearch(all__, current__.operation, "
+ << "_System.Collections.Comparer.DefaultInvariant);";
+ _out << eb;
+ _out << nl << "if(pos < 0)";
+ _out << sb;
+ _out << nl << "return IceInternal.DispatchStatus.DispatchOperationNotExist;";
+ _out << eb;
+ _out << sp << nl << "switch(pos)";
+ _out << sb;
+ int i = 0;
+ for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ {
+ string opName = *q;
+
+ _out << nl << "case " << i++ << ':';
+ _out << sb;
+ if(opName == "ice_id")
+ {
+ _out << nl << "return ice_id___(this, inS__, current__);";
+ }
+ else if(opName == "ice_ids")
+ {
+ _out << nl << "return ice_ids___(this, inS__, current__);";
+ }
+ else if(opName == "ice_isA")
+ {
+ _out << nl << "return ice_isA___(this, inS__, current__);";
+ }
+ else if(opName == "ice_ping")
+ {
+ _out << nl << "return ice_ping___(this, inS__, current__);";
+ }
+ else
+ {
+ //
+ // There's probably a better way to do this
+ //
+ for(OperationList::const_iterator t = allOps.begin(); t != allOps.end(); ++t)
+ {
+ if((*t)->name() == (*q))
+ {
+ ContainerPtr container = (*t)->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ assert(cl);
+ if(cl->scoped() == p->scoped())
+ {
+ _out << nl << "return " << opName << "___(this, inS__, current__);";
+ }
+ else
+ {
+ string base = cl->scoped();
+ if(cl->isInterface())
+ {
+ base += "Disp_";
+ }
+ _out << nl << "return " << fixId(base) << "." << opName << "___(this, inS__, current__);";
+ }
+ break;
+ }
+ }
+ }
+ _out << eb;
+ }
+ _out << eb;
+ _out << sp << nl << "_System.Diagnostics.Debug.Assert(false);";
+ _out << nl << "return IceInternal.DispatchStatus.DispatchOperationNotExist;";
+ _out << eb;
}
if(!p->isInterface() || ops.size() != 0)
{
- _out << sp << nl << "#endregion"; // Operation dispatch
+ _out << sp << nl << "#endregion"; // Operation dispatch
}
}
@@ -719,11 +719,11 @@ Slice::CsVisitor::getParamAttributes(const ParamDeclPtr& p)
StringList metaData = p->getMetaData();
for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
{
- static const string prefix = "cs:attribute:";
+ static const string prefix = "cs:attribute:";
if(i->find(prefix) == 0)
- {
- result += "[" + i->substr(prefix.size()) + "] ";
- }
+ {
+ result += "[" + i->substr(prefix.size()) + "] ";
+ }
}
return result;
}
@@ -735,13 +735,13 @@ Slice::CsVisitor::getParams(const OperationPtr& op)
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string param = getParamAttributes(*q);
- if((*q)->isOutParam())
- {
- param += "out ";
- }
- param += typeToString((*q)->type()) + " " + fixId((*q)->name());
- params.push_back(param);
+ string param = getParamAttributes(*q);
+ if((*q)->isOutParam())
+ {
+ param += "out ";
+ }
+ param += typeToString((*q)->type()) + " " + fixId((*q)->name());
+ params.push_back(param);
}
return params;
}
@@ -760,10 +760,10 @@ Slice::CsVisitor::getParamsAsync(const OperationPtr& op, bool amd)
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if(!(*q)->isOutParam())
- {
- params.push_back(getParamAttributes(*q) + typeToString((*q)->type()) + " " + fixId((*q)->name()));
- }
+ if(!(*q)->isOutParam())
+ {
+ params.push_back(getParamAttributes(*q) + typeToString((*q)->type()) + " " + fixId((*q)->name()));
+ }
}
return params;
}
@@ -776,16 +776,16 @@ Slice::CsVisitor::getParamsAsyncCB(const OperationPtr& op)
TypePtr ret = op->returnType();
if(ret)
{
- params.push_back(typeToString(ret) + " ret__");
+ params.push_back(typeToString(ret) + " ret__");
}
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if((*q)->isOutParam())
- {
- params.push_back(getParamAttributes(*q) + typeToString((*q)->type()) + ' ' + fixId((*q)->name()));
- }
+ if((*q)->isOutParam())
+ {
+ params.push_back(getParamAttributes(*q) + typeToString((*q)->type()) + ' ' + fixId((*q)->name()));
+ }
}
return params;
@@ -798,11 +798,11 @@ Slice::CsVisitor::getArgs(const OperationPtr& op)
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string arg = fixId((*q)->name());
- if((*q)->isOutParam())
- {
- arg = "out " + arg;
- }
+ string arg = fixId((*q)->name());
+ if((*q)->isOutParam())
+ {
+ arg = "out " + arg;
+ }
args.push_back(arg);
}
return args;
@@ -819,9 +819,9 @@ Slice::CsVisitor::getArgsAsync(const OperationPtr& op)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
if(!(*q)->isOutParam())
- {
- args.push_back(fixId((*q)->name()));
- }
+ {
+ args.push_back(fixId((*q)->name()));
+ }
}
return args;
}
@@ -841,9 +841,9 @@ Slice::CsVisitor::getArgsAsyncCB(const OperationPtr& op)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
if((*q)->isOutParam())
- {
- args.push_back(fixId((*q)->name()));
- }
+ {
+ args.push_back(fixId((*q)->name()));
+ }
}
return args;
@@ -855,11 +855,11 @@ Slice::CsVisitor::emitAttributes(const ContainedPtr& p)
StringList metaData = p->getMetaData();
for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
{
- static const string prefix = "cs:attribute:";
+ static const string prefix = "cs:attribute:";
if(i->find(prefix) == 0)
- {
- _out << nl << '[' << i->substr(prefix.size()) << ']';
- }
+ {
+ _out << nl << '[' << i->substr(prefix.size()) << ']';
+ }
}
}
@@ -872,22 +872,22 @@ Slice::Gen::Gen(const string& name, const string& base, const vector<string>& in
string::size_type pos = base.find_last_of("/\\");
if(pos != string::npos)
{
- fileBase = base.substr(pos + 1);
+ fileBase = base.substr(pos + 1);
}
string file = fileBase + ".cs";
string fileImpl = fileBase + "I.cs";
if(!dir.empty())
{
- file = dir + '/' + file;
- fileImpl = dir + '/' + fileImpl;
+ file = dir + '/' + file;
+ fileImpl = dir + '/' + fileImpl;
}
_out.open(file.c_str());
if(!_out)
{
cerr << name << ": can't open `" << file << "' for writing" << endl;
- return;
+ return;
}
printHeader();
@@ -899,17 +899,17 @@ Slice::Gen::Gen(const string& name, const string& base, const vector<string>& in
if(impl || implTie)
{
struct stat st;
- if(stat(fileImpl.c_str(), &st) == 0)
- {
- cerr << name << ": `" << fileImpl << "' already exists--will not overwrite" << endl;
- return;
- }
- _impl.open(fileImpl.c_str());
- if(!_impl)
- {
- cerr << name << ": can't open `" << fileImpl << "' for writing" << endl;
- return;
- }
+ if(stat(fileImpl.c_str(), &st) == 0)
+ {
+ cerr << name << ": `" << fileImpl << "' already exists--will not overwrite" << endl;
+ return;
+ }
+ _impl.open(fileImpl.c_str());
+ if(!_impl)
+ {
+ cerr << name << ": can't open `" << fileImpl << "' for writing" << endl;
+ return;
+ }
}
}
@@ -1060,25 +1060,25 @@ Slice::Gen::UnitVisitor::visitModuleStart(const ModulePtr& p)
{
if(!_globalMetaDataDone)
{
- DefinitionContextPtr dc = p->definitionContext();
- StringList globalMetaData = dc->getMetaData();
-
- static const string attributePrefix = "cs:attribute:";
-
- if(!globalMetaData.empty())
- {
- _out << sp;
- }
- for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
- {
- string::size_type pos = q->find(attributePrefix);
- if(pos == 0)
- {
- string attrib = q->substr(pos + attributePrefix.size());
- _out << nl << '[' << attrib << ']';
- }
- }
- _globalMetaDataDone = true; // Do this only once per source file.
+ DefinitionContextPtr dc = p->definitionContext();
+ StringList globalMetaData = dc->getMetaData();
+
+ static const string attributePrefix = "cs:attribute:";
+
+ if(!globalMetaData.empty())
+ {
+ _out << sp;
+ }
+ for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
+ {
+ string::size_type pos = q->find(attributePrefix);
+ if(pos == 0)
+ {
+ string attrib = q->substr(pos + attributePrefix.size());
+ _out << nl << '[' << attrib << ']';
+ }
+ }
+ _globalMetaDataDone = true; // Do this only once per source file.
}
return false;
}
@@ -1119,107 +1119,107 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal() && _stream)
{
_out << sp << nl << "public sealed class " << name << "Helper";
- _out << sb;
+ _out << sb;
- _out << sp << nl << "public " << name << "Helper(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << "_in = inS__;";
- _out << nl << "_pp = new IceInternal.ParamPatcher(typeof(" << scoped << "), \"" << p->scoped() << "\");";
- _out << eb;
+ _out << sp << nl << "public " << name << "Helper(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << "_in = inS__;";
+ _out << nl << "_pp = new IceInternal.ParamPatcher(typeof(" << scoped << "), \"" << p->scoped() << "\");";
+ _out << eb;
- _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << fixId(name) << " v__)";
- _out << sb;
- _out << nl << "outS__.writeObject(v__);";
- _out << eb;
+ _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << fixId(name) << " v__)";
+ _out << sb;
+ _out << nl << "outS__.writeObject(v__);";
+ _out << eb;
- _out << sp << nl << "public void read()";
- _out << sb;
- _out << nl << "_in.readObject(_pp);";
- _out << eb;
+ _out << sp << nl << "public void read()";
+ _out << sb;
+ _out << nl << "_in.readObject(_pp);";
+ _out << eb;
- _out << sp << nl << "public " << scoped << " value";
- _out << sb;
- _out << nl << "get";
- _out << sb;
- _out << nl << "return (" << scoped << ")_pp.value;";
- _out << eb;
- _out << eb;
+ _out << sp << nl << "public " << scoped << " value";
+ _out << sb;
+ _out << nl << "get";
+ _out << sb;
+ _out << nl << "return (" << scoped << ")_pp.value;";
+ _out << eb;
+ _out << eb;
- _out << sp << nl << "private Ice.InputStream _in;";
- _out << nl << "private IceInternal.ParamPatcher _pp;";
+ _out << sp << nl << "private Ice.InputStream _in;";
+ _out << nl << "private IceInternal.ParamPatcher _pp;";
- _out << eb;
+ _out << eb;
}
_out << sp;
emitAttributes(p);
if(p->isInterface())
{
- _out << nl << "public interface " << fixId(name) << " : ";
- if(p->isLocal())
- {
- _out << "Ice.LocalObject";
- }
- else
- {
- _out << "Ice.Object";
- }
- _out << ", " << name;
- if(!p->isLocal())
- {
- _out << "Operations_, " << name;
- }
- _out << "OperationsNC_";
- if(!bases.empty())
- {
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- _out << ", " << fixId((*q)->scoped());
- q++;
- }
- }
+ _out << nl << "public interface " << fixId(name) << " : ";
+ if(p->isLocal())
+ {
+ _out << "Ice.LocalObject";
+ }
+ else
+ {
+ _out << "Ice.Object";
+ }
+ _out << ", " << name;
+ if(!p->isLocal())
+ {
+ _out << "Operations_, " << name;
+ }
+ _out << "OperationsNC_";
+ if(!bases.empty())
+ {
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ _out << ", " << fixId((*q)->scoped());
+ q++;
+ }
+ }
}
else
{
- _out << nl << "public ";
- if(p->isAbstract())
- {
- _out << "abstract ";
- }
- _out << "class " << fixId(name) << " : ";
-
- if(!hasBaseClass)
- {
- if(p->isLocal())
- {
- _out << "Ice.LocalObjectImpl";
- }
- else
- {
- _out << "Ice.ObjectImpl";
- }
- }
- else
- {
- _out << fixId(bases.front()->scoped());
- bases.pop_front();
- }
- if(p->isAbstract())
- {
- if(!p->isLocal())
- {
- _out << ", " << name << "Operations_";
- }
- _out << ", " << name << "OperationsNC_";
- }
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
- {
- if((*q)->isAbstract())
- {
- _out << ", " << fixId((*q)->scoped());
- }
- }
+ _out << nl << "public ";
+ if(p->isAbstract())
+ {
+ _out << "abstract ";
+ }
+ _out << "class " << fixId(name) << " : ";
+
+ if(!hasBaseClass)
+ {
+ if(p->isLocal())
+ {
+ _out << "Ice.LocalObjectImpl";
+ }
+ else
+ {
+ _out << "Ice.ObjectImpl";
+ }
+ }
+ else
+ {
+ _out << fixId(bases.front()->scoped());
+ bases.pop_front();
+ }
+ if(p->isAbstract())
+ {
+ if(!p->isLocal())
+ {
+ _out << ", " << name << "Operations_";
+ }
+ _out << ", " << name << "OperationsNC_";
+ }
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
+ {
+ if((*q)->isAbstract())
+ {
+ _out << ", " << fixId((*q)->scoped());
+ }
+ }
}
_out << sb;
@@ -1227,17 +1227,17 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface())
{
if(p->hasDataMembers() && !p->hasOperations())
- {
- _out << sp << nl << "#region Slice data members";
- }
- else if(p->hasDataMembers())
- {
- _out << sp << nl << "#region Slice data members and operations";
- }
- else if(p->hasOperations())
- {
- _out << sp << nl << "#region Slice operations";
- }
+ {
+ _out << sp << nl << "#region Slice data members";
+ }
+ else if(p->hasDataMembers())
+ {
+ _out << sp << nl << "#region Slice data members and operations";
+ }
+ else if(p->hasOperations())
+ {
+ _out << sp << nl << "#region Slice operations";
+ }
}
return true;
@@ -1258,261 +1258,261 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(!p->isInterface())
{
if(p->hasDataMembers() && !p->hasOperations())
- {
- _out << sp << nl << "#endregion"; // Slice data members"
- }
- else if(p->hasDataMembers())
- {
- _out << sp << nl << "#endregion"; // Slice data members and operations"
- }
- else if(p->hasOperations())
- {
- _out << sp << nl << "#endregion"; // Slice operations"
- }
-
- if(!allDataMembers.empty())
- {
- _out << sp << nl << "#region Constructors";
-
- _out << sp << nl << "public " << name << spar << epar;
- if(hasBaseClass)
- {
- _out << " : base()";
- }
- _out << sb;
- _out << eb;
-
- _out << sp << nl << "public " << name << spar;
- vector<string> paramDecl;
- for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
- {
- string memberName = fixId((*d)->name());
- string memberType = typeToString((*d)->type());
- paramDecl.push_back(memberType + " " + memberName);
- }
- _out << paramDecl << epar;
- if(hasBaseClass && allDataMembers.size() != dataMembers.size())
- {
- _out << " : base" << spar;
- vector<string> baseParamNames;
- DataMemberList baseDataMembers = bases.front()->allDataMembers();
- for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
- {
- baseParamNames.push_back(fixId((*d)->name()));
- }
- _out << baseParamNames << epar;
- }
- _out << sb;
- vector<string> paramNames;
- for(d = dataMembers.begin(); d != dataMembers.end(); ++d)
- {
- paramNames.push_back(fixId((*d)->name()));
- }
- for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
- {
- _out << nl << "this." << *i << " = " << *i << ';';
- }
- _out << eb;
-
- _out << sp << nl << "#endregion"; // Constructors
- }
-
- writeInheritedOperations(p);
+ {
+ _out << sp << nl << "#endregion"; // Slice data members"
+ }
+ else if(p->hasDataMembers())
+ {
+ _out << sp << nl << "#endregion"; // Slice data members and operations"
+ }
+ else if(p->hasOperations())
+ {
+ _out << sp << nl << "#endregion"; // Slice operations"
+ }
+
+ if(!allDataMembers.empty())
+ {
+ _out << sp << nl << "#region Constructors";
+
+ _out << sp << nl << "public " << name << spar << epar;
+ if(hasBaseClass)
+ {
+ _out << " : base()";
+ }
+ _out << sb;
+ _out << eb;
+
+ _out << sp << nl << "public " << name << spar;
+ vector<string> paramDecl;
+ for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixId((*d)->name());
+ string memberType = typeToString((*d)->type());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ _out << paramDecl << epar;
+ if(hasBaseClass && allDataMembers.size() != dataMembers.size())
+ {
+ _out << " : base" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = bases.front()->allDataMembers();
+ for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixId((*d)->name()));
+ }
+ _out << baseParamNames << epar;
+ }
+ _out << sb;
+ vector<string> paramNames;
+ for(d = dataMembers.begin(); d != dataMembers.end(); ++d)
+ {
+ paramNames.push_back(fixId((*d)->name()));
+ }
+ for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+ {
+ _out << nl << "this." << *i << " = " << *i << ';';
+ }
+ _out << eb;
+
+ _out << sp << nl << "#endregion"; // Constructors
+ }
+
+ writeInheritedOperations(p);
}
if(!p->isInterface() && !p->isLocal())
{
- writeDispatch(p);
-
- DataMemberList members = p->dataMembers();
-
- _out << sp << nl << "#region Marshaling support";
-
- _out << sp << nl << "public override void write__(IceInternal.BasicStream os__)";
- _out << sb;
- _out << nl << "os__.writeTypeId(ice_staticId());";
- _out << nl << "os__.startWriteSlice();";
- for(d = members.begin(); d != members.end(); ++d)
- {
- writeMarshalUnmarshalCode(_out, (*d)->type(),
- fixId((*d)->name(), DotNet::ICloneable, true),
- true, false, false);
- }
- _out << nl << "os__.endWriteSlice();";
- _out << nl << "base.write__(os__);";
- _out << eb;
-
- if(allClassMembers.size() != 0)
- {
- _out << sp << nl << "public sealed ";
- if(hasBaseClass && bases.front()->declaration()->usesClasses())
- {
- _out << "new ";
- }
- _out << "class Patcher__ : IceInternal.Patcher";
- _out << sb;
- _out << sp << nl << "internal Patcher__(Ice.ObjectImpl instance";
- if(allClassMembers.size() > 1)
- {
- _out << ", int member";
- }
- _out << ")";
- _out << sb;
- _out << nl << "_instance = (" << name << ")instance;";
- if(allClassMembers.size() > 1)
- {
- _out << nl << "_member = member;";
- }
- _out << eb;
-
- _out << sp << nl << "public override void patch(Ice.Object v)";
- _out << sb;
- _out << nl << "try";
- _out << sb;
- if(allClassMembers.size() > 1)
- {
- _out << nl << "switch(_member)";
- _out << sb;
- }
- int memberCount = 0;
- for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
- {
- if(allClassMembers.size() > 1)
- {
- _out.dec();
- _out << nl << "case " << memberCount << ":";
- _out.inc();
- }
- string memberName = fixId((*d)->name(), DotNet::ICloneable, true);
- string memberType = typeToString((*d)->type());
- _out << nl << "type_ = typeof(" << memberType << ");";
- _out << nl << "_instance." << memberName << " = (" << memberType << ")v;";
- _out << nl << "_typeId = \"" << (*d)->type()->typeId() << "\";";
- if(allClassMembers.size() > 1)
- {
- _out << nl << "break;";
- }
- memberCount++;
- }
- if(allClassMembers.size() > 1)
- {
- _out << eb;
- }
- _out << eb;
- _out << nl << "catch(System.InvalidCastException)";
- _out << sb;
- _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- _out << nl << "_e.type = v.ice_id();";
- _out << nl << "_e.expectedType = _typeId;";
- _out << nl << "throw _e;";
- _out << eb;
- _out << eb;
-
- _out << sp << nl << "private " << name << " _instance;";
- if(allClassMembers.size() > 1)
- {
- _out << nl << "private int _member;";
- }
- _out << nl << "private string _typeId;";
- _out << eb;
- }
-
- _out << sp << nl << "public override void read__(IceInternal.BasicStream is__, bool rid__)";
- _out << sb;
- _out << nl << "if(rid__)";
- _out << sb;
- _out << nl << "/* string myId = */ is__.readTypeId();";
- _out << eb;
- _out << nl << "is__.startReadSlice();";
- int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
- for(d = members.begin(); d != members.end(); ++d)
- {
- ostringstream patchParams;
- patchParams << "this";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*d)->type(),
- fixId((*d)->name(), DotNet::ICloneable, true),
- false, false, false, patchParams.str());
- }
- _out << nl << "is__.endReadSlice();";
- _out << nl << "base.read__(is__, true);";
- _out << eb;
-
- //
- // Write streaming API.
- //
- if(_stream)
- {
- _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- _out << nl << "outS__.writeTypeId(ice_staticId());";
- _out << nl << "outS__.startSlice();";
- for(d = members.begin(); d != members.end(); ++d)
- {
- writeMarshalUnmarshalCode(_out, (*d)->type(),
- fixId((*d)->name(), DotNet::ICloneable, true),
- true, true, false);
- }
- _out << nl << "outS__.endSlice();";
- _out << nl << "base.write__(outS__);";
- _out << eb;
-
- _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
- _out << sb;
- _out << nl << "if(rid__)";
- _out << sb;
- _out << nl << "/* string myId = */ inS__.readTypeId();";
- _out << eb;
- _out << nl << "inS__.startSlice();";
- for(d = members.begin(); d != members.end(); ++d)
- {
- ostringstream patchParams;
- patchParams << "this";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*d)->type(),
- fixId((*d)->name(), DotNet::ICloneable, true),
- false, true, false, patchParams.str());
- }
- _out << nl << "inS__.endSlice();";
- _out << nl << "base.read__(inS__, true);";
- _out << eb;
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
+ writeDispatch(p);
+
+ DataMemberList members = p->dataMembers();
+
+ _out << sp << nl << "#region Marshaling support";
+
+ _out << sp << nl << "public override void write__(IceInternal.BasicStream os__)";
+ _out << sb;
+ _out << nl << "os__.writeTypeId(ice_staticId());";
+ _out << nl << "os__.startWriteSlice();";
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ writeMarshalUnmarshalCode(_out, (*d)->type(),
+ fixId((*d)->name(), DotNet::ICloneable, true),
+ true, false, false);
+ }
+ _out << nl << "os__.endWriteSlice();";
+ _out << nl << "base.write__(os__);";
+ _out << eb;
+
+ if(allClassMembers.size() != 0)
+ {
+ _out << sp << nl << "public sealed ";
+ if(hasBaseClass && bases.front()->declaration()->usesClasses())
+ {
+ _out << "new ";
+ }
+ _out << "class Patcher__ : IceInternal.Patcher";
+ _out << sb;
+ _out << sp << nl << "internal Patcher__(Ice.ObjectImpl instance";
+ if(allClassMembers.size() > 1)
+ {
+ _out << ", int member";
+ }
+ _out << ")";
+ _out << sb;
+ _out << nl << "_instance = (" << name << ")instance;";
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "_member = member;";
+ }
+ _out << eb;
+
+ _out << sp << nl << "public override void patch(Ice.Object v)";
+ _out << sb;
+ _out << nl << "try";
+ _out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "switch(_member)";
+ _out << sb;
+ }
+ int memberCount = 0;
+ for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
+ {
+ if(allClassMembers.size() > 1)
+ {
+ _out.dec();
+ _out << nl << "case " << memberCount << ":";
+ _out.inc();
+ }
+ string memberName = fixId((*d)->name(), DotNet::ICloneable, true);
+ string memberType = typeToString((*d)->type());
+ _out << nl << "type_ = typeof(" << memberType << ");";
+ _out << nl << "_instance." << memberName << " = (" << memberType << ")v;";
+ _out << nl << "_typeId = \"" << (*d)->type()->typeId() << "\";";
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(allClassMembers.size() > 1)
+ {
+ _out << eb;
+ }
+ _out << eb;
+ _out << nl << "catch(System.InvalidCastException)";
+ _out << sb;
+ _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ _out << nl << "_e.type = v.ice_id();";
+ _out << nl << "_e.expectedType = _typeId;";
+ _out << nl << "throw _e;";
+ _out << eb;
+ _out << eb;
+
+ _out << sp << nl << "private " << name << " _instance;";
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "private int _member;";
+ }
+ _out << nl << "private string _typeId;";
+ _out << eb;
+ }
+
+ _out << sp << nl << "public override void read__(IceInternal.BasicStream is__, bool rid__)";
+ _out << sb;
+ _out << nl << "if(rid__)";
+ _out << sb;
+ _out << nl << "/* string myId = */ is__.readTypeId();";
+ _out << eb;
+ _out << nl << "is__.startReadSlice();";
+ int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ ostringstream patchParams;
+ patchParams << "this";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*d)->type(),
+ fixId((*d)->name(), DotNet::ICloneable, true),
+ false, false, false, patchParams.str());
+ }
+ _out << nl << "is__.endReadSlice();";
+ _out << nl << "base.read__(is__, true);";
+ _out << eb;
+
+ //
+ // Write streaming API.
+ //
+ if(_stream)
+ {
+ _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
+ _out << sb;
+ _out << nl << "outS__.writeTypeId(ice_staticId());";
+ _out << nl << "outS__.startSlice();";
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ writeMarshalUnmarshalCode(_out, (*d)->type(),
+ fixId((*d)->name(), DotNet::ICloneable, true),
+ true, true, false);
+ }
+ _out << nl << "outS__.endSlice();";
+ _out << nl << "base.write__(outS__);";
+ _out << eb;
+
+ _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
+ _out << sb;
+ _out << nl << "if(rid__)";
+ _out << sb;
+ _out << nl << "/* string myId = */ inS__.readTypeId();";
+ _out << eb;
+ _out << nl << "inS__.startSlice();";
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ ostringstream patchParams;
+ patchParams << "this";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*d)->type(),
+ fixId((*d)->name(), DotNet::ICloneable, true),
+ false, true, false, patchParams.str());
+ }
+ _out << nl << "inS__.endSlice();";
+ _out << nl << "base.read__(inS__, true);";
+ _out << eb;
+ }
+ else
+ {
+ //
+ // Emit placeholder functions to catch errors.
+ //
string scoped = p->scoped();
- _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
+ _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
+ _out << sb;
+ _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
+ _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
+ _out << nl << "throw ex;";
+ _out << eb;
- _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
- }
+ _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
+ _out << sb;
+ _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
+ _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
+ _out << nl << "throw ex;";
+ _out << eb;
+ }
- _out << sp << nl << "#endregion"; // Marshalling support
+ _out << sp << nl << "#endregion"; // Marshalling support
}
_out << eb;
@@ -1539,17 +1539,17 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
if(!amd)
{
- params = getParams(p);
- args = getArgs(p);
- name = fixId(name, DotNet::ICloneable, true);
- retS = typeToString(p->returnType());
+ params = getParams(p);
+ args = getArgs(p);
+ name = fixId(name, DotNet::ICloneable, true);
+ retS = typeToString(p->returnType());
}
else
{
- params = getParamsAsync(p, true);
- args = getArgsAsync(p);
- retS = "void";
- name = name + "_async";
+ params = getParamsAsync(p, true);
+ args = getArgsAsync(p);
+ retS = "void";
+ name = name + "_async";
}
_out << sp;
@@ -1566,20 +1566,20 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
}
else
{
- _out << sb;
- _out << nl;
- if(!amd && p->returnType())
- {
- _out << "return ";
- }
- _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';';
- _out << eb;
+ _out << sb;
+ _out << nl;
+ if(!amd && p->returnType())
+ {
+ _out << "return ";
+ }
+ _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';';
+ _out << eb;
}
if(!isLocal)
{
- _out << nl << "public abstract " << retS << " " << name
- << spar << params << "Ice.Current current__" << epar << ';';
+ _out << nl << "public abstract " << retS << " " << name
+ << spar << params << "Ice.Current current__" << epar << ';';
}
}
@@ -1879,13 +1879,13 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out << sb;
if(!isValue)
{
- _out << nl << "if((object)InnerList[i] != null)";
- _out << sb;
+ _out << nl << "if((object)InnerList[i] != null)";
+ _out << sb;
}
_out << nl << "hash = 5 * hash + InnerList[i].GetHashCode();";
if(!isValue)
{
- _out << eb;
+ _out << eb;
}
_out << eb;
_out << nl << "return hash;";
@@ -1909,15 +1909,15 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out << sb;
if(!isValue)
{
- _out << nl << "if(InnerList[i__] == null)";
- _out << sb;
- _out << nl << "if(((" << name << ")other)[i__] != null)";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
- _out << eb;
- _out << nl << "else";
- _out << sb;
+ _out << nl << "if(InnerList[i__] == null)";
+ _out << sb;
+ _out << nl << "if(((" << name << ")other)[i__] != null)";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
+ _out << eb;
+ _out << nl << "else";
+ _out << sb;
}
_out << nl << "if(!((" << s << ")(InnerList[i__])).Equals(((" << name << ")other)[i__]))";
_out << sb;
@@ -1974,7 +1974,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(!p->dataMembers().empty())
{
- _out << sp << nl << "#region Slice data members";
+ _out << sp << nl << "#region Slice data members";
}
return true;
@@ -1991,7 +1991,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(!dataMembers.empty())
{
- _out << sp << nl << "#endregion"; // Slice data members
+ _out << sp << nl << "#endregion"; // Slice data members
}
_out << sp << nl << "#region Constructors";
@@ -2024,17 +2024,17 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), DotNet::ApplicationException);
- bool isValue = isValueType((*q)->type());
- if(!isValue)
- {
- _out << nl << "if((object)" << memberName << " != null)";
- _out << sb;
- }
- _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();";
- if(!isValue)
- {
- _out << eb;
- }
+ bool isValue = isValueType((*q)->type());
+ if(!isValue)
+ {
+ _out << nl << "if((object)" << memberName << " != null)";
+ _out << sb;
+ }
+ _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();";
+ if(!isValue)
+ {
+ _out << eb;
+ }
}
_out << nl << "return h__;";
_out << eb;
@@ -2056,27 +2056,27 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), DotNet::ApplicationException);
- bool isValue = isValueType((*q)->type());
- if(!isValue)
- {
- _out << nl << "if(" << memberName << " == null)";
- _out << sb;
- _out << nl << "if(((" << name << ")other__)." << memberName << " != null)";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
- _out << eb;
- _out << nl << "else";
- _out << sb;
- }
- _out << nl << "if(!" << memberName << ".Equals(((" << name << ")other__)." << memberName << "))";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
- if(!isValue)
- {
- _out << eb;
- }
+ bool isValue = isValueType((*q)->type());
+ if(!isValue)
+ {
+ _out << nl << "if(" << memberName << " == null)";
+ _out << sb;
+ _out << nl << "if(((" << name << ")other__)." << memberName << " != null)";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
+ _out << eb;
+ _out << nl << "else";
+ _out << sb;
+ }
+ _out << nl << "if(!" << memberName << ".Equals(((" << name << ")other__)." << memberName << "))";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
+ if(!isValue)
+ {
+ _out << eb;
+ }
}
_out << nl << "return true;";
_out << eb;
@@ -2107,206 +2107,206 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp << nl << "public override void write__(IceInternal.BasicStream os__)";
_out << sb;
- _out << nl << "os__.writeString(\"" << scoped << "\");";
- _out << nl << "os__.startWriteSlice();";
+ _out << nl << "os__.writeString(\"" << scoped << "\");";
+ _out << nl << "os__.startWriteSlice();";
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- true, false, false);
+ fixId((*q)->name(), DotNet::ApplicationException),
+ true, false, false);
}
- _out << nl << "os__.endWriteSlice();";
+ _out << nl << "os__.endWriteSlice();";
if(base)
{
_out << nl << "base.write__(os__);";
}
_out << eb;
- DataMemberList allClassMembers = p->allClassDataMembers();
- if(allClassMembers.size() != 0)
- {
- _out << sp << nl << "public sealed ";
- if(base && base->usesClasses())
- {
- _out << "new ";
- }
- _out << "class Patcher__ : IceInternal.Patcher";
- _out << sb;
- _out << sp << nl << "internal Patcher__(Ice.Exception instance";
- if(allClassMembers.size() > 1)
- {
- _out << ", int member";
- }
- _out << ")";
- _out << sb;
- _out << nl << "_instance = (" << name << ")instance;";
- if(allClassMembers.size() > 1)
- {
- _out << nl << "_member = member;";
- }
- _out << eb;
-
- _out << sp << nl << "public override void patch(Ice.Object v)";
- _out << sb;
- _out << nl << "try";
- _out << sb;
- if(allClassMembers.size() > 1)
- {
- _out << nl << "switch(_member)";
- _out << sb;
- }
- int memberCount = 0;
- for(q = allClassMembers.begin(); q != allClassMembers.end(); ++q)
- {
- if(allClassMembers.size() > 1)
- {
- _out.dec();
- _out << nl << "case " << memberCount << ":";
- _out.inc();
- }
- string memberName = fixId((*q)->name(), DotNet::ApplicationException);
- string memberType = typeToString((*q)->type());
- _out << nl << "type_ = typeof(" << memberType << ");";
- _out << nl << "_instance." << memberName << " = (" << memberType << ")v;";
- _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\";";
- if(allClassMembers.size() > 1)
- {
- _out << nl << "break;";
- }
- memberCount++;
- }
- if(allClassMembers.size() > 1)
- {
- _out << eb;
- }
- _out << eb;
- _out << nl << "catch(System.InvalidCastException)";
- _out << sb;
- _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- _out << nl << "_e.type = v.ice_id();";
- _out << nl << "_e.expectedType = _typeId;";
- _out << nl << "throw _e;";
- _out << eb;
- _out << eb;
-
- _out << sp << nl << "private " << name << " _instance;";
- if(allClassMembers.size() > 1)
- {
- _out << nl << "private int _member;";
- }
- _out << nl << "private string _typeId;";
- _out << eb;
- }
+ DataMemberList allClassMembers = p->allClassDataMembers();
+ if(allClassMembers.size() != 0)
+ {
+ _out << sp << nl << "public sealed ";
+ if(base && base->usesClasses())
+ {
+ _out << "new ";
+ }
+ _out << "class Patcher__ : IceInternal.Patcher";
+ _out << sb;
+ _out << sp << nl << "internal Patcher__(Ice.Exception instance";
+ if(allClassMembers.size() > 1)
+ {
+ _out << ", int member";
+ }
+ _out << ")";
+ _out << sb;
+ _out << nl << "_instance = (" << name << ")instance;";
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "_member = member;";
+ }
+ _out << eb;
+
+ _out << sp << nl << "public override void patch(Ice.Object v)";
+ _out << sb;
+ _out << nl << "try";
+ _out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "switch(_member)";
+ _out << sb;
+ }
+ int memberCount = 0;
+ for(q = allClassMembers.begin(); q != allClassMembers.end(); ++q)
+ {
+ if(allClassMembers.size() > 1)
+ {
+ _out.dec();
+ _out << nl << "case " << memberCount << ":";
+ _out.inc();
+ }
+ string memberName = fixId((*q)->name(), DotNet::ApplicationException);
+ string memberType = typeToString((*q)->type());
+ _out << nl << "type_ = typeof(" << memberType << ");";
+ _out << nl << "_instance." << memberName << " = (" << memberType << ")v;";
+ _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\";";
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(allClassMembers.size() > 1)
+ {
+ _out << eb;
+ }
+ _out << eb;
+ _out << nl << "catch(System.InvalidCastException)";
+ _out << sb;
+ _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ _out << nl << "_e.type = v.ice_id();";
+ _out << nl << "_e.expectedType = _typeId;";
+ _out << nl << "throw _e;";
+ _out << eb;
+ _out << eb;
+
+ _out << sp << nl << "private " << name << " _instance;";
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "private int _member;";
+ }
+ _out << nl << "private string _typeId;";
+ _out << eb;
+ }
_out << sp << nl << "public override void read__(IceInternal.BasicStream is__, bool rid__)";
_out << sb;
- _out << nl << "if(rid__)";
- _out << sb;
- _out << nl << "/* string myId = */ is__.readString();";
- _out << eb;
- _out << nl << "is__.startReadSlice();";
- DataMemberList classMembers = p->classDataMembers();
- int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
+ _out << nl << "if(rid__)";
+ _out << sb;
+ _out << nl << "/* string myId = */ is__.readString();";
+ _out << eb;
+ _out << nl << "is__.startReadSlice();";
+ DataMemberList classMembers = p->classDataMembers();
+ int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- ostringstream patchParams;
- patchParams << "this";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
+ ostringstream patchParams;
+ patchParams << "this";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- false, false, false, patchParams.str());
+ fixId((*q)->name(), DotNet::ApplicationException),
+ false, false, false, patchParams.str());
}
- _out << nl << "is__.endReadSlice();";
+ _out << nl << "is__.endReadSlice();";
if(base)
{
_out << nl << "base.read__(is__, true);";
}
_out << eb;
- if(_stream)
- {
- _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- _out << nl << "outS__.writeString(\"" << scoped << "\");";
- _out << nl << "outS__.startSlice();";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- true, true, false);
- }
- _out << nl << "outS__.endSlice();";
- if(base)
- {
- _out << nl << "base.write__(outS__);";
- }
- _out << eb;
-
- _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
- _out << sb;
- _out << nl << "if(rid__)";
- _out << sb;
- _out << nl << "/* string myId = */ inS__.readString();";
- _out << eb;
- _out << nl << "inS__.startSlice();";
- classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- ostringstream patchParams;
- patchParams << "this";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- false, true, false, patchParams.str());
- }
- _out << nl << "inS__.endSlice();";
- if(base)
- {
- _out << nl << "base.read__(inS__, true);";
- }
- _out << eb;
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
-
- _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
- }
-
- if(!base || base && !base->usesClasses())
- {
- _out << sp << nl << "public override bool usesClasses__()";
- _out << sb;
- _out << nl << "return true;";
- _out << eb;
- }
+ if(_stream)
+ {
+ _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
+ _out << sb;
+ _out << nl << "outS__.writeString(\"" << scoped << "\");";
+ _out << nl << "outS__.startSlice();";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), DotNet::ApplicationException),
+ true, true, false);
+ }
+ _out << nl << "outS__.endSlice();";
+ if(base)
+ {
+ _out << nl << "base.write__(outS__);";
+ }
+ _out << eb;
+
+ _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
+ _out << sb;
+ _out << nl << "if(rid__)";
+ _out << sb;
+ _out << nl << "/* string myId = */ inS__.readString();";
+ _out << eb;
+ _out << nl << "inS__.startSlice();";
+ classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ ostringstream patchParams;
+ patchParams << "this";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), DotNet::ApplicationException),
+ false, true, false, patchParams.str());
+ }
+ _out << nl << "inS__.endSlice();";
+ if(base)
+ {
+ _out << nl << "base.read__(inS__, true);";
+ }
+ _out << eb;
+ }
+ else
+ {
+ //
+ // Emit placeholder functions to catch errors.
+ //
+ _out << sp << nl << "public override void write__(Ice.OutputStream outS__)";
+ _out << sb;
+ _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
+ _out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
+ _out << nl << "throw ex;";
+ _out << eb;
+
+ _out << sp << nl << "public override void read__(Ice.InputStream inS__, bool rid__)";
+ _out << sb;
+ _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
+ _out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
+ _out << nl << "throw ex;";
+ _out << eb;
+ }
+
+ if(!base || base && !base->usesClasses())
+ {
+ _out << sp << nl << "public override bool usesClasses__()";
+ _out << sb;
+ _out << nl << "return true;";
+ _out << eb;
+ }
_out << sp << nl << "#endregion"; // Marshalling support
}
@@ -2322,21 +2322,21 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
if(!p->isLocal() && _stream)
{
_out << sp << nl << "public sealed class " << p->name() << "Helper";
- _out << sb;
+ _out << sb;
- _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << name << " v__)";
- _out << sb;
- _out << nl << "v__.ice_write(outS__);";
- _out << eb;
+ _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << name << " v__)";
+ _out << sb;
+ _out << nl << "v__.ice_write(outS__);";
+ _out << eb;
- _out << sp << nl << "public static " << name << " read(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << name << " v__ = new " << name << "();";
- _out << nl << "v__.ice_read(inS__);";
- _out << nl << "return v__;";
- _out << eb;
+ _out << sp << nl << "public static " << name << " read(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << name << " v__ = new " << name << "();";
+ _out << nl << "v__.ice_read(inS__);";
+ _out << nl << "return v__;";
+ _out << eb;
- _out << eb;
+ _out << eb;
}
_out << sp;
@@ -2346,11 +2346,11 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
emitAttributes(p);
if(isValueType(p))
{
- _out << nl << "public struct " << name;
+ _out << nl << "public struct " << name;
}
else
{
- _out << nl << "public class " << name << " : _System.ICloneable";
+ _out << nl << "public class " << name << " : _System.ICloneable";
}
_out << sb;
@@ -2376,9 +2376,9 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(isClass)
{
_out << "s";
- _out << sp << nl << "public " << name << "()";
- _out << sb;
- _out << eb;
+ _out << sp << nl << "public " << name << "()";
+ _out << sb;
+ _out << eb;
}
_out << sp << nl << "public " << name << spar;
@@ -2387,15 +2387,15 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name());
- string memberType = typeToString((*q)->type());
- paramDecl.push_back(memberType + " " + memberName);
- paramNames.push_back(memberName);
+ string memberType = typeToString((*q)->type());
+ paramDecl.push_back(memberType + " " + memberName);
+ paramNames.push_back(memberName);
}
_out << paramDecl << epar;
_out << sb;
for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
{
- _out << nl << "this." << *i << " = " << *i << ';';
+ _out << nl << "this." << *i << " = " << *i << ';';
}
_out << eb;
@@ -2403,14 +2403,14 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(isClass)
{
- _out << sp << nl << "#region ICloneable members";
+ _out << sp << nl << "#region ICloneable members";
- _out << sp << nl << "public object Clone()";
- _out << sb;
- _out << nl << "return MemberwiseClone();";
- _out << eb;
+ _out << sp << nl << "public object Clone()";
+ _out << sb;
+ _out << nl << "return MemberwiseClone();";
+ _out << eb;
- _out << sp << nl << "#endregion"; // ICloneable members
+ _out << sp << nl << "#endregion"; // ICloneable members
}
_out << sp << nl << "#region Object members";
@@ -2421,17 +2421,17 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
- bool isValue = isValueType((*q)->type());
- if(!isValue)
- {
- _out << nl << "if(" << memberName << " != null)";
- _out << sb;
- }
- _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();";
- if(!isValue)
- {
- _out << eb;
- }
+ bool isValue = isValueType((*q)->type());
+ if(!isValue)
+ {
+ _out << nl << "if(" << memberName << " != null)";
+ _out << sb;
+ }
+ _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();";
+ if(!isValue)
+ {
+ _out << eb;
+ }
}
_out << nl << "return h__;";
_out << eb;
@@ -2440,22 +2440,22 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sb;
if(isClass)
{
- _out << nl << "if(object.ReferenceEquals(this, other__))";
- _out << sb;
- _out << nl << "return true;";
- _out << eb;
+ _out << nl << "if(object.ReferenceEquals(this, other__))";
+ _out << sb;
+ _out << nl << "return true;";
+ _out << eb;
}
if(isClass)
{
- _out << nl << "if(other__ == null)";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
+ _out << nl << "if(other__ == null)";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
_out << nl << "if(GetType() != other__.GetType())";
}
else
{
- _out << nl << "if(!(other__ is " << name << "))";
+ _out << nl << "if(!(other__ is " << name << "))";
}
_out << sb;
_out << nl << "return false;";
@@ -2466,31 +2466,31 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
- if(!isValueType((*q)->type()))
- {
- _out << nl << "if(" << memberName << " == null)";
- _out << sb;
- _out << nl << "if(o__." << memberName << " != null)";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
- _out << eb;
- _out << nl << "else";
- _out << sb;
- _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
- _out << eb;
- }
- else
- {
- _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
- }
+ string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
+ if(!isValueType((*q)->type()))
+ {
+ _out << nl << "if(" << memberName << " == null)";
+ _out << sb;
+ _out << nl << "if(o__." << memberName << " != null)";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
+ _out << eb;
+ _out << nl << "else";
+ _out << sb;
+ _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
+ _out << eb;
+ }
+ else
+ {
+ _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
+ }
}
_out << nl << "return true;";
_out << eb;
@@ -2517,140 +2517,140 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp << nl << "public void write__(IceInternal.BasicStream os__)";
_out << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
- true, false, false);
- }
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
+ true, false, false);
+ }
_out << eb;
- if(isClass && classMembers.size() != 0)
- {
- _out << sp << nl << "public sealed class Patcher__ : IceInternal.Patcher";
- _out << sb;
- _out << sp << nl << "internal Patcher__(" << name << " instance";
- if(classMembers.size() > 1)
- {
- _out << ", int member";
- }
- _out << ")";
- _out << sb;
- _out << nl << "_instance = instance;";
- if(classMembers.size() > 1)
- {
- _out << nl << "_member = member;";
- }
- _out << eb;
-
- _out << sp << nl << "public override void patch(Ice.Object v)";
- _out << sb;
- _out << nl << "try";
- _out << sb;
- if(classMembers.size() > 1)
- {
- _out << nl << "switch(_member)";
- _out << sb;
- }
- int memberCount = 0;
- for(q = classMembers.begin(); q != classMembers.end(); ++q)
- {
- if(classMembers.size() > 1)
- {
- _out.dec();
- _out << nl << "case " << memberCount << ":";
- _out.inc();
- }
- string memberType = typeToString((*q)->type());
- string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
- _out << nl << "type_ = typeof(" << memberType << ");";
- _out << nl << "_instance." << memberName << " = (" << memberType << ")v;";
- _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\";";
- if(classMembers.size() > 1)
- {
- _out << nl << "break;";
- }
- memberCount++;
- }
- if(classMembers.size() > 1)
- {
- _out << eb;
- }
- _out << eb;
- _out << nl << "catch(System.InvalidCastException)";
- _out << sb;
- _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- _out << nl << "_e.type = v.ice_id();";
- _out << nl << "_e.expectedType = _typeId;";
- _out << nl << "throw _e;";
- _out << eb;
- _out << eb;
-
- _out << sp << nl << "private " << name;
- _out << " _instance;";
- if(classMembers.size() > 1)
- {
- _out << nl << "private int _member;";
- }
- _out << nl << "private string _typeId;";
- _out << eb;
- }
+ if(isClass && classMembers.size() != 0)
+ {
+ _out << sp << nl << "public sealed class Patcher__ : IceInternal.Patcher";
+ _out << sb;
+ _out << sp << nl << "internal Patcher__(" << name << " instance";
+ if(classMembers.size() > 1)
+ {
+ _out << ", int member";
+ }
+ _out << ")";
+ _out << sb;
+ _out << nl << "_instance = instance;";
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "_member = member;";
+ }
+ _out << eb;
+
+ _out << sp << nl << "public override void patch(Ice.Object v)";
+ _out << sb;
+ _out << nl << "try";
+ _out << sb;
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "switch(_member)";
+ _out << sb;
+ }
+ int memberCount = 0;
+ for(q = classMembers.begin(); q != classMembers.end(); ++q)
+ {
+ if(classMembers.size() > 1)
+ {
+ _out.dec();
+ _out << nl << "case " << memberCount << ":";
+ _out.inc();
+ }
+ string memberType = typeToString((*q)->type());
+ string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
+ _out << nl << "type_ = typeof(" << memberType << ");";
+ _out << nl << "_instance." << memberName << " = (" << memberType << ")v;";
+ _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\";";
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(classMembers.size() > 1)
+ {
+ _out << eb;
+ }
+ _out << eb;
+ _out << nl << "catch(System.InvalidCastException)";
+ _out << sb;
+ _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ _out << nl << "_e.type = v.ice_id();";
+ _out << nl << "_e.expectedType = _typeId;";
+ _out << nl << "throw _e;";
+ _out << eb;
+ _out << eb;
+
+ _out << sp << nl << "private " << name;
+ _out << " _instance;";
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "private int _member;";
+ }
+ _out << nl << "private string _typeId;";
+ _out << eb;
+ }
_out << sp << nl << "public void read__(IceInternal.BasicStream is__)";
_out << sb;
- int classMemberCount = 0;
+ int classMemberCount = 0;
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- ostringstream patchParams;
- patchParams << "this";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
+ ostringstream patchParams;
+ patchParams << "this";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
- false, false, false, patchParams.str());
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
+ false, false, false, patchParams.str());
}
_out << eb;
- if(_stream)
- {
- _out << sp << nl << "public void ice_write(Ice.OutputStream outS__)";
- _out << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
- true, true, false);
- }
- _out << eb;
-
- _out << sp << nl << "public void ice_read(Ice.InputStream inS__)";
- _out << sb;
- classMemberCount = 0;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- ostringstream patchParams;
- patchParams << "this";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
- false, true, false, patchParams.str());
- }
- _out << eb;
- }
+ if(_stream)
+ {
+ _out << sp << nl << "public void ice_write(Ice.OutputStream outS__)";
+ _out << sb;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
+ true, true, false);
+ }
+ _out << eb;
+
+ _out << sp << nl << "public void ice_read(Ice.InputStream inS__)";
+ _out << sb;
+ classMemberCount = 0;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ ostringstream patchParams;
+ patchParams << "this";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
+ false, true, false, patchParams.str());
+ }
+ _out << eb;
+ }
_out << sp << nl << "#endregion"; // Marshalling support
}
@@ -2806,13 +2806,13 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
_out << nl << "hash = 5 * hash + e.Key.GetHashCode();";
if(!valueIsValue)
{
- _out << nl << "if(e.Value != null)";
- _out << sb;
+ _out << nl << "if(e.Value != null)";
+ _out << sb;
}
_out << nl << "hash = 5 * hash + e.Value.GetHashCode();";
if(!valueIsValue)
{
- _out << eb;
+ _out << eb;
}
_out << eb;
_out << nl << "return hash;";
@@ -2849,22 +2849,22 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
bool valueIsArray = seq && !seq->hasMetaData("clr:collection");
if(valueIsArray)
{
- _out << nl << vs << "[] vlhs__ = new " << toArrayAlloc(vs + "[]", "Count") << ';';
+ _out << nl << vs << "[] vlhs__ = new " << toArrayAlloc(vs + "[]", "Count") << ';';
}
else
{
- _out << nl << vs << "[] vlhs__ = new " << vs << "[Count];";
+ _out << nl << vs << "[] vlhs__ = new " << vs << "[Count];";
}
_out << nl << "Values.CopyTo(vlhs__, 0);";
_out << nl << "_System.Array.Sort(vlhs__);";
string vrhsCount = "((" + name + ")other).Count";
if(valueIsArray)
{
- _out << nl << vs << "[] vrhs__ = new " << toArrayAlloc(vs + "[]", vrhsCount) << ';';
+ _out << nl << vs << "[] vrhs__ = new " << toArrayAlloc(vs + "[]", vrhsCount) << ';';
}
else
{
- _out << nl << vs << "[] vrhs__ = new " << vs << '[' << vrhsCount << "];";
+ _out << nl << vs << "[] vrhs__ = new " << vs << '[' << vrhsCount << "];";
}
_out << nl << "((" << name << ")other).Values.CopyTo(vrhs__, 0);";
_out << nl << "_System.Array.Sort(vrhs__);";
@@ -2872,24 +2872,24 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
_out << sb;
if(!valueIsValue)
{
- _out << nl << "if(vlhs__[i] == null)";
- _out << sb;
- _out << nl << "if(vrhs__[i] != null)";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
- _out << eb;
- _out << nl << "else if(!vlhs__[i].Equals(vrhs__[i]))";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
+ _out << nl << "if(vlhs__[i] == null)";
+ _out << sb;
+ _out << nl << "if(vrhs__[i] != null)";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
+ _out << eb;
+ _out << nl << "else if(!vlhs__[i].Equals(vrhs__[i]))";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
}
else
{
- _out << nl << "if(!vlhs__[i].Equals(vrhs__[i]))";
- _out << sb;
- _out << nl << "return false;";
- _out << eb;
+ _out << nl << "if(!vlhs__[i].Equals(vrhs__[i]))";
+ _out << sb;
+ _out << nl << "return false;";
+ _out << eb;
}
_out << eb;
_out << nl << "return true;";
@@ -2931,29 +2931,29 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
while(en != enumerators.end())
{
_out << nl << fixId((*en)->name());
- if(++en != enumerators.end())
- {
- _out << ',';
- }
+ if(++en != enumerators.end())
+ {
+ _out << ',';
+ }
}
_out << eb;
if(_stream)
{
- _out << sp << nl << "public sealed class " << name << "Helper";
- _out << sb;
+ _out << sp << nl << "public sealed class " << name << "Helper";
+ _out << sb;
- _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << scoped << " v__)";
- _out << sb;
- writeMarshalUnmarshalCode(_out, p, "v__", true, true, false);
- _out << eb;
+ _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << scoped << " v__)";
+ _out << sb;
+ writeMarshalUnmarshalCode(_out, p, "v__", true, true, false);
+ _out << eb;
- _out << sp << nl << "public static " << scoped << " read(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << scoped << " v__;";
- writeMarshalUnmarshalCode(_out, p, "v__", false, true, false);
- _out << nl << "return v__;";
- _out << eb;
+ _out << sp << nl << "public static " << scoped << " read(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << scoped << " v__;";
+ writeMarshalUnmarshalCode(_out, p, "v__", false, true, false);
+ _out << nl << "return v__;";
+ _out << eb;
_out << eb;
}
@@ -2971,59 +2971,59 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
BuiltinPtr bp = BuiltinPtr::dynamicCast(p->type());
if(bp && bp->kind() == Builtin::KindString)
{
- //
- // Expand strings into the basic source character set. We can't use isalpha() and the like
- // here because they are sensitive to the current locale.
- //
- static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789"
- "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
- static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
-
- _out << "\""; // Opening "
-
- const string val = p->value();
- for(string::const_iterator c = val.begin(); c != val.end(); ++c)
- {
- if(charSet.find(*c) == charSet.end())
- {
- unsigned char uc = *c; // char may be signed, so make it positive
- ostringstream s;
- s << "\\u"; // Print as unicode if not in basic source character set
- s << hex;
- s.width(4);
- s.fill('0');
- s << static_cast<unsigned>(uc);
- _out << s.str();
- }
- else
- {
- _out << *c; // Print normally if in basic source character set
- }
- }
-
- _out << "\""; // Closing "
+ //
+ // Expand strings into the basic source character set. We can't use isalpha() and the like
+ // here because they are sensitive to the current locale.
+ //
+ static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
+ static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
+
+ _out << "\""; // Opening "
+
+ const string val = p->value();
+ for(string::const_iterator c = val.begin(); c != val.end(); ++c)
+ {
+ if(charSet.find(*c) == charSet.end())
+ {
+ unsigned char uc = *c; // char may be signed, so make it positive
+ ostringstream s;
+ s << "\\u"; // Print as unicode if not in basic source character set
+ s << hex;
+ s.width(4);
+ s.fill('0');
+ s << static_cast<unsigned>(uc);
+ _out << s.str();
+ }
+ else
+ {
+ _out << *c; // Print normally if in basic source character set
+ }
+ }
+
+ _out << "\""; // Closing "
}
else if(bp && bp->kind() == Builtin::KindLong)
{
- _out << p->value() << "L";
+ _out << p->value() << "L";
}
else if(bp && bp->kind() == Builtin::KindFloat)
{
- _out << p->value() << "F";
+ _out << p->value() << "F";
}
else
{
- EnumPtr ep = EnumPtr::dynamicCast(p->type());
- if(ep)
- {
- _out << typeToString(p->type()) << "." << fixId(p->value());
- }
- else
- {
- _out << p->value();
- }
+ EnumPtr ep = EnumPtr::dynamicCast(p->type());
+ if(ep)
+ {
+ _out << typeToString(p->type()) << "." << fixId(p->value());
+ }
+ else
+ {
+ _out << p->value();
+ }
}
_out << ";";
_out << eb;
@@ -3041,14 +3041,14 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
if(StructPtr::dynamicCast(cont))
{
isValue = isValueType(StructPtr::dynamicCast(cont));
- if(!isValue || cont->hasMetaData("clr:class"))
- {
- baseTypes = DotNet::ICloneable;
- }
- if(cont->hasMetaData("clr:property"))
- {
- propertyMapping = true;
- }
+ if(!isValue || cont->hasMetaData("clr:class"))
+ {
+ baseTypes = DotNet::ICloneable;
+ }
+ if(cont->hasMetaData("clr:property"))
+ {
+ propertyMapping = true;
+ }
}
else if(ExceptionPtr::dynamicCast(cont))
{
@@ -3056,12 +3056,12 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
}
else if(ClassDefPtr::dynamicCast(cont))
{
- baseTypes = DotNet::ICloneable;
- isClass = true;
- if(cont->hasMetaData("clr:property"))
- {
- propertyMapping = true;
- }
+ baseTypes = DotNet::ICloneable;
+ isClass = true;
+ if(cont->hasMetaData("clr:property"))
+ {
+ propertyMapping = true;
+ }
}
_out << sp;
@@ -3075,7 +3075,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
string dataMemberName = propertyName;
if(propertyMapping)
{
- dataMemberName += "_prop";
+ dataMemberName += "_prop";
}
_out << nl << (propertyMapping ? "private" : "public") << ' ' << type << ' ' << dataMemberName << ';';
@@ -3087,7 +3087,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
_out << nl << "public";
if(!isValue)
{
- _out << " virtual";
+ _out << " virtual";
}
_out << ' ' << type << ' ' << propertyName;
_out << sb;
@@ -3112,7 +3112,7 @@ Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
_out << sp << nl << "namespace " << fixId(p->name());
@@ -3131,7 +3131,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
string name = p->name();
@@ -3144,15 +3144,15 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- _out << fixId((*q)->scoped() + "Prx");
- if(++q != bases.end())
- {
- _out << ", ";
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ _out << fixId((*q)->scoped() + "Prx");
+ if(++q != bases.end())
+ {
+ _out << ", ";
+ }
+ }
}
_out << sb;
@@ -3178,11 +3178,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
string deprecateMetadata, deprecateReason;
if(p->findMetaData("deprecate", deprecateMetadata) || cl->findMetaData("deprecate", deprecateMetadata))
{
- deprecateReason = "This operation has been deprecated.";
- if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
- {
- deprecateReason = deprecateMetadata.substr(10);
- }
+ deprecateReason = "This operation has been deprecated.";
+ if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
+ {
+ deprecateReason = deprecateMetadata.substr(10);
+ }
}
//
@@ -3191,13 +3191,13 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
//
if(!deprecateReason.empty())
{
- _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
}
_out << nl << typeToString(p->returnType()) << " " << name << spar << params << epar << ';';
if(!deprecateReason.empty())
{
- _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
}
_out << nl << typeToString(p->returnType()) << " " << name
<< spar << params << "Ice.Context context__" << epar << ';';
@@ -3206,21 +3206,21 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
vector<string> paramsAMI = getParamsAsync(p, false);
- //
- // Write two versions of the operation - with and without a
- // context parameter.
- //
- _out << sp;
- if(!deprecateReason.empty())
- {
- _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
- }
- _out << nl << "void " << p->name() << "_async" << spar << paramsAMI << epar << ';';
- if(!deprecateReason.empty())
- {
- _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
- }
- _out << nl << "void " << p->name() << "_async" << spar << paramsAMI << "Ice.Context ctx__" << epar << ';';
+ //
+ // Write two versions of the operation - with and without a
+ // context parameter.
+ //
+ _out << sp;
+ if(!deprecateReason.empty())
+ {
+ _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
+ }
+ _out << nl << "void " << p->name() << "_async" << spar << paramsAMI << epar << ';';
+ if(!deprecateReason.empty())
+ {
+ _out << nl << "[System.Obsolete(\"" << deprecateReason << "\")]";
+ }
+ _out << nl << "void " << p->name() << "_async" << spar << paramsAMI << "Ice.Context ctx__" << epar << ';';
}
}
@@ -3256,12 +3256,12 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
//
if(!p->isAbstract())
{
- return false;
+ return false;
}
if(!p->isLocal())
{
- writeOperations(p, false);
+ writeOperations(p, false);
}
writeOperations(p, true);
@@ -3284,30 +3284,30 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
{
_out << " : ";
- ClassList::const_iterator q = bases.begin();
- bool first = true;
- while(q != bases.end())
- {
- if((*q)->isAbstract())
- {
- if(!first)
- {
- _out << ", ";
- }
- else
- {
- first = false;
- }
- string s = (*q)->scoped();
- s += "Operations";
- if(noCurrent)
- {
- s += "NC";
- }
- _out << fixId(s) << '_';
- }
- ++q;
- }
+ ClassList::const_iterator q = bases.begin();
+ bool first = true;
+ while(q != bases.end())
+ {
+ if((*q)->isAbstract())
+ {
+ if(!first)
+ {
+ _out << ", ";
+ }
+ else
+ {
+ first = false;
+ }
+ string s = (*q)->scoped();
+ s += "Operations";
+ if(noCurrent)
+ {
+ s += "NC";
+ }
+ _out << fixId(s) << '_';
+ }
+ ++q;
+ }
}
_out << sb;
@@ -3315,35 +3315,35 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
- bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"));
- string opname = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true);
-
- TypePtr ret;
- vector<string> params;
-
- if(amd)
- {
- params = getParamsAsync(op, true);
- }
- else
- {
- params = getParams(op);
- ret = op->returnType();
- }
-
- _out << sp;
+ OperationPtr op = *r;
+ bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"));
+ string opname = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true);
+
+ TypePtr ret;
+ vector<string> params;
+
+ if(amd)
+ {
+ params = getParamsAsync(op, true);
+ }
+ else
+ {
+ params = getParams(op);
+ ret = op->returnType();
+ }
+
+ _out << sp;
emitDeprecate(op, p, _out, "operation");
- emitAttributes(op);
- string retS = typeToString(ret);
- _out << nl << retS << ' ' << opname << spar << params;
- if(!noCurrent && !p->isLocal())
- {
- _out << "Ice.Current current__";
- }
- _out << epar << ';';
+ emitAttributes(op);
+ string retS = typeToString(ret);
+ _out << nl << retS << ' ' << opname << spar << params;
+ if(!noCurrent && !p->isLocal())
+ {
+ _out << "Ice.Current current__";
+ }
+ _out << epar << ';';
}
_out << eb;
@@ -3389,140 +3389,140 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!ops.empty())
{
- _out << sp << nl << "#region Synchronous operations";
+ _out << sp << nl << "#region Synchronous operations";
}
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = *r;
- string opName = fixId(op->name(), DotNet::ICloneable, true);
- TypePtr ret = op->returnType();
- string retS = typeToString(ret);
-
- vector<string> params = getParams(op);
- vector<string> args = getArgs(op);
-
- _out << sp << nl << "public " << retS << " " << opName << spar << params << epar;
- _out << sb;
- _out << nl;
- if(ret)
- {
- _out << "return ";
- }
- _out << opName << spar << args << "null" << "false" << epar << ';';
- _out << eb;
-
- _out << sp << nl << "public " << retS << " " << opName << spar << params
- << "Ice.Context context__" << epar;
- _out << sb;
- _out << nl;
- if(ret)
- {
- _out << "return ";
- }
- _out << opName << spar << args << "context__" << "true" << epar << ';';
- _out << eb;
-
- _out << sp << nl << "private " << retS << " " << opName << spar << params
- << "Ice.Context context__" << "bool explicitContext__" << epar;
- _out << sb;
-
- _out << nl << "if(explicitContext__ && context__ == null)";
- _out << sb;
- _out << nl << "context__ = emptyContext_;";
- _out << eb;
- _out << nl << "int cnt__ = 0;";
- _out << nl << "while(true)";
- _out << sb;
- _out << nl << "Ice.ObjectDel_ delBase__ = null;";
- _out << nl << "try";
- _out << sb;
- if(op->returnsData())
- {
- _out << nl << "checkTwowayOnly__(\"" << op->name() << "\");";
- }
- _out << nl << "delBase__ = getDelegate__();";
- _out << nl << name << "Del_ del__ = (" << name << "Del_)delBase__;";
- _out << nl;
- if(ret)
- {
- _out << "return ";
- }
- _out << "del__." << opName << spar << args << "context__" << epar << ';';
- if(!ret)
- {
- _out << nl << "return;";
- }
- _out << eb;
- _out << nl << "catch(IceInternal.LocalExceptionWrapper ex__)";
- _out << sb;
- if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating)
- {
- _out << nl << "cnt__ = handleExceptionWrapperRelaxed__(delBase__, ex__, cnt__);";
- }
- else
- {
- _out << nl << "handleExceptionWrapper__(delBase__, ex__);";
- }
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "cnt__ = handleException__(delBase__, ex__, cnt__);";
- _out << eb;
- _out << eb;
-
- _out << eb;
+ string opName = fixId(op->name(), DotNet::ICloneable, true);
+ TypePtr ret = op->returnType();
+ string retS = typeToString(ret);
+
+ vector<string> params = getParams(op);
+ vector<string> args = getArgs(op);
+
+ _out << sp << nl << "public " << retS << " " << opName << spar << params << epar;
+ _out << sb;
+ _out << nl;
+ if(ret)
+ {
+ _out << "return ";
+ }
+ _out << opName << spar << args << "null" << "false" << epar << ';';
+ _out << eb;
+
+ _out << sp << nl << "public " << retS << " " << opName << spar << params
+ << "Ice.Context context__" << epar;
+ _out << sb;
+ _out << nl;
+ if(ret)
+ {
+ _out << "return ";
+ }
+ _out << opName << spar << args << "context__" << "true" << epar << ';';
+ _out << eb;
+
+ _out << sp << nl << "private " << retS << " " << opName << spar << params
+ << "Ice.Context context__" << "bool explicitContext__" << epar;
+ _out << sb;
+
+ _out << nl << "if(explicitContext__ && context__ == null)";
+ _out << sb;
+ _out << nl << "context__ = emptyContext_;";
+ _out << eb;
+ _out << nl << "int cnt__ = 0;";
+ _out << nl << "while(true)";
+ _out << sb;
+ _out << nl << "Ice.ObjectDel_ delBase__ = null;";
+ _out << nl << "try";
+ _out << sb;
+ if(op->returnsData())
+ {
+ _out << nl << "checkTwowayOnly__(\"" << op->name() << "\");";
+ }
+ _out << nl << "delBase__ = getDelegate__();";
+ _out << nl << name << "Del_ del__ = (" << name << "Del_)delBase__;";
+ _out << nl;
+ if(ret)
+ {
+ _out << "return ";
+ }
+ _out << "del__." << opName << spar << args << "context__" << epar << ';';
+ if(!ret)
+ {
+ _out << nl << "return;";
+ }
+ _out << eb;
+ _out << nl << "catch(IceInternal.LocalExceptionWrapper ex__)";
+ _out << sb;
+ if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating)
+ {
+ _out << nl << "cnt__ = handleExceptionWrapperRelaxed__(delBase__, ex__, cnt__);";
+ }
+ else
+ {
+ _out << nl << "handleExceptionWrapper__(delBase__, ex__);";
+ }
+ _out << eb;
+ _out << nl << "catch(Ice.LocalException ex__)";
+ _out << sb;
+ _out << nl << "cnt__ = handleException__(delBase__, ex__, cnt__);";
+ _out << eb;
+ _out << eb;
+
+ _out << eb;
}
if(!ops.empty())
{
- _out << sp << nl << "#endregion"; // Synchronous operations
+ _out << sp << nl << "#endregion"; // Synchronous operations
}
bool hasAsyncOps = false;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
-
- ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
- if(containingClass->hasMetaData("ami") || op->hasMetaData("ami"))
- {
- if(!hasAsyncOps)
- {
- _out << sp << nl << "#region Asynchronous operations";
- hasAsyncOps = true;
- }
- vector<string> paramsAMI = getParamsAsync(op, false);
- vector<string> argsAMI = getArgsAsync(op);
-
- string opName = op->name();
-
- //
- // Write two versions of the operation - with and without a
- // context parameter
- //
- _out << sp;
- _out << nl << "public void " << opName << "_async" << spar << paramsAMI << epar;
- _out << sb;
- _out << nl << "cb__.invoke__" << spar << "this" << argsAMI << "null" << epar << ';';
- _out << eb;
-
- _out << nl << "public void " << opName << "_async" << spar << paramsAMI << "Ice.Context ctx__" << epar;
- _out << sb;
- _out << nl << "if(ctx__ == null)";
- _out << sb;
- _out << nl << "ctx__ = emptyContext_;";
- _out << eb;
- _out << nl << "cb__.invoke__" << spar << "this" << argsAMI << "ctx__" << epar << ';';
- _out << eb;
- }
+ OperationPtr op = *r;
+
+ ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
+ if(containingClass->hasMetaData("ami") || op->hasMetaData("ami"))
+ {
+ if(!hasAsyncOps)
+ {
+ _out << sp << nl << "#region Asynchronous operations";
+ hasAsyncOps = true;
+ }
+ vector<string> paramsAMI = getParamsAsync(op, false);
+ vector<string> argsAMI = getArgsAsync(op);
+
+ string opName = op->name();
+
+ //
+ // Write two versions of the operation - with and without a
+ // context parameter
+ //
+ _out << sp;
+ _out << nl << "public void " << opName << "_async" << spar << paramsAMI << epar;
+ _out << sb;
+ _out << nl << "cb__.invoke__" << spar << "this" << argsAMI << "null" << epar << ';';
+ _out << eb;
+
+ _out << nl << "public void " << opName << "_async" << spar << paramsAMI << "Ice.Context ctx__" << epar;
+ _out << sb;
+ _out << nl << "if(ctx__ == null)";
+ _out << sb;
+ _out << nl << "ctx__ = emptyContext_;";
+ _out << eb;
+ _out << nl << "cb__.invoke__" << spar << "this" << argsAMI << "ctx__" << epar << ';';
+ _out << eb;
+ }
}
if(hasAsyncOps)
{
- _out << sp << nl << "#endregion"; // Asynchronous operations
+ _out << sp << nl << "#endregion"; // Asynchronous operations
}
_out << sp << nl << "#region Checked and unchecked cast operations";
@@ -3665,22 +3665,22 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(_stream)
{
- _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << name << "Prx v__)";
- _out << sb;
- _out << nl << "outS__.writeProxy(v__);";
- _out << eb;
+ _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << name << "Prx v__)";
+ _out << sb;
+ _out << nl << "outS__.writeProxy(v__);";
+ _out << eb;
- _out << sp << nl << "public static " << name << "Prx read(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << "Ice.ObjectPrx proxy = inS__.readProxy();";
- _out << nl << "if(proxy != null)";
- _out << sb;
- _out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
- _out << nl << "result.copyFrom__(proxy);";
- _out << nl << "return result;";
- _out << eb;
- _out << nl << "return null;";
- _out << eb;
+ _out << sp << nl << "public static " << name << "Prx read(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << "Ice.ObjectPrx proxy = inS__.readProxy();";
+ _out << nl << "if(proxy != null)";
+ _out << sb;
+ _out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
+ _out << nl << "result.copyFrom__(proxy);";
+ _out << nl << "return result;";
+ _out << eb;
+ _out << nl << "return null;";
+ _out << eb;
}
_out << sp << nl << "#endregion"; // Marshaling support
@@ -3725,17 +3725,17 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
if(_stream)
{
- _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << typeS << " v__)";
- _out << sb;
- writeSequenceMarshalUnmarshalCode(_out, p, "v__", true, true);
- _out << eb;
+ _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << typeS << " v__)";
+ _out << sb;
+ writeSequenceMarshalUnmarshalCode(_out, p, "v__", true, true);
+ _out << eb;
- _out << sp << nl << "public static " << typeS << " read(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << typeS << " v__;";
- writeSequenceMarshalUnmarshalCode(_out, p, "v__", false, true);
- _out << nl << "return v__;";
- _out << eb;
+ _out << sp << nl << "public static " << typeS << " read(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << typeS << " v__;";
+ writeSequenceMarshalUnmarshalCode(_out, p, "v__", false, true);
+ _out << nl << "return v__;";
+ _out << eb;
}
_out << eb;
@@ -3785,33 +3785,33 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
bool hasClassValue = (builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(value);
if(hasClassValue)
{
- _out << sp << nl << "public sealed class Patcher__ : IceInternal.Patcher";
- _out << sb;
- _out << sp << nl << "internal Patcher__(" << name << " m, " << keyS << " key)";
- _out << sb;
- _out << nl << "_m = m;";
- _out << nl << "_key = key;";
- _out << eb;
-
- _out << sp << nl << "public override void" << nl << "patch(Ice.Object v)";
- _out << sb;
- _out << nl << "type_ = typeof(" << typeToString(p->valueType()) << ");";
- _out << nl << "try";
- _out << sb;
- _out << nl << "_m[_key] = (" << valueS << ")v;";
- _out << eb;
- _out << nl << "catch(System.InvalidCastException)";
- _out << sb;
- _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- _out << nl << "_e.type = v.ice_id();";
- _out << nl << "_e.expectedType = \"" << value->typeId() << "\";";
- _out << nl << "throw _e;";
- _out << eb;
- _out << eb;
-
- _out << sp << nl << "private " << name << " _m;";
- _out << nl << "private " << keyS << " _key;";
- _out << eb;
+ _out << sp << nl << "public sealed class Patcher__ : IceInternal.Patcher";
+ _out << sb;
+ _out << sp << nl << "internal Patcher__(" << name << " m, " << keyS << " key)";
+ _out << sb;
+ _out << nl << "_m = m;";
+ _out << nl << "_key = key;";
+ _out << eb;
+
+ _out << sp << nl << "public override void" << nl << "patch(Ice.Object v)";
+ _out << sb;
+ _out << nl << "type_ = typeof(" << typeToString(p->valueType()) << ");";
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "_m[_key] = (" << valueS << ")v;";
+ _out << eb;
+ _out << nl << "catch(System.InvalidCastException)";
+ _out << sb;
+ _out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ _out << nl << "_e.type = v.ice_id();";
+ _out << nl << "_e.expectedType = \"" << value->typeId() << "\";";
+ _out << nl << "throw _e;";
+ _out << eb;
+ _out << eb;
+
+ _out << sp << nl << "private " << name << " _m;";
+ _out << nl << "private " << keyS << " _key;";
+ _out << eb;
}
_out << sp << nl << "public static " << name << " read(IceInternal.BasicStream is__)";
@@ -3824,12 +3824,12 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
writeMarshalUnmarshalCode(_out, key, "k__", false, false, false);
if(!hasClassValue)
{
- _out << nl << valueS << " v__;";
+ _out << nl << valueS << " v__;";
}
writeMarshalUnmarshalCode(_out, value, "v__", false, false, false, "r__, k__");
if(!hasClassValue)
{
- _out << nl << "r__[k__] = v__;";
+ _out << nl << "r__[k__] = v__;";
}
_out << eb;
_out << nl << "return r__;";
@@ -3837,43 +3837,43 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
if(_stream)
{
- _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << name << " v__)";
- _out << sb;
- _out << nl << "if(v__ == null)";
- _out << sb;
- _out << nl << "outS__.writeSize(0);";
- _out << eb;
- _out << nl << "else";
- _out << sb;
- _out << nl << "outS__.writeSize(v__.Count);";
- _out << nl << "foreach(_System.Collections.DictionaryEntry e__ in v__)";
- _out << sb;
- writeMarshalUnmarshalCode(_out, key, keyArg, true, true, false);
- writeMarshalUnmarshalCode(_out, value, valueArg, true, true, false);
- _out << eb;
- _out << eb;
- _out << eb;
-
- _out << sp << nl << "public static " << name << " read(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << "int sz__ = inS__.readSize();";
- _out << nl << name << " r__ = new " << name << "();";
- _out << nl << "for(int i__ = 0; i__ < sz__; ++i__)";
- _out << sb;
- _out << nl << keyS << " k__;";
- writeMarshalUnmarshalCode(_out, key, "k__", false, true, false);
- if(!hasClassValue)
- {
- _out << nl << valueS << " v__;";
- }
- writeMarshalUnmarshalCode(_out, value, "v__", false, true, false, "r__, k__");
- if(!hasClassValue)
- {
- _out << nl << "r__[k__] = v__;";
- }
- _out << eb;
- _out << nl << "return r__;";
- _out << eb;
+ _out << sp << nl << "public static void write(Ice.OutputStream outS__, " << name << " v__)";
+ _out << sb;
+ _out << nl << "if(v__ == null)";
+ _out << sb;
+ _out << nl << "outS__.writeSize(0);";
+ _out << eb;
+ _out << nl << "else";
+ _out << sb;
+ _out << nl << "outS__.writeSize(v__.Count);";
+ _out << nl << "foreach(_System.Collections.DictionaryEntry e__ in v__)";
+ _out << sb;
+ writeMarshalUnmarshalCode(_out, key, keyArg, true, true, false);
+ writeMarshalUnmarshalCode(_out, value, valueArg, true, true, false);
+ _out << eb;
+ _out << eb;
+ _out << eb;
+
+ _out << sp << nl << "public static " << name << " read(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << "int sz__ = inS__.readSize();";
+ _out << nl << name << " r__ = new " << name << "();";
+ _out << nl << "for(int i__ = 0; i__ < sz__; ++i__)";
+ _out << sb;
+ _out << nl << keyS << " k__;";
+ writeMarshalUnmarshalCode(_out, key, "k__", false, true, false);
+ if(!hasClassValue)
+ {
+ _out << nl << valueS << " v__;";
+ }
+ writeMarshalUnmarshalCode(_out, value, "v__", false, true, false, "r__, k__");
+ if(!hasClassValue)
+ {
+ _out << nl << "r__[k__] = v__;";
+ }
+ _out << eb;
+ _out << nl << "return r__;";
+ _out << eb;
}
_out << eb;
@@ -3908,7 +3908,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
string name = p->name();
@@ -3917,21 +3917,21 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "public interface " << name << "Del_ : ";
if(bases.empty())
{
- _out << "Ice.ObjectDel_";
+ _out << "Ice.ObjectDel_";
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- string s = (*q)->scoped();
- s += "Del_";
- _out << fixId(s);
- if(++q != bases.end())
- {
- _out << ", ";
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ string s = (*q)->scoped();
+ s += "Del_";
+ _out << fixId(s);
+ if(++q != bases.end())
+ {
+ _out << ", ";
+ }
+ }
}
_out << sb;
@@ -3941,13 +3941,13 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
- string opName = fixId(op->name(), DotNet::ICloneable, true);
- TypePtr ret = op->returnType();
- string retS = typeToString(ret);
- vector<string> params = getParams(op);
+ OperationPtr op = *r;
+ string opName = fixId(op->name(), DotNet::ICloneable, true);
+ TypePtr ret = op->returnType();
+ string retS = typeToString(ret);
+ vector<string> params = getParams(op);
- _out << sp << nl << retS << ' ' << opName << spar << params << "Ice.Context context__" << epar << ';';
+ _out << sp << nl << retS << ' ' << opName << spar << params << "Ice.Context context__" << epar << ';';
}
return true;
@@ -4002,168 +4002,168 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
- string opName = fixId(op->name(), DotNet::ICloneable, true);
- TypePtr ret = op->returnType();
- string retS = typeToString(ret);
-
- TypeStringList inParams;
- TypeStringList outParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- else
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- TypeStringList::const_iterator q;
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ OperationPtr op = *r;
+ string opName = fixId(op->name(), DotNet::ICloneable, true);
+ TypePtr ret = op->returnType();
+ string retS = typeToString(ret);
+
+ TypeStringList inParams;
+ TypeStringList outParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ else
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ TypeStringList::const_iterator q;
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- vector<string> params = getParams(op);
-
- _out << sp << nl << "public " << retS << ' ' << opName << spar << params << "Ice.Context context__" << epar;
- _out << sb;
-
- _out << nl << "IceInternal.Outgoing og__ = getOutgoing(\"" << op->name() << "\", "
- << sliceModeToIceMode(op->sendMode())
- << ", context__);";
- _out << nl << "try";
- _out << sb;
- if(!inParams.empty())
- {
- _out << nl << "try";
- _out << sb;
- _out << nl << "IceInternal.BasicStream os__ = og__.ostr();";
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
- }
- if(op->sendsClasses())
- {
- _out << nl << "os__.writePendingObjects();";
- }
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "og__.abort(ex__);";
- _out << eb;
- }
- _out << nl << "bool ok__ = og__.invoke();";
- _out << nl << "try";
- _out << sb;
- _out << nl << "IceInternal.BasicStream is__ = og__.istr();";
- _out << nl << "if(!ok__)";
- _out << sb;
- //
- // The try/catch block is necessary because throwException()
- // can raise UserException.
- //
- _out << nl << "try";
- _out << sb;
- _out << nl << "is__.throwException();";
- _out << eb;
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
- {
- _out << nl << "catch(" << fixId((*t)->scoped()) << ')';
- _out << sb;
- _out << nl << "throw;";
- _out << eb;
- }
- _out << nl << "catch(Ice.UserException ex)";
- _out << sb;
- _out << nl << "throw new Ice.UnknownUserException(ex);";
- _out << eb;
- _out << eb;
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true, "");
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- _out << nl << retS << " ret__;";
- ContainedPtr contained = ContainedPtr::dynamicCast(ret);
- _out << nl << "IceInternal.ParamPatcher ret___PP = new IceInternal.ParamPatcher(typeof("
- << retS << "), \"" << (contained? contained->scoped() : string("::Ice::Object")) << "\");";
- _out << nl << "is__.readObject(ret___PP);";
- }
- else
- {
- _out << nl << retS << " ret__;";
- writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, "");
- }
- }
- if(op->returnsClasses())
- {
- _out << nl << "is__.readPendingObjects();";
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string param = fixId(q->second);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
- {
- string type = typeToString(q->first);
- _out << nl << "try";
- _out << sb;
- _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
- _out << eb;
- _out << nl << "catch(System.InvalidCastException)";
- _out << sb;
- _out << nl << "Ice.UnexpectedObjectException ex = new Ice.UnexpectedObjectException();";
- _out << nl << "ex.type = " << param << "_PP.value.ice_id();";
- _out << nl << "ex.expectedType = \"" << q->first->typeId() << "\";";
- _out << nl << "throw ex;";
- _out << eb;
- }
- }
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- _out << nl << "try";
- _out << sb;
- _out << nl << "ret__ = (" << retS << ")ret___PP.value;";
- _out << eb;
- _out << nl << "catch(System.InvalidCastException)";
- _out << sb;
- _out << nl << "Ice.UnexpectedObjectException ex = new Ice.UnexpectedObjectException();";
- _out << nl << "ex.type = ret___PP.value.ice_id();";
- _out << nl << "ex.expectedType = \"" << ret->typeId() << "\";";
- _out << nl << "throw ex;";
- _out << eb;
- }
- _out << nl << "return ret__;";
- }
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "throw new IceInternal.LocalExceptionWrapper(ex__, false);";
- _out << eb;
+ vector<string> params = getParams(op);
+
+ _out << sp << nl << "public " << retS << ' ' << opName << spar << params << "Ice.Context context__" << epar;
+ _out << sb;
+
+ _out << nl << "IceInternal.Outgoing og__ = getOutgoing(\"" << op->name() << "\", "
+ << sliceModeToIceMode(op->sendMode())
+ << ", context__);";
+ _out << nl << "try";
+ _out << sb;
+ if(!inParams.empty())
+ {
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "IceInternal.BasicStream os__ = og__.ostr();";
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
+ }
+ if(op->sendsClasses())
+ {
+ _out << nl << "os__.writePendingObjects();";
+ }
+ _out << eb;
+ _out << nl << "catch(Ice.LocalException ex__)";
+ _out << sb;
+ _out << nl << "og__.abort(ex__);";
+ _out << eb;
+ }
+ _out << nl << "bool ok__ = og__.invoke();";
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "IceInternal.BasicStream is__ = og__.istr();";
+ _out << nl << "if(!ok__)";
+ _out << sb;
+ //
+ // The try/catch block is necessary because throwException()
+ // can raise UserException.
+ //
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "is__.throwException();";
+ _out << eb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ _out << nl << "catch(" << fixId((*t)->scoped()) << ')';
+ _out << sb;
+ _out << nl << "throw;";
+ _out << eb;
+ }
+ _out << nl << "catch(Ice.UserException ex)";
+ _out << sb;
+ _out << nl << "throw new Ice.UnknownUserException(ex);";
+ _out << eb;
+ _out << eb;
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true, "");
+ }
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ _out << nl << retS << " ret__;";
+ ContainedPtr contained = ContainedPtr::dynamicCast(ret);
+ _out << nl << "IceInternal.ParamPatcher ret___PP = new IceInternal.ParamPatcher(typeof("
+ << retS << "), \"" << (contained? contained->scoped() : string("::Ice::Object")) << "\");";
+ _out << nl << "is__.readObject(ret___PP);";
+ }
+ else
+ {
+ _out << nl << retS << " ret__;";
+ writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, "");
+ }
+ }
+ if(op->returnsClasses())
+ {
+ _out << nl << "is__.readPendingObjects();";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
+ {
+ string type = typeToString(q->first);
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
+ _out << eb;
+ _out << nl << "catch(System.InvalidCastException)";
+ _out << sb;
+ _out << nl << "Ice.UnexpectedObjectException ex = new Ice.UnexpectedObjectException();";
+ _out << nl << "ex.type = " << param << "_PP.value.ice_id();";
+ _out << nl << "ex.expectedType = \"" << q->first->typeId() << "\";";
+ _out << nl << "throw ex;";
+ _out << eb;
+ }
+ }
+ }
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "ret__ = (" << retS << ")ret___PP.value;";
+ _out << eb;
+ _out << nl << "catch(System.InvalidCastException)";
+ _out << sb;
+ _out << nl << "Ice.UnexpectedObjectException ex = new Ice.UnexpectedObjectException();";
+ _out << nl << "ex.type = ret___PP.value.ice_id();";
+ _out << nl << "ex.expectedType = \"" << ret->typeId() << "\";";
+ _out << nl << "throw ex;";
+ _out << eb;
+ }
+ _out << nl << "return ret__;";
+ }
+ _out << eb;
+ _out << nl << "catch(Ice.LocalException ex__)";
+ _out << sb;
+ _out << nl << "throw new IceInternal.LocalExceptionWrapper(ex__, false);";
+ _out << eb;
_out << eb;
_out << nl << "finally";
_out << sb;
@@ -4228,64 +4228,64 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
string opName = fixId(op->name(), DotNet::ICloneable, true);
TypePtr ret = op->returnType();
string retS = typeToString(ret);
- ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
+ ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
vector<string> params = getParams(op);
vector<string> args = getArgs(op);
- _out << sp;
+ _out << sp;
_out << nl << "public " << retS << ' ' << opName << spar << params << "Ice.Context context__" << epar;
_out << sb;
- if(containingClass->hasMetaData("amd") || op->hasMetaData("amd"))
- {
- _out << nl << "throw new Ice.CollocationOptimizationException();";
- }
- else
- {
- _out << nl << "Ice.Current current__ = new Ice.Current();";
- _out << nl << "initCurrent__(ref current__, \"" << op->name() << "\", "
- << sliceModeToIceMode(op->sendMode())
- << ", context__);";
- _out << nl << "while(true)";
- _out << sb;
- _out << nl << "IceInternal.Direct direct__ = new IceInternal.Direct(current__);";
- _out << nl << "object servant__ = direct__.servant();";
- _out << nl << "if(servant__ is " << fixId(name) << ")";
- _out << sb;
- _out << nl << "try";
- _out << sb;
- _out << nl;
- if(ret)
- {
- _out << "return ";
- }
- _out << "((" << fixId(containingClass->scoped()) << ")servant__)."
- << opName << spar << args << "current__" << epar << ';';
- if(!ret)
- {
- _out << nl << "return;";
- }
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "throw new IceInternal.LocalExceptionWrapper(ex__, false);";
- _out << eb;
- _out << nl << "finally";
- _out << sb;
- _out << nl << "direct__.destroy();";
- _out << eb;
- _out << eb;
- _out << nl << "else";
- _out << sb;
- _out << nl << "direct__.destroy();";
- _out << nl << "Ice.OperationNotExistException opEx__ = new Ice.OperationNotExistException();";
- _out << nl << "opEx__.id = current__.id;";
- _out << nl << "opEx__.facet = current__.facet;";
- _out << nl << "opEx__.operation = current__.operation;";
- _out << nl << "throw opEx__;";
- _out << eb;
- _out << eb;
- }
+ if(containingClass->hasMetaData("amd") || op->hasMetaData("amd"))
+ {
+ _out << nl << "throw new Ice.CollocationOptimizationException();";
+ }
+ else
+ {
+ _out << nl << "Ice.Current current__ = new Ice.Current();";
+ _out << nl << "initCurrent__(ref current__, \"" << op->name() << "\", "
+ << sliceModeToIceMode(op->sendMode())
+ << ", context__);";
+ _out << nl << "while(true)";
+ _out << sb;
+ _out << nl << "IceInternal.Direct direct__ = new IceInternal.Direct(current__);";
+ _out << nl << "object servant__ = direct__.servant();";
+ _out << nl << "if(servant__ is " << fixId(name) << ")";
+ _out << sb;
+ _out << nl << "try";
+ _out << sb;
+ _out << nl;
+ if(ret)
+ {
+ _out << "return ";
+ }
+ _out << "((" << fixId(containingClass->scoped()) << ")servant__)."
+ << opName << spar << args << "current__" << epar << ';';
+ if(!ret)
+ {
+ _out << nl << "return;";
+ }
+ _out << eb;
+ _out << nl << "catch(Ice.LocalException ex__)";
+ _out << sb;
+ _out << nl << "throw new IceInternal.LocalExceptionWrapper(ex__, false);";
+ _out << eb;
+ _out << nl << "finally";
+ _out << sb;
+ _out << nl << "direct__.destroy();";
+ _out << eb;
+ _out << eb;
+ _out << nl << "else";
+ _out << sb;
+ _out << nl << "direct__.destroy();";
+ _out << nl << "Ice.OperationNotExistException opEx__ = new Ice.OperationNotExistException();";
+ _out << nl << "opEx__.id = current__.id;";
+ _out << nl << "opEx__.facet = current__.facet;";
+ _out << nl << "opEx__.operation = current__.operation;";
+ _out << nl << "throw opEx__;";
+ _out << eb;
+ _out << eb;
+ }
_out << eb;
}
@@ -4343,42 +4343,42 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
for(OperationList::const_iterator op = ops.begin(); op != ops.end(); ++op)
{
- bool amd = p->hasMetaData("amd") || (*op)->hasMetaData("amd");
-
- string opname = (*op)->name();
- vector<string> params;
- vector<string> args;
- TypePtr ret;
-
- if(amd)
- {
- opname = opname + "_async";
- params = getParamsAsync(*op, true);
- args = getArgsAsync(*op);
- }
- else
- {
- opname = fixId(opname, DotNet::ICloneable, true);
- params = getParams(*op);
- ret = (*op)->returnType();
- args = getArgs(*op);
- }
-
- _out << sp << nl << "public " << typeToString(ret) << " " << opname << spar << params << epar;
- _out << sb << nl;
- if(ret)
- {
- _out << "return ";
- }
- _out << opname << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';';
- _out << eb;
-
- _out << sp << nl << "public abstract " << typeToString(ret) << " " << opname << spar << params;
- if(!p->isLocal())
- {
- _out << "Ice.Current current__";
- }
- _out << epar << ';';
+ bool amd = p->hasMetaData("amd") || (*op)->hasMetaData("amd");
+
+ string opname = (*op)->name();
+ vector<string> params;
+ vector<string> args;
+ TypePtr ret;
+
+ if(amd)
+ {
+ opname = opname + "_async";
+ params = getParamsAsync(*op, true);
+ args = getArgsAsync(*op);
+ }
+ else
+ {
+ opname = fixId(opname, DotNet::ICloneable, true);
+ params = getParams(*op);
+ ret = (*op)->returnType();
+ args = getArgs(*op);
+ }
+
+ _out << sp << nl << "public " << typeToString(ret) << " " << opname << spar << params << epar;
+ _out << sb << nl;
+ if(ret)
+ {
+ _out << "return ";
+ }
+ _out << opname << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';';
+ _out << eb;
+
+ _out << sp << nl << "public abstract " << typeToString(ret) << " " << opname << spar << params;
+ if(!p->isLocal())
+ {
+ _out << "Ice.Current current__";
+ }
+ _out << epar << ';';
}
if(!ops.empty())
@@ -4438,7 +4438,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
if(cl->isLocal())
{
- return;
+ return;
}
string name = p->name();
@@ -4449,266 +4449,266 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
TypePtr ret = p->returnType();
string retS = typeToString(ret);
- TypeStringList inParams;
+ TypeStringList inParams;
TypeStringList outParams;
- ParamDeclList paramList = p->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- else
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
+ ParamDeclList paramList = p->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ else
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
ExceptionList throws = p->throws();
throws.sort();
throws.unique();
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
TypeStringList::const_iterator q;
- vector<string> params = getParamsAsyncCB(p);
- vector<string> args = getArgsAsyncCB(p);
-
- vector<string> paramsInvoke = getParamsAsync(p, false);
-
- _out << sp << nl << "public abstract class AMI_" << cl->name() << '_'
- << name << " : IceInternal.OutgoingAsync";
- _out << sb;
- _out << sp;
- _out << nl << "public abstract void ice_response" << spar << params << epar << ';';
-
- _out << sp << nl << "public void invoke__" << spar << "Ice.ObjectPrx prx__"
- << paramsInvoke << "Ice.Context ctx__" << epar;
- _out << sb;
- _out << nl << "try";
- _out << sb;
- _out << nl << "prepare__(prx__, \"" << name << "\", " << sliceModeToIceMode(p->sendMode())
- << ", ctx__);";
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- string typeS = typeToString(q->first);
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
- }
- if(p->sendsClasses())
- {
- _out << nl << "os__.writePendingObjects();";
- }
- _out << nl << "os__.endWriteEncaps();";
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "finished__(ex__);";
- _out << nl << "return;";
- _out << eb;
- _out << nl << "send__();";
- _out << eb;
-
- _out << sp << nl << "protected override void response__(bool ok__)";
- _out << sb;
+ vector<string> params = getParamsAsyncCB(p);
+ vector<string> args = getArgsAsyncCB(p);
+
+ vector<string> paramsInvoke = getParamsAsync(p, false);
+
+ _out << sp << nl << "public abstract class AMI_" << cl->name() << '_'
+ << name << " : IceInternal.OutgoingAsync";
+ _out << sb;
+ _out << sp;
+ _out << nl << "public abstract void ice_response" << spar << params << epar << ';';
+
+ _out << sp << nl << "public void invoke__" << spar << "Ice.ObjectPrx prx__"
+ << paramsInvoke << "Ice.Context ctx__" << epar;
+ _out << sb;
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "prepare__(prx__, \"" << name << "\", " << sliceModeToIceMode(p->sendMode())
+ << ", ctx__);";
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ string typeS = typeToString(q->first);
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
+ }
+ if(p->sendsClasses())
+ {
+ _out << nl << "os__.writePendingObjects();";
+ }
+ _out << nl << "os__.endWriteEncaps();";
+ _out << eb;
+ _out << nl << "catch(Ice.LocalException ex__)";
+ _out << sb;
+ _out << nl << "finished__(ex__);";
+ _out << nl << "return;";
+ _out << eb;
+ _out << nl << "send__();";
+ _out << eb;
+
+ _out << sp << nl << "protected override void response__(bool ok__)";
+ _out << sb;
for(q = outParams.begin(); q != outParams.end(); ++q)
{
- _out << nl << typeToString(q->first) << ' ' << fixId(q->second) << ';';
+ _out << nl << typeToString(q->first) << ' ' << fixId(q->second) << ';';
}
if(ret)
{
- _out << nl << retS << " ret__;";
+ _out << nl << retS << " ret__;";
+ }
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "if(!ok__)";
+ _out << sb;
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "is__.throwException();";
+ _out << eb;
+ for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
+ {
+ _out << nl << "catch(" << fixId((*r)->scoped()) << ')';
+ _out << sb;
+ _out << nl << "throw;";
+ _out << eb;
}
- _out << nl << "try";
- _out << sb;
- _out << nl << "if(!ok__)";
+ _out << nl << "catch(Ice.UserException ex)";
_out << sb;
- _out << nl << "try";
- _out << sb;
- _out << nl << "is__.throwException();";
- _out << eb;
- for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
- {
- _out << nl << "catch(" << fixId((*r)->scoped()) << ')';
- _out << sb;
- _out << nl << "throw;";
- _out << eb;
- }
- _out << nl << "catch(Ice.UserException ex)";
- _out << sb;
_out << nl << "throw new Ice.UnknownUserException(ex);";
- _out << eb;
+ _out << eb;
_out << eb;
for(q = outParams.begin(); q != outParams.end(); ++q)
{
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
}
if(ret)
{
- writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true);
- }
- if(p->returnsClasses())
- {
- _out << nl << "is__.readPendingObjects();";
- }
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string param = fixId(q->second);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
- {
- string type = typeToString(q->first);
- _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
- }
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- string type = typeToString(ret);
- _out << nl << "ret__ = (" << retS << ")ret___PP.value;";
- }
- }
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "finished__(ex__);";
- _out << nl << "return;";
- _out << eb;
- if(!throws.empty())
- {
- _out << nl << "catch(Ice.UserException ex__)";
- _out << sb;
- _out << nl << "ice_exception(ex__);";
- _out << nl << "return;";
- _out << eb;
- }
- _out << nl << "ice_response" << spar << args << epar << ';';
- _out << eb;
- _out << eb;
+ writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true);
+ }
+ if(p->returnsClasses())
+ {
+ _out << nl << "is__.readPendingObjects();";
+ }
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
+ {
+ string type = typeToString(q->first);
+ _out << nl << param << " = (" << type << ")" << param << "_PP.value;";
+ }
+ }
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ string type = typeToString(ret);
+ _out << nl << "ret__ = (" << retS << ")ret___PP.value;";
+ }
+ }
+ _out << eb;
+ _out << nl << "catch(Ice.LocalException ex__)";
+ _out << sb;
+ _out << nl << "finished__(ex__);";
+ _out << nl << "return;";
+ _out << eb;
+ if(!throws.empty())
+ {
+ _out << nl << "catch(Ice.UserException ex__)";
+ _out << sb;
+ _out << nl << "ice_exception(ex__);";
+ _out << nl << "return;";
+ _out << eb;
+ }
+ _out << nl << "ice_response" << spar << args << epar << ';';
+ _out << eb;
+ _out << eb;
}
if(cl->hasMetaData("amd") || p->hasMetaData("amd"))
{
- string classNameAMD = "AMD_" + cl->name();
- string classNameAMDI = "_AMD_" + cl->name();
+ string classNameAMD = "AMD_" + cl->name();
+ string classNameAMDI = "_AMD_" + cl->name();
- vector<string> paramsAMD = getParamsAsyncCB(p);
+ vector<string> paramsAMD = getParamsAsyncCB(p);
- _out << sp << nl << "public interface " << classNameAMD << '_' << name;
- _out << sb;
- _out << sp << nl << "void ice_response" << spar << paramsAMD << epar << ';';
- _out << sp << nl << "void ice_exception(_System.Exception ex);";
- _out << eb;
+ _out << sp << nl << "public interface " << classNameAMD << '_' << name;
+ _out << sb;
+ _out << sp << nl << "void ice_response" << spar << paramsAMD << epar << ';';
+ _out << sp << nl << "void ice_exception(_System.Exception ex);";
+ _out << eb;
- TypePtr ret = p->returnType();
-
- TypeStringList outParams;
- ParamDeclList paramList = p->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ TypePtr ret = p->returnType();
+
+ TypeStringList outParams;
+ ParamDeclList paramList = p->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- TypeStringList::const_iterator q;
- _out << sp << nl << "class " << classNameAMDI << '_' << name
- << " : IceInternal.IncomingAsync, " << classNameAMD << '_' << name;
- _out << sb;
-
- _out << sp << nl << "public " << classNameAMDI << '_' << name << "(IceInternal.Incoming inc) : base(inc)";
- _out << sb;
- _out << eb;
-
- _out << sp << nl << "public void ice_response" << spar << paramsAMD << epar;
- _out << sb;
- if(ret || !outParams.empty())
- {
- _out << nl << "try";
- _out << sb;
- _out << nl << "IceInternal.BasicStream os__ = this.os__();";
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string typeS = typeToString(q->first);
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
- }
- if(ret)
- {
- string retS = typeToString(ret);
- writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, false);
- }
- if(p->returnsClasses())
- {
- _out << nl << "os__.writePendingObjects();";
- }
- _out << eb;
- _out << nl << "catch(Ice.LocalException ex__)";
- _out << sb;
- _out << nl << "ice_exception(ex__);";
- _out << eb;
- }
- _out << nl << "response__(true);";
- _out << eb;
-
- _out << sp << nl << "public void ice_exception(_System.Exception ex)";
- _out << sb;
- if(throws.empty())
- {
- _out << nl << "exception__(ex);";
- }
- else
- {
- _out << nl << "try";
- _out << sb;
- _out << nl << "throw ex;";
- _out << eb;
- ExceptionList::const_iterator r;
- for(r = throws.begin(); r != throws.end(); ++r)
- {
- string exS = fixId((*r)->scoped());
- _out << nl << "catch(" << exS << " ex__)";
- _out << sb;
- _out << nl << "os__().writeUserException(ex__);";
- _out << nl << "response__(false);";
- _out << eb;
- }
- _out << nl << "catch(_System.Exception ex__)";
- _out << sb;
- _out << nl << "exception__(ex__);";
- _out << eb;
- }
- _out << eb;
-
- _out << eb;
+ TypeStringList::const_iterator q;
+ _out << sp << nl << "class " << classNameAMDI << '_' << name
+ << " : IceInternal.IncomingAsync, " << classNameAMD << '_' << name;
+ _out << sb;
+
+ _out << sp << nl << "public " << classNameAMDI << '_' << name << "(IceInternal.Incoming inc) : base(inc)";
+ _out << sb;
+ _out << eb;
+
+ _out << sp << nl << "public void ice_response" << spar << paramsAMD << epar;
+ _out << sb;
+ if(ret || !outParams.empty())
+ {
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "IceInternal.BasicStream os__ = this.os__();";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string typeS = typeToString(q->first);
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
+ }
+ if(ret)
+ {
+ string retS = typeToString(ret);
+ writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, false);
+ }
+ if(p->returnsClasses())
+ {
+ _out << nl << "os__.writePendingObjects();";
+ }
+ _out << eb;
+ _out << nl << "catch(Ice.LocalException ex__)";
+ _out << sb;
+ _out << nl << "ice_exception(ex__);";
+ _out << eb;
+ }
+ _out << nl << "response__(true);";
+ _out << eb;
+
+ _out << sp << nl << "public void ice_exception(_System.Exception ex)";
+ _out << sb;
+ if(throws.empty())
+ {
+ _out << nl << "exception__(ex);";
+ }
+ else
+ {
+ _out << nl << "try";
+ _out << sb;
+ _out << nl << "throw ex;";
+ _out << eb;
+ ExceptionList::const_iterator r;
+ for(r = throws.begin(); r != throws.end(); ++r)
+ {
+ string exS = fixId((*r)->scoped());
+ _out << nl << "catch(" << exS << " ex__)";
+ _out << sb;
+ _out << nl << "os__().writeUserException(ex__);";
+ _out << nl << "response__(false);";
+ _out << eb;
+ }
+ _out << nl << "catch(_System.Exception ex__)";
+ _out << sb;
+ _out << nl << "exception__(ex__);";
+ _out << eb;
+ }
+ _out << eb;
+
+ _out << eb;
}
}
@@ -4755,14 +4755,14 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "public class " << name << "Tie_ : ";
if(p->isInterface())
{
- if(p->isLocal())
- {
- _out << fixId(name) << ", Ice.TieBase";
- }
- else
- {
- _out << name << "Disp_, Ice.TieBase";
- }
+ if(p->isLocal())
+ {
+ _out << fixId(name) << ", Ice.TieBase";
+ }
+ else
+ {
+ _out << name << "Disp_, Ice.TieBase";
+ }
}
else
{
@@ -4826,14 +4826,14 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
+ bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
string opName = hasAMD ? (*r)->name() + "_async" : fixId((*r)->name(), DotNet::ICloneable, true);
TypePtr ret = (*r)->returnType();
string retS = typeToString(ret);
vector<string> params;
- vector<string> args;
+ vector<string> args;
if(hasAMD)
{
params = getParamsAsync((*r), true);
@@ -4846,11 +4846,11 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
}
_out << sp << nl << "public ";
- if(!p->isInterface() || !p->isLocal())
- {
- _out << "override ";
- }
- _out << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params;
+ if(!p->isInterface() || !p->isLocal())
+ {
+ _out << "override ";
+ }
+ _out << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params;
if(!p->isLocal())
{
_out << "Ice.Current current__";
@@ -4896,19 +4896,19 @@ Slice::Gen::TieVisitor::writeInheritedOperationsWithOpNames(const ClassDefPtr& p
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
+ bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
string opName = hasAMD ? (*r)->name() + "_async" : fixId((*r)->name(), DotNet::ICloneable, true);
- if(opNames.find(opName) != opNames.end())
- {
- continue;
- }
- opNames.insert(opName);
+ if(opNames.find(opName) != opNames.end())
+ {
+ continue;
+ }
+ opNames.insert(opName);
TypePtr ret = (*r)->returnType();
string retS = typeToString(ret);
vector<string> params;
- vector<string> args;
+ vector<string> args;
if(hasAMD)
{
params = getParamsAsync((*r), true);
@@ -4921,11 +4921,11 @@ Slice::Gen::TieVisitor::writeInheritedOperationsWithOpNames(const ClassDefPtr& p
}
_out << sp << nl << "public ";
- if(!p->isInterface() || !p->isLocal())
- {
- _out << "override ";
- }
- _out << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params;
+ if(!p->isInterface() || !p->isLocal())
+ {
+ _out << "override ";
+ }
+ _out << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params;
if(!p->isLocal())
{
_out << "Ice.Current current__";
@@ -4969,96 +4969,96 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
if(comment)
{
- _out << nl << "// ";
+ _out << nl << "// ";
}
else
{
- _out << sp << nl;
+ _out << sp << nl;
}
- ParamDeclList::const_iterator i;
+ ParamDeclList::const_iterator i;
if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
{
- ParamDeclList::const_iterator i;
+ ParamDeclList::const_iterator i;
vector<string> pDecl = getParamsAsync(op, true);
- _out << "public ";
- if(!forTie)
- {
- _out << "override ";
- }
- _out << "void " << opName << "_async" << spar << pDecl << "Ice.Current current__" << epar;
-
- if(comment)
- {
- _out << ';';
- return;
- }
-
- _out << sb;
- if(ret)
- {
- _out << nl << typeToString(ret) << " ret__ = " << writeValue(ret) << ';';
- }
- for(i = params.begin(); i != params.end(); ++i)
- {
- if((*i)->isOutParam())
- {
- string name = fixId((*i)->name());
- TypePtr type = (*i)->type();
- _out << nl << typeToString(type) << ' ' << name << " = " << writeValue(type) << ';';
- }
- }
- _out << nl << "cb__.ice_response" << spar;
- if(ret)
- {
- _out << "ret__";
- }
- for(i = params.begin(); i != params.end(); ++i)
- {
- if((*i)->isOutParam())
- {
- _out << fixId((*i)->name());
- }
- }
- _out << epar << ';';
- _out << eb;
+ _out << "public ";
+ if(!forTie)
+ {
+ _out << "override ";
+ }
+ _out << "void " << opName << "_async" << spar << pDecl << "Ice.Current current__" << epar;
+
+ if(comment)
+ {
+ _out << ';';
+ return;
+ }
+
+ _out << sb;
+ if(ret)
+ {
+ _out << nl << typeToString(ret) << " ret__ = " << writeValue(ret) << ';';
+ }
+ for(i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->isOutParam())
+ {
+ string name = fixId((*i)->name());
+ TypePtr type = (*i)->type();
+ _out << nl << typeToString(type) << ' ' << name << " = " << writeValue(type) << ';';
+ }
+ }
+ _out << nl << "cb__.ice_response" << spar;
+ if(ret)
+ {
+ _out << "ret__";
+ }
+ for(i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->isOutParam())
+ {
+ _out << fixId((*i)->name());
+ }
+ }
+ _out << epar << ';';
+ _out << eb;
}
else
{
- vector<string> pDecls = getParams(op);
-
- _out << "public ";
- if(!forTie && !cl->isLocal())
- {
- _out << "override ";
- }
- _out << retS << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
- if(!cl->isLocal())
- {
- _out << "Ice.Current current__";
- }
- _out << epar;
- if(comment)
- {
- _out << ';';
- return;
- }
- _out << sb;
- for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
- {
- if((*i)->isOutParam())
- {
- string name = fixId((*i)->name());
- TypePtr type = (*i)->type();
- _out << nl << name << " = " << writeValue(type) << ';';
- }
- }
- if(ret)
- {
- _out << nl << "return " << writeValue(ret) << ';';
- }
- _out << eb;
+ vector<string> pDecls = getParams(op);
+
+ _out << "public ";
+ if(!forTie && !cl->isLocal())
+ {
+ _out << "override ";
+ }
+ _out << retS << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
+ if(!cl->isLocal())
+ {
+ _out << "Ice.Current current__";
+ }
+ _out << epar;
+ if(comment)
+ {
+ _out << ';';
+ return;
+ }
+ _out << sb;
+ for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->isOutParam())
+ {
+ string name = fixId((*i)->name());
+ TypePtr type = (*i)->type();
+ _out << nl << name << " = " << writeValue(type) << ';';
+ }
+ }
+ if(ret)
+ {
+ _out << nl << "return " << writeValue(ret) << ';';
+ }
+ _out << eb;
}
}
@@ -5070,43 +5070,43 @@ Slice::Gen::BaseImplVisitor::writeValue(const TypePtr& type)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- switch(builtin->kind())
- {
- case Builtin::KindBool:
- {
- return "false";
- break;
- }
- case Builtin::KindByte:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- {
- return "0";
- break;
- }
- case Builtin::KindFloat:
- {
- return "0.0f";
- break;
- }
- case Builtin::KindDouble:
- {
- return "0.0";
- break;
- }
- default:
- {
- return "null";
- break;
- }
- }
+ switch(builtin->kind())
+ {
+ case Builtin::KindBool:
+ {
+ return "false";
+ break;
+ }
+ case Builtin::KindByte:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ {
+ return "0";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ return "0.0f";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ return "0.0";
+ break;
+ }
+ default:
+ {
+ return "null";
+ break;
+ }
+ }
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return fixId(en->scoped()) + "." + fixId((*en->getEnumerators().begin())->name());
+ return fixId(en->scoped()) + "." + fixId((*en->getEnumerators().begin())->name());
}
StructPtr st = StructPtr::dynamicCast(type);
@@ -5157,13 +5157,13 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
if(p->isInterface())
{
if(p->isLocal())
- {
- _out << " : Ice.LocalObjectImpl, " << fixId(name);
- }
- else
- {
- _out << " : " << name << "Disp_";
- }
+ {
+ _out << " : Ice.LocalObjectImpl, " << fixId(name);
+ }
+ else
+ {
+ _out << " : " << name << "Disp_";
+ }
}
else
{
@@ -5234,15 +5234,15 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "public class " << name << "I : ";
if(inheritImpl)
{
- if(bases.front()->isAbstract())
- {
- _out << bases.front()->name() << 'I';
- }
- else
- {
- _out << fixId(bases.front()->name());
- }
- _out << ", ";
+ if(bases.front()->isAbstract())
+ {
+ _out << bases.front()->name() << 'I';
+ }
+ else
+ {
+ _out << fixId(bases.front()->name());
+ }
+ _out << ", ";
}
_out << name << "Operations";
if(p->isLocal())
diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h
index c14c66202f5..64f4f90d828 100644
--- a/cpp/src/slice2cs/Gen.h
+++ b/cpp/src/slice2cs/Gen.h
@@ -47,10 +47,10 @@ public:
Gen(const std::string&,
const std::string&,
const std::vector<std::string>&,
- const std::string&,
- bool,
- bool,
- bool);
+ const std::string&,
+ bool,
+ bool,
+ bool);
~Gen();
bool operator!() const; // Returns true if there was a constructor error
@@ -78,12 +78,12 @@ private:
UnitVisitor(::IceUtil::Output&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
private:
- bool _stream;
- bool _globalMetaDataDone;
+ bool _stream;
+ bool _globalMetaDataDone;
};
class TypesVisitor : public CsVisitor
@@ -92,24 +92,24 @@ private:
TypesVisitor(::IceUtil::Output&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
private:
- bool _stream;
+ bool _stream;
};
class ProxyVisitor : public CsVisitor
@@ -118,11 +118,11 @@ private:
ProxyVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
};
class OpsVisitor : public CsVisitor
@@ -131,9 +131,9 @@ private:
OpsVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
void writeOperations(const ClassDefPtr&, bool);
@@ -145,16 +145,16 @@ private:
HelperVisitor(::IceUtil::Output&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
private:
- bool _stream;
+ bool _stream;
};
class DelegateVisitor : public CsVisitor
@@ -163,10 +163,10 @@ private:
DelegateVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class DelegateMVisitor : public CsVisitor
@@ -175,10 +175,10 @@ private:
DelegateMVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class DelegateDVisitor : public CsVisitor
@@ -187,10 +187,10 @@ private:
DelegateDVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class DispatcherVisitor : public CsVisitor
@@ -199,9 +199,9 @@ private:
DispatcherVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
};
class AsyncVisitor : public CsVisitor
@@ -210,11 +210,11 @@ private:
AsyncVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
};
class TieVisitor : public CsVisitor
@@ -223,15 +223,15 @@ private:
TieVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
private:
- typedef ::std::set< ::std::string> NameSet;
- void writeInheritedOperationsWithOpNames(const ClassDefPtr&, NameSet&);
+ typedef ::std::set< ::std::string> NameSet;
+ void writeInheritedOperationsWithOpNames(const ClassDefPtr&, NameSet&);
};
class BaseImplVisitor : public CsVisitor
@@ -242,11 +242,11 @@ private:
protected:
- void writeOperation(const OperationPtr&, bool, bool);
+ void writeOperation(const OperationPtr&, bool, bool);
private:
- ::std::string writeValue(const TypePtr&);
+ ::std::string writeValue(const TypePtr&);
};
class ImplVisitor : public BaseImplVisitor
@@ -255,10 +255,10 @@ private:
ImplVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class ImplTieVisitor : public BaseImplVisitor
@@ -267,9 +267,9 @@ private:
ImplTieVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
};
};
diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp
index fe5118175a0..a34d32301cb 100644
--- a/cpp/src/slice2cs/Main.cpp
+++ b/cpp/src/slice2cs/Main.cpp
@@ -26,12 +26,12 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--tie Generate TIE classes.\n"
"--impl Generate sample implementations.\n"
"--impl-tie Generate sample TIE implementations.\n"
- "--depend Generate Makefile dependencies.\n"
+ "--depend Generate Makefile dependencies.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--checksum Generate checksums for Slice definitions.\n"
@@ -69,20 +69,20 @@ main(int argc, char* argv[])
catch(const IceUtil::BadOptException& e)
{
cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -90,19 +90,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -145,80 +145,80 @@ main(int argc, char* argv[])
for(i = args.begin(); i != args.end(); ++i)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::CSharp);
- }
- else
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- return EXIT_FAILURE;
- }
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive);
- int parseStatus = p->parse(cppHandle, debug);
-
- if(!icecpp.close())
- {
- p->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- Gen gen(argv[0], icecpp.getBaseName(), includePaths, output, impl, implTie, stream);
- if(!gen)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- gen.generate(p);
- if(tie)
- {
- gen.generateTie(p);
- }
- if(impl)
- {
- gen.generateImpl(p);
- }
- if(implTie)
- {
- gen.generateImplTie(p);
- }
- if(checksum)
- {
- gen.generateChecksums(p);
- }
- }
-
- p->destroy();
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::CSharp);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ return EXIT_FAILURE;
+ }
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive);
+ int parseStatus = p->parse(cppHandle, debug);
+
+ if(!icecpp.close())
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ Gen gen(argv[0], icecpp.getBaseName(), includePaths, output, impl, implTie, stream);
+ if(!gen)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ gen.generate(p);
+ if(tie)
+ {
+ gen.generateTie(p);
+ }
+ if(impl)
+ {
+ gen.generateImpl(p);
+ }
+ if(implTie)
+ {
+ gen.generateImplTie(p);
+ }
+ if(checksum)
+ {
+ gen.generateChecksums(p);
+ }
+ }
+
+ p->destroy();
+ }
+ }
}
return status;
diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp
index d2da7f62034..86b8beac068 100644
--- a/cpp/src/slice2docbook/Gen.cpp
+++ b/cpp/src/slice2docbook/Gen.cpp
@@ -27,18 +27,18 @@ Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool ch
{
if(chapter)
{
- _chapter = "chapter";
+ _chapter = "chapter";
}
else
{
- _chapter = "section";
+ _chapter = "section";
}
-
+
O.open(file.c_str());
if(!O)
{
- cerr << name << ": can't open `" << file << "' for writing: " << strerror(errno) << endl;
- return;
+ cerr << name << ": can't open `" << file << "' for writing: " << strerror(errno) << endl;
+ return;
}
}
@@ -71,13 +71,13 @@ Slice::Gen::visitUnitStart(const UnitPtr& p)
{
if(_standAlone)
{
- O << "<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook V3.1//EN\">";
- printHeader();
- start("article");
+ O << "<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook V3.1//EN\">";
+ printHeader();
+ start("article");
}
else
{
- printHeader();
+ printHeader();
}
return true;
@@ -88,7 +88,7 @@ Slice::Gen::visitUnitEnd(const UnitPtr& p)
{
if(_standAlone)
{
- end();
+ end();
}
}
@@ -100,11 +100,11 @@ Slice::Gen::visitModuleStart(const ModulePtr& p)
string metadata, deprecateReason;
if(p->findMetaData("deprecate", metadata))
{
- deprecateReason = "This module has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This module has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
start("section", "Overview", false);
@@ -125,262 +125,262 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
{
ModuleList modules = p->modules();
modules.erase(remove_if(modules.begin(), modules.end(), ::IceUtil::constMemFun(&Contained::includeLevel)),
- modules.end());
+ modules.end());
if(!modules.empty() && !_noIndex)
{
- start("section", "Module Index", false);
- start("variablelist");
- for(ModuleList::const_iterator q = modules.begin(); q != modules.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Module Index", false);
+ start("variablelist");
+ for(ModuleList::const_iterator q = modules.begin(); q != modules.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
ClassList classesAndInterfaces = p->classes();
classesAndInterfaces.erase(remove_if(classesAndInterfaces.begin(), classesAndInterfaces.end(),
- ::IceUtil::constMemFun(&Contained::includeLevel)),
- classesAndInterfaces.end());
+ ::IceUtil::constMemFun(&Contained::includeLevel)),
+ classesAndInterfaces.end());
ClassList classes;
ClassList interfaces;
remove_copy_if(classesAndInterfaces.begin(), classesAndInterfaces.end(), back_inserter(classes),
- ::IceUtil::constMemFun(&ClassDef::isInterface));
+ ::IceUtil::constMemFun(&ClassDef::isInterface));
remove_copy_if(classesAndInterfaces.begin(), classesAndInterfaces.end(), back_inserter(interfaces),
- not1(::IceUtil::constMemFun(&ClassDef::isInterface)));
+ not1(::IceUtil::constMemFun(&ClassDef::isInterface)));
if(!classes.empty() && !_noIndex)
{
- start("section", "Class Index", false);
- start("variablelist");
- for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Class Index", false);
+ start("variablelist");
+ for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
if(!interfaces.empty() && !_noIndex)
{
- start("section", "Interface Index", false);
- start("variablelist");
- for(ClassList::const_iterator q = interfaces.begin(); q != interfaces.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Interface Index", false);
+ start("variablelist");
+ for(ClassList::const_iterator q = interfaces.begin(); q != interfaces.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
ExceptionList exceptions = p->exceptions();
exceptions.erase(remove_if(exceptions.begin(), exceptions.end(), ::IceUtil::constMemFun(&Contained::includeLevel)),
- exceptions.end());
+ exceptions.end());
if(!exceptions.empty() && !_noIndex)
{
- start("section", "Exception Index", false);
- start("variablelist");
- for(ExceptionList::const_iterator q = exceptions.begin(); q != exceptions.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Exception Index", false);
+ start("variablelist");
+ for(ExceptionList::const_iterator q = exceptions.begin(); q != exceptions.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
StructList structs = p->structs();
structs.erase(remove_if(structs.begin(), structs.end(), ::IceUtil::constMemFun(&Contained::includeLevel)),
- structs.end());
+ structs.end());
if(!structs.empty() && !_noIndex)
{
- start("section", "Struct Index", false);
- start("variablelist");
- for(StructList::const_iterator q = structs.begin(); q != structs.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Struct Index", false);
+ start("variablelist");
+ for(StructList::const_iterator q = structs.begin(); q != structs.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
SequenceList sequences = p->sequences();
sequences.erase(remove_if(sequences.begin(), sequences.end(), ::IceUtil::constMemFun(&Contained::includeLevel)),
- sequences.end());
+ sequences.end());
if(!sequences.empty() && !_noIndex)
{
- start("section", "Sequence Index", false);
- start("variablelist");
- for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Sequence Index", false);
+ start("variablelist");
+ for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
DictionaryList dictionaries = p->dictionaries();
dictionaries.erase(remove_if(dictionaries.begin(), dictionaries.end(),
- ::IceUtil::constMemFun(&Contained::includeLevel)),
- dictionaries.end());
+ ::IceUtil::constMemFun(&Contained::includeLevel)),
+ dictionaries.end());
if(!dictionaries.empty() && !_noIndex)
{
- start("section", "Dictionary Index", false);
- start("variablelist");
- for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Dictionary Index", false);
+ start("variablelist");
+ for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
EnumList enums = p->enums();
enums.erase(remove_if(enums.begin(), enums.end(), ::IceUtil::constMemFun(&Contained::includeLevel)),
- enums.end());
+ enums.end());
if(!enums.empty() && !_noIndex)
{
- start("section", "Enum Index", false);
- start("variablelist");
- for(EnumList::const_iterator q = enums.begin(); q != enums.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- string metadata;
- printSummary(*q, (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Enum Index", false);
+ start("variablelist");
+ for(EnumList::const_iterator q = enums.begin(); q != enums.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ string metadata;
+ printSummary(*q, (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
end();
{
- for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
- {
- start("section id=" + containedToId(*q), (*q)->name());
- O.zeroIndent();
- O << nl << "<synopsis>";
- printMetaData(*q);
- if((*q)->isLocal())
- {
- O << "local ";
- }
- TypePtr type = (*q)->type();
- O << "sequence&lt;" << toString(type, p) << "&gt; <type>" << (*q)->name() << "</type>;</synopsis>";
- O.restoreIndent();
-
- string metadata, deprecateReason;
- if((*q)->findMetaData("deprecate", metadata))
- {
- deprecateReason = "This type has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
- }
-
- printComment(*q, deprecateReason);
- end();
- }
+ for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
+ {
+ start("section id=" + containedToId(*q), (*q)->name());
+ O.zeroIndent();
+ O << nl << "<synopsis>";
+ printMetaData(*q);
+ if((*q)->isLocal())
+ {
+ O << "local ";
+ }
+ TypePtr type = (*q)->type();
+ O << "sequence&lt;" << toString(type, p) << "&gt; <type>" << (*q)->name() << "</type>;</synopsis>";
+ O.restoreIndent();
+
+ string metadata, deprecateReason;
+ if((*q)->findMetaData("deprecate", metadata))
+ {
+ deprecateReason = "This type has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, deprecateReason);
+ end();
+ }
}
{
- for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
- {
- start("section id=" + containedToId(*q), (*q)->name());
- O.zeroIndent();
- O << nl << "<synopsis>";
- printMetaData(*q);
- if((*q)->isLocal())
- {
- O << "local ";
- }
- TypePtr keyType = (*q)->keyType();
- TypePtr valueType = (*q)->valueType();
- O << "dictionary&lt;" << toString(keyType, p) << ", " << toString(valueType, p) << "&gt; <type>"
- << (*q)->name() << "</type>;</synopsis>";
- O.restoreIndent();
-
- string metadata, deprecateReason;
- if((*q)->findMetaData("deprecate", metadata))
- {
- deprecateReason = "This type has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
- }
-
- printComment(*q, deprecateReason);
- end();
- }
+ for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
+ {
+ start("section id=" + containedToId(*q), (*q)->name());
+ O.zeroIndent();
+ O << nl << "<synopsis>";
+ printMetaData(*q);
+ if((*q)->isLocal())
+ {
+ O << "local ";
+ }
+ TypePtr keyType = (*q)->keyType();
+ TypePtr valueType = (*q)->valueType();
+ O << "dictionary&lt;" << toString(keyType, p) << ", " << toString(valueType, p) << "&gt; <type>"
+ << (*q)->name() << "</type>;</synopsis>";
+ O.restoreIndent();
+
+ string metadata, deprecateReason;
+ if((*q)->findMetaData("deprecate", metadata))
+ {
+ deprecateReason = "This type has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, deprecateReason);
+ end();
+ }
}
}
@@ -395,11 +395,11 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
bool deprecatedClass = p->findMetaData("deprecate", metadata);
if(deprecatedClass)
{
- deprecateReason = "This type has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This type has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
O.zeroIndent();
@@ -407,51 +407,51 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
printMetaData(p);
if(p->isLocal())
{
- O << "local ";
+ O << "local ";
}
if(p->isInterface())
{
- O << "interface";
+ O << "interface";
}
else
{
- O << "class";
+ O << "class";
}
O << " <classname>" << p->name() << "</classname>";
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
- O.inc();
- O << nl << "extends ";
- O.inc();
- O << nl << toString(bases.front(), p);
- bases.pop_front();
- O.dec();
- O.dec();
+ O.inc();
+ O << nl << "extends ";
+ O.inc();
+ O << nl << toString(bases.front(), p);
+ bases.pop_front();
+ O.dec();
+ O.dec();
}
if(!bases.empty())
{
- O.inc();
- if(p->isInterface())
- {
- O << nl << "extends ";
- }
- else
- {
- O << nl << "implements ";
- }
- O.inc();
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- O << nl << toString(*q, p);
- if(++q != bases.end())
- {
- O << ",";
- }
- }
- O.dec();
- O.dec();
+ O.inc();
+ if(p->isInterface())
+ {
+ O << nl << "extends ";
+ }
+ else
+ {
+ O << nl << "implements ";
+ }
+ O.inc();
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ O << nl << toString(*q, p);
+ if(++q != bases.end())
+ {
+ O << ",";
+ }
+ }
+ O.dec();
+ O.dec();
}
O << "</synopsis>";
O.restoreIndent();
@@ -460,138 +460,138 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
OperationList operations = p->operations();
if(!operations.empty() && !_noIndex)
{
- start("section", "Operation Index", false);
- start("variablelist");
- for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- printSummary(*q, deprecatedClass || (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Operation Index", false);
+ start("variablelist");
+ for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ printSummary(*q, deprecatedClass || (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
DataMemberList dataMembers = p->dataMembers();
if(!dataMembers.empty() && !_noIndex)
{
- start("section", "Data Member Index", false);
- start("variablelist");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- printSummary(*q, deprecatedClass || (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Data Member Index", false);
+ start("variablelist");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ printSummary(*q, deprecatedClass || (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
end();
{
- for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
- {
- start("section id=" + containedToId(*q), (*q)->name());
- O.zeroIndent();
- O << nl << "<synopsis>";
- printMetaData(*q);
- TypePtr returnType = (*q)->returnType();
- O << (returnType ? toString(returnType, p) : string("<type>void</type>")) << " <function>" << (*q)->name()
- << "</function>(";
- O.inc();
- ParamDeclList paramList = (*q)->parameters();
- ParamDeclList::const_iterator r = paramList.begin();
- while(r != paramList.end())
- {
- if((*r)->isOutParam())
- {
- O << "out ";
- }
- O << toString((*r)->type(), *q) << " <parameter>";
- O << (*r)->name() << "</parameter>";
- if(++r != paramList.end())
- {
- O << ',';
- O << nl;
- }
- }
- O << ')';
- O.dec();
- ExceptionList throws = (*q)->throws();
- if(!throws.empty())
- {
- O.inc();
- O << nl << "throws";
- O.inc();
- ExceptionList::const_iterator t = throws.begin();
- while(t != throws.end())
- {
- O << nl << toString(*t, p);
- if(++t != throws.end())
- {
- O << ',';
- }
- }
- O.dec();
- O.dec();
- }
- O << ";</synopsis>";
- O.restoreIndent();
-
- string reason;
- metadata.clear();
- if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This operation has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
-
- printComment(*q, reason);
- end();
- }
- }
-
- {
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("section id=" + containedToId(*q), (*q)->name());
- O.zeroIndent();
- O << nl << "<synopsis>";
- printMetaData(*q);
- TypePtr type = (*q)->type();
- O << toString(type, p) << " <structfield>" << (*q)->name() << "</structfield>;</synopsis>";
- O.restoreIndent();
-
- string reason;
- metadata.clear();
- if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This member has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
-
- printComment(*q, reason);
- end();
- }
- }
-
+ for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
+ {
+ start("section id=" + containedToId(*q), (*q)->name());
+ O.zeroIndent();
+ O << nl << "<synopsis>";
+ printMetaData(*q);
+ TypePtr returnType = (*q)->returnType();
+ O << (returnType ? toString(returnType, p) : string("<type>void</type>")) << " <function>" << (*q)->name()
+ << "</function>(";
+ O.inc();
+ ParamDeclList paramList = (*q)->parameters();
+ ParamDeclList::const_iterator r = paramList.begin();
+ while(r != paramList.end())
+ {
+ if((*r)->isOutParam())
+ {
+ O << "out ";
+ }
+ O << toString((*r)->type(), *q) << " <parameter>";
+ O << (*r)->name() << "</parameter>";
+ if(++r != paramList.end())
+ {
+ O << ',';
+ O << nl;
+ }
+ }
+ O << ')';
+ O.dec();
+ ExceptionList throws = (*q)->throws();
+ if(!throws.empty())
+ {
+ O.inc();
+ O << nl << "throws";
+ O.inc();
+ ExceptionList::const_iterator t = throws.begin();
+ while(t != throws.end())
+ {
+ O << nl << toString(*t, p);
+ if(++t != throws.end())
+ {
+ O << ',';
+ }
+ }
+ O.dec();
+ O.dec();
+ }
+ O << ";</synopsis>";
+ O.restoreIndent();
+
+ string reason;
+ metadata.clear();
+ if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This operation has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, reason);
+ end();
+ }
+ }
+
+ {
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("section id=" + containedToId(*q), (*q)->name());
+ O.zeroIndent();
+ O << nl << "<synopsis>";
+ printMetaData(*q);
+ TypePtr type = (*q)->type();
+ O << toString(type, p) << " <structfield>" << (*q)->name() << "</structfield>;</synopsis>";
+ O.restoreIndent();
+
+ string reason;
+ metadata.clear();
+ if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This member has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, reason);
+ end();
+ }
+ }
+
end();
return true;
@@ -608,11 +608,11 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
bool deprecatedException = p->findMetaData("deprecate", metadata);
if(deprecatedException)
{
- deprecateReason = "This type has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This type has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
O.zeroIndent();
@@ -620,18 +620,18 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
printMetaData(p);
if(p->isLocal())
{
- O << "local ";
+ O << "local ";
}
O << "exception <classname>" << p->name() << "</classname>";
ExceptionPtr base = p->base();
if(base)
{
- O.inc();
- O << nl << "extends ";
- O.inc();
- O << nl << toString(base, p);
- O.dec();
- O.dec();
+ O.inc();
+ O << nl << "extends ";
+ O.inc();
+ O << nl << toString(base, p);
+ O.dec();
+ O.dec();
}
O << "</synopsis>";
O.restoreIndent();
@@ -640,52 +640,52 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
DataMemberList dataMembers = p->dataMembers();
if(!dataMembers.empty() && !_noIndex)
{
- start("section", "Data Member Index", false);
- start("variablelist");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- printSummary(*q, deprecatedException || (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Data Member Index", false);
+ start("variablelist");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ printSummary(*q, deprecatedException || (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
end();
{
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("section id=" + containedToId(*q), (*q)->name());
- O.zeroIndent();
- O << nl << "<synopsis>";
- printMetaData(*q);
- TypePtr type = (*q)->type();
- O << toString(type, p) << " <structfield>" << (*q)->name() << "</structfield>;</synopsis>";
- O.restoreIndent();
-
- string reason;
- metadata.clear();
- if(deprecatedException || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This member has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
-
- printComment(*q, reason);
- end();
- }
- }
-
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("section id=" + containedToId(*q), (*q)->name());
+ O.zeroIndent();
+ O << nl << "<synopsis>";
+ printMetaData(*q);
+ TypePtr type = (*q)->type();
+ O << toString(type, p) << " <structfield>" << (*q)->name() << "</structfield>;</synopsis>";
+ O.restoreIndent();
+
+ string reason;
+ metadata.clear();
+ if(deprecatedException || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This member has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, reason);
+ end();
+ }
+ }
+
end();
return true;
@@ -702,11 +702,11 @@ Slice::Gen::visitStructStart(const StructPtr& p)
bool deprecatedStruct = p->findMetaData("deprecate", metadata);
if(deprecatedStruct)
{
- deprecateReason = "This type has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This type has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
O.zeroIndent();
@@ -714,7 +714,7 @@ Slice::Gen::visitStructStart(const StructPtr& p)
printMetaData(p);
if(p->isLocal())
{
- O << "local ";
+ O << "local ";
}
O << "struct <structname>" << p->name() << "</structname>";
O << "</synopsis>";
@@ -724,52 +724,52 @@ Slice::Gen::visitStructStart(const StructPtr& p)
DataMemberList dataMembers = p->dataMembers();
if(!dataMembers.empty() && !_noIndex)
{
- start("section", "Data Member Index", false);
- start("variablelist");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p);
- end();
- start("listitem");
- printSummary(*q, deprecatedStruct || (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Data Member Index", false);
+ start("variablelist");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p);
+ end();
+ start("listitem");
+ printSummary(*q, deprecatedStruct || (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
end();
{
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("section id=" + containedToId(*q), (*q)->name());
- O.zeroIndent();
- O << nl << "<synopsis>";
- printMetaData(*q);
- TypePtr type = (*q)->type();
- O << toString(type, p) << " <structfield>" << (*q)->name() << "</structfield>;</synopsis>";
- O.restoreIndent();
-
- string reason;
- metadata.clear();
- if(deprecatedStruct || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This member has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
-
- printComment(*q, reason);
- end();
- }
- }
-
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("section id=" + containedToId(*q), (*q)->name());
+ O.zeroIndent();
+ O << nl << "<synopsis>";
+ printMetaData(*q);
+ TypePtr type = (*q)->type();
+ O << toString(type, p) << " <structfield>" << (*q)->name() << "</structfield>;</synopsis>";
+ O.restoreIndent();
+
+ string reason;
+ metadata.clear();
+ if(deprecatedStruct || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This member has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, reason);
+ end();
+ }
+ }
+
end();
return true;
@@ -785,11 +785,11 @@ Slice::Gen::visitEnum(const EnumPtr& p)
bool deprecatedEnum = p->findMetaData("deprecate", metadata);
if(deprecatedEnum)
{
- deprecateReason = "This type has been deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This type has been deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
O.zeroIndent();
@@ -797,7 +797,7 @@ Slice::Gen::visitEnum(const EnumPtr& p)
printMetaData(p);
if(p->isLocal())
{
- O << "local ";
+ O << "local ";
}
O << "enum <type>" << p->name() << "</type>";
O << "</synopsis>";
@@ -807,49 +807,49 @@ Slice::Gen::visitEnum(const EnumPtr& p)
EnumeratorList enumerators = p->getEnumerators();
if(!enumerators.empty() && !_noIndex)
{
- start("section", "Enumerator Index", false);
- start("variablelist");
- for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
- {
- start("varlistentry");
- start("term");
- O << toString(*q, p->container());
- end();
- start("listitem");
- printSummary(*q, deprecatedEnum || (*q)->findMetaData("deprecate", metadata));
- end();
- end();
- }
- end();
- end();
+ start("section", "Enumerator Index", false);
+ start("variablelist");
+ for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
+ {
+ start("varlistentry");
+ start("term");
+ O << toString(*q, p->container());
+ end();
+ start("listitem");
+ printSummary(*q, deprecatedEnum || (*q)->findMetaData("deprecate", metadata));
+ end();
+ end();
+ }
+ end();
+ end();
}
end();
{
- for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
- {
- start("section id=" + containedToId(*q), (*q)->name());
- O.zeroIndent();
- O << nl << "<synopsis>";
- printMetaData(*q);
- O << "<constant>" << (*q)->name() << "</constant></synopsis>";
- O.restoreIndent();
-
- //
- // Enumerators do not support metadata.
- //
- string reason;
- if(deprecatedEnum)
- {
- reason = "This enumerator has been deprecated.";
- }
-
- printComment(*q, reason);
- end();
- }
- }
-
+ for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
+ {
+ start("section id=" + containedToId(*q), (*q)->name());
+ O.zeroIndent();
+ O << nl << "<synopsis>";
+ printMetaData(*q);
+ O << "<constant>" << (*q)->name() << "</constant></synopsis>";
+ O.restoreIndent();
+
+ //
+ // Enumerators do not support metadata.
+ //
+ string reason;
+ if(deprecatedEnum)
+ {
+ reason = "This enumerator has been deprecated.";
+ }
+
+ printComment(*q, reason);
+ end();
+ }
+ }
+
end();
}
@@ -887,34 +887,34 @@ Slice::Gen::getComment(const ContainedPtr& contained, const ContainerPtr& contai
string comment;
for(unsigned int i = 0; i < s.size(); ++i)
{
- if(s[i] == '\\' && i + 1 < s.size() && s[i + 1] == '[')
- {
- comment += '[';
- ++i;
- }
- else if(s[i] == '[')
- {
- string literal;
- for(++i; i < s.size(); ++i)
- {
- if(s[i] == ']')
- {
- break;
- }
-
- literal += s[i];
- }
- comment += toString(literal, container);
- }
- else if(summary && s[i] == '.' && (i + 1 >= s.size() || isspace(s[i + 1])))
- {
- comment += '.';
- break;
- }
- else
- {
- comment += s[i];
- }
+ if(s[i] == '\\' && i + 1 < s.size() && s[i + 1] == '[')
+ {
+ comment += '[';
+ ++i;
+ }
+ else if(s[i] == '[')
+ {
+ string literal;
+ for(++i; i < s.size(); ++i)
+ {
+ if(s[i] == ']')
+ {
+ break;
+ }
+
+ literal += s[i];
+ }
+ comment += toString(literal, container);
+ }
+ else if(summary && s[i] == '.' && (i + 1 >= s.size() || isspace(s[i + 1])))
+ {
+ comment += '.';
+ break;
+ }
+ else
+ {
+ comment += s[i];
+ }
}
return comment;
@@ -927,29 +927,29 @@ Slice::Gen::getTagged(const string& tag, string& comment)
string::size_type begin = 0;
while(begin < comment.size())
{
- begin = comment.find("@" + tag, begin);
- if(begin == string::npos)
- {
- return result;
- }
-
- string::size_type pos1 = comment.find_first_not_of(" \t\r\n", begin + tag.size() + 1);
- if(pos1 == string::npos)
- {
- comment.erase(begin);
- return result;
- }
-
- string::size_type pos2 = comment.find('@', pos1);
- string line = comment.substr(pos1, pos2 - pos1);
- comment.erase(begin, pos2 - 1 - begin);
-
- string::size_type pos3 = line.find_last_not_of(" \t\r\n");
- if(pos3 != string::npos)
- {
- line.erase(pos3 + 1);
- }
- result.push_back(line);
+ begin = comment.find("@" + tag, begin);
+ if(begin == string::npos)
+ {
+ return result;
+ }
+
+ string::size_type pos1 = comment.find_first_not_of(" \t\r\n", begin + tag.size() + 1);
+ if(pos1 == string::npos)
+ {
+ comment.erase(begin);
+ return result;
+ }
+
+ string::size_type pos2 = comment.find('@', pos1);
+ string line = comment.substr(pos1, pos2 - pos1);
+ comment.erase(begin, pos2 - 1 - begin);
+
+ string::size_type pos3 = line.find_last_not_of(" \t\r\n");
+ if(pos3 != string::npos)
+ {
+ line.erase(pos3 + 1);
+ }
+ result.push_back(line);
}
return result;
@@ -962,17 +962,17 @@ Slice::Gen::printMetaData(const ContainedPtr& p)
if(!metaData.empty())
{
- O << "[";
- list<string>::const_iterator q = metaData.begin();
- while(q != metaData.end())
- {
- O << " \"" << *q << "\"";
- if(++q != metaData.end())
- {
- O << ",";
- }
- }
- O << " ]" << nl;
+ O << "[";
+ list<string>::const_iterator q = metaData.begin();
+ while(q != metaData.end())
+ {
+ O << " \"" << *q << "\"";
+ if(++q != metaData.end())
+ {
+ O << ",";
+ }
+ }
+ O << " ]" << nl;
}
}
@@ -982,7 +982,7 @@ Slice::Gen::printComment(const ContainedPtr& p, const string& deprecateReason)
ContainerPtr container = ContainerPtr::dynamicCast(p);
if(!container)
{
- container = p->container();
+ container = p->container();
}
string comment = getComment(p, container, false);
@@ -996,223 +996,223 @@ Slice::Gen::printComment(const ContainedPtr& p, const string& deprecateReason)
string::size_type pos = comment.find_last_not_of(" \t\r\n");
if(pos != string::npos)
{
- comment.erase(pos + 1);
- O.zeroIndent();
- O << nl << comment;
- O.restoreIndent();
+ comment.erase(pos + 1);
+ O.zeroIndent();
+ O << nl << comment;
+ O.restoreIndent();
}
end();
if(!deprecateReason.empty())
{
- start("caution");
- start("title");
- O << nl << "Deprecated";
- end();
- start("para");
- O << nl << deprecateReason;
- end();
- end();
+ start("caution");
+ start("title");
+ O << nl << "Deprecated";
+ end();
+ start("para");
+ O << nl << deprecateReason;
+ end();
+ end();
}
if(!par.empty())
{
- start("section", "Parameters", false);
- start("variablelist");
- for(StringList::const_iterator q = par.begin(); q != par.end(); ++q)
- {
- string term;
- pos = q->find_first_of(" \t\r\n");
- if(pos != string::npos)
- {
- term = q->substr(0, pos);
- }
- string item;
- pos = q->find_first_not_of(" \t\r\n", pos);
- if(pos != string::npos)
- {
- item = q->substr(pos);
- }
-
- start("varlistentry");
- start("term");
- O << "<parameter>" << term << "</parameter>";
- end();
- start("listitem");
- start("para");
- O << nl << item;
- end();
- end();
- end();
- }
- end();
- end();
+ start("section", "Parameters", false);
+ start("variablelist");
+ for(StringList::const_iterator q = par.begin(); q != par.end(); ++q)
+ {
+ string term;
+ pos = q->find_first_of(" \t\r\n");
+ if(pos != string::npos)
+ {
+ term = q->substr(0, pos);
+ }
+ string item;
+ pos = q->find_first_not_of(" \t\r\n", pos);
+ if(pos != string::npos)
+ {
+ item = q->substr(pos);
+ }
+
+ start("varlistentry");
+ start("term");
+ O << "<parameter>" << term << "</parameter>";
+ end();
+ start("listitem");
+ start("para");
+ O << nl << item;
+ end();
+ end();
+ end();
+ }
+ end();
+ end();
}
if(!ret.empty())
{
- start("section", "Return Value", false);
- start("para");
- O << nl << ret.front();
- end();
- end();
+ start("section", "Return Value", false);
+ start("para");
+ O << nl << ret.front();
+ end();
+ end();
}
if(!throws.empty())
{
- start("section", "Exceptions", false);
- start("variablelist");
- for(StringList::const_iterator q = throws.begin(); q != throws.end(); ++q)
- {
- string term;
- pos = q->find_first_of(" \t\r\n");
- if(pos != string::npos)
- {
- term = q->substr(0, pos);
- }
- string item;
- pos = q->find_first_not_of(" \t\r\n", pos);
- if(pos != string::npos)
- {
- item = q->substr(pos);
- }
-
- start("varlistentry");
- start("term");
- O << toString(term, container);
- end();
- start("listitem");
- start("para");
- O << nl << item;
- end();
- end();
- end();
- }
- end();
- end();
+ start("section", "Exceptions", false);
+ start("variablelist");
+ for(StringList::const_iterator q = throws.begin(); q != throws.end(); ++q)
+ {
+ string term;
+ pos = q->find_first_of(" \t\r\n");
+ if(pos != string::npos)
+ {
+ term = q->substr(0, pos);
+ }
+ string item;
+ pos = q->find_first_not_of(" \t\r\n", pos);
+ if(pos != string::npos)
+ {
+ item = q->substr(pos);
+ }
+
+ start("varlistentry");
+ start("term");
+ O << toString(term, container);
+ end();
+ start("listitem");
+ start("para");
+ O << nl << item;
+ end();
+ end();
+ end();
+ }
+ end();
+ end();
}
ClassList derivedClasses;
ClassDefPtr def = ClassDefPtr::dynamicCast(p);
if(def)
{
- derivedClasses = p->unit()->findDerivedClasses(def);
+ derivedClasses = p->unit()->findDerivedClasses(def);
}
if(!derivedClasses.empty())
{
- start("section", "Derived Classes and Interfaces", false);
- O << nl << "<para>";
- start("simplelist type=\"inline\"");
- for(ClassList::const_iterator q = derivedClasses.begin(); q != derivedClasses.end(); ++q)
- {
- start("member");
- O << toString(*q, container);
- end();
- }
- end();
- O << "</para>";
- end();
+ start("section", "Derived Classes and Interfaces", false);
+ O << nl << "<para>";
+ start("simplelist type=\"inline\"");
+ for(ClassList::const_iterator q = derivedClasses.begin(); q != derivedClasses.end(); ++q)
+ {
+ start("member");
+ O << toString(*q, container);
+ end();
+ }
+ end();
+ O << "</para>";
+ end();
}
ExceptionList derivedExceptions;
ExceptionPtr ex = ExceptionPtr::dynamicCast(p);
if(ex)
{
- derivedExceptions = p->unit()->findDerivedExceptions(ex);
- if(!derivedExceptions.empty())
- {
- start("section", "Derived Exceptions", false);
- O << nl << "<para>";
- start("simplelist type=\"inline\"");
- for(ExceptionList::const_iterator q = derivedExceptions.begin(); q != derivedExceptions.end(); ++q)
- {
- start("member");
- O << toString(*q, container);
- end();
- }
- end();
- O << "</para>";
- end();
- }
- ContainedList usedBy;
- usedBy = p->unit()->findUsedBy(ex);
- if(!usedBy.empty())
- {
- start("section", "Used By", false);
- O << nl << "<para>";
- start("simplelist type=\"inline\"");
- for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
- {
- start("member");
- O << toString(*q, container);
- end();
- }
- end();
- O << "</para>";
- end();
- }
+ derivedExceptions = p->unit()->findDerivedExceptions(ex);
+ if(!derivedExceptions.empty())
+ {
+ start("section", "Derived Exceptions", false);
+ O << nl << "<para>";
+ start("simplelist type=\"inline\"");
+ for(ExceptionList::const_iterator q = derivedExceptions.begin(); q != derivedExceptions.end(); ++q)
+ {
+ start("member");
+ O << toString(*q, container);
+ end();
+ }
+ end();
+ O << "</para>";
+ end();
+ }
+ ContainedList usedBy;
+ usedBy = p->unit()->findUsedBy(ex);
+ if(!usedBy.empty())
+ {
+ start("section", "Used By", false);
+ O << nl << "<para>";
+ start("simplelist type=\"inline\"");
+ for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
+ {
+ start("member");
+ O << toString(*q, container);
+ end();
+ }
+ end();
+ O << "</para>";
+ end();
+ }
}
ContainedList usedBy;
ConstructedPtr constructed;
if(def)
{
- constructed = def->declaration();
+ constructed = def->declaration();
}
else
{
- constructed = ConstructedPtr::dynamicCast(p);
+ constructed = ConstructedPtr::dynamicCast(p);
}
if(constructed)
{
- usedBy = p->unit()->findUsedBy(constructed);
+ usedBy = p->unit()->findUsedBy(constructed);
}
if(!usedBy.empty())
{
- //
- // We first accumulate the strings in a list instead of printing
- // each stringified entry in the usedBy list. This is necessary because
- // the usedBy list can contain operations and parameters. But toString()
- // on a parameter returns the string for the parameter's operation, so
- // we can end up printing the same operation name more than once.
- //
- list<string> strings;
- for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
- {
- strings.push_back(toString(*q, container));
- }
- strings.sort();
- strings.unique();
-
- start("section", "Used By", false);
- O << nl << "<para>";
- start("simplelist type=\"inline\"");
- for(list<string>::const_iterator p = strings.begin(); p != strings.end(); ++p)
- {
- start("member");
- O << *p;
- end();
- }
- end();
- O << "</para>";
- end();
+ //
+ // We first accumulate the strings in a list instead of printing
+ // each stringified entry in the usedBy list. This is necessary because
+ // the usedBy list can contain operations and parameters. But toString()
+ // on a parameter returns the string for the parameter's operation, so
+ // we can end up printing the same operation name more than once.
+ //
+ list<string> strings;
+ for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
+ {
+ strings.push_back(toString(*q, container));
+ }
+ strings.sort();
+ strings.unique();
+
+ start("section", "Used By", false);
+ O << nl << "<para>";
+ start("simplelist type=\"inline\"");
+ for(list<string>::const_iterator p = strings.begin(); p != strings.end(); ++p)
+ {
+ start("member");
+ O << *p;
+ end();
+ }
+ end();
+ O << "</para>";
+ end();
}
if(!see.empty())
{
- start("section", "See Also", false);
- O << nl << "<para>";
- start("simplelist type=\"inline\"");
- for(StringList::const_iterator q = see.begin(); q != see.end(); ++q)
- {
- start("member");
- O << toString(*q, container);
- end();
- }
- end();
- O << "</para>";
- end();
+ start("section", "See Also", false);
+ O << nl << "<para>";
+ start("simplelist type=\"inline\"");
+ for(StringList::const_iterator q = see.begin(); q != see.end(); ++q)
+ {
+ start("member");
+ O << toString(*q, container);
+ end();
+ }
+ end();
+ O << "</para>";
+ end();
}
}
@@ -1222,7 +1222,7 @@ Slice::Gen::printSummary(const ContainedPtr& p, bool deprecated)
ContainerPtr container = ContainerPtr::dynamicCast(p);
if(!container)
{
- container = p->container();
+ container = p->container();
}
string summary = getComment(p, container, true);
@@ -1231,7 +1231,7 @@ Slice::Gen::printSummary(const ContainedPtr& p, bool deprecated)
O << nl << summary;
if(deprecated)
{
- O << nl << "<emphasis>Deprecated.</emphasis>";
+ O << nl << "<emphasis>Deprecated.</emphasis>";
}
O.restoreIndent();
end();
@@ -1251,12 +1251,12 @@ Slice::Gen::start(const std::string& element, const std::string& title, bool asL
O << se(titleElement);
if(asLiteral)
{
- O << "<literal>";
+ O << "<literal>";
}
O << title;
if(asLiteral)
{
- O << "</literal>";
+ O << "</literal>";
}
end();
}
@@ -1275,7 +1275,7 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
string scoped = contained->scoped();
if(scoped[0] == ':')
{
- scoped.erase(0, 2);
+ scoped.erase(0, 2);
}
string id;
@@ -1283,15 +1283,15 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
for(unsigned int i = 0; i < scoped.size(); ++i)
{
- if(scoped[i] == ':')
- {
- id += '.';
- ++i;
- }
- else
- {
- id += scoped[i];
- }
+ if(scoped[i] == ':')
+ {
+ id += '.';
+ ++i;
+ }
+ else
+ {
+ id += scoped[i];
+ }
}
//
@@ -1300,8 +1300,8 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
//
if(id.size() > 44)
{
- id.erase(0, id.size() - 44);
- assert(id.size() == 44);
+ id.erase(0, id.size() - 44);
+ assert(id.size() == 44);
}
//
@@ -1309,7 +1309,7 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
//
if(id[0] == '.')
{
- id.erase(0, 1);
+ id.erase(0, 1);
}
return '"' + id + '"';
@@ -1324,21 +1324,21 @@ Slice::Gen::getScopedMinimized(const ContainedPtr& contained, const ContainerPtr
if(!q) // Container is the global module
{
- return s.substr(2);
+ return s.substr(2);
}
do
{
- string s2 = q->scoped();
- s2 += "::";
+ string s2 = q->scoped();
+ s2 += "::";
- if(s.find(s2) == 0)
- {
- return s.substr(s2.size());
- }
+ if(s.find(s2) == 0)
+ {
+ return s.substr(s2.size());
+ }
- p = q->container();
- q = ContainedPtr::dynamicCast(p);
+ p = q->container();
+ q = ContainedPtr::dynamicCast(p);
}
while(q);
@@ -1354,130 +1354,130 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
static const char* builtinTable[] =
{
- "byte",
- "bool",
- "short",
- "int",
- "long",
- "float",
- "double",
- "string",
- "Object",
- "Object*",
- "LocalObject"
+ "byte",
+ "bool",
+ "short",
+ "int",
+ "long",
+ "float",
+ "double",
+ "string",
+ "Object",
+ "Object*",
+ "LocalObject"
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
if(builtin)
{
- s = builtinTable[builtin->kind()];
- tag = "type";
+ s = builtinTable[builtin->kind()];
+ tag = "type";
}
ProxyPtr proxy = ProxyPtr::dynamicCast(p);
if(proxy)
{
- if(withLink && proxy->_class()->includeLevel() == 0)
- {
- linkend = containedToId(proxy->_class());
- }
- s = getScopedMinimized(proxy->_class(), container);
- s += "*";
- tag = "classname";
+ if(withLink && proxy->_class()->includeLevel() == 0)
+ {
+ linkend = containedToId(proxy->_class());
+ }
+ s = getScopedMinimized(proxy->_class(), container);
+ s += "*";
+ tag = "classname";
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(p);
if(cl)
{
- //
+ //
// We must generate the id from the definition, not from the
// declaration, provided that a definition is available.
- //
- ContainedPtr definition = cl->definition();
- if(withLink && definition && definition->includeLevel() == 0)
- {
- linkend = containedToId(definition);
- }
- s = getScopedMinimized(cl, container);
- tag = "classname";
+ //
+ ContainedPtr definition = cl->definition();
+ if(withLink && definition && definition->includeLevel() == 0)
+ {
+ linkend = containedToId(definition);
+ }
+ s = getScopedMinimized(cl, container);
+ tag = "classname";
}
ExceptionPtr ex = ExceptionPtr::dynamicCast(p);
if(ex)
{
- if(withLink && ex->includeLevel() == 0)
- {
- linkend = containedToId(ex);
- }
- s = getScopedMinimized(ex, container);
- tag = "classname";
+ if(withLink && ex->includeLevel() == 0)
+ {
+ linkend = containedToId(ex);
+ }
+ s = getScopedMinimized(ex, container);
+ tag = "classname";
}
StructPtr st = StructPtr::dynamicCast(p);
if(st)
{
- if(withLink && st->includeLevel() == 0)
- {
- linkend = containedToId(st);
- }
- s = getScopedMinimized(st, container);
- tag = "structname";
+ if(withLink && st->includeLevel() == 0)
+ {
+ linkend = containedToId(st);
+ }
+ s = getScopedMinimized(st, container);
+ tag = "structname";
}
EnumeratorPtr en = EnumeratorPtr::dynamicCast(p);
if(en)
{
- if(withLink && en->includeLevel() == 0)
- {
- linkend = containedToId(en);
- }
- s = getScopedMinimized(en, container);
- tag = "constant";
+ if(withLink && en->includeLevel() == 0)
+ {
+ linkend = containedToId(en);
+ }
+ s = getScopedMinimized(en, container);
+ tag = "constant";
}
OperationPtr op = OperationPtr::dynamicCast(p);
if(op)
{
- if(withLink && op->includeLevel() == 0)
- {
- linkend = containedToId(op);
- }
- s = getScopedMinimized(op, container);
- tag = "function";
+ if(withLink && op->includeLevel() == 0)
+ {
+ linkend = containedToId(op);
+ }
+ s = getScopedMinimized(op, container);
+ tag = "function";
}
ParamDeclPtr pd = ParamDeclPtr::dynamicCast(p);
if(pd)
{
- op = OperationPtr::dynamicCast(pd->container());
- assert(op);
- if(withLink && pd->includeLevel() == 0)
- {
- linkend = containedToId(op);
- }
- s = getScopedMinimized(op, container);
- tag = "function";
+ op = OperationPtr::dynamicCast(pd->container());
+ assert(op);
+ if(withLink && pd->includeLevel() == 0)
+ {
+ linkend = containedToId(op);
+ }
+ s = getScopedMinimized(op, container);
+ tag = "function";
}
if(s.empty())
{
- ContainedPtr contained = ContainedPtr::dynamicCast(p);
- assert(contained);
- if(withLink && contained->includeLevel() == 0)
- {
- linkend = containedToId(contained);
- }
- s = getScopedMinimized(contained, container);
- tag = "type";
+ ContainedPtr contained = ContainedPtr::dynamicCast(p);
+ assert(contained);
+ if(withLink && contained->includeLevel() == 0)
+ {
+ linkend = containedToId(contained);
+ }
+ s = getScopedMinimized(contained, container);
+ tag = "type";
}
if(linkend.empty())
{
- return "<" + tag + ">" + s + "</" + tag + ">";
+ return "<" + tag + ">" + s + "</" + tag + ">";
}
else
{
- return "<link linkend=" + linkend + "><" + tag + ">" + s + "</" + tag + "></link>";
+ return "<link linkend=" + linkend + "><" + tag + ">" + s + "</" + tag + "></link>";
}
}
@@ -1489,13 +1489,13 @@ Slice::Gen::toString(const string& str, const ContainerPtr& container, bool with
TypeList types = container->lookupType(s, false);
if(!types.empty())
{
- return toString(types.front(), container, withLink);
+ return toString(types.front(), container, withLink);
}
ContainedList contList = container->lookupContained(s, false);
if(!contList.empty())
{
- return toString(contList.front(), container, withLink);
+ return toString(contList.front(), container, withLink);
}
//
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp
index 4850ec97814..4f0f063526b 100644
--- a/cpp/src/slice2docbook/Main.cpp
+++ b/cpp/src/slice2docbook/Main.cpp
@@ -27,12 +27,12 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"-s, --stand-alone Create stand-alone docbook file.\n"
"--chapter Use \"chapter\" instead of \"section\" as\n"
" top-level element.\n"
- "--noindex Suppress generation of index pages.\n"
- "--sort-fields Sort fields of structures, classes, and exceptions.\n"
+ "--noindex Suppress generation of index pages.\n"
+ "--sort-fields Sort fields of structures, classes, and exceptions.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
@@ -64,21 +64,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -86,19 +86,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("I");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -119,9 +119,9 @@ main(int argc, char* argv[])
if(args.empty())
{
- cerr << argv[0] << ": no docbook file specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no docbook file specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
string docbook(args[0]);
@@ -129,20 +129,20 @@ main(int argc, char* argv[])
string::size_type pos = docbook.rfind('.');
if(pos != string::npos)
{
- suffix = docbook.substr(pos);
- transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
+ suffix = docbook.substr(pos);
+ transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
}
if(suffix != ".sgml")
{
- cerr << argv[0] << ": docbook file must end with `.sgml'" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": docbook file must end with `.sgml'" << endl;
+ return EXIT_FAILURE;
}
if(args.size() < 2)
{
- cerr << argv[0] << ": no input file" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no input file" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
UnitPtr p = Unit::createUnit(true, false, ice, caseSensitive);
@@ -151,47 +151,47 @@ main(int argc, char* argv[])
for(vector<string>::size_type idx = 1; idx < args.size(); ++idx)
{
- Preprocessor icecpp(argv[0], args[idx], cppArgs);
- FILE* cppHandle = icecpp.preprocess(true);
-
- if(cppHandle == 0)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- }
- }
- else
- {
- status = p->parse(cppHandle, debug);
- }
-
- if(!icecpp.close())
- {
- p->destroy();
- return EXIT_FAILURE;
- }
+ Preprocessor icecpp(argv[0], args[idx], cppArgs);
+ FILE* cppHandle = icecpp.preprocess(true);
+
+ if(cppHandle == 0)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+ status = p->parse(cppHandle, debug);
+ }
+
+ if(!icecpp.close())
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
}
if(status == EXIT_SUCCESS && !preprocess)
{
- Gen gen(argv[0], docbook, standAlone, chapter, noIndex, sortFields);
- if(!gen)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- gen.generate(p);
+ Gen gen(argv[0], docbook, standAlone, chapter, noIndex, sortFields);
+ if(!gen)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ gen.generate(p);
}
p->destroy();
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index 9b138b20959..97a495da2c2 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -28,12 +28,12 @@ struct DictIndex
bool operator==(const DictIndex& rhs) const
{
- return member == rhs.member;
+ return member == rhs.member;
}
bool operator!=(const DictIndex& rhs) const
{
- return member != rhs.member;
+ return member != rhs.member;
}
};
@@ -74,44 +74,44 @@ usage(const char* n)
"-v, --version Display the Ice version.\n"
"--header-ext EXT Use EXT instead of the default `h' extension.\n"
"--source-ext EXT Use EXT instead of the default `cpp' extension.\n"
- "--add-header HDR[,GUARD]\n"
- " Add #include for HDR (with guard GUARD) to generated source file.\n"
+ "--add-header HDR[,GUARD]\n"
+ " Add #include for HDR (with guard GUARD) to generated source file.\n"
"-DNAME Define NAME as 1.\n"
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--include-dir DIR Use DIR as the header include directory in source files.\n"
"--dll-export SYMBOL Use SYMBOL for DLL exports.\n"
"--dict NAME,KEY,VALUE[,sort[,COMPARE]]\n"
- " Create a Freeze dictionary with the name NAME,\n"
+ " Create a Freeze dictionary with the name NAME,\n"
" using KEY as key, and VALUE as value. This\n"
" option may be specified multiple times for\n"
" different names. NAME may be a scoped name.\n"
- " By default, keys are sorted using their binary\n"
- " Ice-encoding representation. Use 'sort' to sort\n"
- " with the COMPARE functor class. COMPARE's default\n"
- " value is std::less<KEY>\n"
- "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n"
+ " By default, keys are sorted using their binary\n"
+ " Ice-encoding representation. Use 'sort' to sort\n"
+ " with the COMPARE functor class. COMPARE's default\n"
+ " value is std::less<KEY>\n"
+ "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n"
" Create a Freeze evictor index with the name\n"
" NAME for member MEMBER of class TYPE. This\n"
" option may be specified multiple times for\n"
" different names. NAME may be a scoped name.\n"
" When member is a string, the case can be\n"
" sensitive or insensitive (default is sensitive).\n"
- "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}]\n"
- " [,sort[,COMPARE]]\n"
- " Add an index to dictionary DICT. If MEMBER is \n"
+ "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}]\n"
+ " [,sort[,COMPARE]]\n"
+ " Add an index to dictionary DICT. If MEMBER is \n"
" specified, then DICT's VALUE must be a class or\n"
- " a struct, and MEMBER must designate a member of\n"
- " VALUE. Otherwise, the entire VALUE is used for \n"
- " indexing. When the secondary key is a string, \n"
- " the case can be sensitive or insensitive (default\n"
- " is sensitive).\n"
- " By default, keys are sorted using their binary\n"
- " Ice-encoding representation. Use 'sort' to sort\n"
- " with the COMPARE functor class. COMPARE's default\n"
- " value is std::less<secondary key type>.\n"
+ " a struct, and MEMBER must designate a member of\n"
+ " VALUE. Otherwise, the entire VALUE is used for \n"
+ " indexing. When the secondary key is a string, \n"
+ " the case can be sensitive or insensitive (default\n"
+ " is sensitive).\n"
+ " By default, keys are sorted using their binary\n"
+ " Ice-encoding representation. Use 'sort' to sort\n"
+ " with the COMPARE functor class. COMPARE's default\n"
+ " value is std::less<secondary key type>.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
@@ -124,17 +124,17 @@ checkIdentifier(string n, string t, string s)
{
if(s.empty() || (!isalpha(s[0]) && s[0] != '_'))
{
- cerr << n << ": `" << t << "' is not a valid type name" << endl;
- return false;
+ cerr << n << ": `" << t << "' is not a valid type name" << endl;
+ return false;
}
for(unsigned int i = 1; i < s.size(); ++i)
{
- if(!isalnum(s[i]) && s[i] != '_')
- {
- cerr << n << ": `" << t << "' is not a valid type name" << endl;
- return false;
- }
+ if(!isalnum(s[i]) && s[i] != '_')
+ {
+ cerr << n << ": `" << t << "' is not a valid type name" << endl;
+ return false;
+ }
}
return true;
@@ -147,18 +147,18 @@ printFreezeTypes(Output& out, const vector<Dict>& dicts, const vector<Index>& in
out << "\n// Freeze types in this file:";
for(vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
{
- out << "\n// name=\"" << p->name << "\", key=\""
- << p->key << "\", value=\"" << p->value << "\"";
+ out << "\n// name=\"" << p->name << "\", key=\""
+ << p->key << "\", value=\"" << p->value << "\"";
}
for(vector<Index>::const_iterator q = indices.begin(); q != indices.end(); ++q)
{
- out << "\n// name=\"" << q->name << "\", type=\"" << q->type
- << "\", member=\"" << q->member << "\"";
- if(q->caseSensitive == false)
- {
- out << " (case insensitive)";
- }
+ out << "\n// name=\"" << q->name << "\", type=\"" << q->type
+ << "\", member=\"" << q->member << "\"";
+ if(q->caseSensitive == false)
+ {
+ out << " (case insensitive)";
+ }
}
out << '\n';
}
@@ -169,24 +169,24 @@ getCompare(const T& t, const string& keyType)
{
if(t.sort)
{
- if(t.userCompare == "")
- {
- return "std::less< " + keyType + ">";
- }
- else
- {
- return t.userCompare;
- }
+ if(t.userCompare == "")
+ {
+ return "std::less< " + keyType + ">";
+ }
+ else
+ {
+ return t.userCompare;
+ }
}
else
{
- return ICE_ENCODING_COMPARE;
+ return ICE_ENCODING_COMPARE;
}
}
void
writeCodecH(const TypePtr& type, const StringList& metaData, const string& name, const string& freezeType, Output& H,
- const string& dllExport)
+ const string& dllExport)
{
H << sp << nl << "class " << dllExport << name;
H << sb;
@@ -259,14 +259,14 @@ writeCodecC(const TypePtr& type, const StringList& metaData, const string& name,
string staticName = "__";
for(string::const_iterator p = name.begin(); p != name.end(); ++p)
{
- if((*p) == ':')
- {
- staticName += '_';
- }
- else
- {
- staticName += *p;
- }
+ if((*p) == ':')
+ {
+ staticName += '_';
+ }
+ else
+ {
+ staticName += *p;
+ }
}
staticName += "_typeId";
@@ -288,35 +288,35 @@ writeCodecC(const TypePtr& type, const StringList& metaData, const string& name,
void
writeDictWithIndicesH(const string& name, const Dict& dict,
- const vector<IndexType> indexTypes,
- const TypePtr& keyType, const StringList& keyMetaData, const TypePtr& valueType,
- const StringList& valueMetaData, Output& H, const string& dllExport)
+ const vector<IndexType> indexTypes,
+ const TypePtr& keyType, const StringList& keyMetaData, const TypePtr& valueType,
+ const StringList& valueMetaData, Output& H, const string& dllExport)
{
string compare = getCompare(dict, typeToString(keyType, false, keyMetaData));
string templateParams = string("< ") + typeToString(keyType, false, keyMetaData) + ", "
- + typeToString(valueType, false, valueMetaData) + ", " + name + "KeyCodec, "
- + name + "ValueCodec, " + compare + " >";
+ + typeToString(valueType, false, valueMetaData) + ", " + name + "KeyCodec, "
+ + name + "ValueCodec, " + compare + " >";
string keyCompareParams =
- string("< ") + typeToString(keyType, false, keyMetaData) + ", "
- + name + "KeyCodec, " + compare + " >";
+ string("< ") + typeToString(keyType, false, keyMetaData) + ", "
+ + name + "KeyCodec, " + compare + " >";
vector<string> capitalizedMembers;
size_t i;
for(i = 0; i < dict.indices.size(); ++i)
{
- const string& member = dict.indices[i].member;
- if(!member.empty())
- {
- string capitalizedMember = member;
- capitalizedMember[0] = toupper(capitalizedMember[0]);
- capitalizedMembers.push_back(capitalizedMember);
- }
- else
- {
- capitalizedMembers.push_back("Value");
- }
+ const string& member = dict.indices[i].member;
+ if(!member.empty())
+ {
+ string capitalizedMember = member;
+ capitalizedMember[0] = toupper(capitalizedMember[0]);
+ capitalizedMembers.push_back(capitalizedMember);
+ }
+ else
+ {
+ capitalizedMembers.push_back("Value");
+ }
}
H << sp << nl << "class " << dllExport << name
@@ -346,46 +346,46 @@ writeDictWithIndicesH(const string& name, const Dict& dict,
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string className = capitalizedMembers[i] + "Index";
-
- string indexCompare =
- getCompare(dict.indices[i], typeToString(indexTypes[i].type, false, indexTypes[i].metaData));
-
- string indexCompareParams =
- string("< ") + typeToString(indexTypes[i].type, false, indexTypes[i].metaData) + ", "
- + className + ", " + indexCompare + " >";
-
- H << sp << nl << "class " << dllExport << className
- << " : public Freeze::MapIndex" << indexCompareParams;
- H << sb;
-
- H.dec();
- H << sp << nl << "public:";
- H << sp;
- H.inc();
- H << nl << capitalizedMembers[i] << "Index(const std::string&, const "
- << indexCompare << "& = " << indexCompare << "());";
-
- H << sp;
-
- //
- // Codec
- //
- H << nl << "static void write(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << ", Freeze::Key&, const Ice::CommunicatorPtr&);";
-
- H << nl << "static void read("
- << typeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << "&, const Freeze::Key&, const ::Ice::CommunicatorPtr&);";
-
- H.dec();
- H << sp << nl << "protected:";
- H << sp;
- H.inc();
-
- H << nl << "virtual void marshalKey(const Freeze::Value&, Freeze::Key&) const;";
-
- H << eb << ';';
+ string className = capitalizedMembers[i] + "Index";
+
+ string indexCompare =
+ getCompare(dict.indices[i], typeToString(indexTypes[i].type, false, indexTypes[i].metaData));
+
+ string indexCompareParams =
+ string("< ") + typeToString(indexTypes[i].type, false, indexTypes[i].metaData) + ", "
+ + className + ", " + indexCompare + " >";
+
+ H << sp << nl << "class " << dllExport << className
+ << " : public Freeze::MapIndex" << indexCompareParams;
+ H << sb;
+
+ H.dec();
+ H << sp << nl << "public:";
+ H << sp;
+ H.inc();
+ H << nl << capitalizedMembers[i] << "Index(const std::string&, const "
+ << indexCompare << "& = " << indexCompare << "());";
+
+ H << sp;
+
+ //
+ // Codec
+ //
+ H << nl << "static void write(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << ", Freeze::Key&, const Ice::CommunicatorPtr&);";
+
+ H << nl << "static void read("
+ << typeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << "&, const Freeze::Key&, const ::Ice::CommunicatorPtr&);";
+
+ H.dec();
+ H << sp << nl << "protected:";
+ H << sp;
+ H.inc();
+
+ H << nl << "virtual void marshalKey(const Freeze::Value&, Freeze::Key&) const;";
+
+ H << eb << ';';
}
//
@@ -409,14 +409,14 @@ writeDictWithIndicesH(const string& name, const Dict& dict,
H << nl << "std::vector<Freeze::MapIndexBasePtr> __indices;";
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string indexName = dict.indices[i].member;
- if(indexName.empty())
- {
- indexName = "index";
- }
- indexName = string("\"") + indexName + "\"";
-
- H << nl << "__indices.push_back(new " << capitalizedMembers[i] << "Index(" << indexName << "));";
+ string indexName = dict.indices[i].member;
+ if(indexName.empty())
+ {
+ indexName = "index";
+ }
+ indexName = string("\"") + indexName + "\"";
+
+ H << nl << "__indices.push_back(new " << capitalizedMembers[i] << "Index(" << indexName << "));";
}
H << nl << "this->_helper.reset(Freeze::MapHelper::create(__connection, __dbName, "
<< name + "KeyCodec::typeId(), "
@@ -433,35 +433,35 @@ writeDictWithIndicesH(const string& name, const Dict& dict,
//
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- H << sp;
- H << nl << "iterator findBy" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ", bool = true);";
- H << nl << "const_iterator findBy" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ", bool = true) const;";
-
- H << nl << "iterator lowerBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ");";
- H << nl << "const_iterator lowerBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;";
-
- H << nl << "iterator upperBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ");";
- H << nl << "const_iterator upperBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;";
-
- H << nl << "std::pair<iterator, iterator> equalRangeFor"
- << capitalizedMembers[i] << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << ");";
-
- H << nl << "std::pair<const_iterator, const_iterator> equalRangeFor"
- << capitalizedMembers[i] << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << ") const;";
-
- string countFunction = dict.indices[i].member.empty() ? string("valueCount")
- : dict.indices[i].member + "Count";
-
- H << nl << "int " << countFunction
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;";
+ H << sp;
+ H << nl << "iterator findBy" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ", bool = true);";
+ H << nl << "const_iterator findBy" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ", bool = true) const;";
+
+ H << nl << "iterator lowerBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ");";
+ H << nl << "const_iterator lowerBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;";
+
+ H << nl << "iterator upperBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ");";
+ H << nl << "const_iterator upperBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;";
+
+ H << nl << "std::pair<iterator, iterator> equalRangeFor"
+ << capitalizedMembers[i] << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << ");";
+
+ H << nl << "std::pair<const_iterator, const_iterator> equalRangeFor"
+ << capitalizedMembers[i] << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << ") const;";
+
+ string countFunction = dict.indices[i].member.empty() ? string("valueCount")
+ : dict.indices[i].member + "Count";
+
+ H << nl << "int " << countFunction
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << ") const;";
}
H << eb << ';';
@@ -469,35 +469,35 @@ writeDictWithIndicesH(const string& name, const Dict& dict,
void
writeDictWithIndicesC(const string& name, const string& absolute, const Dict& dict,
- const vector<IndexType> indexTypes,
- const TypePtr& keyType, const StringList& keyMetaData, const TypePtr& valueType,
- const StringList& valueMetaData, Output& C)
+ const vector<IndexType> indexTypes,
+ const TypePtr& keyType, const StringList& keyMetaData, const TypePtr& valueType,
+ const StringList& valueMetaData, Output& C)
{
string compare = getCompare(dict, typeToString(keyType, false, keyMetaData));
string templateParams = string("< ") + typeToString(keyType, false, keyMetaData) + ", "
- + typeToString(valueType, false, valueMetaData) + ", " + name + "KeyCodec, "
- + name + "ValueCodec, " + compare + " >";
+ + typeToString(valueType, false, valueMetaData) + ", " + name + "KeyCodec, "
+ + name + "ValueCodec, " + compare + " >";
string keyCompareParams =
- string("< ") + typeToString(keyType, false, keyMetaData) + ", "
- + name + "KeyCodec, " + compare + " >";
+ string("< ") + typeToString(keyType, false, keyMetaData) + ", "
+ + name + "KeyCodec, " + compare + " >";
vector<string> capitalizedMembers;
size_t i;
for(i = 0; i < dict.indices.size(); ++i)
{
- const string& member = dict.indices[i].member;
- if(!member.empty())
- {
- string capitalizedMember = member;
- capitalizedMember[0] = toupper(capitalizedMember[0]);
- capitalizedMembers.push_back(capitalizedMember);
- }
- else
- {
- capitalizedMembers.push_back("Value");
- }
+ const string& member = dict.indices[i].member;
+ if(!member.empty())
+ {
+ string capitalizedMember = member;
+ capitalizedMember[0] = toupper(capitalizedMember[0]);
+ capitalizedMembers.push_back(capitalizedMember);
+ }
+ else
+ {
+ capitalizedMembers.push_back("Value");
+ }
}
@@ -506,119 +506,119 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di
//
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string className = capitalizedMembers[i] + "Index";
-
- string indexCompare =
- getCompare(dict.indices[i], typeToString(indexTypes[i].type, false, indexTypes[i].metaData));
-
- string indexCompareParams =
- string("< ") + typeToString(indexTypes[i].type, false, indexTypes[i].metaData) + ", "
- + className + ", " + indexCompare + " >";
-
- C << sp << nl << absolute << "::" << className << "::" << className
- << "(const std::string& __name, "
- << "const " << indexCompare << "& __compare)";
-
- C.inc();
- C << nl << ": Freeze::MapIndex"
- << indexCompareParams << "(__name, __compare)";
- C.dec();
- C << sb;
- C << eb;
-
- C << sp << nl << "void"
- << nl << absolute << "::" << className << "::"
- << "marshalKey(const Freeze::Value& __v, Freeze::Key& __k) const";
- C << sb;
-
- bool optimize = false;
-
- if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive)
- {
- optimize = true;
- C << nl << "__k = __v;";
- }
- else
- {
- //
- // Can't optimize
- //
- C << nl << typeToString(valueType, false, valueMetaData) << " __x;";
- C << nl << absolute << "ValueCodec::read(__x, __v, _communicator);";
- string param = "__x";
-
- if(!dict.indices[i].member.empty())
- {
- if(ClassDeclPtr::dynamicCast(valueType) != 0)
- {
- param += "->" + dict.indices[i].member;
- }
- else
- {
- param += "." + dict.indices[i].member;
- }
- }
- C << nl << "write(" << param << ", __k, _communicator);";
- }
- C << eb;
-
- C << sp << nl << "void"
- << nl << absolute << "::" << className << "::"
- << "write(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << " __index, Freeze::Key& __bytes, const Ice::CommunicatorPtr& __communicator)";
- C << sb;
-
- if(optimize)
- {
- C << nl << absolute << "ValueCodec::write(__index, __bytes, __communicator);";
- }
- else
- {
- assert(!indexTypes[i].type->usesClasses());
-
- C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(__communicator);";
- C << nl << "IceInternal::BasicStream __stream(__instance.get());";
-
- string valueS;
- if(dict.indices[i].caseSensitive)
- {
- valueS = "__index";
- }
- else
- {
- C << nl << typeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << " __lowerCaseIndex = __index;";
- C << nl << "std::transform(__lowerCaseIndex.begin(), __lowerCaseIndex.end(), __lowerCaseIndex.begin(), tolower);";
- valueS = "__lowerCaseIndex";
- }
-
- writeMarshalUnmarshalCode(C, indexTypes[i].type, valueS, true, "__stream", false, indexTypes[i].metaData);
- C << nl << "::std::vector<Ice::Byte>(__stream.b.begin(), __stream.b.end()).swap(__bytes);";
- }
- C << eb;
-
- C << sp << nl << "void"
- << nl << absolute << "::" << className << "::"
- << "read(" << typeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << "& __index, const Freeze::Key& __bytes, const Ice::CommunicatorPtr& __communicator)";
- C << sb;
-
- if(optimize)
- {
- C << nl << absolute << "ValueCodec::read(__index, __bytes, __communicator);";
- }
- else
- {
- C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(__communicator);";
- C << nl << "IceInternal::BasicStream __stream(__instance.get());";
-
- C << nl << "__stream.b.resize(__bytes.size());";
- C << nl << "::memcpy(&__stream.b[0], &__bytes[0], __bytes.size());";
- C << nl << "__stream.i = __stream.b.begin();";
- writeMarshalUnmarshalCode(C, indexTypes[i].type, "__index", false, "__stream", false,
- indexTypes[i].metaData);
- }
- C << eb;
+ string className = capitalizedMembers[i] + "Index";
+
+ string indexCompare =
+ getCompare(dict.indices[i], typeToString(indexTypes[i].type, false, indexTypes[i].metaData));
+
+ string indexCompareParams =
+ string("< ") + typeToString(indexTypes[i].type, false, indexTypes[i].metaData) + ", "
+ + className + ", " + indexCompare + " >";
+
+ C << sp << nl << absolute << "::" << className << "::" << className
+ << "(const std::string& __name, "
+ << "const " << indexCompare << "& __compare)";
+
+ C.inc();
+ C << nl << ": Freeze::MapIndex"
+ << indexCompareParams << "(__name, __compare)";
+ C.dec();
+ C << sb;
+ C << eb;
+
+ C << sp << nl << "void"
+ << nl << absolute << "::" << className << "::"
+ << "marshalKey(const Freeze::Value& __v, Freeze::Key& __k) const";
+ C << sb;
+
+ bool optimize = false;
+
+ if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive)
+ {
+ optimize = true;
+ C << nl << "__k = __v;";
+ }
+ else
+ {
+ //
+ // Can't optimize
+ //
+ C << nl << typeToString(valueType, false, valueMetaData) << " __x;";
+ C << nl << absolute << "ValueCodec::read(__x, __v, _communicator);";
+ string param = "__x";
+
+ if(!dict.indices[i].member.empty())
+ {
+ if(ClassDeclPtr::dynamicCast(valueType) != 0)
+ {
+ param += "->" + dict.indices[i].member;
+ }
+ else
+ {
+ param += "." + dict.indices[i].member;
+ }
+ }
+ C << nl << "write(" << param << ", __k, _communicator);";
+ }
+ C << eb;
+
+ C << sp << nl << "void"
+ << nl << absolute << "::" << className << "::"
+ << "write(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << " __index, Freeze::Key& __bytes, const Ice::CommunicatorPtr& __communicator)";
+ C << sb;
+
+ if(optimize)
+ {
+ C << nl << absolute << "ValueCodec::write(__index, __bytes, __communicator);";
+ }
+ else
+ {
+ assert(!indexTypes[i].type->usesClasses());
+
+ C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(__communicator);";
+ C << nl << "IceInternal::BasicStream __stream(__instance.get());";
+
+ string valueS;
+ if(dict.indices[i].caseSensitive)
+ {
+ valueS = "__index";
+ }
+ else
+ {
+ C << nl << typeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << " __lowerCaseIndex = __index;";
+ C << nl << "std::transform(__lowerCaseIndex.begin(), __lowerCaseIndex.end(), __lowerCaseIndex.begin(), tolower);";
+ valueS = "__lowerCaseIndex";
+ }
+
+ writeMarshalUnmarshalCode(C, indexTypes[i].type, valueS, true, "__stream", false, indexTypes[i].metaData);
+ C << nl << "::std::vector<Ice::Byte>(__stream.b.begin(), __stream.b.end()).swap(__bytes);";
+ }
+ C << eb;
+
+ C << sp << nl << "void"
+ << nl << absolute << "::" << className << "::"
+ << "read(" << typeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << "& __index, const Freeze::Key& __bytes, const Ice::CommunicatorPtr& __communicator)";
+ C << sb;
+
+ if(optimize)
+ {
+ C << nl << absolute << "ValueCodec::read(__index, __bytes, __communicator);";
+ }
+ else
+ {
+ C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(__communicator);";
+ C << nl << "IceInternal::BasicStream __stream(__instance.get());";
+
+ C << nl << "__stream.b.resize(__bytes.size());";
+ C << nl << "::memcpy(&__stream.b[0], &__bytes[0], __bytes.size());";
+ C << nl << "__stream.i = __stream.b.begin();";
+ writeMarshalUnmarshalCode(C, indexTypes[i].type, "__index", false, "__stream", false,
+ indexTypes[i].metaData);
+ }
+ C << eb;
}
//
@@ -637,14 +637,14 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di
C << nl << "std::vector<Freeze::MapIndexBasePtr> __indices;";
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string indexName = dict.indices[i].member;
- if(indexName.empty())
- {
- indexName = "index";
- }
- indexName = string("\"") + indexName + "\"";
-
- C << nl << "__indices.push_back(new " << capitalizedMembers[i] << "Index(" << indexName << "));";
+ string indexName = dict.indices[i].member;
+ if(indexName.empty())
+ {
+ indexName = "index";
+ }
+ indexName = string("\"") + indexName + "\"";
+
+ C << nl << "__indices.push_back(new " << capitalizedMembers[i] << "Index(" << indexName << "));";
}
C << nl << "_helper.reset(Freeze::MapHelper::create(__connection, __dbName, "
<< absolute + "KeyCodec::typeId(), "
@@ -655,108 +655,108 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di
// Find and count functions
//
for(i = 0; i < capitalizedMembers.size(); ++i)
- {
- string indexClassName = capitalizedMembers[i] + "Index";
-
- string indexName = dict.indices[i].member;
- if(indexName.empty())
- {
- indexName = "index";
- }
- indexName = string("\"") + indexName + "\"";
-
- C << sp << nl << absolute << "::iterator"
- << nl << absolute << "::" << "findBy" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << " __index, bool __onlyDups)";
- C << sb;
- C << nl << "Freeze::Key __bytes;";
- C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
- C << nl << "return iterator(_helper->index(" << indexName
- << ")->untypedFind(__bytes, false, __onlyDups), _communicator);";
- C << eb;
-
- C << sp << nl << absolute << "::const_iterator"
- << nl << absolute << "::" << "findBy" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
- << " __index, bool __onlyDups) const";
- C << sb;
- C << nl << "Freeze::Key __bytes;";
- C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
- C << nl << "return const_iterator(_helper->index(" << indexName
- << ")->untypedFind(__bytes, true, __onlyDups), _communicator);";
- C << eb;
-
- C << sp << nl << absolute << "::iterator"
- << nl << absolute << "::" << "lowerBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)";
- C << sb;
- C << nl << "Freeze::Key __bytes;";
- C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
- C << nl << "return iterator(_helper->index(" << indexName
- << ")->untypedLowerBound(__bytes, false), _communicator);";
- C << eb;
-
- C << sp << nl << absolute << "::const_iterator"
- << nl << absolute << "::" << "lowerBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
- C << sb;
- C << nl << "Freeze::Key __bytes;";
- C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
- C << nl << "return const_iterator(_helper->index(" << indexName
- << ")->untypedLowerBound(__bytes, true), _communicator);";
- C << eb;
-
- C << sp << nl << absolute << "::iterator"
- << nl << absolute << "::" << "upperBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)";
- C << sb;
- C << nl << "Freeze::Key __bytes;";
- C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
- C << nl << "return iterator(_helper->index(" << indexName
- << ")->untypedUpperBound(__bytes, false), _communicator);";
- C << eb;
-
- C << sp << nl << absolute << "::const_iterator"
- << nl << absolute << "::" << "upperBoundFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
- C << sb;
- C << nl << "Freeze::Key __bytes;";
- C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
- C << nl << "return const_iterator(_helper->index(" << indexName
- << ")->untypedUpperBound(__bytes, true), _communicator);";
- C << eb;
-
- C << sp << nl << "std::pair<" << absolute << "::iterator, "
- << absolute << "::iterator>"
- << nl << absolute << "::" << "equalRangeFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)";
- C << sb;
- C << nl << "return std::make_pair(lowerBoundFor" << capitalizedMembers[i]
- << "(__index), upperBoundFor" << capitalizedMembers[i] << "(__index));";
- C << eb;
-
- C << sp << nl << "std::pair<" << absolute << "::const_iterator, "
- << absolute << "::const_iterator>"
- << nl << absolute << "::" << "equalRangeFor" << capitalizedMembers[i]
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
- C << sb;
- C << nl << "return std::make_pair(lowerBoundFor" << capitalizedMembers[i]
- << "(__index), upperBoundFor" << capitalizedMembers[i] << "(__index));";
- C << eb;
-
- string countFunction = dict.indices[i].member.empty() ? string("valueCount")
- : dict.indices[i].member + "Count";
-
- C << sp << nl << "int"
- << nl << absolute << "::" << countFunction
- << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
- C << sb;
- C << nl << "Freeze::Key __bytes;";
- C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
- C << nl << "return _helper->index(" << indexName
- << ")->untypedCount(__bytes);";
- C << eb;
+ {
+ string indexClassName = capitalizedMembers[i] + "Index";
+
+ string indexName = dict.indices[i].member;
+ if(indexName.empty())
+ {
+ indexName = "index";
+ }
+ indexName = string("\"") + indexName + "\"";
+
+ C << sp << nl << absolute << "::iterator"
+ << nl << absolute << "::" << "findBy" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << " __index, bool __onlyDups)";
+ C << sb;
+ C << nl << "Freeze::Key __bytes;";
+ C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
+ C << nl << "return iterator(_helper->index(" << indexName
+ << ")->untypedFind(__bytes, false, __onlyDups), _communicator);";
+ C << eb;
+
+ C << sp << nl << absolute << "::const_iterator"
+ << nl << absolute << "::" << "findBy" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData)
+ << " __index, bool __onlyDups) const";
+ C << sb;
+ C << nl << "Freeze::Key __bytes;";
+ C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
+ C << nl << "return const_iterator(_helper->index(" << indexName
+ << ")->untypedFind(__bytes, true, __onlyDups), _communicator);";
+ C << eb;
+
+ C << sp << nl << absolute << "::iterator"
+ << nl << absolute << "::" << "lowerBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)";
+ C << sb;
+ C << nl << "Freeze::Key __bytes;";
+ C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
+ C << nl << "return iterator(_helper->index(" << indexName
+ << ")->untypedLowerBound(__bytes, false), _communicator);";
+ C << eb;
+
+ C << sp << nl << absolute << "::const_iterator"
+ << nl << absolute << "::" << "lowerBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
+ C << sb;
+ C << nl << "Freeze::Key __bytes;";
+ C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
+ C << nl << "return const_iterator(_helper->index(" << indexName
+ << ")->untypedLowerBound(__bytes, true), _communicator);";
+ C << eb;
+
+ C << sp << nl << absolute << "::iterator"
+ << nl << absolute << "::" << "upperBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)";
+ C << sb;
+ C << nl << "Freeze::Key __bytes;";
+ C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
+ C << nl << "return iterator(_helper->index(" << indexName
+ << ")->untypedUpperBound(__bytes, false), _communicator);";
+ C << eb;
+
+ C << sp << nl << absolute << "::const_iterator"
+ << nl << absolute << "::" << "upperBoundFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
+ C << sb;
+ C << nl << "Freeze::Key __bytes;";
+ C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
+ C << nl << "return const_iterator(_helper->index(" << indexName
+ << ")->untypedUpperBound(__bytes, true), _communicator);";
+ C << eb;
+
+ C << sp << nl << "std::pair<" << absolute << "::iterator, "
+ << absolute << "::iterator>"
+ << nl << absolute << "::" << "equalRangeFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index)";
+ C << sb;
+ C << nl << "return std::make_pair(lowerBoundFor" << capitalizedMembers[i]
+ << "(__index), upperBoundFor" << capitalizedMembers[i] << "(__index));";
+ C << eb;
+
+ C << sp << nl << "std::pair<" << absolute << "::const_iterator, "
+ << absolute << "::const_iterator>"
+ << nl << absolute << "::" << "equalRangeFor" << capitalizedMembers[i]
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
+ C << sb;
+ C << nl << "return std::make_pair(lowerBoundFor" << capitalizedMembers[i]
+ << "(__index), upperBoundFor" << capitalizedMembers[i] << "(__index));";
+ C << eb;
+
+ string countFunction = dict.indices[i].member.empty() ? string("valueCount")
+ : dict.indices[i].member + "Count";
+
+ C << sp << nl << "int"
+ << nl << absolute << "::" << countFunction
+ << "(" << inputTypeToString(indexTypes[i].type, false, indexTypes[i].metaData) << " __index) const";
+ C << sb;
+ C << nl << "Freeze::Key __bytes;";
+ C << nl << indexClassName << "::" << "write(__index, __bytes, _communicator);";
+ C << nl << "return _helper->index(" << indexName
+ << ")->untypedCount(__bytes);";
+ C << eb;
}
}
@@ -767,42 +767,42 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c
string absolute = dict.name;
if(absolute.find("::") == 0)
{
- absolute.erase(0, 2);
+ absolute.erase(0, 2);
}
string name = absolute;
vector<string> scope;
string::size_type pos;
while((pos = name.find("::")) != string::npos)
{
- string s = name.substr(0, pos);
- name.erase(0, pos + 2);
-
- if(!checkIdentifier(n, absolute, s))
- {
- return false;
- }
-
- scope.push_back(s);
+ string s = name.substr(0, pos);
+ name.erase(0, pos + 2);
+
+ if(!checkIdentifier(n, absolute, s))
+ {
+ return false;
+ }
+
+ scope.push_back(s);
}
if(!checkIdentifier(n, absolute, name))
{
- return false;
+ return false;
}
TypeList keyTypes = u->lookupType(dict.key, false);
if(keyTypes.empty())
{
- cerr << n << ": `" << dict.key << "' is not a valid type" << endl;
- return false;
+ cerr << n << ": `" << dict.key << "' is not a valid type" << endl;
+ return false;
}
TypePtr keyType = keyTypes.front();
TypeList valueTypes = u->lookupType(dict.value, false);
if(valueTypes.empty())
{
- cerr << n << ": `" << dict.value << "' is not a valid type" << endl;
- return false;
+ cerr << n << ": `" << dict.value << "' is not a valid type" << endl;
+ return false;
}
TypePtr valueType = valueTypes.front();
@@ -810,8 +810,8 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c
for(q = scope.begin(); q != scope.end(); ++q)
{
- H << sp;
- H << nl << "namespace " << *q << nl << '{';
+ H << sp;
+ H << nl << "namespace " << *q << nl << '{';
}
writeCodecH(keyType, dict.keyMetaData, name + "KeyCodec", "Key", H, dllExport);
@@ -821,127 +821,127 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c
if(dict.indices.size() == 0)
{
- string compare = getCompare(dict, typeToString(keyType, false, dict.keyMetaData));
+ string compare = getCompare(dict, typeToString(keyType, false, dict.keyMetaData));
- H << sp << nl << "typedef Freeze::Map< " << typeToString(keyType, false, dict.keyMetaData)
- << ", " << typeToString(valueType, false, dict.valueMetaData) << ", "
- << name << "KeyCodec, " << name << "ValueCodec, " << compare
- << " > " << name << ";";
+ H << sp << nl << "typedef Freeze::Map< " << typeToString(keyType, false, dict.keyMetaData)
+ << ", " << typeToString(valueType, false, dict.valueMetaData) << ", "
+ << name << "KeyCodec, " << name << "ValueCodec, " << compare
+ << " > " << name << ";";
}
else
{
- for(vector<DictIndex>::const_iterator p = dict.indices.begin();
- p != dict.indices.end(); ++p)
- {
- const DictIndex& index = *p;
- if(index.member.empty())
- {
- if(dict.indices.size() > 1)
- {
- cerr << n << ": bad index for dictionary `" << dict.name << "'" << endl;
- return false;
- }
-
- if(!Dictionary::legalKeyType(valueType))
- {
- cerr << n << ": `" << dict.value << "' is not a valid index type" << endl;
- return false;
- }
-
-
- if(index.caseSensitive == false)
- {
- //
- // Let's check value is a string
- //
-
- BuiltinPtr builtInType = BuiltinPtr::dynamicCast(valueType);
-
- if(builtInType == 0 || builtInType->kind() != Builtin::KindString)
- {
- cerr << n << ": VALUE is a `" << dict.value << "', not a string" << endl;
- return false;
- }
- }
- IndexType iType;
- iType.type = valueType;
- iType.metaData = dict.valueMetaData;
- indexTypes.push_back(iType);
- }
- else
- {
- DataMemberPtr dataMember = 0;
- DataMemberList dataMembers;
-
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType);
- if(classDecl != 0)
- {
- dataMembers = classDecl->definition()->allDataMembers();
- }
- else
- {
- StructPtr structDecl = StructPtr::dynamicCast(valueType);
- if(structDecl == 0)
- {
- cerr << n << ": `" << dict.value << "' is neither a class nor a struct." << endl;
- return false;
- }
- dataMembers = structDecl->dataMembers();
- }
- DataMemberList::const_iterator d = dataMembers.begin();
- while(d != dataMembers.end() && dataMember == 0)
- {
- if((*d)->name() == index.member)
- {
- dataMember = *d;
- }
- else
- {
- ++d;
- }
- }
-
- if(dataMember == 0)
- {
- cerr << n << ": The value of `" << dict.name
- << "' has no data member named `" << index.member << "'" << endl;
- return false;
- }
-
- TypePtr dataMemberType = dataMember->type();
-
- if(!Dictionary::legalKeyType(dataMemberType))
- {
- cerr << n << ": `" << index.member << "' cannot be used as an index" << endl;
- return false;
- }
-
- if(index.caseSensitive == false)
- {
- //
- // Let's check member is a string
- //
- BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMemberType);
- if(memberType == 0 || memberType->kind() != Builtin::KindString)
- {
- cerr << n << ": `" << index.member << "' is not a string " << endl;
- return false;
- }
- }
- IndexType iType;
- iType.type = dataMemberType;
- indexTypes.push_back(iType);
- }
- }
- writeDictWithIndicesH(name, dict, indexTypes, keyType, dict.keyMetaData, valueType, dict.valueMetaData, H,
- dllExport);
+ for(vector<DictIndex>::const_iterator p = dict.indices.begin();
+ p != dict.indices.end(); ++p)
+ {
+ const DictIndex& index = *p;
+ if(index.member.empty())
+ {
+ if(dict.indices.size() > 1)
+ {
+ cerr << n << ": bad index for dictionary `" << dict.name << "'" << endl;
+ return false;
+ }
+
+ if(!Dictionary::legalKeyType(valueType))
+ {
+ cerr << n << ": `" << dict.value << "' is not a valid index type" << endl;
+ return false;
+ }
+
+
+ if(index.caseSensitive == false)
+ {
+ //
+ // Let's check value is a string
+ //
+
+ BuiltinPtr builtInType = BuiltinPtr::dynamicCast(valueType);
+
+ if(builtInType == 0 || builtInType->kind() != Builtin::KindString)
+ {
+ cerr << n << ": VALUE is a `" << dict.value << "', not a string" << endl;
+ return false;
+ }
+ }
+ IndexType iType;
+ iType.type = valueType;
+ iType.metaData = dict.valueMetaData;
+ indexTypes.push_back(iType);
+ }
+ else
+ {
+ DataMemberPtr dataMember = 0;
+ DataMemberList dataMembers;
+
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType);
+ if(classDecl != 0)
+ {
+ dataMembers = classDecl->definition()->allDataMembers();
+ }
+ else
+ {
+ StructPtr structDecl = StructPtr::dynamicCast(valueType);
+ if(structDecl == 0)
+ {
+ cerr << n << ": `" << dict.value << "' is neither a class nor a struct." << endl;
+ return false;
+ }
+ dataMembers = structDecl->dataMembers();
+ }
+ DataMemberList::const_iterator d = dataMembers.begin();
+ while(d != dataMembers.end() && dataMember == 0)
+ {
+ if((*d)->name() == index.member)
+ {
+ dataMember = *d;
+ }
+ else
+ {
+ ++d;
+ }
+ }
+
+ if(dataMember == 0)
+ {
+ cerr << n << ": The value of `" << dict.name
+ << "' has no data member named `" << index.member << "'" << endl;
+ return false;
+ }
+
+ TypePtr dataMemberType = dataMember->type();
+
+ if(!Dictionary::legalKeyType(dataMemberType))
+ {
+ cerr << n << ": `" << index.member << "' cannot be used as an index" << endl;
+ return false;
+ }
+
+ if(index.caseSensitive == false)
+ {
+ //
+ // Let's check member is a string
+ //
+ BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMemberType);
+ if(memberType == 0 || memberType->kind() != Builtin::KindString)
+ {
+ cerr << n << ": `" << index.member << "' is not a string " << endl;
+ return false;
+ }
+ }
+ IndexType iType;
+ iType.type = dataMemberType;
+ indexTypes.push_back(iType);
+ }
+ }
+ writeDictWithIndicesH(name, dict, indexTypes, keyType, dict.keyMetaData, valueType, dict.valueMetaData, H,
+ dllExport);
}
for(q = scope.begin(); q != scope.end(); ++q)
{
- H << sp;
- H << nl << '}';
+ H << sp;
+ H << nl << '}';
}
writeCodecC(keyType, dict.keyMetaData, absolute + "KeyCodec", "Key", false, C);
@@ -949,8 +949,8 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c
if(indexTypes.size() > 0)
{
- writeDictWithIndicesC(name, absolute, dict, indexTypes, keyType, dict.keyMetaData, valueType,
- dict.valueMetaData, C);
+ writeDictWithIndicesC(name, absolute, dict, indexTypes, keyType, dict.keyMetaData, valueType,
+ dict.valueMetaData, C);
}
return true;
@@ -995,7 +995,7 @@ writeIndexH(const string& memberTypeString, const string& name, Output& H, const
void
writeIndexC(const TypePtr& type, const TypePtr& memberType, const string& memberName,
- bool caseSensitive, const string& fullName, const string& name, Output& C)
+ bool caseSensitive, const string& fullName, const string& name, Output& C)
{
string inputType = inputTypeToString(memberType, false);
@@ -1057,13 +1057,13 @@ writeIndexC(const TypePtr& type, const TypePtr& memberType, const string& member
string valueS;
if(caseSensitive)
{
- valueS = "__index";
+ valueS = "__index";
}
else
{
- C << nl << typeToString(memberType, false) << " __lowerCaseIndex = __index;";
- C << nl << "std::transform(__lowerCaseIndex.begin(), __lowerCaseIndex.end(), __lowerCaseIndex.begin(), tolower);";
- valueS = "__lowerCaseIndex";
+ C << nl << typeToString(memberType, false) << " __lowerCaseIndex = __index;";
+ C << nl << "std::transform(__lowerCaseIndex.begin(), __lowerCaseIndex.end(), __lowerCaseIndex.begin(), tolower);";
+ valueS = "__lowerCaseIndex";
}
writeMarshalUnmarshalCode(C, memberType, valueS, true, "__stream", false);
@@ -1081,41 +1081,41 @@ writeIndex(const string& n, UnitPtr& u, const Index& index, Output& H, Output& C
string absolute = index.name;
if(absolute.find("::") == 0)
{
- absolute.erase(0, 2);
+ absolute.erase(0, 2);
}
string name = absolute;
vector<string> scope;
string::size_type pos;
while((pos = name.find("::")) != string::npos)
{
- string s = name.substr(0, pos);
- name.erase(0, pos + 2);
-
- if(!checkIdentifier(n, absolute, s))
- {
- return false;
- }
-
- scope.push_back(s);
+ string s = name.substr(0, pos);
+ name.erase(0, pos + 2);
+
+ if(!checkIdentifier(n, absolute, s))
+ {
+ return false;
+ }
+
+ scope.push_back(s);
}
if(!checkIdentifier(n, absolute, name))
{
- return false;
+ return false;
}
TypeList types = u->lookupType(index.type, false);
if(types.empty())
{
- cerr << n << ": `" << index.type << "' is not a valid type" << endl;
- return false;
+ cerr << n << ": `" << index.type << "' is not a valid type" << endl;
+ return false;
}
TypePtr type = types.front();
ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
if(classDecl == 0)
{
- cerr << n << ": `" << index.type << "' is not a class" << endl;
+ cerr << n << ": `" << index.type << "' is not a class" << endl;
return false;
}
@@ -1124,49 +1124,49 @@ writeIndex(const string& n, UnitPtr& u, const Index& index, Output& H, Output& C
DataMemberList::const_iterator p = dataMembers.begin();
while(p != dataMembers.end() && dataMember == 0)
{
- if((*p)->name() == index.member)
- {
- dataMember = *p;
- }
- else
- {
- ++p;
- }
+ if((*p)->name() == index.member)
+ {
+ dataMember = *p;
+ }
+ else
+ {
+ ++p;
+ }
}
if(dataMember == 0)
{
- cerr << n << ": `" << index.type << "' has no data member named `" << index.member << "'" << endl;
+ cerr << n << ": `" << index.type << "' has no data member named `" << index.member << "'" << endl;
return false;
}
if(index.caseSensitive == false)
{
- //
- // Let's check member is a string
- //
- BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type());
- if(memberType == 0 || memberType->kind() != Builtin::KindString)
- {
- cerr << n << ": `" << index.member << "'is not a string " << endl;
- return false;
- }
+ //
+ // Let's check member is a string
+ //
+ BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type());
+ if(memberType == 0 || memberType->kind() != Builtin::KindString)
+ {
+ cerr << n << ": `" << index.member << "'is not a string " << endl;
+ return false;
+ }
}
vector<string>::const_iterator q;
for(q = scope.begin(); q != scope.end(); ++q)
{
- H << sp;
- H << nl << "namespace " << *q << nl << '{';
+ H << sp;
+ H << nl << "namespace " << *q << nl << '{';
}
writeIndexH(inputTypeToString(dataMember->type(), false), name, H, dllExport);
for(q = scope.begin(); q != scope.end(); ++q)
{
- H << sp;
- H << nl << '}';
+ H << sp;
+ H << nl << '}';
}
writeIndexC(type, dataMember->type(), index.member, index.caseSensitive, absolute, name, C);
@@ -1203,21 +1203,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string headerExtension = opts.optArg("header-ext");
@@ -1229,19 +1229,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess= opts.isSet("E");
@@ -1254,330 +1254,330 @@ main(int argc, char* argv[])
optargs = opts.argVec("dict");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Dict dict;
-
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- dict.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- if(s.find("[\"") == 0)
- {
- string::size_type end = s.find("\"]");
- if(end != string::npos && end < pos)
- {
- dict.key = s.substr(end + 2, pos - end - 2);
- dict.keyMetaData.push_back(s.substr(2, end - 2));
- }
- else
- {
- dict.key = s.substr(0, pos);
- }
- }
- else
- {
- dict.key = s.substr(0, pos);
- }
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos == string::npos)
- {
- if(s.find("[\"") == 0)
- {
- string::size_type end = s.find("\"]");
- if(end != string::npos)
- {
- dict.value = s.substr(end + 2);
- dict.valueMetaData.push_back(s.substr(2, end - 2));
- }
- else
- {
- dict.value = s;
- }
- }
- else
- {
- dict.value = s;
- }
- dict.sort = false;
- }
- else
- {
- if(s.find("[\"") == 0)
- {
- string::size_type end = s.find("\"]");
- if(end != string::npos && end < pos)
- {
- dict.value = s.substr(end + 2, pos - end - 2);
- dict.valueMetaData.push_back(s.substr(2, end - 2));
- }
- else
- {
- dict.value = s.substr(0, pos);
- }
- }
- else
- {
- dict.value = s.substr(0, pos);
- }
- s.erase(0, pos + 1);
-
- pos = s.find(',');
- if(pos == string::npos)
- {
- if(s != "sort")
- {
- cerr << argv[0] << ": " << *i
- << ": nothing or ',sort' expected after value-type" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- dict.sort = true;
- }
- else
- {
- string sort = s.substr(0, pos);
- s.erase(0, pos + 1);
- if(sort != "sort")
- {
- cerr << argv[0] << ": " << *i
- << ": nothing or ',sort' expected after value-type" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- dict.sort = true;
- dict.userCompare = s;
- }
- }
-
- if(dict.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(dict.key.empty())
- {
- cerr << argv[0] << ": " << *i << ": no key specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(dict.value.empty())
- {
- cerr << argv[0] << ": " << *i << ": no value specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- dicts.push_back(dict);
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Dict dict;
+
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dict.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ if(s.find("[\"") == 0)
+ {
+ string::size_type end = s.find("\"]");
+ if(end != string::npos && end < pos)
+ {
+ dict.key = s.substr(end + 2, pos - end - 2);
+ dict.keyMetaData.push_back(s.substr(2, end - 2));
+ }
+ else
+ {
+ dict.key = s.substr(0, pos);
+ }
+ }
+ else
+ {
+ dict.key = s.substr(0, pos);
+ }
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos == string::npos)
+ {
+ if(s.find("[\"") == 0)
+ {
+ string::size_type end = s.find("\"]");
+ if(end != string::npos)
+ {
+ dict.value = s.substr(end + 2);
+ dict.valueMetaData.push_back(s.substr(2, end - 2));
+ }
+ else
+ {
+ dict.value = s;
+ }
+ }
+ else
+ {
+ dict.value = s;
+ }
+ dict.sort = false;
+ }
+ else
+ {
+ if(s.find("[\"") == 0)
+ {
+ string::size_type end = s.find("\"]");
+ if(end != string::npos && end < pos)
+ {
+ dict.value = s.substr(end + 2, pos - end - 2);
+ dict.valueMetaData.push_back(s.substr(2, end - 2));
+ }
+ else
+ {
+ dict.value = s.substr(0, pos);
+ }
+ }
+ else
+ {
+ dict.value = s.substr(0, pos);
+ }
+ s.erase(0, pos + 1);
+
+ pos = s.find(',');
+ if(pos == string::npos)
+ {
+ if(s != "sort")
+ {
+ cerr << argv[0] << ": " << *i
+ << ": nothing or ',sort' expected after value-type" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ dict.sort = true;
+ }
+ else
+ {
+ string sort = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ if(sort != "sort")
+ {
+ cerr << argv[0] << ": " << *i
+ << ": nothing or ',sort' expected after value-type" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ dict.sort = true;
+ dict.userCompare = s;
+ }
+ }
+
+ if(dict.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(dict.key.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no key specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(dict.value.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no value specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ dicts.push_back(dict);
}
vector<Index> indices;
optargs = opts.argVec("index");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Index index;
-
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.type = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- string caseString;
- if(pos != string::npos)
- {
- index.member = s.substr(0, pos);
- s.erase(0, pos + 1);
- caseString = s;
- }
- else
- {
- index.member = s;
- caseString = "case-sensitive";
- }
-
- if(index.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(index.type.empty())
- {
- cerr << argv[0] << ": " << *i << ": no type specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(index.member.empty())
- {
- cerr << argv[0] << ": " << *i << ": no member specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(caseString != "case-sensitive" && caseString != "case-insensitive")
- {
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- index.caseSensitive = (caseString == "case-sensitive");
-
- indices.push_back(index);
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Index index;
+
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.type = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ string caseString;
+ if(pos != string::npos)
+ {
+ index.member = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ caseString = s;
+ }
+ else
+ {
+ index.member = s;
+ caseString = "case-sensitive";
+ }
+
+ if(index.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.type.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no type specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.member.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no member specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(caseString != "case-sensitive" && caseString != "case-insensitive")
+ {
+ cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ index.caseSensitive = (caseString == "case-sensitive");
+
+ indices.push_back(index);
}
optargs = opts.argVec("dict-index");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- string dictName;
- DictIndex index;
- index.sort = false;
- index.caseSensitive = true;
-
- string::size_type pos = s.find(',');
- if(pos == string::npos)
- {
- dictName = s;
- }
- else
- {
- dictName = s.substr(0, pos);
- s.erase(0, pos + 1);
-
- bool done = false;
- while(!done)
- {
- pos = s.find(',');
- if(pos == string::npos)
- {
- if(s == "sort")
- {
- index.sort = true;
- }
- else if(s == "case-sensitive")
- {
- index.caseSensitive = true;
- }
- else if(s == "case-insensitive")
- {
- index.caseSensitive = false;
- }
- else if(index.member.empty())
- {
- if(s == "\\sort")
- {
- index.member = "sort";
- }
- else
- {
- index.member = s;
- }
- }
- else
- {
- cerr << argv[0] << ": " << *i << ": syntax error" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- done = true;
- }
- else
- {
- string subs = s.substr(0, pos);
- s.erase(0, pos + 1);
-
- if(subs == "sort")
- {
- index.sort = true;
- index.userCompare = s;
- done = true;
- }
- else if(subs == "case-sensitive")
- {
- index.caseSensitive = true;
- }
- else if(subs == "case-insensitive")
- {
- index.caseSensitive = false;
- }
- else if(index.member.empty())
- {
- if(subs == "\\sort")
- {
- index.member = "sort";
- }
- else
- {
- index.member = subs;
- }
- }
- else
- {
- cerr << argv[0] << ": " << *i << ": syntax error" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- }
- }
- }
-
- if(dictName.empty())
- {
- cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- bool found = false;
- for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
- {
- if(p->name == dictName)
- {
- if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
- {
- cerr << argv[0] << ": --dict-index " << *i
- << ": this dict-index is defined twice" << endl;
- return EXIT_FAILURE;
- }
- p->indices.push_back(index);
- found = true;
- break;
- }
- }
- if(!found)
- {
- cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ string dictName;
+ DictIndex index;
+ index.sort = false;
+ index.caseSensitive = true;
+
+ string::size_type pos = s.find(',');
+ if(pos == string::npos)
+ {
+ dictName = s;
+ }
+ else
+ {
+ dictName = s.substr(0, pos);
+ s.erase(0, pos + 1);
+
+ bool done = false;
+ while(!done)
+ {
+ pos = s.find(',');
+ if(pos == string::npos)
+ {
+ if(s == "sort")
+ {
+ index.sort = true;
+ }
+ else if(s == "case-sensitive")
+ {
+ index.caseSensitive = true;
+ }
+ else if(s == "case-insensitive")
+ {
+ index.caseSensitive = false;
+ }
+ else if(index.member.empty())
+ {
+ if(s == "\\sort")
+ {
+ index.member = "sort";
+ }
+ else
+ {
+ index.member = s;
+ }
+ }
+ else
+ {
+ cerr << argv[0] << ": " << *i << ": syntax error" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ done = true;
+ }
+ else
+ {
+ string subs = s.substr(0, pos);
+ s.erase(0, pos + 1);
+
+ if(subs == "sort")
+ {
+ index.sort = true;
+ index.userCompare = s;
+ done = true;
+ }
+ else if(subs == "case-sensitive")
+ {
+ index.caseSensitive = true;
+ }
+ else if(subs == "case-insensitive")
+ {
+ index.caseSensitive = false;
+ }
+ else if(index.member.empty())
+ {
+ if(subs == "\\sort")
+ {
+ index.member = "sort";
+ }
+ else
+ {
+ index.member = subs;
+ }
+ }
+ else
+ {
+ cerr << argv[0] << ": " << *i << ": syntax error" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ }
+ }
+ }
+
+ if(dictName.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ bool found = false;
+ for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
+ {
+ if(p->name == dictName)
+ {
+ if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
+ {
+ cerr << argv[0] << ": --dict-index " << *i
+ << ": this dict-index is defined twice" << endl;
+ return EXIT_FAILURE;
+ }
+ p->indices.push_back(index);
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ {
+ cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
string output = opts.optArg("output-dir");
@@ -1590,16 +1590,16 @@ main(int argc, char* argv[])
if(dicts.empty() && indices.empty())
{
- cerr << argv[0] << ": no Freeze types specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no Freeze types specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(args.empty())
{
- cerr << argv[0] << ": no file name base specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no file name base specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
string fileH = args[0];
@@ -1609,8 +1609,8 @@ main(int argc, char* argv[])
fileC += "." + sourceExtension;
if(!output.empty())
{
- fileH = output + '/' + fileH;
- fileC = output + '/' + fileC;
+ fileH = output + '/' + fileH;
+ fileC = output + '/' + fileC;
}
UnitPtr u = Unit::createUnit(true, false, ice, caseSensitive);
@@ -1621,193 +1621,193 @@ main(int argc, char* argv[])
for(vector<string>::size_type idx = 1; idx < args.size(); ++idx)
{
- Preprocessor icecpp(argv[0], args[idx], cppArgs);
+ Preprocessor icecpp(argv[0], args[idx], cppArgs);
//
// Add an include file for each Slice file. Note that the .h extension
// is replaced with headerExtension later.
//
- includes.push_back(icecpp.getBaseName() + ".h");
-
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- }
- }
- else
- {
- status = u->parse(cppHandle, debug);
- }
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
+ includes.push_back(icecpp.getBaseName() + ".h");
+
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+ status = u->parse(cppHandle, debug);
+ }
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
}
if(status == EXIT_SUCCESS && !preprocess)
{
- u->mergeModules();
- u->sort();
-
- {
- for(vector<string>::iterator p = includePaths.begin(); p != includePaths.end(); ++p)
- {
- if(p->length() && (*p)[p->length() - 1] != '/')
- {
- *p += '/';
- }
- }
- }
-
- Output H;
- H.open(fileH.c_str());
- if(!H)
- {
- cerr << argv[0] << ": can't open `" << fileH << "' for writing: " << strerror(errno) << endl;
- u->destroy();
- return EXIT_FAILURE;
- }
- printHeader(H);
- printFreezeTypes(H, dicts, indices);
-
- Output C;
- C.open(fileC.c_str());
- if(!C)
- {
- cerr << argv[0] << ": can't open `" << fileC << "' for writing: " << strerror(errno) << endl;
- u->destroy();
- return EXIT_FAILURE;
- }
- printHeader(C);
- printFreezeTypes(C, dicts, indices);
-
- for(vector<string>::const_iterator i = extraHeaders.begin(); i != extraHeaders.end(); ++i)
- {
- string hdr = *i;
- string guard;
- string::size_type pos = hdr.rfind(',');
- if(pos != string::npos)
- {
- hdr = i->substr(0, pos);
- guard = i->substr(pos + 1);
- }
- if(!guard.empty())
- {
- C << "\n#ifndef " << guard;
- C << "\n#define " << guard;
- }
- C << "\n#include <";
- if(!include.empty())
- {
- C << include << '/';
- }
- C << hdr << '>';
- if(!guard.empty())
- {
- C << "\n#endif";
- }
- }
-
- string s = fileH;
- transform(s.begin(), s.end(), s.begin(), ToIfdef());
- H << "\n#ifndef __" << s << "__";
- H << "\n#define __" << s << "__";
- H << '\n';
-
- if(dicts.size() > 0)
- {
- H << "\n#include <Freeze/Map.h>";
- }
-
- if(indices.size() > 0)
- {
- H << "\n#include <Freeze/Index.h>";
- }
-
-
- {
- for(StringList::const_iterator p = includes.begin(); p != includes.end(); ++p)
- {
- H << "\n#include <" << changeInclude(*p, includePaths) << "." + headerExtension + ">";
- }
- }
+ u->mergeModules();
+ u->sort();
+
+ {
+ for(vector<string>::iterator p = includePaths.begin(); p != includePaths.end(); ++p)
+ {
+ if(p->length() && (*p)[p->length() - 1] != '/')
+ {
+ *p += '/';
+ }
+ }
+ }
+
+ Output H;
+ H.open(fileH.c_str());
+ if(!H)
+ {
+ cerr << argv[0] << ": can't open `" << fileH << "' for writing: " << strerror(errno) << endl;
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ printHeader(H);
+ printFreezeTypes(H, dicts, indices);
+
+ Output C;
+ C.open(fileC.c_str());
+ if(!C)
+ {
+ cerr << argv[0] << ": can't open `" << fileC << "' for writing: " << strerror(errno) << endl;
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ printHeader(C);
+ printFreezeTypes(C, dicts, indices);
+
+ for(vector<string>::const_iterator i = extraHeaders.begin(); i != extraHeaders.end(); ++i)
+ {
+ string hdr = *i;
+ string guard;
+ string::size_type pos = hdr.rfind(',');
+ if(pos != string::npos)
+ {
+ hdr = i->substr(0, pos);
+ guard = i->substr(pos + 1);
+ }
+ if(!guard.empty())
+ {
+ C << "\n#ifndef " << guard;
+ C << "\n#define " << guard;
+ }
+ C << "\n#include <";
+ if(!include.empty())
+ {
+ C << include << '/';
+ }
+ C << hdr << '>';
+ if(!guard.empty())
+ {
+ C << "\n#endif";
+ }
+ }
+
+ string s = fileH;
+ transform(s.begin(), s.end(), s.begin(), ToIfdef());
+ H << "\n#ifndef __" << s << "__";
+ H << "\n#define __" << s << "__";
+ H << '\n';
+
+ if(dicts.size() > 0)
+ {
+ H << "\n#include <Freeze/Map.h>";
+ }
+
+ if(indices.size() > 0)
+ {
+ H << "\n#include <Freeze/Index.h>";
+ }
+
+
+ {
+ for(StringList::const_iterator p = includes.begin(); p != includes.end(); ++p)
+ {
+ H << "\n#include <" << changeInclude(*p, includePaths) << "." + headerExtension + ">";
+ }
+ }
C << "\n#include <Ice/BasicStream.h>";
- C << "\n#include <";
- if(include.size())
- {
- C << include << '/';
- }
- C << includeH << '>';
-
- printVersionCheck(H);
- printVersionCheck(C);
-
- printDllExportStuff(H, dllExport);
- if(dllExport.size())
- {
- dllExport += " ";
- }
-
- {
- for(vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
- {
- try
- {
- if(!writeDict(argv[0], u, *p, H, C, dllExport))
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- }
- catch(...)
- {
- cerr << argv[0] << ": unknown exception" << endl;
- u->destroy();
- return EXIT_FAILURE;
- }
- }
-
-
- for(vector<Index>::const_iterator q = indices.begin(); q != indices.end(); ++q)
- {
- try
- {
- if(!writeIndex(argv[0], u, *q, H, C, dllExport))
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- }
- catch(...)
- {
- cerr << argv[0] << ": unknown exception" << endl;
- u->destroy();
- return EXIT_FAILURE;
- }
- }
-
- }
-
- H << "\n\n#endif\n";
- C << '\n';
+ C << "\n#include <";
+ if(include.size())
+ {
+ C << include << '/';
+ }
+ C << includeH << '>';
+
+ printVersionCheck(H);
+ printVersionCheck(C);
+
+ printDllExportStuff(H, dllExport);
+ if(dllExport.size())
+ {
+ dllExport += " ";
+ }
+
+ {
+ for(vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
+ {
+ try
+ {
+ if(!writeDict(argv[0], u, *p, H, C, dllExport))
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ catch(...)
+ {
+ cerr << argv[0] << ": unknown exception" << endl;
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+
+
+ for(vector<Index>::const_iterator q = indices.begin(); q != indices.end(); ++q)
+ {
+ try
+ {
+ if(!writeIndex(argv[0], u, *q, H, C, dllExport))
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ catch(...)
+ {
+ cerr << argv[0] << ": unknown exception" << endl;
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+
+ }
+
+ H << "\n\n#endif\n";
+ C << '\n';
}
u->destroy();
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp
index adf009ee4d6..bbca3691695 100644
--- a/cpp/src/slice2freezej/Main.cpp
+++ b/cpp/src/slice2freezej/Main.cpp
@@ -26,12 +26,12 @@ struct DictIndex
bool operator==(const DictIndex& rhs) const
{
- return member == rhs.member;
+ return member == rhs.member;
}
bool operator!=(const DictIndex& rhs) const
{
- return member != rhs.member;
+ return member != rhs.member;
}
};
@@ -82,49 +82,49 @@ FreezeGenerator::varToObject(const TypePtr& type, const string& param)
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(b != 0)
{
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- result = string("new java.lang.Byte(") + param + ")";
- break;
- }
- case Builtin::KindBool:
- {
- result = string("new java.lang.Boolean(") + param + ")";
- break;
- }
- case Builtin::KindShort:
- {
- result = string("new java.lang.Short(") + param + ")";
- break;
- }
- case Builtin::KindInt:
- {
- result = string("new java.lang.Integer(") + param + ")";
- break;
- }
- case Builtin::KindLong:
- {
- result = string("new java.lang.Long(") + param + ")";
- break;
- }
- case Builtin::KindFloat:
- {
- result = string("new java.lang.Float(") + param + ")";
- break;
- }
- case Builtin::KindDouble:
- {
- result = string("new java.lang.Double(") + param + ")";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- break;
- }
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ result = string("new java.lang.Byte(") + param + ")";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ result = string("new java.lang.Boolean(") + param + ")";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ result = string("new java.lang.Short(") + param + ")";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ result = string("new java.lang.Integer(") + param + ")";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ result = string("new java.lang.Long(") + param + ")";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ result = string("new java.lang.Float(") + param + ")";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ result = string("new java.lang.Double(") + param + ")";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ break;
+ }
}
return result;
}
@@ -137,49 +137,49 @@ FreezeGenerator::objectToVar(const TypePtr& type, const string& param)
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(b != 0)
{
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- result = string("((java.lang.Byte)") + param + ").byteValue()";
- break;
- }
- case Builtin::KindBool:
- {
- result = string("((java.lang.Boolean)") + param + ").booleanValue()";
- break;
- }
- case Builtin::KindShort:
- {
- result = string("((java.lang.Short)") + param + ").shortValue()";
- break;
- }
- case Builtin::KindInt:
- {
- result = string("((java.lang.Integer)") + param + ").intValue()";
- break;
- }
- case Builtin::KindLong:
- {
- result = string("((java.lang.Long)") + param + ").longValue()";
- break;
- }
- case Builtin::KindFloat:
- {
- result = string("((java.lang.Float)") + param + ").floatValue()";
- break;
- }
- case Builtin::KindDouble:
- {
- result = string("((java.lang.Double)") + param + ").doubleValue()";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- break;
- }
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ result = string("((java.lang.Byte)") + param + ").byteValue()";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ result = string("((java.lang.Boolean)") + param + ").booleanValue()";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ result = string("((java.lang.Short)") + param + ").shortValue()";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ result = string("((java.lang.Integer)") + param + ").intValue()";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ result = string("((java.lang.Long)") + param + ").longValue()";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ result = string("((java.lang.Float)") + param + ").floatValue()";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ result = string("((java.lang.Double)") + param + ").doubleValue()";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ break;
+ }
}
return result;
}
@@ -236,108 +236,108 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
for(i = 0; i < dict.indices.size(); ++i)
{
- const DictIndex& index = dict.indices[i];
- const string& member = index.member;
-
- if(index.member.empty())
- {
- if(dict.indices.size() > 1)
- {
- cerr << _prog << ": bad index for dictionary `" << dict.name << "'" << endl;
- return false;
- }
-
- if(!Dictionary::legalKeyType(valueType))
- {
- cerr << _prog << ": `" << dict.value << "' is not a valid index type" << endl;
- return false;
- }
-
- if(index.caseSensitive == false)
- {
- //
- // Let's check value is a string
- //
-
- BuiltinPtr builtInType = BuiltinPtr::dynamicCast(valueType);
-
- if(builtInType == 0 || builtInType->kind() != Builtin::KindString)
- {
- cerr << _prog << ": VALUE is a `" << dict.value << "', not a string " << endl;
- return false;
- }
- }
- indexTypes.push_back(valueType);
- capitalizedMembers.push_back("Value");
- indexNames.push_back("index");
- }
- else
- {
- DataMemberPtr dataMember = 0;
- DataMemberList dataMembers;
-
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType);
- if(classDecl != 0)
- {
- dataMembers = classDecl->definition()->allDataMembers();
- }
- else
- {
- StructPtr structDecl = StructPtr::dynamicCast(valueType);
- if(structDecl == 0)
- {
- cerr << _prog << ": `" << dict.value << "' is neither a class nor a struct." << endl;
- return false;
- }
- dataMembers = structDecl->dataMembers();
- }
- DataMemberList::const_iterator q = dataMembers.begin();
- while(q != dataMembers.end() && dataMember == 0)
- {
- if((*q)->name() == index.member)
- {
- dataMember = *q;
- }
- else
- {
- ++q;
- }
- }
-
- if(dataMember == 0)
- {
- cerr << _prog << ": The value of `" << dict.name
- << "' has no data member named `" << index.member << "'" << endl;
- return false;
- }
-
- TypePtr dataMemberType = dataMember->type();
-
- if(!Dictionary::legalKeyType(dataMemberType))
- {
- cerr << _prog << ": `" << index.member << "' cannot be used as an index" << endl;
- return false;
- }
-
- if(index.caseSensitive == false)
- {
- //
- // Let's check member is a string
- //
- BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMemberType);
- if(memberType == 0 || memberType->kind() != Builtin::KindString)
- {
- cerr << _prog << ": `" << index.member << "' is not a string " << endl;
- return false;
- }
- }
- indexTypes.push_back(dataMemberType);
-
- string capitalizedMember = member;
- capitalizedMember[0] = toupper(capitalizedMember[0]);
- capitalizedMembers.push_back(capitalizedMember);
- indexNames.push_back(member);
- }
+ const DictIndex& index = dict.indices[i];
+ const string& member = index.member;
+
+ if(index.member.empty())
+ {
+ if(dict.indices.size() > 1)
+ {
+ cerr << _prog << ": bad index for dictionary `" << dict.name << "'" << endl;
+ return false;
+ }
+
+ if(!Dictionary::legalKeyType(valueType))
+ {
+ cerr << _prog << ": `" << dict.value << "' is not a valid index type" << endl;
+ return false;
+ }
+
+ if(index.caseSensitive == false)
+ {
+ //
+ // Let's check value is a string
+ //
+
+ BuiltinPtr builtInType = BuiltinPtr::dynamicCast(valueType);
+
+ if(builtInType == 0 || builtInType->kind() != Builtin::KindString)
+ {
+ cerr << _prog << ": VALUE is a `" << dict.value << "', not a string " << endl;
+ return false;
+ }
+ }
+ indexTypes.push_back(valueType);
+ capitalizedMembers.push_back("Value");
+ indexNames.push_back("index");
+ }
+ else
+ {
+ DataMemberPtr dataMember = 0;
+ DataMemberList dataMembers;
+
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType);
+ if(classDecl != 0)
+ {
+ dataMembers = classDecl->definition()->allDataMembers();
+ }
+ else
+ {
+ StructPtr structDecl = StructPtr::dynamicCast(valueType);
+ if(structDecl == 0)
+ {
+ cerr << _prog << ": `" << dict.value << "' is neither a class nor a struct." << endl;
+ return false;
+ }
+ dataMembers = structDecl->dataMembers();
+ }
+ DataMemberList::const_iterator q = dataMembers.begin();
+ while(q != dataMembers.end() && dataMember == 0)
+ {
+ if((*q)->name() == index.member)
+ {
+ dataMember = *q;
+ }
+ else
+ {
+ ++q;
+ }
+ }
+
+ if(dataMember == 0)
+ {
+ cerr << _prog << ": The value of `" << dict.name
+ << "' has no data member named `" << index.member << "'" << endl;
+ return false;
+ }
+
+ TypePtr dataMemberType = dataMember->type();
+
+ if(!Dictionary::legalKeyType(dataMemberType))
+ {
+ cerr << _prog << ": `" << index.member << "' cannot be used as an index" << endl;
+ return false;
+ }
+
+ if(index.caseSensitive == false)
+ {
+ //
+ // Let's check member is a string
+ //
+ BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMemberType);
+ if(memberType == 0 || memberType->kind() != Builtin::KindString)
+ {
+ cerr << _prog << ": `" << index.member << "' is not a string " << endl;
+ return false;
+ }
+ }
+ indexTypes.push_back(dataMemberType);
+
+ string capitalizedMember = member;
+ capitalizedMember[0] = toupper(capitalizedMember[0]);
+ capitalizedMembers.push_back(capitalizedMember);
+ indexNames.push_back(member);
+ }
}
@@ -357,46 +357,46 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
//
if(dict.indices.size() > 0)
{
- out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
- << "java.util.Comparator __comparator, java.util.Map __indexComparators)";
- out << sb;
-
- out << nl << "super(__connection, __dbName, __comparator);";
- out << nl << "_indices = new Freeze.Map.Index[" << dict.indices.size() << "];";
- for(i = 0; i < dict.indices.size(); ++i)
- {
- out << nl << "_indices[" << i << "] = new " << capitalizedMembers[i]
- << "Index(\"" << indexNames[i] << "\");";
- }
- out << nl << "init(_indices, __dbName, \"" << keyType->typeId() << "\", \""
- << valueType->typeId() << "\", __createDb, __indexComparators);";
- out << eb;
+ out << sp << nl << "public" << nl << name
+ << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
+ << "java.util.Comparator __comparator, java.util.Map __indexComparators)";
+ out << sb;
+
+ out << nl << "super(__connection, __dbName, __comparator);";
+ out << nl << "_indices = new Freeze.Map.Index[" << dict.indices.size() << "];";
+ for(i = 0; i < dict.indices.size(); ++i)
+ {
+ out << nl << "_indices[" << i << "] = new " << capitalizedMembers[i]
+ << "Index(\"" << indexNames[i] << "\");";
+ }
+ out << nl << "init(_indices, __dbName, \"" << keyType->typeId() << "\", \""
+ << valueType->typeId() << "\", __createDb, __indexComparators);";
+ out << eb;
}
out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
- << "java.util.Comparator __comparator)";
+ << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
+ << "java.util.Comparator __comparator)";
out << sb;
if(dict.indices.size() > 0)
{
- out << nl << "this(__connection, __dbName, __createDb, __comparator, null);";
+ out << nl << "this(__connection, __dbName, __createDb, __comparator, null);";
}
else
{
- out << nl << "super(__connection, __dbName, \"" << keyType->typeId() << "\", \""
- << valueType->typeId() << "\", __createDb, __comparator);";
+ out << nl << "super(__connection, __dbName, \"" << keyType->typeId() << "\", \""
+ << valueType->typeId() << "\", __createDb, __comparator);";
}
out << eb;
out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName, boolean __createDb)";
+ << "(Freeze.Connection __connection, String __dbName, boolean __createDb)";
out << sb;
out << nl << "this(__connection, __dbName, __createDb, null);";
out << eb;
out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName)";
+ << "(Freeze.Connection __connection, String __dbName)";
out << sb;
out << nl << "this(__connection, __dbName, true);";
out << eb;
@@ -406,33 +406,33 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
//
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string indexClassName = capitalizedMembers[i] + "Index";
-
- out << sp << nl << "public Freeze.Map.EntryIterator";
- out << nl << "findBy" << capitalizedMembers[i] << "("
- << typeToString(indexTypes[i], TypeModeIn) << " __index, boolean __onlyDups)";
- out << sb;
- out << nl << "return _indices[" << i << "].untypedFind("
- << varToObject(indexTypes[i], "__index") << ", __onlyDups);";
- out << eb;
-
- out << sp << nl << "public Freeze.Map.EntryIterator";
- out << nl << "findBy" << capitalizedMembers[i] << "("
- << typeToString(indexTypes[i], TypeModeIn) << " __index)";
- out << sb;
- out << nl << "return _indices[" << i << "].untypedFind("
- << varToObject(indexTypes[i], "__index") << ", true);";
- out << eb;
-
- string countMethod = dict.indices[i].member.empty() ?
- string("valueCount") : dict.indices[i].member + "Count";
- out << sp << nl << "public int";
- out << nl << countMethod << "("
- << typeToString(indexTypes[i], TypeModeIn) << " __index)";
- out << sb;
- out << nl << "return _indices[" << i << "].untypedCount("
- << varToObject(indexTypes[i], "__index") << ");";
- out << eb;
+ string indexClassName = capitalizedMembers[i] + "Index";
+
+ out << sp << nl << "public Freeze.Map.EntryIterator";
+ out << nl << "findBy" << capitalizedMembers[i] << "("
+ << typeToString(indexTypes[i], TypeModeIn) << " __index, boolean __onlyDups)";
+ out << sb;
+ out << nl << "return _indices[" << i << "].untypedFind("
+ << varToObject(indexTypes[i], "__index") << ", __onlyDups);";
+ out << eb;
+
+ out << sp << nl << "public Freeze.Map.EntryIterator";
+ out << nl << "findBy" << capitalizedMembers[i] << "("
+ << typeToString(indexTypes[i], TypeModeIn) << " __index)";
+ out << sb;
+ out << nl << "return _indices[" << i << "].untypedFind("
+ << varToObject(indexTypes[i], "__index") << ", true);";
+ out << eb;
+
+ string countMethod = dict.indices[i].member.empty() ?
+ string("valueCount") : dict.indices[i].member + "Count";
+ out << sp << nl << "public int";
+ out << nl << countMethod << "("
+ << typeToString(indexTypes[i], TypeModeIn) << " __index)";
+ out << sb;
+ out << nl << "return _indices[" << i << "].untypedCount("
+ << varToObject(indexTypes[i], "__index") << ");";
+ out << eb;
}
//
@@ -460,18 +460,18 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
encaps = true;
}
- string valS = objectToVar(type, "o");
- string typeS;
+ string valS = objectToVar(type, "o");
+ string typeS;
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(b != 0)
{
typeS = builtinTable[b->kind()];
- }
- else
- {
- typeS = typeToString(type, TypeModeIn);
- }
+ }
+ else
+ {
+ typeS = typeToString(type, TypeModeIn);
+ }
int iter;
@@ -614,213 +614,213 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
//
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string indexClassName = capitalizedMembers[i] + "Index";
- out << sp << nl << "private class " << indexClassName << " extends Freeze.Map.Index";
- out << sb;
-
- //
- // encodeKey
- //
- out << sp << nl << "public byte[]";
- out << nl << "encodeKey(Object key, Ice.Communicator communicator)";
- out << sb;
- if(dict.indices[i].member.empty())
- {
- //
- // Encode the full value (with an encaps!)
- //
- string keyS = "key";
- if(!dict.indices[i].caseSensitive)
- {
- keyS = "((String)key).toLowerCase()";
- }
-
- out << nl << "return encodeValue(" << keyS << ", communicator);";
- }
- else
- {
- //
- // No encaps
- //
- string keyS = dict.indices[i].caseSensitive ?
- "key" : "((String)key).toLowerCase()";
-
- keyS = objectToVar(indexTypes[i], keyS);
-
- out << nl << "IceInternal.BasicStream __os = "
- << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
- int iter = 0;
- writeMarshalUnmarshalCode(out, "", indexTypes[i], keyS, true, iter, false);
- assert(!indexTypes[i]->usesClasses());
-
- out << nl << "java.nio.ByteBuffer buf = __os.prepareWrite();";
- out << nl << "byte[] r = new byte[buf.limit()];";
- out << nl << "buf.get(r);";
- out << nl << "return r;";
- }
- out << eb;
-
- //
- // decodekey
- //
- out << sp << nl << "public Object";
- out << nl << "decodeKey(byte[] bytes, Ice.Communicator communicator)";
- out << sb;
- if(dict.indices[i].member.empty())
- {
- //
- // Decode the full value (with an encaps!)
- //
- out << nl << "return decodeValue(bytes, communicator);";
- }
- else
- {
- out << nl << "IceInternal.BasicStream __is = new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
- out << nl << "__is.resize(bytes.length, true);";
- out << nl << "java.nio.ByteBuffer buf = __is.prepareRead();";
- out << nl << "buf.position(0);";
- out << nl << "buf.put(bytes);";
- out << nl << "buf.position(0);";
-
- int iter = 0;
- list<string> metaData;
- string patchParams;
-
- string typeS;
- BuiltinPtr b = BuiltinPtr::dynamicCast(indexTypes[i]);
- if(b != 0)
- {
- typeS = builtinTable[b->kind()];
- }
- else
- {
- typeS = typeToString(indexTypes[i], TypeModeIn);
- }
+ string indexClassName = capitalizedMembers[i] + "Index";
+ out << sp << nl << "private class " << indexClassName << " extends Freeze.Map.Index";
+ out << sb;
+
+ //
+ // encodeKey
+ //
+ out << sp << nl << "public byte[]";
+ out << nl << "encodeKey(Object key, Ice.Communicator communicator)";
+ out << sb;
+ if(dict.indices[i].member.empty())
+ {
+ //
+ // Encode the full value (with an encaps!)
+ //
+ string keyS = "key";
+ if(!dict.indices[i].caseSensitive)
+ {
+ keyS = "((String)key).toLowerCase()";
+ }
+
+ out << nl << "return encodeValue(" << keyS << ", communicator);";
+ }
+ else
+ {
+ //
+ // No encaps
+ //
+ string keyS = dict.indices[i].caseSensitive ?
+ "key" : "((String)key).toLowerCase()";
+
+ keyS = objectToVar(indexTypes[i], keyS);
+
+ out << nl << "IceInternal.BasicStream __os = "
+ << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
+ int iter = 0;
+ writeMarshalUnmarshalCode(out, "", indexTypes[i], keyS, true, iter, false);
+ assert(!indexTypes[i]->usesClasses());
+
+ out << nl << "java.nio.ByteBuffer buf = __os.prepareWrite();";
+ out << nl << "byte[] r = new byte[buf.limit()];";
+ out << nl << "buf.get(r);";
+ out << nl << "return r;";
+ }
+ out << eb;
+
+ //
+ // decodekey
+ //
+ out << sp << nl << "public Object";
+ out << nl << "decodeKey(byte[] bytes, Ice.Communicator communicator)";
+ out << sb;
+ if(dict.indices[i].member.empty())
+ {
+ //
+ // Decode the full value (with an encaps!)
+ //
+ out << nl << "return decodeValue(bytes, communicator);";
+ }
+ else
+ {
+ out << nl << "IceInternal.BasicStream __is = new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
+ out << nl << "__is.resize(bytes.length, true);";
+ out << nl << "java.nio.ByteBuffer buf = __is.prepareRead();";
+ out << nl << "buf.position(0);";
+ out << nl << "buf.put(bytes);";
+ out << nl << "buf.position(0);";
+
+ int iter = 0;
+ list<string> metaData;
+ string patchParams;
+
+ string typeS;
+ BuiltinPtr b = BuiltinPtr::dynamicCast(indexTypes[i]);
+ if(b != 0)
+ {
+ typeS = builtinTable[b->kind()];
+ }
+ else
+ {
+ typeS = typeToString(indexTypes[i], TypeModeIn);
+ }
out << nl << typeS << " r;";
-
- if(b != 0)
- {
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- out << nl << "r = new java.lang.Byte(__is.readByte());";
- break;
- }
- case Builtin::KindBool:
- {
- out << nl << "r = new java.lang.Boolean(__is.readBool());";
- break;
- }
- case Builtin::KindShort:
- {
- out << nl << "r = new java.lang.Short(__is.readShort());";
- break;
- }
- case Builtin::KindInt:
- {
- out << nl << "r = new java.lang.Integer(__is.readInt());";
- break;
- }
- case Builtin::KindLong:
- {
- out << nl << "r = new java.lang.Long(__is.readLong());";
- break;
- }
- case Builtin::KindFloat:
- {
- out << nl << "r = new java.lang.Float(__is.readFloat());";
- break;
- }
- case Builtin::KindDouble:
- {
- out << nl << "r = new java.lang.Double(__is.readDouble());";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- {
- writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
- break;
- }
- }
- }
- else
- {
- writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
- }
+
+ if(b != 0)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ out << nl << "r = new java.lang.Byte(__is.readByte());";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ out << nl << "r = new java.lang.Boolean(__is.readBool());";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ out << nl << "r = new java.lang.Short(__is.readShort());";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ out << nl << "r = new java.lang.Integer(__is.readInt());";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ out << nl << "r = new java.lang.Long(__is.readLong());";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ out << nl << "r = new java.lang.Float(__is.readFloat());";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ out << nl << "r = new java.lang.Double(__is.readDouble());";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
+ break;
+ }
+ }
+ }
+ else
+ {
+ writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
+ }
out << nl << "return r;";
}
out << eb;
- //
- // compare
- //
- out << sp << nl << "public int";
- out << nl << "compare(Object o1, Object o2)";
- out << sb;
- out << nl << "assert _comparator != null;";
- out << nl << "byte[] d1 = (byte[])o1;";
- out << nl << "byte[] d2 = (byte[])o2;";
- out << nl << "Ice.Communicator communicator = ((Freeze.Connection)_connection).getCommunicator();";
- out << nl << "return _comparator.compare(";
- out.inc();
- out << nl << "decodeKey(d1, communicator),";
- out << nl << "decodeKey(d2, communicator));";
- out.dec();
- out << eb;
-
- //
- // extractKey from value
- //
- out << sp << nl << "public Object";
- out << nl << "extractKey(Object value)";
- out << sb;
- if(dict.indices[i].member.empty())
- {
- if(dict.indices[i].caseSensitive)
- {
- out << nl << "return value;";
- }
- else
- {
- out << nl << "return value.toLowerCase();";
- }
- }
- else
- {
- out << nl << typeToString(valueType, TypeModeIn)
- << " typedValue = ("
- << typeToString(valueType, TypeModeIn) << ")value;";
-
- string member = string("typedValue.") + dict.indices[i].member;
- if(!dict.indices[i].caseSensitive)
- {
- member += ".toLowerCase()";
- }
- out << nl << "return " << varToObject(indexTypes[i], member) << ";";
- }
- out << eb;
-
- //
- // marshalKey optimization
- //
- if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive)
- {
- out << sp << nl << "protected byte[]";
- out << nl << "marshalKey(byte[] value)";
- out << sb;
- out << nl << "return value;";
- out << eb;
- }
-
- out << sp << nl << "private " << indexClassName << "(String name)";
- out << sb;
- out << nl << "super(name);";
- out << eb;
- out << eb;
+ //
+ // compare
+ //
+ out << sp << nl << "public int";
+ out << nl << "compare(Object o1, Object o2)";
+ out << sb;
+ out << nl << "assert _comparator != null;";
+ out << nl << "byte[] d1 = (byte[])o1;";
+ out << nl << "byte[] d2 = (byte[])o2;";
+ out << nl << "Ice.Communicator communicator = ((Freeze.Connection)_connection).getCommunicator();";
+ out << nl << "return _comparator.compare(";
+ out.inc();
+ out << nl << "decodeKey(d1, communicator),";
+ out << nl << "decodeKey(d2, communicator));";
+ out.dec();
+ out << eb;
+
+ //
+ // extractKey from value
+ //
+ out << sp << nl << "public Object";
+ out << nl << "extractKey(Object value)";
+ out << sb;
+ if(dict.indices[i].member.empty())
+ {
+ if(dict.indices[i].caseSensitive)
+ {
+ out << nl << "return value;";
+ }
+ else
+ {
+ out << nl << "return value.toLowerCase();";
+ }
+ }
+ else
+ {
+ out << nl << typeToString(valueType, TypeModeIn)
+ << " typedValue = ("
+ << typeToString(valueType, TypeModeIn) << ")value;";
+
+ string member = string("typedValue.") + dict.indices[i].member;
+ if(!dict.indices[i].caseSensitive)
+ {
+ member += ".toLowerCase()";
+ }
+ out << nl << "return " << varToObject(indexTypes[i], member) << ";";
+ }
+ out << eb;
+
+ //
+ // marshalKey optimization
+ //
+ if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive)
+ {
+ out << sp << nl << "protected byte[]";
+ out << nl << "marshalKey(byte[] value)";
+ out << sb;
+ out << nl << "return value;";
+ out << eb;
+ }
+
+ out << sp << nl << "private " << indexClassName << "(String name)";
+ out << sb;
+ out << nl << "super(name);";
+ out << eb;
+ out << eb;
}
//
@@ -897,7 +897,7 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
if(classDecl == 0)
{
- cerr << _prog << ": `" << index.type << "' is not a class" << endl;
+ cerr << _prog << ": `" << index.type << "' is not a class" << endl;
return false;
}
@@ -906,33 +906,33 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
DataMemberList::const_iterator p = dataMembers.begin();
while(p != dataMembers.end() && dataMember == 0)
{
- if((*p)->name() == index.member)
- {
- dataMember = *p;
- }
- else
- {
- ++p;
- }
+ if((*p)->name() == index.member)
+ {
+ dataMember = *p;
+ }
+ else
+ {
+ ++p;
+ }
}
if(dataMember == 0)
{
- cerr << _prog << ": `" << index.type << "' has no data member named `" << index.member << "'" << endl;
+ cerr << _prog << ": `" << index.type << "' has no data member named `" << index.member << "'" << endl;
return false;
}
if(index.caseSensitive == false)
{
- //
- // Let's check member is a string
- //
- BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type());
- if(memberType == 0 || memberType->kind() != Builtin::KindString)
- {
- cerr << _prog << ": `" << index.member << "'is not a string " << endl;
- return false;
- }
+ //
+ // Let's check member is a string
+ //
+ BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type());
+ if(memberType == 0 || memberType->kind() != Builtin::KindString)
+ {
+ cerr << _prog << ": `" << index.member << "'is not a string " << endl;
+ return false;
+ }
}
string memberTypeString = typeToString(dataMember->type(), TypeModeIn);
@@ -965,19 +965,19 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
// find and count
//
out << sp << nl << "public Ice.Identity[]" << nl
- << "findFirst(" << memberTypeString << " __index, int __firstN)";
+ << "findFirst(" << memberTypeString << " __index, int __firstN)";
out << sb;
out << nl << "return untypedFindFirst(marshalKey(__index), __firstN);";
out << eb;
out << sp << nl << "public Ice.Identity[]" << nl
- << "find(" << memberTypeString << " __index)";
+ << "find(" << memberTypeString << " __index)";
out << sb;
out << nl << "return untypedFind(marshalKey(__index));";
out << eb;
out << sp << nl << "public int" << nl
- << "count(" << memberTypeString << " __index)";
+ << "count(" << memberTypeString << " __index)";
out << sb;
out << nl << "return untypedCount(marshalKey(__index));";
out << eb;
@@ -988,7 +988,7 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
string typeString = typeToString(type, TypeModeIn);
out << sp << nl << "protected byte[]" << nl
- << "marshalKey(Ice.Object __servant)";
+ << "marshalKey(Ice.Object __servant)";
out << sb;
out << nl << "if(__servant instanceof " << typeString << ")";
out << sb;
@@ -1004,15 +1004,15 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
string valueS = index.caseSensitive ? "__key" : "__key.toLowerCase()";
out << sp << nl << "private byte[]" << nl
- << "marshalKey(" << memberTypeString << " __key)";
+ << "marshalKey(" << memberTypeString << " __key)";
out << sb;
out << nl << "IceInternal.BasicStream __os = "
- << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator()));";
+ << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator()));";
int iter = 0;
writeMarshalUnmarshalCode(out, "", dataMember->type(), valueS, true, iter, false);
if(type->usesClasses())
{
- out << nl << "__os.writePendingObjects();";
+ out << nl << "__os.writePendingObjects();";
}
out << nl << "java.nio.ByteBuffer __buf = __os.prepareWrite();";
out << nl << "byte[] __r = new byte[__buf.limit()];";
@@ -1040,29 +1040,29 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--include-dir DIR Use DIR as the header include directory.\n"
"--dict NAME,KEY,VALUE Create a Freeze dictionary with the name NAME,\n"
" using KEY as key, and VALUE as value. This\n"
" option may be specified multiple times for\n"
" different names. NAME may be a scoped name.\n"
- "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n"
+ "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n"
" Create a Freeze evictor index with the name\n"
" NAME for member MEMBER of class TYPE. This\n"
" option may be specified multiple times for\n"
" different names. NAME may be a scoped name.\n"
" When member is a string, the case can be\n"
" sensitive or insensitive (default is sensitive).\n"
- "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}] \n"
- " Add an index to dictionary DICT. If MEMBER is \n"
+ "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}] \n"
+ " Add an index to dictionary DICT. If MEMBER is \n"
" specified, then DICT's VALUE must be a class or\n"
- " a struct, and MEMBER must designate a member of\n"
- " VALUE. Otherwise, the entire VALUE is used for \n"
- " indexing. When the secondary key is a string, \n"
- " the case can be sensitive or insensitive (default\n"
- " is sensitive).\n"
+ " a struct, and MEMBER must designate a member of\n"
+ " VALUE. Otherwise, the entire VALUE is used for \n"
+ " indexing. When the secondary key is a string, \n"
+ " the case can be sensitive or insensitive (default\n"
+ " is sensitive).\n"
"--output-dir DIR Create files in the directory DIR.\n"
- "--depend Generate Makefile dependencies.\n"
+ "--depend Generate Makefile dependencies.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--meta META Define global metadata directive META.\n"
@@ -1098,21 +1098,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -1120,19 +1120,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -1143,199 +1143,199 @@ main(int argc, char* argv[])
optargs = opts.argVec("dict");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Dict dict;
-
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- dict.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- dict.key = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- dict.value = s;
-
- if(dict.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(dict.key.empty())
- {
- cerr << argv[0] << ": " << *i << ": no key specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(dict.value.empty())
- {
- cerr << argv[0] << ": " << *i << ": no value specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- dicts.push_back(dict);
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Dict dict;
+
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dict.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dict.key = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ dict.value = s;
+
+ if(dict.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(dict.key.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no key specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(dict.value.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no value specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ dicts.push_back(dict);
}
vector<Index> indices;
optargs = opts.argVec("index");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Index index;
-
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.type = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- string caseString;
- if(pos != string::npos)
- {
- index.member = s.substr(0, pos);
- s.erase(0, pos + 1);
- caseString = s;
- }
- else
- {
- index.member = s;
- caseString = "case-sensitive";
- }
-
- if(index.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(index.type.empty())
- {
- cerr << argv[0] << ": " << *i << ": no type specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(index.member.empty())
- {
- cerr << argv[0] << ": " << *i << ": no member specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(caseString != "case-sensitive" && caseString != "case-insensitive")
- {
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- index.caseSensitive = (caseString == "case-sensitive");
-
- indices.push_back(index);
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Index index;
+
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.type = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ string caseString;
+ if(pos != string::npos)
+ {
+ index.member = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ caseString = s;
+ }
+ else
+ {
+ index.member = s;
+ caseString = "case-sensitive";
+ }
+
+ if(index.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.type.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no type specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.member.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no member specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(caseString != "case-sensitive" && caseString != "case-insensitive")
+ {
+ cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ index.caseSensitive = (caseString == "case-sensitive");
+
+ indices.push_back(index);
}
if(opts.isSet("dict-index"))
{
- vector<string> optargs = opts.argVec("dict-index");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- string dictName;
- DictIndex index;
- string::size_type pos;
-
- string caseString = "case-sensitive";
- pos = s.find(',');
- if(pos != string::npos)
- {
- dictName = s.substr(0, pos);
- s.erase(0, pos + 1);
-
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.member = s.substr(0, pos);
- s.erase(0, pos + 1);
- caseString = s;
- }
- else
- {
- if(s == "case-sensitive" || s == "case-insensitive")
- {
- caseString = s;
- }
- else
- {
- index.member = s;
- }
- }
- }
- else
- {
- dictName = s;
- }
-
- if(dictName.empty())
- {
- cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(caseString != "case-sensitive" && caseString != "case-insensitive")
- {
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- index.caseSensitive = (caseString == "case-sensitive");
-
- bool found = false;
- for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
- {
- if(p->name == dictName)
- {
- if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
- {
- cerr << argv[0] << ": --dict-index " << *i << ": this dict-index is defined twice" << endl;
- return EXIT_FAILURE;
- }
-
- p->indices.push_back(index);
- found = true;
- break;
- }
- }
- if(!found)
- {
- cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- }
+ vector<string> optargs = opts.argVec("dict-index");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ string dictName;
+ DictIndex index;
+ string::size_type pos;
+
+ string caseString = "case-sensitive";
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dictName = s.substr(0, pos);
+ s.erase(0, pos + 1);
+
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.member = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ caseString = s;
+ }
+ else
+ {
+ if(s == "case-sensitive" || s == "case-insensitive")
+ {
+ caseString = s;
+ }
+ else
+ {
+ index.member = s;
+ }
+ }
+ }
+ else
+ {
+ dictName = s;
+ }
+
+ if(dictName.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(caseString != "case-sensitive" && caseString != "case-insensitive")
+ {
+ cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ index.caseSensitive = (caseString == "case-sensitive");
+
+ bool found = false;
+ for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
+ {
+ if(p->name == dictName)
+ {
+ if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
+ {
+ cerr << argv[0] << ": --dict-index " << *i << ": this dict-index is defined twice" << endl;
+ return EXIT_FAILURE;
+ }
+
+ p->indices.push_back(index);
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ {
+ cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ }
}
string output = opts.optArg("output-dir");
@@ -1365,51 +1365,51 @@ main(int argc, char* argv[])
for(vector<string>::size_type idx = 0; idx < args.size(); ++idx)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], args[idx], cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::Java);
- }
- else
- {
- Preprocessor icecpp(argv[0], args[idx], cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- }
- }
- else
- {
- status = u->parse(cppHandle, debug);
- }
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], args[idx], cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::Java);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], args[idx], cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+ status = u->parse(cppHandle, debug);
+ }
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
}
if(depend)
{
u->destroy();
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
if(status == EXIT_SUCCESS && !preprocess)
@@ -1439,7 +1439,7 @@ main(int argc, char* argv[])
}
}
- for(vector<Index>::const_iterator q = indices.begin(); q != indices.end(); ++q)
+ for(vector<Index>::const_iterator q = indices.begin(); q != indices.end(); ++q)
{
try
{
diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp
index 3c694561ec7..dba70089b34 100644
--- a/cpp/src/slice2html/Gen.cpp
+++ b/cpp/src/slice2html/Gen.cpp
@@ -33,9 +33,9 @@ namespace Slice
void
generate(const UnitPtr& unit, const string& dir,
- const string& header, const string& footer,
- const string& indexHeader, const string& indexFooter,
- const string& imageDir, const string& logoURL, const string& searchAction, unsigned indexCount, unsigned warnSummary)
+ const string& header, const string& footer,
+ const string& indexHeader, const string& indexFooter,
+ const string& imageDir, const string& logoURL, const string& searchAction, unsigned indexCount, unsigned warnSummary)
{
unit->mergeModules();
@@ -110,8 +110,8 @@ Slice::GeneratorBase::setOutputDir(const string& dir)
{
if(!dir.empty())
{
- _dir = dir;
- makeDir(_dir);
+ _dir = dir;
+ makeDir(_dir);
}
}
@@ -215,21 +215,21 @@ Slice::GeneratorBase::openDoc(const string& file, const string& title, const str
string h2;
if(header.empty())
{
- _out << _header1;
+ _out << _header1;
}
else
{
- getHeaders(header, h1, h2);
- _out << h1;
+ getHeaders(header, h1, h2);
+ _out << h1;
}
_out << title;
if(header.empty())
{
- _out << _header2;
+ _out << _header2;
}
else
{
- _out << h2;
+ _out << h2;
}
_indexFooter = getFooter(footer);
_out.inc();
@@ -250,12 +250,12 @@ Slice::GeneratorBase::openDoc(const ContainedPtr& c)
StringList::size_type num = 0;
for(StringList::const_iterator i = components.begin(); i != components.end(); ++i)
{
- path += "/" + *i;
- ++num;
- if(num < components.size())
- {
- makeDir(path);
- }
+ path += "/" + *i;
+ ++num;
+ if(num < components.size())
+ {
+ makeDir(path);
+ }
}
path += ".html";
@@ -286,7 +286,7 @@ Slice::GeneratorBase::start(const std::string& element, const std::string& class
string s = element;
if(!classes.empty())
{
- s += " class=\"" + classes + "\"";
+ s += " class=\"" + classes + "\"";
}
_out << se(s);
}
@@ -299,7 +299,7 @@ Slice::GeneratorBase::end()
void
Slice::GeneratorBase::printComment(const ContainedPtr& p, const ContainerPtr& container,
- const string& deprecateReason, bool forIndex)
+ const string& deprecateReason, bool forIndex)
{
#ifndef NDEBUG
int indent = _out.currIndent();
@@ -314,221 +314,221 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const ContainerPtr& co
string::size_type pos = comment.find_last_not_of(" \t\r\n");
if(pos != string::npos)
{
- comment.erase(pos + 1);
- start("p");
- _out.zeroIndent();
- _out << nl << comment;
- _out.restoreIndent();
- end();
+ comment.erase(pos + 1);
+ start("p");
+ _out.zeroIndent();
+ _out << nl << comment;
+ _out.restoreIndent();
+ end();
}
if(!deprecateReason.empty())
{
- start("p", "Deprecated");
- _out << nl << deprecateReason;
- end();
+ start("p", "Deprecated");
+ _out << nl << deprecateReason;
+ end();
}
assert(_out.currIndent() == indent);
if(!par.empty())
{
- start("h4");
- _out << "Parameters";
- end();
- start("dl");
- for(StringList::const_iterator q = par.begin(); q != par.end(); ++q)
- {
- string term;
- pos = q->find_first_of(" \t\r\n");
- if(pos != string::npos)
- {
- term = q->substr(0, pos);
- }
- string item;
- pos = q->find_first_not_of(" \t\r\n", pos);
- if(pos != string::npos)
- {
- item = q->substr(pos);
- }
-
- start("dt", "Symbol");
- _out << term;
- end();
- start("dd");
- _out << nl << item;
- end();
- }
- end();
+ start("h4");
+ _out << "Parameters";
+ end();
+ start("dl");
+ for(StringList::const_iterator q = par.begin(); q != par.end(); ++q)
+ {
+ string term;
+ pos = q->find_first_of(" \t\r\n");
+ if(pos != string::npos)
+ {
+ term = q->substr(0, pos);
+ }
+ string item;
+ pos = q->find_first_not_of(" \t\r\n", pos);
+ if(pos != string::npos)
+ {
+ item = q->substr(pos);
+ }
+
+ start("dt", "Symbol");
+ _out << term;
+ end();
+ start("dd");
+ _out << nl << item;
+ end();
+ }
+ end();
}
if(!ret.empty())
{
- start("h4");
- _out << "Return Value";
- end();
- start("p");
- _out << ret.front();
- end();
+ start("h4");
+ _out << "Return Value";
+ end();
+ start("p");
+ _out << ret.front();
+ end();
}
if(!throws.empty())
{
- start("h4");
- _out << "Exceptions";
- end();
- start("dl");
- for(StringList::const_iterator q = throws.begin(); q != throws.end(); ++q)
- {
- string term;
- pos = q->find_first_of(" \t\r\n");
- if(pos != string::npos)
- {
- term = q->substr(0, pos);
- }
- string item;
- pos = q->find_first_not_of(" \t\r\n", pos);
- if(pos != string::npos)
- {
- item = q->substr(pos);
- }
-
- start("dt", "Symbol");
- _out << toString(term, container, false, forIndex);
- end();
- start("dd");
- _out << nl << item;
- end();
- }
- end();
+ start("h4");
+ _out << "Exceptions";
+ end();
+ start("dl");
+ for(StringList::const_iterator q = throws.begin(); q != throws.end(); ++q)
+ {
+ string term;
+ pos = q->find_first_of(" \t\r\n");
+ if(pos != string::npos)
+ {
+ term = q->substr(0, pos);
+ }
+ string item;
+ pos = q->find_first_not_of(" \t\r\n", pos);
+ if(pos != string::npos)
+ {
+ item = q->substr(pos);
+ }
+
+ start("dt", "Symbol");
+ _out << toString(term, container, false, forIndex);
+ end();
+ start("dd");
+ _out << nl << item;
+ end();
+ }
+ end();
}
ClassList derivedClasses;
ClassDefPtr def = ClassDefPtr::dynamicCast(p);
if(def)
{
- derivedClasses = p->unit()->findDerivedClasses(def);
+ derivedClasses = p->unit()->findDerivedClasses(def);
}
if(!derivedClasses.empty())
{
- start("h4");
- _out << "Derived Classes and Interfaces";
- end();
- start("dl");
- for(ClassList::const_iterator q = derivedClasses.begin(); q != derivedClasses.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, container, false, forIndex);
- end();
- }
- end();
+ start("h4");
+ _out << "Derived Classes and Interfaces";
+ end();
+ start("dl");
+ for(ClassList::const_iterator q = derivedClasses.begin(); q != derivedClasses.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, container, false, forIndex);
+ end();
+ }
+ end();
}
ExceptionList derivedExceptions;
ExceptionPtr ex = ExceptionPtr::dynamicCast(p);
if(ex)
{
- derivedExceptions = p->unit()->findDerivedExceptions(ex);
- if(!derivedExceptions.empty())
- {
- start("h4");
- _out << "Derived Exceptions";
- end();
- start("dl");
- for(ExceptionList::const_iterator q = derivedExceptions.begin(); q != derivedExceptions.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, container, false, forIndex);
- end();
- }
- end();
- }
-
- ContainedList usedBy;
- usedBy = p->unit()->findUsedBy(ex);
- if(!usedBy.empty())
- {
- start("h4");
- _out << "Used By";
- end();
- start("dl");
- //
- // We first extract the symbol names from the used-by list and sort
- // them, otherwise the symbols appear in random order.
- //
- StringList sl;
- for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
- {
- sl.push_back(toString(*q, container, false, forIndex));
- }
- sl.sort();
- for(StringList::const_iterator r = sl.begin(); r != sl.end(); ++r)
- {
- start("dt", "Symbol");
- _out << *r;
- end();
- }
- end();
- }
+ derivedExceptions = p->unit()->findDerivedExceptions(ex);
+ if(!derivedExceptions.empty())
+ {
+ start("h4");
+ _out << "Derived Exceptions";
+ end();
+ start("dl");
+ for(ExceptionList::const_iterator q = derivedExceptions.begin(); q != derivedExceptions.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, container, false, forIndex);
+ end();
+ }
+ end();
+ }
+
+ ContainedList usedBy;
+ usedBy = p->unit()->findUsedBy(ex);
+ if(!usedBy.empty())
+ {
+ start("h4");
+ _out << "Used By";
+ end();
+ start("dl");
+ //
+ // We first extract the symbol names from the used-by list and sort
+ // them, otherwise the symbols appear in random order.
+ //
+ StringList sl;
+ for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
+ {
+ sl.push_back(toString(*q, container, false, forIndex));
+ }
+ sl.sort();
+ for(StringList::const_iterator r = sl.begin(); r != sl.end(); ++r)
+ {
+ start("dt", "Symbol");
+ _out << *r;
+ end();
+ }
+ end();
+ }
}
ContainedList usedBy;
ConstructedPtr constructed;
if(def)
{
- constructed = def->declaration();
+ constructed = def->declaration();
}
else
{
- constructed = ConstructedPtr::dynamicCast(p);
+ constructed = ConstructedPtr::dynamicCast(p);
}
if(constructed)
{
- usedBy = p->unit()->findUsedBy(constructed);
+ usedBy = p->unit()->findUsedBy(constructed);
}
if(!usedBy.empty())
{
- //
- // We first accumulate the strings in a list instead of printing
- // each stringified entry in the usedBy list. This is necessary because
- // the usedBy list can contain operations and parameters. But toString()
- // on a parameter returns the string for the parameter's operation, so
- // we can end up printing the same operation name more than once.
- //
- StringList strings;
- for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
- {
- strings.push_back(toString(*q, container, false, forIndex));
- }
- strings.sort();
- strings.unique();
-
- start("h4");
- _out << "Used By";
- end();
- start("dl");
- for(list<string>::const_iterator p = strings.begin(); p != strings.end(); ++p)
- {
- start("dt", "Symbol");
- _out << *p;
- end();
- }
- end();
+ //
+ // We first accumulate the strings in a list instead of printing
+ // each stringified entry in the usedBy list. This is necessary because
+ // the usedBy list can contain operations and parameters. But toString()
+ // on a parameter returns the string for the parameter's operation, so
+ // we can end up printing the same operation name more than once.
+ //
+ StringList strings;
+ for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
+ {
+ strings.push_back(toString(*q, container, false, forIndex));
+ }
+ strings.sort();
+ strings.unique();
+
+ start("h4");
+ _out << "Used By";
+ end();
+ start("dl");
+ for(list<string>::const_iterator p = strings.begin(); p != strings.end(); ++p)
+ {
+ start("dt", "Symbol");
+ _out << *p;
+ end();
+ }
+ end();
}
if(!see.empty())
{
- start("h4");
- _out << "See Also";
- end();
- start("dl");
- for(StringList::const_iterator q = see.begin(); q != see.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, container, false, forIndex);
- end();
- }
- end();
+ start("h4");
+ _out << "See Also";
+ end();
+ start("dl");
+ for(StringList::const_iterator q = see.begin(); q != see.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, container, false, forIndex);
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
@@ -541,17 +541,17 @@ Slice::GeneratorBase::printMetaData(const ContainedPtr& p)
if(!metaData.empty())
{
- _out << "[";
- list<string>::const_iterator q = metaData.begin();
- while(q != metaData.end())
- {
- _out << " \"" << *q << "\"";
- if(++q != metaData.end())
- {
- _out << ",";
- }
- }
- _out << " ]" << nl;
+ _out << "[";
+ list<string>::const_iterator q = metaData.begin();
+ while(q != metaData.end())
+ {
+ _out << " \"" << *q << "\"";
+ if(++q != metaData.end())
+ {
+ _out << ",";
+ }
+ }
+ _out << " ]" << nl;
}
}
@@ -561,12 +561,12 @@ Slice::GeneratorBase::printSummary(const ContainedPtr& p, const ContainerPtr& mo
ContainerPtr container = ContainerPtr::dynamicCast(p);
if(!container)
{
- container = p->container();
+ container = p->container();
}
if(module)
{
- container = module;
+ container = module;
}
string summary = getComment(p, container, true, module);
@@ -574,9 +574,9 @@ Slice::GeneratorBase::printSummary(const ContainedPtr& p, const ContainerPtr& mo
if(deprecated)
{
- start("p", "Deprecated");
- _out << nl << "Deprecated.";
- end();
+ start("p", "Deprecated");
+ _out << nl << "Deprecated.";
+ end();
}
}
@@ -589,11 +589,11 @@ Slice::GeneratorBase::printHeaderFooter(const ContainedPtr& c)
ContainedList::const_iterator pos = _symbols.begin();
while(pos != _symbols.end())
{
- if((*pos)->scoped() == scoped)
- {
- break;
- }
- prev = pos++;
+ if((*pos)->scoped() == scoped)
+ {
+ break;
+ }
+ prev = pos++;
}
ContainedList::const_iterator next = pos == _symbols.end() ? _symbols.end() : ++pos;
@@ -607,49 +607,49 @@ Slice::GeneratorBase::printHeaderFooter(const ContainedPtr& c)
string prevClass;
if(!isFirst)
{
- prevLink = getLinkPath(*prev, container, false, onEnumPage) + ".html";
- prevClass = "Button";
+ prevLink = getLinkPath(*prev, container, false, onEnumPage) + ".html";
+ prevClass = "Button";
}
else
{
- prevClass = "ButtonGrey";
+ prevClass = "ButtonGrey";
}
string nextLink;
string nextClass;
if(!isLast)
{
- nextLink = getLinkPath(*next, container, false, onEnumPage) + ".html";
- nextClass = "Button";
+ nextLink = getLinkPath(*next, container, false, onEnumPage) + ".html";
+ nextClass = "Button";
}
else
{
- nextClass = "ButtonGrey";
+ nextClass = "ButtonGrey";
}
string upLink;
string upClass;
if(hasParent)
{
- upLink = getLinkPath(c->container(), container, ModulePtr::dynamicCast(c), onEnumPage) + ".html";
- upClass = "Button";
+ upLink = getLinkPath(c->container(), container, ModulePtr::dynamicCast(c), onEnumPage) + ".html";
+ upClass = "Button";
}
else
{
- upClass = "ButtonGrey";
+ upClass = "ButtonGrey";
}
string homeLink = getLinkPath(0, container, ModulePtr::dynamicCast(c), onEnumPage);
if(!homeLink.empty())
{
- homeLink += "/";
+ homeLink += "/";
}
homeLink += "index.html";
string indexLink = getLinkPath(0, container, ModulePtr::dynamicCast(c), onEnumPage);
if(!indexLink.empty())
{
- indexLink += "/";
+ indexLink += "/";
}
indexLink += "_sindex.html";
@@ -664,18 +664,18 @@ Slice::GeneratorBase::printHeaderFooter(const ContainedPtr& c)
if(!imageDir.empty())
{
- string path = getLinkPath(0, container, ModulePtr::dynamicCast(c), onEnumPage);
- if(!path.empty())
- {
- path += "/";
- }
- path += imageDir + "/";
+ string path = getLinkPath(0, container, ModulePtr::dynamicCast(c), onEnumPage);
+ if(!path.empty())
+ {
+ path += "/";
+ }
+ path += imageDir + "/";
- prevImage = "<img class=\"" + prevClass + "\" src=\"" + path + prevImage + "\" alt=\"Previous\"/>";
- nextImage = "<img class=\"" + nextClass + "\" src=\"" + path + nextImage + "\" alt=\"Next\"/>";
- upImage = "<img class=\"" + upClass + "\" src=\"" + path + upImage + "\" alt=\"Up\"/>";
- homeImage = "<img class=\"Button\" src=\"" + path + homeImage + "\" alt=\"Home\"/>";
- indexImage = "<img class=\"Button\" src=\"" + path + indexImage + "\" alt=\"Index\"/>";
+ prevImage = "<img class=\"" + prevClass + "\" src=\"" + path + prevImage + "\" alt=\"Previous\"/>";
+ nextImage = "<img class=\"" + nextClass + "\" src=\"" + path + nextImage + "\" alt=\"Next\"/>";
+ upImage = "<img class=\"" + upClass + "\" src=\"" + path + upImage + "\" alt=\"Up\"/>";
+ homeImage = "<img class=\"Button\" src=\"" + path + homeImage + "\" alt=\"Home\"/>";
+ indexImage = "<img class=\"Button\" src=\"" + path + indexImage + "\" alt=\"Index\"/>";
}
start("div", "HeaderFooter");
@@ -689,47 +689,47 @@ Slice::GeneratorBase::printHeaderFooter(const ContainedPtr& c)
if(!imageDir.empty() || !isFirst)
{
- start("td");
- if(!isFirst)
- {
- _out << "<a href=\"" << prevLink << "\">";
- }
- _out << prevImage;
- if(!isFirst)
- {
- _out << "</a>";
- }
- end();
+ start("td");
+ if(!isFirst)
+ {
+ _out << "<a href=\"" << prevLink << "\">";
+ }
+ _out << prevImage;
+ if(!isFirst)
+ {
+ _out << "</a>";
+ }
+ end();
}
if(!imageDir.empty() || hasParent)
{
- start("td");
- if(hasParent)
- {
- _out << "<a href=\"" << upLink << "\">";
- }
- _out << upImage;
- if(hasParent)
- {
- _out << "</a>";
- }
- end();
+ start("td");
+ if(hasParent)
+ {
+ _out << "<a href=\"" << upLink << "\">";
+ }
+ _out << upImage;
+ if(hasParent)
+ {
+ _out << "</a>";
+ }
+ end();
}
if(!imageDir.empty() || !isLast)
{
- start("td");
- if(!isLast)
- {
- _out << "<a href=\"" << nextLink << "\">";
- }
- _out << nextImage;
- if(!isLast)
- {
- _out << "</a>";
- }
- end();
+ start("td");
+ if(!isLast)
+ {
+ _out << "<a href=\"" << nextLink << "\">";
+ }
+ _out << nextImage;
+ if(!isLast)
+ {
+ _out << "</a>";
+ }
+ end();
}
start("td");
@@ -779,33 +779,33 @@ Slice::GeneratorBase::printLogo(const ContainedPtr& c, const ContainerPtr& conta
string imageDir = getImageDir();
if(!imageDir.empty())
{
- string path = getLinkPath(0, container, ModulePtr::dynamicCast(c), forEnum);
- if(!path.empty())
- {
- path += "/";
- }
- path += imageDir + "/logo.gif";
- start("table", "LogoTable");
- start("tr");
- start("td");
- if(!_logoURL.empty())
- {
- _out << "<a href=\"" + _logoURL + "\">";
- }
- _out << "<img class=\"Logo\" src=\"" + path + "\" alt=\"Logo\"/>";
- if(!_logoURL.empty())
- {
- _out << "</a>";
- }
- end();
- end();
- end();
+ string path = getLinkPath(0, container, ModulePtr::dynamicCast(c), forEnum);
+ if(!path.empty())
+ {
+ path += "/";
+ }
+ path += imageDir + "/logo.gif";
+ start("table", "LogoTable");
+ start("tr");
+ start("td");
+ if(!_logoURL.empty())
+ {
+ _out << "<a href=\"" + _logoURL + "\">";
+ }
+ _out << "<img class=\"Logo\" src=\"" + path + "\" alt=\"Logo\"/>";
+ if(!_logoURL.empty())
+ {
+ _out << "</a>";
+ }
+ end();
+ end();
+ end();
}
}
string
Slice::GeneratorBase::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container, bool asTarget, bool forIndex,
- unsigned* summarySize, bool shortName)
+ unsigned* summarySize, bool shortName)
{
string anchor;
string linkpath;
@@ -813,149 +813,149 @@ Slice::GeneratorBase::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& c
static const char* builtinTable[] =
{
- "byte",
- "bool",
- "short",
- "int",
- "long",
- "float",
- "double",
- "string",
- "Object",
- "Object*",
- "LocalObject"
+ "byte",
+ "bool",
+ "short",
+ "int",
+ "long",
+ "float",
+ "double",
+ "string",
+ "Object",
+ "Object*",
+ "LocalObject"
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
if(builtin)
{
- s = builtinTable[builtin->kind()];
- return s;
+ s = builtinTable[builtin->kind()];
+ return s;
}
ProxyPtr proxy = ProxyPtr::dynamicCast(p);
if(proxy)
{
- if(_files.find(p->definitionContext()->filename()) != _files.end())
- {
- linkpath = getLinkPath(proxy->_class()->definition(), container, forIndex);
- }
- s = getScopedMinimized(proxy->_class(), container, shortName);
+ if(_files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ linkpath = getLinkPath(proxy->_class()->definition(), container, forIndex);
+ }
+ s = getScopedMinimized(proxy->_class(), container, shortName);
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(p);
if(cl)
{
- //
+ //
// We must generate the id from the definition, not from the
// declaration, provided that a definition is available.
- //
- ContainedPtr definition = cl->definition();
- if(definition && _files.find(p->definitionContext()->filename()) != _files.end())
- {
- linkpath = getLinkPath(definition, container, forIndex);
- }
- s = getScopedMinimized(cl, container, shortName);
+ //
+ ContainedPtr definition = cl->definition();
+ if(definition && _files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ linkpath = getLinkPath(definition, container, forIndex);
+ }
+ s = getScopedMinimized(cl, container, shortName);
}
ExceptionPtr ex = ExceptionPtr::dynamicCast(p);
if(ex)
{
- if(_files.find(p->definitionContext()->filename()) != _files.end())
- {
- linkpath = getLinkPath(ex, container, forIndex);
- }
- s = getScopedMinimized(ex, container, shortName);
+ if(_files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ linkpath = getLinkPath(ex, container, forIndex);
+ }
+ s = getScopedMinimized(ex, container, shortName);
}
StructPtr st = StructPtr::dynamicCast(p);
if(st)
{
- if(_files.find(p->definitionContext()->filename()) != _files.end())
- {
- linkpath = getLinkPath(st, container, forIndex);
- }
- s = getScopedMinimized(st, container, shortName);
+ if(_files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ linkpath = getLinkPath(st, container, forIndex);
+ }
+ s = getScopedMinimized(st, container, shortName);
}
EnumeratorPtr en = EnumeratorPtr::dynamicCast(p);
if(en)
{
- if(_files.find(p->definitionContext()->filename()) != _files.end())
- {
- anchor = getAnchor(en);
- linkpath = getLinkPath(en, container, forIndex);
- }
- s = getScopedMinimized(en, container, shortName);
+ if(_files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ anchor = getAnchor(en);
+ linkpath = getLinkPath(en, container, forIndex);
+ }
+ s = getScopedMinimized(en, container, shortName);
}
OperationPtr op = OperationPtr::dynamicCast(p);
if(op)
{
- if(_files.find(p->definitionContext()->filename()) != _files.end())
- {
- anchor = getAnchor(op);
- linkpath = getLinkPath(op, container, forIndex);
- }
- s = getScopedMinimized(op, container, shortName);
+ if(_files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ anchor = getAnchor(op);
+ linkpath = getLinkPath(op, container, forIndex);
+ }
+ s = getScopedMinimized(op, container, shortName);
}
ParamDeclPtr pd = ParamDeclPtr::dynamicCast(p);
if(pd)
{
- op = OperationPtr::dynamicCast(pd->container());
- assert(op);
- if(_files.find(p->definitionContext()->filename()) != _files.end())
- {
- anchor = getAnchor(op);
- linkpath = getLinkPath(op, container, forIndex);
- }
- s = getScopedMinimized(op, container, shortName);
+ op = OperationPtr::dynamicCast(pd->container());
+ assert(op);
+ if(_files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ anchor = getAnchor(op);
+ linkpath = getLinkPath(op, container, forIndex);
+ }
+ s = getScopedMinimized(op, container, shortName);
}
if(s.empty())
{
- ContainedPtr contained = ContainedPtr::dynamicCast(p);
- assert(contained);
- if(_files.find(p->definitionContext()->filename()) != _files.end())
- {
- if(!(EnumPtr::dynamicCast(p) || ModulePtr::dynamicCast(p) || ClassDeclPtr::dynamicCast(p)))
- {
- anchor = getAnchor(contained);
- }
-
- //
- // Sequences and dictionaries are documented on the page for their
- // enclosing module.
- //
- if(SequencePtr::dynamicCast(p) || DictionaryPtr::dynamicCast(p))
- {
- linkpath = getLinkPath(contained->container(), container, forIndex);
- }
- else
- {
- linkpath = getLinkPath(contained, container, forIndex);
- }
- }
- s = getScopedMinimized(contained, container, shortName);
+ ContainedPtr contained = ContainedPtr::dynamicCast(p);
+ assert(contained);
+ if(_files.find(p->definitionContext()->filename()) != _files.end())
+ {
+ if(!(EnumPtr::dynamicCast(p) || ModulePtr::dynamicCast(p) || ClassDeclPtr::dynamicCast(p)))
+ {
+ anchor = getAnchor(contained);
+ }
+
+ //
+ // Sequences and dictionaries are documented on the page for their
+ // enclosing module.
+ //
+ if(SequencePtr::dynamicCast(p) || DictionaryPtr::dynamicCast(p))
+ {
+ linkpath = getLinkPath(contained->container(), container, forIndex);
+ }
+ else
+ {
+ linkpath = getLinkPath(contained, container, forIndex);
+ }
+ }
+ s = getScopedMinimized(contained, container, shortName);
}
if(summarySize)
{
- *summarySize = s.size();
+ *summarySize = s.size();
}
if(linkpath.empty() && anchor.empty())
{
- if(ProxyPtr::dynamicCast(p))
- {
- s += '*';
- if(summarySize)
- {
- ++(*summarySize);
- }
- }
- return s;
+ if(ProxyPtr::dynamicCast(p))
+ {
+ s += '*';
+ if(summarySize)
+ {
+ ++(*summarySize);
+ }
+ }
+ return s;
}
string ret = "<a class=\"Symbol\" ";
@@ -963,46 +963,46 @@ Slice::GeneratorBase::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& c
ret += "=\"";
if(asTarget)
{
- ret += anchor;
+ ret += anchor;
}
else
{
- ret += linkpath;
- if(!linkpath.empty())
- {
- ret += ".html";
- }
- if(!anchor.empty())
- {
- ret += "#" + anchor;
- }
+ ret += linkpath;
+ if(!linkpath.empty())
+ {
+ ret += ".html";
+ }
+ if(!anchor.empty())
+ {
+ ret += "#" + anchor;
+ }
}
ret += "\">";
ret += s;
ret += "</a>";
if(ProxyPtr::dynamicCast(p))
{
- ret += '*';
+ ret += '*';
}
return ret;
}
string
Slice::GeneratorBase::toString(const string& str, const ContainerPtr& container, bool asTarget, bool forIndex,
- unsigned* summarySize)
+ unsigned* summarySize)
{
string s = str;
TypeList types = container->lookupType(s, false);
if(!types.empty())
{
- return toString(types.front(), container, asTarget, forIndex, summarySize);
+ return toString(types.front(), container, asTarget, forIndex, summarySize);
}
ContainedList contList = container->lookupContained(s, false);
if(!contList.empty())
{
- return toString(contList.front(), container, asTarget, forIndex, summarySize);
+ return toString(contList.front(), container, asTarget, forIndex, summarySize);
}
//
@@ -1014,52 +1014,52 @@ Slice::GeneratorBase::toString(const string& str, const ContainerPtr& container,
string
Slice::GeneratorBase::getComment(const ContainedPtr& contained, const ContainerPtr& container,
- bool summary, bool forIndex)
+ bool summary, bool forIndex)
{
unsigned summarySize = 0;
string s = contained->comment();
string comment;
for(unsigned int i = 0; i < s.size(); ++i)
{
- if(s[i] == '\\' && i + 1 < s.size() && s[i + 1] == '[')
- {
- comment += '[';
- ++summarySize;
- ++i;
- }
- else if(s[i] == '[')
- {
- string literal;
- for(++i; i < s.size(); ++i)
- {
- if(s[i] == ']')
- {
- break;
- }
-
- literal += s[i];
- }
- unsigned sz = 0;
- comment += toString(literal, container, false, forIndex, summary ? &sz : 0);
- summarySize += sz;
- }
- else if(summary && s[i] == '.' && (i + 1 >= s.size() || isspace(s[i + 1])))
- {
- comment += '.';
- ++summarySize;
- break;
- }
- else
- {
- comment += s[i];
- ++summarySize;
- }
+ if(s[i] == '\\' && i + 1 < s.size() && s[i + 1] == '[')
+ {
+ comment += '[';
+ ++summarySize;
+ ++i;
+ }
+ else if(s[i] == '[')
+ {
+ string literal;
+ for(++i; i < s.size(); ++i)
+ {
+ if(s[i] == ']')
+ {
+ break;
+ }
+
+ literal += s[i];
+ }
+ unsigned sz = 0;
+ comment += toString(literal, container, false, forIndex, summary ? &sz : 0);
+ summarySize += sz;
+ }
+ else if(summary && s[i] == '.' && (i + 1 >= s.size() || isspace(s[i + 1])))
+ {
+ comment += '.';
+ ++summarySize;
+ break;
+ }
+ else
+ {
+ comment += s[i];
+ ++summarySize;
+ }
}
if(summary && _warnSummary && summarySize > _warnSummary)
{
- cerr << contained->definitionContext()->filename() << ": summary size (" << summarySize << ") exceeds "
- << _warnSummary << " characters: `" << comment << "'" << endl;
+ cerr << contained->definitionContext()->filename() << ": summary size (" << summarySize << ") exceeds "
+ << _warnSummary << " characters: `" << comment << "'" << endl;
}
return comment;
@@ -1072,11 +1072,11 @@ Slice::GeneratorBase::getAnchor(const SyntaxTreeBasePtr& p)
string anchor;
for(StringList::const_iterator i = symbols.begin(); i != symbols.end(); ++i)
{
- if(i != symbols.begin())
- {
- anchor += "::";
- }
- anchor += *i;
+ if(i != symbols.begin())
+ {
+ anchor += "::";
+ }
+ anchor += *i;
}
return anchor;
}
@@ -1092,7 +1092,7 @@ Slice::GeneratorBase::getLinkPath(const SyntaxTreeBasePtr& p, const ContainerPtr
//
if(forIndex && ContainedPtr::dynamicCast(container))
{
- c = ContainedPtr::dynamicCast(c)->container();
+ c = ContainedPtr::dynamicCast(c)->container();
}
//
@@ -1103,32 +1103,32 @@ Slice::GeneratorBase::getLinkPath(const SyntaxTreeBasePtr& p, const ContainerPtr
EnumeratorPtr enumerator = EnumeratorPtr::dynamicCast(p);
if(enumerator)
{
- target = toStringList(enumerator->type());
+ target = toStringList(enumerator->type());
}
else
{
- target = getContainer(p);
+ target = getContainer(p);
}
StringList from = getContainer(c);
while(!target.empty() && !from.empty() && target.front() == from.front())
{
- target.pop_front();
- from.pop_front();
- commonEnclosingScope = true;
+ target.pop_front();
+ from.pop_front();
+ commonEnclosingScope = true;
}
if(commonEnclosingScope && target.empty())
{
- ModulePtr module = ModulePtr::dynamicCast(p);
- if(module)
- {
- target.push_front(module->name());
- }
+ ModulePtr module = ModulePtr::dynamicCast(p);
+ if(module)
+ {
+ target.push_front(module->name());
+ }
}
else if(!from.empty())
{
- from.pop_front();
+ from.pop_front();
}
//
@@ -1137,12 +1137,12 @@ Slice::GeneratorBase::getLinkPath(const SyntaxTreeBasePtr& p, const ContainerPtr
string path;
while(!from.empty())
{
- if(!path.empty())
- {
- path += "/";
- }
- path += "..";
- from.pop_front();
+ if(!path.empty())
+ {
+ path += "/";
+ }
+ path += "..";
+ from.pop_front();
}
//
@@ -1150,24 +1150,24 @@ Slice::GeneratorBase::getLinkPath(const SyntaxTreeBasePtr& p, const ContainerPtr
//
while(!target.empty())
{
- if(!path.empty())
- {
- path += "/";
- }
- path += target.front() == "index" ? string("_index") : target.front();
- target.pop_front();
+ if(!path.empty())
+ {
+ path += "/";
+ }
+ path += target.front() == "index" ? string("_index") : target.front();
+ target.pop_front();
}
if(forEnum)
{
- if(!path.empty())
- {
- path = "../" + path;
- }
- else
- {
- path = "..";
- }
+ if(!path.empty())
+ {
+ path = "../" + path;
+ }
+ else
+ {
+ path = "..";
+ }
}
return path;
}
@@ -1190,8 +1190,8 @@ Slice::GeneratorBase::openStream(const string& path)
_out.open(path.c_str());
if(!_out.isOpen())
{
- string err = "cannot open `" + path + "' for writing";
- throw err;
+ string err = "cannot open `" + path + "' for writing";
+ throw err;
}
}
@@ -1203,7 +1203,7 @@ Slice::GeneratorBase::containedToId(const ContainedPtr& contained, bool asTarget
string scoped = contained->scoped();
if(scoped[0] == ':')
{
- scoped.erase(0, 2);
+ scoped.erase(0, 2);
}
string id;
@@ -1211,15 +1211,15 @@ Slice::GeneratorBase::containedToId(const ContainedPtr& contained, bool asTarget
for(unsigned int i = 0; i < scoped.size(); ++i)
{
- if(scoped[i] == ':')
- {
- id += '.';
- ++i;
- }
- else
- {
- id += scoped[i];
- }
+ if(scoped[i] == ':')
+ {
+ id += '.';
+ ++i;
+ }
+ else
+ {
+ id += scoped[i];
+ }
}
//
@@ -1227,7 +1227,7 @@ Slice::GeneratorBase::containedToId(const ContainedPtr& contained, bool asTarget
//
if(id[0] == '.')
{
- id.erase(0, 1);
+ id.erase(0, 1);
}
return '"' + id + '"';
@@ -1240,29 +1240,29 @@ Slice::GeneratorBase::getTagged(const string& tag, string& comment)
string::size_type begin = 0;
while(begin < comment.size())
{
- begin = comment.find("@" + tag, begin);
- if(begin == string::npos)
- {
- return result;
- }
-
- string::size_type pos1 = comment.find_first_not_of(" \t\r\n", begin + tag.size() + 1);
- if(pos1 == string::npos)
- {
- comment.erase(begin);
- return result;
- }
-
- string::size_type pos2 = comment.find('@', pos1);
- string line = comment.substr(pos1, pos2 - pos1);
- comment.erase(begin, pos2 - 1 - begin);
-
- string::size_type pos3 = line.find_last_not_of(" \t\r\n");
- if(pos3 != string::npos)
- {
- line.erase(pos3 + 1);
- }
- result.push_back(line);
+ begin = comment.find("@" + tag, begin);
+ if(begin == string::npos)
+ {
+ return result;
+ }
+
+ string::size_type pos1 = comment.find_first_not_of(" \t\r\n", begin + tag.size() + 1);
+ if(pos1 == string::npos)
+ {
+ comment.erase(begin);
+ return result;
+ }
+
+ string::size_type pos2 = comment.find('@', pos1);
+ string line = comment.substr(pos1, pos2 - pos1);
+ comment.erase(begin, pos2 - 1 - begin);
+
+ string::size_type pos3 = line.find_last_not_of(" \t\r\n");
+ if(pos3 != string::npos)
+ {
+ line.erase(pos3 + 1);
+ }
+ result.push_back(line);
}
return result;
@@ -1273,7 +1273,7 @@ Slice::GeneratorBase::getScopedMinimized(const ContainedPtr& contained, const Co
{
if(shortName)
{
- return contained->name();
+ return contained->name();
}
string s = contained->scoped();
@@ -1282,21 +1282,21 @@ Slice::GeneratorBase::getScopedMinimized(const ContainedPtr& contained, const Co
if(!q) // Container is the global module
{
- return s.substr(2);
+ return s.substr(2);
}
do
{
- string s2 = q->scoped();
- s2 += "::";
+ string s2 = q->scoped();
+ s2 += "::";
- if(s.find(s2) == 0)
- {
- return s.substr(s2.size());
- }
+ if(s.find(s2) == 0)
+ {
+ return s.substr(s2.size());
+ }
- p = q->container();
- q = ContainedPtr::dynamicCast(p);
+ p = q->container();
+ q = ContainedPtr::dynamicCast(p);
}
while(q);
@@ -1309,17 +1309,17 @@ Slice::GeneratorBase::getContained(const SyntaxTreeBasePtr& p)
StringList result;
if(!p)
{
- return result;
+ return result;
}
SyntaxTreeBasePtr c = p;
do
{
- ContainedPtr contained = ContainedPtr::dynamicCast(c);
- assert(contained);
- result.push_front(contained->name());
- c = contained->container();
+ ContainedPtr contained = ContainedPtr::dynamicCast(c);
+ assert(contained);
+ result.push_front(contained->name());
+ c = contained->container();
}
while(!ContainerPtr::dynamicCast(c));
return result;
@@ -1332,24 +1332,24 @@ Slice::GeneratorBase::getContainer(const SyntaxTreeBasePtr& p)
if(!p)
{
- return result;
+ return result;
}
ContainedPtr contained = ContainedPtr::dynamicCast(p);
while(contained &&
- !ModulePtr::dynamicCast(contained) &&
- !ExceptionPtr::dynamicCast(contained) &&
- !ClassDefPtr::dynamicCast(contained) &&
- !StructPtr::dynamicCast(contained) &&
- !EnumPtr::dynamicCast(contained))
+ !ModulePtr::dynamicCast(contained) &&
+ !ExceptionPtr::dynamicCast(contained) &&
+ !ClassDefPtr::dynamicCast(contained) &&
+ !StructPtr::dynamicCast(contained) &&
+ !EnumPtr::dynamicCast(contained))
{
- contained = ContainedPtr::dynamicCast(contained->container());
+ contained = ContainedPtr::dynamicCast(contained->container());
}
while(contained)
{
- result.push_front(contained->name());
- contained = ContainedPtr::dynamicCast(contained->container());
+ result.push_front(contained->name());
+ contained = ContainedPtr::dynamicCast(contained->container());
}
return result;
}
@@ -1367,13 +1367,13 @@ Slice::GeneratorBase::toStringList(const ContainedPtr& c)
string::size_type endpos;
while((endpos = scoped.find("::", next)) != string::npos)
{
- ids.push_back(scoped.substr(next, endpos - next));
- next = endpos;
- if(next != string::npos)
- {
- ++next;
- ++next;
- }
+ ids.push_back(scoped.substr(next, endpos - next));
+ next = endpos;
+ if(next != string::npos)
+ {
+ ++next;
+ ++next;
+ }
}
ids.push_back(scoped.substr(next));
@@ -1387,7 +1387,7 @@ Slice::GeneratorBase::makeDir(const string& dir)
int rc = stat(dir.c_str(), &st);
if(rc == 0)
{
- return;
+ return;
}
#ifdef _WIN32
rc = mkdir(dir.c_str());
@@ -1396,8 +1396,8 @@ Slice::GeneratorBase::makeDir(const string& dir)
#endif
if(rc != 0)
{
- string err = "cannot create directory `" + dir + "'";
- throw err;
+ string err = "cannot create directory `" + dir + "'";
+ throw err;
}
}
@@ -1407,8 +1407,8 @@ Slice::GeneratorBase::readFile(const string& file)
ifstream in(file.c_str());
if(!in)
{
- string err = "cannot open `" + file + "' for reading";
- throw err;
+ string err = "cannot open `" + file + "' for reading";
+ throw err;
}
ostringstream result;
@@ -1416,8 +1416,8 @@ Slice::GeneratorBase::readFile(const string& file)
getline(in, line);
while(!line.empty())
{
- result << line << '\n';
- getline(in, line);
+ result << line << '\n';
+ getline(in, line);
}
return result.str();
@@ -1428,32 +1428,32 @@ Slice::GeneratorBase::getHeaders(const string& header, string& h1, string& h2)
{
if(header.empty())
{
- ostringstream hdr1;
- XMLOutput O1(hdr1);
- O1 << "<!-- Generated by Ice version " << ICE_STRING_VERSION << " -->";
- O1 << sp;
- O1 << nl << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";
- O1 << se("html");
- O1 << se("head");
- O1 << se("title") << nl;
- h1 = hdr1.str();
-
- // _header1 and _header2 store the bit preceding and following the title.
- // _header1, the title text, and _header2 are written by openDoc().
-
- ostringstream hdr2;
- XMLOutput O2(hdr2);
- O2.inc();
- O2.inc();
- O2 << nl << "</title>";
- O2.dec();
- O2 << nl << "</head>";
- O2 << nl << "<body>";
- h2 = hdr2.str();
+ ostringstream hdr1;
+ XMLOutput O1(hdr1);
+ O1 << "<!-- Generated by Ice version " << ICE_STRING_VERSION << " -->";
+ O1 << sp;
+ O1 << nl << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";
+ O1 << se("html");
+ O1 << se("head");
+ O1 << se("title") << nl;
+ h1 = hdr1.str();
+
+ // _header1 and _header2 store the bit preceding and following the title.
+ // _header1, the title text, and _header2 are written by openDoc().
+
+ ostringstream hdr2;
+ XMLOutput O2(hdr2);
+ O2.inc();
+ O2.inc();
+ O2 << nl << "</title>";
+ O2.dec();
+ O2 << nl << "</head>";
+ O2 << nl << "<body>";
+ h2 = hdr2.str();
}
else
{
- readFile(header, h1, h2);
+ readFile(header, h1, h2);
}
}
@@ -1464,11 +1464,11 @@ Slice::GeneratorBase::getFooter(const string& footer)
XMLOutput O(ftr);
if(footer.empty())
{
- O << " </body>";
+ O << " </body>";
}
else
{
- O << readFile(footer);
+ O << readFile(footer);
}
O << nl << "</html>";
return ftr.str();
@@ -1480,8 +1480,8 @@ Slice::GeneratorBase::readFile(const string& file, string& part1, string& part2)
ifstream in(file.c_str());
if(!in)
{
- string err = "cannot open `" + file + "' for reading";
- throw err;
+ string err = "cannot open `" + file + "' for reading";
+ throw err;
}
string line;
@@ -1490,28 +1490,28 @@ Slice::GeneratorBase::readFile(const string& file, string& part1, string& part2)
ostringstream p1;
while(!foundTitle && getline(in, line))
{
- if(line == "TITLE")
- {
- foundTitle = true;
- }
- else
- {
- p1 << line << '\n';
- }
+ if(line == "TITLE")
+ {
+ foundTitle = true;
+ }
+ else
+ {
+ p1 << line << '\n';
+ }
}
part1 = p1.str();
if(!foundTitle)
{
- string err = "no TITLE marker in `" + file + "'";
- throw err;
+ string err = "no TITLE marker in `" + file + "'";
+ throw err;
}
ostringstream p2;
p2 << endl;
while(getline(in, line))
{
- p2 << line << '\n';
+ p2 << line << '\n';
}
part2 = p2.str();
}
@@ -1539,12 +1539,12 @@ Slice::StartPageGenerator::~StartPageGenerator()
start("dl");
for(ModuleDescriptions::const_iterator i = _modules.begin(); i != _modules.end(); ++i)
{
- start("dt", "Symbol");
- _out << i->first;
- end();
- start("dd");
- _out << i->second;
- end();
+ start("dt", "Symbol");
+ _out << i->first;
+ end();
+ start("dd");
+ _out << i->second;
+ end();
}
end();
@@ -1573,12 +1573,12 @@ Slice::StartPageGenerator::printHeaderFooter()
string imageDir = getImageDir();
if(imageDir.empty())
{
- _out << "<a href=\"_sindex.html\">Index</a>";
+ _out << "<a href=\"_sindex.html\">Index</a>";
}
else
{
- string src = imageDir + "/index.gif";
- _out << "<a href=\"_sindex.html\"><img class=\"Button\" src=\"" + src + "\" alt=\"Index Button\"/></a>";
+ string src = imageDir + "/index.gif";
+ _out << "<a href=\"_sindex.html\"><img class=\"Button\" src=\"" + src + "\" alt=\"Index Button\"/></a>";
}
end();
end();
@@ -1588,22 +1588,22 @@ Slice::StartPageGenerator::printHeaderFooter()
if(!imageDir.empty())
{
- start("table", "LogoTable");
- start("tr");
- start("td");
- string logoURL = getLogoURL();
- if(!logoURL.empty())
- {
- _out << "<a href=\"" + logoURL + "\">";
- }
- _out << "<img class=\"Logo\" src=\"" + imageDir + "/logo.gif\" alt=\"Logo\"/>";
- if(!logoURL.empty())
- {
- _out << "</a>";
- }
- end();
- end();
- end();
+ start("table", "LogoTable");
+ start("tr");
+ start("td");
+ string logoURL = getLogoURL();
+ if(!logoURL.empty())
+ {
+ _out << "<a href=\"" + logoURL + "\">";
+ }
+ _out << "<img class=\"Logo\" src=\"" + imageDir + "/logo.gif\" alt=\"Logo\"/>";
+ if(!logoURL.empty())
+ {
+ _out << "</a>";
+ }
+ end();
+ end();
+ end();
}
end();
@@ -1731,7 +1731,7 @@ TOCGenerator::writeTOC()
_out.inc();
for(ModuleList::const_iterator i = _modules.begin(); i != _modules.end(); ++i)
{
- writeEntry(*i);
+ writeEntry(*i);
}
_out.dec();
_out << nl << "</ul>";
@@ -1757,89 +1757,89 @@ TOCGenerator::writeEntry(const ContainedPtr& c)
ModulePtr m = ModulePtr::dynamicCast(c);
if(m)
{
- cl = m->contents();
+ cl = m->contents();
}
EnumPtr en = EnumPtr::dynamicCast(c);
if(en)
{
- EnumeratorList enumerators = en->getEnumerators();
- for(EnumeratorList::const_iterator i = enumerators.begin(); i != enumerators.end(); ++i)
- {
- cl.push_back(*i);
- }
+ EnumeratorList enumerators = en->getEnumerators();
+ for(EnumeratorList::const_iterator i = enumerators.begin(); i != enumerators.end(); ++i)
+ {
+ cl.push_back(*i);
+ }
}
StructPtr s = StructPtr::dynamicCast(c);
if(s)
{
- DataMemberList dml = s->dataMembers();
- for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
- {
- cl.push_back(*i);
- }
+ DataMemberList dml = s->dataMembers();
+ for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
+ {
+ cl.push_back(*i);
+ }
}
ExceptionPtr e = ExceptionPtr::dynamicCast(c);
if(e)
{
- DataMemberList dml = e->dataMembers();
- for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
- {
- cl.push_back(*i);
- }
+ DataMemberList dml = e->dataMembers();
+ for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
+ {
+ cl.push_back(*i);
+ }
}
ClassDefPtr cdef = ClassDefPtr::dynamicCast(c);
if(!cdef)
{
- ClassDeclPtr cdec = ClassDeclPtr::dynamicCast(c);
- if(cdec)
- {
- cdef = cdec->definition();
- }
+ ClassDeclPtr cdec = ClassDeclPtr::dynamicCast(c);
+ if(cdec)
+ {
+ cdef = cdec->definition();
+ }
}
if(cdef)
{
- DataMemberList dml = cdef->dataMembers();
- for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
- {
- cl.push_back(*i);
- }
- OperationList ol = cdef->operations();
- for(OperationList::const_iterator j = ol.begin(); j != ol.end(); ++j)
- {
- cl.push_back(*j);
- }
+ DataMemberList dml = cdef->dataMembers();
+ for(DataMemberList::const_iterator i = dml.begin(); i != dml.end(); ++i)
+ {
+ cl.push_back(*i);
+ }
+ OperationList ol = cdef->operations();
+ for(OperationList::const_iterator j = ol.begin(); j != ol.end(); ++j)
+ {
+ cl.push_back(*j);
+ }
}
start("li");
if(!cl.empty())
{
- cl.sort();
- cl.unique();
+ cl.sort();
+ cl.unique();
- _out << nl << toString(c, 0, false, true, 0, true);
- start("ul");
- for(ContainedList::const_iterator i = cl.begin(); i != cl.end(); ++i)
- {
- writeEntry(*i);
- }
- end();
+ _out << nl << toString(c, 0, false, true, 0, true);
+ start("ul");
+ for(ContainedList::const_iterator i = cl.begin(); i != cl.end(); ++i)
+ {
+ writeEntry(*i);
+ }
+ end();
}
else
{
- _out << nl << toString(c, 0, false, true, 0, true);
+ _out << nl << toString(c, 0, false, true, 0, true);
}
if(ModulePtr::dynamicCast(c) || ExceptionPtr::dynamicCast(c) || ClassDefPtr::dynamicCast(c) ||
StructPtr::dynamicCast(c) || EnumPtr::dynamicCast(c))
{
- _symbols.push_back(c);
+ _symbols.push_back(c);
}
else if(ClassDeclPtr::dynamicCast(c))
{
- _symbols.push_back(ClassDeclPtr::dynamicCast(c)->definition());
+ _symbols.push_back(ClassDeclPtr::dynamicCast(c)->definition());
}
end();
}
@@ -1898,11 +1898,11 @@ Slice::ModuleGenerator::generate(const ModulePtr& m)
string metadata, deprecateReason;
if(m->findMetaData("deprecate", metadata))
{
- deprecateReason = "This module is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This module is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
start("h2");
_out << "Overview";
@@ -1935,21 +1935,21 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!modules.empty())
{
- start("h2");
- _out << "Module Index";
- end();
- start("dl");
- for(ModuleList::const_iterator q = modules.begin(); q != modules.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Module Index";
+ end();
+ start("dl");
+ for(ModuleList::const_iterator q = modules.begin(); q != modules.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
@@ -1958,48 +1958,48 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
ClassList classes;
ClassList interfaces;
remove_copy_if(classesAndInterfaces.begin(), classesAndInterfaces.end(), back_inserter(classes),
- ::IceUtil::constMemFun(&ClassDef::isInterface));
+ ::IceUtil::constMemFun(&ClassDef::isInterface));
remove_copy_if(classesAndInterfaces.begin(), classesAndInterfaces.end(), back_inserter(interfaces),
- not1(::IceUtil::constMemFun(&ClassDef::isInterface)));
+ not1(::IceUtil::constMemFun(&ClassDef::isInterface)));
if(!classes.empty())
{
- start("h2");
- _out << "Class Index";
- end();
- start("dl");
- for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Class Index";
+ end();
+ start("dl");
+ for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
if(!interfaces.empty())
{
- start("h2");
- _out << "Interface Index";
- end();
- start("dl");
- for(ClassList::const_iterator q = interfaces.begin(); q != interfaces.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Interface Index";
+ end();
+ start("dl");
+ for(ClassList::const_iterator q = interfaces.begin(); q != interfaces.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
@@ -2008,21 +2008,21 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!exceptions.empty())
{
- start("h2");
- _out << "Exception Index";
- end();
- start("dl");
- for(ExceptionList::const_iterator q = exceptions.begin(); q != exceptions.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Exception Index";
+ end();
+ start("dl");
+ for(ExceptionList::const_iterator q = exceptions.begin(); q != exceptions.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
@@ -2031,21 +2031,21 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!structs.empty())
{
- start("h2");
- _out << "Structure Index";
- end();
- start("dl");
- for(StructList::const_iterator q = structs.begin(); q != structs.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Structure Index";
+ end();
+ start("dl");
+ for(StructList::const_iterator q = structs.begin(); q != structs.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
@@ -2054,21 +2054,21 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!sequences.empty())
{
- start("h2");
- _out << "Sequence Index";
- end();
- start("dl");
- for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Sequence Index";
+ end();
+ start("dl");
+ for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
@@ -2077,21 +2077,21 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!dictionaries.empty())
{
- start("h2");
- _out << "Dictionary Index";
- end();
- start("dl");
- for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Dictionary Index";
+ end();
+ start("dl");
+ for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
@@ -2100,99 +2100,99 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!enums.empty())
{
- start("h2");
- _out << "Enumeration Index";
- end();
- start("dl");
- for(EnumList::const_iterator q = enums.begin(); q != enums.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, p, false, true);
- end();
- start("dd");
- string metadata;
- printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Enumeration Index";
+ end();
+ start("dl");
+ for(EnumList::const_iterator q = enums.begin(); q != enums.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
assert(_out.currIndent() == indent);
if(!sequences.empty())
{
- start("h2");
- _out << "Sequences";
- end();
- for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
- {
- start("dl");
- start("dt");
- start("span", "Synopsis");
- printMetaData(*q);
- if((*q)->isLocal())
- {
- _out << "local ";
- }
- TypePtr type = (*q)->type();
- _out << "sequence&lt;" << toString(type, p, false, true) << "&gt; " << toString(*q, p);
- end();
- end();
-
- start("dd");
- string metadata, deprecateReason;
- if((*q)->findMetaData("deprecate", metadata))
- {
- deprecateReason = "This type is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
- }
-
- printComment(*q, p, deprecateReason, true);
- end();
- end();
- }
+ start("h2");
+ _out << "Sequences";
+ end();
+ for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
+ {
+ start("dl");
+ start("dt");
+ start("span", "Synopsis");
+ printMetaData(*q);
+ if((*q)->isLocal())
+ {
+ _out << "local ";
+ }
+ TypePtr type = (*q)->type();
+ _out << "sequence&lt;" << toString(type, p, false, true) << "&gt; " << toString(*q, p);
+ end();
+ end();
+
+ start("dd");
+ string metadata, deprecateReason;
+ if((*q)->findMetaData("deprecate", metadata))
+ {
+ deprecateReason = "This type is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, p, deprecateReason, true);
+ end();
+ end();
+ }
}
if(!dictionaries.empty())
{
- start("h2");
- _out << "Dictionaries";
- end();
- for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
- {
- start("dl");
- start("dt");
- start("span", "Synopsis");
- printMetaData(*q);
- if((*q)->isLocal())
- {
- _out << "local ";
- }
- TypePtr keyType = (*q)->keyType();
- TypePtr valueType = (*q)->valueType();
- _out << "dictionary&lt;" << toString(keyType, p, false, true) << ", "
- << toString(valueType, p, false, true) << "&gt; " << toString(*q, p);
- end();
- end();
-
- start("dd");
- string metadata, deprecateReason;
- if((*q)->findMetaData("deprecate", metadata))
- {
- deprecateReason = "This type is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
- }
-
- printComment(*q, p, deprecateReason, true);
- end();
- end();
- }
+ start("h2");
+ _out << "Dictionaries";
+ end();
+ for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
+ {
+ start("dl");
+ start("dt");
+ start("span", "Synopsis");
+ printMetaData(*q);
+ if((*q)->isLocal())
+ {
+ _out << "local ";
+ }
+ TypePtr keyType = (*q)->keyType();
+ TypePtr valueType = (*q)->valueType();
+ _out << "dictionary&lt;" << toString(keyType, p, false, true) << ", "
+ << toString(valueType, p, false, true) << "&gt; " << toString(*q, p);
+ end();
+ end();
+
+ start("dd");
+ string metadata, deprecateReason;
+ if((*q)->findMetaData("deprecate", metadata))
+ {
+ deprecateReason = "This type is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, p, deprecateReason, true);
+ end();
+ end();
+ }
}
}
@@ -2221,11 +2221,11 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
bool deprecatedException = e->findMetaData("deprecate", metadata);
if(deprecatedException)
{
- deprecateReason = "This module is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This module is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
start("h2");
@@ -2236,18 +2236,18 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
printMetaData(e);
if(e->isLocal())
{
- _out << "local ";
+ _out << "local ";
}
_out << "exception " << e->name();
ExceptionPtr base = e->base();
if(base)
{
- _out.inc();
- _out << nl << "extends ";
- _out.inc();
- _out << nl << toString(base, e);
- _out.dec();
- _out.dec();
+ _out.inc();
+ _out << nl << "extends ";
+ _out.inc();
+ _out << nl << toString(base, e);
+ _out.dec();
+ _out.dec();
}
end();
@@ -2257,55 +2257,55 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
if(_indexCount > 0 && dataMembers.size() >= _indexCount)
{
- start("h2");
- _out << "Data Member Index";
- end();
- start("dl");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, e, false);
- end();
- start("dd");
- string metadata;
- printSummary(*q, e, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Data Member Index";
+ end();
+ start("dl");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, e, false);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, e, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
if(!dataMembers.empty())
{
- start("h2");
- _out << "Data Members";
- end();
- start("dl");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("dt", "Symbol");
- printMetaData(*q);
- TypePtr type = (*q)->type();
- _out << toString(type, e) << " " << toString(*q, e) << ";";
- end();
-
- start("dd");
- string reason;
- metadata.clear();
- if(deprecatedException || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This member is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
-
- printComment(*q, e, reason);
- end();
- }
- end();
- }
-
+ start("h2");
+ _out << "Data Members";
+ end();
+ start("dl");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("dt", "Symbol");
+ printMetaData(*q);
+ TypePtr type = (*q)->type();
+ _out << toString(type, e) << " " << toString(*q, e) << ";";
+ end();
+
+ start("dd");
+ string reason;
+ metadata.clear();
+ if(deprecatedException || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This member is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, e, reason);
+ end();
+ }
+ end();
+ }
+
_out << nl << "<hr>";
printHeaderFooter(e);
@@ -2339,13 +2339,13 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
bool deprecatedClass = c->findMetaData("deprecate", metadata);
if(deprecatedClass)
{
- deprecateReason = "This ";
- deprecateReason += c->isInterface() ? "interface" : "class";
- deprecateReason += " is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This ";
+ deprecateReason += c->isInterface() ? "interface" : "class";
+ deprecateReason += " is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
start("h2");
@@ -2355,29 +2355,29 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
printMetaData(c);
if(c->isLocal())
{
- _out << "local ";
+ _out << "local ";
}
_out << (c->isInterface() ? "interface" : "class" )<< " " << c->name();
ClassList bases = c->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
- _out << " extends " << toString(bases.front(), c);
- bases.pop_front();
+ _out << " extends " << toString(bases.front(), c);
+ bases.pop_front();
}
if(!bases.empty())
{
- _out << (c->isInterface() ? " extends " : " implements ");
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- _out << toString(*q, c, false);
- if(++q != bases.end())
- {
- _out << ", ";
- }
- }
+ _out << (c->isInterface() ? " extends " : " implements ");
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ _out << toString(*q, c, false);
+ if(++q != bases.end())
+ {
+ _out << ", ";
+ }
+ }
}
end();
@@ -2387,127 +2387,127 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
if(_indexCount > 0 && operations.size() >= _indexCount)
{
- start("h2");
- _out << "Operation Index";
- end();
- start("dl");
- for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, c, false);
- end();
- start("dd");
- string metadata;
- printSummary(*q, c, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Operation Index";
+ end();
+ start("dl");
+ for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, c, false);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, c, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
DataMemberList dataMembers = c->dataMembers();
if(_indexCount > 0 && dataMembers.size() >= _indexCount)
{
- start("h2");
- _out << "Data Member Index";
- end();
- start("dl");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, c, false);
- end();
- start("dd");
- string metadata;
- printSummary(*q, c, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Data Member Index";
+ end();
+ start("dl");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, c, false);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, c, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
if(!operations.empty())
{
- start("h2");
- _out << "Operations";
- end();
- for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
- {
- start("h3", "Synopsis");
- TypePtr returnType = (*q)->returnType();
- _out << (returnType ? toString(returnType, c, false) : string("void")) << " "
- << toString(*q, c) << "(";
- ParamDeclList params = (*q)->parameters();
- ParamDeclList::const_iterator r = params.begin();
- while(r != params.end())
- {
- if((*r)->isOutParam())
- {
- _out << "out ";
- }
- _out << toString((*r)->type(), ContainedPtr::dynamicCast(*q)->container(), false)
- << " " << (*r)->name();
- if(++r != params.end())
- {
- _out << ", ";
- }
- }
- _out << ")";
- ExceptionList throws = (*q)->throws();
- if(!throws.empty())
- {
- _out << " throws ";
- ExceptionList::const_iterator t = throws.begin();
- while(t != throws.end())
- {
- _out << toString(*t, c, false);
- if(++t != throws.end())
- {
- _out << ", ";
- }
- }
- }
- end();
-
- string reason;
- metadata.clear();
- if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This operation is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
- printComment(*q, c, reason);
- }
+ start("h2");
+ _out << "Operations";
+ end();
+ for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
+ {
+ start("h3", "Synopsis");
+ TypePtr returnType = (*q)->returnType();
+ _out << (returnType ? toString(returnType, c, false) : string("void")) << " "
+ << toString(*q, c) << "(";
+ ParamDeclList params = (*q)->parameters();
+ ParamDeclList::const_iterator r = params.begin();
+ while(r != params.end())
+ {
+ if((*r)->isOutParam())
+ {
+ _out << "out ";
+ }
+ _out << toString((*r)->type(), ContainedPtr::dynamicCast(*q)->container(), false)
+ << " " << (*r)->name();
+ if(++r != params.end())
+ {
+ _out << ", ";
+ }
+ }
+ _out << ")";
+ ExceptionList throws = (*q)->throws();
+ if(!throws.empty())
+ {
+ _out << " throws ";
+ ExceptionList::const_iterator t = throws.begin();
+ while(t != throws.end())
+ {
+ _out << toString(*t, c, false);
+ if(++t != throws.end())
+ {
+ _out << ", ";
+ }
+ }
+ }
+ end();
+
+ string reason;
+ metadata.clear();
+ if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This operation is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+ printComment(*q, c, reason);
+ }
}
if(!dataMembers.empty())
{
- start("h2");
- _out << "Data Members";
- end();
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("h3", "Synopsis");
- printMetaData(*q);
- TypePtr type = (*q)->type();
- _out << toString(type, c, false) << " " << toString(*q, c) << ";";
- end();
-
- string reason;
- metadata.clear();
- if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This member is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
-
- printComment(*q, c, reason);
- }
+ start("h2");
+ _out << "Data Members";
+ end();
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("h3", "Synopsis");
+ printMetaData(*q);
+ TypePtr type = (*q)->type();
+ _out << toString(type, c, false) << " " << toString(*q, c) << ";";
+ end();
+
+ string reason;
+ metadata.clear();
+ if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This member is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, c, reason);
+ }
}
_out << nl << "<hr>";
@@ -2543,11 +2543,11 @@ Slice::StructGenerator::generate(const StructPtr& s)
bool deprecatedException = s->findMetaData("deprecate", metadata);
if(deprecatedException)
{
- deprecateReason = "This module is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This module is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
start("h2");
@@ -2558,7 +2558,7 @@ Slice::StructGenerator::generate(const StructPtr& s)
printMetaData(s);
if(s->isLocal())
{
- _out << "local ";
+ _out << "local ";
}
_out << "struct " << s->name();
end();
@@ -2569,55 +2569,55 @@ Slice::StructGenerator::generate(const StructPtr& s)
if(_indexCount > 0 && dataMembers.size() >= _indexCount)
{
- start("h2");
- _out << "Data Member Index";
- end();
- start("dl");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("dt", "Symbol");
- _out << toString(*q, s, false);
- end();
- start("dd");
- string metadata;
- printSummary(*q, s, (*q)->findMetaData("deprecate", metadata));
- end();
- }
- end();
+ start("h2");
+ _out << "Data Member Index";
+ end();
+ start("dl");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, s, false);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, s, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
}
if(!dataMembers.empty())
{
- start("h2");
- _out << "Data Members";
- end();
- start("dl");
- for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- start("dt", "Symbol");
- printMetaData(*q);
- TypePtr type = (*q)->type();
- _out << toString(type, s, false) << " " << toString(*q, s) << ";";
- end();
-
- start("dd");
- string reason;
- metadata.clear();
- if(deprecatedException || (*q)->findMetaData("deprecate", metadata))
- {
- reason = "This member is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- reason = metadata.substr(10);
- }
- }
-
- printComment(*q, s, reason);
- end();
- }
- end();
- }
-
+ start("h2");
+ _out << "Data Members";
+ end();
+ start("dl");
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ start("dt", "Symbol");
+ printMetaData(*q);
+ TypePtr type = (*q)->type();
+ _out << toString(type, s, false) << " " << toString(*q, s) << ";";
+ end();
+
+ start("dd");
+ string reason;
+ metadata.clear();
+ if(deprecatedException || (*q)->findMetaData("deprecate", metadata))
+ {
+ reason = "This member is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ reason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, s, reason);
+ end();
+ }
+ end();
+ }
+
_out << nl << "<hr>";
printHeaderFooter(s);
@@ -2651,11 +2651,11 @@ Slice::EnumGenerator::generate(const EnumPtr& e)
bool deprecatedException = e->findMetaData("deprecate", metadata);
if(deprecatedException)
{
- deprecateReason = "This enumeration is deprecated.";
- if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
- {
- deprecateReason = metadata.substr(10);
- }
+ deprecateReason = "This enumeration is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
}
start("h2");
@@ -2666,7 +2666,7 @@ Slice::EnumGenerator::generate(const EnumPtr& e)
printMetaData(e);
if(e->isLocal())
{
- _out << "local ";
+ _out << "local ";
}
_out << "enum " << e->name();
end();
@@ -2676,27 +2676,27 @@ Slice::EnumGenerator::generate(const EnumPtr& e)
EnumeratorList enumerators = e->getEnumerators();
if(!enumerators.empty())
{
- start("h2");
- _out << "Enumerators";
- end();
- start("dl");
- for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
- {
- start("dt", "Symbol");
- _out << (*q)->name();
- end();
-
- start("dd");
- string reason;
- //
- // Enumerators do not support metadata.
- //
- printComment(*q, e->container(), reason, false);
- end();
- }
- end();
- }
-
+ start("h2");
+ _out << "Enumerators";
+ end();
+ start("dl");
+ for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << (*q)->name();
+ end();
+
+ start("dd");
+ string reason;
+ //
+ // Enumerators do not support metadata.
+ //
+ printComment(*q, e->container(), reason, false);
+ end();
+ }
+ end();
+ }
+
closeDoc();
_out << nl << "<hr>";
diff --git a/cpp/src/slice2html/Gen.h b/cpp/src/slice2html/Gen.h
index 408ee5772ed..88abf9651e3 100644
--- a/cpp/src/slice2html/Gen.h
+++ b/cpp/src/slice2html/Gen.h
@@ -17,7 +17,7 @@ namespace Slice
{
void generate(const UnitPtr&, const ::std::string&, const ::std::string&, const ::std::string&, const std::string&,
- const ::std::string&, const ::std::string&, const ::std::string&, const ::std::string&,
+ const ::std::string&, const ::std::string&, const ::std::string&, const ::std::string&,
unsigned, unsigned);
typedef ::std::set< ::std::string> Files;
@@ -57,7 +57,7 @@ protected:
void printLogo(const ContainedPtr&, const ContainerPtr&, bool);
::std::string toString(const SyntaxTreeBasePtr&, const ContainerPtr&, bool = true, bool = false,
- unsigned* = 0, bool = false);
+ unsigned* = 0, bool = false);
::std::string toString(const ::std::string&, const ContainerPtr&, bool = true, bool = false, unsigned* = 0);
::std::string getComment(const ContainedPtr&, const ContainerPtr&, bool, bool = false);
diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp
index 4befc462ca3..bda3228acbe 100644
--- a/cpp/src/slice2html/Main.cpp
+++ b/cpp/src/slice2html/Main.cpp
@@ -28,17 +28,17 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
- "--output-dir DIR Create files in the directory DIR.\n"
+ "-E Print preprocessor output on stdout.\n"
+ "--output-dir DIR Create files in the directory DIR.\n"
"--hdr FILE Use the contents of FILE as the header.\n"
- "--ftr FILe Use the contents of FILE as the footer.\n"
- "--indexhdr FILE Use the contents of FILE as the header of the index/toc page (default=--hdr).\n"
- "--indexftr FILE Use the contents of FILE as the footer of the index/toc page (default=--ftr).\n"
- "--image-dir DIR Directory containing images for style sheets.\n"
- "--logo-url URL Link to URL from logo image (requires --image-dir).\n"
+ "--ftr FILe Use the contents of FILE as the footer.\n"
+ "--indexhdr FILE Use the contents of FILE as the header of the index/toc page (default=--hdr).\n"
+ "--indexftr FILE Use the contents of FILE as the footer of the index/toc page (default=--ftr).\n"
+ "--image-dir DIR Directory containing images for style sheets.\n"
+ "--logo-url URL Link to URL from logo image (requires --image-dir).\n"
"--search ACTION Generate search box with specified ACTION.\n"
- "--index NUM Generate subindex if it has at least NUM entries (0 for no index, default=1).\n"
- "--summary NUM Print a warning if a summary sentence exceeds NUM characters.\n"
+ "--index NUM Generate subindex if it has at least NUM entries (0 for no index, default=1).\n"
+ "--summary NUM Print a warning if a summary sentence exceeds NUM characters.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only).\n"
;
@@ -74,21 +74,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -96,19 +96,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("I");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -127,14 +127,14 @@ main(int argc, char* argv[])
unsigned indexCount;
if(!ind.empty())
{
- istringstream s(ind);
- s >> indexCount;
- if(!s)
- {
- cerr << argv[0] << ": the --index operation requires a positive integer argument" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ istringstream s(ind);
+ s >> indexCount;
+ if(!s)
+ {
+ cerr << argv[0] << ": the --index operation requires a positive integer argument" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
string imageDir = opts.optArg("image-dir");
@@ -147,14 +147,14 @@ main(int argc, char* argv[])
unsigned summaryCount;
if(!warnSummary.empty())
{
- istringstream s(warnSummary);
- s >> summaryCount;
- if(!s)
- {
- cerr << argv[0] << ": the --summary operation requires a positive integer argument" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ istringstream s(warnSummary);
+ s >> summaryCount;
+ if(!s)
+ {
+ cerr << argv[0] << ": the --summary operation requires a positive integer argument" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
bool debug = opts.isSet("debug");
@@ -163,9 +163,9 @@ main(int argc, char* argv[])
if(args.empty())
{
- cerr << argv[0] << ": no input file" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no input file" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
UnitPtr p = Unit::createUnit(true, false, ice, false);
@@ -174,55 +174,55 @@ main(int argc, char* argv[])
for(vector<string>::size_type idx = 0; idx < args.size(); ++idx)
{
- Preprocessor icecpp(argv[0], args[idx], cppArgs);
- FILE* cppHandle = icecpp.preprocess(true);
-
- if(cppHandle == 0)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- }
- }
- else
- {
- status = p->parse(cppHandle, debug);
- }
-
- if(!icecpp.close())
- {
- p->destroy();
- return EXIT_FAILURE;
- }
+ Preprocessor icecpp(argv[0], args[idx], cppArgs);
+ FILE* cppHandle = icecpp.preprocess(true);
+
+ if(cppHandle == 0)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+ status = p->parse(cppHandle, debug);
+ }
+
+ if(!icecpp.close())
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
}
if(status == EXIT_SUCCESS && !preprocess)
{
- try
- {
- Slice::generate(p, output, header, footer, indexHeader, indexFooter, imageDir, logoURL,
+ try
+ {
+ Slice::generate(p, output, header, footer, indexHeader, indexFooter, imageDir, logoURL,
searchAction, indexCount, summaryCount);
- }
- catch(const string& err)
- {
- cerr << argv[0] << ": " << err << endl;
- status = EXIT_FAILURE;
- }
- catch(const char* err)
- {
- cerr << argv[0] << ": " << err << endl;
- status = EXIT_FAILURE;
- }
+ }
+ catch(const string& err)
+ {
+ cerr << argv[0] << ": " << err << endl;
+ status = EXIT_FAILURE;
+ }
+ catch(const char* err)
+ {
+ cerr << argv[0] << ": " << err << endl;
+ status = EXIT_FAILURE;
+ }
}
p->destroy();
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 03d04934dca..aa163075dfb 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -38,26 +38,26 @@ sliceModeToIceMode(Operation::Mode opMode)
string mode;
switch(opMode)
{
- case Operation::Normal:
- {
- mode = "Ice.OperationMode.Normal";
- break;
- }
- case Operation::Nonmutating:
- {
- mode = "Ice.OperationMode.Nonmutating";
- break;
- }
- case Operation::Idempotent:
- {
- mode = "Ice.OperationMode.Idempotent";
- break;
- }
- default:
- {
- assert(false);
- break;
- }
+ case Operation::Normal:
+ {
+ mode = "Ice.OperationMode.Normal";
+ break;
+ }
+ case Operation::Nonmutating:
+ {
+ mode = "Ice.OperationMode.Nonmutating";
+ break;
+ }
+ case Operation::Idempotent:
+ {
+ mode = "Ice.OperationMode.Idempotent";
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
}
return mode;
}
@@ -72,7 +72,7 @@ getDeprecateReason(const ContainedPtr& p1, const ContainedPtr& p2, const string&
deprecateReason = "This " + type + " has been deprecated.";
if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
{
- deprecateReason = deprecateMetadata.substr(10);
+ deprecateReason = deprecateMetadata.substr(10);
}
}
return deprecateReason;
@@ -96,7 +96,7 @@ Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
StringList metaData = (*q)->getMetaData();
- string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
+ string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
metaData);
params.push_back(typeString + ' ' + fixKwd((*q)->name()));
}
@@ -118,12 +118,12 @@ Slice::JavaVisitor::getParamsAsync(const OperationPtr& op, const string& package
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if(!(*q)->isOutParam())
- {
+ if(!(*q)->isOutParam())
+ {
StringList metaData = (*q)->getMetaData();
- string typeString = typeToString((*q)->type(), TypeModeIn, package, metaData);
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
- }
+ string typeString = typeToString((*q)->type(), TypeModeIn, package, metaData);
+ params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ }
}
return params;
@@ -137,18 +137,18 @@ Slice::JavaVisitor::getParamsAsyncCB(const OperationPtr& op, const string& packa
TypePtr ret = op->returnType();
if(ret)
{
- string retS = typeToString(ret, TypeModeIn, package, op->getMetaData());
- params.push_back(retS + " __ret");
+ string retS = typeToString(ret, TypeModeIn, package, op->getMetaData());
+ params.push_back(retS + " __ret");
}
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if((*q)->isOutParam())
- {
- string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData());
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
- }
+ if((*q)->isOutParam())
+ {
+ string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData());
+ params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ }
}
return params;
@@ -178,10 +178,10 @@ Slice::JavaVisitor::getArgsAsync(const OperationPtr& op)
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if(!(*q)->isOutParam())
- {
- args.push_back(fixKwd((*q)->name()));
- }
+ if(!(*q)->isOutParam())
+ {
+ args.push_back(fixKwd((*q)->name()));
+ }
}
return args;
@@ -195,32 +195,32 @@ Slice::JavaVisitor::getArgsAsyncCB(const OperationPtr& op)
TypePtr ret = op->returnType();
if(ret)
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- args.push_back("__ret.value");
- }
- else
- {
- args.push_back("__ret");
- }
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ args.push_back("__ret.value");
+ }
+ else
+ {
+ args.push_back("__ret");
+ }
}
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if((*q)->isOutParam())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- args.push_back(fixKwd((*q)->name()) + ".value");
- }
- else
- {
- args.push_back(fixKwd((*q)->name()));
- }
- }
+ if((*q)->isOutParam())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ args.push_back(fixKwd((*q)->name()) + ".value");
+ }
+ else
+ {
+ args.push_back(fixKwd((*q)->name()));
+ }
+ }
}
return args;
@@ -239,12 +239,12 @@ Slice::JavaVisitor::writeThrowsClause(const string& package, const ExceptionList
int count = 0;
for(r = throws.begin(); r != throws.end(); ++r)
{
- if(count > 0)
- {
- out << "," << nl;
- }
- out << getAbsolute(*r, package);
- count++;
+ if(count > 0)
+ {
+ out << "," << nl;
+ }
+ out << getAbsolute(*r, package);
+ count++;
}
out.restoreIndent();
out.dec();
@@ -263,8 +263,8 @@ Slice::JavaVisitor::writeDelegateThrowsClause(const string& package, const Excep
ExceptionList::const_iterator r;
for(r = throws.begin(); r != throws.end(); ++r)
{
- out << "," << nl;
- out << getAbsolute(*r, package);
+ out << "," << nl;
+ out << getAbsolute(*r, package);
}
out.restoreIndent();
out.dec();
@@ -343,7 +343,7 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- bool customType = hasTypeMetaData(seq, metaData);
+ bool customType = hasTypeMetaData(seq, metaData);
out << nl << "if(" << name << " != null)";
out << sb;
@@ -354,7 +354,7 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
else
{
out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << name << ".length; __i" << iter
- << "++)";
+ << "++)";
out << sb;
ostringstream elem;
elem << name << "[__i" << iter << ']';
@@ -397,15 +397,15 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sb;
{
- StringList::const_iterator q = ids.begin();
- while(q != ids.end())
- {
- out << nl << '"' << *q << '"';
- if(++q != ids.end())
- {
- out << ',';
- }
- }
+ StringList::const_iterator q = ids.begin();
+ while(q != ids.end())
+ {
+ out << nl << '"' << *q << '"';
+ if(++q != ids.end())
+ {
+ out << ',';
+ }
+ }
}
out << eb << ';';
@@ -452,96 +452,96 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
+ OperationPtr op = *r;
string opName = op->name();
ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- assert(cl);
-
- bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
-
- vector<string> params;
- vector<string> args;
- TypePtr ret;
-
- if(amd)
- {
- opName += "_async";
- params = getParamsAsync(op, package, true);
- args = getArgsAsync(op);
- }
- else
- {
- opName = fixKwd(opName);
- ret = op->returnType();
- params = getParams(op, package);
- args = getArgs(op);
- }
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Only generate a "no current" version of the operation if it hasn't been done in a base
- // class already, because the "no current" version is final.
- //
- bool generateOperation = cl == p; // Generate if the operation is defined in this class.
- if(!generateOperation)
- {
- //
- // The operation is not defined in this class.
- //
- if(!bases.empty())
- {
- //
- // Check if the operation is already implemented by a base class.
- //
- bool implementedByBase = false;
- if(!bases.front()->isInterface())
- {
- OperationList baseOps = bases.front()->allOperations();
- OperationList::const_iterator i;
- for(i = baseOps.begin(); i != baseOps.end(); ++i)
- {
- if((*i)->name() == op->name())
- {
- implementedByBase = true;
- break;
- }
- }
- if(i == baseOps.end())
- {
- generateOperation = true;
- }
- }
- if(!generateOperation && !implementedByBase)
- {
- //
- // No base class defines the operation. Check if one of the
- // interfaces defines it, in which case this class must provide it.
- //
- if(bases.front()->isInterface() || bases.size() > 1)
- {
- generateOperation = true;
- }
- }
- }
- }
- if(generateOperation)
- {
- out << sp << nl << "public final " << typeToString(ret, TypeModeReturn, package, op->getMetaData())
- << nl << opName << spar << params << epar;
- writeThrowsClause(package, throws);
- out << sb << nl;
- if(ret)
- {
- out << "return ";
- }
- out << opName << spar << args << "null" << epar << ';';
- out << eb;
- }
+ assert(cl);
+
+ bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
+
+ vector<string> params;
+ vector<string> args;
+ TypePtr ret;
+
+ if(amd)
+ {
+ opName += "_async";
+ params = getParamsAsync(op, package, true);
+ args = getArgsAsync(op);
+ }
+ else
+ {
+ opName = fixKwd(opName);
+ ret = op->returnType();
+ params = getParams(op, package);
+ args = getArgs(op);
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Only generate a "no current" version of the operation if it hasn't been done in a base
+ // class already, because the "no current" version is final.
+ //
+ bool generateOperation = cl == p; // Generate if the operation is defined in this class.
+ if(!generateOperation)
+ {
+ //
+ // The operation is not defined in this class.
+ //
+ if(!bases.empty())
+ {
+ //
+ // Check if the operation is already implemented by a base class.
+ //
+ bool implementedByBase = false;
+ if(!bases.front()->isInterface())
+ {
+ OperationList baseOps = bases.front()->allOperations();
+ OperationList::const_iterator i;
+ for(i = baseOps.begin(); i != baseOps.end(); ++i)
+ {
+ if((*i)->name() == op->name())
+ {
+ implementedByBase = true;
+ break;
+ }
+ }
+ if(i == baseOps.end())
+ {
+ generateOperation = true;
+ }
+ }
+ if(!generateOperation && !implementedByBase)
+ {
+ //
+ // No base class defines the operation. Check if one of the
+ // interfaces defines it, in which case this class must provide it.
+ //
+ if(bases.front()->isInterface() || bases.size() > 1)
+ {
+ generateOperation = true;
+ }
+ }
+ }
+ }
+ if(generateOperation)
+ {
+ out << sp << nl << "public final " << typeToString(ret, TypeModeReturn, package, op->getMetaData())
+ << nl << opName << spar << params << epar;
+ writeThrowsClause(package, throws);
+ out << sb << nl;
+ if(ret)
+ {
+ out << "return ";
+ }
+ out << opName << spar << args << "null" << epar << ';';
+ out << eb;
+ }
}
//
@@ -556,250 +556,250 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
StringList opMetaData = op->getMetaData();
ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- assert(cl);
+ assert(cl);
string opName = op->name();
out << sp << nl << "public static IceInternal.DispatchStatus" << nl << "___" << opName << '(' << name
- << " __obj, IceInternal.Incoming __inS, Ice.Current __current)";
+ << " __obj, IceInternal.Incoming __inS, Ice.Current __current)";
out << sb;
- bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
- if(!amd)
- {
- TypePtr ret = op->returnType();
-
- ParamDeclList inParams;
- ParamDeclList outParams;
- ParamDeclList paramList = op->parameters();
- ParamDeclList::const_iterator pli;
- for(pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- else
- {
- inParams.push_back(*pli);
- }
- }
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
+ if(!amd)
+ {
+ TypePtr ret = op->returnType();
+
+ ParamDeclList inParams;
+ ParamDeclList outParams;
+ ParamDeclList paramList = op->parameters();
+ ParamDeclList::const_iterator pli;
+ for(pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ else
+ {
+ inParams.push_back(*pli);
+ }
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- int iter;
-
- out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
-
- if(!inParams.empty())
- {
- out << nl << "IceInternal.BasicStream __is = __inS.is();";
- }
- if(!outParams.empty() || ret || !throws.empty())
- {
- out << nl << "IceInternal.BasicStream __os = __inS.os();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- iter = 0;
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
+ int iter;
+
+ out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ out << nl << "IceInternal.BasicStream __is = __inS.is();";
+ }
+ if(!outParams.empty() || ret || !throws.empty())
+ {
+ out << nl << "IceInternal.BasicStream __os = __inS.os();";
+ }
+
+ //
+ // Unmarshal 'in' parameters.
+ //
+ iter = 0;
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
StringList metaData = (*pli)->getMetaData();
TypePtr paramType = (*pli)->type();
string paramName = fixKwd((*pli)->name());
- string typeS = typeToString(paramType, TypeModeIn, package, metaData);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true,
- metaData, string());
- }
- else
- {
- out << nl << typeS << ' ' << paramName << ';';
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
- }
- }
- if(op->sendsClasses())
- {
- out << nl << "__is.readPendingObjects();";
- }
-
- //
- // Create holders for 'out' parameters.
- //
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData());
- out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
- }
-
- //
- // Call on the servant.
- //
- if(!throws.empty())
- {
- out << nl << "try";
- out << sb;
- }
- out << nl;
- if(ret)
- {
- string retS = typeToString(ret, TypeModeReturn, package, opMetaData);
- out << retS << " __ret = ";
- }
- out << "__obj." << fixKwd(opName) << '(';
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
+ string typeS = typeToString(paramType, TypeModeIn, package, metaData);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true,
+ metaData, string());
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
+ }
+ }
+ if(op->sendsClasses())
+ {
+ out << nl << "__is.readPendingObjects();";
+ }
+
+ //
+ // Create holders for 'out' parameters.
+ //
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData());
+ out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
+ }
+
+ //
+ // Call on the servant.
+ //
+ if(!throws.empty())
+ {
+ out << nl << "try";
+ out << sb;
+ }
+ out << nl;
+ if(ret)
+ {
+ string retS = typeToString(ret, TypeModeReturn, package, opMetaData);
+ out << retS << " __ret = ";
+ }
+ out << "__obj." << fixKwd(opName) << '(';
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
TypePtr paramType = (*pli)->type();
- out << fixKwd((*pli)->name());
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << ".value";
- }
- out << ", ";
- }
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- out << fixKwd((*pli)->name()) << ", ";
- }
- out << "__current);";
-
- //
- // Marshal 'out' parameters and return value.
- //
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, true,
+ out << fixKwd((*pli)->name());
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << ".value";
+ }
+ out << ", ";
+ }
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ out << fixKwd((*pli)->name()) << ", ";
+ }
+ out << "__current);";
+
+ //
+ // Marshal 'out' parameters and return value.
+ //
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, true,
(*pli)->getMetaData());
- }
- if(ret)
- {
- writeMarshalUnmarshalCode(out, package, ret, "__ret", true, iter, false, opMetaData);
- }
- if(op->returnsClasses())
- {
- out << nl << "__os.writePendingObjects();";
- }
- out << nl << "return IceInternal.DispatchStatus.DispatchOK;";
-
- //
- // Handle user exceptions.
- //
- if(!throws.empty())
- {
- out << eb;
- ExceptionList::const_iterator t;
- for(t = throws.begin(); t != throws.end(); ++t)
- {
- string exS = getAbsolute(*t, package);
- out << nl << "catch(" << exS << " ex)";
- out << sb;
- out << nl << "__os.writeUserException(ex);";
- out << nl << "return IceInternal.DispatchStatus.DispatchUserException;";
- out << eb;
- }
- }
-
- out << eb;
- }
- else
- {
- ParamDeclList inParams;
- ParamDeclList paramList = op->parameters();
- ParamDeclList::const_iterator pli;
- for(pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if(!(*pli)->isOutParam())
- {
- inParams.push_back(*pli);
- }
- }
-
- int iter;
-
- out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
-
- if(!inParams.empty())
- {
- out << nl << "IceInternal.BasicStream __is = __inS.is();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- iter = 0;
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
+ }
+ if(ret)
+ {
+ writeMarshalUnmarshalCode(out, package, ret, "__ret", true, iter, false, opMetaData);
+ }
+ if(op->returnsClasses())
+ {
+ out << nl << "__os.writePendingObjects();";
+ }
+ out << nl << "return IceInternal.DispatchStatus.DispatchOK;";
+
+ //
+ // Handle user exceptions.
+ //
+ if(!throws.empty())
+ {
+ out << eb;
+ ExceptionList::const_iterator t;
+ for(t = throws.begin(); t != throws.end(); ++t)
+ {
+ string exS = getAbsolute(*t, package);
+ out << nl << "catch(" << exS << " ex)";
+ out << sb;
+ out << nl << "__os.writeUserException(ex);";
+ out << nl << "return IceInternal.DispatchStatus.DispatchUserException;";
+ out << eb;
+ }
+ }
+
+ out << eb;
+ }
+ else
+ {
+ ParamDeclList inParams;
+ ParamDeclList paramList = op->parameters();
+ ParamDeclList::const_iterator pli;
+ for(pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if(!(*pli)->isOutParam())
+ {
+ inParams.push_back(*pli);
+ }
+ }
+
+ int iter;
+
+ out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ out << nl << "IceInternal.BasicStream __is = __inS.is();";
+ }
+
+ //
+ // Unmarshal 'in' parameters.
+ //
+ iter = 0;
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
StringList metaData = (*pli)->getMetaData();
TypePtr paramType = (*pli)->type();
string paramName = fixKwd((*pli)->name());
- string typeS = typeToString(paramType, TypeModeIn, package, metaData);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true, metaData,
+ string typeS = typeToString(paramType, TypeModeIn, package, metaData);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true, metaData,
string());
- }
- else
- {
- out << nl << typeS << ' ' << paramName << ';';
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
- }
- }
- if(op->sendsClasses())
- {
- out << nl << "__is.readPendingObjects();";
- }
-
- //
- // Call on the servant.
- //
- string classNameAMD = "AMD_" + p->name();
- out << nl << classNameAMD << '_' << opName << " __cb = new _" << classNameAMD << '_' << opName
- << "(__inS);";
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
+ }
+ }
+ if(op->sendsClasses())
+ {
+ out << nl << "__is.readPendingObjects();";
+ }
+
+ //
+ // Call on the servant.
+ //
+ string classNameAMD = "AMD_" + p->name();
+ out << nl << classNameAMD << '_' << opName << " __cb = new _" << classNameAMD << '_' << opName
+ << "(__inS);";
out << nl << "try";
out << sb;
- out << nl << "__obj." << (amd ? opName + "_async" : fixKwd(opName)) << (amd ? "(__cb, " : "(");
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
+ out << nl << "__obj." << (amd ? opName + "_async" : fixKwd(opName)) << (amd ? "(__cb, " : "(");
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
TypePtr paramType = (*pli)->type();
- out << fixKwd((*pli)->name());
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << ".value";
- }
- out << ", ";
- }
- out << "__current);";
- out << eb;
- out << nl << "catch(java.lang.Exception ex)";
- out << sb;
- out << nl << "__cb.ice_exception(ex);";
- out << eb;
- out << nl << "return IceInternal.DispatchStatus.DispatchAsync;";
-
- out << eb;
- }
+ out << fixKwd((*pli)->name());
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << ".value";
+ }
+ out << ", ";
+ }
+ out << "__current);";
+ out << eb;
+ out << nl << "catch(java.lang.Exception ex)";
+ out << sb;
+ out << nl << "__cb.ice_exception(ex);";
+ out << eb;
+ out << nl << "return IceInternal.DispatchStatus.DispatchAsync;";
+
+ out << eb;
+ }
}
OperationList allOps = p->allOperations();
@@ -830,7 +830,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << eb << ';';
out << sp << nl << "public IceInternal.DispatchStatus" << nl
- << "__dispatch(IceInternal.Incoming in, Ice.Current __current)";
+ << "__dispatch(IceInternal.Incoming in, Ice.Current __current)";
out << sb;
out << nl << "int pos = java.util.Arrays.binarySearch(__all, __current.operation);";
out << nl << "if(pos < 0)";
@@ -903,47 +903,47 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << eb;
- //
- // Check if we need to generate ice_operationAttributes()
- //
-
- StringList freezeWriteOpNames;
- for(OperationList::iterator r = allOps.begin(); r != allOps.end(); ++r)
- {
- ClassDefPtr classDef = ClassDefPtr::dynamicCast((*r)->container());
- assert(classDef != 0);
-
- if((*r)->hasMetaData("freeze:write") ||
- (classDef->hasMetaData("freeze:write") && !(*r)->hasMetaData("freeze:read")))
- {
- freezeWriteOpNames.push_back((*r)->name());
- }
- }
-
- if(!freezeWriteOpNames.empty())
- {
- freezeWriteOpNames.sort();
-
- StringList::iterator q;
-
- out << sp << nl << "private final static String[] __freezeWriteOperations =";
- out << sb;
- q = freezeWriteOpNames.begin();
- while(q != freezeWriteOpNames.end())
- {
- out << nl << '"' << *q << '"';
- if(++q != freezeWriteOpNames.end())
- {
- out << ',';
- }
- }
- out << eb << ';';
-
- out << sp << nl << "public int ice_operationAttributes(String operation)";
- out << sb;
- out << nl << "return (java.util.Arrays.binarySearch(__freezeWriteOperations, operation) >= 0) ? 1 : 0;";
- out << eb;
- }
+ //
+ // Check if we need to generate ice_operationAttributes()
+ //
+
+ StringList freezeWriteOpNames;
+ for(OperationList::iterator r = allOps.begin(); r != allOps.end(); ++r)
+ {
+ ClassDefPtr classDef = ClassDefPtr::dynamicCast((*r)->container());
+ assert(classDef != 0);
+
+ if((*r)->hasMetaData("freeze:write") ||
+ (classDef->hasMetaData("freeze:write") && !(*r)->hasMetaData("freeze:read")))
+ {
+ freezeWriteOpNames.push_back((*r)->name());
+ }
+ }
+
+ if(!freezeWriteOpNames.empty())
+ {
+ freezeWriteOpNames.sort();
+
+ StringList::iterator q;
+
+ out << sp << nl << "private final static String[] __freezeWriteOperations =";
+ out << sb;
+ q = freezeWriteOpNames.begin();
+ while(q != freezeWriteOpNames.end())
+ {
+ out << nl << '"' << *q << '"';
+ if(++q != freezeWriteOpNames.end())
+ {
+ out << ',';
+ }
+ }
+ out << eb << ';';
+
+ out << sp << nl << "public int ice_operationAttributes(String operation)";
+ out << sb;
+ out << nl << "return (java.util.Arrays.binarySearch(__freezeWriteOperations, operation) >= 0) ? 1 : 0;";
+ out << eb;
+ }
}
}
@@ -1062,21 +1062,21 @@ Slice::Gen::writeChecksumClass(const string& checksumClass, const string& dir, c
//
if(java2)
{
- out << sp << nl << "public static java.util.Map checksums;";
+ out << sp << nl << "public static java.util.Map checksums;";
}
else
{
- out << sp << nl << "public static java.util.Map<String, String> checksums;";
+ out << sp << nl << "public static java.util.Map<String, String> checksums;";
}
out << sp << nl << "static";
out << sb;
if(java2)
{
- out << nl << "java.util.Map map = new java.util.HashMap();";
+ out << nl << "java.util.Map map = new java.util.HashMap();";
}
else
{
- out << nl << "java.util.Map<String, String> map = new java.util.HashMap<String, String>();";
+ out << nl << "java.util.Map<String, String> map = new java.util.HashMap<String, String>();";
}
for(ChecksumMap::const_iterator p = m.begin(); p != m.end(); ++p)
{
@@ -1115,7 +1115,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
- writeOperations(p, false);
+ writeOperations(p, false);
}
writeOperations(p, true);
@@ -1131,7 +1131,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
string opIntfName = "Operations";
if(noCurrent || p->isLocal())
{
- opIntfName += "NC";
+ opIntfName += "NC";
}
string absolute = getAbsolute(p, "", "_", opIntfName);
@@ -1176,47 +1176,47 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
+ OperationPtr op = *r;
ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string opname = op->name();
-
- TypePtr ret;
- vector<string> params;
-
- bool amd = !p->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"));
-
- if(amd)
- {
- params = getParamsAsync(op, package, true);
- }
- else
- {
- params = getParams(op, package);
- ret = op->returnType();
- }
-
- string deprecateReason = getDeprecateReason(*r, p, "operation");
-
- string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData());
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << retS << ' ' << (amd ? opname + "_async" : fixKwd(opname)) << spar << params;
- if(!noCurrent && !p->isLocal())
- {
- out << "Ice.Current __current";
- }
- out << epar;
- writeThrowsClause(package, throws);
- out << ';';
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string opname = op->name();
+
+ TypePtr ret;
+ vector<string> params;
+
+ bool amd = !p->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"));
+
+ if(amd)
+ {
+ params = getParamsAsync(op, package, true);
+ }
+ else
+ {
+ params = getParams(op, package);
+ ret = op->returnType();
+ }
+
+ string deprecateReason = getDeprecateReason(*r, p, "operation");
+
+ string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData());
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << retS << ' ' << (amd ? opname + "_async" : fixKwd(opname)) << spar << params;
+ if(!noCurrent && !p->isLocal())
+ {
+ out << "Ice.Current __current";
+ }
+ out << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
}
out << eb;
@@ -1320,47 +1320,47 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
if(p->isLocal())
{
out << sp << nl << "public int" << nl << "ice_hash()";
- out << sb;
- out << nl << "return hashCode();";
- out << eb;
+ out << sb;
+ out << nl << "return hashCode();";
+ out << eb;
- out << sp << nl << "public java.lang.Object" << nl << "clone()";
- out.inc();
- out << nl << "throws java.lang.CloneNotSupportedException";
- out.dec();
- out << sb;
- out << nl << "return super.clone();";
- out << eb;
+ out << sp << nl << "public java.lang.Object" << nl << "clone()";
+ out.inc();
+ out << nl << "throws java.lang.CloneNotSupportedException";
+ out.dec();
+ out << sb;
+ out << nl << "return super.clone();";
+ out << eb;
}
OperationList ops = p->allOperations();
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- ContainerPtr container = (*r)->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd");
+ ContainerPtr container = (*r)->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd");
#if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550)
//
// Work around for Sun CC 5.5 bug #4853566
//
- string opName;
- if(hasAMD)
- {
- opName = (*r)->name() + "_async";
- }
- else
- {
- opName = fixKwd((*r)->name());
- }
-#else
+ string opName;
+ if(hasAMD)
+ {
+ opName = (*r)->name() + "_async";
+ }
+ else
+ {
+ opName = fixKwd((*r)->name());
+ }
+#else
string opName = hasAMD ? (*r)->name() + "_async" : fixKwd((*r)->name());
#endif
TypePtr ret = (*r)->returnType();
string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData());
vector<string> params;
- vector<string> args;
+ vector<string> args;
if(hasAMD)
{
params = getParamsAsync((*r), package, true);
@@ -1458,7 +1458,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDefPtr baseClass;
if(!bases.empty() && !bases.front()->isInterface())
{
- baseClass = bases.front();
+ baseClass = bases.front();
}
string package = getPackage(p);
@@ -1489,15 +1489,15 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "Ice.Object";
}
- out << "," << nl << '_' << name;
- if(!p->isLocal())
- {
- out << "Operations, _" << name << "OperationsNC";
- }
- else
- {
- out << "OperationsNC";
- }
+ out << "," << nl << '_' << name;
+ if(!p->isLocal())
+ {
+ out << "Operations, _" << name << "OperationsNC";
+ }
+ else
+ {
+ out << "OperationsNC";
+ }
if(!bases.empty())
{
ClassList::const_iterator q = bases.begin();
@@ -1542,10 +1542,10 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
StringList implements;
if(p->isAbstract())
{
- if(!p->isLocal())
- {
- implements.push_back("_" + name + "Operations");
- }
+ if(!p->isLocal())
+ {
+ implements.push_back("_" + name + "Operations");
+ }
implements.push_back("_" + name + "OperationsNC");
}
if(!bases.empty())
@@ -1584,49 +1584,49 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface() && !allDataMembers.empty())
{
- //
- // Constructors.
- //
- out << sp;
- out << nl << "public " << name << "()";
- out << sb;
- if(baseClass)
- {
- out << nl << "super();";
- }
- out << eb;
-
- out << sp << nl << "public " << name << spar;
- vector<string> paramDecl;
- for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
- {
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
- paramDecl.push_back(memberType + " " + memberName);
- }
- out << paramDecl << epar;
- out << sb;
- if(baseClass && allDataMembers.size() != members.size())
- {
- out << nl << "super" << spar;
- vector<string> baseParamNames;
- DataMemberList baseDataMembers = baseClass->allDataMembers();
- for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
- {
- baseParamNames.push_back(fixKwd((*d)->name()));
- }
- out << baseParamNames << epar << ';';
- }
- vector<string> paramNames;
- for(d = members.begin(); d != members.end(); ++d)
- {
- paramNames.push_back(fixKwd((*d)->name()));
- }
- for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
- {
- out << nl << "this." << *i << " = " << *i << ';';
- }
- out << eb;
+ //
+ // Constructors.
+ //
+ out << sp;
+ out << nl << "public " << name << "()";
+ out << sb;
+ if(baseClass)
+ {
+ out << nl << "super();";
+ }
+ out << eb;
+
+ out << sp << nl << "public " << name << spar;
+ vector<string> paramDecl;
+ for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(baseClass && allDataMembers.size() != members.size())
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = baseClass->allDataMembers();
+ for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ out << baseParamNames << epar << ';';
+ }
+ vector<string> paramNames;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ paramNames.push_back(fixKwd((*d)->name()));
+ }
+ for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+ {
+ out << nl << "this." << *i << " = " << *i << ';';
+ }
+ out << eb;
}
//
@@ -1665,91 +1665,91 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public void" << nl << "__write(IceInternal.BasicStream __os)";
out << sb;
- out << nl << "__os.writeTypeId(ice_staticId());";
- out << nl << "__os.startWriteSlice();";
+ out << nl << "__os.writeTypeId(ice_staticId());";
+ out << nl << "__os.startWriteSlice();";
iter = 0;
for(d = members.begin(); d != members.end(); ++d)
{
StringList metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false, metaData);
}
- out << nl << "__os.endWriteSlice();";
+ out << nl << "__os.endWriteSlice();";
out << nl << "super.__write(__os);";
out << eb;
- DataMemberList allClassMembers = p->allClassDataMembers();
- if(allClassMembers.size() != 0)
- {
- out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ DataMemberList allClassMembers = p->allClassDataMembers();
+ if(allClassMembers.size() != 0)
+ {
+ out << sp << nl << "private class Patcher implements IceInternal.Patcher";
if(_stream)
{
out << ", Ice.ReadObjectCallback";
}
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << sp << nl << "Patcher(int member)";
- out << sb;
- out << nl << "__member = member;";
- out << eb;
- }
-
- out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
- out << sb;
- out << nl << "try";
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << nl << "switch(__member)";
- out << sb;
- }
- int memberCount = 0;
- for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
- {
- if(allClassMembers.size() > 1)
- {
- out.dec();
- out << nl << "case " << memberCount << ":";
- out.inc();
- }
- if(allClassMembers.size() > 1)
- {
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
- }
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package);
- out << nl << memberName << " = (" << memberType << ")v;";
- if(allClassMembers.size() > 1)
- {
- out << nl << "break;";
- }
- memberCount++;
- }
- if(allClassMembers.size() > 1)
- {
- out << eb;
- }
- out << eb;
- out << nl << "catch(ClassCastException ex)";
- out << sb;
- out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- out << nl << "_e.type = v.ice_id();";
- out << nl << "_e.expectedType = type();";
- out << nl << "throw _e;";
- out << eb;
- out << eb;
-
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << nl << "return __typeId;";
- }
- else
- {
- out << nl << "return \"" << (*allClassMembers.begin())->type()->typeId() << "\";";
- }
- out << eb;
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << sp << nl << "Patcher(int member)";
+ out << sb;
+ out << nl << "__member = member;";
+ out << eb;
+ }
+
+ out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "switch(__member)";
+ out << sb;
+ }
+ int memberCount = 0;
+ for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
+ {
+ if(allClassMembers.size() > 1)
+ {
+ out.dec();
+ out << nl << "case " << memberCount << ":";
+ out.inc();
+ }
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ }
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package);
+ out << nl << memberName << " = (" << memberType << ")v;";
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(allClassMembers.size() > 1)
+ {
+ out << eb;
+ }
+ out << eb;
+ out << nl << "catch(ClassCastException ex)";
+ out << sb;
+ out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ out << nl << "_e.type = v.ice_id();";
+ out << nl << "_e.expectedType = type();";
+ out << nl << "throw _e;";
+ out << eb;
+ out << eb;
+
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "return __typeId;";
+ }
+ else
+ {
+ out << nl << "return \"" << (*allClassMembers.begin())->type()->typeId() << "\";";
+ }
+ out << eb;
if(_stream)
{
@@ -1759,40 +1759,40 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
}
- if(allClassMembers.size() > 1)
- {
- out << sp << nl << "private int __member;";
- out << nl << "private String __typeId;";
- }
- out << eb;
- }
+ if(allClassMembers.size() > 1)
+ {
+ out << sp << nl << "private int __member;";
+ out << nl << "private String __typeId;";
+ }
+ out << eb;
+ }
out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is, boolean __rid)";
out << sb;
- out << nl << "if(__rid)";
- out << sb;
- out << nl << "__is.readTypeId();";
- out << eb;
- out << nl << "__is.startReadSlice();";
+ out << nl << "if(__rid)";
+ out << sb;
+ out << nl << "__is.readTypeId();";
+ out << eb;
+ out << nl << "__is.startReadSlice();";
iter = 0;
- DataMemberList classMembers = p->classDataMembers();
- size_t classMemberCount = allClassMembers.size() - classMembers.size();
+ DataMemberList classMembers = p->classDataMembers();
+ size_t classMemberCount = allClassMembers.size() - classMembers.size();
for(d = members.begin(); d != members.end(); ++d)
{
StringList metaData = (*d)->getMetaData();
- ostringstream patchParams;
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << "new Patcher(" << classMemberCount++ << ')';
- }
- }
+ ostringstream patchParams;
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << "new Patcher(" << classMemberCount++ << ')';
+ }
+ }
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData,
- patchParams.str());
+ patchParams.str());
}
- out << nl << "__is.endReadSlice();";
+ out << nl << "__is.endReadSlice();";
out << nl << "super.__read(__is, true);";
out << eb;
@@ -1897,9 +1897,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
string deprecateReason = getDeprecateReason(p, 0, "type");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public class " << name << " extends ";
@@ -1923,49 +1923,49 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(!allDataMembers.empty())
{
- //
- // Constructors.
- //
- out << sp;
- out << nl << "public " << name << "()";
- out << sb;
- if(base)
- {
- out << nl << "super();";
- }
- out << eb;
-
- out << sp << nl << "public " << name << spar;
- vector<string> paramDecl;
- for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
- {
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
- paramDecl.push_back(memberType + " " + memberName);
- }
- out << paramDecl << epar;
- out << sb;
- if(base && allDataMembers.size() != members.size())
- {
- out << nl << "super" << spar;
- vector<string> baseParamNames;
- DataMemberList baseDataMembers = base->allDataMembers();
- for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
- {
- baseParamNames.push_back(fixKwd((*d)->name()));
- }
- out << baseParamNames << epar << ';';
- }
- vector<string> paramNames;
- for(d = members.begin(); d != members.end(); ++d)
- {
- paramNames.push_back(fixKwd((*d)->name()));
- }
- for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
- {
- out << nl << "this." << *i << " = " << *i << ';';
- }
- out << eb;
+ //
+ // Constructors.
+ //
+ out << sp;
+ out << nl << "public " << name << "()";
+ out << sb;
+ if(base)
+ {
+ out << nl << "super();";
+ }
+ out << eb;
+
+ out << sp << nl << "public " << name << spar;
+ vector<string> paramDecl;
+ for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(base && allDataMembers.size() != members.size())
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = base->allDataMembers();
+ for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ out << baseParamNames << epar << ';';
+ }
+ vector<string> paramNames;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ paramNames.push_back(fixKwd((*d)->name()));
+ }
+ for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+ {
+ out << nl << "this." << *i << " = " << *i << ';';
+ }
+ out << eb;
}
out << sp << nl << "public String" << nl << "ice_name()";
@@ -1994,94 +1994,94 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp << nl << "public void" << nl << "__write(IceInternal.BasicStream __os)";
out << sb;
- out << nl << "__os.writeString(\"" << scoped << "\");";
- out << nl << "__os.startWriteSlice();";
+ out << nl << "__os.writeString(\"" << scoped << "\");";
+ out << nl << "__os.startWriteSlice();";
iter = 0;
for(d = members.begin(); d != members.end(); ++d)
{
StringList metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false, metaData);
}
- out << nl << "__os.endWriteSlice();";
+ out << nl << "__os.endWriteSlice();";
if(base)
{
out << nl << "super.__write(__os);";
}
out << eb;
- DataMemberList allClassMembers = p->allClassDataMembers();
- if(allClassMembers.size() != 0)
- {
- out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ DataMemberList allClassMembers = p->allClassDataMembers();
+ if(allClassMembers.size() != 0)
+ {
+ out << sp << nl << "private class Patcher implements IceInternal.Patcher";
if(_stream)
{
out << ", Ice.ReadObjectCallback";
}
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << sp << nl << "Patcher(int member)";
- out << sb;
- out << nl << "__member = member;";
- out << eb;
- }
-
- out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
- out << sb;
- out << nl << "try";
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << nl << "switch(__member)";
- out << sb;
- }
- int memberCount = 0;
- for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
- {
- if(allClassMembers.size() > 1)
- {
- out.dec();
- out << nl << "case " << memberCount << ":";
- out.inc();
- }
- if(allClassMembers.size() > 1)
- {
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
- }
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package);
- out << nl << memberName << " = (" << memberType << ")v;";
- if(allClassMembers.size() > 1)
- {
- out << nl << "break;";
- }
- memberCount++;
- }
- if(allClassMembers.size() > 1)
- {
- out << eb;
- }
- out << eb;
- out << nl << "catch(ClassCastException ex)";
- out << sb;
- out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- out << nl << "_e.type = v.ice_id();";
- out << nl << "_e.expectedType = type();";
- out << nl << "throw _e;";
- out << eb;
- out << eb;
-
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << nl << "return __typeId;";
- }
- else
- {
- out << nl << "return \"" << (*allClassMembers.begin())->type()->typeId() << "\";";
- }
- out << eb;
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << sp << nl << "Patcher(int member)";
+ out << sb;
+ out << nl << "__member = member;";
+ out << eb;
+ }
+
+ out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "switch(__member)";
+ out << sb;
+ }
+ int memberCount = 0;
+ for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
+ {
+ if(allClassMembers.size() > 1)
+ {
+ out.dec();
+ out << nl << "case " << memberCount << ":";
+ out.inc();
+ }
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ }
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package);
+ out << nl << memberName << " = (" << memberType << ")v;";
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(allClassMembers.size() > 1)
+ {
+ out << eb;
+ }
+ out << eb;
+ out << nl << "catch(ClassCastException ex)";
+ out << sb;
+ out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ out << nl << "_e.type = v.ice_id();";
+ out << nl << "_e.expectedType = type();";
+ out << nl << "throw _e;";
+ out << eb;
+ out << eb;
+
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "return __typeId;";
+ }
+ else
+ {
+ out << nl << "return \"" << (*allClassMembers.begin())->type()->typeId() << "\";";
+ }
+ out << eb;
if(_stream)
{
@@ -2091,39 +2091,39 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << eb;
}
- if(allClassMembers.size() > 1)
- {
- out << sp << nl << "private int __member;";
- out << nl << "private String __typeId;";
- }
- out << eb;
- }
+ if(allClassMembers.size() > 1)
+ {
+ out << sp << nl << "private int __member;";
+ out << nl << "private String __typeId;";
+ }
+ out << eb;
+ }
out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is, boolean __rid)";
out << sb;
- out << nl << "if(__rid)";
- out << sb;
- out << nl << "__is.readString();";
- out << eb;
- out << nl << "__is.startReadSlice();";
+ out << nl << "if(__rid)";
+ out << sb;
+ out << nl << "__is.readString();";
+ out << eb;
+ out << nl << "__is.startReadSlice();";
iter = 0;
- DataMemberList classMembers = p->classDataMembers();
- size_t classMemberCount = allClassMembers.size() - classMembers.size();
+ DataMemberList classMembers = p->classDataMembers();
+ size_t classMemberCount = allClassMembers.size() - classMembers.size();
for(d = members.begin(); d != members.end(); ++d)
{
- ostringstream patchParams;
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << "new Patcher(" << classMemberCount++ << ')';
- }
- }
+ ostringstream patchParams;
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << "new Patcher(" << classMemberCount++ << ')';
+ }
+ }
StringList metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData,
- patchParams.str());
+ patchParams.str());
}
- out << nl << "__is.endReadSlice();";
+ out << nl << "__is.endReadSlice();";
if(base)
{
out << nl << "super.__read(__is, true);";
@@ -2200,16 +2200,16 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << eb;
}
- if(p->usesClasses())
- {
- if(!base || base && !base->usesClasses())
- {
- out << sp << nl << "public boolean" << nl << "__usesClasses()";
- out << sb;
- out << nl << "return true;";
- out << eb;
- }
- }
+ if(p->usesClasses())
+ {
+ if(!base || base && !base->usesClasses())
+ {
+ out << sp << nl << "public boolean" << nl << "__usesClasses()";
+ out << sb;
+ out << nl << "return true;";
+ out << eb;
+ }
+ }
}
out << eb;
@@ -2234,9 +2234,9 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
string deprecateReason = getDeprecateReason(p, 0, "type");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public final class " << name << " implements java.lang.Cloneable";
@@ -2267,17 +2267,17 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
vector<string> paramNames;
for(d = members.begin(); d != members.end(); ++d)
{
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
- paramDecl.push_back(memberType + " " + memberName);
- paramNames.push_back(memberName);
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ paramNames.push_back(memberName);
}
out << sp << nl << "public " << name << spar << paramDecl << epar;
out << sb;
for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
{
- out << nl << "this." << *i << " = " << *i << ';';
+ out << nl << "this." << *i << " = " << *i << ';';
}
out << eb;
@@ -2347,7 +2347,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
SequencePtr seq = SequencePtr::dynamicCast((*d)->type());
if(seq)
{
- if(hasTypeMetaData(seq, (*d)->getMetaData()))
+ if(hasTypeMetaData(seq, (*d)->getMetaData()))
{
out << nl << "if(" << memberName << " != _r." << memberName << " && " << memberName
<< " != null && !" << memberName << ".equals(_r." << memberName << "))";
@@ -2417,80 +2417,80 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
out << eb;
- DataMemberList classMembers = p->classDataMembers();
+ DataMemberList classMembers = p->classDataMembers();
- if(classMembers.size() != 0)
- {
- out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ if(classMembers.size() != 0)
+ {
+ out << sp << nl << "private class Patcher implements IceInternal.Patcher";
if(_stream)
{
out << ", Ice.ReadObjectCallback";
}
- out << sb;
- if(classMembers.size() > 1)
- {
- out << sp << nl << "Patcher(int member)";
- out << sb;
- out << nl << "__member = member;";
- out << eb;
- }
-
- out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
- out << sb;
- out << nl << "try";
- out << sb;
- if(classMembers.size() > 1)
- {
- out << nl << "switch(__member)";
- out << sb;
- }
- int memberCount = 0;
- for(d = classMembers.begin(); d != classMembers.end(); ++d)
- {
- if(classMembers.size() > 1)
- {
- out.dec();
- out << nl << "case " << memberCount << ":";
- out.inc();
- }
- if(classMembers.size() > 1)
- {
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
- }
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package);
- out << nl << memberName << " = (" << memberType << ")v;";
- if(classMembers.size() > 1)
- {
- out << nl << "break;";
- }
- memberCount++;
- }
- if(classMembers.size() > 1)
- {
- out << eb;
- }
- out << eb;
- out << nl << "catch(ClassCastException ex)";
- out << sb;
- out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- out << nl << "_e.type = v.ice_id();";
- out << nl << "_e.expectedType = type();";
- out << nl << "throw _e;";
- out << eb;
- out << eb;
-
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- if(classMembers.size() > 1)
- {
- out << nl << "return __typeId;";
- }
- else
- {
- out << nl << "return \"" << (*classMembers.begin())->type()->typeId() << "\";";
- }
- out << eb;
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << sp << nl << "Patcher(int member)";
+ out << sb;
+ out << nl << "__member = member;";
+ out << eb;
+ }
+
+ out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << nl << "switch(__member)";
+ out << sb;
+ }
+ int memberCount = 0;
+ for(d = classMembers.begin(); d != classMembers.end(); ++d)
+ {
+ if(classMembers.size() > 1)
+ {
+ out.dec();
+ out << nl << "case " << memberCount << ":";
+ out.inc();
+ }
+ if(classMembers.size() > 1)
+ {
+ out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ }
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package);
+ out << nl << memberName << " = (" << memberType << ")v;";
+ if(classMembers.size() > 1)
+ {
+ out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(classMembers.size() > 1)
+ {
+ out << eb;
+ }
+ out << eb;
+ out << nl << "catch(ClassCastException ex)";
+ out << sb;
+ out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ out << nl << "_e.type = v.ice_id();";
+ out << nl << "_e.expectedType = type();";
+ out << nl << "throw _e;";
+ out << eb;
+ out << eb;
+
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << nl << "return __typeId;";
+ }
+ else
+ {
+ out << nl << "return \"" << (*classMembers.begin())->type()->typeId() << "\";";
+ }
+ out << eb;
if(_stream)
{
@@ -2500,32 +2500,32 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
}
- if(classMembers.size() > 1)
- {
- out << sp << nl << "private int __member;";
- out << nl << "private String __typeId;";
- }
- out << eb;
- }
+ if(classMembers.size() > 1)
+ {
+ out << sp << nl << "private int __member;";
+ out << nl << "private String __typeId;";
+ }
+ out << eb;
+ }
out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is)";
out << sb;
iter = 0;
- int classMemberCount = 0;
+ int classMemberCount = 0;
for(d = members.begin(); d != members.end(); ++d)
{
- ostringstream patchParams;
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1)
- {
- patchParams << "new Patcher(" << classMemberCount++ << ')';
- }
- }
+ ostringstream patchParams;
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1)
+ {
+ patchParams << "new Patcher(" << classMemberCount++ << ')';
+ }
+ }
StringList metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData,
- patchParams.str());
+ patchParams.str());
}
out << eb;
@@ -2585,9 +2585,9 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
string deprecateReason = getDeprecateReason(p, contained, "member");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public " << s << ' ' << name << ';';
@@ -2596,134 +2596,134 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
//
if(p->hasMetaData(_getSetMetaData) || contained->hasMetaData(_getSetMetaData))
{
- string capName = p->name();
- capName[0] = toupper(capName[0]);
-
- //
- // If container is a class, get all of its operations so that we can check for conflicts.
- //
- OperationList ops;
- string file, line;
- ClassDefPtr cls = ClassDefPtr::dynamicCast(container);
- if(cls)
- {
- ops = cls->allOperations();
- DefinitionContextPtr dc = p->definitionContext();
- file = dc->filename();
- line = p->line();
- if(!validateGetterSetter(ops, "get" + capName, 0, file, line) ||
- !validateGetterSetter(ops, "set" + capName, 1, file, line))
- {
- return;
- }
- }
-
- //
- // Getter.
- //
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << "public " << s;
- out << nl << "get" << capName << "()";
- out << sb;
- out << nl << "return " << name << ';';
- out << eb;
-
- //
- // Setter.
- //
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << "public void";
- out << nl << "set" << capName << '(' << s << " _" << name << ')';
- out << sb;
- out << nl << name << " = _" << name << ';';
- out << eb;
-
- //
- // Check for bool type.
- //
- BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if(b && b->kind() == Builtin::KindBool)
- {
- if(cls && !validateGetterSetter(ops, "is" + capName, 0, file, line))
- {
- return;
- }
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << "public boolean";
- out << nl << "is" << capName << "()";
- out << sb;
- out << nl << "return " << name << ';';
- out << eb;
- }
-
- //
- // Check for unmodified sequence type and emit indexing methods.
- //
- SequencePtr seq = SequencePtr::dynamicCast(type);
- if(seq)
- {
- if(!hasTypeMetaData(seq, metaData))
- {
- if(cls &&
- (!validateGetterSetter(ops, "get" + capName, 1, file, line) ||
- !validateGetterSetter(ops, "set" + capName, 2, file, line)))
- {
- return;
- }
-
- string elem = typeToString(seq->type(), TypeModeMember, getPackage(contained));
-
- //
- // Indexed getter.
- //
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << "public " << elem;
- out << nl << "get" << capName << "(int _index)";
- out << sb;
- out << nl << "return " << name << "[_index];";
- out << eb;
-
- //
- // Indexed setter.
- //
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << "public void";
- out << nl << "set" << capName << "(int _index, " << elem << " _val)";
- out << sb;
- out << nl << name << "[_index] = _val;";
- out << eb;
- }
- }
+ string capName = p->name();
+ capName[0] = toupper(capName[0]);
+
+ //
+ // If container is a class, get all of its operations so that we can check for conflicts.
+ //
+ OperationList ops;
+ string file, line;
+ ClassDefPtr cls = ClassDefPtr::dynamicCast(container);
+ if(cls)
+ {
+ ops = cls->allOperations();
+ DefinitionContextPtr dc = p->definitionContext();
+ file = dc->filename();
+ line = p->line();
+ if(!validateGetterSetter(ops, "get" + capName, 0, file, line) ||
+ !validateGetterSetter(ops, "set" + capName, 1, file, line))
+ {
+ return;
+ }
+ }
+
+ //
+ // Getter.
+ //
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public " << s;
+ out << nl << "get" << capName << "()";
+ out << sb;
+ out << nl << "return " << name << ';';
+ out << eb;
+
+ //
+ // Setter.
+ //
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public void";
+ out << nl << "set" << capName << '(' << s << " _" << name << ')';
+ out << sb;
+ out << nl << name << " = _" << name << ';';
+ out << eb;
+
+ //
+ // Check for bool type.
+ //
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(b && b->kind() == Builtin::KindBool)
+ {
+ if(cls && !validateGetterSetter(ops, "is" + capName, 0, file, line))
+ {
+ return;
+ }
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public boolean";
+ out << nl << "is" << capName << "()";
+ out << sb;
+ out << nl << "return " << name << ';';
+ out << eb;
+ }
+
+ //
+ // Check for unmodified sequence type and emit indexing methods.
+ //
+ SequencePtr seq = SequencePtr::dynamicCast(type);
+ if(seq)
+ {
+ if(!hasTypeMetaData(seq, metaData))
+ {
+ if(cls &&
+ (!validateGetterSetter(ops, "get" + capName, 1, file, line) ||
+ !validateGetterSetter(ops, "set" + capName, 2, file, line)))
+ {
+ return;
+ }
+
+ string elem = typeToString(seq->type(), TypeModeMember, getPackage(contained));
+
+ //
+ // Indexed getter.
+ //
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public " << elem;
+ out << nl << "get" << capName << "(int _index)";
+ out << sb;
+ out << nl << "return " << name << "[_index];";
+ out << eb;
+
+ //
+ // Indexed setter.
+ //
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public void";
+ out << nl << "set" << capName << "(int _index, " << elem << " _val)";
+ out << sb;
+ out << nl << name << "[_index] = _val;";
+ out << eb;
+ }
+ }
}
}
@@ -2748,49 +2748,49 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
string deprecateReason = getDeprecateReason(p, 0, "type");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
bool java2 = p->definitionContext()->findMetaData("java:java2") == "java:java2";
if(java2)
{
- out << nl << "public final class " << name;
+ out << nl << "public final class " << name;
}
else
{
- out << nl << "public enum " << name;
+ out << nl << "public enum " << name;
}
out << sb;
if(!java2)
{
- int n;
- for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
- {
- if(en != enumerators.begin())
- {
- out << ',';
- }
- out << nl << fixKwd((*en)->name()) << '(' << n << ')';
- }
- out << ';';
- out << sp;
+ int n;
+ for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
+ {
+ if(en != enumerators.begin())
+ {
+ out << ',';
+ }
+ out << nl << fixKwd((*en)->name()) << '(' << n << ')';
+ }
+ out << ';';
+ out << sp;
}
out << nl << "private static " << name << "[] __values = new " << name << "[" << sz << "];";
if(!java2)
{
- out << nl << "static";
- out << sb;
- int n;
- for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
- {
- out << nl << "__values[" << n << "] = " << fixKwd((*en)->name()) << ';';
- }
- out << eb;
+ out << nl << "static";
+ out << sb;
+ int n;
+ for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
+ {
+ out << nl << "__values[" << n << "] = " << fixKwd((*en)->name()) << ';';
+ }
+ out << eb;
}
out << nl << "private int __value;";
@@ -2798,18 +2798,18 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
// For backward compatibility, we keep the integer member in the Java5 mapping.
//
{
- out << sp;
- int n;
- for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
- {
- string member = fixKwd((*en)->name());
- out << nl << "public static final int _" << member << " = " << n << ';';
- if(java2)
- {
- out << nl << "public static final " << name << ' ' << fixKwd(member)
- << " = new " << name << "(_" << member << ");";
- }
- }
+ out << sp;
+ int n;
+ for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
+ {
+ string member = fixKwd((*en)->name());
+ out << nl << "public static final int _" << member << " = " << n << ';';
+ if(java2)
+ {
+ out << nl << "public static final " << name << ' ' << fixKwd(member)
+ << " = new " << name << "(_" << member << ");";
+ }
+ }
}
out << sp << nl << "public static " << name << nl << "convert(int val)";
@@ -2838,10 +2838,10 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
if(java2)
{
- out << sp << nl << "public String" << nl << "toString()";
- out << sb;
- out << nl << "return __T[__value];";
- out << eb;
+ out << sp << nl << "public String" << nl << "toString()";
+ out << sb;
+ out << nl << "return __T[__value];";
+ out << eb;
}
out << sp << nl << "private" << nl << name << "(int val)";
@@ -2849,7 +2849,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "__value = val;";
if(java2)
{
- out << nl << "__values[val] = this;";
+ out << nl << "__values[val] = this;";
}
out << eb;
@@ -2935,18 +2935,18 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
if(java2)
{
- out << sp << nl << "final static private String[] __T =";
- out << sb;
- en = enumerators.begin();
- while(en != enumerators.end())
- {
- out << nl << "\"" << (*en)->name() << "\"";
- if(++en != enumerators.end())
- {
- out << ',';
- }
- }
- out << eb << ';';
+ out << sp << nl << "final static private String[] __T =";
+ out << sb;
+ en = enumerators.begin();
+ while(en != enumerators.end())
+ {
+ out << nl << "\"" << (*en)->name() << "\"";
+ if(++en != enumerators.end())
+ {
+ out << ',';
+ }
+ }
+ out << eb << ';';
}
out << eb;
@@ -2974,76 +2974,76 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
EnumPtr ep;
if(bp = BuiltinPtr::dynamicCast(type))
{
- switch(bp->kind())
- {
- case Builtin::KindString:
- {
- out << "\"";
-
- const string val = p->value();
- for(string::const_iterator c = val.begin(); c != val.end(); ++c)
- {
- if(isascii(*c) && isprint(*c))
- {
- switch(*c)
- {
- case '\\':
- case '"':
- {
- out << "\\";
- break;
- }
- }
- out << *c;
- }
- else
- {
- switch(*c)
- {
- case '\r':
- {
- out << "\\r";
- break;
- }
- case '\n':
- {
- out << "\\n";
- break;
- }
- default:
- {
- unsigned char uc = *c;
- ostringstream s;
- s << "\\u";
- s.flags(ios_base::hex);
- s.width(4);
- s.fill('0');
- s << static_cast<unsigned>(uc);
- out << s.str();
- break;
- }
- }
- }
- }
-
- out << "\"";
- break;
- }
- case Builtin::KindByte:
- {
- int i = atoi(p->value().c_str());
- if(i > 127)
- {
- i -= 256;
- }
- out << i; // Slice byte runs from 0-255, Java byte runs from -128 - 127.
- break;
- }
- case Builtin::KindLong:
- {
- out << p->value() << "L"; // Need to append "L" modifier for long constants.
- break;
- }
+ switch(bp->kind())
+ {
+ case Builtin::KindString:
+ {
+ out << "\"";
+
+ const string val = p->value();
+ for(string::const_iterator c = val.begin(); c != val.end(); ++c)
+ {
+ if(isascii(*c) && isprint(*c))
+ {
+ switch(*c)
+ {
+ case '\\':
+ case '"':
+ {
+ out << "\\";
+ break;
+ }
+ }
+ out << *c;
+ }
+ else
+ {
+ switch(*c)
+ {
+ case '\r':
+ {
+ out << "\\r";
+ break;
+ }
+ case '\n':
+ {
+ out << "\\n";
+ break;
+ }
+ default:
+ {
+ unsigned char uc = *c;
+ ostringstream s;
+ s << "\\u";
+ s.flags(ios_base::hex);
+ s.width(4);
+ s.fill('0');
+ s << static_cast<unsigned>(uc);
+ out << s.str();
+ break;
+ }
+ }
+ }
+ }
+
+ out << "\"";
+ break;
+ }
+ case Builtin::KindByte:
+ {
+ int i = atoi(p->value().c_str());
+ if(i > 127)
+ {
+ i -= 256;
+ }
+ out << i; // Slice byte runs from 0-255, Java byte runs from -128 - 127.
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ out << p->value() << "L"; // Need to append "L" modifier for long constants.
+ break;
+ }
case Builtin::KindBool:
case Builtin::KindShort:
case Builtin::KindInt:
@@ -3052,11 +3052,11 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
case Builtin::KindObject:
case Builtin::KindObjectProxy:
case Builtin::KindLocalObject:
- {
- out << p->value();
+ {
+ out << p->value();
break;
- }
- }
+ }
+ }
}
else if(ep = EnumPtr::dynamicCast(type))
@@ -3067,11 +3067,11 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
{
val.erase(0, pos + 1);
}
- out << getAbsolute(ep, package) << '.' << fixKwd(val);
+ out << getAbsolute(ep, package) << '.' << fixKwd(val);
}
else
{
- out << p->value();
+ out << p->value();
}
out << ';' << eb;
close();
@@ -3079,21 +3079,21 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
bool
Slice::Gen::TypesVisitor::validateGetterSetter(const OperationList& ops, const std::string& name, int numArgs,
- const string& file, const string& line)
+ const string& file, const string& line)
{
for(OperationList::const_iterator i = ops.begin(); i != ops.end(); ++i)
{
- if((*i)->name() == name)
- {
- int numParams = static_cast<int>((*i)->parameters().size());
- if(numArgs >= numParams && numArgs - numParams <= 1)
- {
- cerr << file << ":" << line
- << ": error: operation `" << name << "' conflicts with getter/setter method" << endl;
- return false;
- }
- break;
- }
+ if((*i)->name() == name)
+ {
+ int numParams = static_cast<int>((*i)->parameters().size());
+ if(numArgs >= numParams && numArgs - numParams <= 1)
+ {
+ cerr << file << ":" << line
+ << ": error: operation `" << name << "' conflicts with getter/setter method" << endl;
+ return false;
+ }
+ break;
+ }
}
return true;
}
@@ -3181,37 +3181,37 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
out << sb;
out << nl << "this.value = value;";
out << eb;
- if(!p->isLocal())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(p))
- {
- out << sp << nl << "public class Patcher implements IceInternal.Patcher";
+ if(!p->isLocal())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(p))
+ {
+ out << sp << nl << "public class Patcher implements IceInternal.Patcher";
if(_stream)
{
out << ", Ice.ReadObjectCallback";
}
- out << sb;
- out << nl << "public void";
- out << nl << "patch(Ice.Object v)";
- out << sb;
- out << nl << "try";
- out << sb;
- out << nl << "value = (" << typeS << ")v;";
- out << eb;
- out << nl << "catch(ClassCastException ex)";
- out << sb;
- out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
- out << nl << "_e.type = v.ice_id();";
- out << nl << "_e.expectedType = type();";
- out << nl << "throw _e;";
- out << eb;
- out << eb;
-
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- out << nl << "return \"" << p->typeId() << "\";";
- out << eb;
+ out << sb;
+ out << nl << "public void";
+ out << nl << "patch(Ice.Object v)";
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ out << nl << "value = (" << typeS << ")v;";
+ out << eb;
+ out << nl << "catch(ClassCastException ex)";
+ out << sb;
+ out << nl << "Ice.UnexpectedObjectException _e = new Ice.UnexpectedObjectException();";
+ out << nl << "_e.type = v.ice_id();";
+ out << nl << "_e.expectedType = type();";
+ out << nl << "throw _e;";
+ out << eb;
+ out << eb;
+
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ out << nl << "return \"" << p->typeId() << "\";";
+ out << eb;
if(_stream)
{
@@ -3220,15 +3220,15 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
out << nl << "patch(v);";
out << eb;
}
- out << eb;
-
- out << sp << nl << "public Patcher";
- out << nl << "getPatcher()";
- out << sb;
- out << nl << "return new Patcher();";
- out << eb;
- }
- }
+ out << eb;
+
+ out << sp << nl << "public Patcher";
+ out << nl << "getPatcher()";
+ out << sb;
+ out << nl << "return new Patcher();";
+ out << eb;
+ }
+ }
out << sp << nl << "public " << typeS << " value;";
out << eb;
close();
@@ -3285,8 +3285,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = *r;
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string opName = fixKwd(op->name());
TypePtr ret = op->returnType();
string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData());
@@ -3311,51 +3311,51 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "return ";
}
- out << opName << spar << args << "null" << "false" << epar << ';';
+ out << opName << spar << args << "null" << "false" << epar << ';';
out << eb;
- out << sp;
+ out << sp;
out << nl << "public " << retS << nl << opName << spar << params << contextParam << epar;
writeThrowsClause(package, throws);
out << sb;
- out << nl;
+ out << nl;
if(ret)
{
out << "return ";
}
- out << opName << spar << args << "__ctx" << "true" << epar << ';';
+ out << opName << spar << args << "__ctx" << "true" << epar << ';';
out << eb;
out << sp;
- //
- // TODO: If we eventually drop support for Java2, we can remove this
- // SupressWarnings annotation. Meanwhile, it is necessary to prevent
- // a compiler warning about an unchecked conversion. This is caused
- // by the fact that _emptyContext returns the unchecked type
- // java.util.Map but Ice.Context is mapped to Map<String, String>.
- //
- if(!java2)
- {
- out << nl << "@SuppressWarnings(\"unchecked\")";
- }
+ //
+ // TODO: If we eventually drop support for Java2, we can remove this
+ // SupressWarnings annotation. Meanwhile, it is necessary to prevent
+ // a compiler warning about an unchecked conversion. This is caused
+ // by the fact that _emptyContext returns the unchecked type
+ // java.util.Map but Ice.Context is mapped to Map<String, String>.
+ //
+ if(!java2)
+ {
+ out << nl << "@SuppressWarnings(\"unchecked\")";
+ }
out << nl << "private " << retS << nl << opName << spar << params << contextParam
- << explicitContextParam << epar;
+ << explicitContextParam << epar;
writeThrowsClause(package, throws);
out << sb;
- out << nl << "if(__explicitCtx && __ctx == null)";
- out << sb;
- out << nl << "__ctx = _emptyContext;";
- out << eb;
+ out << nl << "if(__explicitCtx && __ctx == null)";
+ out << sb;
+ out << nl << "__ctx = _emptyContext;";
+ out << eb;
out << nl << "int __cnt = 0;";
out << nl << "while(true)";
out << sb;
out << nl << "Ice._ObjectDel __delBase = null;";
out << nl << "try";
out << sb;
- if(op->returnsData())
- {
- out << nl << "__checkTwowayOnly(\"" << opName << "\");";
- }
+ if(op->returnsData())
+ {
+ out << nl << "__checkTwowayOnly(\"" << opName << "\");";
+ }
out << nl << "__delBase = __getDelegate();";
out << nl << '_' << name << "Del __del = (_" << name << "Del)__delBase;";
out << nl;
@@ -3387,43 +3387,43 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
out << eb;
- if(cl->hasMetaData("ami") || op->hasMetaData("ami"))
- {
- vector<string> paramsAMI = getParamsAsync(op, package, false);
- vector<string> argsAMI = getArgsAsync(op);
-
- //
- // Write two versions of the operation - with and without a
- // context parameter
- //
- out << sp;
- out << nl << "public void" << nl << op->name() << "_async" << spar << paramsAMI << epar;
- out << sb;
- out << nl << "__cb.__invoke" << spar << "this" << argsAMI << "null" << epar << ';';
- out << eb;
-
- out << sp;
- //
- // TODO: If we eventually drop support for Java2, we can remove this
- // SupressWarnings annotation. Meanwhile, it is necessary to prevent
- // a compiler warning about an unchecked conversion. This is caused
- // by the fact that _emptyContext returns the unchecked type
- // java.util.Map but Ice.Context is mapped to Map<String, String>.
- //
- if(!java2)
- {
- out << nl << "@SuppressWarnings(\"unchecked\")";
- }
- out << nl << "public void" << nl << op->name() << "_async" << spar << paramsAMI
- << contextParam << epar;
- out << sb;
- out << nl << "if( __ctx == null)";
- out << sb;
- out << nl << "__ctx = _emptyContext;";
- out << eb;
- out << nl << "__cb.__invoke" << spar << "this" << argsAMI << "__ctx" << epar << ';';
- out << eb;
- }
+ if(cl->hasMetaData("ami") || op->hasMetaData("ami"))
+ {
+ vector<string> paramsAMI = getParamsAsync(op, package, false);
+ vector<string> argsAMI = getArgsAsync(op);
+
+ //
+ // Write two versions of the operation - with and without a
+ // context parameter
+ //
+ out << sp;
+ out << nl << "public void" << nl << op->name() << "_async" << spar << paramsAMI << epar;
+ out << sb;
+ out << nl << "__cb.__invoke" << spar << "this" << argsAMI << "null" << epar << ';';
+ out << eb;
+
+ out << sp;
+ //
+ // TODO: If we eventually drop support for Java2, we can remove this
+ // SupressWarnings annotation. Meanwhile, it is necessary to prevent
+ // a compiler warning about an unchecked conversion. This is caused
+ // by the fact that _emptyContext returns the unchecked type
+ // java.util.Map but Ice.Context is mapped to Map<String, String>.
+ //
+ if(!java2)
+ {
+ out << nl << "@SuppressWarnings(\"unchecked\")";
+ }
+ out << nl << "public void" << nl << op->name() << "_async" << spar << paramsAMI
+ << contextParam << epar;
+ out << sb;
+ out << nl << "if( __ctx == null)";
+ out << sb;
+ out << nl << "__ctx = _emptyContext;";
+ out << eb;
+ out << nl << "__cb.__invoke" << spar << "this" << argsAMI << "__ctx" << epar << ';';
+ out << eb;
+ }
}
out << sp << nl << "public static " << name << "Prx" << nl << "checkedCast(Ice.ObjectPrx __obj)";
@@ -3449,7 +3449,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
out << sp << nl << "public static " << name << "Prx" << nl << "checkedCast(Ice.ObjectPrx __obj, " << contextParam
- << ')';
+ << ')';
out << sb;
out << nl << name << "Prx __d = null;";
out << nl << "if(__obj != null)";
@@ -3695,7 +3695,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << sb;
out << nl << typeS << " __v;";
iter = 0;
- writeSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
+ writeSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
out << nl << "return __v;";
out << eb;
@@ -3746,42 +3746,42 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
if(open(helper))
{
Output& out = output();
- int iter;
+ int iter;
out << sp << nl << "public final class " << name << "Helper";
out << sb;
out << nl << "public static void" << nl << "write(IceInternal.BasicStream __os, " << abstractType << " __v)";
out << sb;
- iter = 0;
+ iter = 0;
writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
- out << eb;
+ out << eb;
- out << sp << nl << "public static " << abstractType
- << nl << "read(IceInternal.BasicStream __is)";
- out << sb;
- out << nl << abstractType << " __v = new " << concreteType << "();";
- iter = 0;
- writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
- out << nl << "return __v;";
- out << eb;
+ out << sp << nl << "public static " << abstractType
+ << nl << "read(IceInternal.BasicStream __is)";
+ out << sb;
+ out << nl << abstractType << " __v = new " << concreteType << "();";
+ iter = 0;
+ writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
+ out << nl << "return __v;";
+ out << eb;
if(_stream)
{
out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __outS, " << abstractType
- << " __v)";
+ << " __v)";
out << sb;
- iter = 0;
- writeStreamDictionaryMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
+ iter = 0;
+ writeStreamDictionaryMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
out << eb;
- out << sp << nl << "public static " << abstractType
+ out << sp << nl << "public static " << abstractType
<< nl << "read(Ice.InputStream __inS)";
out << sb;
- out << nl << abstractType << " __v = new " << concreteType << "();";
- iter = 0;
- writeStreamDictionaryMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
- out << nl << "return __v;";
+ out << nl << abstractType << " __v = new " << concreteType << "();";
+ iter = 0;
+ writeStreamDictionaryMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
+ out << nl << "return __v;";
out << eb;
}
@@ -3910,18 +3910,18 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
out << sp;
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public " << retS << ' ' << name << spar << params << epar;
writeThrowsClause(package, throws);
out << ';';
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
bool java2 = p->definitionContext()->findMetaData("java:java2") == "java:java2";
@@ -3933,27 +3933,27 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
if(cl->hasMetaData("ami") || p->hasMetaData("ami"))
{
- vector<string> paramsAMI = getParamsAsync(p, package, false);
-
- //
- // Write two versions of the operation - with and without a
- // context parameter.
- //
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << "public void " << p->name() << "_async" << spar << paramsAMI << epar << ';';
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << "public void " << p->name() << "_async" << spar << paramsAMI << contextParam << epar << ';';
+ vector<string> paramsAMI = getParamsAsync(p, package, false);
+
+ //
+ // Write two versions of the operation - with and without a
+ // context parameter.
+ //
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public void " << p->name() << "_async" << spar << paramsAMI << epar << ';';
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public void " << p->name() << "_async" << spar << paramsAMI << contextParam << epar << ';';
}
}
@@ -4080,34 +4080,34 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
ParamDeclList inParams;
ParamDeclList outParams;
- ParamDeclList paramList = op->parameters();
- ParamDeclList::const_iterator pli;
- for(pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- else
- {
- inParams.push_back(*pli);
- }
- }
+ ParamDeclList paramList = op->parameters();
+ ParamDeclList::const_iterator pli;
+ for(pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ else
+ {
+ inParams.push_back(*pli);
+ }
+ }
ExceptionList throws = op->throws();
throws.sort();
throws.unique();
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
vector<string> params = getParams(op, package);
@@ -4118,50 +4118,50 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "IceInternal.Outgoing __og = __connection.getOutgoing(__reference, \"" << op->name() << "\", "
- << sliceModeToIceMode(op->sendMode()) << ", __ctx, __compress);";
+ << sliceModeToIceMode(op->sendMode()) << ", __ctx, __compress);";
out << nl << "try";
out << sb;
if(!inParams.empty())
{
- out << nl << "try";
- out << sb;
+ out << nl << "try";
+ out << sb;
out << nl << "IceInternal.BasicStream __os = __og.os();";
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
- writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, false,
- (*pli)->getMetaData());
- }
- if(op->sendsClasses())
- {
- out << nl << "__os.writePendingObjects();";
- }
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "__og.abort(__ex);";
- out << eb;
- }
- out << nl << "boolean __ok = __og.invoke();";
- out << nl << "try";
- out << sb;
- out << nl << "IceInternal.BasicStream __is = __og.is();";
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, false,
+ (*pli)->getMetaData());
+ }
+ if(op->sendsClasses())
+ {
+ out << nl << "__os.writePendingObjects();";
+ }
+ out << eb;
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "__og.abort(__ex);";
+ out << eb;
+ }
+ out << nl << "boolean __ok = __og.invoke();";
+ out << nl << "try";
+ out << sb;
+ out << nl << "IceInternal.BasicStream __is = __og.is();";
out << nl << "if(!__ok)";
out << sb;
out << nl << "try";
out << sb;
- out << nl << "__is.throwException();";
+ out << nl << "__is.throwException();";
out << eb;
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
- {
- out << nl << "catch(" << getAbsolute(*t, package) << " __ex)";
- out << sb;
- out << nl << "throw __ex;";
- out << eb;
- }
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ out << nl << "catch(" << getAbsolute(*t, package) << " __ex)";
+ out << sb;
+ out << nl << "throw __ex;";
+ out << eb;
+ }
+ out << nl << "catch(Ice.UserException __ex)";
+ out << sb;
out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
- out << eb;
+ out << eb;
out << eb;
for(pli = outParams.begin(); pli != outParams.end(); ++pli)
{
@@ -4170,39 +4170,39 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
}
if(ret)
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- out << nl << retS << "Holder __ret = new " << retS << "Holder();";
- out << nl << "__is.readObject(__ret.getPatcher());";
- }
- else
- {
- out << nl << retS << " __ret;";
- writeMarshalUnmarshalCode(out, package, ret, "__ret", false, iter, false, opMetaData);
- }
- }
- if(op->returnsClasses())
- {
- out << nl << "__is.readPendingObjects();";
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- out << nl << "return __ret.value;";
- }
- else
- {
- out << nl << "return __ret;";
- }
- }
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "throw new IceInternal.LocalExceptionWrapper(__ex, false);";
- out << eb;
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ out << nl << retS << "Holder __ret = new " << retS << "Holder();";
+ out << nl << "__is.readObject(__ret.getPatcher());";
+ }
+ else
+ {
+ out << nl << retS << " __ret;";
+ writeMarshalUnmarshalCode(out, package, ret, "__ret", false, iter, false, opMetaData);
+ }
+ }
+ if(op->returnsClasses())
+ {
+ out << nl << "__is.readPendingObjects();";
+ }
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ out << nl << "return __ret.value;";
+ }
+ else
+ {
+ out << nl << "return __ret;";
+ }
+ }
+ out << eb;
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "throw new IceInternal.LocalExceptionWrapper(__ex, false);";
+ out << eb;
out << eb;
out << nl << "finally";
out << sb;
@@ -4254,8 +4254,8 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = *r;
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string opName = fixKwd(op->name());
TypePtr ret = op->returnType();
string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData());
@@ -4267,63 +4267,63 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
vector<string> params = getParams(op, package);
vector<string> args = getArgs(op);
- out << sp;
+ out << sp;
out << nl << "public " << retS << nl << opName << spar << params << contextParam << epar;
writeDelegateThrowsClause(package, throws);
out << sb;
- if(cl->hasMetaData("amd") || op->hasMetaData("amd"))
- {
- out << nl << "throw new Ice.CollocationOptimizationException();";
- }
- else
- {
- StringList metaData = op->getMetaData();
- out << nl << "Ice.Current __current = new Ice.Current();";
- out << nl << "__initCurrent(__current, \"" << op->name() << "\", "
- << sliceModeToIceMode(op->sendMode())
- << ", __ctx);";
- out << nl << "while(true)";
- out << sb;
- out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__current);";
- out << nl << "try";
- out << sb;
- out << nl << fixKwd(name) << " __servant = null;";
- out << nl << "try";
- out << sb;
- out << nl << "__servant = (" << fixKwd(name) << ")__direct.servant();";
- out << eb;
- out << nl << "catch(ClassCastException __ex)";
- out << sb;
- out << nl << "Ice.OperationNotExistException __opEx = new Ice.OperationNotExistException();";
- out << nl << "__opEx.id = __current.id;";
- out << nl << "__opEx.facet = __current.facet;";
- out << nl << "__opEx.operation = __current.operation;";
- out << nl << "throw __opEx;";
- out << eb;
+ if(cl->hasMetaData("amd") || op->hasMetaData("amd"))
+ {
+ out << nl << "throw new Ice.CollocationOptimizationException();";
+ }
+ else
+ {
+ StringList metaData = op->getMetaData();
+ out << nl << "Ice.Current __current = new Ice.Current();";
+ out << nl << "__initCurrent(__current, \"" << op->name() << "\", "
+ << sliceModeToIceMode(op->sendMode())
+ << ", __ctx);";
+ out << nl << "while(true)";
+ out << sb;
+ out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__current);";
+ out << nl << "try";
+ out << sb;
+ out << nl << fixKwd(name) << " __servant = null;";
out << nl << "try";
out << sb;
- out << nl;
- if(ret)
- {
- out << "return ";
- }
- out << "__servant." << opName << spar << args << "__current" << epar << ';';
- if(!ret)
- {
- out << nl << "return;";
- }
+ out << nl << "__servant = (" << fixKwd(name) << ")__direct.servant();";
+ out << eb;
+ out << nl << "catch(ClassCastException __ex)";
+ out << sb;
+ out << nl << "Ice.OperationNotExistException __opEx = new Ice.OperationNotExistException();";
+ out << nl << "__opEx.id = __current.id;";
+ out << nl << "__opEx.facet = __current.facet;";
+ out << nl << "__opEx.operation = __current.operation;";
+ out << nl << "throw __opEx;";
+ out << eb;
+ out << nl << "try";
+ out << sb;
+ out << nl;
+ if(ret)
+ {
+ out << "return ";
+ }
+ out << "__servant." << opName << spar << args << "__current" << epar << ';';
+ if(!ret)
+ {
+ out << nl << "return;";
+ }
out << eb;
out << nl << "catch(Ice.LocalException __ex)";
out << sb;
out << nl << "throw new IceInternal.LocalExceptionWrapper(__ex, false);";
- out << eb;
- out << eb;
- out << nl << "finally";
- out << sb;
- out << nl << "__direct.destroy();";
- out << eb;
- out << eb;
- }
+ out << eb;
+ out << eb;
+ out << nl << "finally";
+ out << sb;
+ out << nl << "__direct.destroy();";
+ out << eb;
+ out << eb;
+ }
out << eb;
}
@@ -4523,25 +4523,25 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& package,
if(!local && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
{
- vector<string> paramsAMD = getParamsAsync(op, package, true);
+ vector<string> paramsAMD = getParamsAsync(op, package, true);
out << sp << nl << "public void" << nl << opName << "_async" << spar << paramsAMD << "Ice.Current __current"
- << epar;
+ << epar;
ExceptionList throws = op->throws();
throws.sort();
throws.unique();
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
writeThrowsClause(package, throws);
@@ -4717,15 +4717,15 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public class " << name << 'I';
if(inheritImpl)
{
- out << " extends ";
+ out << " extends ";
if(bases.front()->isAbstract())
- {
- out << bases.front()->name() << 'I';
- }
- else
- {
- out << fixKwd(bases.front()->name());
- }
+ {
+ out << bases.front()->name() << 'I';
+ }
+ else
+ {
+ out << fixKwd(bases.front()->name());
+ }
}
out << " implements " << '_' << name << "Operations";
if(p->isLocal())
@@ -4786,7 +4786,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
if(cl->isLocal())
{
- return;
+ return;
}
string name = p->name();
@@ -4795,148 +4795,148 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
if(cl->hasMetaData("ami") || p->hasMetaData("ami"))
{
- string classNameAMI = "AMI_" + cl->name();
- string absoluteAMI = getAbsolute(cl, "", "AMI_", "_" + name);
+ string classNameAMI = "AMI_" + cl->name();
+ string absoluteAMI = getAbsolute(cl, "", "AMI_", "_" + name);
- if(!open(absoluteAMI))
- {
- return;
- }
-
- Output& out = output();
+ if(!open(absoluteAMI))
+ {
+ return;
+ }
+
+ Output& out = output();
TypePtr ret = p->returnType();
- ParamDeclList inParams;
+ ParamDeclList inParams;
ParamDeclList outParams;
- ParamDeclList paramList = p->parameters();
- ParamDeclList::const_iterator pli;
- for(pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- else
- {
- inParams.push_back(*pli);
- }
- }
+ ParamDeclList paramList = p->parameters();
+ ParamDeclList::const_iterator pli;
+ for(pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ else
+ {
+ inParams.push_back(*pli);
+ }
+ }
ExceptionList throws = p->throws();
throws.sort();
throws.unique();
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
int iter;
- vector<string> params = getParamsAsyncCB(p, classPkg);
- vector<string> args = getArgsAsyncCB(p);
-
- vector<string> paramsInvoke = getParamsAsync(p, classPkg, false);
-
- out << sp << nl << "public abstract class " << classNameAMI << '_' << name
- << " extends IceInternal.OutgoingAsync";
- out << sb;
- out << sp;
- out << nl << "public abstract void ice_response" << spar << params << epar << ';';
- out << nl << "public abstract void ice_exception(Ice.LocalException ex);";
- if(!throws.empty())
- {
- out << nl << "public abstract void ice_exception(Ice.UserException ex);";
- }
-
- bool java2 = p->definitionContext()->findMetaData("java:java2") == "java:java2";
- string contextParam = java2 ? "java.util.Map __ctx" : "java.util.Map<String, String> __ctx";
-
- out << sp << nl << "public final void" << nl << "__invoke" << spar << "Ice.ObjectPrx __prx"
- << paramsInvoke << contextParam << epar;
- out << sb;
- out << nl << "try";
- out << sb;
- out << nl << "__prepare(__prx, \"" << p->name() << "\", "
- << sliceModeToIceMode(p->sendMode()) << ", __ctx);";
+ vector<string> params = getParamsAsyncCB(p, classPkg);
+ vector<string> args = getArgsAsyncCB(p);
+
+ vector<string> paramsInvoke = getParamsAsync(p, classPkg, false);
+
+ out << sp << nl << "public abstract class " << classNameAMI << '_' << name
+ << " extends IceInternal.OutgoingAsync";
+ out << sb;
+ out << sp;
+ out << nl << "public abstract void ice_response" << spar << params << epar << ';';
+ out << nl << "public abstract void ice_exception(Ice.LocalException ex);";
+ if(!throws.empty())
+ {
+ out << nl << "public abstract void ice_exception(Ice.UserException ex);";
+ }
+
+ bool java2 = p->definitionContext()->findMetaData("java:java2") == "java:java2";
+ string contextParam = java2 ? "java.util.Map __ctx" : "java.util.Map<String, String> __ctx";
+
+ out << sp << nl << "public final void" << nl << "__invoke" << spar << "Ice.ObjectPrx __prx"
+ << paramsInvoke << contextParam << epar;
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ out << nl << "__prepare(__prx, \"" << p->name() << "\", "
+ << sliceModeToIceMode(p->sendMode()) << ", __ctx);";
iter = 0;
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
StringList metaData = (*pli)->getMetaData();
- string typeS = typeToString((*pli)->type(), TypeModeIn, classPkg, metaData);
- writeMarshalUnmarshalCode(out, classPkg, (*pli)->type(), fixKwd((*pli)->name()), true, iter, false,
+ string typeS = typeToString((*pli)->type(), TypeModeIn, classPkg, metaData);
+ writeMarshalUnmarshalCode(out, classPkg, (*pli)->type(), fixKwd((*pli)->name()), true, iter, false,
metaData);
- }
- if(p->sendsClasses())
- {
- out << nl << "__os.writePendingObjects();";
- }
- out << nl << "__os.endWriteEncaps();";
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "__finished(__ex);";
- out << nl << "return;";
- out << eb;
- out << nl << "__send();";
- out << eb;
-
- out << sp << nl << "protected final void" << nl << "__response(boolean __ok)";
- out << sb;
+ }
+ if(p->sendsClasses())
+ {
+ out << nl << "__os.writePendingObjects();";
+ }
+ out << nl << "__os.endWriteEncaps();";
+ out << eb;
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "__finished(__ex);";
+ out << nl << "return;";
+ out << eb;
+ out << nl << "__send();";
+ out << eb;
+
+ out << sp << nl << "protected final void" << nl << "__response(boolean __ok)";
+ out << sb;
for(pli = outParams.begin(); pli != outParams.end(); ++pli)
{
TypePtr paramType = (*pli)->type();
string paramName = fixKwd((*pli)->name());
string typeS = typeToString(paramType, TypeModeIn, classPkg, (*pli)->getMetaData());
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- }
- else
- {
- out << nl << typeS << ' ' << paramName << ';';
- }
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ }
}
if(ret)
{
- string retS = typeToString(ret, TypeModeIn, classPkg, opMetaData);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- out << nl << retS << "Holder __ret = new " << retS << "Holder();";
- }
- else
- {
- out << nl << retS << " __ret;";
- }
- }
- out << nl << "try";
- out << sb;
- out << nl << "if(!__ok)";
+ string retS = typeToString(ret, TypeModeIn, classPkg, opMetaData);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ out << nl << retS << "Holder __ret = new " << retS << "Holder();";
+ }
+ else
+ {
+ out << nl << retS << " __ret;";
+ }
+ }
+ out << nl << "try";
+ out << sb;
+ out << nl << "if(!__ok)";
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ out << nl << "__is.throwException();";
+ out << eb;
+ for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
+ {
+ out << nl << "catch(" << getAbsolute(*r, classPkg) << " __ex)";
+ out << sb;
+ out << nl << "ice_exception(__ex);";
+ out << nl << "return;";
+ out << eb;
+ }
+ out << nl << "catch(Ice.UserException __ex)";
out << sb;
- out << nl << "try";
- out << sb;
- out << nl << "__is.throwException();";
- out << eb;
- for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
- {
- out << nl << "catch(" << getAbsolute(*r, classPkg) << " __ex)";
- out << sb;
- out << nl << "ice_exception(__ex);";
- out << nl << "return;";
- out << eb;
- }
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
out << eb;
out << eb;
@@ -4944,186 +4944,186 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
{
TypePtr paramType = (*pli)->type();
string paramName = fixKwd((*pli)->name());
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << "__is.readObject(" << paramName << ".getPatcher());";
- }
- else
- {
- writeMarshalUnmarshalCode(out, classPkg, paramType, paramName, false, iter, false,
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << "__is.readObject(" << paramName << ".getPatcher());";
+ }
+ else
+ {
+ writeMarshalUnmarshalCode(out, classPkg, paramType, paramName, false, iter, false,
(*pli)->getMetaData());
- }
+ }
}
if(ret)
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- out << nl << "__is.readObject(__ret.getPatcher());";
- }
- else
- {
- writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", false, iter, false, opMetaData);
- }
- }
- if(p->returnsClasses())
- {
- out << nl << "__is.readPendingObjects();";
- }
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "__finished(__ex);";
- out << nl << "return;";
- out << eb;
- out << nl << "ice_response" << spar << args << epar << ';';
- out << eb;
- out << eb;
-
- close();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ out << nl << "__is.readObject(__ret.getPatcher());";
+ }
+ else
+ {
+ writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", false, iter, false, opMetaData);
+ }
+ }
+ if(p->returnsClasses())
+ {
+ out << nl << "__is.readPendingObjects();";
+ }
+ out << eb;
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "__finished(__ex);";
+ out << nl << "return;";
+ out << eb;
+ out << nl << "ice_response" << spar << args << epar << ';';
+ out << eb;
+ out << eb;
+
+ close();
}
if(cl->hasMetaData("amd") || p->hasMetaData("amd"))
{
- string classNameAMD = "AMD_" + cl->name();
- string absoluteAMD = getAbsolute(cl, "", "AMD_", "_" + name);
-
- string classNameAMDI = "_AMD_" + cl->name();
- string absoluteAMDI = getAbsolute(cl, "", "_AMD_", "_" + name);
-
- vector<string> paramsAMD = getParamsAsyncCB(p, classPkg);
-
- {
- if(!open(absoluteAMD))
- {
- return;
- }
-
- Output& out = output();
-
- out << sp << nl << "public interface " << classNameAMD << '_' << name;
- out << sb;
- out << sp << nl << "void ice_response" << spar << paramsAMD << epar << ';';
- out << sp << nl << "void ice_exception(java.lang.Exception ex);";
- out << eb;
-
- close();
- }
-
- {
- if(!open(absoluteAMDI))
- {
- return;
- }
-
- Output& out = output();
-
- TypePtr ret = p->returnType();
-
- ParamDeclList outParams;
- ParamDeclList paramList = p->parameters();
- ParamDeclList::const_iterator pli;
- for(pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- }
-
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ string classNameAMD = "AMD_" + cl->name();
+ string absoluteAMD = getAbsolute(cl, "", "AMD_", "_" + name);
+
+ string classNameAMDI = "_AMD_" + cl->name();
+ string absoluteAMDI = getAbsolute(cl, "", "_AMD_", "_" + name);
+
+ vector<string> paramsAMD = getParamsAsyncCB(p, classPkg);
+
+ {
+ if(!open(absoluteAMD))
+ {
+ return;
+ }
+
+ Output& out = output();
+
+ out << sp << nl << "public interface " << classNameAMD << '_' << name;
+ out << sb;
+ out << sp << nl << "void ice_response" << spar << paramsAMD << epar << ';';
+ out << sp << nl << "void ice_exception(java.lang.Exception ex);";
+ out << eb;
+
+ close();
+ }
+
+ {
+ if(!open(absoluteAMDI))
+ {
+ return;
+ }
+
+ Output& out = output();
+
+ TypePtr ret = p->returnType();
+
+ ParamDeclList outParams;
+ ParamDeclList paramList = p->parameters();
+ ParamDeclList::const_iterator pli;
+ for(pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ }
+
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- int iter;
+ int iter;
- out << sp << nl << "final class " << classNameAMDI << '_' << name
- << " extends IceInternal.IncomingAsync implements " << classNameAMD << '_' << name;
- out << sb;
+ out << sp << nl << "final class " << classNameAMDI << '_' << name
+ << " extends IceInternal.IncomingAsync implements " << classNameAMD << '_' << name;
+ out << sb;
- out << sp << nl << "public" << nl << classNameAMDI << '_' << name << "(IceInternal.Incoming in)";
- out << sb;
- out << nl << "super(in);";
- out << eb;
+ out << sp << nl << "public" << nl << classNameAMDI << '_' << name << "(IceInternal.Incoming in)";
+ out << sb;
+ out << nl << "super(in);";
+ out << eb;
- out << sp << nl << "public void" << nl << "ice_response" << spar << paramsAMD << epar;
- out << sb;
+ out << sp << nl << "public void" << nl << "ice_response" << spar << paramsAMD << epar;
+ out << sb;
iter = 0;
- if(ret || !outParams.empty())
- {
- out << nl << "try";
- out << sb;
- out << nl << "IceInternal.BasicStream __os = this.__os();";
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
+ if(ret || !outParams.empty())
+ {
+ out << nl << "try";
+ out << sb;
+ out << nl << "IceInternal.BasicStream __os = this.__os();";
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
StringList metaData = (*pli)->getMetaData();
- string typeS = typeToString((*pli)->type(), TypeModeIn, classPkg, metaData);
- writeMarshalUnmarshalCode(out, classPkg, (*pli)->type(), fixKwd((*pli)->name()), true, iter,
+ string typeS = typeToString((*pli)->type(), TypeModeIn, classPkg, metaData);
+ writeMarshalUnmarshalCode(out, classPkg, (*pli)->type(), fixKwd((*pli)->name()), true, iter,
false, metaData);
- }
- if(ret)
- {
- string retS = typeToString(ret, TypeModeIn, classPkg, opMetaData);
- writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", true, iter, false, opMetaData);
- }
- if(p->returnsClasses())
- {
- out << nl << "__os.writePendingObjects();";
- }
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "ice_exception(__ex);";
- out << eb;
- }
- out << nl << "__response(true);";
- out << eb;
-
- out << sp << nl << "public void" << nl << "ice_exception(java.lang.Exception ex)";
- out << sb;
- if(throws.empty())
- {
- out << nl << "__exception(ex);";
- }
- else
- {
- out << nl << "try";
- out << sb;
- out << nl << "throw ex;";
- out << eb;
- ExceptionList::const_iterator r;
- for(r = throws.begin(); r != throws.end(); ++r)
- {
- string exS = getAbsolute(*r, classPkg);
- out << nl << "catch(" << exS << " __ex)";
- out << sb;
- out << nl << "__os().writeUserException(__ex);";
- out << nl << "__response(false);";
- out << eb;
- }
- out << nl << "catch(java.lang.Exception __ex)";
- out << sb;
- out << nl << "__exception(__ex);";
- out << eb;
- }
- out << eb;
-
- out << eb;
-
- close();
- }
+ }
+ if(ret)
+ {
+ string retS = typeToString(ret, TypeModeIn, classPkg, opMetaData);
+ writeMarshalUnmarshalCode(out, classPkg, ret, "__ret", true, iter, false, opMetaData);
+ }
+ if(p->returnsClasses())
+ {
+ out << nl << "__os.writePendingObjects();";
+ }
+ out << eb;
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "ice_exception(__ex);";
+ out << eb;
+ }
+ out << nl << "__response(true);";
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "ice_exception(java.lang.Exception ex)";
+ out << sb;
+ if(throws.empty())
+ {
+ out << nl << "__exception(ex);";
+ }
+ else
+ {
+ out << nl << "try";
+ out << sb;
+ out << nl << "throw ex;";
+ out << eb;
+ ExceptionList::const_iterator r;
+ for(r = throws.begin(); r != throws.end(); ++r)
+ {
+ string exS = getAbsolute(*r, classPkg);
+ out << nl << "catch(" << exS << " __ex)";
+ out << sb;
+ out << nl << "__os().writeUserException(__ex);";
+ out << nl << "__response(false);";
+ out << eb;
+ }
+ out << nl << "catch(java.lang.Exception __ex)";
+ out << sb;
+ out << nl << "__exception(__ex);";
+ out << eb;
+ }
+ out << eb;
+
+ out << eb;
+
+ close();
+ }
}
}
diff --git a/cpp/src/slice2java/Gen.h b/cpp/src/slice2java/Gen.h
index 07cfd847a4c..8326dd115e3 100644
--- a/cpp/src/slice2java/Gen.h
+++ b/cpp/src/slice2java/Gen.h
@@ -98,7 +98,7 @@ private:
virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- void writeOperations(const ClassDefPtr&, bool);
+ void writeOperations(const ClassDefPtr&, bool);
};
class TieVisitor : public JavaVisitor
@@ -137,11 +137,11 @@ private:
private:
- //
- // Verifies that a getter/setter method does not conflict with an operation.
- //
- bool validateGetterSetter(const OperationList&, const std::string&, int, const std::string&,
- const std::string&);
+ //
+ // Verifies that a getter/setter method does not conflict with an operation.
+ //
+ bool validateGetterSetter(const OperationList&, const std::string&, int, const std::string&,
+ const std::string&);
bool _stream;
};
diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp
index b2014f0e247..6daeac74c03 100644
--- a/cpp/src/slice2java/Main.cpp
+++ b/cpp/src/slice2java/Main.cpp
@@ -30,12 +30,12 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--tie Generate TIE classes.\n"
"--impl Generate sample implementations.\n"
"--impl-tie Generate sample TIE implementations.\n"
- "--depend Generate Makefile dependencies.\n"
+ "--depend Generate Makefile dependencies.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--checksum CLASS Generate checksums for Slice definitions into CLASS.\n"
@@ -75,20 +75,20 @@ main(int argc, char* argv[])
catch(const IceUtil::BadOptException& e)
{
cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -96,19 +96,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -157,101 +157,101 @@ main(int argc, char* argv[])
for(i = args.begin(); i != args.end(); ++i)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::Java);
- }
- else
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- return EXIT_FAILURE;
- }
-
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive, globalMetadata);
- int parseStatus = p->parse(cppHandle, debug, Ice);
-
- if(!icecpp.close())
- {
- p->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- Gen gen(argv[0], icecpp.getBaseName(), includePaths, output);
- if(!gen)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- gen.generate(p, stream);
- if(tie)
- {
- gen.generateTie(p);
- }
- if(impl)
- {
- gen.generateImpl(p);
- }
- if(implTie)
- {
- gen.generateImplTie(p);
- }
- if(!checksumClass.empty())
- {
- //
- // Calculate checksums for the Slice definitions in the unit.
- //
- ChecksumMap m = createChecksums(p);
- copy(m.begin(), m.end(), inserter(checksums, checksums.begin()));
- }
- }
- p->destroy();
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::Java);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ return EXIT_FAILURE;
+ }
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive, globalMetadata);
+ int parseStatus = p->parse(cppHandle, debug, Ice);
+
+ if(!icecpp.close())
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ Gen gen(argv[0], icecpp.getBaseName(), includePaths, output);
+ if(!gen)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ gen.generate(p, stream);
+ if(tie)
+ {
+ gen.generateTie(p);
+ }
+ if(impl)
+ {
+ gen.generateImpl(p);
+ }
+ if(implTie)
+ {
+ gen.generateImplTie(p);
+ }
+ if(!checksumClass.empty())
+ {
+ //
+ // Calculate checksums for the Slice definitions in the unit.
+ //
+ ChecksumMap m = createChecksums(p);
+ copy(m.begin(), m.end(), inserter(checksums, checksums.begin()));
+ }
+ }
+ p->destroy();
+ }
+ }
}
if(!checksumClass.empty())
{
- //
- // Look for the Java2 metadata.
- //
- bool java2 = false;
- for(StringList::iterator p = globalMetadata.begin(); p != globalMetadata.end(); ++p)
- {
- if((*p) == "java:java2")
- {
- java2 = true;
- break;
- }
- }
- Gen::writeChecksumClass(checksumClass, output, checksums, java2);
+ //
+ // Look for the Java2 metadata.
+ //
+ bool java2 = false;
+ for(StringList::iterator p = globalMetadata.begin(); p != globalMetadata.end(); ++p)
+ {
+ if((*p) == "java:java2")
+ {
+ java2 = true;
+ break;
+ }
+ }
+ Gen::writeChecksumClass(checksumClass, output, checksums, java2);
}
return status;
diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp
index 38f6cca5c5f..13e728b15cb 100644
--- a/cpp/src/slice2javae/Gen.cpp
+++ b/cpp/src/slice2javae/Gen.cpp
@@ -37,26 +37,26 @@ sliceModeToIceMode(Operation::Mode opMode)
string mode;
switch(opMode)
{
- case Operation::Normal:
- {
- mode = "Ice.OperationMode.Normal";
- break;
- }
- case Operation::Nonmutating:
- {
- mode = "Ice.OperationMode.Nonmutating";
- break;
- }
- case Operation::Idempotent:
- {
- mode = "Ice.OperationMode.Idempotent";
- break;
- }
- default:
- {
- assert(false);
- break;
- }
+ case Operation::Normal:
+ {
+ mode = "Ice.OperationMode.Normal";
+ break;
+ }
+ case Operation::Nonmutating:
+ {
+ mode = "Ice.OperationMode.Nonmutating";
+ break;
+ }
+ case Operation::Idempotent:
+ {
+ mode = "Ice.OperationMode.Idempotent";
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
}
return mode;
}
@@ -120,7 +120,7 @@ Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
StringList metaData = (*q)->getMetaData();
- string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
+ string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
metaData);
params.push_back(typeString + ' ' + fixKwd((*q)->name()));
}
@@ -155,12 +155,12 @@ Slice::JavaVisitor::writeThrowsClause(const string& package, const ExceptionList
int count = 0;
for(r = throws.begin(); r != throws.end(); ++r)
{
- if(count > 0)
- {
- out << "," << nl;
- }
- out << getAbsolute(*r, package);
- count++;
+ if(count > 0)
+ {
+ out << "," << nl;
+ }
+ out << getAbsolute(*r, package);
+ count++;
}
out.restoreIndent();
out.dec();
@@ -239,18 +239,18 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- out << nl << "if(" << name << " != null)";
- out << sb;
- out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << name << ".length; __i" << iter
- << "++)";
- out << sb;
- ostringstream elem;
- elem << name << "[__i" << iter << ']';
- iter++;
- writeHashCode(out, seq->type(), elem.str(), iter);
- out << eb;
- out << eb;
- return;
+ out << nl << "if(" << name << " != null)";
+ out << sb;
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << name << ".length; __i" << iter
+ << "++)";
+ out << sb;
+ ostringstream elem;
+ elem << name << "[__i" << iter << ']';
+ iter++;
+ writeHashCode(out, seq->type(), elem.str(), iter);
+ out << eb;
+ out << eb;
+ return;
}
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
@@ -284,15 +284,15 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sb;
{
- StringList::const_iterator q = ids.begin();
- while(q != ids.end())
- {
- out << nl << '"' << *q << '"';
- if(++q != ids.end())
- {
- out << ',';
- }
- }
+ StringList::const_iterator q = ids.begin();
+ while(q != ids.end())
+ {
+ out << nl << '"' << *q << '"';
+ if(++q != ids.end())
+ {
+ out << ',';
+ }
+ }
}
out << eb << ';';
@@ -339,85 +339,85 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
+ OperationPtr op = *r;
string opName = op->name();
ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- assert(cl);
-
- vector<string> params;
- vector<string> args;
- TypePtr ret;
-
- opName = fixKwd(opName);
- ret = op->returnType();
- params = getParams(op, package);
- args = getArgs(op);
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Only generate a "no current" version of the operation if it hasn't been done in a base
- // class already, because the "no current" version is final.
- //
- bool generateOperation = cl == p; // Generate if the operation is defined in this class.
- if(!generateOperation)
- {
- //
- // The operation is not defined in this class.
- //
- if(!bases.empty())
- {
- //
- // Check if the operation is already implemented by a base class.
- //
- bool implementedByBase = false;
- if(!bases.front()->isInterface())
- {
- OperationList baseOps = bases.front()->allOperations();
- OperationList::const_iterator i;
- for(i = baseOps.begin(); i != baseOps.end(); ++i)
- {
- if((*i)->name() == op->name())
- {
- implementedByBase = true;
- break;
- }
- }
- if(i == baseOps.end())
- {
- generateOperation = true;
- }
- }
- if(!generateOperation && !implementedByBase)
- {
- //
- // No base class defines the operation. Check if one of the
- // interfaces defines it, in which case this class must provide it.
- //
- if(bases.front()->isInterface() || bases.size() > 1)
- {
- generateOperation = true;
- }
- }
- }
- }
- if(generateOperation)
- {
- out << sp << nl << "public final " << typeToString(ret, TypeModeReturn, package, op->getMetaData())
- << nl << opName << spar << params << epar;
- writeThrowsClause(package, throws);
- out << sb << nl;
- if(ret)
- {
- out << nl << "return ";
- }
- out << opName << spar << args << "null" << epar << ';';
- out << eb;
- }
+ assert(cl);
+
+ vector<string> params;
+ vector<string> args;
+ TypePtr ret;
+
+ opName = fixKwd(opName);
+ ret = op->returnType();
+ params = getParams(op, package);
+ args = getArgs(op);
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Only generate a "no current" version of the operation if it hasn't been done in a base
+ // class already, because the "no current" version is final.
+ //
+ bool generateOperation = cl == p; // Generate if the operation is defined in this class.
+ if(!generateOperation)
+ {
+ //
+ // The operation is not defined in this class.
+ //
+ if(!bases.empty())
+ {
+ //
+ // Check if the operation is already implemented by a base class.
+ //
+ bool implementedByBase = false;
+ if(!bases.front()->isInterface())
+ {
+ OperationList baseOps = bases.front()->allOperations();
+ OperationList::const_iterator i;
+ for(i = baseOps.begin(); i != baseOps.end(); ++i)
+ {
+ if((*i)->name() == op->name())
+ {
+ implementedByBase = true;
+ break;
+ }
+ }
+ if(i == baseOps.end())
+ {
+ generateOperation = true;
+ }
+ }
+ if(!generateOperation && !implementedByBase)
+ {
+ //
+ // No base class defines the operation. Check if one of the
+ // interfaces defines it, in which case this class must provide it.
+ //
+ if(bases.front()->isInterface() || bases.size() > 1)
+ {
+ generateOperation = true;
+ }
+ }
+ }
+ }
+ if(generateOperation)
+ {
+ out << sp << nl << "public final " << typeToString(ret, TypeModeReturn, package, op->getMetaData())
+ << nl << opName << spar << params << epar;
+ writeThrowsClause(package, throws);
+ out << sb << nl;
+ if(ret)
+ {
+ out << nl << "return ";
+ }
+ out << opName << spar << args << "null" << epar << ';';
+ out << eb;
+ }
}
//
@@ -432,157 +432,157 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
StringList opMetaData = op->getMetaData();
ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- assert(cl);
+ assert(cl);
string opName = op->name();
out << sp << nl << "public static IceInternal.DispatchStatus" << nl << "___" << opName << '(' << name
- << " __obj, IceInternal.Incoming __in, Ice.Current __current)";
+ << " __obj, IceInternal.Incoming __in, Ice.Current __current)";
out << sb;
- TypePtr ret = op->returnType();
-
- ParamDeclList inParams;
- ParamDeclList outParams;
- ParamDeclList paramList = op->parameters();
- ParamDeclList::const_iterator pli;
- for(pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- else
- {
- inParams.push_back(*pli);
- }
- }
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ TypePtr ret = op->returnType();
+
+ ParamDeclList inParams;
+ ParamDeclList outParams;
+ ParamDeclList paramList = op->parameters();
+ ParamDeclList::const_iterator pli;
+ for(pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ else
+ {
+ inParams.push_back(*pli);
+ }
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- int iter;
-
- out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
- if(!inParams.empty())
- {
- out << nl << "IceInternal.BasicStream __is = __in.is();";
- }
- if(!outParams.empty() || ret || !throws.empty())
- {
- out << nl << "IceInternal.BasicStream __os = __in.os();";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- iter = 0;
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
+ int iter;
+
+ out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+ if(!inParams.empty())
+ {
+ out << nl << "IceInternal.BasicStream __is = __in.is();";
+ }
+ if(!outParams.empty() || ret || !throws.empty())
+ {
+ out << nl << "IceInternal.BasicStream __os = __in.os();";
+ }
+
+ //
+ // Unmarshal 'in' parameters.
+ //
+ iter = 0;
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
StringList metaData = (*pli)->getMetaData();
TypePtr paramType = (*pli)->type();
string paramName = fixKwd((*pli)->name());
- string typeS = typeToString(paramType, TypeModeIn, package, metaData);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true,
- metaData, string());
- }
- else
- {
- out << nl << typeS << ' ' << paramName << ';';
- writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
- }
- }
-
- //
- // Create holders for 'out' parameters.
- //
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData());
- out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
- }
-
- //
- // Call on the servant.
- //
- if(!throws.empty())
- {
- out << nl << "try";
- out << sb;
- }
- out << nl;
- if(ret)
- {
- string retS = typeToString(ret, TypeModeReturn, package, opMetaData);
- out << retS << " __ret = ";
- }
- out << "__obj." << fixKwd(opName) << '(';
- for(pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
+ string typeS = typeToString(paramType, TypeModeIn, package, metaData);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, true,
+ metaData, string());
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ writeMarshalUnmarshalCode(out, package, paramType, paramName, false, iter, false, metaData);
+ }
+ }
+
+ //
+ // Create holders for 'out' parameters.
+ //
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData());
+ out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
+ }
+
+ //
+ // Call on the servant.
+ //
+ if(!throws.empty())
+ {
+ out << nl << "try";
+ out << sb;
+ }
+ out << nl;
+ if(ret)
+ {
+ string retS = typeToString(ret, TypeModeReturn, package, opMetaData);
+ out << retS << " __ret = ";
+ }
+ out << "__obj." << fixKwd(opName) << '(';
+ for(pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
TypePtr paramType = (*pli)->type();
- out << fixKwd((*pli)->name());
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << ".value";
- }
- out << ", ";
- }
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- out << fixKwd((*pli)->name()) << ", ";
- }
- out << "__current);";
-
- //
- // Marshal 'out' parameters and return value.
- //
- for(pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, true,
+ out << fixKwd((*pli)->name());
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << ".value";
+ }
+ out << ", ";
+ }
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ out << fixKwd((*pli)->name()) << ", ";
+ }
+ out << "__current);";
+
+ //
+ // Marshal 'out' parameters and return value.
+ //
+ for(pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), fixKwd((*pli)->name()), true, iter, true,
(*pli)->getMetaData());
- }
- if(ret)
- {
- writeMarshalUnmarshalCode(out, package, ret, "__ret", true, iter, false, opMetaData);
- }
- out << nl << "return IceInternal.DispatchStatus.DispatchOK;";
-
- //
- // Handle user exceptions.
- //
- if(!throws.empty())
- {
- out << eb;
- ExceptionList::const_iterator t;
- for(t = throws.begin(); t != throws.end(); ++t)
- {
- string exS = getAbsolute(*t, package);
- out << nl << "catch(" << exS << " ex)";
- out << sb;
- out << nl << "__os.writeUserException(ex);";
- out << nl << "return IceInternal.DispatchStatus.DispatchUserException;";
- out << eb;
- }
- }
-
- out << eb;
+ }
+ if(ret)
+ {
+ writeMarshalUnmarshalCode(out, package, ret, "__ret", true, iter, false, opMetaData);
+ }
+ out << nl << "return IceInternal.DispatchStatus.DispatchOK;";
+
+ //
+ // Handle user exceptions.
+ //
+ if(!throws.empty())
+ {
+ out << eb;
+ ExceptionList::const_iterator t;
+ for(t = throws.begin(); t != throws.end(); ++t)
+ {
+ string exS = getAbsolute(*t, package);
+ out << nl << "catch(" << exS << " ex)";
+ out << sb;
+ out << nl << "__os.writeUserException(ex);";
+ out << nl << "return IceInternal.DispatchStatus.DispatchUserException;";
+ out << eb;
+ }
+ }
+
+ out << eb;
}
OperationList allOps = p->allOperations();
@@ -613,7 +613,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << eb << ';';
out << sp << nl << "public IceInternal.DispatchStatus" << nl
- << "__dispatch(IceInternal.Incoming in, Ice.Current __current)";
+ << "__dispatch(IceInternal.Incoming in, Ice.Current __current)";
out << sb;
out << nl << "int pos = IceUtil.Arrays.search(__all, __current.operation);";
out << nl << "if(pos < 0)";
@@ -681,8 +681,8 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << eb;
}
out << eb;
- out << nl << "if(IceUtil.Debug.ASSERT)";
- out << sb;
+ out << nl << "if(IceUtil.Debug.ASSERT)";
+ out << sb;
out << sp << nl << "IceUtil.Debug.Assert(false);";
out << eb;
out << nl << "return IceInternal.DispatchStatus.DispatchOperationNotExist;";
@@ -773,7 +773,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
- writeOperations(p, false);
+ writeOperations(p, false);
}
writeOperations(p, true);
@@ -789,7 +789,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
string opIntfName = "Operations";
if(noCurrent || p->isLocal())
{
- opIntfName += "NC";
+ opIntfName += "NC";
}
string absolute = getAbsolute(p, "", "_", opIntfName);
@@ -834,39 +834,39 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
+ OperationPtr op = *r;
ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string opname = op->name();
-
- TypePtr ret;
- vector<string> params;
-
- params = getParams(op, package);
- ret = op->returnType();
-
- string deprecateReason = getDeprecateReason(op, p, "operation");
-
- string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData());
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
- }
- out << nl << retS << ' ' << fixKwd(opname) << spar << params;
- if(!noCurrent && !p->isLocal())
- {
- out << "Ice.Current __current";
- }
- out << epar;
- writeThrowsClause(package, throws);
- out << ';';
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string opname = op->name();
+
+ TypePtr ret;
+ vector<string> params;
+
+ params = getParams(op, package);
+ ret = op->returnType();
+
+ string deprecateReason = getDeprecateReason(op, p, "operation");
+
+ string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData());
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << retS << ' ' << fixKwd(opname) << spar << params;
+ if(!noCurrent && !p->isLocal())
+ {
+ out << "Ice.Current __current";
+ }
+ out << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
}
out << eb;
@@ -964,18 +964,18 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
if(p->isLocal())
{
- out << sp << nl << "public java.lang.Object" << nl << "ice_clone()";
- out.inc();
- out << nl << "throws IceUtil.CloneException";
- out.dec();
- out << sb;
- out << sp << nl << "return new _" << name << "Tie(_ice_delegate);";
- out << eb;
+ out << sp << nl << "public java.lang.Object" << nl << "ice_clone()";
+ out.inc();
+ out << nl << "throws IceUtil.CloneException";
+ out.dec();
+ out << sb;
+ out << sp << nl << "return new _" << name << "Tie(_ice_delegate);";
+ out << eb;
out << sp << nl << "public int" << nl << "ice_hash()";
- out << sb;
- out << nl << "return hashCode();";
- out << eb;
+ out << sb;
+ out << nl << "return hashCode();";
+ out << eb;
}
out << sp << nl << "public int" << nl << "hashCode()";
@@ -987,16 +987,16 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- ContainerPtr container = (*r)->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ ContainerPtr container = (*r)->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string opName = fixKwd((*r)->name());
+ string opName = fixKwd((*r)->name());
TypePtr ret = (*r)->returnType();
string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData());
vector<string> params = getParams((*r), package);
- vector<string> args = getArgs(*r);
+ vector<string> args = getArgs(*r);
out << sp;
out << nl << "public " << retS << nl << opName << spar << params;
@@ -1084,7 +1084,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDefPtr baseClass;
if(!bases.empty() && !bases.front()->isInterface())
{
- baseClass = bases.front();
+ baseClass = bases.front();
}
string package = getPackage(p);
@@ -1115,15 +1115,15 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "Ice.Object";
}
- out << "," << nl << '_' << name;
- if(!p->isLocal())
- {
- out << "Operations, _" << name << "OperationsNC";
- }
- else
- {
- out << "OperationsNC";
- }
+ out << "," << nl << '_' << name;
+ if(!p->isLocal())
+ {
+ out << "Operations, _" << name << "OperationsNC";
+ }
+ else
+ {
+ out << "OperationsNC";
+ }
if(!bases.empty())
{
ClassList::const_iterator q = bases.begin();
@@ -1168,10 +1168,10 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
StringList implements;
if(p->isAbstract())
{
- if(!p->isLocal())
- {
- implements.push_back("_" + name + "Operations");
- }
+ if(!p->isLocal())
+ {
+ implements.push_back("_" + name + "Operations");
+ }
implements.push_back("_" + name + "OperationsNC");
}
if(!bases.empty())
@@ -1210,49 +1210,49 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface() && !allDataMembers.empty())
{
- //
- // Constructors.
- //
- out << sp;
- out << nl << "public " << name << "()";
- out << sb;
- if(baseClass)
- {
- out << nl << "super();";
- }
- out << eb;
-
- out << sp << nl << "public " << name << spar;
- vector<string> paramDecl;
- for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
- {
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
- paramDecl.push_back(memberType + " " + memberName);
- }
- out << paramDecl << epar;
- out << sb;
- if(baseClass && allDataMembers.size() != members.size())
- {
- out << nl << "super" << spar;
- vector<string> baseParamNames;
- DataMemberList baseDataMembers = baseClass->allDataMembers();
- for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
- {
- baseParamNames.push_back(fixKwd((*d)->name()));
- }
- out << baseParamNames << epar << ';';
- }
- vector<string> paramNames;
- for(d = members.begin(); d != members.end(); ++d)
- {
- paramNames.push_back(fixKwd((*d)->name()));
- }
- for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
- {
- out << nl << "this." << *i << " = " << *i << ';';
- }
- out << eb;
+ //
+ // Constructors.
+ //
+ out << sp;
+ out << nl << "public " << name << "()";
+ out << sb;
+ if(baseClass)
+ {
+ out << nl << "super();";
+ }
+ out << eb;
+
+ out << sp << nl << "public " << name << spar;
+ vector<string> paramDecl;
+ for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(baseClass && allDataMembers.size() != members.size())
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = baseClass->allDataMembers();
+ for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ out << baseParamNames << epar << ';';
+ }
+ vector<string> paramNames;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ paramNames.push_back(fixKwd((*d)->name()));
+ }
+ for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+ {
+ out << nl << "this." << *i << " = " << *i << ';';
+ }
+ out << eb;
}
//
@@ -1265,19 +1265,19 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface() && !members.empty())
{
- out << sp << nl << "protected void" << nl << "__copyFrom(java.lang.Object __obj)";
- out << sb;
- if(baseClass)
- {
- out << nl << "super.__copyFrom(__obj);";
- }
- out << nl << name << " __src = (" << name << ")__obj;";
- for(d = members.begin(); d != members.end(); ++d)
- {
- string memberName = fixKwd((*d)->name());
- out << nl << memberName << " = __src." << memberName << ";";
- }
- out << eb;
+ out << sp << nl << "protected void" << nl << "__copyFrom(java.lang.Object __obj)";
+ out << sb;
+ if(baseClass)
+ {
+ out << nl << "super.__copyFrom(__obj);";
+ }
+ out << nl << name << " __src = (" << name << ")__obj;";
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ out << nl << memberName << " = __src." << memberName << ";";
+ }
+ out << eb;
}
return true;
@@ -1315,9 +1315,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
string deprecateReason = getDeprecateReason(p, 0, "type");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public class " << name << " extends ";
@@ -1341,49 +1341,49 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(!allDataMembers.empty())
{
- //
- // Constructors.
- //
- out << sp;
- out << nl << "public " << name << "()";
- out << sb;
- if(base)
- {
- out << nl << "super();";
- }
- out << eb;
-
- out << sp << nl << "public " << name << spar;
- vector<string> paramDecl;
- for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
- {
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
- paramDecl.push_back(memberType + " " + memberName);
- }
- out << paramDecl << epar;
- out << sb;
- if(base && allDataMembers.size() != members.size())
- {
- out << nl << "super" << spar;
- vector<string> baseParamNames;
- DataMemberList baseDataMembers = base->allDataMembers();
- for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
- {
- baseParamNames.push_back(fixKwd((*d)->name()));
- }
- out << baseParamNames << epar << ';';
- }
- vector<string> paramNames;
- for(d = members.begin(); d != members.end(); ++d)
- {
- paramNames.push_back(fixKwd((*d)->name()));
- }
- for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
- {
- out << nl << "this." << *i << " = " << *i << ';';
- }
- out << eb;
+ //
+ // Constructors.
+ //
+ out << sp;
+ out << nl << "public " << name << "()";
+ out << sb;
+ if(base)
+ {
+ out << nl << "super();";
+ }
+ out << eb;
+
+ out << sp << nl << "public " << name << spar;
+ vector<string> paramDecl;
+ for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(base && allDataMembers.size() != members.size())
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = base->allDataMembers();
+ for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ out << baseParamNames << epar << ';';
+ }
+ vector<string> paramNames;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ paramNames.push_back(fixKwd((*d)->name()));
+ }
+ for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+ {
+ out << nl << "this." << *i << " = " << *i << ';';
+ }
+ out << eb;
}
out << sp << nl << "public String" << nl << "ice_name()";
@@ -1412,105 +1412,105 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp << nl << "public void" << nl << "__write(IceInternal.BasicStream __os)";
out << sb;
- out << nl << "__os.writeString(\"" << scoped << "\");";
- out << nl << "__os.startWriteSlice();";
+ out << nl << "__os.writeString(\"" << scoped << "\");";
+ out << nl << "__os.startWriteSlice();";
iter = 0;
for(d = members.begin(); d != members.end(); ++d)
{
StringList metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false, metaData);
}
- out << nl << "__os.endWriteSlice();";
+ out << nl << "__os.endWriteSlice();";
if(base)
{
out << nl << "super.__write(__os);";
}
out << eb;
- DataMemberList allClassMembers = p->allClassDataMembers();
- if(allClassMembers.size() != 0)
- {
- out << sp << nl << "private class Patcher implements IceInternal.Patcher";
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << sp << nl << "Patcher(int member)";
- out << sb;
- out << nl << "__member = member;";
- out << eb;
- }
-
- out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << nl << "switch(__member)";
- out << sb;
- }
- int memberCount = 0;
- for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
- {
- if(allClassMembers.size() > 1)
- {
- out.dec();
- out << nl << "case " << memberCount << ":";
- out.inc();
- }
- if(allClassMembers.size() > 1)
- {
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
- }
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package);
- out << nl << memberName << " = (" << memberType << ")v;";
- if(allClassMembers.size() > 1)
- {
- out << nl << "break;";
- }
- memberCount++;
- }
- if(allClassMembers.size() > 1)
- {
- out << eb;
- }
- out << eb;
-
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- if(allClassMembers.size() > 1)
- {
- out << nl << "return __typeId;";
- }
- else
- {
- out << nl << "return \"" << (*allClassMembers.begin())->type()->typeId() << "\";";
- }
- out << eb;
-
- if(allClassMembers.size() > 1)
- {
- out << sp << nl << "private int __member;";
- out << nl << "private String __typeId;";
- }
- out << eb;
- }
+ DataMemberList allClassMembers = p->allClassDataMembers();
+ if(allClassMembers.size() != 0)
+ {
+ out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << sp << nl << "Patcher(int member)";
+ out << sb;
+ out << nl << "__member = member;";
+ out << eb;
+ }
+
+ out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "switch(__member)";
+ out << sb;
+ }
+ int memberCount = 0;
+ for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
+ {
+ if(allClassMembers.size() > 1)
+ {
+ out.dec();
+ out << nl << "case " << memberCount << ":";
+ out.inc();
+ }
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ }
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package);
+ out << nl << memberName << " = (" << memberType << ")v;";
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(allClassMembers.size() > 1)
+ {
+ out << eb;
+ }
+ out << eb;
+
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ if(allClassMembers.size() > 1)
+ {
+ out << nl << "return __typeId;";
+ }
+ else
+ {
+ out << nl << "return \"" << (*allClassMembers.begin())->type()->typeId() << "\";";
+ }
+ out << eb;
+
+ if(allClassMembers.size() > 1)
+ {
+ out << sp << nl << "private int __member;";
+ out << nl << "private String __typeId;";
+ }
+ out << eb;
+ }
out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is, boolean __rid)";
out << sb;
- out << nl << "if(__rid)";
- out << sb;
- out << nl << "String myId = __is.readString();";
- out << eb;
- out << nl << "__is.startReadSlice();";
+ out << nl << "if(__rid)";
+ out << sb;
+ out << nl << "String myId = __is.readString();";
+ out << eb;
+ out << nl << "__is.startReadSlice();";
iter = 0;
- DataMemberList classMembers = p->classDataMembers();
+ DataMemberList classMembers = p->classDataMembers();
for(d = members.begin(); d != members.end(); ++d)
{
- ostringstream patchParams;
+ ostringstream patchParams;
StringList metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData,
- patchParams.str());
+ patchParams.str());
}
- out << nl << "__is.endReadSlice();";
+ out << nl << "__is.endReadSlice();";
if(base)
{
out << nl << "super.__read(__is, true);";
@@ -1541,9 +1541,9 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
string deprecateReason = getDeprecateReason(p, 0, "type");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public final class " << name;
@@ -1575,17 +1575,17 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
vector<string>::const_iterator q;
for(d = members.begin(); d != members.end(); ++d)
{
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
- paramDecl.push_back(memberType + " " + memberName);
- paramNames.push_back(memberName);
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ paramNames.push_back(memberName);
}
out << sp << nl << "public " << name << spar << paramDecl << epar;
out << sb;
for(q = paramNames.begin(); q != paramNames.end(); ++q)
{
- out << nl << "this." << *q << " = " << *q << ';';
+ out << nl << "this." << *q << " = " << *q << ';';
}
out << eb;
@@ -1650,10 +1650,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
SequencePtr seq = SequencePtr::dynamicCast((*d)->type());
if(seq)
{
- out << nl << "if(!IceUtil.Arrays.equals(" << memberName << ", _r." << memberName << "))";
- out << sb;
- out << nl << "return false;";
- out << eb;
+ out << nl << "if(!IceUtil.Arrays.equals(" << memberName << ", _r." << memberName << "))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
}
else
{
@@ -1690,11 +1690,11 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << nl << "return new " << name << '(';
for(q = paramNames.begin(); q != paramNames.end(); ++q)
{
- if(q != paramNames.begin())
- {
- out << ", ";
- }
- out << *q;
+ if(q != paramNames.begin())
+ {
+ out << ", ";
+ }
+ out << *q;
}
out << ");";
out << eb;
@@ -1711,84 +1711,84 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
out << eb;
- DataMemberList classMembers = p->classDataMembers();
-
- if(classMembers.size() != 0)
- {
- out << sp << nl << "private class Patcher implements IceInternal.Patcher";
- out << sb;
- if(classMembers.size() > 1)
- {
- out << sp << nl << "Patcher(int member)";
- out << sb;
- out << nl << "__member = member;";
- out << eb;
- }
-
- out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
- out << sb;
- if(classMembers.size() > 1)
- {
- out << nl << "switch(__member)";
- out << sb;
- }
- int memberCount = 0;
- for(d = classMembers.begin(); d != classMembers.end(); ++d)
- {
- if(classMembers.size() > 1)
- {
- out.dec();
- out << nl << "case " << memberCount << ":";
- out.inc();
- }
- if(classMembers.size() > 1)
- {
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
- }
- string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package);
- out << nl << memberName << " = (" << memberType << ")v;";
- if(classMembers.size() > 1)
- {
- out << nl << "break;";
- }
- memberCount++;
- }
- if(classMembers.size() > 1)
- {
- out << eb;
- }
- out << eb;
-
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- if(classMembers.size() > 1)
- {
- out << nl << "return __typeId;";
- }
- else
- {
- out << nl << "return \"" << (*classMembers.begin())->type()->typeId() << "\";";
- }
- out << eb;
-
- if(classMembers.size() > 1)
- {
- out << sp << nl << "private int __member;";
- out << nl << "private String __typeId;";
- }
- out << eb;
- }
+ DataMemberList classMembers = p->classDataMembers();
+
+ if(classMembers.size() != 0)
+ {
+ out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << sp << nl << "Patcher(int member)";
+ out << sb;
+ out << nl << "__member = member;";
+ out << eb;
+ }
+
+ out << sp << nl << "public void" << nl << "patch(Ice.Object v)";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << nl << "switch(__member)";
+ out << sb;
+ }
+ int memberCount = 0;
+ for(d = classMembers.begin(); d != classMembers.end(); ++d)
+ {
+ if(classMembers.size() > 1)
+ {
+ out.dec();
+ out << nl << "case " << memberCount << ":";
+ out.inc();
+ }
+ if(classMembers.size() > 1)
+ {
+ out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ }
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package);
+ out << nl << memberName << " = (" << memberType << ")v;";
+ if(classMembers.size() > 1)
+ {
+ out << nl << "break;";
+ }
+ memberCount++;
+ }
+ if(classMembers.size() > 1)
+ {
+ out << eb;
+ }
+ out << eb;
+
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << nl << "return __typeId;";
+ }
+ else
+ {
+ out << nl << "return \"" << (*classMembers.begin())->type()->typeId() << "\";";
+ }
+ out << eb;
+
+ if(classMembers.size() > 1)
+ {
+ out << sp << nl << "private int __member;";
+ out << nl << "private String __typeId;";
+ }
+ out << eb;
+ }
out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is)";
out << sb;
iter = 0;
for(d = members.begin(); d != members.end(); ++d)
{
- ostringstream patchParams;
+ ostringstream patchParams;
StringList metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData,
- patchParams.str());
+ patchParams.str());
}
out << eb;
}
@@ -1812,9 +1812,9 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
string deprecateReason = getDeprecateReason(p, contained, "member");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public " << s << ' ' << name << ';';
}
@@ -1840,9 +1840,9 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
string deprecateReason = getDeprecateReason(p, 0, "type");
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public final class " << name;
@@ -1856,7 +1856,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
string member = fixKwd((*en)->name());
out << nl << "public static final int _" << member << " = " << n << ';';
out << nl << "public static final " << name << ' ' << fixKwd(member)
- << " = new " << name << "(_" << member << ");";
+ << " = new " << name << "(_" << member << ");";
}
out << sp << nl << "public static " << name << nl << "convert(int val)";
@@ -1962,76 +1962,76 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
EnumPtr ep;
if(bp = BuiltinPtr::dynamicCast(type))
{
- switch(bp->kind())
- {
- case Builtin::KindString:
- {
- out << "\"";
-
- const string val = p->value();
- for(string::const_iterator c = val.begin(); c != val.end(); ++c)
- {
- if(isascii(*c) && isprint(*c))
- {
- switch(*c)
- {
- case '\\':
- case '"':
- {
- out << "\\";
- break;
- }
- }
- out << *c;
- }
- else
- {
- switch(*c)
- {
- case '\r':
- {
- out << "\\r";
- break;
- }
- case '\n':
- {
- out << "\\n";
- break;
- }
- default:
- {
- unsigned char uc = *c;
- ostringstream s;
- s << "\\u";
- s.flags(ios_base::hex);
- s.width(4);
- s.fill('0');
- s << static_cast<unsigned>(uc);
- out << s.str();
- break;
- }
- }
- }
- }
-
- out << "\"";
- break;
- }
- case Builtin::KindByte:
- {
- int i = atoi(p->value().c_str());
- if(i > 127)
- {
- i -= 256;
- }
- out << i; // Slice byte runs from 0-255, Java byte runs from -128 - 127.
- break;
- }
- case Builtin::KindLong:
- {
- out << p->value() << "L"; // Need to append "L" modifier for long constants.
- break;
- }
+ switch(bp->kind())
+ {
+ case Builtin::KindString:
+ {
+ out << "\"";
+
+ const string val = p->value();
+ for(string::const_iterator c = val.begin(); c != val.end(); ++c)
+ {
+ if(isascii(*c) && isprint(*c))
+ {
+ switch(*c)
+ {
+ case '\\':
+ case '"':
+ {
+ out << "\\";
+ break;
+ }
+ }
+ out << *c;
+ }
+ else
+ {
+ switch(*c)
+ {
+ case '\r':
+ {
+ out << "\\r";
+ break;
+ }
+ case '\n':
+ {
+ out << "\\n";
+ break;
+ }
+ default:
+ {
+ unsigned char uc = *c;
+ ostringstream s;
+ s << "\\u";
+ s.flags(ios_base::hex);
+ s.width(4);
+ s.fill('0');
+ s << static_cast<unsigned>(uc);
+ out << s.str();
+ break;
+ }
+ }
+ }
+ }
+
+ out << "\"";
+ break;
+ }
+ case Builtin::KindByte:
+ {
+ int i = atoi(p->value().c_str());
+ if(i > 127)
+ {
+ i -= 256;
+ }
+ out << i; // Slice byte runs from 0-255, Java byte runs from -128 - 127.
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ out << p->value() << "L"; // Need to append "L" modifier for long constants.
+ break;
+ }
case Builtin::KindBool:
case Builtin::KindShort:
case Builtin::KindInt:
@@ -2040,11 +2040,11 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
case Builtin::KindObject:
case Builtin::KindObjectProxy:
case Builtin::KindLocalObject:
- {
- out << p->value();
+ {
+ out << p->value();
break;
- }
- }
+ }
+ }
}
else if(ep = EnumPtr::dynamicCast(type))
@@ -2055,11 +2055,11 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
{
val.erase(0, pos + 1);
}
- out << getAbsolute(ep, package) << '.' << fixKwd(val);
+ out << getAbsolute(ep, package) << '.' << fixKwd(val);
}
else
{
- out << p->value();
+ out << p->value();
}
out << ';' << eb;
close();
@@ -2200,12 +2200,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
OperationPtr op = *r;
StringList opMetaData = op->getMetaData();
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string opName = fixKwd(op->name());
TypePtr ret = op->returnType();
string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData());
- int iter;
+ int iter;
vector<string> params = getParams(op, package);
vector<string> args = getArgs(op);
@@ -2253,14 +2253,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "int __cnt = 0;";
out << nl << "while(true)";
out << sb;
- out << nl << "Ice.Connection __connection = null;";
+ out << nl << "Ice.Connection __connection = null;";
out << nl << "try";
out << sb;
- if(op->returnsData())
- {
- out << nl << "__checkTwowayOnly(\"" << opName << "\");";
- }
- out << nl << "__connection = ice_getConnection();";
+ if(op->returnsData())
+ {
+ out << nl << "__checkTwowayOnly(\"" << opName << "\");";
+ }
+ out << nl << "__connection = ice_getConnection();";
out << nl << "IceInternal.Outgoing __og = __connection.getOutgoing(_reference, \"" << op->name() << "\", "
<< sliceModeToIceMode(op->sendMode()) << ", __ctx);";
out << nl << "try";
@@ -2330,10 +2330,10 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "__connection.reclaimOutgoing(__og);";
out << eb;
- if(!ret)
- {
+ if(!ret)
+ {
out << nl << "return ;";
- }
+ }
out << eb;
out << nl << "catch(IceInternal.LocalExceptionWrapper __ex)";
out << sb;
@@ -2532,7 +2532,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << sb;
out << nl << typeS << " __v;";
iter = 0;
- writeSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
+ writeSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
out << nl << "return __v;";
out << eb;
@@ -2583,8 +2583,8 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << nl << "java.util.Enumeration __i = __v.keys();";
out << nl << "while(__i.hasMoreElements())";
out << sb;
- out << nl << "java.lang.Object key = __i.nextElement();";
- out << nl << "java.lang.Object value = __v.get(key);";
+ out << nl << "java.lang.Object key = __i.nextElement();";
+ out << nl << "java.lang.Object value = __v.get(key);";
iter = 0;
for(i = 0; i < 2; i++)
{
@@ -2648,7 +2648,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
break;
}
- case Builtin::KindObject:
+ case Builtin::KindObject:
case Builtin::KindLocalObject:
{
assert(false);
@@ -2670,9 +2670,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sp << nl << "public static java.util.Hashtable";
out << nl << "read(IceInternal.BasicStream __is)";
out << sb;
- //
- // JDK 1.1 raises IllegalArgumentException if you pass 0 to the Hashtable constructor.
- //
+ //
+ // JDK 1.1 raises IllegalArgumentException if you pass 0 to the Hashtable constructor.
+ //
out << nl << "int __sz = __is.readSize();";
out << nl << "java.util.Hashtable __r = new java.util.Hashtable(__sz == 0 ? 1 : __sz);";
out << nl << "for(int __i = 0; __i < __sz; __i++)";
@@ -2754,11 +2754,11 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
else
{
string s = typeToString(type, TypeModeIn, package);
- out << nl << s << ' ' << arg << ';';
- writeMarshalUnmarshalCode(out, package, type, arg, false, iter, false);
+ out << nl << s << ' ' << arg << ';';
+ writeMarshalUnmarshalCode(out, package, type, arg, false, iter, false);
}
}
- out << nl << "__r.put(__key, __value);";
+ out << nl << "__r.put(__key, __value);";
out << eb;
out << nl << "return __r;";
out << eb;
@@ -2860,18 +2860,18 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
out << sp;
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public " << retS << ' ' << name << spar << params << epar;
writeThrowsClause(package, throws);
out << ';';
if(!deprecateReason.empty())
{
- out << nl << "/**";
- out << nl << " * @deprecated " << deprecateReason;
- out << nl << " **/";
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
}
out << nl << "public " << retS << ' ' << name << spar << params << "java.util.Hashtable __ctx" << epar;
writeThrowsClause(package, throws);
@@ -3046,10 +3046,10 @@ Slice::Gen::BaseImplVisitor::writeReturn(Output& out, const TypePtr& type)
break;
}
case Builtin::KindObject:
- {
- cerr << "Ice objects cannot be returned by value in IceE." << endl;
- break;
- }
+ {
+ cerr << "Ice objects cannot be returned by value in IceE." << endl;
+ break;
+ }
}
return;
}
@@ -3194,15 +3194,15 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public class " << name << 'I';
if(inheritImpl)
{
- out << " extends ";
+ out << " extends ";
if(bases.front()->isAbstract())
- {
- out << bases.front()->name() << 'I';
- }
- else
- {
- out << fixKwd(bases.front()->name());
- }
+ {
+ out << bases.front()->name() << 'I';
+ }
+ else
+ {
+ out << fixKwd(bases.front()->name());
+ }
}
out << " implements " << '_' << name << "Operations";
if(p->isLocal())
diff --git a/cpp/src/slice2javae/Gen.h b/cpp/src/slice2javae/Gen.h
index f61fcee5f9e..667847b5164 100644
--- a/cpp/src/slice2javae/Gen.h
+++ b/cpp/src/slice2javae/Gen.h
@@ -99,7 +99,7 @@ private:
virtual bool visitClassDefStart(const ClassDefPtr&);
private:
- void writeOperations(const ClassDefPtr&, bool);
+ void writeOperations(const ClassDefPtr&, bool);
};
class TieVisitor : public JavaVisitor
diff --git a/cpp/src/slice2javae/Main.cpp b/cpp/src/slice2javae/Main.cpp
index d47d6d0b054..a431e9f5865 100644
--- a/cpp/src/slice2javae/Main.cpp
+++ b/cpp/src/slice2javae/Main.cpp
@@ -26,12 +26,12 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"--tie Generate TIE classes.\n"
"--impl Generate sample implementations.\n"
"--impl-tie Generate sample TIE implementations.\n"
- "--depend Generate Makefile dependencies.\n"
+ "--depend Generate Makefile dependencies.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
@@ -65,20 +65,20 @@ main(int argc, char* argv[])
catch(const IceUtil::BadOptException& e)
{
cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICEE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICEE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -86,19 +86,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -137,76 +137,76 @@ main(int argc, char* argv[])
for(i = args.begin(); i != args.end(); ++i)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::Java);
- }
- else
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- return EXIT_FAILURE;
- }
-
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive);
- int parseStatus = p->parse(cppHandle, debug, Slice::IceE);
-
- if(!icecpp.close())
- {
- p->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- Gen gen(argv[0], icecpp.getBaseName(), includePaths, output);
- if(!gen)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- gen.generate(p);
- if(tie)
- {
- gen.generateTie(p);
- }
- if(impl)
- {
- gen.generateImpl(p);
- }
- if(implTie)
- {
- gen.generateImplTie(p);
- }
- }
- p->destroy();
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::Java);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ return EXIT_FAILURE;
+ }
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive);
+ int parseStatus = p->parse(cppHandle, debug, Slice::IceE);
+
+ if(!icecpp.close())
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ Gen gen(argv[0], icecpp.getBaseName(), includePaths, output);
+ if(!gen)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ gen.generate(p);
+ if(tie)
+ {
+ gen.generateTie(p);
+ }
+ if(impl)
+ {
+ gen.generateImpl(p);
+ }
+ if(implTie)
+ {
+ gen.generateImplTie(p);
+ }
+ }
+ p->destroy();
+ }
+ }
}
return status;
diff --git a/cpp/src/slice2py/Main.cpp b/cpp/src/slice2py/Main.cpp
index dcb1fd7b5d4..c0ff6b7dce0 100644
--- a/cpp/src/slice2py/Main.cpp
+++ b/cpp/src/slice2py/Main.cpp
@@ -369,7 +369,7 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
@@ -407,21 +407,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -429,19 +429,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -481,86 +481,86 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr u = Unit::createUnit(false, all, ice, caseSensitive);
- int parseStatus = u->parse(cppHandle, debug);
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- string base = icecpp.getBaseName();
- string::size_type pos = base.find_last_of("/\\");
- if(pos != string::npos)
- {
- base.erase(0, pos + 1);
- }
-
- //
- // Append the suffix "_ice" to the filename in order to avoid any conflicts
- // with Slice module names. For example, if the file Test.ice defines a
- // Slice module named "Test", then we couldn't create a Python package named
- // "Test" and also call the generated file "Test.py".
- //
- string file = prefix + base + "_ice.py";
- if(!output.empty())
- {
- file = output + '/' + file;
- }
-
- IceUtil::Output out;
- out.open(file.c_str());
- if(!out)
- {
- cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
- u->destroy();
- return EXIT_FAILURE;
- }
-
- printHeader(out);
- out << "\n# Generated from file `" << base << ".ice'\n";
-
- //
- // Generate the Python mapping.
- //
- generate(u, all, checksum, includePaths, out);
-
- //
- // Create or update the Python package hierarchy.
- //
- if(!noPackage)
- {
- PackageVisitor visitor(argv[0], prefix + base + "_ice", output);
- u->visit(&visitor, false);
- }
- }
-
- u->destroy();
- }
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr u = Unit::createUnit(false, all, ice, caseSensitive);
+ int parseStatus = u->parse(cppHandle, debug);
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ string base = icecpp.getBaseName();
+ string::size_type pos = base.find_last_of("/\\");
+ if(pos != string::npos)
+ {
+ base.erase(0, pos + 1);
+ }
+
+ //
+ // Append the suffix "_ice" to the filename in order to avoid any conflicts
+ // with Slice module names. For example, if the file Test.ice defines a
+ // Slice module named "Test", then we couldn't create a Python package named
+ // "Test" and also call the generated file "Test.py".
+ //
+ string file = prefix + base + "_ice.py";
+ if(!output.empty())
+ {
+ file = output + '/' + file;
+ }
+
+ IceUtil::Output out;
+ out.open(file.c_str());
+ if(!out)
+ {
+ cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ printHeader(out);
+ out << "\n# Generated from file `" << base << ".ice'\n";
+
+ //
+ // Generate the Python mapping.
+ //
+ generate(u, all, checksum, includePaths, out);
+
+ //
+ // Create or update the Python package hierarchy.
+ //
+ if(!noPackage)
+ {
+ PackageVisitor visitor(argv[0], prefix + base + "_ice", output);
+ u->visit(&visitor, false);
+ }
+ }
+
+ u->destroy();
+ }
}
return status;
diff --git a/cpp/src/slice2rb/Main.cpp b/cpp/src/slice2rb/Main.cpp
index 7025196520b..47867199325 100644
--- a/cpp/src/slice2rb/Main.cpp
+++ b/cpp/src/slice2rb/Main.cpp
@@ -41,7 +41,7 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--output-dir DIR Create files in the directory DIR.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
@@ -75,21 +75,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -97,19 +97,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + *i;
+ cppArgs += " -D" + *i;
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + *i;
+ cppArgs += " -U" + *i;
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + *i;
+ cppArgs += " -I" + *i;
}
bool preprocess = opts.isSet("E");
@@ -145,71 +145,71 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr u = Unit::createUnit(false, all, ice, caseSensitive);
- int parseStatus = u->parse(cppHandle, debug);
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- string base = icecpp.getBaseName();
- string::size_type pos = base.find_last_of("/\\");
- if(pos != string::npos)
- {
- base.erase(0, pos + 1);
- }
-
- string file = base + ".rb";
- if(!output.empty())
- {
- file = output + '/' + file;
- }
-
- IceUtil::Output out;
- out.open(file.c_str());
- if(!out)
- {
- cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
- u->destroy();
- return EXIT_FAILURE;
- }
-
- printHeader(out);
- out << "\n# Generated from file `" << base << ".ice'\n";
-
- //
- // Generate the Ruby mapping.
- //
- generate(u, all, checksum, includePaths, out);
- }
-
- u->destroy();
- }
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr u = Unit::createUnit(false, all, ice, caseSensitive);
+ int parseStatus = u->parse(cppHandle, debug);
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ string base = icecpp.getBaseName();
+ string::size_type pos = base.find_last_of("/\\");
+ if(pos != string::npos)
+ {
+ base.erase(0, pos + 1);
+ }
+
+ string file = base + ".rb";
+ if(!output.empty())
+ {
+ file = output + '/' + file;
+ }
+
+ IceUtil::Output out;
+ out.open(file.c_str());
+ if(!out)
+ {
+ cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ printHeader(out);
+ out << "\n# Generated from file `" << base << ".ice'\n";
+
+ //
+ // Generate the Ruby mapping.
+ //
+ generate(u, all, checksum, includePaths, out);
+ }
+
+ u->destroy();
+ }
}
return status;
diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp
index cab9cb3918a..2b2be18c899 100755
--- a/cpp/src/slice2vb/Gen.cpp
+++ b/cpp/src/slice2vb/Gen.cpp
@@ -43,26 +43,26 @@ sliceModeToIceMode(Operation::Mode opMode)
string mode;
switch(opMode)
{
- case Operation::Normal:
- {
- mode = "Ice.OperationMode.Normal";
- break;
- }
- case Operation::Nonmutating:
- {
- mode = "Ice.OperationMode.Nonmutating";
- break;
- }
- case Operation::Idempotent:
- {
- mode = "Ice.OperationMode.Idempotent";
- break;
- }
- default:
- {
- assert(false);
- break;
- }
+ case Operation::Normal:
+ {
+ mode = "Ice.OperationMode.Normal";
+ break;
+ }
+ case Operation::Nonmutating:
+ {
+ mode = "Ice.OperationMode.Nonmutating";
+ break;
+ }
+ case Operation::Idempotent:
+ {
+ mode = "Ice.OperationMode.Idempotent";
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
}
return mode;
}
@@ -74,12 +74,12 @@ emitDeprecate(const ContainedPtr& p1, const ContainedPtr& p2, Output& out, strin
if(p1->findMetaData("deprecate", deprecateMetadata) ||
(p2 != 0 && p2->findMetaData("deprecate", deprecateMetadata)))
{
- string deprecateReason = "This " + type + " has been deprecated.";
- if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
- {
- deprecateReason = deprecateMetadata.substr(10);
- }
- out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
+ string deprecateReason = "This " + type + " has been deprecated.";
+ if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
+ {
+ deprecateReason = deprecateMetadata.substr(10);
+ }
+ out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
}
}
@@ -97,92 +97,92 @@ Slice::VbVisitor::writeInheritedOperations(const ClassDefPtr& p)
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
- bases.pop_front();
+ bases.pop_front();
}
if(!bases.empty())
{
- _out.zeroIndent();
- _out << sp << nl << "#Region \"Inherited Slice operations\"";
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"Inherited Slice operations\"";
+ _out.restoreIndent();
OperationList allOps;
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
- {
- OperationList tmp = (*q)->allOperations();
- allOps.splice(allOps.end(), tmp);
- }
- allOps.sort();
- allOps.unique();
- for(OperationList::const_iterator op = allOps.begin(); op != allOps.end(); ++op)
- {
- ClassDefPtr containingClass = ClassDefPtr::dynamicCast((*op)->container());
- bool amd = containingClass->hasMetaData("amd") || (*op)->hasMetaData("amd");
- string name = (*op)->name();
- TypePtr ret = (*op)->returnType();
-
- if(!amd)
- {
- vector<string> params = getParams(*op);
- vector<string> args = getArgs(*op);
- string retS = typeToString((*op)->returnType());
-
- string vbOp = ret ? "Function" : "Sub";
- _out << sp << nl << "Public " << vbOp << ' ' << fixId(name, DotNet::ICloneable, true)
- << spar << params << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out << " Implements " << fixId(containingClass->scoped() + "OperationsNC_.")
- << fixId(name, DotNet::ICloneable, true);
- _out.inc();
- _out << nl;
- if((*op)->returnType())
- {
- _out << "Return ";
- }
- _out << fixId(name, DotNet::ICloneable, true)
- << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar;
- _out.dec();
- _out << nl << "End " << vbOp;
-
- _out << sp << nl << "Public MustOverride " << vbOp << ' ' << fixId(name, DotNet::ICloneable, true)
- << spar << params;
- if(!containingClass->isLocal())
- {
- _out << "ByVal current__ As Ice.Current";
- }
- _out << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out << " Implements " << fixId(containingClass->scoped() + "Operations_.")
- << fixId(name, DotNet::ICloneable, true);
- }
- else
- {
- vector<string> params = getParamsAsync(*op, true);
- vector<string> args = getArgsAsync(*op);
-
- _out << sp << nl << "Public Sub " << ' ' << name << "_async" << spar << params << epar
- << " Implements " << fixId(containingClass->scoped() + "OperationsNC_.")
- << name << "_async";
- _out.inc();
- _out << nl << name << "_async" << spar << args << epar;
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public MustOverride Sub " << name << "_async"
- << spar << params << "ByVal current__ As Ice.Current" << epar
- << " Implements " << fixId(containingClass->scoped() + "Operations_.")
- << name << "_async";
- }
- }
-
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // Inherited Slice operations
- _out.restoreIndent();
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
+ {
+ OperationList tmp = (*q)->allOperations();
+ allOps.splice(allOps.end(), tmp);
+ }
+ allOps.sort();
+ allOps.unique();
+ for(OperationList::const_iterator op = allOps.begin(); op != allOps.end(); ++op)
+ {
+ ClassDefPtr containingClass = ClassDefPtr::dynamicCast((*op)->container());
+ bool amd = containingClass->hasMetaData("amd") || (*op)->hasMetaData("amd");
+ string name = (*op)->name();
+ TypePtr ret = (*op)->returnType();
+
+ if(!amd)
+ {
+ vector<string> params = getParams(*op);
+ vector<string> args = getArgs(*op);
+ string retS = typeToString((*op)->returnType());
+
+ string vbOp = ret ? "Function" : "Sub";
+ _out << sp << nl << "Public " << vbOp << ' ' << fixId(name, DotNet::ICloneable, true)
+ << spar << params << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements " << fixId(containingClass->scoped() + "OperationsNC_.")
+ << fixId(name, DotNet::ICloneable, true);
+ _out.inc();
+ _out << nl;
+ if((*op)->returnType())
+ {
+ _out << "Return ";
+ }
+ _out << fixId(name, DotNet::ICloneable, true)
+ << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar;
+ _out.dec();
+ _out << nl << "End " << vbOp;
+
+ _out << sp << nl << "Public MustOverride " << vbOp << ' ' << fixId(name, DotNet::ICloneable, true)
+ << spar << params;
+ if(!containingClass->isLocal())
+ {
+ _out << "ByVal current__ As Ice.Current";
+ }
+ _out << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements " << fixId(containingClass->scoped() + "Operations_.")
+ << fixId(name, DotNet::ICloneable, true);
+ }
+ else
+ {
+ vector<string> params = getParamsAsync(*op, true);
+ vector<string> args = getArgsAsync(*op);
+
+ _out << sp << nl << "Public Sub " << ' ' << name << "_async" << spar << params << epar
+ << " Implements " << fixId(containingClass->scoped() + "OperationsNC_.")
+ << name << "_async";
+ _out.inc();
+ _out << nl << name << "_async" << spar << args << epar;
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public MustOverride Sub " << name << "_async"
+ << spar << params << "ByVal current__ As Ice.Current" << epar
+ << " Implements " << fixId(containingClass->scoped() + "Operations_.")
+ << name << "_async";
+ }
+ }
+
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // Inherited Slice operations
+ _out.restoreIndent();
}
}
@@ -237,16 +237,16 @@ Slice::VbVisitor::writeDispatch(const ClassDefPtr& p)
_out.inc();
{
- StringList::const_iterator q = ids.begin();
- while(q != ids.end())
- {
- _out << nl << '"' << *q << '"';
- if(++q != ids.end())
- {
- _out << ',';
- }
- _out << " _";
- }
+ StringList::const_iterator q = ids.begin();
+ while(q != ids.end())
+ {
+ _out << nl << '"' << *q << '"';
+ if(++q != ids.end())
+ {
+ _out << ',';
+ }
+ _out << " _";
+ }
}
_out.dec();
_out << nl << '}';
@@ -302,398 +302,398 @@ Slice::VbVisitor::writeDispatch(const ClassDefPtr& p)
OperationList ops = p->operations();
if(!p->isInterface() || ops.size() != 0)
{
- _out.zeroIndent();
- _out << sp << nl << "#Region \"Operation dispatch\"";
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"Operation dispatch\"";
+ _out.restoreIndent();
}
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = *r;
- ContainerPtr container = op->container();
+ ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
assert(cl);
string opName = op->name();
_out << sp << nl << "Public Shared Function "<< opName << "___( _";
- _out.inc();
- _out.inc();
- _out << nl << "ByVal obj__ As " << p->name() << "Operations_, _";
- _out << nl << "ByVal inS__ As IceInternal.Incoming, _";
- _out << nl << "ByVal current__ As Ice.Current) As IceInternal.DispatchStatus";
+ _out.inc();
+ _out.inc();
+ _out << nl << "ByVal obj__ As " << p->name() << "Operations_, _";
+ _out << nl << "ByVal inS__ As IceInternal.Incoming, _";
+ _out << nl << "ByVal current__ As Ice.Current) As IceInternal.DispatchStatus";
_out.dec();
- bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
- if(!amd)
- {
- TypePtr ret = op->returnType();
-
- TypeStringList inParams;
- TypeStringList outParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- else
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
+ if(!amd)
+ {
+ TypePtr ret = op->returnType();
+
+ TypeStringList inParams;
+ TypeStringList outParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ else
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- TypeStringList::const_iterator q;
- _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode)";
- if(!inParams.empty())
- {
- _out << nl << "Dim is__ As IceInternal.BasicStream = inS__.istr()";
- }
- if(!outParams.empty() || ret || !throws.empty())
- {
- _out << nl << "Dim os__ As IceInternal.BasicStream = inS__.ostr()";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- string param = fixId(q->second);
- string typeS = typeToString(q->first);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- if(!isClass)
- {
- _out << nl << "Dim " << param << " As " << typeS << " = Nothing";
- }
- writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
- }
- if(op->sendsClasses())
- {
- _out << nl << "is__.readPendingObjects()";
- }
-
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string typeS = typeToString(q->first);
- _out << nl << "Dim " << fixId(q->second) << " As " << typeS << " = Nothing";
- }
-
- //
- // Call on the servant.
- //
- if(!throws.empty())
- {
- _out << nl << "Try";
- _out.inc();
- }
- _out << nl;
- if(ret)
- {
- string retS = typeToString(ret);
- _out << "Dim ret__ As " << retS << " = ";
- }
- _out << "obj__." << fixId(opName, DotNet::ICloneable, true) << spar;
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
-
- if(isClass)
- {
- _out << "CType(" + fixId(q->second) + "_PP.value, " + typeToString(q->first) + ")";
- }
- else
- {
- _out << fixId(q->second);
- }
- }
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- _out << fixId(q->second);
- }
- _out << "current__" << epar;
-
- //
- // Marshal 'out' parameters and return value.
- //
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, true, "");
- }
- if(ret)
- {
- writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, true, "");
- }
- if(op->returnsClasses())
- {
- _out << nl << "os__.writePendingObjects()";
- }
- _out << nl << "Return IceInternal.DispatchStatus.DispatchOK";
-
- //
- // Handle user exceptions.
- //
- if(!throws.empty())
- {
- _out.dec();
- ExceptionList::const_iterator t;
- for(t = throws.begin(); t != throws.end(); ++t)
- {
- string exS = fixId((*t)->scoped());
- _out << nl << "Catch ex As " << exS;
- _out.inc();
- _out << nl << "os__.writeUserException(ex)";
- _out << nl << "Return IceInternal.DispatchStatus.DispatchUserException";
- }
- _out.dec();
- _out << nl << "End Try";
- }
-
- _out.dec();
- _out << nl << "End Function";
- }
- else
- {
- TypeStringList inParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if(!(*pli)->isOutParam())
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- TypeStringList::const_iterator q;
- _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode)";
- if(!inParams.empty())
- {
- _out << nl << "Dim is__ As IceInternal.BasicStream = inS__.istr()";
- }
-
- //
- // Unmarshal 'in' parameters.
- //
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- if(!isClass)
- {
- _out << nl << "Dim " << fixId(q->second) << " As " << typeToString(q->first);
- }
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
- }
- if(op->sendsClasses())
- {
- _out << nl << "is__.readPendingObjects()";
- }
-
- //
- // Call on the servant.
- //
- string classNameAMD = "AMD_" + p->name();
- _out << nl << "Dim cb__ As " << classNameAMD << '_' << op->name() << " = new _"
- << classNameAMD << '_' << op->name() << "(inS__)";
+ TypeStringList::const_iterator q;
+ _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode)";
+ if(!inParams.empty())
+ {
+ _out << nl << "Dim is__ As IceInternal.BasicStream = inS__.istr()";
+ }
+ if(!outParams.empty() || ret || !throws.empty())
+ {
+ _out << nl << "Dim os__ As IceInternal.BasicStream = inS__.ostr()";
+ }
+
+ //
+ // Unmarshal 'in' parameters.
+ //
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ string typeS = typeToString(q->first);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ if(!isClass)
+ {
+ _out << nl << "Dim " << param << " As " << typeS << " = Nothing";
+ }
+ writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
+ }
+ if(op->sendsClasses())
+ {
+ _out << nl << "is__.readPendingObjects()";
+ }
+
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string typeS = typeToString(q->first);
+ _out << nl << "Dim " << fixId(q->second) << " As " << typeS << " = Nothing";
+ }
+
+ //
+ // Call on the servant.
+ //
+ if(!throws.empty())
+ {
+ _out << nl << "Try";
+ _out.inc();
+ }
+ _out << nl;
+ if(ret)
+ {
+ string retS = typeToString(ret);
+ _out << "Dim ret__ As " << retS << " = ";
+ }
+ _out << "obj__." << fixId(opName, DotNet::ICloneable, true) << spar;
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+
+ if(isClass)
+ {
+ _out << "CType(" + fixId(q->second) + "_PP.value, " + typeToString(q->first) + ")";
+ }
+ else
+ {
+ _out << fixId(q->second);
+ }
+ }
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ _out << fixId(q->second);
+ }
+ _out << "current__" << epar;
+
+ //
+ // Marshal 'out' parameters and return value.
+ //
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, true, "");
+ }
+ if(ret)
+ {
+ writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, true, "");
+ }
+ if(op->returnsClasses())
+ {
+ _out << nl << "os__.writePendingObjects()";
+ }
+ _out << nl << "Return IceInternal.DispatchStatus.DispatchOK";
+
+ //
+ // Handle user exceptions.
+ //
+ if(!throws.empty())
+ {
+ _out.dec();
+ ExceptionList::const_iterator t;
+ for(t = throws.begin(); t != throws.end(); ++t)
+ {
+ string exS = fixId((*t)->scoped());
+ _out << nl << "Catch ex As " << exS;
+ _out.inc();
+ _out << nl << "os__.writeUserException(ex)";
+ _out << nl << "Return IceInternal.DispatchStatus.DispatchUserException";
+ }
+ _out.dec();
+ _out << nl << "End Try";
+ }
+
+ _out.dec();
+ _out << nl << "End Function";
+ }
+ else
+ {
+ TypeStringList inParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if(!(*pli)->isOutParam())
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ TypeStringList::const_iterator q;
+ _out << nl << "checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode)";
+ if(!inParams.empty())
+ {
+ _out << nl << "Dim is__ As IceInternal.BasicStream = inS__.istr()";
+ }
+
+ //
+ // Unmarshal 'in' parameters.
+ //
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ if(!isClass)
+ {
+ _out << nl << "Dim " << fixId(q->second) << " As " << typeToString(q->first);
+ }
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
+ }
+ if(op->sendsClasses())
+ {
+ _out << nl << "is__.readPendingObjects()";
+ }
+
+ //
+ // Call on the servant.
+ //
+ string classNameAMD = "AMD_" + p->name();
+ _out << nl << "Dim cb__ As " << classNameAMD << '_' << op->name() << " = new _"
+ << classNameAMD << '_' << op->name() << "(inS__)";
_out << nl << "Try";
_out.inc();
- _out << nl << "obj__.";
- if(amd)
- {
- _out << opName << "_async";
- }
- else
- {
- _out << fixId(opName, DotNet::ICloneable, true);
- }
- _out << spar;
- if(amd)
- {
- _out << "cb__";
- }
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
- || ClassDeclPtr::dynamicCast(q->first);
- if(isClass)
- {
- _out << "CType(" + q->second + "__PP.value, " + typeToString(q->first);
- }
- else
- {
- _out << fixId(q->second);
- }
- }
- _out << "current__" << epar;
- _out.dec();
- _out << nl << "Catch ex As _System.Exception";
- _out.inc();
- _out << nl << "cb__.ice_exception(ex)";
- _out.dec();
- _out << nl << "End Try";
- _out << nl << "Return IceInternal.DispatchStatus.DispatchAsync";
-
- _out.dec();
- _out << nl << "End Function";
- }
+ _out << nl << "obj__.";
+ if(amd)
+ {
+ _out << opName << "_async";
+ }
+ else
+ {
+ _out << fixId(opName, DotNet::ICloneable, true);
+ }
+ _out << spar;
+ if(amd)
+ {
+ _out << "cb__";
+ }
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+ || ClassDeclPtr::dynamicCast(q->first);
+ if(isClass)
+ {
+ _out << "CType(" + q->second + "__PP.value, " + typeToString(q->first);
+ }
+ else
+ {
+ _out << fixId(q->second);
+ }
+ }
+ _out << "current__" << epar;
+ _out.dec();
+ _out << nl << "Catch ex As _System.Exception";
+ _out.inc();
+ _out << nl << "cb__.ice_exception(ex)";
+ _out.dec();
+ _out << nl << "End Try";
+ _out << nl << "Return IceInternal.DispatchStatus.DispatchAsync";
+
+ _out.dec();
+ _out << nl << "End Function";
+ }
}
OperationList allOps = p->allOperations();
if(!allOps.empty())
{
- StringList allOpNames;
+ StringList allOpNames;
#if defined(__IBMCPP__) && defined(NDEBUG)
- //
- // See comment for transform above
- //
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun<string,Operation>(&Contained::name));
+ //
+ // See comment for transform above
+ //
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun<string,Operation>(&Contained::name));
#else
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name));
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name));
#endif
- allOpNames.push_back("ice_id");
- allOpNames.push_back("ice_ids");
- allOpNames.push_back("ice_isA");
- allOpNames.push_back("ice_ping");
-
- //
- // We sort into case-insensitive order here because, at run time,
- // the sort order must match the sort order used by System.Array.Sort().
- // (C# has no notion of the default ASCII ordering.)
- //
+ allOpNames.push_back("ice_id");
+ allOpNames.push_back("ice_ids");
+ allOpNames.push_back("ice_isA");
+ allOpNames.push_back("ice_ping");
+
+ //
+ // We sort into case-insensitive order here because, at run time,
+ // the sort order must match the sort order used by System.Array.Sort().
+ // (C# has no notion of the default ASCII ordering.)
+ //
#if defined(__SUNPRO_CC)
- allOpNames.sort(Slice::cICompare);
+ allOpNames.sort(Slice::cICompare);
#else
- allOpNames.sort(Slice::CICompare());
+ allOpNames.sort(Slice::CICompare());
#endif
- allOpNames.unique();
-
- StringList::const_iterator q;
-
- _out << sp << nl << "Public Shared Shadows all__ As String() = New String() _";
- _out.inc();
- _out << nl << "{ _";
- _out.inc();
-
- q = allOpNames.begin();
- while(q != allOpNames.end())
- {
- _out << nl << '"' << *q << '"';
- if(++q != allOpNames.end())
- {
- _out << ',';
- }
- _out << " _";
- }
- _out.dec();
- _out << nl << '}';
- _out.dec();
-
- _out << sp << nl << "Public Overloads Overrides Function dispatch__( _";
- _out.inc();
- _out.inc();
- _out << nl << "ByVal inS__ As IceInternal.Incoming, _";
- _out << nl << "ByVal current__ As Ice.Current) As IceInternal.DispatchStatus";
- _out.dec();
- _out << nl << "Dim pos As Integer";
- _out << nl << "pos = _System.Array.BinarySearch(all__, current__.operation, "
- << "_System.Collections.Comparer.DefaultInvariant)";
- _out << nl << "If pos < 0 Then";
- _out.inc();
- _out << nl << "Return IceInternal.DispatchStatus.DispatchOperationNotExist";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "Select Case pos";
- _out.inc();
- int i = 0;
- for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
- {
- string opName = *q;
-
- _out << nl << "Case " << i++;
- _out.inc();
- if(opName == "ice_id")
- {
- _out << nl << "Return ice_id___(Me, inS__, current__)";
- }
- else if(opName == "ice_ids")
- {
- _out << nl << "Return ice_ids___(Me, inS__, current__)";
- }
- else if(opName == "ice_isA")
- {
- _out << nl << "Return ice_isA___(Me, inS__, current__)";
- }
- else if(opName == "ice_ping")
- {
- _out << nl << "Return ice_ping___(Me, inS__, current__)";
- }
- else
- {
- //
- // There's probably a better way to do this
- //
- for(OperationList::const_iterator t = allOps.begin(); t != allOps.end(); ++t)
- {
- if((*t)->name() == (*q))
- {
- ContainerPtr container = (*t)->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- assert(cl);
- if(cl->scoped() == p->scoped())
- {
- _out << nl << "Return " << opName << "___(Me, inS__, current__)";
- }
- else
- {
- string base = cl->scoped();
- if(cl->isInterface())
- {
- base += "Disp_";
- }
- _out << nl << "Return " << fixId(base) << "." << opName << "___(Me, inS__, current__)";
- }
- break;
- }
- }
- }
- _out.dec();
- }
- _out.dec();
- _out << nl << "End Select";
- _out << sp << nl << "' _System.Diagnostics.Debug.Assert(false) ' Bug in VB 7.1: Diagnostics.Debug is not found";
- _out << nl << "Return IceInternal.DispatchStatus.DispatchOperationNotExist";
- _out.dec();
- _out << nl << "End Function";
+ allOpNames.unique();
+
+ StringList::const_iterator q;
+
+ _out << sp << nl << "Public Shared Shadows all__ As String() = New String() _";
+ _out.inc();
+ _out << nl << "{ _";
+ _out.inc();
+
+ q = allOpNames.begin();
+ while(q != allOpNames.end())
+ {
+ _out << nl << '"' << *q << '"';
+ if(++q != allOpNames.end())
+ {
+ _out << ',';
+ }
+ _out << " _";
+ }
+ _out.dec();
+ _out << nl << '}';
+ _out.dec();
+
+ _out << sp << nl << "Public Overloads Overrides Function dispatch__( _";
+ _out.inc();
+ _out.inc();
+ _out << nl << "ByVal inS__ As IceInternal.Incoming, _";
+ _out << nl << "ByVal current__ As Ice.Current) As IceInternal.DispatchStatus";
+ _out.dec();
+ _out << nl << "Dim pos As Integer";
+ _out << nl << "pos = _System.Array.BinarySearch(all__, current__.operation, "
+ << "_System.Collections.Comparer.DefaultInvariant)";
+ _out << nl << "If pos < 0 Then";
+ _out.inc();
+ _out << nl << "Return IceInternal.DispatchStatus.DispatchOperationNotExist";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "Select Case pos";
+ _out.inc();
+ int i = 0;
+ for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ {
+ string opName = *q;
+
+ _out << nl << "Case " << i++;
+ _out.inc();
+ if(opName == "ice_id")
+ {
+ _out << nl << "Return ice_id___(Me, inS__, current__)";
+ }
+ else if(opName == "ice_ids")
+ {
+ _out << nl << "Return ice_ids___(Me, inS__, current__)";
+ }
+ else if(opName == "ice_isA")
+ {
+ _out << nl << "Return ice_isA___(Me, inS__, current__)";
+ }
+ else if(opName == "ice_ping")
+ {
+ _out << nl << "Return ice_ping___(Me, inS__, current__)";
+ }
+ else
+ {
+ //
+ // There's probably a better way to do this
+ //
+ for(OperationList::const_iterator t = allOps.begin(); t != allOps.end(); ++t)
+ {
+ if((*t)->name() == (*q))
+ {
+ ContainerPtr container = (*t)->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ assert(cl);
+ if(cl->scoped() == p->scoped())
+ {
+ _out << nl << "Return " << opName << "___(Me, inS__, current__)";
+ }
+ else
+ {
+ string base = cl->scoped();
+ if(cl->isInterface())
+ {
+ base += "Disp_";
+ }
+ _out << nl << "Return " << fixId(base) << "." << opName << "___(Me, inS__, current__)";
+ }
+ break;
+ }
+ }
+ }
+ _out.dec();
+ }
+ _out.dec();
+ _out << nl << "End Select";
+ _out << sp << nl << "' _System.Diagnostics.Debug.Assert(false) ' Bug in VB 7.1: Diagnostics.Debug is not found";
+ _out << nl << "Return IceInternal.DispatchStatus.DispatchOperationNotExist";
+ _out.dec();
+ _out << nl << "End Function";
}
if(!p->isInterface() || ops.size() != 0)
{
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // Operation dispatch
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // Operation dispatch
+ _out.restoreIndent();
}
}
@@ -704,11 +704,11 @@ Slice::VbVisitor::getParamAttributes(const ParamDeclPtr& p)
StringList metaData = p->getMetaData();
for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
{
- static const string prefix = "vb:attribute:";
+ static const string prefix = "vb:attribute:";
if(i->find(prefix) == 0)
- {
- result += "<" + i->substr(prefix.size()) + "> ";
- }
+ {
+ result += "<" + i->substr(prefix.size()) + "> ";
+ }
}
return result;
}
@@ -721,9 +721,9 @@ Slice::VbVisitor::getParams(const OperationPtr& op)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
string param = getParamAttributes(*q);
- param += ((*q)->isOutParam() ? "<_System.Runtime.InteropServices.Out()> ByRef " : "ByVal ")
- + fixId((*q)->name()) + " As " + typeToString((*q)->type());
- params.push_back(param);
+ param += ((*q)->isOutParam() ? "<_System.Runtime.InteropServices.Out()> ByRef " : "ByVal ")
+ + fixId((*q)->name()) + " As " + typeToString((*q)->type());
+ params.push_back(param);
}
return params;
}
@@ -744,11 +744,11 @@ Slice::VbVisitor::getParamsAsync(const OperationPtr& op, bool amd)
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if(!(*q)->isOutParam())
- {
- params.push_back(getParamAttributes(*q) + "ByVal " + fixId((*q)->name()) + " As "
- + typeToString((*q)->type()));
- }
+ if(!(*q)->isOutParam())
+ {
+ params.push_back(getParamAttributes(*q) + "ByVal " + fixId((*q)->name()) + " As "
+ + typeToString((*q)->type()));
+ }
}
return params;
}
@@ -761,17 +761,17 @@ Slice::VbVisitor::getParamsAsyncCB(const OperationPtr& op)
TypePtr ret = op->returnType();
if(ret)
{
- params.push_back("ByVal ret__ As " + typeToString(ret));
+ params.push_back("ByVal ret__ As " + typeToString(ret));
}
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if((*q)->isOutParam())
- {
- params.push_back(getParamAttributes(*q) + "ByVal " + fixId((*q)->name()) + " As "
- + typeToString((*q)->type()));
- }
+ if((*q)->isOutParam())
+ {
+ params.push_back(getParamAttributes(*q) + "ByVal " + fixId((*q)->name()) + " As "
+ + typeToString((*q)->type()));
+ }
}
return params;
@@ -784,7 +784,7 @@ Slice::VbVisitor::getArgs(const OperationPtr& op)
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string arg = fixId((*q)->name());
+ string arg = fixId((*q)->name());
args.push_back(arg);
}
return args;
@@ -801,9 +801,9 @@ Slice::VbVisitor::getArgsAsync(const OperationPtr& op)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
if(!(*q)->isOutParam())
- {
- args.push_back(fixId((*q)->name()));
- }
+ {
+ args.push_back(fixId((*q)->name()));
+ }
}
return args;
}
@@ -823,9 +823,9 @@ Slice::VbVisitor::getArgsAsyncCB(const OperationPtr& op)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
if((*q)->isOutParam())
- {
- args.push_back(fixId((*q)->name()));
- }
+ {
+ args.push_back(fixId((*q)->name()));
+ }
}
return args;
@@ -837,11 +837,11 @@ Slice::VbVisitor::emitAttributes(const ContainedPtr& p)
StringList metaData = p->getMetaData();
for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
{
- static const string prefix = "vb:attribute:";
+ static const string prefix = "vb:attribute:";
if(i->find(prefix) == 0)
- {
- _out << nl << '<' << i->substr(prefix.size()) << '>';
- }
+ {
+ _out << nl << '<' << i->substr(prefix.size()) << '>';
+ }
}
}
@@ -854,22 +854,22 @@ Slice::Gen::Gen(const string& name, const string& base, const vector<string>& in
string::size_type pos = base.find_last_of("/\\");
if(pos != string::npos)
{
- fileBase = base.substr(pos + 1);
+ fileBase = base.substr(pos + 1);
}
string file = fileBase + ".vb";
string fileImpl = fileBase + "I.vb";
if(!dir.empty())
{
- file = dir + '/' + file;
- fileImpl = dir + '/' + fileImpl;
+ file = dir + '/' + file;
+ fileImpl = dir + '/' + fileImpl;
}
_out.open(file.c_str());
if(!_out)
{
cerr << name << ": can't open `" << file << "' for writing" << endl;
- return;
+ return;
}
printHeader();
@@ -881,17 +881,17 @@ Slice::Gen::Gen(const string& name, const string& base, const vector<string>& in
if(impl || implTie)
{
struct stat st;
- if(stat(fileImpl.c_str(), &st) == 0)
- {
- cerr << name << ": `" << fileImpl << "' already exists - will not overwrite" << endl;
- return;
- }
- _impl.open(fileImpl.c_str());
- if(!_impl)
- {
- cerr << name << ": can't open `" << fileImpl << "' for writing" << endl;
- return;
- }
+ if(stat(fileImpl.c_str(), &st) == 0)
+ {
+ cerr << name << ": `" << fileImpl << "' already exists - will not overwrite" << endl;
+ return;
+ }
+ _impl.open(fileImpl.c_str());
+ if(!_impl)
+ {
+ cerr << name << ": can't open `" << fileImpl << "' for writing" << endl;
+ return;
+ }
}
}
@@ -993,7 +993,7 @@ Slice::Gen::generateChecksums(const UnitPtr& p)
_out << sp << nl << "Public NotInheritable Class " << className;
_out.inc();
_out << nl << "Public Shared Readonly map As _System.Collections.Hashtable"
- << " = new _System.Collections.Hashtable()";
+ << " = new _System.Collections.Hashtable()";
_out << sp << nl << "Shared Sub New()";
_out.inc();
for(ChecksumMap::const_iterator q = map.begin(); q != map.end(); ++q)
@@ -1009,13 +1009,13 @@ Slice::Gen::generateChecksums(const UnitPtr& p)
_out << str.str() << "\")";
}
_out.dec();
- _out << nl << "End Sub";
+ _out << nl << "End Sub";
_out.dec();
- _out << sp << nl << "End Class";
+ _out << sp << nl << "End Class";
_out.dec();
- _out << sp << nl << "End Namespace";
+ _out << sp << nl << "End Namespace";
_out.dec();
- _out << sp << nl << "End Namespace";
+ _out << sp << nl << "End Namespace";
}
}
@@ -1047,25 +1047,25 @@ Slice::Gen::UnitVisitor::visitModuleStart(const ModulePtr& p)
{
if(!_globalMetaDataDone)
{
- DefinitionContextPtr dc = p->definitionContext();
- StringList globalMetaData = dc->getMetaData();
-
- static const string attributePrefix = "vb:attribute:";
-
- if(!globalMetaData.empty())
- {
- _out << sp;
- }
- for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
- {
- string::size_type pos = q->find(attributePrefix);
- if(pos == 0)
- {
- string attrib = q->substr(pos + attributePrefix.size());
- _out << nl << '<' << attrib << '>';
- }
- }
- _globalMetaDataDone = true; // Do this only once per source file.
+ DefinitionContextPtr dc = p->definitionContext();
+ StringList globalMetaData = dc->getMetaData();
+
+ static const string attributePrefix = "vb:attribute:";
+
+ if(!globalMetaData.empty())
+ {
+ _out << sp;
+ }
+ for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
+ {
+ string::size_type pos = q->find(attributePrefix);
+ if(pos == 0)
+ {
+ string attrib = q->substr(pos + attributePrefix.size());
+ _out << nl << '<' << attrib << '>';
+ }
+ }
+ _globalMetaDataDone = true; // Do this only once per source file.
}
return false;
}
@@ -1107,42 +1107,42 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal() && _stream)
{
_out << sp << nl << "Public NotInheritable Class " << p->name() << "Helper";
- _out.inc();
-
- _out << sp << nl << "Public Sub New(ByVal inS__ As Ice.InputStream)";
- _out.inc();
- _out << nl << "_in = inS__";
- _out << nl << "_pp = New IceInternal.ParamPatcher(GetType(" << scoped << "), \"" << p->scoped() << "\")";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')';
- _out.inc();
- _out << nl << "outS__.writeObject(v__)";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Sub read()";
- _out.inc();
- _out << nl << "_in.readObject(_pp)";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public ReadOnly Property value() As " << scoped;
- _out.inc();
- _out << nl << "Get";
- _out.inc();
- _out << nl << "Return CType(_pp.value, " << scoped << ')';
- _out.dec();
- _out << nl << "End Get";
- _out.dec();
- _out << nl << "End Property";
-
- _out << sp << nl << "Private _in As Ice.InputStream";
- _out << nl << "Private _pp As IceInternal.ParamPatcher";
-
- _out.dec();
- _out << sp << nl << "End Class";
+ _out.inc();
+
+ _out << sp << nl << "Public Sub New(ByVal inS__ As Ice.InputStream)";
+ _out.inc();
+ _out << nl << "_in = inS__";
+ _out << nl << "_pp = New IceInternal.ParamPatcher(GetType(" << scoped << "), \"" << p->scoped() << "\")";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')';
+ _out.inc();
+ _out << nl << "outS__.writeObject(v__)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Sub read()";
+ _out.inc();
+ _out << nl << "_in.readObject(_pp)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public ReadOnly Property value() As " << scoped;
+ _out.inc();
+ _out << nl << "Get";
+ _out.inc();
+ _out << nl << "Return CType(_pp.value, " << scoped << ')';
+ _out.dec();
+ _out << nl << "End Get";
+ _out.dec();
+ _out << nl << "End Property";
+
+ _out << sp << nl << "Private _in As Ice.InputStream";
+ _out << nl << "Private _pp As IceInternal.ParamPatcher";
+
+ _out.dec();
+ _out << sp << nl << "End Class";
}
_out << sp;
@@ -1150,91 +1150,91 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(p->isInterface())
{
_out << nl << "Public Interface " << name;
- _out.inc();
- if(p->isLocal())
- {
- _out << nl << "Inherits Ice.LocalObject";
- }
- else
- {
- _out << nl << "Inherits Ice.Object";
- }
- _out << ", " << p->name();
- if(!p->isLocal())
- {
- _out << "Operations_, " << p->name();
- }
- _out << "OperationsNC_";
- if(!bases.empty())
- {
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- _out << ", " << fixId((*q)->scoped());
- q++;
- }
- }
+ _out.inc();
+ if(p->isLocal())
+ {
+ _out << nl << "Inherits Ice.LocalObject";
+ }
+ else
+ {
+ _out << nl << "Inherits Ice.Object";
+ }
+ _out << ", " << p->name();
+ if(!p->isLocal())
+ {
+ _out << "Operations_, " << p->name();
+ }
+ _out << "OperationsNC_";
+ if(!bases.empty())
+ {
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ _out << ", " << fixId((*q)->scoped());
+ q++;
+ }
+ }
}
else
{
- _out << nl << "Public ";
- if(p->isAbstract())
- {
- _out << "MustInherit ";
- }
- _out << "Class " << name;
- _out.inc();
-
- if(!hasBaseClass)
- {
- if(p->isLocal())
- {
- _out << nl << "Inherits Ice.LocalObjectImpl";
- }
- else
- {
- _out << nl << "Inherits Ice.ObjectImpl";
- }
- }
- else
- {
- _out << nl << "Inherits " << fixId(bases.front()->scoped());
- bases.pop_front();
- }
- if(p->isAbstract())
- {
- _out << nl << "Implements " << p->name();
- if(!p->isLocal())
- {
- _out << "Operations_, " << p->name();
- }
- _out << "OperationsNC_";
- }
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
- {
- if((*q)->isAbstract())
- {
- _out << ", " << fixId((*q)->scoped());
- }
- }
+ _out << nl << "Public ";
+ if(p->isAbstract())
+ {
+ _out << "MustInherit ";
+ }
+ _out << "Class " << name;
+ _out.inc();
+
+ if(!hasBaseClass)
+ {
+ if(p->isLocal())
+ {
+ _out << nl << "Inherits Ice.LocalObjectImpl";
+ }
+ else
+ {
+ _out << nl << "Inherits Ice.ObjectImpl";
+ }
+ }
+ else
+ {
+ _out << nl << "Inherits " << fixId(bases.front()->scoped());
+ bases.pop_front();
+ }
+ if(p->isAbstract())
+ {
+ _out << nl << "Implements " << p->name();
+ if(!p->isLocal())
+ {
+ _out << "Operations_, " << p->name();
+ }
+ _out << "OperationsNC_";
+ }
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
+ {
+ if((*q)->isAbstract())
+ {
+ _out << ", " << fixId((*q)->scoped());
+ }
+ }
}
if(!p->isInterface())
{
- _out.zeroIndent();
+ _out.zeroIndent();
if(p->hasDataMembers() && !p->hasOperations())
- {
- _out << sp << nl << "#Region \"Slice data members\"";
- }
- else if(p->hasDataMembers())
- {
- _out << sp << nl << "#Region \"Slice data members and operations\"";
- }
- else if(p->hasOperations())
- {
- _out << sp << nl << "#Region \"Slice operations\"";
- }
- _out.restoreIndent();
+ {
+ _out << sp << nl << "#Region \"Slice data members\"";
+ }
+ else if(p->hasDataMembers())
+ {
+ _out << sp << nl << "#Region \"Slice data members and operations\"";
+ }
+ else if(p->hasOperations())
+ {
+ _out << sp << nl << "#Region \"Slice operations\"";
+ }
+ _out.restoreIndent();
}
return true;
@@ -1254,283 +1254,283 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
_out.zeroIndent();
if(p->hasDataMembers() && !p->hasOperations())
- {
- _out << sp << nl << "#End Region"; // Slice data members
- }
- else if(p->hasDataMembers())
- {
- _out << sp << nl << "#End Region"; // Slice data members and operations
- }
- else if(p->hasOperations())
- {
- _out << sp << nl << "#End Region"; // Slice operations
- }
- _out.restoreIndent();
-
- if(!allDataMembers.empty())
- {
- _out.zeroIndent();
- _out << sp << nl << "#Region \"Constructors\"";
- _out.restoreIndent();
-
- _out << sp << nl << "Public Sub New" << spar << epar;
- _out.inc();
- if(hasBaseClass)
- {
- _out << nl << "MyBase.New()";
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Sub New" << spar;
- vector<string> paramDecl;
- for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
- {
- string memberName = fixId((*d)->name());
- string memberType = typeToString((*d)->type());
- paramDecl.push_back("ByVal " + memberName + " As " + memberType);
- }
- _out << paramDecl << epar;
- _out.inc();
- if(hasBaseClass && allDataMembers.size() != dataMembers.size())
- {
- _out << nl << "MyBase.New" << spar;
- vector<string> baseParamNames;
- DataMemberList baseDataMembers = bases.front()->allDataMembers();
- for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
- {
- baseParamNames.push_back(fixId((*d)->name()));
- }
- _out << baseParamNames << epar;
- }
- vector<string> paramNames;
- for(d = dataMembers.begin(); d != dataMembers.end(); ++d)
- {
- paramNames.push_back(fixId((*d)->name()));
- }
- for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
- {
- _out << nl << "Me." << *i << " = " << *i;
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // Constructors
- _out.restoreIndent();
- }
-
- writeInheritedOperations(p);
+ {
+ _out << sp << nl << "#End Region"; // Slice data members
+ }
+ else if(p->hasDataMembers())
+ {
+ _out << sp << nl << "#End Region"; // Slice data members and operations
+ }
+ else if(p->hasOperations())
+ {
+ _out << sp << nl << "#End Region"; // Slice operations
+ }
+ _out.restoreIndent();
+
+ if(!allDataMembers.empty())
+ {
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"Constructors\"";
+ _out.restoreIndent();
+
+ _out << sp << nl << "Public Sub New" << spar << epar;
+ _out.inc();
+ if(hasBaseClass)
+ {
+ _out << nl << "MyBase.New()";
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Sub New" << spar;
+ vector<string> paramDecl;
+ for(d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixId((*d)->name());
+ string memberType = typeToString((*d)->type());
+ paramDecl.push_back("ByVal " + memberName + " As " + memberType);
+ }
+ _out << paramDecl << epar;
+ _out.inc();
+ if(hasBaseClass && allDataMembers.size() != dataMembers.size())
+ {
+ _out << nl << "MyBase.New" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = bases.front()->allDataMembers();
+ for(d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixId((*d)->name()));
+ }
+ _out << baseParamNames << epar;
+ }
+ vector<string> paramNames;
+ for(d = dataMembers.begin(); d != dataMembers.end(); ++d)
+ {
+ paramNames.push_back(fixId((*d)->name()));
+ }
+ for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+ {
+ _out << nl << "Me." << *i << " = " << *i;
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // Constructors
+ _out.restoreIndent();
+ }
+
+ writeInheritedOperations(p);
}
if(!p->isInterface() && !p->isLocal())
{
- writeDispatch(p);
-
- DataMemberList members = p->dataMembers();
-
- _out.zeroIndent();
- _out << sp << nl << "#Region \"Marshaling support\"";
- _out.restoreIndent();
-
- _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal os__ As IceInternal.BasicStream)";
- _out.inc();
- _out << nl << "os__.writeTypeId(ice_staticId())";
- _out << nl << "os__.startWriteSlice()";
- for(d = members.begin(); d != members.end(); ++d)
- {
- writeMarshalUnmarshalCode(_out, (*d)->type(), fixId((*d)->name(), DotNet::ICloneable, true), true, false,
- false);
- }
- _out << nl << "os__.endWriteSlice()";
- _out << nl << "MyBase.write__(os__)";
- _out.dec();
- _out << nl << "End Sub";
-
- DataMemberList allClassMembers = p->allClassDataMembers();
- if(allClassMembers.size() != 0)
- {
- _out << sp << nl << "Public Shadows NotInheritable Class Patcher__";
- _out.inc();
- _out << nl << "Inherits IceInternal.Patcher";
- _out << sp << nl << "Friend Sub New(ByVal instance As Ice.ObjectImpl";
- if(allClassMembers.size() > 1)
- {
- _out << ", ByVal member As Integer";
- }
- _out << ')';
- _out.inc();
- _out << nl << "_instance = CType(instance, " << name << ')';
- if(allClassMembers.size() > 1)
- {
- _out << nl << "_member = member";
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
- _out.inc();
- _out << nl << "Try";
- _out.inc();
- if(allClassMembers.size() > 1)
- {
- _out << nl << "Select Case _member";
- _out.inc();
- }
- int memberCount = 0;
- for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
- {
- if(allClassMembers.size() > 1)
- {
- _out << nl << "Case " << memberCount;
- _out.inc();
- }
- string memberName = fixId((*d)->name(), DotNet::ICloneable, true);
- string memberType = typeToString((*d)->type());
- _out << nl << "type_ = GetType(" << memberType << ')';
- _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')';
- _out << nl << "_typeId = \"" << (*d)->type()->typeId() << "\"";
- if(allClassMembers.size() > 1)
- {
- _out.dec();
- }
- memberCount++;
- }
- if(allClassMembers.size() > 1)
- {
- _out << nl << "End Select";
- }
- _out.dec();
- _out << nl << "Catch _ex As System.InvalidCastException";
- _out.inc();
- _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
- _out << nl << "_e.type = v.ice_id()";
- _out << nl << "_e.expectedType = _typeId";
- _out << nl << "Throw _e";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Private _instance As " << name;
- if(allClassMembers.size() > 1)
- {
- _out << nl << "Private _member As Integer";
- }
- _out << nl << "Private _typeId As String";
- _out.dec();
- _out << sp << nl << "End Class";
- }
-
- _out << sp << nl << "Public Overloads Overrides Sub read__(ByVal is__ As IceInternal.BasicStream, "
- "ByVal rid__ As Boolean)";
- _out.inc();
- _out << nl << "If rid__ Then";
- _out.inc();
- _out << nl << "Dim myId As String = is__.readTypeId()";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "is__.startReadSlice()";
- DataMemberList classMembers = p->classDataMembers();
- int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
- for(d = members.begin(); d != members.end(); ++d)
- {
- ostringstream patchParams;
- patchParams << "Me";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*d)->type(),
- fixId((*d)->name(), DotNet::ICloneable, true),
- false, false, false, patchParams.str());
- }
- _out << nl << "is__.endReadSlice()";
- _out << nl << "MyBase.read__(is__, true)";
- _out.dec();
- _out << nl << "End Sub";
-
- //
- // Write streaming API.
- //
- if(_stream)
- {
- _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
- _out.inc();
- _out << nl << "outS__.writeTypeId(ice_staticId())";
- _out << nl << "outS__.startSlice()";
- for(d = members.begin(); d != members.end(); ++d)
- {
- writeMarshalUnmarshalCode(_out, (*d)->type(),
- fixId((*d)->name(), DotNet::ICloneable, true),
- true, true, false);
- }
- _out << nl << "outS__.endSlice()";
- _out << nl << "MyBase.write__(outS__)";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overloads Overrides Sub read__"
- << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)";
- _out.inc();
- _out << nl << "If rid__ Then";
- _out.inc();
- _out << nl << "Dim myId As String = inS__.readTypeId()";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "inS__.startSlice()";
- for(d = members.begin(); d != members.end(); ++d)
- {
- ostringstream patchParams;
- patchParams << "Me";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*d)->type(),
- fixId((*d)->name(), DotNet::ICloneable, true),
- false, true, false, patchParams.str());
- }
- _out << nl << "inS__.endSlice()";
- _out << nl << "MyBase.read__(inS__, True)";
- _out.dec();
- _out << nl << "End Sub";
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
+ writeDispatch(p);
+
+ DataMemberList members = p->dataMembers();
+
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"Marshaling support\"";
+ _out.restoreIndent();
+
+ _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal os__ As IceInternal.BasicStream)";
+ _out.inc();
+ _out << nl << "os__.writeTypeId(ice_staticId())";
+ _out << nl << "os__.startWriteSlice()";
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ writeMarshalUnmarshalCode(_out, (*d)->type(), fixId((*d)->name(), DotNet::ICloneable, true), true, false,
+ false);
+ }
+ _out << nl << "os__.endWriteSlice()";
+ _out << nl << "MyBase.write__(os__)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ DataMemberList allClassMembers = p->allClassDataMembers();
+ if(allClassMembers.size() != 0)
+ {
+ _out << sp << nl << "Public Shadows NotInheritable Class Patcher__";
+ _out.inc();
+ _out << nl << "Inherits IceInternal.Patcher";
+ _out << sp << nl << "Friend Sub New(ByVal instance As Ice.ObjectImpl";
+ if(allClassMembers.size() > 1)
+ {
+ _out << ", ByVal member As Integer";
+ }
+ _out << ')';
+ _out.inc();
+ _out << nl << "_instance = CType(instance, " << name << ')';
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "_member = member";
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
+ _out.inc();
+ _out << nl << "Try";
+ _out.inc();
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "Select Case _member";
+ _out.inc();
+ }
+ int memberCount = 0;
+ for(d = allClassMembers.begin(); d != allClassMembers.end(); ++d)
+ {
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "Case " << memberCount;
+ _out.inc();
+ }
+ string memberName = fixId((*d)->name(), DotNet::ICloneable, true);
+ string memberType = typeToString((*d)->type());
+ _out << nl << "type_ = GetType(" << memberType << ')';
+ _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')';
+ _out << nl << "_typeId = \"" << (*d)->type()->typeId() << "\"";
+ if(allClassMembers.size() > 1)
+ {
+ _out.dec();
+ }
+ memberCount++;
+ }
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "End Select";
+ }
+ _out.dec();
+ _out << nl << "Catch _ex As System.InvalidCastException";
+ _out.inc();
+ _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
+ _out << nl << "_e.type = v.ice_id()";
+ _out << nl << "_e.expectedType = _typeId";
+ _out << nl << "Throw _e";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Private _instance As " << name;
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "Private _member As Integer";
+ }
+ _out << nl << "Private _typeId As String";
+ _out.dec();
+ _out << sp << nl << "End Class";
+ }
+
+ _out << sp << nl << "Public Overloads Overrides Sub read__(ByVal is__ As IceInternal.BasicStream, "
+ "ByVal rid__ As Boolean)";
+ _out.inc();
+ _out << nl << "If rid__ Then";
+ _out.inc();
+ _out << nl << "Dim myId As String = is__.readTypeId()";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "is__.startReadSlice()";
+ DataMemberList classMembers = p->classDataMembers();
+ int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ ostringstream patchParams;
+ patchParams << "Me";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*d)->type(),
+ fixId((*d)->name(), DotNet::ICloneable, true),
+ false, false, false, patchParams.str());
+ }
+ _out << nl << "is__.endReadSlice()";
+ _out << nl << "MyBase.read__(is__, true)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ //
+ // Write streaming API.
+ //
+ if(_stream)
+ {
+ _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
+ _out.inc();
+ _out << nl << "outS__.writeTypeId(ice_staticId())";
+ _out << nl << "outS__.startSlice()";
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ writeMarshalUnmarshalCode(_out, (*d)->type(),
+ fixId((*d)->name(), DotNet::ICloneable, true),
+ true, true, false);
+ }
+ _out << nl << "outS__.endSlice()";
+ _out << nl << "MyBase.write__(outS__)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overloads Overrides Sub read__"
+ << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)";
+ _out.inc();
+ _out << nl << "If rid__ Then";
+ _out.inc();
+ _out << nl << "Dim myId As String = inS__.readTypeId()";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "inS__.startSlice()";
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ ostringstream patchParams;
+ patchParams << "Me";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*d)->type(),
+ fixId((*d)->name(), DotNet::ICloneable, true),
+ false, true, false, patchParams.str());
+ }
+ _out << nl << "inS__.endSlice()";
+ _out << nl << "MyBase.read__(inS__, True)";
+ _out.dec();
+ _out << nl << "End Sub";
+ }
+ else
+ {
+ //
+ // Emit placeholder functions to catch errors.
+ //
string scoped = p->scoped();
- _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
- _out.inc();
- _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
- _out << nl << "Throw ex";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overloads Overrides Sub read__"
- << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)";
- _out.inc();
- _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
- _out << nl << "Throw ex";
- _out.dec();
- _out << nl << "End Sub";
- }
-
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // Marshalling support
- _out.restoreIndent();
+ _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
+ _out.inc();
+ _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
+ _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
+ _out << nl << "Throw ex";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overloads Overrides Sub read__"
+ << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)";
+ _out.inc();
+ _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
+ _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
+ _out << nl << "Throw ex";
+ _out.dec();
+ _out << nl << "End Sub";
+ }
+
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // Marshalling support
+ _out.restoreIndent();
}
_out.dec();
@@ -1559,17 +1559,17 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
if(!amd)
{
- params = getParams(p);
- args = getArgs(p);
- name = fixId(name, DotNet::ICloneable, true);
- ret = p->returnType();
- retS = typeToString(ret);
+ params = getParams(p);
+ args = getArgs(p);
+ name = fixId(name, DotNet::ICloneable, true);
+ ret = p->returnType();
+ retS = typeToString(ret);
}
else
{
- params = getParamsAsync(p, true);
- args = getArgsAsync(p);
- name = name + "_async";
+ params = getParamsAsync(p, true);
+ args = getArgsAsync(p);
+ name = name + "_async";
}
string vbOp = ret ? "Function" : "Sub";
@@ -1589,26 +1589,26 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
_out << " Implements " << classDef->name() << "OperationsNC_." << name;
if(!isLocal)
{
- _out.inc();
- _out << nl;
- if(!amd && p->returnType())
- {
- _out << "Return ";
- }
- _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar;
- _out.dec();
- _out << nl << "End " << vbOp;
+ _out.inc();
+ _out << nl;
+ if(!amd && p->returnType())
+ {
+ _out << "Return ";
+ }
+ _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar;
+ _out.dec();
+ _out << nl << "End " << vbOp;
}
if(!isLocal)
{
- _out << sp << nl << "Public MustOverride " << vbOp << ' ' << name
- << spar << params << "ByVal current__ As Ice.Current" << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out << " Implements " << classDef->name() << "Operations_." << name;
+ _out << sp << nl << "Public MustOverride " << vbOp << ' ' << name
+ << spar << params << "ByVal current__ As Ice.Current" << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements " << classDef->name() << "Operations_." << name;
}
}
@@ -2011,14 +2011,14 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out.inc();
if(!isValue)
{
- _out << nl << "If Not InnerList(i) Is Nothing Then";
- _out.inc();
+ _out << nl << "If Not InnerList(i) Is Nothing Then";
+ _out.inc();
}
_out << nl << "hash = 5 * hash + InnerList(i).GetHashCode()";
if(!isValue)
{
- _out.dec();
- _out << nl << "End If";
+ _out.dec();
+ _out << nl << "End If";
}
_out.dec();
_out << nl << "Next";
@@ -2047,16 +2047,16 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out.inc();
if(!isValue)
{
- _out << nl << "If InnerList(i__) Is Nothing Then";
- _out.inc();
- _out << nl << "If Not CType(other, " << name << ")(i__) Is Nothing Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
- _out << nl << "Else";
- _out.inc();
+ _out << nl << "If InnerList(i__) Is Nothing Then";
+ _out.inc();
+ _out << nl << "If Not CType(other, " << name << ")(i__) Is Nothing Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "Else";
+ _out.inc();
}
_out << nl << "If Not InnerList(i__).Equals(CType(other, " << name << ")(i__)) Then";
_out.inc();
@@ -2067,7 +2067,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
if(!isValue)
{
_out.dec();
- _out << nl << "End If";
+ _out << nl << "End If";
}
_out << nl << "Next";
_out << nl << "Return True";
@@ -2106,9 +2106,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(!p->dataMembers().empty())
{
- _out.zeroIndent();
- _out << sp << nl << "#Region \"Slice data members\"";
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"Slice data members\"";
+ _out.restoreIndent();
}
return true;
@@ -2124,9 +2124,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(!dataMembers.empty())
{
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // Slice data members
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // Slice data members
+ _out.restoreIndent();
}
_out.zeroIndent();
@@ -2171,19 +2171,19 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), DotNet::ApplicationException);
- bool isValue = isValueType((*q)->type());
- if(!isValue)
- {
- _out << nl << "If Not " << memberName << " Is Nothing Then";
- _out.inc();
- }
- _out << nl << "h__ = 5 * h__ + ";
- invokeObjectMethod((*q)->type(), memberName, "GetHashCode", "");
- if(!isValue)
- {
- _out.dec();
- _out << nl << "End If";
- }
+ bool isValue = isValueType((*q)->type());
+ if(!isValue)
+ {
+ _out << nl << "If Not " << memberName << " Is Nothing Then";
+ _out.inc();
+ }
+ _out << nl << "h__ = 5 * h__ + ";
+ invokeObjectMethod((*q)->type(), memberName, "GetHashCode", "");
+ if(!isValue)
+ {
+ _out.dec();
+ _out << nl << "End If";
+ }
}
_out << nl << "Return h__";
_out.dec();
@@ -2209,33 +2209,33 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), DotNet::ApplicationException);
- bool isValue = isValueType((*q)->type());
-
- if(!isValue)
- {
- _out << nl << "If " << memberName << " Is Nothing Then";
- _out.inc();
- _out << nl << "If Not (CType(other__, " + name + "))." << memberName << " Is Nothing";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
- _out << nl << "Else";
- _out.inc();
- }
- _out << nl << "If Not ";
- invokeObjectMethod((*q)->type(), memberName, "Equals", "CType(other__, " + name + ")." + memberName);
- _out << " Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- if(!isValue)
- {
- _out.dec();
- _out << nl << "End If";
- }
+ bool isValue = isValueType((*q)->type());
+
+ if(!isValue)
+ {
+ _out << nl << "If " << memberName << " Is Nothing Then";
+ _out.inc();
+ _out << nl << "If Not (CType(other__, " + name + "))." << memberName << " Is Nothing";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "Else";
+ _out.inc();
+ }
+ _out << nl << "If Not ";
+ invokeObjectMethod((*q)->type(), memberName, "Equals", "CType(other__, " + name + ")." + memberName);
+ _out << " Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ if(!isValue)
+ {
+ _out.dec();
+ _out << nl << "End If";
+ }
}
_out << nl << "Return True";
_out.dec();
@@ -2247,9 +2247,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(!p->isLocal())
{
- _out.zeroIndent();
+ _out.zeroIndent();
_out << sp << nl << "#Region \"Marshaling support\"";
- _out.restoreIndent();
+ _out.restoreIndent();
string scoped = p->scoped();
ExceptionPtr base = p->base();
@@ -2257,221 +2257,221 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp << nl << "Public Overloads Overrides Sub write__(ByVal os__ As IceInternal.BasicStream)";
_out.inc();
- _out << nl << "os__.writeString(\"" << scoped << "\")";
- _out << nl << "os__.startWriteSlice()";
+ _out << nl << "os__.writeString(\"" << scoped << "\")";
+ _out << nl << "os__.startWriteSlice()";
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- true, false, false);
+ fixId((*q)->name(), DotNet::ApplicationException),
+ true, false, false);
}
- _out << nl << "os__.endWriteSlice()";
+ _out << nl << "os__.endWriteSlice()";
if(base)
{
_out << nl << "MyBase.write__(os__)";
}
- _out.dec();
- _out << nl << "End Sub";
-
- DataMemberList allClassMembers = p->allClassDataMembers();
- if(allClassMembers.size() != 0)
- {
- _out << sp << nl << "Public Shadows NotInheritable Class Patcher__";
- _out.inc();
- _out << nl << "Inherits IceInternal.Patcher";
- _out << sp << nl << "Friend Sub New(ByVal instance As Ice.Exception";
- if(allClassMembers.size() > 1)
- {
- _out << ", ByVal member As Integer";
- }
- _out << ')';
- _out.inc();
- _out << nl << "_instance = CType(instance, " << name << ')';
- if(allClassMembers.size() > 1)
- {
- _out << nl << "_member = member";
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
- _out.inc();
- _out << nl << "Try";
- _out.inc();
- if(allClassMembers.size() > 1)
- {
- _out << nl << "Select Case _member";
- _out.inc();
- }
- int memberCount = 0;
- for(q = allClassMembers.begin(); q != allClassMembers.end(); ++q)
- {
- if(allClassMembers.size() > 1)
- {
- _out << nl << "Case " << memberCount;
- _out.inc();
- }
- string memberName = fixId((*q)->name(), DotNet::ApplicationException);
- string memberType = typeToString((*q)->type());
- _out << nl << "type_ = GetType(" << memberType << ')';
- _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')';
- _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\"";
- if(allClassMembers.size() > 1)
- {
- _out.dec();
- }
- memberCount++;
- }
- if(allClassMembers.size() > 1)
- {
- _out.dec();
- _out << nl << "End Select";
- }
- _out.dec();
- _out << nl << "Catch _ex As System.InvalidCastException";
- _out.inc();
- _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
- _out << nl << "_e.type = v.ice_id()";
- _out << nl << "_e.expectedType = _typeId";
- _out << nl << "Throw _e";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Private _instance As " << name;
- if(allClassMembers.size() > 1)
- {
- _out << nl << "Private _member As Integer";
- }
- _out << nl << "Private _typeId As String";
- _out.dec();
- _out << sp << nl << "End Class";
- }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ DataMemberList allClassMembers = p->allClassDataMembers();
+ if(allClassMembers.size() != 0)
+ {
+ _out << sp << nl << "Public Shadows NotInheritable Class Patcher__";
+ _out.inc();
+ _out << nl << "Inherits IceInternal.Patcher";
+ _out << sp << nl << "Friend Sub New(ByVal instance As Ice.Exception";
+ if(allClassMembers.size() > 1)
+ {
+ _out << ", ByVal member As Integer";
+ }
+ _out << ')';
+ _out.inc();
+ _out << nl << "_instance = CType(instance, " << name << ')';
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "_member = member";
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
+ _out.inc();
+ _out << nl << "Try";
+ _out.inc();
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "Select Case _member";
+ _out.inc();
+ }
+ int memberCount = 0;
+ for(q = allClassMembers.begin(); q != allClassMembers.end(); ++q)
+ {
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "Case " << memberCount;
+ _out.inc();
+ }
+ string memberName = fixId((*q)->name(), DotNet::ApplicationException);
+ string memberType = typeToString((*q)->type());
+ _out << nl << "type_ = GetType(" << memberType << ')';
+ _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')';
+ _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\"";
+ if(allClassMembers.size() > 1)
+ {
+ _out.dec();
+ }
+ memberCount++;
+ }
+ if(allClassMembers.size() > 1)
+ {
+ _out.dec();
+ _out << nl << "End Select";
+ }
+ _out.dec();
+ _out << nl << "Catch _ex As System.InvalidCastException";
+ _out.inc();
+ _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
+ _out << nl << "_e.type = v.ice_id()";
+ _out << nl << "_e.expectedType = _typeId";
+ _out << nl << "Throw _e";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Private _instance As " << name;
+ if(allClassMembers.size() > 1)
+ {
+ _out << nl << "Private _member As Integer";
+ }
+ _out << nl << "Private _typeId As String";
+ _out.dec();
+ _out << sp << nl << "End Class";
+ }
_out << sp << nl << "Public Overloads Overrides Sub read__(ByVal is__ As IceInternal.BasicStream, "
- "ByVal rid__ As Boolean)";
+ "ByVal rid__ As Boolean)";
_out.inc();
- _out << nl << "If rid__ Then";
- _out.inc();
- _out << nl << "Dim myId As String = is__.readString()";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "is__.startReadSlice()";
- DataMemberList classMembers = p->classDataMembers();
- int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
+ _out << nl << "If rid__ Then";
+ _out.inc();
+ _out << nl << "Dim myId As String = is__.readString()";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "is__.startReadSlice()";
+ DataMemberList classMembers = p->classDataMembers();
+ int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- ostringstream patchParams;
- patchParams << "Me";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
+ ostringstream patchParams;
+ patchParams << "Me";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- false, false, false, patchParams.str());
+ fixId((*q)->name(), DotNet::ApplicationException),
+ false, false, false, patchParams.str());
}
- _out << nl << "is__.endReadSlice()";
+ _out << nl << "is__.endReadSlice()";
if(base)
{
_out << nl << "MyBase.read__(is__, true)";
}
_out.dec();
- _out << nl << "End Sub";
-
- if(_stream)
- {
- _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
- _out.inc();
- _out << nl << "outS__.writeString(\"" << scoped << "\")";
- _out << nl << "outS__.startSlice()";
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- true, true, false);
- }
- _out << nl << "outS__.endSlice()";
- if(base)
- {
- _out << nl << "MyBase.write__(outS__)";
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overloads Overrides Sub read__(ByVal inS__ As Ice.InputStream, "
- << "ByVal rid__ As Boolean)";
- _out.inc();
- _out << nl << "If rid__ Then";
- _out.inc();
- _out << nl << "Dim myId As String = inS__.readString()";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "inS__.startSlice()";
- classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- ostringstream patchParams;
- patchParams << "Me";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), DotNet::ApplicationException),
- false, true, false, patchParams.str());
- }
- _out << nl << "inS__.endSlice()";
- if(base)
- {
- _out << nl << "MyBase.read__(inS__, true)";
- }
- _out.dec();
- _out << nl << "End Sub";
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
- _out.inc();
- _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
- _out << nl << "Throw ex";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overloads Overrides Sub read__"
- << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)";
- _out.inc();
- _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
- _out << nl << "Throw ex";
- _out.dec();
- _out << nl << "End Sub";
- }
-
- if(!base || base && !base->usesClasses())
- {
- _out << sp << nl << "Public Overrides Function usesClasses__() As Boolean";
- _out.inc();
- _out << nl << "Return True";
- _out.dec();
- _out << nl << "End Function";
- }
-
- _out.zeroIndent();
+ _out << nl << "End Sub";
+
+ if(_stream)
+ {
+ _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
+ _out.inc();
+ _out << nl << "outS__.writeString(\"" << scoped << "\")";
+ _out << nl << "outS__.startSlice()";
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), DotNet::ApplicationException),
+ true, true, false);
+ }
+ _out << nl << "outS__.endSlice()";
+ if(base)
+ {
+ _out << nl << "MyBase.write__(outS__)";
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overloads Overrides Sub read__(ByVal inS__ As Ice.InputStream, "
+ << "ByVal rid__ As Boolean)";
+ _out.inc();
+ _out << nl << "If rid__ Then";
+ _out.inc();
+ _out << nl << "Dim myId As String = inS__.readString()";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "inS__.startSlice()";
+ classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ ostringstream patchParams;
+ patchParams << "Me";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), DotNet::ApplicationException),
+ false, true, false, patchParams.str());
+ }
+ _out << nl << "inS__.endSlice()";
+ if(base)
+ {
+ _out << nl << "MyBase.read__(inS__, true)";
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+ }
+ else
+ {
+ //
+ // Emit placeholder functions to catch errors.
+ //
+ _out << sp << nl << "Public Overloads Overrides Sub write__(ByVal outS__ As Ice.OutputStream)";
+ _out.inc();
+ _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
+ _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
+ _out << nl << "Throw ex";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overloads Overrides Sub read__"
+ << "(ByVal inS__ As Ice.InputStream, ByVal rid__ As Boolean)";
+ _out.inc();
+ _out << nl << "Dim ex As Ice.MarshalException = New Ice.MarshalException";
+ _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\"";
+ _out << nl << "Throw ex";
+ _out.dec();
+ _out << nl << "End Sub";
+ }
+
+ if(!base || base && !base->usesClasses())
+ {
+ _out << sp << nl << "Public Overrides Function usesClasses__() As Boolean";
+ _out.inc();
+ _out << nl << "Return True";
+ _out.dec();
+ _out << nl << "End Function";
+ }
+
+ _out.zeroIndent();
_out << sp << nl << "#End Region"; // Marshalling support
- _out.restoreIndent();
+ _out.restoreIndent();
}
_out.dec();
@@ -2486,24 +2486,24 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
if(!p->isLocal() && _stream)
{
_out << sp << nl << "Public NotInheritable Class " << p->name() << "Helper";
- _out.inc();
+ _out.inc();
- _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')';
- _out.inc();
- _out << nl << "v__.ice_write(outS__)";
- _out.dec();
- _out << nl << "End Sub";
+ _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')';
+ _out.inc();
+ _out << nl << "v__.ice_write(outS__)";
+ _out.dec();
+ _out << nl << "End Sub";
- _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name;
- _out.inc();
- _out << nl << "Dim v__ As " << name << " = New " << name;
- _out << nl << "v__.ice_read(inS__)";
- _out << nl << "Return v__";
- _out.dec();
- _out << nl << "End Function";
+ _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name;
+ _out.inc();
+ _out << nl << "Dim v__ As " << name << " = New " << name;
+ _out << nl << "v__.ice_read(inS__)";
+ _out << nl << "Return v__";
+ _out.dec();
+ _out << nl << "End Function";
- _out.dec();
- _out << sp << nl << "End Class";
+ _out.dec();
+ _out << sp << nl << "End Class";
}
_out << sp;
@@ -2513,14 +2513,14 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
emitAttributes(p);
if(isValueType(p))
{
- _out << nl << "Public Structure " << name;
+ _out << nl << "Public Structure " << name;
}
else
{
- _out << nl << "Public Class " << name;
- _out.inc();
- _out << nl << " Implements _System.ICloneable";
- _out.dec();
+ _out << nl << "Public Class " << name;
+ _out.inc();
+ _out << nl << " Implements _System.ICloneable";
+ _out.dec();
}
_out.inc();
@@ -2556,7 +2556,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(isClass)
{
_out << sp << nl << "Public Sub New()";
- _out << nl << "End Sub";
+ _out << nl << "End Sub";
}
_out << sp << nl << "Public Sub New" << spar;
@@ -2565,9 +2565,9 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name());
- string memberType = typeToString((*q)->type());
- paramDecl.push_back("ByVal " + memberName + " As " + memberType);
- paramNames.push_back(memberName);
+ string memberType = typeToString((*q)->type());
+ paramDecl.push_back("ByVal " + memberName + " As " + memberType);
+ paramNames.push_back(memberName);
}
_out << paramDecl << epar;
_out.inc();
@@ -2584,19 +2584,19 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(isClass)
{
- _out.zeroIndent();
- _out << sp << nl << "#Region \"ICloneable members\"";
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"ICloneable members\"";
+ _out.restoreIndent();
- _out << sp << nl << "Function Clone() As Object Implements _System.ICloneable.Clone";
- _out.inc();
- _out << nl << "Return MemberwiseClone()";
- _out.dec();
- _out << nl << "End Function";
+ _out << sp << nl << "Function Clone() As Object Implements _System.ICloneable.Clone";
+ _out.inc();
+ _out << nl << "Return MemberwiseClone()";
+ _out.dec();
+ _out << nl << "End Function";
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // ICloneable members
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // ICloneable members
+ _out.restoreIndent();
}
_out.zeroIndent();
@@ -2609,19 +2609,19 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
- bool isValue = isValueType((*q)->type());
- if(!isValue)
- {
- _out << nl << "If Not " << memberName << " Is Nothing Then";
- _out.inc();
- }
- _out << nl << "h__ = 5 * h__ + ";
- invokeObjectMethod((*q)->type(), memberName, "GetHashCode", "");
- if(!isValue)
- {
- _out.dec();
- _out << nl << "End If";
- }
+ bool isValue = isValueType((*q)->type());
+ if(!isValue)
+ {
+ _out << nl << "If Not " << memberName << " Is Nothing Then";
+ _out.inc();
+ }
+ _out << nl << "h__ = 5 * h__ + ";
+ invokeObjectMethod((*q)->type(), memberName, "GetHashCode", "");
+ if(!isValue)
+ {
+ _out.dec();
+ _out << nl << "End If";
+ }
}
_out << nl << "Return h__";
_out.dec();
@@ -2631,27 +2631,27 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out.inc();
if(isClass)
{
- _out << nl << "If Object.ReferenceEquals(Me, other__) Then";
- _out.inc();
- _out << nl << "Return True";
- _out.dec();
- _out << nl << "End If";
+ _out << nl << "If Object.ReferenceEquals(Me, other__) Then";
+ _out.inc();
+ _out << nl << "Return True";
+ _out.dec();
+ _out << nl << "End If";
}
if(isClass)
{
_out << nl << "If other__ Is Nothing Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
}
else
{
- _out << nl << "If Not TypeOf other__ Is " << name << " Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
+ _out << nl << "If Not TypeOf other__ Is " << name << " Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
}
if(!dataMembers.empty())
{
@@ -2660,36 +2660,36 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
- if(!isValueType((*q)->type()))
- {
- _out << nl << "If " << memberName << " Is Nothing Then";
- _out.inc();
- _out << nl << "If Not o__." << memberName << " Is Nothing Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
- _out << nl << "Else";
- _out.inc();
- _out << nl << "If Not ";
- invokeObjectMethod((*q)->type(), memberName, "Equals", "o__." + memberName);
- _out << " Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
- _out << nl << "End If";
- }
- else
- {
- _out << nl << "If Not " << memberName << ".Equals(o__." << memberName << ") Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- }
+ if(!isValueType((*q)->type()))
+ {
+ _out << nl << "If " << memberName << " Is Nothing Then";
+ _out.inc();
+ _out << nl << "If Not o__." << memberName << " Is Nothing Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "Else";
+ _out.inc();
+ _out << nl << "If Not ";
+ invokeObjectMethod((*q)->type(), memberName, "Equals", "o__." + memberName);
+ _out << " Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "End If";
+ }
+ else
+ {
+ _out << nl << "If Not " << memberName << ".Equals(o__." << memberName << ") Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ }
}
_out << nl << "Return True";
_out.dec();
@@ -2701,158 +2701,158 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(!p->isLocal())
{
- _out.zeroIndent();
+ _out.zeroIndent();
_out << sp << nl << "#Region \"Marshalling support\"";
- _out.restoreIndent();
+ _out.restoreIndent();
_out << sp << nl << "Public Sub write__(ByVal os__ As IceInternal.BasicStream)";
_out.inc();
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
- true, false, false);
- }
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
+ true, false, false);
+ }
_out.dec();
- _out << nl << "End Sub";
-
-
- if(isClass && classMembers.size() != 0)
- {
- _out << sp << nl << "Public NotInheritable Class Patcher__";
- _out.inc();
- _out << nl << "Inherits IceInternal.Patcher";
- _out << sp << nl << "Friend Sub New(ByVal instance As " << name;
- if(classMembers.size() > 1)
- {
- _out << ", ByVal member As Integer";
- }
- _out << ')';
- _out.inc();
- _out << nl << "_instance = instance";
- if(classMembers.size() > 1)
- {
- _out << nl << "_member = member";
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
- _out.inc();
- _out << nl << "Try";
- _out.inc();
- if(classMembers.size() > 1)
- {
- _out << nl << "Select Case _member";
- _out.inc();
- }
- int memberCount = 0;
- for(q = classMembers.begin(); q != classMembers.end(); ++q)
- {
- if(classMembers.size() > 1)
- {
- _out << nl << "Case " << memberCount;
- _out.inc();
- }
- string memberType = typeToString((*q)->type());
- string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
- _out << nl << "type_ = GetType(" << memberType << ')';
- _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')';
- _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\"";
- if(classMembers.size() > 1)
- {
- _out.dec();
- }
- memberCount++;
- }
- if(classMembers.size() > 1)
- {
- _out.dec();
- _out << nl << "End Select";
- }
- _out.dec();
- _out << nl << "Catch _ex As System.InvalidCastException";
- _out.inc();
- _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
- _out << nl << "_e.type = v.ice_id()";
- _out << nl << "_e.expectedType = _typeId";
- _out << nl << "Throw _e";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Private _instance As " << name;
- if(classMembers.size() > 1)
- {
- _out << nl << "Private _member As Integer";
- }
- _out << nl << "Private _typeId As String";
- _out.dec();
- _out << sp << nl << "End Class";
- }
+ _out << nl << "End Sub";
+
+
+ if(isClass && classMembers.size() != 0)
+ {
+ _out << sp << nl << "Public NotInheritable Class Patcher__";
+ _out.inc();
+ _out << nl << "Inherits IceInternal.Patcher";
+ _out << sp << nl << "Friend Sub New(ByVal instance As " << name;
+ if(classMembers.size() > 1)
+ {
+ _out << ", ByVal member As Integer";
+ }
+ _out << ')';
+ _out.inc();
+ _out << nl << "_instance = instance";
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "_member = member";
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
+ _out.inc();
+ _out << nl << "Try";
+ _out.inc();
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "Select Case _member";
+ _out.inc();
+ }
+ int memberCount = 0;
+ for(q = classMembers.begin(); q != classMembers.end(); ++q)
+ {
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "Case " << memberCount;
+ _out.inc();
+ }
+ string memberType = typeToString((*q)->type());
+ string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
+ _out << nl << "type_ = GetType(" << memberType << ')';
+ _out << nl << "_instance." << memberName << " = CType(v, " << memberType << ')';
+ _out << nl << "_typeId = \"" << (*q)->type()->typeId() << "\"";
+ if(classMembers.size() > 1)
+ {
+ _out.dec();
+ }
+ memberCount++;
+ }
+ if(classMembers.size() > 1)
+ {
+ _out.dec();
+ _out << nl << "End Select";
+ }
+ _out.dec();
+ _out << nl << "Catch _ex As System.InvalidCastException";
+ _out.inc();
+ _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
+ _out << nl << "_e.type = v.ice_id()";
+ _out << nl << "_e.expectedType = _typeId";
+ _out << nl << "Throw _e";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Private _instance As " << name;
+ if(classMembers.size() > 1)
+ {
+ _out << nl << "Private _member As Integer";
+ }
+ _out << nl << "Private _typeId As String";
+ _out.dec();
+ _out << sp << nl << "End Class";
+ }
_out << sp << nl << "Public Sub read__(ByVal is__ As IceInternal.BasicStream)";
_out.inc();
- int classMemberCount = 0;
+ int classMemberCount = 0;
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- ostringstream patchParams;
- patchParams << "Me";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
+ ostringstream patchParams;
+ patchParams << "Me";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
- false, false, false, patchParams.str());
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
+ false, false, false, patchParams.str());
}
_out.dec();
- _out << nl << "End Sub";
-
- if(_stream)
- {
- _out << sp << nl << "Public Sub ice_write(ByVal outS__ As Ice.OutputStream)";
- _out.inc();
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
- true, true, false);
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Sub ice_read(ByVal inS__ As Ice.InputStream)";
- _out.inc();
- classMemberCount = 0;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- ostringstream patchParams;
- patchParams << "Me";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- if(classMembers.size() > 1)
- {
- patchParams << ", " << classMemberCount++;
- }
- }
- writeMarshalUnmarshalCode(_out, (*q)->type(),
- fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
- false, true, false, patchParams.str());
- }
- _out.dec();
- _out << nl << "End Sub";
- }
-
- _out.zeroIndent();
+ _out << nl << "End Sub";
+
+ if(_stream)
+ {
+ _out << sp << nl << "Public Sub ice_write(ByVal outS__ As Ice.OutputStream)";
+ _out.inc();
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
+ true, true, false);
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Sub ice_read(ByVal inS__ As Ice.InputStream)";
+ _out.inc();
+ classMemberCount = 0;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ ostringstream patchParams;
+ patchParams << "Me";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ if(classMembers.size() > 1)
+ {
+ patchParams << ", " << classMemberCount++;
+ }
+ }
+ writeMarshalUnmarshalCode(_out, (*q)->type(),
+ fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
+ false, true, false, patchParams.str());
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+ }
+
+ _out.zeroIndent();
_out << sp << nl << "#End Region"; // Marshalling support
- _out.restoreIndent();
+ _out.restoreIndent();
}
_out.dec();
@@ -3045,14 +3045,14 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
_out << nl << "hash = 5 * hash + e.Key.GetHashCode()";
if(!valueIsValue)
{
- _out << nl << "If Not e.Value Is Nothing";
- _out.inc();
+ _out << nl << "If Not e.Value Is Nothing";
+ _out.inc();
}
_out << nl << "hash = 5 * hash + e.Value.GetHashCode()";
if(!valueIsValue)
{
- _out.dec();
- _out << nl << "End If";
+ _out.dec();
+ _out << nl << "End If";
}
_out.dec();
_out << nl << "Next";
@@ -3096,22 +3096,22 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
bool valueIsArray = seq && !seq->hasMetaData("clr:collection");
if(valueIsArray)
{
- _out << nl << "Dim vlhs__ As " << vs << "() = New " << toArrayAlloc(vs + "()", "Count - 1") << " {}";
+ _out << nl << "Dim vlhs__ As " << vs << "() = New " << toArrayAlloc(vs + "()", "Count - 1") << " {}";
}
else
{
- _out << nl << "Dim vlhs__ As " << vs << "() = New " << vs << "(Count - 1) {}";
+ _out << nl << "Dim vlhs__ As " << vs << "() = New " << vs << "(Count - 1) {}";
}
_out << nl << "Values.CopyTo(vlhs__, 0)";
_out << nl << "_System.Array.Sort(vlhs__)";
string vrhsCount = "Ctype(other, " + name + ").Count - 1";
if(valueIsArray)
{
- _out << nl << "Dim vrhs__ As " << vs << "() = New " << toArrayAlloc(vs + "()", vrhsCount) << " {}";
+ _out << nl << "Dim vrhs__ As " << vs << "() = New " << toArrayAlloc(vs + "()", vrhsCount) << " {}";
}
else
{
- _out << nl << "Dim vrhs__ As " << vs << "() = New " << vs << '(' << vrhsCount << ") {}";
+ _out << nl << "Dim vrhs__ As " << vs << "() = New " << vs << '(' << vrhsCount << ") {}";
}
_out << nl << "CType(other, " << name << ").Values.CopyTo(vrhs__, 0)";
_out << nl << "_System.Array.Sort(vrhs__)";
@@ -3119,29 +3119,29 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
_out.inc();
if(!valueIsValue)
{
- _out << nl << "If vlhs__(i) Is Nothing";
- _out.inc();
- _out << nl << "If Not vrhs__(i) Is Nothing";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
- _out << nl << "ElseIf Not CType(vlhs__(i), Object).Equals(vrhs__(i)) Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
+ _out << nl << "If vlhs__(i) Is Nothing";
+ _out.inc();
+ _out << nl << "If Not vrhs__(i) Is Nothing";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "ElseIf Not CType(vlhs__(i), Object).Equals(vrhs__(i)) Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
}
else
{
- _out << nl << "If Not vlhs__(i).Equals(vrhs__(i)) Then";
- _out.inc();
- _out << nl << "Return False";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
+ _out << nl << "If Not vlhs__(i).Equals(vrhs__(i)) Then";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
}
_out << nl << "Next";
_out << nl << "Return True";
@@ -3178,25 +3178,25 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
if(_stream)
{
- _out << sp << nl << "Public NotInheritable Class " << name << "Helper";
- _out.inc();
+ _out << sp << nl << "Public NotInheritable Class " << name << "Helper";
+ _out.inc();
- _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << scoped << ')';
- _out.inc();
- writeMarshalUnmarshalCode(_out, p, "v__", true, true, false);
- _out.dec();
- _out << nl << "End Sub";
+ _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << scoped << ')';
+ _out.inc();
+ writeMarshalUnmarshalCode(_out, p, "v__", true, true, false);
+ _out.dec();
+ _out << nl << "End Sub";
- _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << scoped;
- _out.inc();
- _out << nl << "Dim v__ As " << scoped;
- writeMarshalUnmarshalCode(_out, p, "v__", false, true, false);
- _out << nl << "Return v__";
- _out.dec();
- _out << nl << "End Function";
+ _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << scoped;
+ _out.inc();
+ _out << nl << "Dim v__ As " << scoped;
+ writeMarshalUnmarshalCode(_out, p, "v__", false, true, false);
+ _out << nl << "Return v__";
+ _out.dec();
+ _out << nl << "End Function";
- _out.dec();
- _out << sp << nl << "End Class";
+ _out.dec();
+ _out << sp << nl << "End Class";
}
}
@@ -3212,108 +3212,108 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
BuiltinPtr bp = BuiltinPtr::dynamicCast(p->type());
if(bp && bp->kind() == Builtin::KindString)
{
- static const string basicStringChars = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789"
- "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
- static const set<char> charSet(basicStringChars.begin(), basicStringChars.end());
-
- enum Position { Beginning, InString, NotInString };
- Position pos = Beginning;
-
- const string val = p->value();
- for(string::const_iterator c = val.begin(); c != val.end(); ++c)
- {
- if(charSet.find(*c) == charSet.end())
- {
- //
- // The character is something non-printable, such as a line feed,
- // so get it into the string literal using the VB Chr() function.
- //
- if(pos == InString)
- {
- _out << '"'; // Close previous string literal.
- pos = NotInString;
- }
- if(pos == NotInString)
- {
- _out << " + ";
- }
-
- //
- // char may be signed, so make it positive.
- //
- unsigned char uc = *c;
- _out << " + Chr(" << static_cast<unsigned>(uc) << ')';
-
- pos = NotInString;
- }
- else
- {
- if(pos == NotInString)
- {
- _out << " + ";
- pos = Beginning;
- }
- if(pos == Beginning)
- {
- _out << '"';
- }
-
- if(*c == '"')
- {
- _out << "\"\"";
- }
- else
- {
- _out << *c;
- }
-
- pos = InString;
- }
- }
- if(pos == InString)
- {
- _out << '"'; // Terminate final string literal.
- }
+ static const string basicStringChars = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
+ static const set<char> charSet(basicStringChars.begin(), basicStringChars.end());
+
+ enum Position { Beginning, InString, NotInString };
+ Position pos = Beginning;
+
+ const string val = p->value();
+ for(string::const_iterator c = val.begin(); c != val.end(); ++c)
+ {
+ if(charSet.find(*c) == charSet.end())
+ {
+ //
+ // The character is something non-printable, such as a line feed,
+ // so get it into the string literal using the VB Chr() function.
+ //
+ if(pos == InString)
+ {
+ _out << '"'; // Close previous string literal.
+ pos = NotInString;
+ }
+ if(pos == NotInString)
+ {
+ _out << " + ";
+ }
+
+ //
+ // char may be signed, so make it positive.
+ //
+ unsigned char uc = *c;
+ _out << " + Chr(" << static_cast<unsigned>(uc) << ')';
+
+ pos = NotInString;
+ }
+ else
+ {
+ if(pos == NotInString)
+ {
+ _out << " + ";
+ pos = Beginning;
+ }
+ if(pos == Beginning)
+ {
+ _out << '"';
+ }
+
+ if(*c == '"')
+ {
+ _out << "\"\"";
+ }
+ else
+ {
+ _out << *c;
+ }
+
+ pos = InString;
+ }
+ }
+ if(pos == InString)
+ {
+ _out << '"'; // Terminate final string literal.
+ }
}
else if(bp && bp->kind() == Builtin::KindBool)
{
- string val = p->value();
- val[0] = toupper(val[0]);
- _out << val;
+ string val = p->value();
+ val[0] = toupper(val[0]);
+ _out << val;
}
else if(bp && bp->kind() == Builtin::KindShort)
{
- _out << p->value() << 'S';
+ _out << p->value() << 'S';
}
else if(bp && bp->kind() == Builtin::KindInt)
{
- _out << p->value() << 'I';
+ _out << p->value() << 'I';
}
else if(bp && bp->kind() == Builtin::KindLong)
{
- _out << p->value() << 'L';
+ _out << p->value() << 'L';
}
else if(bp && bp->kind() == Builtin::KindFloat)
{
- _out << p->value() << 'F';
+ _out << p->value() << 'F';
}
else if(bp && bp->kind() == Builtin::KindDouble)
{
- _out << p->value() << 'R';
+ _out << p->value() << 'R';
}
else
{
- EnumPtr ep = EnumPtr::dynamicCast(p->type());
- if(ep)
- {
- _out << fixId(typeToString(p->type())) << '.' << fixId(p->value());
- }
- else
- {
- _out << p->value(); // byte
- }
+ EnumPtr ep = EnumPtr::dynamicCast(p->type());
+ if(ep)
+ {
+ _out << fixId(typeToString(p->type())) << '.' << fixId(p->value());
+ }
+ else
+ {
+ _out << p->value(); // byte
+ }
}
_out.dec();
_out << sp << nl << "End Class";
@@ -3330,15 +3330,15 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
assert(cont);
if(StructPtr::dynamicCast(cont))
{
- isValue = isValueType(StructPtr::dynamicCast(cont));
- if(!isValue || cont->hasMetaData("clr:class"))
- {
- baseTypes = DotNet::ICloneable;
- }
- if(cont->hasMetaData("clr:property"))
- {
- propertyMapping = true;
- }
+ isValue = isValueType(StructPtr::dynamicCast(cont));
+ if(!isValue || cont->hasMetaData("clr:class"))
+ {
+ baseTypes = DotNet::ICloneable;
+ }
+ if(cont->hasMetaData("clr:property"))
+ {
+ propertyMapping = true;
+ }
}
else if(ExceptionPtr::dynamicCast(cont))
{
@@ -3346,12 +3346,12 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
}
else if(ClassDefPtr::dynamicCast(cont))
{
- baseTypes = DotNet::ICloneable;
- isClass = true;
- if(cont->hasMetaData("clr:property"))
- {
- propertyMapping = true;
- }
+ baseTypes = DotNet::ICloneable;
+ isClass = true;
+ if(cont->hasMetaData("clr:property"))
+ {
+ propertyMapping = true;
+ }
}
_out << sp;
@@ -3397,13 +3397,13 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
void
Slice::Gen::TypesVisitor::invokeObjectMethod(const TypePtr& type, const string& obj, const string& method,
- const string& arg)
+ const string& arg)
{
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
ClassDeclPtr cl;
if(!b)
{
- cl = ClassDeclPtr::dynamicCast(type);
+ cl = ClassDeclPtr::dynamicCast(type);
}
//
@@ -3413,11 +3413,11 @@ Slice::Gen::TypesVisitor::invokeObjectMethod(const TypePtr& type, const string&
if((b && (b->kind() == Builtin::KindObject || b->kind() == Builtin::KindObjectProxy)) ||
(cl && cl->isInterface()) || ProxyPtr::dynamicCast(type))
{
- _out << "CType(" << obj << ", Object)." << method << '(' << arg << ')';
+ _out << "CType(" << obj << ", Object)." << method << '(' << arg << ')';
}
else
{
- _out << obj << '.' << method << '(' << arg << ')';
+ _out << obj << '.' << method << '(' << arg << ')';
}
}
@@ -3431,7 +3431,7 @@ Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
{
if(!p->hasNonLocalClassDecls())
{
- return false;
+ return false;
}
_out << sp;
@@ -3453,7 +3453,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
string name = p->name();
@@ -3468,15 +3468,15 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- _out << fixId((*q)->scoped() + "Prx");
- if(++q != bases.end())
- {
- _out << ", ";
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ _out << fixId((*q)->scoped() + "Prx");
+ if(++q != bases.end())
+ {
+ _out << ", ";
+ }
+ }
}
return true;
@@ -3505,11 +3505,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
string deprecateMetadata, deprecateReason;
if(p->findMetaData("deprecate", deprecateMetadata) || cl->findMetaData("deprecate", deprecateMetadata))
{
- deprecateReason = "This operation has been deprecated.";
- if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
- {
- deprecateReason = deprecateMetadata.substr(10);
- }
+ deprecateReason = "This operation has been deprecated.";
+ if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
+ {
+ deprecateReason = deprecateMetadata.substr(10);
+ }
}
//
@@ -3518,7 +3518,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
//
if(!deprecateReason.empty())
{
- _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
+ _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
}
_out << nl << vbOp << ' ' << name << spar << params << epar;
if(ret)
@@ -3528,7 +3528,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
if(!deprecateReason.empty())
{
- _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
+ _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
}
_out << nl << vbOp << ' ' << name << spar << params << "ByVal context__ As Ice.Context" << epar;
if(ret)
@@ -3540,21 +3540,21 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
vector<string> paramsAMI = getParamsAsync(p, false);
- //
- // Write two versions of the operation - with and without a
- // context parameter.
- //
- _out << sp;
- if(!deprecateReason.empty())
- {
- _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
- }
- _out << nl << "Sub " << p->name() << "_async" << spar << paramsAMI << epar;
- if(!deprecateReason.empty())
- {
- _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
- }
- _out << nl << "Sub " << p->name() << "_async" << spar << paramsAMI << "ByVal ctx__ As Ice.Context" << epar;
+ //
+ // Write two versions of the operation - with and without a
+ // context parameter.
+ //
+ _out << sp;
+ if(!deprecateReason.empty())
+ {
+ _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
+ }
+ _out << nl << "Sub " << p->name() << "_async" << spar << paramsAMI << epar;
+ if(!deprecateReason.empty())
+ {
+ _out << nl << "<System.Obsolete(\"" << deprecateReason << "\")>";
+ }
+ _out << nl << "Sub " << p->name() << "_async" << spar << paramsAMI << "ByVal ctx__ As Ice.Context" << epar;
}
}
@@ -3591,12 +3591,12 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
//
if(!p->isAbstract())
{
- return false;
+ return false;
}
if(!p->isLocal())
{
- writeOperations(p, false);
+ writeOperations(p, false);
}
writeOperations(p, true);
@@ -3620,71 +3620,71 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
{
_out << nl << "Inherits ";
- ClassList::const_iterator q = bases.begin();
- bool first = true;
- while(q != bases.end())
- {
- if((*q)->isAbstract())
- {
- if(!first)
- {
- _out << ", ";
- }
- else
- {
- first = false;
- }
- string s = (*q)->scoped();
- s += "Operations";
- if(noCurrent)
- {
- s += "NC";
- }
- s += "_";
- _out << fixId(s);
- }
- ++q;
- }
+ ClassList::const_iterator q = bases.begin();
+ bool first = true;
+ while(q != bases.end())
+ {
+ if((*q)->isAbstract())
+ {
+ if(!first)
+ {
+ _out << ", ";
+ }
+ else
+ {
+ first = false;
+ }
+ string s = (*q)->scoped();
+ s += "Operations";
+ if(noCurrent)
+ {
+ s += "NC";
+ }
+ s += "_";
+ _out << fixId(s);
+ }
+ ++q;
+ }
}
OperationList ops = p->operations();
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
- bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"));
- string opname = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true);
+ OperationPtr op = *r;
+ bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"));
+ string opname = amd ? (op->name() + "_async") : fixId(op->name(), DotNet::ICloneable, true);
- TypePtr ret;
- vector<string> params;
+ TypePtr ret;
+ vector<string> params;
- if(amd)
- {
- params = getParamsAsync(op, true);
- }
- else
- {
- params = getParams(op);
- ret = op->returnType();
- }
+ if(amd)
+ {
+ params = getParamsAsync(op, true);
+ }
+ else
+ {
+ params = getParams(op);
+ ret = op->returnType();
+ }
- string vbOp = ret ? "Function" : "Sub";
+ string vbOp = ret ? "Function" : "Sub";
- _out << sp;
+ _out << sp;
emitDeprecate(op, p, _out, "operation");
- emitAttributes(op);
- _out << nl << vbOp << ' ' << opname << spar << params;
- if(!noCurrent && !p->isLocal())
- {
- _out << "ByVal current__ As Ice.Current";
- }
- _out << epar;
- if(ret)
- {
- _out << " As " << typeToString(ret);
- }
+ emitAttributes(op);
+ _out << nl << vbOp << ' ' << opname << spar << params;
+ if(!noCurrent && !p->isLocal())
+ {
+ _out << "ByVal current__ As Ice.Current";
+ }
+ _out << epar;
+ if(ret)
+ {
+ _out << " As " << typeToString(ret);
+ }
}
_out.dec();
@@ -3735,178 +3735,178 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!ops.empty())
{
- _out.zeroIndent();
- _out << sp << nl << "#Region \"Synchronous operations\"";
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"Synchronous operations\"";
+ _out.restoreIndent();
}
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = *r;
- string opName = fixId(op->name(), DotNet::ICloneable, true);
- TypePtr ret = op->returnType();
- string retS = typeToString(ret);
+ string opName = fixId(op->name(), DotNet::ICloneable, true);
+ TypePtr ret = op->returnType();
+ string retS = typeToString(ret);
- vector<string> params = getParams(op);
- vector<string> args = getArgs(op);
+ vector<string> params = getParams(op);
+ vector<string> args = getArgs(op);
string vbOp = ret ? "Function" : "Sub";
- _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out << " Implements " << name << "Prx." << opName;
- _out.inc();
- _out << nl;
- if(ret)
- {
- _out << "Return ";
- }
- _out << opName << spar << args << "Nothing" << "False" << epar;
- _out.dec();
- _out << nl << "End " << vbOp;
-
-
- _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params
- << "ByVal context__ As Ice.Context" << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out << " Implements " << name << "Prx." << opName;
- _out.inc();
- _out << nl;
- if(ret)
- {
- _out << "Return ";
- }
- _out << opName << spar << args << "context__" << "True" << epar;
- _out.dec();
- _out << nl << "End " << vbOp;
-
- _out << sp << nl << "Private " << vbOp << ' ' << opName << spar << params
- << "ByVal context__ As Ice.Context" << "explicitContext__ As Boolean" << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out.inc();
- _out << nl << "If explicitContext__ And context__ Is Nothing Then";
- _out.inc();
- _out << nl << "context__ = emptyContext_";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "Dim cnt__ As Integer = 0";
- _out << nl << "While True";
- _out.inc();
- _out << nl << "Dim delBase__ As Ice.ObjectDel_ = Nothing";
- _out << nl << "Try";
- _out.inc();
- if(op->returnsData())
- {
- _out << nl << "checkTwowayOnly__(\"" << op->name() << "\")";
- }
- _out << nl << "delBase__ = getDelegate__()";
- _out << nl << "Dim del__ As _" << name << "Del = CType(delBase__, _" << name << "Del)";
- _out << nl;
- if(ret)
- {
- _out << "Return ";
- }
- _out << "del__." << opName << spar << args << "context__" << epar;
- if(!ret)
- {
- _out << nl << "Return";
- }
- _out.dec();
- _out << nl << "Catch ex__ As IceInternal.LocalExceptionWrapper";
- _out.inc();
- if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating)
- {
- _out << nl << "cnt__ = handleExceptionWrapperRelaxed__(delBase__, ex__, cnt__)";
- }
- else
- {
- _out << nl << "handleExceptionWrapper__(delBase__, ex__)";
- }
- _out.dec();
- _out << nl << "Catch ex__ As Ice.LocalException";
- _out.inc();
- _out << nl << "cnt__ = handleException__(delBase__, ex__, cnt__)";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "End While";
- if(ret)
- {
- _out << nl << "Return Nothing"; // Satisfy the VB2005 compiler.
- }
-
- _out.dec();
- _out << nl << "End " << vbOp;
+ _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements " << name << "Prx." << opName;
+ _out.inc();
+ _out << nl;
+ if(ret)
+ {
+ _out << "Return ";
+ }
+ _out << opName << spar << args << "Nothing" << "False" << epar;
+ _out.dec();
+ _out << nl << "End " << vbOp;
+
+
+ _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params
+ << "ByVal context__ As Ice.Context" << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements " << name << "Prx." << opName;
+ _out.inc();
+ _out << nl;
+ if(ret)
+ {
+ _out << "Return ";
+ }
+ _out << opName << spar << args << "context__" << "True" << epar;
+ _out.dec();
+ _out << nl << "End " << vbOp;
+
+ _out << sp << nl << "Private " << vbOp << ' ' << opName << spar << params
+ << "ByVal context__ As Ice.Context" << "explicitContext__ As Boolean" << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out.inc();
+ _out << nl << "If explicitContext__ And context__ Is Nothing Then";
+ _out.inc();
+ _out << nl << "context__ = emptyContext_";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "Dim cnt__ As Integer = 0";
+ _out << nl << "While True";
+ _out.inc();
+ _out << nl << "Dim delBase__ As Ice.ObjectDel_ = Nothing";
+ _out << nl << "Try";
+ _out.inc();
+ if(op->returnsData())
+ {
+ _out << nl << "checkTwowayOnly__(\"" << op->name() << "\")";
+ }
+ _out << nl << "delBase__ = getDelegate__()";
+ _out << nl << "Dim del__ As _" << name << "Del = CType(delBase__, _" << name << "Del)";
+ _out << nl;
+ if(ret)
+ {
+ _out << "Return ";
+ }
+ _out << "del__." << opName << spar << args << "context__" << epar;
+ if(!ret)
+ {
+ _out << nl << "Return";
+ }
+ _out.dec();
+ _out << nl << "Catch ex__ As IceInternal.LocalExceptionWrapper";
+ _out.inc();
+ if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating)
+ {
+ _out << nl << "cnt__ = handleExceptionWrapperRelaxed__(delBase__, ex__, cnt__)";
+ }
+ else
+ {
+ _out << nl << "handleExceptionWrapper__(delBase__, ex__)";
+ }
+ _out.dec();
+ _out << nl << "Catch ex__ As Ice.LocalException";
+ _out.inc();
+ _out << nl << "cnt__ = handleException__(delBase__, ex__, cnt__)";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "End While";
+ if(ret)
+ {
+ _out << nl << "Return Nothing"; // Satisfy the VB2005 compiler.
+ }
+
+ _out.dec();
+ _out << nl << "End " << vbOp;
}
if(!ops.empty())
{
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // Synchronous operations
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // Synchronous operations
+ _out.restoreIndent();
}
bool hasAsyncOps = false;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
-
- ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
- if(containingClass->hasMetaData("ami") || op->hasMetaData("ami"))
- {
- if(!hasAsyncOps)
- {
- _out.zeroIndent();
- _out << sp << nl << "#Region \"Asynchronous operations\"";
- _out.restoreIndent();
- hasAsyncOps = true;
- }
- vector<string> paramsAMI = getParamsAsync(op, false);
- vector<string> argsAMI = getArgsAsync(op);
-
- string opName = op->name();
-
- //
- // Write two versions of the operation - with and without a
- // context parameter
- //
- _out << sp << nl << "Public Sub " << opName << "_async" << spar << paramsAMI << epar
- << " Implements " << name << "Prx." << opName << "_async"; // TODO: should be containing class?
- _out.inc();
- _out << nl << opName << "_async" << spar << argsAMI << "Nothing" << epar;
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Sub " << opName << "_async" << spar << paramsAMI
- << "ByVal ctx__ As Ice.Context" << epar
- << " Implements " << name << "Prx." << opName << "_async"; // TODO: should be containing class?
- _out.inc();
- _out << nl << "If ctx__ Is Nothing Then";
- _out.inc();
- _out << nl << "ctx__ = emptyContext_";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "cb__.invoke__" << spar << "Me" << argsAMI << "ctx__" << epar;
- _out.dec();
- _out << nl << "End Sub";
- }
+ OperationPtr op = *r;
+
+ ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
+ if(containingClass->hasMetaData("ami") || op->hasMetaData("ami"))
+ {
+ if(!hasAsyncOps)
+ {
+ _out.zeroIndent();
+ _out << sp << nl << "#Region \"Asynchronous operations\"";
+ _out.restoreIndent();
+ hasAsyncOps = true;
+ }
+ vector<string> paramsAMI = getParamsAsync(op, false);
+ vector<string> argsAMI = getArgsAsync(op);
+
+ string opName = op->name();
+
+ //
+ // Write two versions of the operation - with and without a
+ // context parameter
+ //
+ _out << sp << nl << "Public Sub " << opName << "_async" << spar << paramsAMI << epar
+ << " Implements " << name << "Prx." << opName << "_async"; // TODO: should be containing class?
+ _out.inc();
+ _out << nl << opName << "_async" << spar << argsAMI << "Nothing" << epar;
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Sub " << opName << "_async" << spar << paramsAMI
+ << "ByVal ctx__ As Ice.Context" << epar
+ << " Implements " << name << "Prx." << opName << "_async"; // TODO: should be containing class?
+ _out.inc();
+ _out << nl << "If ctx__ Is Nothing Then";
+ _out.inc();
+ _out << nl << "ctx__ = emptyContext_";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "cb__.invoke__" << spar << "Me" << argsAMI << "ctx__" << epar;
+ _out.dec();
+ _out << nl << "End Sub";
+ }
}
if(hasAsyncOps)
{
- _out.zeroIndent();
- _out << sp << nl << "#End Region"; // Asynchronous operations
- _out.restoreIndent();
+ _out.zeroIndent();
+ _out << sp << nl << "#End Region"; // Asynchronous operations
+ _out.restoreIndent();
}
_out.zeroIndent();
@@ -4080,25 +4080,25 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(_stream)
{
- _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << "Prx)";
- _out.inc();
- _out << nl << "outS__.writeProxy(v__)";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name << "Prx";
- _out.inc();
- _out << nl << "Dim proxy As Ice.ObjectPrx = inS__.readProxy()";
- _out << nl << "If Not proxy Is Nothing";
- _out.inc();
- _out << nl << "Dim result As " << name << "PrxHelper = New " << name << "PrxHelper";
- _out << nl << "result.copyFrom__(proxy)";
- _out << nl << "Return result";
- _out.dec();
- _out << nl << "End If";
- _out << nl << "Return Nothing";
- _out.dec();
- _out << nl << "End Function";
+ _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << "Prx)";
+ _out.inc();
+ _out << nl << "outS__.writeProxy(v__)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name << "Prx";
+ _out.inc();
+ _out << nl << "Dim proxy As Ice.ObjectPrx = inS__.readProxy()";
+ _out << nl << "If Not proxy Is Nothing";
+ _out.inc();
+ _out << nl << "Dim result As " << name << "PrxHelper = New " << name << "PrxHelper";
+ _out << nl << "result.copyFrom__(proxy)";
+ _out << nl << "Return result";
+ _out.dec();
+ _out << nl << "End If";
+ _out << nl << "Return Nothing";
+ _out.dec();
+ _out << nl << "End Function";
}
_out.zeroIndent();
@@ -4148,19 +4148,19 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
if(_stream)
{
- _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << typeS << ')';
- _out.inc();
- writeSequenceMarshalUnmarshalCode(_out, p, "v__", true, true);
- _out.dec();
- _out << nl << "End Sub";
+ _out << sp << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << typeS << ')';
+ _out.inc();
+ writeSequenceMarshalUnmarshalCode(_out, p, "v__", true, true);
+ _out.dec();
+ _out << nl << "End Sub";
- _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << typeS;
- _out.inc();
- _out << nl << "Dim v__ As " << typeS << " = Nothing";
- writeSequenceMarshalUnmarshalCode(_out, p, "v__", false, true);
- _out << nl << "Return v__";
- _out.dec();
- _out << nl << "End Function";
+ _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << typeS;
+ _out.inc();
+ _out << nl << "Dim v__ As " << typeS << " = Nothing";
+ writeSequenceMarshalUnmarshalCode(_out, p, "v__", false, true);
+ _out << nl << "Return v__";
+ _out.dec();
+ _out << nl << "End Function";
}
_out.dec();
@@ -4215,38 +4215,38 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
bool hasClassValue = (builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(value);
if(hasClassValue)
{
- _out << sp << nl << "Public NotInheritable Class Patcher__";
- _out.inc();
- _out << nl << "Inherits IceInternal.Patcher";
- _out << sp << nl << "Friend Sub New(ByVal m As " << name << ", ByVal key As " << keyS << ')';
- _out.inc();
- _out << nl << "_m = m";
- _out << nl << "_key = key";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
- _out.inc();
- _out << nl << "type_ = GetType(" << typeToString(p->valueType()) << ')';
- _out << nl << "Try";
- _out.inc();
- _out << nl << "_m(_key) = CType(v, " << valueS << ')';
- _out.dec();
- _out << nl << "Catch _ex As System.InvalidCastException";
- _out.inc();
- _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
- _out << nl << "_e.type = v.ice_id()";
- _out << nl << "_e.expectedType = \"" << value->typeId() << "\"";
- _out << nl << "Throw _e";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Private _m As " << name;
- _out << nl << "Private _key As " << keyS;
- _out.dec();
- _out << sp << nl << "End Class";
+ _out << sp << nl << "Public NotInheritable Class Patcher__";
+ _out.inc();
+ _out << nl << "Inherits IceInternal.Patcher";
+ _out << sp << nl << "Friend Sub New(ByVal m As " << name << ", ByVal key As " << keyS << ')';
+ _out.inc();
+ _out << nl << "_m = m";
+ _out << nl << "_key = key";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Overrides Sub patch(ByVal v As Ice.Object)";
+ _out.inc();
+ _out << nl << "type_ = GetType(" << typeToString(p->valueType()) << ')';
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "_m(_key) = CType(v, " << valueS << ')';
+ _out.dec();
+ _out << nl << "Catch _ex As System.InvalidCastException";
+ _out.inc();
+ _out << nl << "Dim _e As Ice.UnexpectedObjectException = New Ice.UnexpectedObjectException";
+ _out << nl << "_e.type = v.ice_id()";
+ _out << nl << "_e.expectedType = \"" << value->typeId() << "\"";
+ _out << nl << "Throw _e";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Private _m As " << name;
+ _out << nl << "Private _key As " << keyS;
+ _out.dec();
+ _out << sp << nl << "End Class";
}
_out << sp << nl << "Public Shared Function " << " read(ByVal is__ As IceInternal.BasicStream) As " << name;
@@ -4261,12 +4261,12 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
if(!hasClassValue)
{
- _out << nl << "Dim v__ As " << valueS;
+ _out << nl << "Dim v__ As " << valueS;
}
writeMarshalUnmarshalCode(_out, value, "v__", false, false, false, "r__, k__");
if(!hasClassValue)
{
- _out << nl << "r__(k__) = v__";
+ _out << nl << "r__(k__) = v__";
}
_out.dec();
_out << nl << "Next";
@@ -4277,48 +4277,48 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
if(_stream)
{
- _out << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')';
- _out.inc();
- _out << nl << "If v__ Is Nothing Then";
- _out.inc();
- _out << nl << "outS__.writeSize(0)";
- _out.dec();
- _out << nl << "Else";
- _out.inc();
- _out << nl << "outS__.writeSize(v__.Count)";
- _out << nl << "For Each e__ As _System.Collections.DictionaryEntry In v__";
- _out.inc();
- writeMarshalUnmarshalCode(_out, key, keyArg, true, true, false);
- writeMarshalUnmarshalCode(_out, value, valueArg, true, true, false);
- _out.dec();
- _out << nl << "Next";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name;
- _out.inc();
- _out << nl << "Dim sz__ As Integer = inS__.readSize()";
- _out << nl << "Dim r__ As " << name << " = New " << name;
- _out << nl << "For i__ As Integer = 0 To sz__ - 1";
- _out.inc();
- _out << nl << "Dim k__ As " << keyS;
- writeMarshalUnmarshalCode(_out, key, "k__", false, true, false);
- if(!hasClassValue)
- {
- _out << nl << "Dim v__ As " << valueS;
- }
- writeMarshalUnmarshalCode(_out, value, "v__", false, true, false, "r__, k__");
- if(!hasClassValue)
- {
- _out << nl << "r__(k__) = v__";
- }
- _out.dec();
- _out << nl << "Next";
- _out << nl << "Return r__";
- _out.dec();
- _out << nl << "End Function";
+ _out << nl << "Public Shared Sub write(ByVal outS__ As Ice.OutputStream, ByVal v__ As " << name << ')';
+ _out.inc();
+ _out << nl << "If v__ Is Nothing Then";
+ _out.inc();
+ _out << nl << "outS__.writeSize(0)";
+ _out.dec();
+ _out << nl << "Else";
+ _out.inc();
+ _out << nl << "outS__.writeSize(v__.Count)";
+ _out << nl << "For Each e__ As _System.Collections.DictionaryEntry In v__";
+ _out.inc();
+ writeMarshalUnmarshalCode(_out, key, keyArg, true, true, false);
+ writeMarshalUnmarshalCode(_out, value, valueArg, true, true, false);
+ _out.dec();
+ _out << nl << "Next";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Shared Function read(ByVal inS__ As Ice.InputStream) As " << name;
+ _out.inc();
+ _out << nl << "Dim sz__ As Integer = inS__.readSize()";
+ _out << nl << "Dim r__ As " << name << " = New " << name;
+ _out << nl << "For i__ As Integer = 0 To sz__ - 1";
+ _out.inc();
+ _out << nl << "Dim k__ As " << keyS;
+ writeMarshalUnmarshalCode(_out, key, "k__", false, true, false);
+ if(!hasClassValue)
+ {
+ _out << nl << "Dim v__ As " << valueS;
+ }
+ writeMarshalUnmarshalCode(_out, value, "v__", false, true, false, "r__, k__");
+ if(!hasClassValue)
+ {
+ _out << nl << "r__(k__) = v__";
+ }
+ _out.dec();
+ _out << nl << "Next";
+ _out << nl << "Return r__";
+ _out.dec();
+ _out << nl << "End Function";
}
_out.dec();
@@ -4355,7 +4355,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(p->isLocal())
{
- return false;
+ return false;
}
string name = p->name();
@@ -4366,24 +4366,24 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "Inherits ";
if(bases.empty())
{
- _out << "Ice.ObjectDel_";
+ _out << "Ice.ObjectDel_";
}
else
{
- ClassList::const_iterator q = bases.begin();
- while(q != bases.end())
- {
- string s = (*q)->scoped();
- string::size_type pos = s.rfind("::");
- assert(pos != string::npos);
- s = s.insert(pos + 2, "_");
- s += "Del";
- _out << fixId(s);
- if(++q != bases.end())
- {
- _out << ", ";
- }
- }
+ ClassList::const_iterator q = bases.begin();
+ while(q != bases.end())
+ {
+ string s = (*q)->scoped();
+ string::size_type pos = s.rfind("::");
+ assert(pos != string::npos);
+ s = s.insert(pos + 2, "_");
+ s += "Del";
+ _out << fixId(s);
+ if(++q != bases.end())
+ {
+ _out << ", ";
+ }
+ }
}
OperationList ops = p->operations();
@@ -4391,18 +4391,18 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
- string opName = fixId(op->name(), DotNet::ICloneable, true);
- TypePtr ret = op->returnType();
- string retS = typeToString(ret);
- vector<string> params = getParams(op);
- string vbOp = ret ? "Function" : "Sub";
+ OperationPtr op = *r;
+ string opName = fixId(op->name(), DotNet::ICloneable, true);
+ TypePtr ret = op->returnType();
+ string retS = typeToString(ret);
+ vector<string> params = getParams(op);
+ string vbOp = ret ? "Function" : "Sub";
- _out << sp << nl << vbOp << ' ' << opName << spar << params << "ByVal context__ As Ice.Context" << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
+ _out << sp << nl << vbOp << ' ' << opName << spar << params << "ByVal context__ As Ice.Context" << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
}
return true;
@@ -4461,168 +4461,168 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- OperationPtr op = *r;
- string opName = fixId(op->name(), DotNet::ICloneable, true);
- TypePtr ret = op->returnType();
- string retS = typeToString(ret);
-
- TypeStringList inParams;
- TypeStringList outParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- else
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- TypeStringList::const_iterator q;
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ OperationPtr op = *r;
+ string opName = fixId(op->name(), DotNet::ICloneable, true);
+ TypePtr ret = op->returnType();
+ string retS = typeToString(ret);
+
+ TypeStringList inParams;
+ TypeStringList outParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ else
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ TypeStringList::const_iterator q;
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- vector<string> params = getParams(op);
-
- string vbOp = ret ? "Function" : "Sub";
-
- _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params
- << "ByVal context__ As Ice.Context" << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out << " Implements _" << name << "Del." << opName; // TODO: should be containing class?
- _out.inc();
-
- _out << nl << "Dim og__ As IceInternal.Outgoing = getOutgoing(\""
- << op->name() << "\", " << sliceModeToIceMode(op->sendMode()) << ", context__)";
- _out << nl << "Try";
- _out.inc();
- if(!inParams.empty())
- {
- _out << nl << "Try";
- _out.inc();
- _out << nl << "Dim os__ As IceInternal.BasicStream = og__.ostr()";
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
- }
- if(op->sendsClasses())
- {
- _out << nl << "os__.writePendingObjects()";
- }
- _out.dec();
- _out << nl << "Catch ex__ As Ice.LocalException";
- _out.inc();
- _out << nl << "og__.abort(ex__)";
- _out.dec();
- _out << nl << "End Try";
- }
- _out << nl << "Dim ok__ As Boolean = og__.invoke()";
- _out << nl << "Try";
- _out.inc();
- _out << nl << "Dim is__ As IceInternal.BasicStream = og__.istr()";
- _out << nl << "If Not ok__ Then";
- _out.inc();
- //
- // The try/catch block is necessary because throwException()
- // can raise UserException.
- //
- _out << nl << "Try";
- _out.inc();
- _out << nl << "is__.throwException()";
- _out.dec();
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
- {
- _out << nl << "Catch ex__ As " << fixId((*t)->scoped());
- _out.inc();
- _out << nl << "Throw";
- _out.dec();
- }
- _out << nl << "Catch ex__ As Ice.UserException";
- _out.inc();
- _out << nl << "Throw New Ice.UnknownUserException(ex__)";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "End If";
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true, "");
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- ContainedPtr contained = ContainedPtr::dynamicCast(ret);
- _out << nl << "Dim ret__ As " << retS << " = Nothing";
- _out << nl << "Dim ret___PP As IceInternal.ParamPatcher = New IceInternal.ParamPatcher(GetType("
- << retS << "), \"" << (contained ? contained->scoped() : string("::Ice::Object")) << "\")";
- _out << nl << "is__.readObject(ret___PP)";
- }
- else
- {
- _out << nl << "Dim ret__ As " << retS << " = Nothing";
- writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, "");
- }
- }
- if(op->returnsClasses())
- {
- _out << nl << "is__.readPendingObjects()";
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string param = fixId(q->second);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
- {
- string type = typeToString(q->first);
- _out << nl << param << " = CType(" << param << "_PP.value, " << type << ')';
- }
- }
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- _out << nl << "ret__ = CType(ret___PP.value, " << retS << ')';
- }
- _out << nl << "Return ret__";
- }
- _out.dec();
- _out << nl << "Catch ex__ As Ice.LocalException";
- _out.inc();
- _out << nl << "throw New IceInternal.LocalExceptionWrapper(ex__, false)";
- _out.dec();
- _out << nl << "End Try";
+ vector<string> params = getParams(op);
+
+ string vbOp = ret ? "Function" : "Sub";
+
+ _out << sp << nl << "Public " << vbOp << ' ' << opName << spar << params
+ << "ByVal context__ As Ice.Context" << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements _" << name << "Del." << opName; // TODO: should be containing class?
+ _out.inc();
+
+ _out << nl << "Dim og__ As IceInternal.Outgoing = getOutgoing(\""
+ << op->name() << "\", " << sliceModeToIceMode(op->sendMode()) << ", context__)";
+ _out << nl << "Try";
+ _out.inc();
+ if(!inParams.empty())
+ {
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "Dim os__ As IceInternal.BasicStream = og__.ostr()";
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
+ }
+ if(op->sendsClasses())
+ {
+ _out << nl << "os__.writePendingObjects()";
+ }
+ _out.dec();
+ _out << nl << "Catch ex__ As Ice.LocalException";
+ _out.inc();
+ _out << nl << "og__.abort(ex__)";
+ _out.dec();
+ _out << nl << "End Try";
+ }
+ _out << nl << "Dim ok__ As Boolean = og__.invoke()";
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "Dim is__ As IceInternal.BasicStream = og__.istr()";
+ _out << nl << "If Not ok__ Then";
+ _out.inc();
+ //
+ // The try/catch block is necessary because throwException()
+ // can raise UserException.
+ //
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "is__.throwException()";
+ _out.dec();
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ _out << nl << "Catch ex__ As " << fixId((*t)->scoped());
+ _out.inc();
+ _out << nl << "Throw";
+ _out.dec();
+ }
+ _out << nl << "Catch ex__ As Ice.UserException";
+ _out.inc();
+ _out << nl << "Throw New Ice.UnknownUserException(ex__)";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "End If";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true, "");
+ }
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ ContainedPtr contained = ContainedPtr::dynamicCast(ret);
+ _out << nl << "Dim ret__ As " << retS << " = Nothing";
+ _out << nl << "Dim ret___PP As IceInternal.ParamPatcher = New IceInternal.ParamPatcher(GetType("
+ << retS << "), \"" << (contained ? contained->scoped() : string("::Ice::Object")) << "\")";
+ _out << nl << "is__.readObject(ret___PP)";
+ }
+ else
+ {
+ _out << nl << "Dim ret__ As " << retS << " = Nothing";
+ writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, "");
+ }
+ }
+ if(op->returnsClasses())
+ {
+ _out << nl << "is__.readPendingObjects()";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
+ {
+ string type = typeToString(q->first);
+ _out << nl << param << " = CType(" << param << "_PP.value, " << type << ')';
+ }
+ }
+ }
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ _out << nl << "ret__ = CType(ret___PP.value, " << retS << ')';
+ }
+ _out << nl << "Return ret__";
+ }
+ _out.dec();
+ _out << nl << "Catch ex__ As Ice.LocalException";
+ _out.inc();
+ _out << nl << "throw New IceInternal.LocalExceptionWrapper(ex__, false)";
+ _out.dec();
+ _out << nl << "End Try";
_out.dec();
_out << nl << "Finally";
_out.inc();
_out << nl << "reclaimOutgoing(og__)";
_out.dec();
- _out << nl << "End Try";
+ _out << nl << "End Try";
_out.dec();
- _out << nl << "End " << vbOp;
+ _out << nl << "End " << vbOp;
}
return true;
@@ -4685,78 +4685,78 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
string opName = fixId(op->name(), DotNet::ICloneable, true);
TypePtr ret = op->returnType();
string retS = typeToString(ret);
- string vbOp = ret ? "Function" : "Sub";
- ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
+ string vbOp = ret ? "Function" : "Sub";
+ ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container());
vector<string> params = getParams(op);
vector<string> args = getArgs(op);
- _out << sp;
+ _out << sp;
_out << nl << "Public " << vbOp << ' ' << opName << spar << params << "ByVal context__ As Ice.Context" << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- _out << " Implements _" << name << "Del." << opName; // TODO: should be containing class?
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ _out << " Implements _" << name << "Del." << opName; // TODO: should be containing class?
_out.inc();
- if(containingClass->hasMetaData("amd") || op->hasMetaData("amd"))
- {
- _out << nl << "Throw New Ice.CollocationOptimizationException()";
- }
- else
- {
- _out << nl << "Dim current__ As Ice.Current = New Ice.Current";
- _out << nl << "initCurrent__(current__, \"" << op->name() << "\", "
- << sliceModeToIceMode(op->sendMode())
- << ", context__)";
- _out << nl << "While True";
- _out.inc();
- _out << nl << "Dim direct__ As IceInternal.Direct = New IceInternal.Direct(current__)";
- _out << nl << "Dim servant__ As Object = direct__.servant()";
- _out << nl << "If TypeOf servant__ Is " << fixId(name) << " Then";
- _out.inc();
- _out << nl << "Try";
- _out.inc();
- _out << nl;
- if(ret)
- {
- _out << "Return ";
- }
- _out << "CType(servant__, " << fixId(containingClass->scoped() + "Operations_")
- << ")." << opName << spar << args << "current__" << epar;
- if(!ret)
- {
- _out << nl << "Return";
- }
- _out.dec();
- _out << nl << "Catch ex__ As Ice.LocalException";
- _out.inc();
- _out << nl << "Throw New IceInternal.LocalExceptionWrapper(ex__, false)";
- _out.dec();
- _out << nl << "Finally";
- _out.inc();
- _out << nl << "direct__.destroy()";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "Else";
- _out.inc();
- _out << nl << "direct__.destroy()";
- _out << nl << "Dim opEx__ As Ice.OperationNotExistException = new Ice.OperationNotExistException()";
- _out << nl << "opEx__.id = current__.id";
- _out << nl << "opEx__.facet = current__.facet";
- _out << nl << "opEx__.operation = current__.operation";
- _out << nl << "Throw opEx__";
- _out.dec();
- _out << nl << "End If";
- _out.dec();
- _out << nl << "End While";
- if(ret)
- {
- _out << nl << "Return Nothing"; // Satisfy the VB2005 compiler.
- }
- }
- _out.dec();
+ if(containingClass->hasMetaData("amd") || op->hasMetaData("amd"))
+ {
+ _out << nl << "Throw New Ice.CollocationOptimizationException()";
+ }
+ else
+ {
+ _out << nl << "Dim current__ As Ice.Current = New Ice.Current";
+ _out << nl << "initCurrent__(current__, \"" << op->name() << "\", "
+ << sliceModeToIceMode(op->sendMode())
+ << ", context__)";
+ _out << nl << "While True";
+ _out.inc();
+ _out << nl << "Dim direct__ As IceInternal.Direct = New IceInternal.Direct(current__)";
+ _out << nl << "Dim servant__ As Object = direct__.servant()";
+ _out << nl << "If TypeOf servant__ Is " << fixId(name) << " Then";
+ _out.inc();
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl;
+ if(ret)
+ {
+ _out << "Return ";
+ }
+ _out << "CType(servant__, " << fixId(containingClass->scoped() + "Operations_")
+ << ")." << opName << spar << args << "current__" << epar;
+ if(!ret)
+ {
+ _out << nl << "Return";
+ }
+ _out.dec();
+ _out << nl << "Catch ex__ As Ice.LocalException";
+ _out.inc();
+ _out << nl << "Throw New IceInternal.LocalExceptionWrapper(ex__, false)";
+ _out.dec();
+ _out << nl << "Finally";
+ _out.inc();
+ _out << nl << "direct__.destroy()";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "Else";
+ _out.inc();
+ _out << nl << "direct__.destroy()";
+ _out << nl << "Dim opEx__ As Ice.OperationNotExistException = new Ice.OperationNotExistException()";
+ _out << nl << "opEx__.id = current__.id";
+ _out << nl << "opEx__.facet = current__.facet";
+ _out << nl << "opEx__.operation = current__.operation";
+ _out << nl << "Throw opEx__";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "End While";
+ if(ret)
+ {
+ _out << nl << "Return Nothing"; // Satisfy the VB2005 compiler.
+ }
+ }
+ _out.dec();
_out << nl << "End " << vbOp;
}
@@ -4811,70 +4811,70 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->operations();
if(!ops.empty())
{
- _out.zeroIndent();
+ _out.zeroIndent();
_out << sp << nl << "#Region \"Slice operations\"";
- _out.restoreIndent();
+ _out.restoreIndent();
}
for(OperationList::const_iterator op = ops.begin(); op != ops.end(); ++op)
{
- bool amd = p->hasMetaData("amd") || (*op)->hasMetaData("amd");
-
- string name = (*op)->name();
- vector<string> params;
- vector<string> args;
- TypePtr ret;
-
- if(amd)
- {
- name = name + "_async";
- params = getParamsAsync(*op, true);
- args = getArgsAsync(*op);
- }
- else
- {
- name = fixId(name, DotNet::ICloneable, true);
- params = getParams(*op);
- ret = (*op)->returnType();
- args = getArgs(*op);
- }
-
- string vbOp = ret ? "Function" : "Sub";
-
- _out << sp << nl << "Public " << vbOp << ' ' << name << spar << params << epar;
- if(ret)
- {
- _out << " As " << typeToString(ret);
- }
- _out << " Implements " << p->name() << "OperationsNC_" << '.' << name; // TODO: should be containing class?
- _out.inc();
- _out << nl;
- if(ret)
- {
- _out << "Return ";
- }
- _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar;
- _out.dec();
- _out << nl << "End " << vbOp;
-
- _out << sp << nl << "Public MustOverride " << vbOp << ' ' << name << spar << params;
- if(!p->isLocal())
- {
- _out << "ByVal current__ As Ice.Current";
- }
- _out << epar;
- if(ret)
- {
- _out << " As " << typeToString(ret);
- }
- _out << " Implements " << p->name() << "Operations_" << '.' << name; // TODO: should be containing class?
+ bool amd = p->hasMetaData("amd") || (*op)->hasMetaData("amd");
+
+ string name = (*op)->name();
+ vector<string> params;
+ vector<string> args;
+ TypePtr ret;
+
+ if(amd)
+ {
+ name = name + "_async";
+ params = getParamsAsync(*op, true);
+ args = getArgsAsync(*op);
+ }
+ else
+ {
+ name = fixId(name, DotNet::ICloneable, true);
+ params = getParams(*op);
+ ret = (*op)->returnType();
+ args = getArgs(*op);
+ }
+
+ string vbOp = ret ? "Function" : "Sub";
+
+ _out << sp << nl << "Public " << vbOp << ' ' << name << spar << params << epar;
+ if(ret)
+ {
+ _out << " As " << typeToString(ret);
+ }
+ _out << " Implements " << p->name() << "OperationsNC_" << '.' << name; // TODO: should be containing class?
+ _out.inc();
+ _out << nl;
+ if(ret)
+ {
+ _out << "Return ";
+ }
+ _out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar;
+ _out.dec();
+ _out << nl << "End " << vbOp;
+
+ _out << sp << nl << "Public MustOverride " << vbOp << ' ' << name << spar << params;
+ if(!p->isLocal())
+ {
+ _out << "ByVal current__ As Ice.Current";
+ }
+ _out << epar;
+ if(ret)
+ {
+ _out << " As " << typeToString(ret);
+ }
+ _out << " Implements " << p->name() << "Operations_" << '.' << name; // TODO: should be containing class?
}
if(!ops.empty())
{
- _out.zeroIndent();
+ _out.zeroIndent();
_out << sp << nl << "#End Region"; // Slice operations
- _out.restoreIndent();
+ _out.restoreIndent();
}
writeInheritedOperations(p);
@@ -4931,7 +4931,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
if(cl->isLocal())
{
- return;
+ return;
}
string name = p->name();
@@ -4942,285 +4942,285 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
TypePtr ret = p->returnType();
string retS = typeToString(ret);
- TypeStringList inParams;
+ TypeStringList inParams;
TypeStringList outParams;
- ParamDeclList paramList = p->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- else
- {
- inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
+ ParamDeclList paramList = p->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ else
+ {
+ inParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
ExceptionList throws = p->throws();
throws.sort();
throws.unique();
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
TypeStringList::const_iterator q;
- vector<string> params = getParamsAsyncCB(p);
- vector<string> args = getArgsAsyncCB(p);
-
- vector<string> paramsInvoke = getParamsAsync(p, false);
-
- _out << sp << nl << "Public MustInherit Class AMI_" << cl->name() << '_' << name;
- _out.inc();
- _out << nl << "Inherits IceInternal.OutgoingAsync";
- _out << sp;
- _out << nl << "Public MustOverride Sub ice_response" << spar << params << epar;
-
- _out << sp << nl << "Public Sub invoke__" << spar << "ByVal prx__ As Ice.ObjectPrx"
- << paramsInvoke << "ByVal ctx__ As Ice.Context" << epar;
- _out.inc();
- _out << nl << "Try";
- _out.inc();
- _out << nl << "prepare__(prx__, \"" << p->name() << "\", "
- << sliceModeToIceMode(p->sendMode()) << ", ctx__)";
- if(p->returnsData())
- for(q = inParams.begin(); q != inParams.end(); ++q)
- {
- string typeS = typeToString(q->first);
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
- }
- if(p->sendsClasses())
- {
- _out << nl << "os__.writePendingObjects()";
- }
- _out << nl << "os__.endWriteEncaps()";
- _out.dec();
- _out << nl << "Catch ex__ As Ice.LocalException";
- _out.inc();
- _out << nl << "finished__(ex__)";
- _out << nl << "Return";
- _out.dec();
- _out << nl << "End Try";
- _out << nl << "send__()";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Protected Overrides Sub response__(ok__ As Boolean)";
- _out.inc();
+ vector<string> params = getParamsAsyncCB(p);
+ vector<string> args = getArgsAsyncCB(p);
+
+ vector<string> paramsInvoke = getParamsAsync(p, false);
+
+ _out << sp << nl << "Public MustInherit Class AMI_" << cl->name() << '_' << name;
+ _out.inc();
+ _out << nl << "Inherits IceInternal.OutgoingAsync";
+ _out << sp;
+ _out << nl << "Public MustOverride Sub ice_response" << spar << params << epar;
+
+ _out << sp << nl << "Public Sub invoke__" << spar << "ByVal prx__ As Ice.ObjectPrx"
+ << paramsInvoke << "ByVal ctx__ As Ice.Context" << epar;
+ _out.inc();
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "prepare__(prx__, \"" << p->name() << "\", "
+ << sliceModeToIceMode(p->sendMode()) << ", ctx__)";
+ if(p->returnsData())
+ for(q = inParams.begin(); q != inParams.end(); ++q)
+ {
+ string typeS = typeToString(q->first);
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
+ }
+ if(p->sendsClasses())
+ {
+ _out << nl << "os__.writePendingObjects()";
+ }
+ _out << nl << "os__.endWriteEncaps()";
+ _out.dec();
+ _out << nl << "Catch ex__ As Ice.LocalException";
+ _out.inc();
+ _out << nl << "finished__(ex__)";
+ _out << nl << "Return";
+ _out.dec();
+ _out << nl << "End Try";
+ _out << nl << "send__()";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Protected Overrides Sub response__(ok__ As Boolean)";
+ _out.inc();
for(q = outParams.begin(); q != outParams.end(); ++q)
{
- _out << nl << "Dim " << fixId(q->second) << " As " << typeToString(q->first) << " = Nothing";
+ _out << nl << "Dim " << fixId(q->second) << " As " << typeToString(q->first) << " = Nothing";
}
if(ret)
{
- _out << nl << "Dim ret__ As " << retS << " = Nothing";
+ _out << nl << "Dim ret__ As " << retS << " = Nothing";
+ }
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "If Not ok__ Then";
+ _out.inc();
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "is__.throwException()";
+ _out.dec();
+ for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
+ {
+ _out << nl << "Catch ex__ As " << fixId((*r)->scoped());
+ _out.inc();
+ _out << nl << "Throw";
+ _out.dec();
}
- _out << nl << "Try";
- _out.inc();
- _out << nl << "If Not ok__ Then";
+ _out << nl << "Catch ex__ As Ice.UserException";
_out.inc();
- _out << nl << "Try";
- _out.inc();
- _out << nl << "is__.throwException()";
- _out.dec();
- for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
- {
- _out << nl << "Catch ex__ As " << fixId((*r)->scoped());
- _out.inc();
- _out << nl << "Throw";
- _out.dec();
- }
- _out << nl << "Catch ex__ As Ice.UserException";
- _out.inc();
_out << nl << "Throw New Ice.UnknownUserException(ex__)";
- _out.dec();
- _out << nl << "End Try";
- _out.dec();
- _out << nl << "End If";
+ _out.dec();
+ _out << nl << "End Try";
+ _out.dec();
+ _out << nl << "End If";
for(q = outParams.begin(); q != outParams.end(); ++q)
{
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
}
if(ret)
{
- writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true);
- }
- if(p->returnsClasses())
- {
- _out << nl << "is__.readPendingObjects()";
- }
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string param = fixId(q->second);
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
- {
- string type = typeToString(q->first);
- _out << nl << param << " = CType(" << param << "_PP.value, " << type << ')';
- }
- }
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- string type = typeToString(ret);
- _out << nl << "ret__ = CType(ret___PP.value, " << retS << ')';
- }
- }
- _out.dec();
- _out << nl << "Catch ex__ As Ice.LocalException";
- _out.inc();
- _out << nl << "finished__(ex__)";
- _out << nl << "Return";
- _out.dec();
- if(!throws.empty())
- {
- _out << nl << "Catch ex__ As Ice.UserException";
- _out.inc();
- _out << nl << "ice_exception(ex__)";
- _out << nl << "Return";
- _out.dec();
- }
- _out << nl << "End Try";
- _out << nl << "ice_response" << spar << args << epar;
- _out.dec();
- _out << nl << "End Sub";
- _out.dec();
- _out << sp << nl << "End Class";
+ writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true);
+ }
+ if(p->returnsClasses())
+ {
+ _out << nl << "is__.readPendingObjects()";
+ }
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string param = fixId(q->second);
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->first))
+ {
+ string type = typeToString(q->first);
+ _out << nl << param << " = CType(" << param << "_PP.value, " << type << ')';
+ }
+ }
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ string type = typeToString(ret);
+ _out << nl << "ret__ = CType(ret___PP.value, " << retS << ')';
+ }
+ }
+ _out.dec();
+ _out << nl << "Catch ex__ As Ice.LocalException";
+ _out.inc();
+ _out << nl << "finished__(ex__)";
+ _out << nl << "Return";
+ _out.dec();
+ if(!throws.empty())
+ {
+ _out << nl << "Catch ex__ As Ice.UserException";
+ _out.inc();
+ _out << nl << "ice_exception(ex__)";
+ _out << nl << "Return";
+ _out.dec();
+ }
+ _out << nl << "End Try";
+ _out << nl << "ice_response" << spar << args << epar;
+ _out.dec();
+ _out << nl << "End Sub";
+ _out.dec();
+ _out << sp << nl << "End Class";
}
if(cl->hasMetaData("amd") || p->hasMetaData("amd"))
{
- string classNameAMD = "AMD_" + cl->name();
- string classNameAMDI = "_AMD_" + cl->name();
+ string classNameAMD = "AMD_" + cl->name();
+ string classNameAMDI = "_AMD_" + cl->name();
- vector<string> paramsAMD = getParamsAsyncCB(p);
+ vector<string> paramsAMD = getParamsAsyncCB(p);
- _out << sp << nl << "Public Interface " << classNameAMD << '_' << name;
- _out.inc();
- _out << sp << nl << "Sub ice_response" << spar << paramsAMD << epar;
- _out << sp << nl << "Sub ice_exception(ex As _System.Exception)";
- _out.dec();
- _out << nl << "End Interface";
+ _out << sp << nl << "Public Interface " << classNameAMD << '_' << name;
+ _out.inc();
+ _out << sp << nl << "Sub ice_response" << spar << paramsAMD << epar;
+ _out << sp << nl << "Sub ice_exception(ex As _System.Exception)";
+ _out.dec();
+ _out << nl << "End Interface";
- TypePtr ret = p->returnType();
-
- TypeStringList outParams;
- ParamDeclList paramList = p->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
- }
- }
-
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ TypePtr ret = p->returnType();
+
+ TypeStringList outParams;
+ ParamDeclList paramList = p->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(make_pair((*pli)->type(), (*pli)->name()));
+ }
+ }
+
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
+ throws.sort(Slice::derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- TypeStringList::const_iterator q;
- _out << sp << nl << "Class " << classNameAMDI << '_' << name;
- _out.inc();
- _out << nl << "Inherits IceInternal.IncomingAsync";
- _out << nl << "Implements " << classNameAMD << '_' << name;
-
- _out << sp << nl << "Public Sub New(ByVal inc As IceInternal.Incoming)";
- _out.inc();
- _out << nl << "MyBase.New(inc)";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Sub ice_response" << spar << paramsAMD << epar
- << " Implements " << classNameAMD << '_' << name << ".ice_response"; // TODO: should be containing class?
- _out.inc();
- if(ret || !outParams.empty())
- {
- _out << nl << "Try";
- _out.inc();
- _out << nl << "Dim os__ As IceInternal.BasicStream = Me.os__()";
- for(q = outParams.begin(); q != outParams.end(); ++q)
- {
- string typeS = typeToString(q->first);
- writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
- }
- if(ret)
- {
- string retS = typeToString(ret);
- writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, false);
- }
- if(p->returnsClasses())
- {
- _out << nl << "os__.writePendingObjects()";
- }
- _out.dec();
- _out << nl << "Catch ex__ As Ice.LocalException";
- _out.inc();
- _out << nl << "ice_exception(ex__)";
- _out.dec();
- _out << nl << "End Try";
- }
- _out << nl << "response__(true)";
- _out.dec();
- _out << nl << "End Sub";
-
- _out << sp << nl << "Public Sub ice_exception(ByVal ex As _System.Exception)"
- << " Implements " << classNameAMD << '_' << name << ".ice_exception"; // TODO: should be containing class?
- _out.inc();
- if(throws.empty())
- {
- _out << nl << "exception__(ex)";
- }
- else
- {
- _out << nl << "Try";
- _out.inc();
- _out << nl << "throw ex";
- _out.dec();
- ExceptionList::const_iterator r;
- for(r = throws.begin(); r != throws.end(); ++r)
- {
- string exS = fixId((*r)->scoped());
- _out << nl << "Catch ex__ As " << exS;
- _out.inc();
- _out << nl << "os__().writeUserException(ex__)";
- _out << nl << "response__(false)";
- _out.dec();
- }
- _out << nl << "Catch ex__ As _System.Exception";
- _out.inc();
- _out << nl << "exception__(ex__)";
- _out.dec();
- _out << nl << "End Try";
- }
- _out.dec();
- _out << nl << "End Sub";
-
- _out.dec();
- _out << sp << nl << "End Class";
+ TypeStringList::const_iterator q;
+ _out << sp << nl << "Class " << classNameAMDI << '_' << name;
+ _out.inc();
+ _out << nl << "Inherits IceInternal.IncomingAsync";
+ _out << nl << "Implements " << classNameAMD << '_' << name;
+
+ _out << sp << nl << "Public Sub New(ByVal inc As IceInternal.Incoming)";
+ _out.inc();
+ _out << nl << "MyBase.New(inc)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Sub ice_response" << spar << paramsAMD << epar
+ << " Implements " << classNameAMD << '_' << name << ".ice_response"; // TODO: should be containing class?
+ _out.inc();
+ if(ret || !outParams.empty())
+ {
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "Dim os__ As IceInternal.BasicStream = Me.os__()";
+ for(q = outParams.begin(); q != outParams.end(); ++q)
+ {
+ string typeS = typeToString(q->first);
+ writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), true, false, false);
+ }
+ if(ret)
+ {
+ string retS = typeToString(ret);
+ writeMarshalUnmarshalCode(_out, ret, "ret__", true, false, false);
+ }
+ if(p->returnsClasses())
+ {
+ _out << nl << "os__.writePendingObjects()";
+ }
+ _out.dec();
+ _out << nl << "Catch ex__ As Ice.LocalException";
+ _out.inc();
+ _out << nl << "ice_exception(ex__)";
+ _out.dec();
+ _out << nl << "End Try";
+ }
+ _out << nl << "response__(true)";
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out << sp << nl << "Public Sub ice_exception(ByVal ex As _System.Exception)"
+ << " Implements " << classNameAMD << '_' << name << ".ice_exception"; // TODO: should be containing class?
+ _out.inc();
+ if(throws.empty())
+ {
+ _out << nl << "exception__(ex)";
+ }
+ else
+ {
+ _out << nl << "Try";
+ _out.inc();
+ _out << nl << "throw ex";
+ _out.dec();
+ ExceptionList::const_iterator r;
+ for(r = throws.begin(); r != throws.end(); ++r)
+ {
+ string exS = fixId((*r)->scoped());
+ _out << nl << "Catch ex__ As " << exS;
+ _out.inc();
+ _out << nl << "os__().writeUserException(ex__)";
+ _out << nl << "response__(false)";
+ _out.dec();
+ }
+ _out << nl << "Catch ex__ As _System.Exception";
+ _out.inc();
+ _out << nl << "exception__(ex__)";
+ _out.dec();
+ _out << nl << "End Try";
+ }
+ _out.dec();
+ _out << nl << "End Sub";
+
+ _out.dec();
+ _out << sp << nl << "End Class";
}
}
@@ -5270,14 +5270,14 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "Inherits ";
if(p->isInterface())
{
- if(p->isLocal())
- {
- _out << fixId(name);
- }
- else
- {
- _out << name << "Disp_";
- }
+ if(p->isLocal())
+ {
+ _out << fixId(name);
+ }
+ else
+ {
+ _out << name << "Disp_";
+ }
}
else
{
@@ -5359,14 +5359,14 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
+ bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
string opName = hasAMD ? (*r)->name() + "_async" : fixId((*r)->name(), DotNet::ICloneable, true);
TypePtr ret = (*r)->returnType();
string retS = typeToString(ret);
vector<string> params;
- vector<string> args;
+ vector<string> args;
if(hasAMD)
{
params = getParamsAsync((*r), true);
@@ -5379,21 +5379,21 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
}
_out << sp << nl << "Public Overloads ";
- if(!p->isInterface() || !p->isLocal())
- {
- _out << "Overrides ";
- }
- string vbOp = (!ret || hasAMD) ? "Sub" : "Function";
- _out << vbOp << ' ' << opName << spar << params;
+ if(!p->isInterface() || !p->isLocal())
+ {
+ _out << "Overrides ";
+ }
+ string vbOp = (!ret || hasAMD) ? "Sub" : "Function";
+ _out << vbOp << ' ' << opName << spar << params;
if(!p->isLocal())
{
_out << "ByVal current__ As Ice.Current";
}
_out << epar;
- if(ret && !hasAMD)
- {
- _out << " As " << retS;
- }
+ if(ret && !hasAMD)
+ {
+ _out << " As " << retS;
+ }
_out.inc();
_out << nl;
if(ret && !hasAMD)
@@ -5407,7 +5407,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
}
_out << epar;
_out.dec();
- _out << nl << "End " << vbOp;
+ _out << nl << "End " << vbOp;
}
NameSet opNames;
@@ -5436,19 +5436,19 @@ Slice::Gen::TieVisitor::writeInheritedOperationsWithOpNames(const ClassDefPtr& p
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
+ bool hasAMD = p->hasMetaData("amd") || (*r)->hasMetaData("amd");
string opName = hasAMD ? (*r)->name() + "_async" : fixId((*r)->name(), DotNet::ICloneable, true);
- if(opNames.find(opName) != opNames.end())
- {
- continue;
- }
- opNames.insert(opName);
+ if(opNames.find(opName) != opNames.end())
+ {
+ continue;
+ }
+ opNames.insert(opName);
TypePtr ret = (*r)->returnType();
string retS = typeToString(ret);
vector<string> params;
- vector<string> args;
+ vector<string> args;
if(hasAMD)
{
params = getParamsAsync((*r), true);
@@ -5461,21 +5461,21 @@ Slice::Gen::TieVisitor::writeInheritedOperationsWithOpNames(const ClassDefPtr& p
}
_out << sp << nl << "Public Overloads ";
- if(!p->isInterface() || !p->isLocal())
- {
- _out << "Overrides ";
- }
- string vbOp = (ret && !hasAMD) ? "Function" : "Sub";
- _out << vbOp << ' ' << opName << spar << params;
+ if(!p->isInterface() || !p->isLocal())
+ {
+ _out << "Overrides ";
+ }
+ string vbOp = (ret && !hasAMD) ? "Function" : "Sub";
+ _out << vbOp << ' ' << opName << spar << params;
if(!p->isLocal())
{
_out << "ByVal current__ As Ice.Current";
}
_out << epar;
- if(ret && !hasAMD)
- {
- _out << " As " << retS;
- }
+ if(ret && !hasAMD)
+ {
+ _out << " As " << retS;
+ }
_out.inc();
_out << nl;
if(ret && !hasAMD)
@@ -5488,7 +5488,7 @@ Slice::Gen::TieVisitor::writeInheritedOperationsWithOpNames(const ClassDefPtr& p
_out << "current__";
}
_out << epar;
- _out.dec();
+ _out.dec();
_out << nl << "End " << vbOp;
}
@@ -5516,113 +5516,113 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
if(comment)
{
- _out << nl << "' ";
+ _out << nl << "' ";
}
else
{
- _out << sp << nl;
+ _out << sp << nl;
}
if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
{
vector<string> pDecl = getParamsAsync(op, true);
- _out << "Public Overloads ";
- if(!forTie)
- {
- _out << "Overrides ";
- }
- _out << "Sub " << opName << "_async" << spar << pDecl << "ByVal current__ As Ice.Current" << epar;
-
- if(comment)
- {
- return;
- }
- else
- {
- if(forTie)
- {
- _out << " Implements " << cl->name() << "Operations_." << opName << "_async"; // TODO: should be containing class?
- }
- }
-
- _out.inc();
- if(ret)
- {
- _out << nl << "Dim ret__ As " << typeToString(ret) << " = " << writeValue(ret);
- }
- for(i = params.begin(); i != params.end(); ++i)
- {
- if((*i)->isOutParam())
- {
- string name = fixId((*i)->name());
- TypePtr type = (*i)->type();
- _out << nl << "Dim " << name << " As " << typeToString(type) << " = " << writeValue(type);
- }
- }
- _out << nl << "cb__.ice_response" << spar;
- if(ret)
- {
- _out << "ret__";
- }
- for(i = params.begin(); i != params.end(); ++i)
- {
- if((*i)->isOutParam())
- {
- _out << fixId((*i)->name());
- }
- }
- _out << epar;
- _out.dec();
- _out << nl << "End Sub";
+ _out << "Public Overloads ";
+ if(!forTie)
+ {
+ _out << "Overrides ";
+ }
+ _out << "Sub " << opName << "_async" << spar << pDecl << "ByVal current__ As Ice.Current" << epar;
+
+ if(comment)
+ {
+ return;
+ }
+ else
+ {
+ if(forTie)
+ {
+ _out << " Implements " << cl->name() << "Operations_." << opName << "_async"; // TODO: should be containing class?
+ }
+ }
+
+ _out.inc();
+ if(ret)
+ {
+ _out << nl << "Dim ret__ As " << typeToString(ret) << " = " << writeValue(ret);
+ }
+ for(i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->isOutParam())
+ {
+ string name = fixId((*i)->name());
+ TypePtr type = (*i)->type();
+ _out << nl << "Dim " << name << " As " << typeToString(type) << " = " << writeValue(type);
+ }
+ }
+ _out << nl << "cb__.ice_response" << spar;
+ if(ret)
+ {
+ _out << "ret__";
+ }
+ for(i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->isOutParam())
+ {
+ _out << fixId((*i)->name());
+ }
+ }
+ _out << epar;
+ _out.dec();
+ _out << nl << "End Sub";
}
else
{
- vector<string> pDecls = getParams(op);
- string vbOp = ret ? "Function" : "Sub";
-
- _out << "Public Overloads ";
- if(!forTie && !cl->isLocal())
- {
- _out << "Overrides ";
- }
- _out << vbOp << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
- if(!cl->isLocal())
- {
- _out << "ByVal current__ As Ice.Current";
- }
- _out << epar;
- if(ret)
- {
- _out << " As " << retS;
- }
- if(comment)
- {
- return;
- }
- else
- {
- if(forTie)
- {
- _out << " Implements " << cl->name() << "Operations_." << fixId(opName, DotNet::ICloneable, true); // TODO: should be containing class?
- }
- }
- _out.inc();
- for(i = params.begin(); i != params.end(); ++i)
- {
- if((*i)->isOutParam())
- {
- string name = fixId((*i)->name());
- TypePtr type = (*i)->type();
- _out << nl << name << " = " << writeValue(type);
- }
- }
- if(ret)
- {
- _out << nl << "Return " << writeValue(ret);
- }
- _out.dec();
- _out << nl << "End " << vbOp;
+ vector<string> pDecls = getParams(op);
+ string vbOp = ret ? "Function" : "Sub";
+
+ _out << "Public Overloads ";
+ if(!forTie && !cl->isLocal())
+ {
+ _out << "Overrides ";
+ }
+ _out << vbOp << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
+ if(!cl->isLocal())
+ {
+ _out << "ByVal current__ As Ice.Current";
+ }
+ _out << epar;
+ if(ret)
+ {
+ _out << " As " << retS;
+ }
+ if(comment)
+ {
+ return;
+ }
+ else
+ {
+ if(forTie)
+ {
+ _out << " Implements " << cl->name() << "Operations_." << fixId(opName, DotNet::ICloneable, true); // TODO: should be containing class?
+ }
+ }
+ _out.inc();
+ for(i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->isOutParam())
+ {
+ string name = fixId((*i)->name());
+ TypePtr type = (*i)->type();
+ _out << nl << name << " = " << writeValue(type);
+ }
+ }
+ if(ret)
+ {
+ _out << nl << "Return " << writeValue(ret);
+ }
+ _out.dec();
+ _out << nl << "End " << vbOp;
}
}
@@ -5634,43 +5634,43 @@ Slice::Gen::BaseImplVisitor::writeValue(const TypePtr& type)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- switch(builtin->kind())
- {
- case Builtin::KindBool:
- {
- return "false";
- break;
- }
- case Builtin::KindByte:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- {
- return "0";
- break;
- }
- case Builtin::KindFloat:
- {
- return "0.0F";
- break;
- }
- case Builtin::KindDouble:
- {
- return "0.0R";
- break;
- }
- default:
- {
- return "Nothing";
- break;
- }
- }
+ switch(builtin->kind())
+ {
+ case Builtin::KindBool:
+ {
+ return "false";
+ break;
+ }
+ case Builtin::KindByte:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ {
+ return "0";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ return "0.0F";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ return "0.0R";
+ break;
+ }
+ default:
+ {
+ return "Nothing";
+ break;
+ }
+ }
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return fixId(en->scoped()) + "." + fixId((*en->getEnumerators().begin())->name());
+ return fixId(en->scoped()) + "." + fixId((*en->getEnumerators().begin())->name());
}
StructPtr st = StructPtr::dynamicCast(type);
@@ -5723,14 +5723,14 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
if(p->isInterface())
{
if(p->isLocal())
- {
- _out << "Inherits Ice.LocalObjectImpl";
- _out << nl << "Implements fixId(name)";
- }
- else
- {
- _out << "Inherits " << name << "Disp_";
- }
+ {
+ _out << "Inherits Ice.LocalObjectImpl";
+ _out << nl << "Implements fixId(name)";
+ }
+ else
+ {
+ _out << "Inherits " << name << "Disp_";
+ }
}
else
{
@@ -5805,14 +5805,14 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
if(inheritImpl)
{
_out << nl << "Inherits ";
- if(bases.front()->isAbstract())
- {
- _out << bases.front()->name() << 'I';
- }
- else
- {
- _out << fixId(bases.front()->name());
- }
+ if(bases.front()->isAbstract())
+ {
+ _out << bases.front()->name() << 'I';
+ }
+ else
+ {
+ _out << fixId(bases.front()->name());
+ }
}
_out << nl << "Implements " << name << "Operations_";
diff --git a/cpp/src/slice2vb/Gen.h b/cpp/src/slice2vb/Gen.h
index 85ad4d6fcde..0d743201b07 100644
--- a/cpp/src/slice2vb/Gen.h
+++ b/cpp/src/slice2vb/Gen.h
@@ -46,10 +46,10 @@ public:
Gen(const std::string&,
const std::string&,
const std::vector<std::string>&,
- const std::string&,
- bool,
- bool,
- bool);
+ const std::string&,
+ bool,
+ bool,
+ bool);
~Gen();
bool operator!() const; // Returns true if there was a constructor error
@@ -77,12 +77,12 @@ private:
UnitVisitor(::IceUtil::Output&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
private:
bool _stream;
- bool _globalMetaDataDone;
+ bool _globalMetaDataDone;
};
class TypesVisitor : public VbVisitor
@@ -91,24 +91,24 @@ private:
TypesVisitor(::IceUtil::Output&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
private:
- void invokeObjectMethod(const TypePtr&, const std::string&, const std::string&, const std::string&);
+ void invokeObjectMethod(const TypePtr&, const std::string&, const std::string&, const std::string&);
bool _stream;
};
@@ -119,11 +119,11 @@ private:
ProxyVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
};
class OpsVisitor : public VbVisitor
@@ -132,9 +132,9 @@ private:
OpsVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
private:
void writeOperations(const ClassDefPtr&, bool);
@@ -146,12 +146,12 @@ private:
HelperVisitor(::IceUtil::Output&, bool);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
private:
@@ -164,10 +164,10 @@ private:
DelegateVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class DelegateMVisitor : public VbVisitor
@@ -176,10 +176,10 @@ private:
DelegateMVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class DelegateDVisitor : public VbVisitor
@@ -188,10 +188,10 @@ private:
DelegateDVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class DispatcherVisitor : public VbVisitor
@@ -200,9 +200,9 @@ private:
DispatcherVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
};
class AsyncVisitor : public VbVisitor
@@ -211,11 +211,11 @@ private:
AsyncVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
};
class TieVisitor : public VbVisitor
@@ -224,15 +224,15 @@ private:
TieVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
private:
- typedef ::std::set< ::std::string> NameSet;
- void writeInheritedOperationsWithOpNames(const ClassDefPtr&, NameSet&);
+ typedef ::std::set< ::std::string> NameSet;
+ void writeInheritedOperationsWithOpNames(const ClassDefPtr&, NameSet&);
};
class BaseImplVisitor : public VbVisitor
@@ -243,11 +243,11 @@ private:
protected:
- void writeOperation(const OperationPtr&, bool, bool);
+ void writeOperation(const OperationPtr&, bool, bool);
private:
- ::std::string writeValue(const TypePtr&);
+ ::std::string writeValue(const TypePtr&);
};
class ImplVisitor : public BaseImplVisitor
@@ -256,10 +256,10 @@ private:
ImplVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
};
class ImplTieVisitor : public BaseImplVisitor
@@ -268,9 +268,9 @@ private:
ImplTieVisitor(::IceUtil::Output&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
};
};
diff --git a/cpp/src/slice2vb/Main.cpp b/cpp/src/slice2vb/Main.cpp
index 767b93257b2..e16990e3c3a 100644
--- a/cpp/src/slice2vb/Main.cpp
+++ b/cpp/src/slice2vb/Main.cpp
@@ -31,7 +31,7 @@ usage(const char* n)
"--tie Generate TIE classes.\n"
"--impl Generate sample implementations.\n"
"--impl-tie Generate sample TIE implementations.\n"
- "--depend Generate Makefile dependencies.\n"
+ "--depend Generate Makefile dependencies.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--checksum Generate checksums for Slice definitions.\n"
@@ -69,20 +69,20 @@ main(int argc, char* argv[])
catch(const IceUtil::BadOptException& e)
{
cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -90,19 +90,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -145,81 +145,81 @@ main(int argc, char* argv[])
for(i = args.begin(); i != args.end(); ++i)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::VisualBasic);
- }
- else
- {
- Preprocessor icecpp(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- return EXIT_FAILURE;
- }
-
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- return EXIT_FAILURE;
- }
- }
- if(!icecpp.close())
- {
- return EXIT_FAILURE;
- }
- }
- else
- {
- UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive);
- int parseStatus = p->parse(cppHandle, debug);
-
- if(!icecpp.close())
- {
- p->destroy();
- return EXIT_FAILURE;
- }
-
- if(parseStatus == EXIT_FAILURE)
- {
- status = EXIT_FAILURE;
- }
- else
- {
- Gen gen(argv[0], icecpp.getBaseName(), includePaths, output, impl, implTie, stream);
- if(!gen)
- {
- p->destroy();
- return EXIT_FAILURE;
- }
- gen.generate(p);
- if(tie)
- {
- gen.generateTie(p);
- }
- if(impl)
- {
- gen.generateImpl(p);
- }
- if(implTie)
- {
- gen.generateImplTie(p);
- }
- if(checksum)
- {
- gen.generateChecksums(p);
- }
- }
-
- p->destroy();
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::VisualBasic);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], *i, cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ return EXIT_FAILURE;
+ }
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ if(!icecpp.close())
+ {
+ return EXIT_FAILURE;
+ }
+ }
+ else
+ {
+ UnitPtr p = Unit::createUnit(false, false, ice, caseSensitive);
+ int parseStatus = p->parse(cppHandle, debug);
+
+ if(!icecpp.close())
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ Gen gen(argv[0], icecpp.getBaseName(), includePaths, output, impl, implTie, stream);
+ if(!gen)
+ {
+ p->destroy();
+ return EXIT_FAILURE;
+ }
+ gen.generate(p);
+ if(tie)
+ {
+ gen.generateTie(p);
+ }
+ if(impl)
+ {
+ gen.generateImpl(p);
+ }
+ if(implTie)
+ {
+ gen.generateImplTie(p);
+ }
+ if(checksum)
+ {
+ gen.generateChecksums(p);
+ }
+ }
+
+ p->destroy();
+ }
+ }
}
return status;
diff --git a/cpp/test/Freeze/complex/Client.cpp b/cpp/test/Freeze/complex/Client.cpp
index 7012c50f038..fdc3850b8a9 100644
--- a/cpp/test/Freeze/complex/Client.cpp
+++ b/cpp/test/Freeze/complex/Client.cpp
@@ -32,22 +32,22 @@ validate(const Complex::ComplexDict& m)
Parser myParser;
for(p = m.begin(); p != m.end(); ++p)
{
- //
- // Verify the stored record is correct.
- //
+ //
+ // Verify the stored record is correct.
+ //
// COMPILERFIX: VC.NET reports an unhandled
// exception if the test is written this way:
//
- //test(p->first.result == p->second->calc());
+ //test(p->first.result == p->second->calc());
//
Complex::NodePtr n = p->second;
- test(p->first.result == n->calc());
+ test(p->first.result == n->calc());
- //
- // Verify that the expression & result again.
- //
- Complex::NodePtr root = myParser.parse(p->first.expression);
- test(root->calc() == p->first.result);
+ //
+ // Verify that the expression & result again.
+ //
+ Complex::NodePtr root = myParser.parse(p->first.expression);
+ test(root->calc() == p->first.result);
}
cout << "ok" << endl;
@@ -71,12 +71,12 @@ populate(Complex::ComplexDict& m)
Parser myParser;
for(size_t i = 0 ; i < nexpressions; ++i)
{
- Complex::NodePtr root = myParser.parse(expressions[i]);
- assert(root);
- Complex::Key k;
- k.expression = expressions[i];
- k.result = root->calc();
- m.put(pair<const Complex::Key, const Complex::NodePtr>(k, root));
+ Complex::NodePtr root = myParser.parse(expressions[i]);
+ assert(root);
+ Complex::Key k;
+ k.expression = expressions[i];
+ k.result = root->calc();
+ m.put(pair<const Complex::Key, const Complex::NodePtr>(k, root));
}
cout << "ok" << endl;
@@ -87,8 +87,8 @@ static void
usage(const char* name)
{
cerr << "Usage: " << name << " [options] validate|populate\n";
- cerr <<
- "Options:\n"
+ cerr <<
+ "Options:\n"
"--dbdir Location of the database directory.\n";
}
@@ -105,11 +105,11 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator, Complex::C
if(argc > 1 && strcmp(argv[1], "populate") == 0)
{
- return populate(m);
+ return populate(m);
}
if(argc > 1 && strcmp(argv[1], "validate") == 0)
{
- return validate(m);
+ return validate(m);
}
usage(argv[0]);
@@ -126,59 +126,59 @@ main(int argc, char* argv[])
try
{
- //
- // Scan for --dbdir command line argument.
- //
- int i = 1;
- while(i < argc)
- {
- if(strcmp(argv[i], "--dbdir") == 0)
- {
- if(i +1 >= argc)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- envName = argv[i+1];
- envName += "/";
- envName += "db";
-
- //
- // Consume arguments
- //
- while(i < argc - 2)
- {
- argv[i] = argv[i+2];
- ++i;
- }
- argc -= 2;
- }
- else
- {
- ++i;
- }
- }
-
- communicator = Ice::initialize(argc, argv);
- Freeze::ConnectionPtr connection = createConnection(communicator, envName);
- Complex::ComplexDict m(connection, "test");
- status = run(argc, argv, communicator, m);
+ //
+ // Scan for --dbdir command line argument.
+ //
+ int i = 1;
+ while(i < argc)
+ {
+ if(strcmp(argv[i], "--dbdir") == 0)
+ {
+ if(i +1 >= argc)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ envName = argv[i+1];
+ envName += "/";
+ envName += "db";
+
+ //
+ // Consume arguments
+ //
+ while(i < argc - 2)
+ {
+ argv[i] = argv[i+2];
+ ++i;
+ }
+ argc -= 2;
+ }
+ else
+ {
+ ++i;
+ }
+ }
+
+ communicator = Ice::initialize(argc, argv);
+ Freeze::ConnectionPtr connection = createConnection(communicator, envName);
+ Complex::ComplexDict m(connection, "test");
+ status = run(argc, argv, communicator, m);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
try
{
- communicator->destroy();
+ communicator->destroy();
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
return status;
diff --git a/cpp/test/Freeze/complex/NodeI.h b/cpp/test/Freeze/complex/NodeI.h
index 40479c2e2ba..296b3096260 100644
--- a/cpp/test/Freeze/complex/NodeI.h
+++ b/cpp/test/Freeze/complex/NodeI.h
@@ -26,12 +26,12 @@ public:
NumberNodeI(int n)
{
- number = n;
+ number = n;
}
virtual int calc(const Ice::Current&)
{
- return number;
+ return number;
}
};
@@ -45,13 +45,13 @@ public:
AddNodeI(const NodePtr& l, const NodePtr& r)
{
- left = l;
- right = r;
+ left = l;
+ right = r;
}
virtual int calc(const Ice::Current&)
{
- return left->calc() + right->calc();
+ return left->calc() + right->calc();
}
};
@@ -65,13 +65,13 @@ public:
MultiplyNodeI(const NodePtr& l, const NodePtr& r)
{
- left = l;
- right = r;
+ left = l;
+ right = r;
}
virtual int calc(const Ice::Current&)
{
- return left->calc() * right->calc();
+ return left->calc() * right->calc();
}
};
@@ -81,26 +81,26 @@ public:
virtual Ice::ObjectPtr create(const std::string& type)
{
- if(type == "::Complex::MultiplyNode")
- {
- return new MultiplyNodeI();
- }
- if(type == "::Complex::AddNode")
- {
- return new AddNodeI();
- }
- if(type == "::Complex::NumberNode")
- {
- return new NumberNodeI();
- }
- std::cout << "create: " << type << std::endl;
- assert(false);
- return 0;
+ if(type == "::Complex::MultiplyNode")
+ {
+ return new MultiplyNodeI();
+ }
+ if(type == "::Complex::AddNode")
+ {
+ return new AddNodeI();
+ }
+ if(type == "::Complex::NumberNode")
+ {
+ return new NumberNodeI();
+ }
+ std::cout << "create: " << type << std::endl;
+ assert(false);
+ return 0;
}
virtual void destroy()
{
- // Nothing to do
+ // Nothing to do
}
};
diff --git a/cpp/test/Freeze/complex/Parser.cpp b/cpp/test/Freeze/complex/Parser.cpp
index 96616e9daa1..6114668e970 100644
--- a/cpp/test/Freeze/complex/Parser.cpp
+++ b/cpp/test/Freeze/complex/Parser.cpp
@@ -45,7 +45,7 @@ Parser::parse(const string& commands, bool debug)
if(_errors)
{
- return 0;
+ return 0;
}
return _result;
@@ -70,17 +70,17 @@ Parser::getInput(char* buf, int& result, int maxSize)
if(!_buf.empty())
{
#if defined(_MSC_VER) && !defined(_STLP_MSVC)
- // COMPILERBUG: Stupid Visual C++ defines min and max as macros
- result = _MIN(maxSize, static_cast<int>(_buf.length()));
+ // COMPILERBUG: Stupid Visual C++ defines min and max as macros
+ result = _MIN(maxSize, static_cast<int>(_buf.length()));
#else
- result = min(maxSize, static_cast<int>(_buf.length()));
+ result = min(maxSize, static_cast<int>(_buf.length()));
#endif
- strncpy(buf, _buf.c_str(), result);
- _buf.erase(0, result);
+ strncpy(buf, _buf.c_str(), result);
+ _buf.erase(0, result);
}
else
{
- result = 0;
+ result = 0;
}
}
diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp
index 77f705b8a58..09ab3c7d745 100644
--- a/cpp/test/Freeze/dbmap/Client.cpp
+++ b/cpp/test/Freeze/dbmap/Client.cpp
@@ -64,27 +64,27 @@ populateDB(const Freeze::ConnectionPtr& connection, ByteIntMap& m)
for(;;)
{
- try
- {
- TransactionHolder txHolder(connection);
- for(size_t j = 0; j < length; ++j)
- {
- m.put(ByteIntMap::value_type(alphabet[j], static_cast<Int>(j)));
- }
- txHolder.commit();
- break;
- }
- catch(const DeadlockException&)
- {
+ try
+ {
+ TransactionHolder txHolder(connection);
+ for(size_t j = 0; j < length; ++j)
+ {
+ m.put(ByteIntMap::value_type(alphabet[j], static_cast<Int>(j)));
+ }
+ txHolder.commit();
+ break;
+ }
+ catch(const DeadlockException&)
+ {
#ifdef SHOW_EXCEPTIONS
- cerr << "t" << flush;
+ cerr << "t" << flush;
#endif
- length = length / 2;
- //
- // Try again
- //
- }
+ length = length / 2;
+ //
+ // Try again
+ //
+ }
}
}
@@ -93,45 +93,45 @@ class ReadThread : public IceUtil::Thread
public:
ReadThread(const CommunicatorPtr& communicator, const string& envName, const string& dbName) :
- _connection(createConnection(communicator, envName)),
- _map(_connection, dbName)
+ _connection(createConnection(communicator, envName)),
+ _map(_connection, dbName)
{
}
virtual void
run()
{
- for(int i = 0; i < 10; ++i)
- {
- for(;;)
- {
- try
- {
- for(ByteIntMap::iterator p = _map.begin(); p != _map.end(); ++p)
- {
- test(p->first == p->second + 'a');
- IceUtil::ThreadControl::yield();
- }
- break; // for(;;)
- }
- catch(const DeadlockException&)
- {
+ for(int i = 0; i < 10; ++i)
+ {
+ for(;;)
+ {
+ try
+ {
+ for(ByteIntMap::iterator p = _map.begin(); p != _map.end(); ++p)
+ {
+ test(p->first == p->second + 'a');
+ IceUtil::ThreadControl::yield();
+ }
+ break; // for(;;)
+ }
+ catch(const DeadlockException&)
+ {
#ifdef SHOW_EXCEPTIONS
- cerr << "r" << flush;
+ cerr << "r" << flush;
#endif
- //
- // Try again
- //
- }
- catch(const InvalidPositionException&)
- {
+ //
+ // Try again
+ //
+ }
+ catch(const InvalidPositionException&)
+ {
#ifdef SHOW_EXCEPTIONS
- cerr << "i" << flush;
+ cerr << "i" << flush;
#endif
- break;
- }
- }
- }
+ break;
+ }
+ }
+ }
}
private:
@@ -146,51 +146,51 @@ class WriteThread : public IceUtil::Thread
public:
WriteThread(const CommunicatorPtr& communicator, const string& envName, const string& dbName) :
- _connection(createConnection(communicator, envName)),
- _map(_connection, dbName)
+ _connection(createConnection(communicator, envName)),
+ _map(_connection, dbName)
{
}
virtual void
run()
{
- //
- // Delete an recreate each object
- //
- for(int i = 0; i < 4; ++i)
- {
- for(;;)
- {
- try
- {
- TransactionHolder txHolder(_connection);
- for(ByteIntMap::iterator p = _map.begin(); p != _map.end(); ++p)
- {
- p.set(p->second + 1);
- _map.erase(p);
- }
- break; // for(;;)
- txHolder.commit();
- }
- catch(const DeadlockException&)
- {
+ //
+ // Delete an recreate each object
+ //
+ for(int i = 0; i < 4; ++i)
+ {
+ for(;;)
+ {
+ try
+ {
+ TransactionHolder txHolder(_connection);
+ for(ByteIntMap::iterator p = _map.begin(); p != _map.end(); ++p)
+ {
+ p.set(p->second + 1);
+ _map.erase(p);
+ }
+ break; // for(;;)
+ txHolder.commit();
+ }
+ catch(const DeadlockException&)
+ {
#ifdef SHOW_EXCEPTIONS
- cerr << "w" << flush;
+ cerr << "w" << flush;
#endif
- //
- // Try again
- //
- }
- catch(const InvalidPositionException&)
- {
+ //
+ // Try again
+ //
+ }
+ catch(const InvalidPositionException&)
+ {
#ifdef SHOW_EXCEPTIONS
- cerr << "I" << flush;
+ cerr << "I" << flush;
#endif
- break;
- }
- }
- populateDB(_connection, _map);
- }
+ break;
+ }
+ }
+ populateDB(_connection, _map);
+ }
}
private:
@@ -222,18 +222,18 @@ run(const CommunicatorPtr& communicator, const string& envName)
//
for(j = alphabet.begin(); j != alphabet.end(); ++j)
{
- p = m.find(*j);
- test(p != m.end());
- test(p->first == *j && p->second == j - alphabet.begin());
+ p = m.find(*j);
+ test(p != m.end());
+ test(p->first == *j && p->second == j - alphabet.begin());
}
//
// Next try const iterator
//
for(j = alphabet.begin(); j != alphabet.end(); ++j)
{
- cp = m.find(*j);
- test(cp != m.end());
- test(cp->first == *j && cp->second == j - alphabet.begin());
+ cp = m.find(*j);
+ test(cp != m.end());
+ test(cp->first == *j && cp->second == j - alphabet.begin());
}
test(!m.empty());
@@ -262,27 +262,27 @@ run(const CommunicatorPtr& communicator, const string& envName)
bytes.push_back('c');
for(j = bytes.begin(); j != bytes.end(); ++j)
{
- p = m.find(*j);
- test(p != m.end());
- m.erase(p);
-
- //
- // Release locks to avoid self deadlock
- //
- p = m.end();
-
- p = m.find(*j);
- test(p == m.end());
- vector<Byte>::iterator r = find(alphabet.begin(), alphabet.end(), *j);
- test(r != alphabet.end());
- alphabet.erase(r);
+ p = m.find(*j);
+ test(p != m.end());
+ m.erase(p);
+
+ //
+ // Release locks to avoid self deadlock
+ //
+ p = m.end();
+
+ p = m.find(*j);
+ test(p == m.end());
+ vector<Byte>::iterator r = find(alphabet.begin(), alphabet.end(), *j);
+ test(r != alphabet.end());
+ alphabet.erase(r);
}
for(j = alphabet.begin(); j != alphabet.end(); ++j)
{
- cp = m.find(*j);
- test(cp != m.end());
- test(cp->first == *j && cp->second == (j - alphabet.begin()) + offset);
+ cp = m.find(*j);
+ test(cp != m.end());
+ test(cp->first == *j && cp->second == (j - alphabet.begin()) + offset);
}
cout << "ok" << endl;
@@ -486,8 +486,8 @@ run(const CommunicatorPtr& communicator, const string& envName)
map<Byte, const Int>::const_iterator pit;
for(pit = pairs.begin(); pit != pairs.end(); ++pit)
{
- p = m.find(pit->first);
- test(p != m.end());
+ p = m.find(pit->first);
+ test(p != m.end());
}
cout << "ok" << endl;
@@ -498,10 +498,10 @@ run(const CommunicatorPtr& communicator, const string& envName)
size_t length = alphabet.size();
for(size_t k = 0; k < length; ++k)
{
- p = m.findByValue(static_cast<Int>(k));
- test(p != m.end());
- test(p->first == alphabet[k]);
- test(++p == m.end());
+ p = m.findByValue(static_cast<Int>(k));
+ test(p != m.end());
+ test(p->first == alphabet[k]);
+ test(++p == m.end());
}
//
@@ -531,12 +531,12 @@ run(const CommunicatorPtr& communicator, const string& envName)
try
{
- p.set(18);
- test(false);
+ p.set(18);
+ test(false);
}
catch(const DatabaseException&)
{
- // Expected
+ // Expected
}
test(p->first == alphabet[17] || p->first == alphabet[21]);
test(++p == m.end());
@@ -551,177 +551,177 @@ run(const CommunicatorPtr& communicator, const string& envName)
vector<IceUtil::ThreadControl> controls;
for(int i = 0; i < 5; ++i)
{
- IceUtil::ThreadPtr rt = new ReadThread(communicator, envName, dbName);
- controls.push_back(rt->start());
- IceUtil::ThreadPtr wt = new WriteThread(communicator, envName, dbName);
- controls.push_back(wt->start());
+ IceUtil::ThreadPtr rt = new ReadThread(communicator, envName, dbName);
+ controls.push_back(rt->start());
+ IceUtil::ThreadPtr wt = new WriteThread(communicator, envName, dbName);
+ controls.push_back(wt->start());
}
for(vector<IceUtil::ThreadControl>::iterator q = controls.begin(); q != controls.end(); ++q)
{
- q->join();
+ q->join();
}
cout << "ok" << endl;
cout << "testing index creation... " << flush;
{
- IntIdentityMap iim(connection, "intIdentity");
-
- Ice::Identity odd;
- odd.name = "foo";
- odd.category = "odd";
-
- Ice::Identity even;
- even.name = "bar";
- even.category = "even";
-
- TransactionHolder txHolder(connection);
- for(int i = 0; i < 1000; i++)
- {
- if(i % 2 == 0)
- {
- iim.put(IntIdentityMap::value_type(i, even));
- }
- else
- {
- iim.put(IntIdentityMap::value_type(i, odd));
- }
- }
- txHolder.commit();
+ IntIdentityMap iim(connection, "intIdentity");
+
+ Ice::Identity odd;
+ odd.name = "foo";
+ odd.category = "odd";
+
+ Ice::Identity even;
+ even.name = "bar";
+ even.category = "even";
+
+ TransactionHolder txHolder(connection);
+ for(int i = 0; i < 1000; i++)
+ {
+ if(i % 2 == 0)
+ {
+ iim.put(IntIdentityMap::value_type(i, even));
+ }
+ else
+ {
+ iim.put(IntIdentityMap::value_type(i, odd));
+ }
+ }
+ txHolder.commit();
}
{
- IntIdentityMapWithIndex iim(connection, "intIdentity");
- test(iim.categoryCount("even") == 500);
- test(iim.categoryCount("odd") == 500);
-
- {
- int count = 0;
- IntIdentityMapWithIndex::iterator p = iim.findByCategory("even");
- while(p != iim.end())
- {
- test(p->first % 2 == 0);
- ++p;
- ++count;
- }
- test(count == 500);
- }
-
- {
- int count = 0;
- IntIdentityMapWithIndex::iterator p = iim.findByCategory("odd");
- while(p != iim.end())
- {
- test(p->first % 2 == 1);
- ++p;
- ++count;
- }
- test(count == 500);
- }
- iim.clear();
+ IntIdentityMapWithIndex iim(connection, "intIdentity");
+ test(iim.categoryCount("even") == 500);
+ test(iim.categoryCount("odd") == 500);
+
+ {
+ int count = 0;
+ IntIdentityMapWithIndex::iterator p = iim.findByCategory("even");
+ while(p != iim.end())
+ {
+ test(p->first % 2 == 0);
+ ++p;
+ ++count;
+ }
+ test(count == 500);
+ }
+
+ {
+ int count = 0;
+ IntIdentityMapWithIndex::iterator p = iim.findByCategory("odd");
+ while(p != iim.end())
+ {
+ test(p->first % 2 == 1);
+ ++p;
+ ++count;
+ }
+ test(count == 500);
+ }
+ iim.clear();
}
cout << "ok" << endl;
cout << "testing sorting... " << flush;
{
- SortedMap sm(connection, "sortedMap");
-
- TransactionHolder txHolder(connection);
- for(int i = 0; i < 1000; i++)
- {
- int k = rand() % 1000;
-
- Ice::Identity id;
- id.name = "foo";
- id.category = 'a' + static_cast<char>(k % 26);
-
- sm.put(SortedMap::value_type(k, id));
- }
- txHolder.commit();
+ SortedMap sm(connection, "sortedMap");
+
+ TransactionHolder txHolder(connection);
+ for(int i = 0; i < 1000; i++)
+ {
+ int k = rand() % 1000;
+
+ Ice::Identity id;
+ id.name = "foo";
+ id.category = 'a' + static_cast<char>(k % 26);
+
+ sm.put(SortedMap::value_type(k, id));
+ }
+ txHolder.commit();
}
{
- SortedMap sm(connection, "sortedMap");
- {
- for(int i = 0; i < 100; ++i)
- {
- int k = rand() % 1000;
- SortedMap::iterator p = sm.lower_bound(k);
- if(p != sm.end())
- {
- test(p->first >= k);
- SortedMap::iterator q = sm.upper_bound(k);
- if(q == sm.end())
- {
- test(p->first == k);
- }
- else
- {
- test((p->first == k && q->first > k) ||
- (p->first > k && q->first == p->first));
- }
- }
- }
- }
-
- {
- for(int i = 0; i < 100; ++i)
- {
- string category;
- category = static_cast<char>('a' + rand() % 26);
-
- SortedMap::iterator p = sm.findByCategory(category);
- if(p != sm.end())
- {
- SortedMap::iterator q = sm.lowerBoundForCategory(category);
- test(p == q);
- do
- {
- q++;
- } while(q != sm.end() && q->second.category == category);
-
- if(q != sm.end())
- {
- test(q == sm.upperBoundForCategory(category));
- }
- }
- else
- {
- SortedMap::iterator q = sm.lowerBoundForCategory(category);
- if(q != sm.end())
- {
- test(p != q);
- test(q->second.category < category);
- category = q->second.category;
-
- do
- {
- q++;
- } while(q != sm.end() && q->second.category == category);
-
- if(q != sm.end())
- {
- test(q == sm.upperBoundForCategory(category));
- }
- }
- }
- }
- }
-
- {
- string category = "z";
- SortedMap::iterator p = sm.lowerBoundForCategory(category);
-
- while(p != sm.end())
- {
- test(p->second.category <= category);
- category = p->second.category;
- // cerr << category << ":" << p->first << endl;
- ++p;
- }
- }
-
- sm.clear();
+ SortedMap sm(connection, "sortedMap");
+ {
+ for(int i = 0; i < 100; ++i)
+ {
+ int k = rand() % 1000;
+ SortedMap::iterator p = sm.lower_bound(k);
+ if(p != sm.end())
+ {
+ test(p->first >= k);
+ SortedMap::iterator q = sm.upper_bound(k);
+ if(q == sm.end())
+ {
+ test(p->first == k);
+ }
+ else
+ {
+ test((p->first == k && q->first > k) ||
+ (p->first > k && q->first == p->first));
+ }
+ }
+ }
+ }
+
+ {
+ for(int i = 0; i < 100; ++i)
+ {
+ string category;
+ category = static_cast<char>('a' + rand() % 26);
+
+ SortedMap::iterator p = sm.findByCategory(category);
+ if(p != sm.end())
+ {
+ SortedMap::iterator q = sm.lowerBoundForCategory(category);
+ test(p == q);
+ do
+ {
+ q++;
+ } while(q != sm.end() && q->second.category == category);
+
+ if(q != sm.end())
+ {
+ test(q == sm.upperBoundForCategory(category));
+ }
+ }
+ else
+ {
+ SortedMap::iterator q = sm.lowerBoundForCategory(category);
+ if(q != sm.end())
+ {
+ test(p != q);
+ test(q->second.category < category);
+ category = q->second.category;
+
+ do
+ {
+ q++;
+ } while(q != sm.end() && q->second.category == category);
+
+ if(q != sm.end())
+ {
+ test(q == sm.upperBoundForCategory(category));
+ }
+ }
+ }
+ }
+ }
+
+ {
+ string category = "z";
+ SortedMap::iterator p = sm.lowerBoundForCategory(category);
+
+ while(p != sm.end())
+ {
+ test(p->second.category <= category);
+ category = p->second.category;
+ // cerr << category << ":" << p->first << endl;
+ ++p;
+ }
+ }
+
+ sm.clear();
}
cout << "ok" << endl;
@@ -729,29 +729,29 @@ run(const CommunicatorPtr& communicator, const string& envName)
cout << "testing wstring... " << flush;
{
- WstringWstringMap wsm(connection, "wstringMap");
-
- TransactionHolder txHolder(connection);
- wsm.put(WstringWstringMap::value_type(L"AAAAA", L"aaaaa"));
- wsm.put(WstringWstringMap::value_type(L"BBBBB", L"bbbbb"));
- wsm.put(WstringWstringMap::value_type(L"CCCCC", L"ccccc"));
- wsm.put(WstringWstringMap::value_type(L"DDDDD", L"ddddd"));
- wsm.put(WstringWstringMap::value_type(L"EEEEE", L"eeeee"));
- txHolder.commit();
+ WstringWstringMap wsm(connection, "wstringMap");
+
+ TransactionHolder txHolder(connection);
+ wsm.put(WstringWstringMap::value_type(L"AAAAA", L"aaaaa"));
+ wsm.put(WstringWstringMap::value_type(L"BBBBB", L"bbbbb"));
+ wsm.put(WstringWstringMap::value_type(L"CCCCC", L"ccccc"));
+ wsm.put(WstringWstringMap::value_type(L"DDDDD", L"ddddd"));
+ wsm.put(WstringWstringMap::value_type(L"EEEEE", L"eeeee"));
+ txHolder.commit();
}
{
- WstringWstringMap wsm(connection, "wstringMap");
- {
- WstringWstringMap::iterator p = wsm.find(L"BBBBB");
- test(p != wsm.end());
- test(p->second == L"bbbbb");
-
- p = wsm.findByValue(L"ddddd");
- test(p != wsm.end());
- test(p->first == L"DDDDD");
- }
- wsm.clear();
+ WstringWstringMap wsm(connection, "wstringMap");
+ {
+ WstringWstringMap::iterator p = wsm.find(L"BBBBB");
+ test(p != wsm.end());
+ test(p->second == L"bbbbb");
+
+ p = wsm.findByValue(L"ddddd");
+ test(p != wsm.end());
+ test(p->first == L"DDDDD");
+ }
+ wsm.clear();
}
cout << "ok" << endl;
@@ -769,30 +769,30 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- if(argc != 1)
- {
- envName = argv[1];
- envName += "/";
- envName += "db";
- }
+ communicator = Ice::initialize(argc, argv);
+ if(argc != 1)
+ {
+ envName = argv[1];
+ envName += "/";
+ envName += "db";
+ }
- status = run(communicator, envName);
+ status = run(communicator, envName);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
try
{
- communicator->destroy();
+ communicator->destroy();
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
return status;
diff --git a/cpp/test/Freeze/evictor/Client.cpp b/cpp/test/Freeze/evictor/Client.cpp
index 41ee315faf2..cfafd704ef7 100644
--- a/cpp/test/Freeze/evictor/Client.cpp
+++ b/cpp/test/Freeze/evictor/Client.cpp
@@ -29,35 +29,35 @@ class ReadThread : public Thread
public:
ReadThread(vector<Test::ServantPrx>& servants) :
- _servants(servants)
+ _servants(servants)
{
}
virtual void
run()
{
- int loops = 10;
- while(loops-- > 0)
- {
- try
- {
- _servants[0]->getValue();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
- catch(...)
- {
- test(false);
- }
-
- for(int i = 1; i < static_cast<int>(_servants.size()); ++i)
- {
- test(_servants[i]->getValue() == i);
- }
- }
+ int loops = 10;
+ while(loops-- > 0)
+ {
+ try
+ {
+ _servants[0]->getValue();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ for(int i = 1; i < static_cast<int>(_servants.size()); ++i)
+ {
+ test(_servants[i]->getValue() == i);
+ }
+ }
}
private:
@@ -71,72 +71,72 @@ public:
enum State { StateRunning, StateDeactivating, StateDeactivated };
ReadForeverThread(vector<Test::ServantPrx>& servants) :
- _servants(servants),
- _state(StateRunning)
+ _servants(servants),
+ _state(StateRunning)
{
}
virtual void
run()
{
- for(;;)
- {
- try
- {
- for(int i = 0; i < static_cast<int>(_servants.size()); ++i)
- {
- if(getState() == StateDeactivated)
- {
- _servants[i]->slowGetValue();
- test(false);
- }
- else
- {
- test(_servants[i]->slowGetValue() == i);
- }
- }
- }
- catch(const Ice::SocketException&)
- {
- //
- // Expected
- //
- test(validEx());
- return;
- }
- catch(const Ice::LocalException& e)
- {
- cerr << "Caught unexpected : " << e << endl;
- test(false);
- return;
- }
- catch(...)
- {
- test(false);
- return;
- }
- }
+ for(;;)
+ {
+ try
+ {
+ for(int i = 0; i < static_cast<int>(_servants.size()); ++i)
+ {
+ if(getState() == StateDeactivated)
+ {
+ _servants[i]->slowGetValue();
+ test(false);
+ }
+ else
+ {
+ test(_servants[i]->slowGetValue() == i);
+ }
+ }
+ }
+ catch(const Ice::SocketException&)
+ {
+ //
+ // Expected
+ //
+ test(validEx());
+ return;
+ }
+ catch(const Ice::LocalException& e)
+ {
+ cerr << "Caught unexpected : " << e << endl;
+ test(false);
+ return;
+ }
+ catch(...)
+ {
+ test(false);
+ return;
+ }
+ }
}
State
getState()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state;
}
bool
validEx()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state == StateDeactivating || _state == StateDeactivated;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state == StateDeactivating || _state == StateDeactivated;
}
void
setState(State s)
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- _state = s;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ _state = s;
}
private:
@@ -152,99 +152,99 @@ public:
enum State { StateRunning, StateDeactivating, StateDeactivated };
AddForeverThread(const Test::RemoteEvictorPrx& evictor, int prefix) :
- _evictor(evictor),
- _state(StateRunning)
+ _evictor(evictor),
+ _state(StateRunning)
{
- ostringstream ostr;
- ostr << prefix;
- _prefix = ostr.str();
+ ostringstream ostr;
+ ostr << prefix;
+ _prefix = ostr.str();
}
virtual void
run()
{
- int index = 0;
-
- for(;;)
- {
- ostringstream ostr;
- ostr << _prefix << "-" << index;
- index++;
- string id = ostr.str();
- try
- {
- if(getState() == StateDeactivated)
- {
- _evictor->createServant(id, 0);
- test(false);
- }
- else
- {
- _evictor->createServant(id, 0);
- }
- }
- catch(const Test::EvictorDeactivatedException&)
- {
- test(validEx());
- //
- // Expected
- //
- return;
- }
- catch(const Ice::ObjectNotExistException&)
- {
- test(validEx());
- //
- // Expected
- //
- return;
- }
- catch(const Ice::LocalException& e)
- {
- cerr << "Caught unexpected : " << e << endl;
- test(false);
- return;
- }
- catch(const IceUtil::Exception& e)
- {
- cerr << "Caught IceUtil::Exception : " << e << endl;
- cerr << "Index is " << index << endl;
- test(false);
- return;
- }
- catch(const std::exception& e)
- {
- cerr << "Caught std::exception : " << e.what() << endl;
- test(false);
- return;
- }
- catch(...)
- {
- cerr << "Caught unknown exception" << endl;
+ int index = 0;
+
+ for(;;)
+ {
+ ostringstream ostr;
+ ostr << _prefix << "-" << index;
+ index++;
+ string id = ostr.str();
+ try
+ {
+ if(getState() == StateDeactivated)
+ {
+ _evictor->createServant(id, 0);
+ test(false);
+ }
+ else
+ {
+ _evictor->createServant(id, 0);
+ }
+ }
+ catch(const Test::EvictorDeactivatedException&)
+ {
+ test(validEx());
+ //
+ // Expected
+ //
+ return;
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ test(validEx());
+ //
+ // Expected
+ //
+ return;
+ }
+ catch(const Ice::LocalException& e)
+ {
+ cerr << "Caught unexpected : " << e << endl;
test(false);
- return;
- }
- }
+ return;
+ }
+ catch(const IceUtil::Exception& e)
+ {
+ cerr << "Caught IceUtil::Exception : " << e << endl;
+ cerr << "Index is " << index << endl;
+ test(false);
+ return;
+ }
+ catch(const std::exception& e)
+ {
+ cerr << "Caught std::exception : " << e.what() << endl;
+ test(false);
+ return;
+ }
+ catch(...)
+ {
+ cerr << "Caught unknown exception" << endl;
+ test(false);
+ return;
+ }
+ }
}
State
getState()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state;
}
bool
validEx()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state == StateDeactivating || _state == StateDeactivated;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state == StateDeactivating || _state == StateDeactivated;
}
void
setState(State s)
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- _state = s;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ _state = s;
}
private:
@@ -259,96 +259,96 @@ class CreateDestroyThread : public Thread
public:
CreateDestroyThread(const Test::RemoteEvictorPrx& evictor, int id, int size) :
- _evictor(evictor),
- _size(size)
+ _evictor(evictor),
+ _size(size)
{
- ostringstream ostr;
- ostr << id;
- _id = ostr.str();
+ ostringstream ostr;
+ ostr << id;
+ _id = ostr.str();
}
virtual void
run()
{
- try
- {
- int loops = 50;
- while(loops-- > 0)
- {
- for(int i = 0; i < _size; i++)
- {
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- if(id == _id)
- {
- //
- // Create when odd, destroy when even.
- //
-
- if(loops % 2 == 0)
- {
- Test::ServantPrx servant = _evictor->getServant(id);
- servant->destroy();
-
- //
- // Twice
- //
- try
- {
- servant->destroy();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
- }
- else
- {
- Test::ServantPrx servant = _evictor->createServant(id, i);
-
- //
- // Twice
- //
- try
- {
- servant = _evictor->createServant(id, 0);
- test(false);
- }
- catch(const Test::AlreadyRegisteredException&)
- {
- // Expected
- }
- }
- }
- else
- {
- //
- // Just read/write the value
- //
- Test::ServantPrx servant = _evictor->getServant(id);
- try
- {
- int val = servant->getValue();
- test(val == i || val == -i);
- servant->setValue(-val);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected from time to time
- }
- }
- }
- }
- }
- catch(...)
- {
- //
- // Unexpected!
- //
- test(false);
- }
+ try
+ {
+ int loops = 50;
+ while(loops-- > 0)
+ {
+ for(int i = 0; i < _size; i++)
+ {
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ if(id == _id)
+ {
+ //
+ // Create when odd, destroy when even.
+ //
+
+ if(loops % 2 == 0)
+ {
+ Test::ServantPrx servant = _evictor->getServant(id);
+ servant->destroy();
+
+ //
+ // Twice
+ //
+ try
+ {
+ servant->destroy();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+ }
+ else
+ {
+ Test::ServantPrx servant = _evictor->createServant(id, i);
+
+ //
+ // Twice
+ //
+ try
+ {
+ servant = _evictor->createServant(id, 0);
+ test(false);
+ }
+ catch(const Test::AlreadyRegisteredException&)
+ {
+ // Expected
+ }
+ }
+ }
+ else
+ {
+ //
+ // Just read/write the value
+ //
+ Test::ServantPrx servant = _evictor->getServant(id);
+ try
+ {
+ int val = servant->getValue();
+ test(val == i || val == -i);
+ servant->setValue(-val);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected from time to time
+ }
+ }
+ }
+ }
+ }
+ catch(...)
+ {
+ //
+ // Unexpected!
+ //
+ test(false);
+ }
}
private:
Test::RemoteEvictorPrx _evictor;
@@ -379,32 +379,32 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
vector<Test::ServantPrx> servants;
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- servants.push_back(evictor->createServant(id, i));
- servants[i]->ice_ping();
-
- Test::FacetPrx facet1 = Test::FacetPrx::uncheckedCast(servants[i], "facet1");
- try
- {
- facet1->ice_ping();
- test(false);
- }
- catch(const Ice::FacetNotExistException&)
- {
- // Expected
- }
-
- servants[i]->addFacet("facet1", "data");
- facet1->ice_ping();
- facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- facet1->setValue(10 * i);
- facet1->addFacet("facet2", "moreData");
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- facet2->setValue(100 * i);
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ servants.push_back(evictor->createServant(id, i));
+ servants[i]->ice_ping();
+
+ Test::FacetPrx facet1 = Test::FacetPrx::uncheckedCast(servants[i], "facet1");
+ try
+ {
+ facet1->ice_ping();
+ test(false);
+ }
+ catch(const Ice::FacetNotExistException&)
+ {
+ // Expected
+ }
+
+ servants[i]->addFacet("facet1", "data");
+ facet1->ice_ping();
+ facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ facet1->setValue(10 * i);
+ facet1->addFacet("facet2", "moreData");
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ facet2->setValue(100 * i);
}
//
@@ -414,14 +414,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getValue() == i);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- test(facet1->getValue() == 10 * i);
- test(facet1->getData() == "data");
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- test(facet2->getData() == "moreData");
+ test(servants[i]->getValue() == i);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ test(facet1->getValue() == 10 * i);
+ test(facet1->getData() == "data");
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ test(facet2->getData() == "moreData");
}
//
@@ -429,13 +429,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->setValue(i + 100);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- facet1->setValue(10 * i + 100);
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- facet2->setValue(100 * i + 100);
+ servants[i]->setValue(i + 100);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ facet1->setValue(10 * i + 100);
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ facet2->setValue(100 * i + 100);
}
//
@@ -445,13 +445,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getValue() == i + 100);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- test(facet1->getValue() == 10 * i + 100);
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- test(facet2->getValue() == 100 * i + 100);
+ test(servants[i]->getValue() == i + 100);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ test(facet1->getValue() == 10 * i + 100);
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ test(facet2->getValue() == 100 * i + 100);
}
//
// Test saving while busy
@@ -459,24 +459,24 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
Test::AMI_Servant_setValueAsyncPtr setCB = new AMI_Servant_setValueAsyncI;
for(i = 0; i < size; i++)
{
- //
- // Start a mutating operation so that the object is not idle.
- //
- servants[i]->setValueAsync_async(setCB, i + 300);
-
- test(servants[i]->getValue() == i + 100);
- //
- // This operation modifies the object state but is not saved
- // because the setValueAsync operation is still pending.
- //
- servants[i]->setValue(i + 200);
- test(servants[i]->getValue() == i + 200);
+ //
+ // Start a mutating operation so that the object is not idle.
+ //
+ servants[i]->setValueAsync_async(setCB, i + 300);
+
+ test(servants[i]->getValue() == i + 100);
+ //
+ // This operation modifies the object state but is not saved
+ // because the setValueAsync operation is still pending.
+ //
+ servants[i]->setValue(i + 200);
+ test(servants[i]->getValue() == i + 200);
- //
- // Force the response to setValueAsync
- //
- servants[i]->releaseAsync();
- test(servants[i]->getValue() == i + 300);
+ //
+ // Force the response to setValueAsync
+ //
+ servants[i]->releaseAsync();
+ test(servants[i]->getValue() == i + 300);
}
//
@@ -484,14 +484,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- try
- {
- servants[i]->addFacet("facet1", "foobar");
- test(false);
- }
- catch(const Test::AlreadyRegisteredException&)
- {
- }
+ try
+ {
+ servants[i]->addFacet("facet1", "foobar");
+ test(false);
+ }
+ catch(const Test::AlreadyRegisteredException&)
+ {
+ }
}
//
@@ -499,8 +499,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
try
{
- servants[0]->removeFacet("facet3");
- test(false);
+ servants[0]->removeFacet("facet3");
+ test(false);
}
catch(const Test::NotRegisteredException&)
{
@@ -512,8 +512,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->removeFacet("facet1");
- servants[i]->removeFacet("facet2");
+ servants[i]->removeFacet("facet1");
+ servants[i]->removeFacet("facet2");
}
//
@@ -521,10 +521,10 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1 == 0);
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(servants[i], "facet2");
- test(facet2 == 0);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1 == 0);
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(servants[i], "facet2");
+ test(facet2 == 0);
}
evictor->setSize(0);
@@ -532,10 +532,10 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
for(i = 0; i < size; i++)
{
- test(servants[i]->getValue() == i + 300);
+ test(servants[i]->getValue() == i + 300);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1 == 0);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1 == 0);
}
//
@@ -543,26 +543,26 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->destroy();
- try
- {
- servants[i]->getValue();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
-
- try
- {
- servants[i]->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
+ servants[i]->destroy();
+ try
+ {
+ servants[i]->getValue();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ servants[i]->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
}
//
@@ -571,11 +571,11 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
servants.clear();
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- servants.push_back(evictor->createServant(id, i));
- servants[i]->setTransientValue(i);
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ servants.push_back(evictor->createServant(id, i));
+ servants[i]->setTransientValue(i);
}
//
@@ -590,7 +590,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == -1);
+ test(servants[i]->getTransientValue() == -1);
}
//
@@ -598,9 +598,9 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->keepInCache();
- servants[i]->keepInCache();
- servants[i]->setTransientValue(i);
+ servants[i]->keepInCache();
+ servants[i]->keepInCache();
+ servants[i]->setTransientValue(i);
}
evictor->saveNow();
evictor->setSize(0);
@@ -612,7 +612,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == i);
+ test(servants[i]->getTransientValue() == i);
}
//
@@ -620,14 +620,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->release();
+ servants[i]->release();
}
evictor->saveNow();
evictor->setSize(0);
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == i);
+ test(servants[i]->getTransientValue() == i);
}
//
@@ -635,14 +635,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->release();
+ servants[i]->release();
}
evictor->saveNow();
evictor->setSize(0);
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == -1);
+ test(servants[i]->getTransientValue() == -1);
}
@@ -651,15 +651,15 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- try
- {
- servants[i]->release();
- test(false);
- }
- catch(const Test::NotRegisteredException&)
- {
- // Expected
- }
+ try
+ {
+ servants[i]->release();
+ test(false);
+ }
+ catch(const Test::NotRegisteredException&)
+ {
+ // Expected
+ }
}
@@ -673,12 +673,12 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
- servants[i] = evictor->getServant(id);
- test(servants[i]->getValue() == i);
+ servants[i] = evictor->getServant(id);
+ test(servants[i]->getValue() == i);
}
//
@@ -689,19 +689,19 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
servants[0]->destroy();
{
- const int threadCount = size * 2;
-
- ThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new ReadThread(servants);
- threads[i]->start();
- }
-
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
+ const int threadCount = size * 2;
+
+ ThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new ReadThread(servants);
+ threads[i]->start();
+ }
+
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
}
//
@@ -715,35 +715,35 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
// CreateDestroy threads
//
{
- const int threadCount = size;;
-
- ThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new CreateDestroyThread(evictor, i, size);
- threads[i]->start();
- }
-
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
-
- //
- // Verify all destroyed
- //
- for(i = 0; i < size; i++)
- {
- try
- {
- servants[i]->getValue();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
- }
+ const int threadCount = size;;
+
+ ThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new CreateDestroyThread(evictor, i, size);
+ threads[i]->start();
+ }
+
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
+
+ //
+ // Verify all destroyed
+ //
+ for(i = 0; i < size; i++)
+ {
+ try
+ {
+ servants[i]->getValue();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+ }
}
//
@@ -752,10 +752,10 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
servants.clear();
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- servants.push_back(evictor->createServant(id, i));
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ servants.push_back(evictor->createServant(id, i));
}
//
@@ -763,30 +763,30 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
// (really testing Ice here)
//
{
- const int threadCount = size;
-
- ReadForeverThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new ReadForeverThread(servants);
- threads[i]->start();
- }
+ const int threadCount = size;
+
+ ReadForeverThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new ReadForeverThread(servants);
+ threads[i]->start();
+ }
- ThreadControl::sleep(Time::milliSeconds(500));
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(ReadForeverThread::StateDeactivating);
- }
- evictor->deactivate();
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(ReadForeverThread::StateDeactivated);
- }
+ ThreadControl::sleep(Time::milliSeconds(500));
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(ReadForeverThread::StateDeactivating);
+ }
+ evictor->deactivate();
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(ReadForeverThread::StateDeactivated);
+ }
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
}
//
@@ -799,30 +799,30 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
// Deactivate in the middle of adds
//
{
- const int threadCount = size;
-
- AddForeverThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new AddForeverThread(evictor, i);
- threads[i]->start();
- }
-
- ThreadControl::sleep(Time::milliSeconds(500));
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(AddForeverThread::StateDeactivating);
- }
- evictor->deactivate();
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(AddForeverThread::StateDeactivated);
- }
-
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
+ const int threadCount = size;
+
+ AddForeverThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new AddForeverThread(evictor, i);
+ threads[i]->start();
+ }
+
+ ThreadControl::sleep(Time::milliSeconds(500));
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(AddForeverThread::StateDeactivating);
+ }
+ evictor->deactivate();
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(AddForeverThread::StateDeactivated);
+ }
+
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
}
diff --git a/cpp/test/Freeze/evictor/Test.ice b/cpp/test/Freeze/evictor/Test.ice
index 4ab855c984c..e51e4b39a18 100644
--- a/cpp/test/Freeze/evictor/Test.ice
+++ b/cpp/test/Freeze/evictor/Test.ice
@@ -61,7 +61,7 @@ interface RemoteEvictor
idempotent void setSize(int size);
Servant* createServant(string id, int value)
- throws AlreadyRegisteredException, EvictorDeactivatedException;
+ throws AlreadyRegisteredException, EvictorDeactivatedException;
idempotent Servant* getServant(string id);
diff --git a/cpp/test/Freeze/evictor/TestI.cpp b/cpp/test/Freeze/evictor/TestI.cpp
index 04e94256dcf..490d23083ac 100644
--- a/cpp/test/Freeze/evictor/TestI.cpp
+++ b/cpp/test/Freeze/evictor/TestI.cpp
@@ -20,16 +20,16 @@ class DelayedResponse : public Thread
public:
DelayedResponse(const Test::AMD_Servant_slowGetValuePtr& cb, int val) :
- _cb(cb),
- _val(val)
+ _cb(cb),
+ _val(val)
{
}
virtual void
run()
{
- ThreadControl::sleep(Time::milliSeconds(500));
- _cb->ice_response(_val);
+ ThreadControl::sleep(Time::milliSeconds(500));
+ _cb->ice_response(_val);
}
private:
@@ -75,7 +75,7 @@ Test::ServantI::slowGetValue(const Current&) const
void
Test::ServantI::slowGetValue_async(const AMD_Servant_slowGetValuePtr& cb,
- const Current&) const
+ const Current&) const
{
IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
Monitor<Mutex>::Lock sync(*this);
@@ -123,11 +123,11 @@ Test::ServantI::addFacet(const string& name, const string& data, const Current&
try
{
- _evictor->addFacet(facet, current.id, name);
+ _evictor->addFacet(facet, current.id, name);
}
catch(const Ice::AlreadyRegisteredException&)
{
- throw Test::AlreadyRegisteredException();
+ throw Test::AlreadyRegisteredException();
}
}
@@ -136,11 +136,11 @@ Test::ServantI::removeFacet(const string& name, const Current& current) const
{
try
{
- _evictor->removeFacet(current.id, name);
+ _evictor->removeFacet(current.id, name);
}
catch(const Ice::NotRegisteredException&)
{
- throw Test::NotRegisteredException();
+ throw Test::NotRegisteredException();
}
}
@@ -170,11 +170,11 @@ Test::ServantI::release(const Current& current)
{
try
{
- _evictor->release(current.id);
+ _evictor->release(current.id);
}
catch(const Ice::NotRegisteredException&)
{
- throw NotRegisteredException();
+ throw NotRegisteredException();
}
}
@@ -183,11 +183,11 @@ Test::ServantI::destroy(const Current& current)
{
try
{
- _evictor->remove(current.id);
+ _evictor->remove(current.id);
}
catch(const Ice::NotRegisteredException&)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
}
@@ -225,7 +225,7 @@ public:
void init(const Test::RemoteEvictorIPtr& remoteEvictor, const Freeze::EvictorPtr& evictor)
{
_remoteEvictor = remoteEvictor;
- _evictor = evictor;
+ _evictor = evictor;
}
virtual void
@@ -243,7 +243,7 @@ private:
Test::RemoteEvictorI::RemoteEvictorI(const ObjectAdapterPtr& adapter, const string& envName,
- const string& category) :
+ const string& category) :
_adapter(adapter),
_category(category)
{
@@ -275,19 +275,19 @@ Test::RemoteEvictorI::createServant(const string& id, Int value, const Current&)
ServantPtr servant = new ServantI(this, _evictor, value);
try
{
- return ServantPrx::uncheckedCast(_evictor->add(servant, ident));
+ return ServantPrx::uncheckedCast(_evictor->add(servant, ident));
}
catch(const Ice::AlreadyRegisteredException&)
{
- throw Test::AlreadyRegisteredException();
+ throw Test::AlreadyRegisteredException();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
- throw EvictorDeactivatedException();
+ throw EvictorDeactivatedException();
}
catch(const Freeze::EvictorDeactivatedException&)
{
- throw EvictorDeactivatedException();
+ throw EvictorDeactivatedException();
}
}
@@ -327,7 +327,7 @@ Test::RemoteEvictorI::destroyAllServants(const string& facetName, const Current&
Freeze::EvictorIteratorPtr p = _evictor->getIterator(facetName, batchSize);
while(p->hasNext())
{
- _evictor->remove(p->next());
+ _evictor->remove(p->next());
}
}
@@ -344,7 +344,7 @@ Test::RemoteEvictorFactoryI::createEvictor(const string& name, const Current& cu
{
RemoteEvictorIPtr remoteEvictor = new RemoteEvictorI(_adapter, _envName, name);
return RemoteEvictorPrx::uncheckedCast(_adapter->add(remoteEvictor,
- _adapter->getCommunicator()->stringToIdentity(name)));
+ _adapter->getCommunicator()->stringToIdentity(name)));
}
void
diff --git a/cpp/test/Freeze/evictor/TestI.h b/cpp/test/Freeze/evictor/TestI.h
index e886473517c..458cf023702 100644
--- a/cpp/test/Freeze/evictor/TestI.h
+++ b/cpp/test/Freeze/evictor/TestI.h
@@ -41,7 +41,7 @@ public:
virtual void slowGetValue_async(const AMD_Servant_slowGetValuePtr&,
- const Ice::Current& = Ice::Current()) const;
+ const Ice::Current& = Ice::Current()) const;
virtual void setValue(::Ice::Int, const Ice::Current& = Ice::Current());
diff --git a/cpp/test/Freeze/oldevictor/Client.cpp b/cpp/test/Freeze/oldevictor/Client.cpp
index 41ee315faf2..cfafd704ef7 100644
--- a/cpp/test/Freeze/oldevictor/Client.cpp
+++ b/cpp/test/Freeze/oldevictor/Client.cpp
@@ -29,35 +29,35 @@ class ReadThread : public Thread
public:
ReadThread(vector<Test::ServantPrx>& servants) :
- _servants(servants)
+ _servants(servants)
{
}
virtual void
run()
{
- int loops = 10;
- while(loops-- > 0)
- {
- try
- {
- _servants[0]->getValue();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
- catch(...)
- {
- test(false);
- }
-
- for(int i = 1; i < static_cast<int>(_servants.size()); ++i)
- {
- test(_servants[i]->getValue() == i);
- }
- }
+ int loops = 10;
+ while(loops-- > 0)
+ {
+ try
+ {
+ _servants[0]->getValue();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ for(int i = 1; i < static_cast<int>(_servants.size()); ++i)
+ {
+ test(_servants[i]->getValue() == i);
+ }
+ }
}
private:
@@ -71,72 +71,72 @@ public:
enum State { StateRunning, StateDeactivating, StateDeactivated };
ReadForeverThread(vector<Test::ServantPrx>& servants) :
- _servants(servants),
- _state(StateRunning)
+ _servants(servants),
+ _state(StateRunning)
{
}
virtual void
run()
{
- for(;;)
- {
- try
- {
- for(int i = 0; i < static_cast<int>(_servants.size()); ++i)
- {
- if(getState() == StateDeactivated)
- {
- _servants[i]->slowGetValue();
- test(false);
- }
- else
- {
- test(_servants[i]->slowGetValue() == i);
- }
- }
- }
- catch(const Ice::SocketException&)
- {
- //
- // Expected
- //
- test(validEx());
- return;
- }
- catch(const Ice::LocalException& e)
- {
- cerr << "Caught unexpected : " << e << endl;
- test(false);
- return;
- }
- catch(...)
- {
- test(false);
- return;
- }
- }
+ for(;;)
+ {
+ try
+ {
+ for(int i = 0; i < static_cast<int>(_servants.size()); ++i)
+ {
+ if(getState() == StateDeactivated)
+ {
+ _servants[i]->slowGetValue();
+ test(false);
+ }
+ else
+ {
+ test(_servants[i]->slowGetValue() == i);
+ }
+ }
+ }
+ catch(const Ice::SocketException&)
+ {
+ //
+ // Expected
+ //
+ test(validEx());
+ return;
+ }
+ catch(const Ice::LocalException& e)
+ {
+ cerr << "Caught unexpected : " << e << endl;
+ test(false);
+ return;
+ }
+ catch(...)
+ {
+ test(false);
+ return;
+ }
+ }
}
State
getState()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state;
}
bool
validEx()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state == StateDeactivating || _state == StateDeactivated;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state == StateDeactivating || _state == StateDeactivated;
}
void
setState(State s)
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- _state = s;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ _state = s;
}
private:
@@ -152,99 +152,99 @@ public:
enum State { StateRunning, StateDeactivating, StateDeactivated };
AddForeverThread(const Test::RemoteEvictorPrx& evictor, int prefix) :
- _evictor(evictor),
- _state(StateRunning)
+ _evictor(evictor),
+ _state(StateRunning)
{
- ostringstream ostr;
- ostr << prefix;
- _prefix = ostr.str();
+ ostringstream ostr;
+ ostr << prefix;
+ _prefix = ostr.str();
}
virtual void
run()
{
- int index = 0;
-
- for(;;)
- {
- ostringstream ostr;
- ostr << _prefix << "-" << index;
- index++;
- string id = ostr.str();
- try
- {
- if(getState() == StateDeactivated)
- {
- _evictor->createServant(id, 0);
- test(false);
- }
- else
- {
- _evictor->createServant(id, 0);
- }
- }
- catch(const Test::EvictorDeactivatedException&)
- {
- test(validEx());
- //
- // Expected
- //
- return;
- }
- catch(const Ice::ObjectNotExistException&)
- {
- test(validEx());
- //
- // Expected
- //
- return;
- }
- catch(const Ice::LocalException& e)
- {
- cerr << "Caught unexpected : " << e << endl;
- test(false);
- return;
- }
- catch(const IceUtil::Exception& e)
- {
- cerr << "Caught IceUtil::Exception : " << e << endl;
- cerr << "Index is " << index << endl;
- test(false);
- return;
- }
- catch(const std::exception& e)
- {
- cerr << "Caught std::exception : " << e.what() << endl;
- test(false);
- return;
- }
- catch(...)
- {
- cerr << "Caught unknown exception" << endl;
+ int index = 0;
+
+ for(;;)
+ {
+ ostringstream ostr;
+ ostr << _prefix << "-" << index;
+ index++;
+ string id = ostr.str();
+ try
+ {
+ if(getState() == StateDeactivated)
+ {
+ _evictor->createServant(id, 0);
+ test(false);
+ }
+ else
+ {
+ _evictor->createServant(id, 0);
+ }
+ }
+ catch(const Test::EvictorDeactivatedException&)
+ {
+ test(validEx());
+ //
+ // Expected
+ //
+ return;
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ test(validEx());
+ //
+ // Expected
+ //
+ return;
+ }
+ catch(const Ice::LocalException& e)
+ {
+ cerr << "Caught unexpected : " << e << endl;
test(false);
- return;
- }
- }
+ return;
+ }
+ catch(const IceUtil::Exception& e)
+ {
+ cerr << "Caught IceUtil::Exception : " << e << endl;
+ cerr << "Index is " << index << endl;
+ test(false);
+ return;
+ }
+ catch(const std::exception& e)
+ {
+ cerr << "Caught std::exception : " << e.what() << endl;
+ test(false);
+ return;
+ }
+ catch(...)
+ {
+ cerr << "Caught unknown exception" << endl;
+ test(false);
+ return;
+ }
+ }
}
State
getState()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state;
}
bool
validEx()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- return _state == StateDeactivating || _state == StateDeactivated;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ return _state == StateDeactivating || _state == StateDeactivated;
}
void
setState(State s)
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- _state = s;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ _state = s;
}
private:
@@ -259,96 +259,96 @@ class CreateDestroyThread : public Thread
public:
CreateDestroyThread(const Test::RemoteEvictorPrx& evictor, int id, int size) :
- _evictor(evictor),
- _size(size)
+ _evictor(evictor),
+ _size(size)
{
- ostringstream ostr;
- ostr << id;
- _id = ostr.str();
+ ostringstream ostr;
+ ostr << id;
+ _id = ostr.str();
}
virtual void
run()
{
- try
- {
- int loops = 50;
- while(loops-- > 0)
- {
- for(int i = 0; i < _size; i++)
- {
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- if(id == _id)
- {
- //
- // Create when odd, destroy when even.
- //
-
- if(loops % 2 == 0)
- {
- Test::ServantPrx servant = _evictor->getServant(id);
- servant->destroy();
-
- //
- // Twice
- //
- try
- {
- servant->destroy();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
- }
- else
- {
- Test::ServantPrx servant = _evictor->createServant(id, i);
-
- //
- // Twice
- //
- try
- {
- servant = _evictor->createServant(id, 0);
- test(false);
- }
- catch(const Test::AlreadyRegisteredException&)
- {
- // Expected
- }
- }
- }
- else
- {
- //
- // Just read/write the value
- //
- Test::ServantPrx servant = _evictor->getServant(id);
- try
- {
- int val = servant->getValue();
- test(val == i || val == -i);
- servant->setValue(-val);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected from time to time
- }
- }
- }
- }
- }
- catch(...)
- {
- //
- // Unexpected!
- //
- test(false);
- }
+ try
+ {
+ int loops = 50;
+ while(loops-- > 0)
+ {
+ for(int i = 0; i < _size; i++)
+ {
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ if(id == _id)
+ {
+ //
+ // Create when odd, destroy when even.
+ //
+
+ if(loops % 2 == 0)
+ {
+ Test::ServantPrx servant = _evictor->getServant(id);
+ servant->destroy();
+
+ //
+ // Twice
+ //
+ try
+ {
+ servant->destroy();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+ }
+ else
+ {
+ Test::ServantPrx servant = _evictor->createServant(id, i);
+
+ //
+ // Twice
+ //
+ try
+ {
+ servant = _evictor->createServant(id, 0);
+ test(false);
+ }
+ catch(const Test::AlreadyRegisteredException&)
+ {
+ // Expected
+ }
+ }
+ }
+ else
+ {
+ //
+ // Just read/write the value
+ //
+ Test::ServantPrx servant = _evictor->getServant(id);
+ try
+ {
+ int val = servant->getValue();
+ test(val == i || val == -i);
+ servant->setValue(-val);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected from time to time
+ }
+ }
+ }
+ }
+ }
+ catch(...)
+ {
+ //
+ // Unexpected!
+ //
+ test(false);
+ }
}
private:
Test::RemoteEvictorPrx _evictor;
@@ -379,32 +379,32 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
vector<Test::ServantPrx> servants;
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- servants.push_back(evictor->createServant(id, i));
- servants[i]->ice_ping();
-
- Test::FacetPrx facet1 = Test::FacetPrx::uncheckedCast(servants[i], "facet1");
- try
- {
- facet1->ice_ping();
- test(false);
- }
- catch(const Ice::FacetNotExistException&)
- {
- // Expected
- }
-
- servants[i]->addFacet("facet1", "data");
- facet1->ice_ping();
- facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- facet1->setValue(10 * i);
- facet1->addFacet("facet2", "moreData");
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- facet2->setValue(100 * i);
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ servants.push_back(evictor->createServant(id, i));
+ servants[i]->ice_ping();
+
+ Test::FacetPrx facet1 = Test::FacetPrx::uncheckedCast(servants[i], "facet1");
+ try
+ {
+ facet1->ice_ping();
+ test(false);
+ }
+ catch(const Ice::FacetNotExistException&)
+ {
+ // Expected
+ }
+
+ servants[i]->addFacet("facet1", "data");
+ facet1->ice_ping();
+ facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ facet1->setValue(10 * i);
+ facet1->addFacet("facet2", "moreData");
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ facet2->setValue(100 * i);
}
//
@@ -414,14 +414,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getValue() == i);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- test(facet1->getValue() == 10 * i);
- test(facet1->getData() == "data");
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- test(facet2->getData() == "moreData");
+ test(servants[i]->getValue() == i);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ test(facet1->getValue() == 10 * i);
+ test(facet1->getData() == "data");
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ test(facet2->getData() == "moreData");
}
//
@@ -429,13 +429,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->setValue(i + 100);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- facet1->setValue(10 * i + 100);
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- facet2->setValue(100 * i + 100);
+ servants[i]->setValue(i + 100);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ facet1->setValue(10 * i + 100);
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ facet2->setValue(100 * i + 100);
}
//
@@ -445,13 +445,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getValue() == i + 100);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1);
- test(facet1->getValue() == 10 * i + 100);
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
- test(facet2);
- test(facet2->getValue() == 100 * i + 100);
+ test(servants[i]->getValue() == i + 100);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1);
+ test(facet1->getValue() == 10 * i + 100);
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(facet1, "facet2");
+ test(facet2);
+ test(facet2->getValue() == 100 * i + 100);
}
//
// Test saving while busy
@@ -459,24 +459,24 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
Test::AMI_Servant_setValueAsyncPtr setCB = new AMI_Servant_setValueAsyncI;
for(i = 0; i < size; i++)
{
- //
- // Start a mutating operation so that the object is not idle.
- //
- servants[i]->setValueAsync_async(setCB, i + 300);
-
- test(servants[i]->getValue() == i + 100);
- //
- // This operation modifies the object state but is not saved
- // because the setValueAsync operation is still pending.
- //
- servants[i]->setValue(i + 200);
- test(servants[i]->getValue() == i + 200);
+ //
+ // Start a mutating operation so that the object is not idle.
+ //
+ servants[i]->setValueAsync_async(setCB, i + 300);
+
+ test(servants[i]->getValue() == i + 100);
+ //
+ // This operation modifies the object state but is not saved
+ // because the setValueAsync operation is still pending.
+ //
+ servants[i]->setValue(i + 200);
+ test(servants[i]->getValue() == i + 200);
- //
- // Force the response to setValueAsync
- //
- servants[i]->releaseAsync();
- test(servants[i]->getValue() == i + 300);
+ //
+ // Force the response to setValueAsync
+ //
+ servants[i]->releaseAsync();
+ test(servants[i]->getValue() == i + 300);
}
//
@@ -484,14 +484,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- try
- {
- servants[i]->addFacet("facet1", "foobar");
- test(false);
- }
- catch(const Test::AlreadyRegisteredException&)
- {
- }
+ try
+ {
+ servants[i]->addFacet("facet1", "foobar");
+ test(false);
+ }
+ catch(const Test::AlreadyRegisteredException&)
+ {
+ }
}
//
@@ -499,8 +499,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
try
{
- servants[0]->removeFacet("facet3");
- test(false);
+ servants[0]->removeFacet("facet3");
+ test(false);
}
catch(const Test::NotRegisteredException&)
{
@@ -512,8 +512,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->removeFacet("facet1");
- servants[i]->removeFacet("facet2");
+ servants[i]->removeFacet("facet1");
+ servants[i]->removeFacet("facet2");
}
//
@@ -521,10 +521,10 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1 == 0);
- Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(servants[i], "facet2");
- test(facet2 == 0);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1 == 0);
+ Test::FacetPrx facet2 = Test::FacetPrx::checkedCast(servants[i], "facet2");
+ test(facet2 == 0);
}
evictor->setSize(0);
@@ -532,10 +532,10 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
for(i = 0; i < size; i++)
{
- test(servants[i]->getValue() == i + 300);
+ test(servants[i]->getValue() == i + 300);
- Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
- test(facet1 == 0);
+ Test::FacetPrx facet1 = Test::FacetPrx::checkedCast(servants[i], "facet1");
+ test(facet1 == 0);
}
//
@@ -543,26 +543,26 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->destroy();
- try
- {
- servants[i]->getValue();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
-
- try
- {
- servants[i]->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
+ servants[i]->destroy();
+ try
+ {
+ servants[i]->getValue();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ servants[i]->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
}
//
@@ -571,11 +571,11 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
servants.clear();
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- servants.push_back(evictor->createServant(id, i));
- servants[i]->setTransientValue(i);
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ servants.push_back(evictor->createServant(id, i));
+ servants[i]->setTransientValue(i);
}
//
@@ -590,7 +590,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == -1);
+ test(servants[i]->getTransientValue() == -1);
}
//
@@ -598,9 +598,9 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->keepInCache();
- servants[i]->keepInCache();
- servants[i]->setTransientValue(i);
+ servants[i]->keepInCache();
+ servants[i]->keepInCache();
+ servants[i]->setTransientValue(i);
}
evictor->saveNow();
evictor->setSize(0);
@@ -612,7 +612,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == i);
+ test(servants[i]->getTransientValue() == i);
}
//
@@ -620,14 +620,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->release();
+ servants[i]->release();
}
evictor->saveNow();
evictor->setSize(0);
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == i);
+ test(servants[i]->getTransientValue() == i);
}
//
@@ -635,14 +635,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- servants[i]->release();
+ servants[i]->release();
}
evictor->saveNow();
evictor->setSize(0);
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- test(servants[i]->getTransientValue() == -1);
+ test(servants[i]->getTransientValue() == -1);
}
@@ -651,15 +651,15 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
//
for(i = 0; i < size; i++)
{
- try
- {
- servants[i]->release();
- test(false);
- }
- catch(const Test::NotRegisteredException&)
- {
- // Expected
- }
+ try
+ {
+ servants[i]->release();
+ test(false);
+ }
+ catch(const Test::NotRegisteredException&)
+ {
+ // Expected
+ }
}
@@ -673,12 +673,12 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
evictor->setSize(size);
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
- servants[i] = evictor->getServant(id);
- test(servants[i]->getValue() == i);
+ servants[i] = evictor->getServant(id);
+ test(servants[i]->getValue() == i);
}
//
@@ -689,19 +689,19 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
servants[0]->destroy();
{
- const int threadCount = size * 2;
-
- ThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new ReadThread(servants);
- threads[i]->start();
- }
-
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
+ const int threadCount = size * 2;
+
+ ThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new ReadThread(servants);
+ threads[i]->start();
+ }
+
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
}
//
@@ -715,35 +715,35 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
// CreateDestroy threads
//
{
- const int threadCount = size;;
-
- ThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new CreateDestroyThread(evictor, i, size);
- threads[i]->start();
- }
-
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
-
- //
- // Verify all destroyed
- //
- for(i = 0; i < size; i++)
- {
- try
- {
- servants[i]->getValue();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // Expected
- }
- }
+ const int threadCount = size;;
+
+ ThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new CreateDestroyThread(evictor, i, size);
+ threads[i]->start();
+ }
+
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
+
+ //
+ // Verify all destroyed
+ //
+ for(i = 0; i < size; i++)
+ {
+ try
+ {
+ servants[i]->getValue();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // Expected
+ }
+ }
}
//
@@ -752,10 +752,10 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
servants.clear();
for(i = 0; i < size; i++)
{
- ostringstream ostr;
- ostr << i;
- string id = ostr.str();
- servants.push_back(evictor->createServant(id, i));
+ ostringstream ostr;
+ ostr << i;
+ string id = ostr.str();
+ servants.push_back(evictor->createServant(id, i));
}
//
@@ -763,30 +763,30 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
// (really testing Ice here)
//
{
- const int threadCount = size;
-
- ReadForeverThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new ReadForeverThread(servants);
- threads[i]->start();
- }
+ const int threadCount = size;
+
+ ReadForeverThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new ReadForeverThread(servants);
+ threads[i]->start();
+ }
- ThreadControl::sleep(Time::milliSeconds(500));
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(ReadForeverThread::StateDeactivating);
- }
- evictor->deactivate();
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(ReadForeverThread::StateDeactivated);
- }
+ ThreadControl::sleep(Time::milliSeconds(500));
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(ReadForeverThread::StateDeactivating);
+ }
+ evictor->deactivate();
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(ReadForeverThread::StateDeactivated);
+ }
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
}
//
@@ -799,30 +799,30 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
// Deactivate in the middle of adds
//
{
- const int threadCount = size;
-
- AddForeverThreadPtr threads[threadCount];
- for(i = 0; i < threadCount; i++)
- {
- threads[i] = new AddForeverThread(evictor, i);
- threads[i]->start();
- }
-
- ThreadControl::sleep(Time::milliSeconds(500));
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(AddForeverThread::StateDeactivating);
- }
- evictor->deactivate();
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->setState(AddForeverThread::StateDeactivated);
- }
-
- for(i = 0; i < threadCount; i++)
- {
- threads[i]->getThreadControl().join();
- }
+ const int threadCount = size;
+
+ AddForeverThreadPtr threads[threadCount];
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i] = new AddForeverThread(evictor, i);
+ threads[i]->start();
+ }
+
+ ThreadControl::sleep(Time::milliSeconds(500));
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(AddForeverThread::StateDeactivating);
+ }
+ evictor->deactivate();
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->setState(AddForeverThread::StateDeactivated);
+ }
+
+ for(i = 0; i < threadCount; i++)
+ {
+ threads[i]->getThreadControl().join();
+ }
}
diff --git a/cpp/test/Freeze/oldevictor/Test.ice b/cpp/test/Freeze/oldevictor/Test.ice
index f1ee08793eb..61610763814 100644
--- a/cpp/test/Freeze/oldevictor/Test.ice
+++ b/cpp/test/Freeze/oldevictor/Test.ice
@@ -61,7 +61,7 @@ interface RemoteEvictor
void setSize(int size);
Servant* createServant(string id, int value)
- throws AlreadyRegisteredException, EvictorDeactivatedException;
+ throws AlreadyRegisteredException, EvictorDeactivatedException;
Servant* getServant(string id);
diff --git a/cpp/test/Freeze/oldevictor/TestI.cpp b/cpp/test/Freeze/oldevictor/TestI.cpp
index 9b2850c9397..2e88f875e28 100644
--- a/cpp/test/Freeze/oldevictor/TestI.cpp
+++ b/cpp/test/Freeze/oldevictor/TestI.cpp
@@ -20,16 +20,16 @@ class DelayedResponse : public Thread
public:
DelayedResponse(const Test::AMD_Servant_slowGetValuePtr& cb, int val) :
- _cb(cb),
- _val(val)
+ _cb(cb),
+ _val(val)
{
}
virtual void
run()
{
- ThreadControl::sleep(Time::milliSeconds(500));
- _cb->ice_response(_val);
+ ThreadControl::sleep(Time::milliSeconds(500));
+ _cb->ice_response(_val);
}
private:
@@ -75,7 +75,7 @@ Test::ServantI::slowGetValue(const Current&) const
void
Test::ServantI::slowGetValue_async(const AMD_Servant_slowGetValuePtr& cb,
- const Current&) const
+ const Current&) const
{
IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
Monitor<Mutex>::Lock sync(*this);
@@ -122,11 +122,11 @@ Test::ServantI::addFacet(const string& name, const string& data, const Current&
try
{
- _evictor->addFacet(facet, current.id, name);
+ _evictor->addFacet(facet, current.id, name);
}
catch(const Ice::AlreadyRegisteredException&)
{
- throw Test::AlreadyRegisteredException();
+ throw Test::AlreadyRegisteredException();
}
}
@@ -135,11 +135,11 @@ Test::ServantI::removeFacet(const string& name, const Current& current) const
{
try
{
- _evictor->removeFacet(current.id, name);
+ _evictor->removeFacet(current.id, name);
}
catch(const Ice::NotRegisteredException&)
{
- throw Test::NotRegisteredException();
+ throw Test::NotRegisteredException();
}
}
@@ -169,11 +169,11 @@ Test::ServantI::release(const Current& current)
{
try
{
- _evictor->release(current.id);
+ _evictor->release(current.id);
}
catch(const Ice::NotRegisteredException&)
{
- throw NotRegisteredException();
+ throw NotRegisteredException();
}
}
@@ -182,11 +182,11 @@ Test::ServantI::destroy(const Current& current)
{
try
{
- _evictor->remove(current.id);
+ _evictor->remove(current.id);
}
catch(const Ice::NotRegisteredException&)
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
}
@@ -224,7 +224,7 @@ public:
void init(const Test::RemoteEvictorIPtr& remoteEvictor, const Freeze::EvictorPtr& evictor)
{
_remoteEvictor = remoteEvictor;
- _evictor = evictor;
+ _evictor = evictor;
}
virtual void
@@ -242,7 +242,7 @@ private:
Test::RemoteEvictorI::RemoteEvictorI(const ObjectAdapterPtr& adapter, const string& envName,
- const string& category) :
+ const string& category) :
_adapter(adapter),
_category(category)
{
@@ -274,19 +274,19 @@ Test::RemoteEvictorI::createServant(const string& id, Int value, const Current&)
ServantPtr servant = new ServantI(this, _evictor, value);
try
{
- return ServantPrx::uncheckedCast(_evictor->add(servant, ident));
+ return ServantPrx::uncheckedCast(_evictor->add(servant, ident));
}
catch(const Ice::AlreadyRegisteredException&)
{
- throw Test::AlreadyRegisteredException();
+ throw Test::AlreadyRegisteredException();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
- throw EvictorDeactivatedException();
+ throw EvictorDeactivatedException();
}
catch(const Freeze::EvictorDeactivatedException&)
{
- throw EvictorDeactivatedException();
+ throw EvictorDeactivatedException();
}
}
@@ -326,7 +326,7 @@ Test::RemoteEvictorI::destroyAllServants(const string& facetName, const Current&
Freeze::EvictorIteratorPtr p = _evictor->getIterator(facetName, batchSize);
while(p->hasNext())
{
- _evictor->remove(p->next());
+ _evictor->remove(p->next());
}
}
@@ -343,7 +343,7 @@ Test::RemoteEvictorFactoryI::createEvictor(const string& name, const Current& cu
{
RemoteEvictorIPtr remoteEvictor = new RemoteEvictorI(_adapter, _envName, name);
return RemoteEvictorPrx::uncheckedCast(_adapter->add(remoteEvictor,
- _adapter->getCommunicator()->stringToIdentity(name)));
+ _adapter->getCommunicator()->stringToIdentity(name)));
}
void
diff --git a/cpp/test/Freeze/oldevictor/TestI.h b/cpp/test/Freeze/oldevictor/TestI.h
index 3f7ac3af396..cef09c3d6ad 100644
--- a/cpp/test/Freeze/oldevictor/TestI.h
+++ b/cpp/test/Freeze/oldevictor/TestI.h
@@ -41,7 +41,7 @@ public:
virtual void slowGetValue_async(const AMD_Servant_slowGetValuePtr&,
- const Ice::Current& = Ice::Current()) const;
+ const Ice::Current& = Ice::Current()) const;
virtual void setValue(::Ice::Int, const Ice::Current& = Ice::Current());
diff --git a/cpp/test/FreezeScript/dbmap/run.py b/cpp/test/FreezeScript/dbmap/run.py
index 362b3401e61..dcb1d9e6078 100755
--- a/cpp/test/FreezeScript/dbmap/run.py
+++ b/cpp/test/FreezeScript/dbmap/run.py
@@ -65,10 +65,10 @@ for oldfile in files:
value = "int"
command = transformdb + " --old " + os.path.join(directory, "fail", oldfile) + " --new " + \
- os.path.join(directory, "fail", newfile) + " -o tmp.xml --key string --value " + value
+ os.path.join(directory, "fail", newfile) + " -o tmp.xml --key string --value " + value
if TestUtil.debug:
- print command
+ print command
stdin, stdout, stderr = os.popen3(command)
lines1 = stderr.readlines()
diff --git a/cpp/test/FreezeScript/evictor/makedb.cpp b/cpp/test/FreezeScript/evictor/makedb.cpp
index 7adc199bb00..2a765c03322 100644
--- a/cpp/test/FreezeScript/evictor/makedb.cpp
+++ b/cpp/test/FreezeScript/evictor/makedb.cpp
@@ -74,7 +74,7 @@ run(const Ice::CommunicatorPtr& communicator, const string& envName, const strin
for(int i = 0; i < 10; ++i)
{
- string facetName = "theFacet";
+ string facetName = "theFacet";
Ice::Identity id;
ostringstream ostr;
diff --git a/cpp/test/Glacier2/attack/Client.cpp b/cpp/test/Glacier2/attack/Client.cpp
index 0bea57e6931..113df36526c 100644
--- a/cpp/test/Glacier2/attack/Client.cpp
+++ b/cpp/test/Glacier2/attack/Client.cpp
@@ -36,7 +36,7 @@ main(int argc, char* argv[])
// proxies, even with regular retries disabled.
//
initData.properties->setProperty("Ice.RetryIntervals", "-1");
-
+
AttackClient app;
return app.main(argc, argv, initData);
}
@@ -65,48 +65,48 @@ AttackClient::run(int argc, char* argv[])
string msg;
for(int i = 1; i <= 10000; ++i)
{
- if(i % 100 == 0)
- {
- if(!msg.empty())
- {
- cout << string(msg.size(), '\b');
- }
- ostringstream s;
- s << i;
- msg = s.str();
- cout << msg << flush;
- }
-
- Identity ident;
- string::iterator p;
-
- ident.name.resize(1); // 1 + IceUtil::random() % 2);
- for(p = ident.name.begin(); p != ident.name.end(); ++p)
- {
- *p = static_cast<char>('A' + IceUtil::random() % 26);
- }
-
- ident.category.resize(IceUtil::random() % 2);
- for(p = ident.category.begin(); p != ident.category.end(); ++p)
- {
- *p = static_cast<char>('a' + IceUtil::random() % 26);
- }
-
- BackendPrx newBackend = BackendPrx::uncheckedCast(backendBase->ice_identity(ident));
-
- set<BackendPrx>::const_iterator q = backends.find(newBackend);
-
- if(q == backends.end())
- {
- backends.insert(newBackend);
- backend = newBackend;
- }
- else
- {
- backend = *q;
- }
-
- backend->ice_ping();
+ if(i % 100 == 0)
+ {
+ if(!msg.empty())
+ {
+ cout << string(msg.size(), '\b');
+ }
+ ostringstream s;
+ s << i;
+ msg = s.str();
+ cout << msg << flush;
+ }
+
+ Identity ident;
+ string::iterator p;
+
+ ident.name.resize(1); // 1 + IceUtil::random() % 2);
+ for(p = ident.name.begin(); p != ident.name.end(); ++p)
+ {
+ *p = static_cast<char>('A' + IceUtil::random() % 26);
+ }
+
+ ident.category.resize(IceUtil::random() % 2);
+ for(p = ident.category.begin(); p != ident.category.end(); ++p)
+ {
+ *p = static_cast<char>('a' + IceUtil::random() % 26);
+ }
+
+ BackendPrx newBackend = BackendPrx::uncheckedCast(backendBase->ice_identity(ident));
+
+ set<BackendPrx>::const_iterator q = backends.find(newBackend);
+
+ if(q == backends.end())
+ {
+ backends.insert(newBackend);
+ backend = newBackend;
+ }
+ else
+ {
+ backend = *q;
+ }
+
+ backend->ice_ping();
}
cout << string(msg.size(), '\b') << string(msg.size(), ' ') << string(msg.size(), '\b');
cout << "ok" << endl;
@@ -120,12 +120,12 @@ AttackClient::run(int argc, char* argv[])
admin->shutdown();
try
{
- admin->ice_ping();
- test(false);
+ admin->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
return EXIT_SUCCESS;
diff --git a/cpp/test/Glacier2/attack/Server.cpp b/cpp/test/Glacier2/attack/Server.cpp
index 1b5d8627065..87eb2268cb5 100644
--- a/cpp/test/Glacier2/attack/Server.cpp
+++ b/cpp/test/Glacier2/attack/Server.cpp
@@ -19,13 +19,13 @@ class ServantLocatorI : virtual public ServantLocator
public:
ServantLocatorI() :
- _backend(new BackendI)
+ _backend(new BackendI)
{
}
-
+
virtual ObjectPtr locate(const Current&, LocalObjectPtr&)
{
- return _backend;
+ return _backend;
}
virtual void finished(const Current&, const ObjectPtr&, const LocalObjectPtr&)
diff --git a/cpp/test/Glacier2/dynamicFiltering/Client.cpp b/cpp/test/Glacier2/dynamicFiltering/Client.cpp
index 8bb4deddf17..ee19c221a6e 100755
--- a/cpp/test/Glacier2/dynamicFiltering/Client.cpp
+++ b/cpp/test/Glacier2/dynamicFiltering/Client.cpp
@@ -36,7 +36,7 @@ main(int argc, char* argv[])
//
initData.properties->setProperty("Ice.RetryIntervals", "-1");
initData.properties->setProperty("Ice.Warn.Connections", "0");
-
+
SessionControlClient app;
return app.main(argc, argv, initData);
}
@@ -51,7 +51,7 @@ SessionControlClient::run(int argc, char* argv[])
cout << "accessing test controller... " << flush;
Ice::CommunicatorPtr controlComm = Ice::initialize(argc, argv, initData);
TestControllerPrx controller = TestControllerPrx::checkedCast(
- controlComm->stringToProxy("testController:tcp -p 12013"));
+ controlComm->stringToProxy("testController:tcp -p 12013"));
test(controller);
TestToken currentState;
TestToken newState;
@@ -73,61 +73,61 @@ SessionControlClient::run(int argc, char* argv[])
bool printOk = false;
while(currentState.code == Running)
{
- controller->step(currentSession, currentState, newState);
- currentState = newState;
-
- if(currentState.code != Running)
- {
- cout << "ok" << endl;
- break;
- }
-
- //
- // If we are running the first case for this configuration, print the configuration description.
- //
- if(currentState.caseIndex == 0)
- {
- if(printOk)
- {
- cout << "ok" << endl;
- }
- else
- {
- printOk = true;
- }
- cout << currentState.description << "... " << flush;
- }
-
- if(currentState.expectedResult)
- {
- BackendPrx prx = BackendPrx::uncheckedCast(communicator()->stringToProxy(currentState.testReference));
- try
- {
- prx->check();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- }
- else
- {
- BackendPrx prx = BackendPrx::uncheckedCast(communicator()->stringToProxy(currentState.testReference));
- try
- {
- prx->check();
- test(false);
- }
- catch(const ObjectNotExistException&)
- {
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- }
+ controller->step(currentSession, currentState, newState);
+ currentState = newState;
+
+ if(currentState.code != Running)
+ {
+ cout << "ok" << endl;
+ break;
+ }
+
+ //
+ // If we are running the first case for this configuration, print the configuration description.
+ //
+ if(currentState.caseIndex == 0)
+ {
+ if(printOk)
+ {
+ cout << "ok" << endl;
+ }
+ else
+ {
+ printOk = true;
+ }
+ cout << currentState.description << "... " << flush;
+ }
+
+ if(currentState.expectedResult)
+ {
+ BackendPrx prx = BackendPrx::uncheckedCast(communicator()->stringToProxy(currentState.testReference));
+ try
+ {
+ prx->check();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ }
+ else
+ {
+ BackendPrx prx = BackendPrx::uncheckedCast(communicator()->stringToProxy(currentState.testReference));
+ try
+ {
+ prx->check();
+ test(false);
+ }
+ catch(const ObjectNotExistException&)
+ {
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ }
}
//
@@ -135,7 +135,7 @@ SessionControlClient::run(int argc, char* argv[])
//
try
{
- router->destroySession();
+ router->destroySession();
}
catch(const ConnectionLostException&)
{
@@ -148,16 +148,16 @@ SessionControlClient::run(int argc, char* argv[])
try
{
- //
- // Shut down the test server.
- //
- currentSession = Test::TestSessionPrx::uncheckedCast(router->createSession("userid", "abc123"));
- currentSession->shutdown();
+ //
+ // Shut down the test server.
+ //
+ currentSession = Test::TestSessionPrx::uncheckedCast(router->createSession("userid", "abc123"));
+ currentSession->shutdown();
}
catch(const Glacier2::CannotCreateSessionException& ex)
{
- cerr << ex.reason << endl;
- throw ex;
+ cerr << ex.reason << endl;
+ throw ex;
}
//
@@ -170,12 +170,12 @@ SessionControlClient::run(int argc, char* argv[])
admin->shutdown();
try
{
- admin->ice_ping();
- test(false);
+ admin->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
return EXIT_SUCCESS;
diff --git a/cpp/test/Glacier2/dynamicFiltering/Server.cpp b/cpp/test/Glacier2/dynamicFiltering/Server.cpp
index 7c25807d0fe..c40fa198d0c 100755
--- a/cpp/test/Glacier2/dynamicFiltering/Server.cpp
+++ b/cpp/test/Glacier2/dynamicFiltering/Server.cpp
@@ -29,23 +29,23 @@ public:
virtual void
setAdapterDirectProxy_async(const AMD_LocatorRegistry_setAdapterDirectProxyPtr& cb, const string&,
- const ObjectPrx&, const Current&)
+ const ObjectPrx&, const Current&)
{
- cb->ice_response();
+ cb->ice_response();
}
virtual void
setReplicatedAdapterDirectProxy_async(const AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr& cb,
- const string&, const string&, const ObjectPrx&, const Current&)
+ const string&, const string&, const ObjectPrx&, const Current&)
{
- cb->ice_response();
+ cb->ice_response();
}
virtual void
setServerProcessProxy_async(const AMD_LocatorRegistry_setServerProcessProxyPtr& cb,
- const string&, const ProcessPrx&, const Current&)
+ const string&, const ProcessPrx&, const Current&)
{
- cb->ice_response();
+ cb->ice_response();
}
};
@@ -53,29 +53,29 @@ class ServerLocatorI : virtual public Locator
{
public:
ServerLocatorI(BackendPtr backend, ObjectAdapterPtr adapter) :
- _backend(backend),
- _adapter(adapter)
+ _backend(backend),
+ _adapter(adapter)
{
- _registryPrx = LocatorRegistryPrx::uncheckedCast(adapter->add(new ServerLocatorRegistry,
- _adapter->getCommunicator()->stringToIdentity("registry")));
+ _registryPrx = LocatorRegistryPrx::uncheckedCast(adapter->add(new ServerLocatorRegistry,
+ _adapter->getCommunicator()->stringToIdentity("registry")));
}
virtual void
findObjectById_async(const AMD_Locator_findObjectByIdPtr& cb, const Identity& id, const Current&) const
{
- cb->ice_response(_adapter->createProxy(id));
+ cb->ice_response(_adapter->createProxy(id));
}
virtual void
findAdapterById_async(const AMD_Locator_findAdapterByIdPtr& cb, const string& id, const Current& current) const
{
- cb->ice_response(_adapter->createDirectProxy(_adapter->getCommunicator()->stringToIdentity("dummy")));
+ cb->ice_response(_adapter->createDirectProxy(_adapter->getCommunicator()->stringToIdentity("dummy")));
}
virtual LocatorRegistryPrx
getRegistry(const Current&) const
{
- return _registryPrx;
+ return _registryPrx;
}
private:
@@ -89,13 +89,13 @@ class ServantLocatorI : virtual public ServantLocator
public:
ServantLocatorI(const BackendPtr& backend) :
- _backend(backend)
+ _backend(backend)
{
}
-
+
virtual ObjectPtr locate(const Current&, LocalObjectPtr&)
{
- return _backend;
+ return _backend;
}
virtual void finished(const Current&, const ObjectPtr&, const LocalObjectPtr&)
diff --git a/cpp/test/Glacier2/dynamicFiltering/SessionI.cpp b/cpp/test/Glacier2/dynamicFiltering/SessionI.cpp
index 3e3d70739a4..a17c975b53d 100755
--- a/cpp/test/Glacier2/dynamicFiltering/SessionI.cpp
+++ b/cpp/test/Glacier2/dynamicFiltering/SessionI.cpp
@@ -22,7 +22,7 @@ Glacier2::SessionPrx
SessionManagerI::create(const string&, const Glacier2::SessionControlPrx& sessionControl, const Ice::Current& current)
{
Glacier2::SessionPrx newSession = Glacier2::SessionPrx::uncheckedCast(
- current.adapter->addWithUUID(new SessionI(sessionControl, _controller)));
+ current.adapter->addWithUUID(new SessionI(sessionControl, _controller)));
_controller->addSession(SessionTuple(newSession, sessionControl));
return newSession;
}
diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp
index c209c03356f..16b434716ab 100755
--- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp
+++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp
@@ -57,101 +57,101 @@ TestControllerI::TestControllerI()
void
TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToken& currentState, TestToken& newState,
- const Ice::Current& current)
+ const Ice::Current& current)
{
switch(currentState.code)
{
- case Test::Finished:
- {
- assert("TestController::step() shouldn't have been called with a state of Finished" == 0);
- break;
- }
-
- case Test::Running:
- {
- TestConfiguration& config = _configurations[currentState.config];
- assert(!config.description.empty());
-
-
- bool found = false;
- SessionTuple session;
- for(vector<SessionTuple>::const_iterator i = _sessions.begin(); i != _sessions.end() && !found; ++i)
- {
- if(i->session == currentSession)
- {
- session = *i;
- found = true;
- }
- }
-
- assert(found);
-
- //
- // New sessions force configuration step.
- //
- bool reconfigure = !session.configured;
-
- //
- // We start with the previous known state.
- //
- newState = currentState;
-
- ++newState.caseIndex;
- if(!(newState.caseIndex < (long)config.cases.size()))
- {
- //
- // We are out of test cases for this configuration. Move to
- // the next configuration.
- //
- ++newState.config;
- if(!(newState.config < (long)_configurations.size()))
- {
- newState.code = Test::Finished;
- newState.expectedResult = false;
- newState.description = "No more tests";
- newState.testReference = "";
- newState.config = -1;
- newState.caseIndex = -1;
- return;
- }
-
- //
- // New test configuration!
- //
- config = _configurations[newState.config];
-
- newState.description = config.description;
- newState.caseIndex = 0;
- reconfigure = true;
- }
- newState.expectedResult = config.cases[newState.caseIndex].expectedResult;
- newState.testReference = config.cases[newState.caseIndex].proxy;
-
- if(reconfigure)
- {
- Glacier2::StringSetPrx categories = session.sessionControl->categories();
- categories->add(config.categoryFiltersAccept);
-
- Glacier2::StringSetPrx adapterIds = session.sessionControl->adapterIds();
- adapterIds->add(config.adapterIdFiltersAccept);
-
- Glacier2::IdentitySetPrx ids = session.sessionControl->identities();
- ids->add(config.objectIdFiltersAccept);
- session.configured = true;
- }
- break;
- }
-
- default:
- {
- newState.code = Running;
- newState.config = 0;
- newState.caseIndex = 0;
- newState.testReference = "";
- newState.description = "Initial running state";
- newState.expectedResult = false;
- break;
- }
+ case Test::Finished:
+ {
+ assert("TestController::step() shouldn't have been called with a state of Finished" == 0);
+ break;
+ }
+
+ case Test::Running:
+ {
+ TestConfiguration& config = _configurations[currentState.config];
+ assert(!config.description.empty());
+
+
+ bool found = false;
+ SessionTuple session;
+ for(vector<SessionTuple>::const_iterator i = _sessions.begin(); i != _sessions.end() && !found; ++i)
+ {
+ if(i->session == currentSession)
+ {
+ session = *i;
+ found = true;
+ }
+ }
+
+ assert(found);
+
+ //
+ // New sessions force configuration step.
+ //
+ bool reconfigure = !session.configured;
+
+ //
+ // We start with the previous known state.
+ //
+ newState = currentState;
+
+ ++newState.caseIndex;
+ if(!(newState.caseIndex < (long)config.cases.size()))
+ {
+ //
+ // We are out of test cases for this configuration. Move to
+ // the next configuration.
+ //
+ ++newState.config;
+ if(!(newState.config < (long)_configurations.size()))
+ {
+ newState.code = Test::Finished;
+ newState.expectedResult = false;
+ newState.description = "No more tests";
+ newState.testReference = "";
+ newState.config = -1;
+ newState.caseIndex = -1;
+ return;
+ }
+
+ //
+ // New test configuration!
+ //
+ config = _configurations[newState.config];
+
+ newState.description = config.description;
+ newState.caseIndex = 0;
+ reconfigure = true;
+ }
+ newState.expectedResult = config.cases[newState.caseIndex].expectedResult;
+ newState.testReference = config.cases[newState.caseIndex].proxy;
+
+ if(reconfigure)
+ {
+ Glacier2::StringSetPrx categories = session.sessionControl->categories();
+ categories->add(config.categoryFiltersAccept);
+
+ Glacier2::StringSetPrx adapterIds = session.sessionControl->adapterIds();
+ adapterIds->add(config.adapterIdFiltersAccept);
+
+ Glacier2::IdentitySetPrx ids = session.sessionControl->identities();
+ ids->add(config.objectIdFiltersAccept);
+ session.configured = true;
+ }
+ break;
+ }
+
+ default:
+ {
+ newState.code = Running;
+ newState.config = 0;
+ newState.caseIndex = 0;
+ newState.testReference = "";
+ newState.description = "Initial running state";
+ newState.expectedResult = false;
+ break;
+ }
}
}
@@ -172,10 +172,10 @@ TestControllerI::notifyDestroy(const Glacier2::SessionControlPrx& control)
{
for(vector<SessionTuple>::iterator i = _sessions.begin(); i != _sessions.end(); ++i)
{
- if(i->sessionControl == control)
- {
- _sessions.erase(i);
- break;
- }
+ if(i->sessionControl == control)
+ {
+ _sessions.erase(i);
+ break;
+ }
}
}
diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
index 59e3b51cf02..20b3efaadeb 100644
--- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
+++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
@@ -25,22 +25,22 @@ struct SessionTuple
SessionTuple() {}
SessionTuple(Glacier2::SessionPrx s, Glacier2::SessionControlPrx control):
- session(s),
- sessionControl(control),
- configured(false)
+ session(s),
+ sessionControl(control),
+ configured(false)
{}
SessionTuple&
operator=(const SessionTuple& rhs)
{
- if(this == &rhs)
- {
- return *this;
- }
-
- session = rhs.session;
- sessionControl = rhs.sessionControl;
- return *this;
+ if(this == &rhs)
+ {
+ return *this;
+ }
+
+ session = rhs.session;
+ sessionControl = rhs.sessionControl;
+ return *this;
}
};
@@ -78,7 +78,7 @@ public:
// Slice to C++ mapping.
//
void step(const Glacier2::SessionPrx& currentSession, const Test::TestToken& currentState,
- Test::TestToken& newState, const Ice::Current&);
+ Test::TestToken& newState, const Ice::Current&);
void shutdown(const Ice::Current&);
diff --git a/cpp/test/Glacier2/dynamicFiltering/run.py b/cpp/test/Glacier2/dynamicFiltering/run.py
index afa4600299e..a4c8dd1ebad 100755
--- a/cpp/test/Glacier2/dynamicFiltering/run.py
+++ b/cpp/test/Glacier2/dynamicFiltering/run.py
@@ -37,9 +37,9 @@ command = router + TestUtil.clientServerOptions + \
r' --Ice.OA.Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \
r' --Ice.OA.Glacier2.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \
r' --Ice.OA.Glacier2.Server.Endpoints="default -p 12349 -t 10000"' + \
- r' --Glacier2.SessionManager="SessionManager:tcp -h 127.0.0.1 -p 12010 -t 10000"' + \
- r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \
- r' --Ice.Default.Locator="locator:default -h 127.0.0.1 -p 12012 -t 10000"'
+ r' --Glacier2.SessionManager="SessionManager:tcp -h 127.0.0.1 -p 12010 -t 10000"' + \
+ r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \
+ r' --Ice.Default.Locator="locator:default -h 127.0.0.1 -p 12012 -t 10000"'
print "starting router...",
starterPipe = os.popen(command + " 2>&1")
diff --git a/cpp/test/Glacier2/router/Callback.ice b/cpp/test/Glacier2/router/Callback.ice
index 73057f0ba53..4188edd551c 100644
--- a/cpp/test/Glacier2/router/Callback.ice
+++ b/cpp/test/Glacier2/router/Callback.ice
@@ -26,7 +26,7 @@ interface CallbackReceiver
["ami"] void callback();
["ami"] void callbackEx()
- throws CallbackException;
+ throws CallbackException;
["amd", "ami"] int concurrentCallback(int number);
@@ -40,7 +40,7 @@ interface Callback
["amd"] void initiateCallback(CallbackReceiver* proxy);
["amd"] void initiateCallbackEx(CallbackReceiver* proxy)
- throws CallbackException;
+ throws CallbackException;
["amd", "ami"] int initiateConcurrentCallback(int number, CallbackReceiver* proxy);
diff --git a/cpp/test/Glacier2/router/CallbackI.cpp b/cpp/test/Glacier2/router/CallbackI.cpp
index c3bc09db876..9c0a2e19062 100644
--- a/cpp/test/Glacier2/router/CallbackI.cpp
+++ b/cpp/test/Glacier2/router/CallbackI.cpp
@@ -20,20 +20,20 @@ class AMI_CallbackReceiver_callbackI : public AMI_CallbackReceiver_callback
public:
AMI_CallbackReceiver_callbackI(const AMD_Callback_initiateCallbackPtr cb) :
- _cb(cb)
+ _cb(cb)
{
}
virtual void
ice_response()
{
- _cb->ice_response();
+ _cb->ice_response();
}
virtual void
ice_exception(const Exception& e)
{
- _cb->ice_exception(e);
+ _cb->ice_exception(e);
}
private:
@@ -46,20 +46,20 @@ class AMI_CallbackReceiver_callbackExI : public AMI_CallbackReceiver_callbackEx
public:
AMI_CallbackReceiver_callbackExI(const AMD_Callback_initiateCallbackExPtr cb) :
- _cb(cb)
+ _cb(cb)
{
}
virtual void
ice_response()
{
- _cb->ice_response();
+ _cb->ice_response();
}
virtual void
ice_exception(const Exception& e)
{
- _cb->ice_exception(e);
+ _cb->ice_exception(e);
}
private:
@@ -72,20 +72,20 @@ class AMI_CallbackReceiver_concurrentCallbackI : public AMI_CallbackReceiver_con
public:
AMI_CallbackReceiver_concurrentCallbackI(const AMD_Callback_initiateConcurrentCallbackPtr cb) :
- _cb(cb)
+ _cb(cb)
{
}
virtual void
ice_response(Int number)
{
- _cb->ice_response(number);
+ _cb->ice_response(number);
}
virtual void
ice_exception(const Exception& e)
{
- _cb->ice_exception(e);
+ _cb->ice_exception(e);
}
private:
@@ -98,20 +98,20 @@ class AMI_CallbackReceiver_waitCallbackI : public AMI_CallbackReceiver_waitCallb
public:
AMI_CallbackReceiver_waitCallbackI(const AMD_Callback_initiateWaitCallbackPtr cb) :
- _cb(cb)
+ _cb(cb)
{
}
virtual void
ice_response()
{
- _cb->ice_response();
+ _cb->ice_response();
}
virtual void
ice_exception(const Exception& e)
{
- _cb->ice_exception(e);
+ _cb->ice_exception(e);
}
private:
@@ -124,20 +124,20 @@ class AMI_CallbackReceiver_callbackWithPayloadI : public AMI_CallbackReceiver_ca
public:
AMI_CallbackReceiver_callbackWithPayloadI(const AMD_Callback_initiateCallbackWithPayloadPtr cb) :
- _cb(cb)
+ _cb(cb)
{
}
virtual void
ice_response()
{
- _cb->ice_response();
+ _cb->ice_response();
}
virtual void
ice_exception(const Exception& e)
{
- _cb->ice_exception(e);
+ _cb->ice_exception(e);
}
private:
@@ -174,8 +174,8 @@ CallbackReceiverI::callbackEx(const Current& current)
void
CallbackReceiverI::concurrentCallback_async(const AMD_CallbackReceiver_concurrentCallbackPtr& cb,
- Int number,
- const Current&)
+ Int number,
+ const Current&)
{
Lock sync(*this);
@@ -190,19 +190,19 @@ void
CallbackReceiverI::waitCallback(const Current&)
{
{
- Lock sync(*this);
- assert(!_waitCallback);
- _waitCallback = true;
- notifyAll();
+ Lock sync(*this);
+ assert(!_waitCallback);
+ _waitCallback = true;
+ notifyAll();
}
{
- Lock sync(*this);
- while(!_finishWaitCallback)
- {
- test(timedWait(IceUtil::Time::milliSeconds(10000)));
- }
- _finishWaitCallback = false;
+ Lock sync(*this);
+ while(!_finishWaitCallback)
+ {
+ test(timedWait(IceUtil::Time::milliSeconds(10000)));
+ }
+ _finishWaitCallback = false;
}
}
@@ -222,10 +222,10 @@ CallbackReceiverI::callbackOK()
while(!_callback)
{
- if(!timedWait(IceUtil::Time::milliSeconds(10000)))
- {
- return false;
- }
+ if(!timedWait(IceUtil::Time::milliSeconds(10000)))
+ {
+ return false;
+ }
}
_callback = false;
@@ -238,10 +238,10 @@ CallbackReceiverI::waitCallbackOK()
Lock sync(*this);
while(!_waitCallback)
{
- if(!timedWait(IceUtil::Time::milliSeconds(10000)))
- {
- return false;
- }
+ if(!timedWait(IceUtil::Time::milliSeconds(10000)))
+ {
+ return false;
+ }
}
_waitCallback = false;
@@ -255,10 +255,10 @@ CallbackReceiverI::callbackWithPayloadOK()
while(!_callbackWithPayload)
{
- if(!timedWait(IceUtil::Time::milliSeconds(10000)))
- {
- return false;
- }
+ if(!timedWait(IceUtil::Time::milliSeconds(10000)))
+ {
+ return false;
+ }
}
_callbackWithPayload = false;
@@ -280,17 +280,17 @@ CallbackReceiverI::answerConcurrentCallbacks(unsigned int num)
while(_callbacks.size() != num)
{
- if(!timedWait(IceUtil::Time::milliSeconds(10000)))
- {
- return false;
- }
+ if(!timedWait(IceUtil::Time::milliSeconds(10000)))
+ {
+ return false;
+ }
}
for(vector<pair<AMD_CallbackReceiver_concurrentCallbackPtr, Int> >::const_iterator p = _callbacks.begin();
- p != _callbacks.end();
- ++p)
+ p != _callbacks.end();
+ ++p)
{
- p->first->ice_response(p->second);
+ p->first->ice_response(p->second);
}
_callbacks.clear();
return true;
@@ -302,55 +302,55 @@ CallbackI::CallbackI()
void
CallbackI::initiateCallback_async(const AMD_Callback_initiateCallbackPtr& cb,
- const CallbackReceiverPrx& proxy, const Current& current)
+ const CallbackReceiverPrx& proxy, const Current& current)
{
if(proxy->ice_isTwoway())
{
- proxy->callback_async(new AMI_CallbackReceiver_callbackI(cb), current.ctx);
+ proxy->callback_async(new AMI_CallbackReceiver_callbackI(cb), current.ctx);
}
else
{
- proxy->callback(current.ctx);
- cb->ice_response();
+ proxy->callback(current.ctx);
+ cb->ice_response();
}
}
void
CallbackI::initiateCallbackEx_async(const AMD_Callback_initiateCallbackExPtr& cb,
- const CallbackReceiverPrx& proxy, const Current& current)
+ const CallbackReceiverPrx& proxy, const Current& current)
{
if(proxy->ice_isTwoway())
{
- proxy->callbackEx_async(new AMI_CallbackReceiver_callbackExI(cb), current.ctx);
+ proxy->callbackEx_async(new AMI_CallbackReceiver_callbackExI(cb), current.ctx);
}
else
{
- proxy->callbackEx(current.ctx);
- cb->ice_response();
+ proxy->callbackEx(current.ctx);
+ cb->ice_response();
}
}
void
CallbackI::initiateConcurrentCallback_async(const AMD_Callback_initiateConcurrentCallbackPtr& cb,
- Int number,
- const CallbackReceiverPrx& proxy,
- const Current& current)
+ Int number,
+ const CallbackReceiverPrx& proxy,
+ const Current& current)
{
proxy->concurrentCallback_async(new AMI_CallbackReceiver_concurrentCallbackI(cb), number, current.ctx);
}
void
CallbackI::initiateWaitCallback_async(const AMD_Callback_initiateWaitCallbackPtr& cb,
- const CallbackReceiverPrx& proxy,
- const Current& current)
+ const CallbackReceiverPrx& proxy,
+ const Current& current)
{
proxy->waitCallback_async(new AMI_CallbackReceiver_waitCallbackI(cb));
}
void
CallbackI::initiateCallbackWithPayload_async(const AMD_Callback_initiateCallbackWithPayloadPtr& cb,
- const CallbackReceiverPrx& proxy,
- const Current& current)
+ const CallbackReceiverPrx& proxy,
+ const Current& current)
{
Ice::ByteSeq seq(1000 * 1024, 0);
proxy->callbackWithPayload_async(new AMI_CallbackReceiver_callbackWithPayloadI(cb), seq);
diff --git a/cpp/test/Glacier2/router/CallbackI.h b/cpp/test/Glacier2/router/CallbackI.h
index 6e4a33f8565..9db011b4df4 100644
--- a/cpp/test/Glacier2/router/CallbackI.h
+++ b/cpp/test/Glacier2/router/CallbackI.h
@@ -24,8 +24,8 @@ public:
virtual void callback(const Ice::Current&);
virtual void callbackEx(const Ice::Current&);
virtual void concurrentCallback_async(const ::Test::AMD_CallbackReceiver_concurrentCallbackPtr&,
- Ice::Int,
- const ::Ice::Current&);
+ Ice::Int,
+ const ::Ice::Current&);
virtual void waitCallback(const ::Ice::Current&);
virtual void callbackWithPayload(const Ice::ByteSeq&, const ::Ice::Current&);
@@ -53,19 +53,19 @@ public:
CallbackI();
virtual void initiateCallback_async(const ::Test::AMD_Callback_initiateCallbackPtr&,
- const ::Test::CallbackReceiverPrx&, const Ice::Current&);
+ const ::Test::CallbackReceiverPrx&, const Ice::Current&);
virtual void initiateCallbackEx_async(const ::Test::AMD_Callback_initiateCallbackExPtr&,
- const ::Test::CallbackReceiverPrx&, const Ice::Current&);
+ const ::Test::CallbackReceiverPrx&, const Ice::Current&);
virtual void initiateConcurrentCallback_async(const ::Test::AMD_Callback_initiateConcurrentCallbackPtr&,
- Ice::Int,
- const ::Test::CallbackReceiverPrx&,
- const ::Ice::Current&);
+ Ice::Int,
+ const ::Test::CallbackReceiverPrx&,
+ const ::Ice::Current&);
virtual void initiateWaitCallback_async(const ::Test::AMD_Callback_initiateWaitCallbackPtr&,
- const ::Test::CallbackReceiverPrx&,
- const ::Ice::Current&);
+ const ::Test::CallbackReceiverPrx&,
+ const ::Ice::Current&);
virtual void initiateCallbackWithPayload_async(const ::Test::AMD_Callback_initiateCallbackWithPayloadPtr&,
- const ::Test::CallbackReceiverPrx&,
- const ::Ice::Current&);
+ const ::Test::CallbackReceiverPrx&,
+ const ::Ice::Current&);
virtual void shutdown(const Ice::Current&);
};
diff --git a/cpp/test/Glacier2/router/Client.cpp b/cpp/test/Glacier2/router/Client.cpp
index a423212e8af..686752a79d1 100644
--- a/cpp/test/Glacier2/router/Client.cpp
+++ b/cpp/test/Glacier2/router/Client.cpp
@@ -21,49 +21,49 @@ using namespace Test;
static Ice::InitializationData initData;
class AMI_Callback_initiateConcurrentCallbackI : public AMI_Callback_initiateConcurrentCallback,
- public IceUtil::Monitor<IceUtil::Mutex>
+ public IceUtil::Monitor<IceUtil::Mutex>
{
public:
AMI_Callback_initiateConcurrentCallbackI() :
- _haveResponse(false)
+ _haveResponse(false)
{
}
virtual void
ice_response(Int response)
{
- Lock sync(*this);
- _haveResponse = true;
- _response = response;
- notify();
+ Lock sync(*this);
+ _haveResponse = true;
+ _response = response;
+ notify();
}
virtual void
ice_exception(const Exception& e)
{
- Lock sync(*this);
- _haveResponse = true;
- _ex.reset(e.ice_clone());
- notify();
+ Lock sync(*this);
+ _haveResponse = true;
+ _ex.reset(e.ice_clone());
+ notify();
}
int
waitResponse() const
{
- Lock sync(*this);
- while(!_haveResponse)
- {
- if(!timedWait(IceUtil::Time::milliSeconds(5000)))
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
- }
- if(_ex.get())
- {
- _ex->ice_throw();
- }
- return _response;
+ Lock sync(*this);
+ while(!_haveResponse)
+ {
+ if(!timedWait(IceUtil::Time::milliSeconds(5000)))
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+ }
+ if(_ex.get())
+ {
+ _ex->ice_throw();
+ }
+ return _response;
}
private:
@@ -85,92 +85,92 @@ public:
virtual
void run()
{
- CommunicatorPtr communicator = initialize(initData);
- ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347 -t 10000");
- Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
- communicator->setDefaultRouter(router);
-
- ostringstream os;
- os << "userid-" << _id;
- Glacier2::SessionPrx session = router->createSession(os.str(), "abc123");
- communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "");
- ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
- adapter->activate();
-
- string category = router->getCategoryForClient();
- {
- Lock sync(*this);
- _callbackReceiver = new CallbackReceiverI;
- notify();
- }
-
- Identity ident;
- ident.name = "callbackReceiver";
- ident.category = category;
- CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
-
- ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010 -t 10000");
- base = base->ice_oneway();
- CallbackPrx callback = CallbackPrx::uncheckedCast(base);
-
-
- //
- // Block the CallbackReceiver in wait() to prevent the client from
- // processing other incoming calls and wait to receive the callback.
- //
- callback->initiateWaitCallback(receiver);
- test(_callbackReceiver->waitCallbackOK());
-
- //
- // Notify the main thread that the callback was received.
- //
- {
- Lock sync(*this);
- _callback = true;
- notify();
- }
-
- //
- // Callback the client with a large payload. This should cause
- // the Glacier2 request queue thread to block trying to send the
- // callback to the client because the client is currently blocked
- // in CallbackReceiverI::waitCallback() and can't process more
- // requests.
- //
- callback->initiateCallbackWithPayload(receiver);
- test(_callbackReceiver->callbackWithPayloadOK());
-
- try
- {
- router->destroySession();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- catch(const Ice::LocalException&)
- {
- test(false);
- }
- communicator->destroy();
+ CommunicatorPtr communicator = initialize(initData);
+ ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347 -t 10000");
+ Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
+ communicator->setDefaultRouter(router);
+
+ ostringstream os;
+ os << "userid-" << _id;
+ Glacier2::SessionPrx session = router->createSession(os.str(), "abc123");
+ communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "");
+ ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
+ adapter->activate();
+
+ string category = router->getCategoryForClient();
+ {
+ Lock sync(*this);
+ _callbackReceiver = new CallbackReceiverI;
+ notify();
+ }
+
+ Identity ident;
+ ident.name = "callbackReceiver";
+ ident.category = category;
+ CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
+
+ ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010 -t 10000");
+ base = base->ice_oneway();
+ CallbackPrx callback = CallbackPrx::uncheckedCast(base);
+
+
+ //
+ // Block the CallbackReceiver in wait() to prevent the client from
+ // processing other incoming calls and wait to receive the callback.
+ //
+ callback->initiateWaitCallback(receiver);
+ test(_callbackReceiver->waitCallbackOK());
+
+ //
+ // Notify the main thread that the callback was received.
+ //
+ {
+ Lock sync(*this);
+ _callback = true;
+ notify();
+ }
+
+ //
+ // Callback the client with a large payload. This should cause
+ // the Glacier2 request queue thread to block trying to send the
+ // callback to the client because the client is currently blocked
+ // in CallbackReceiverI::waitCallback() and can't process more
+ // requests.
+ //
+ callback->initiateCallbackWithPayload(receiver);
+ test(_callbackReceiver->callbackWithPayloadOK());
+
+ try
+ {
+ router->destroySession();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ catch(const Ice::LocalException&)
+ {
+ test(false);
+ }
+ communicator->destroy();
}
void
notifyWaitCallback()
{
- _callbackReceiver->notifyWaitCallback();
+ _callbackReceiver->notifyWaitCallback();
}
void
waitForCallback()
{
- {
- Lock sync(*this);
- while(!_callback)
- {
- wait();
- }
- }
+ {
+ Lock sync(*this);
+ while(!_callback)
+ {
+ wait();
+ }
+ }
}
private:
@@ -192,47 +192,47 @@ public:
virtual
void run()
{
- CommunicatorPtr communicator = initialize(initData);
- ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347 -t 30000");
- _router = Glacier2::RouterPrx::checkedCast(routerBase);
- communicator->setDefaultRouter(_router);
-
- ostringstream os;
- os << "userid-" << _id;
- Glacier2::SessionPrx session = _router->createSession(os.str(), "abc123");
- communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "");
- ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("CallbackReceiverAdapter", _router);
- adapter->activate();
-
- string category = _router->getCategoryForClient();
- _callbackReceiver = new CallbackReceiverI;
- Identity ident;
- ident.name = "callbackReceiver";
- ident.category = category;
- CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
-
- ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010 -t 10000");
- base = base->ice_oneway();
- CallbackPrx callback = CallbackPrx::uncheckedCast(base);
-
- {
- Lock sync(*this);
- _initialized = true;
- notifyAll();
- }
- {
- Lock sync(*this);
- while(!_notified)
- {
- wait();
- }
- }
-
- //
- // Stress the router until the connection is closed.
- //
- stress(callback, receiver);
- communicator->destroy();
+ CommunicatorPtr communicator = initialize(initData);
+ ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347 -t 30000");
+ _router = Glacier2::RouterPrx::checkedCast(routerBase);
+ communicator->setDefaultRouter(_router);
+
+ ostringstream os;
+ os << "userid-" << _id;
+ Glacier2::SessionPrx session = _router->createSession(os.str(), "abc123");
+ communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "");
+ ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("CallbackReceiverAdapter", _router);
+ adapter->activate();
+
+ string category = _router->getCategoryForClient();
+ _callbackReceiver = new CallbackReceiverI;
+ Identity ident;
+ ident.name = "callbackReceiver";
+ ident.category = category;
+ CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
+
+ ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010 -t 10000");
+ base = base->ice_oneway();
+ CallbackPrx callback = CallbackPrx::uncheckedCast(base);
+
+ {
+ Lock sync(*this);
+ _initialized = true;
+ notifyAll();
+ }
+ {
+ Lock sync(*this);
+ while(!_notified)
+ {
+ wait();
+ }
+ }
+
+ //
+ // Stress the router until the connection is closed.
+ //
+ stress(callback, receiver);
+ communicator->destroy();
}
virtual void stress(const CallbackPrx& callback, const CallbackReceiverPrx&) = 0;
@@ -240,39 +240,39 @@ public:
void
notifyThread()
{
- {
- Lock sync(*this);
- while(!_initialized)
- {
- wait();
- }
- }
- {
- Lock sync(*this);
- _notified = true;
- notify();
- }
+ {
+ Lock sync(*this);
+ while(!_initialized)
+ {
+ wait();
+ }
+ }
+ {
+ Lock sync(*this);
+ _notified = true;
+ notify();
+ }
}
void
kill()
{
- try
- {
- _router->destroySession();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
+ try
+ {
+ _router->destroySession();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
}
protected:
@@ -296,28 +296,28 @@ public:
virtual void
stress(const CallbackPrx& callback, const CallbackReceiverPrx&)
{
- try
- {
- CallbackPrx cb = CallbackPrx::uncheckedCast(callback->ice_twoway());
- Context context;
- context["_fwd"] = "t";
- while(true)
- {
- cb->ice_ping(context);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1));
- }
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
+ try
+ {
+ CallbackPrx cb = CallbackPrx::uncheckedCast(callback->ice_twoway());
+ Context context;
+ context["_fwd"] = "t";
+ while(true)
+ {
+ cb->ice_ping(context);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1));
+ }
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
}
};
@@ -332,36 +332,36 @@ public:
virtual void
stress(const CallbackPrx& callback, const CallbackReceiverPrx& receiver)
{
- try
- {
- CallbackPrx cb = CallbackPrx::uncheckedCast(callback->ice_twoway());
- Context context;
- context["_fwd"] = "t";
- while(true)
- {
- cb->initiateCallback(receiver, context);
- test(_callbackReceiver->callbackOK());
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1));
- }
- }
- catch(const Ice::ConnectionLostException&)
- {
- // Session was destroyed.
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // This might be raised by the CallbackI implementation if it can't invoke on the
- // callback receiver because the session is being destroyed concurrently.
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- // This might happen if the retry fails because the communicator is destroyed.
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
+ try
+ {
+ CallbackPrx cb = CallbackPrx::uncheckedCast(callback->ice_twoway());
+ Context context;
+ context["_fwd"] = "t";
+ while(true)
+ {
+ cb->initiateCallback(receiver, context);
+ test(_callbackReceiver->callbackOK());
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1));
+ }
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ // Session was destroyed.
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // This might be raised by the CallbackI implementation if it can't invoke on the
+ // callback receiver because the session is being destroyed concurrently.
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ // This might happen if the retry fails because the communicator is destroyed.
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
}
};
@@ -376,36 +376,36 @@ public:
virtual void
stress(const CallbackPrx& callback, const CallbackReceiverPrx& receiver)
{
- try
- {
- CallbackPrx cb = CallbackPrx::uncheckedCast(callback->ice_twoway());
- Context context;
- context["_fwd"] = "t";
- while(true)
- {
- cb->initiateCallbackWithPayload(receiver, context);
- test(_callbackReceiver->callbackWithPayloadOK());
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
- }
- }
- catch(const Ice::ConnectionLostException&)
- {
- // Session was destroyed.
- }
- catch(const Ice::ObjectNotExistException&)
- {
- // This might be raised by the CallbackI implementation if it can't invoke on the
- // callback receiver because the session is being destroyed concurrently.
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- // This might happen if the retry fails because the communicator is destroyed.
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
+ try
+ {
+ CallbackPrx cb = CallbackPrx::uncheckedCast(callback->ice_twoway());
+ Context context;
+ context["_fwd"] = "t";
+ while(true)
+ {
+ cb->initiateCallbackWithPayload(receiver, context);
+ test(_callbackReceiver->callbackWithPayloadOK());
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
+ }
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ // Session was destroyed.
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ // This might be raised by the CallbackI implementation if it can't invoke on the
+ // callback receiver because the session is being destroyed concurrently.
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ // This might happen if the retry fails because the communicator is destroyed.
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
}
};
@@ -437,132 +437,132 @@ CallbackClient::run(int argc, char* argv[])
ObjectPrx routerBase;
{
- cout << "testing stringToProxy for router... " << flush;
- routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347 -t 10000");
- cout << "ok" << endl;
+ cout << "testing stringToProxy for router... " << flush;
+ routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347 -t 10000");
+ cout << "ok" << endl;
}
Glacier2::RouterPrx router;
{
- cout << "testing checked cast for router... " << flush;
- router = Glacier2::RouterPrx::checkedCast(routerBase);
- test(router);
- cout << "ok" << endl;
+ cout << "testing checked cast for router... " << flush;
+ router = Glacier2::RouterPrx::checkedCast(routerBase);
+ test(router);
+ cout << "ok" << endl;
}
{
- cout << "installing router with communicator... " << flush;
- communicator()->setDefaultRouter(router);
- cout << "ok" << endl;
+ cout << "installing router with communicator... " << flush;
+ communicator()->setDefaultRouter(router);
+ cout << "ok" << endl;
}
{
- cout << "getting the session timeout... " << flush;
- Ice::Long timeout = router->getSessionTimeout();
- test(timeout == 30);
- cout << "ok" << endl;
+ cout << "getting the session timeout... " << flush;
+ Ice::Long timeout = router->getSessionTimeout();
+ test(timeout == 30);
+ cout << "ok" << endl;
}
ObjectPrx base;
{
- cout << "testing stringToProxy for server object... " << flush;
- base = communicator()->stringToProxy("c1/callback:tcp -p 12010 -t 10000");
- cout << "ok" << endl;
+ cout << "testing stringToProxy for server object... " << flush;
+ base = communicator()->stringToProxy("c1/callback:tcp -p 12010 -t 10000");
+ cout << "ok" << endl;
}
-
+
{
- cout << "trying to ping server before session creation... " << flush;
- try
- {
- base->ice_ping();
- test(false);
- }
- catch(const ConnectionLostException&)
- {
- cout << "ok" << endl;
- }
+ cout << "trying to ping server before session creation... " << flush;
+ try
+ {
+ base->ice_ping();
+ test(false);
+ }
+ catch(const ConnectionLostException&)
+ {
+ cout << "ok" << endl;
+ }
}
Glacier2::SessionPrx session;
{
- cout << "trying to create session with wrong password... " << flush;
- try
- {
- session = router->createSession("userid", "xxx");
- test(false);
- }
- catch(const Glacier2::PermissionDeniedException&)
- {
- cout << "ok" << endl;
- }
+ cout << "trying to create session with wrong password... " << flush;
+ try
+ {
+ session = router->createSession("userid", "xxx");
+ test(false);
+ }
+ catch(const Glacier2::PermissionDeniedException&)
+ {
+ cout << "ok" << endl;
+ }
}
{
- cout << "trying to destroy non-existing session... " << flush;
- try
- {
- router->destroySession();
- test(false);
- }
- catch(const Glacier2::SessionNotExistException&)
- {
- cout << "ok" << endl;
- }
+ cout << "trying to destroy non-existing session... " << flush;
+ try
+ {
+ router->destroySession();
+ test(false);
+ }
+ catch(const Glacier2::SessionNotExistException&)
+ {
+ cout << "ok" << endl;
+ }
}
{
- cout << "creating session with correct password... " << flush;
- session = router->createSession("userid", "abc123");
- cout << "ok" << endl;
+ cout << "creating session with correct password... " << flush;
+ session = router->createSession("userid", "abc123");
+ cout << "ok" << endl;
}
{
- cout << "trying to create a second session... " << flush;
- try
- {
- router->createSession("userid", "abc123");
- test(false);
- }
- catch(const Glacier2::CannotCreateSessionException&)
- {
- cout << "ok" << endl;
- }
+ cout << "trying to create a second session... " << flush;
+ try
+ {
+ router->createSession("userid", "abc123");
+ test(false);
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ cout << "ok" << endl;
+ }
}
{
- cout << "pinging server after session creation... " << flush;
- base->ice_ping();
- cout << "ok" << endl;
+ cout << "pinging server after session creation... " << flush;
+ base->ice_ping();
+ cout << "ok" << endl;
}
CallbackPrx twoway;
{
- cout << "testing checked cast for server object... " << flush;
- twoway = CallbackPrx::checkedCast(base);
- test(twoway);
- cout << "ok" << endl;
+ cout << "testing checked cast for server object... " << flush;
+ twoway = CallbackPrx::checkedCast(base);
+ test(twoway);
+ cout << "ok" << endl;
}
ObjectAdapterPtr adapter;
{
- cout << "creating and activating callback receiver adapter with router... " << flush;
- communicator()->getProperties()->setProperty("Ice.PrintAdapterReady", "0");
- adapter = communicator()->createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
- adapter->activate();
- cout << "ok" << endl;
+ cout << "creating and activating callback receiver adapter with router... " << flush;
+ communicator()->getProperties()->setProperty("Ice.PrintAdapterReady", "0");
+ adapter = communicator()->createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
+ adapter->activate();
+ cout << "ok" << endl;
}
string category;
{
- cout << "getting category from router... " << flush;
- category = router->getCategoryForClient();
- cout << "ok" << endl;
+ cout << "getting category from router... " << flush;
+ category = router->getCategoryForClient();
+ cout << "ok" << endl;
}
CallbackReceiverI* callbackReceiverImpl;
@@ -571,38 +571,38 @@ CallbackClient::run(int argc, char* argv[])
CallbackReceiverPrx fakeTwowayR;
{
- cout << "creating and adding callback receiver object... " << flush;
- callbackReceiverImpl = new CallbackReceiverI;
- callbackReceiver = callbackReceiverImpl;
- Identity callbackReceiverIdent;
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
- twowayR = CallbackReceiverPrx::uncheckedCast(adapter->add(callbackReceiver, callbackReceiverIdent));
- Identity fakeCallbackReceiverIdent;
- fakeCallbackReceiverIdent.name = "callbackReceiver";
- fakeCallbackReceiverIdent.category = "dummy";
- fakeTwowayR = CallbackReceiverPrx::uncheckedCast(adapter->add(callbackReceiver, fakeCallbackReceiverIdent));
- cout << "ok" << endl;
+ cout << "creating and adding callback receiver object... " << flush;
+ callbackReceiverImpl = new CallbackReceiverI;
+ callbackReceiver = callbackReceiverImpl;
+ Identity callbackReceiverIdent;
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = category;
+ twowayR = CallbackReceiverPrx::uncheckedCast(adapter->add(callbackReceiver, callbackReceiverIdent));
+ Identity fakeCallbackReceiverIdent;
+ fakeCallbackReceiverIdent.name = "callbackReceiver";
+ fakeCallbackReceiverIdent.category = "dummy";
+ fakeTwowayR = CallbackReceiverPrx::uncheckedCast(adapter->add(callbackReceiver, fakeCallbackReceiverIdent));
+ cout << "ok" << endl;
}
{
- cout << "testing oneway callback... " << flush;
- CallbackPrx oneway = CallbackPrx::uncheckedCast(twoway->ice_oneway());
- CallbackReceiverPrx onewayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_oneway());
- Context context;
- context["_fwd"] = "o";
- oneway->initiateCallback(onewayR, context);
- test(callbackReceiverImpl->callbackOK());
- cout << "ok" << endl;
+ cout << "testing oneway callback... " << flush;
+ CallbackPrx oneway = CallbackPrx::uncheckedCast(twoway->ice_oneway());
+ CallbackReceiverPrx onewayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_oneway());
+ Context context;
+ context["_fwd"] = "o";
+ oneway->initiateCallback(onewayR, context);
+ test(callbackReceiverImpl->callbackOK());
+ cout << "ok" << endl;
}
{
- cout << "testing twoway callback... " << flush;
- Context context;
- context["_fwd"] = "t";
- twoway->initiateCallback(twowayR, context);
- test(callbackReceiverImpl->callbackOK());
- cout << "ok" << endl;
+ cout << "testing twoway callback... " << flush;
+ Context context;
+ context["_fwd"] = "t";
+ twoway->initiateCallback(twowayR, context);
+ test(callbackReceiverImpl->callbackOK());
+ cout << "ok" << endl;
}
//
@@ -612,292 +612,292 @@ CallbackClient::run(int argc, char* argv[])
// twoway requests (see bug 337 for more information).
//
{
- cout << "testing concurrent twoway callback... " << flush;
- Context context;
- context["_fwd"] = "t";
- AMI_Callback_initiateConcurrentCallbackIPtr cb0 = new AMI_Callback_initiateConcurrentCallbackI();
- twoway->initiateConcurrentCallback_async(cb0, 0, twowayR, context);
- AMI_Callback_initiateConcurrentCallbackIPtr cb1 = new AMI_Callback_initiateConcurrentCallbackI();
- twoway->initiateConcurrentCallback_async(cb1, 1, twowayR, context);
- AMI_Callback_initiateConcurrentCallbackIPtr cb2 = new AMI_Callback_initiateConcurrentCallbackI();
- twoway->initiateConcurrentCallback_async(cb2, 2, twowayR, context);
- test(callbackReceiverImpl->answerConcurrentCallbacks(3));
- test(cb0->waitResponse() == 0);
- test(cb1->waitResponse() == 1);
- test(cb2->waitResponse() == 2);
- cout << "ok" << endl;
- }
-
- {
- cout << "ditto, but with user exception... " << flush;
- Context context;
- context["_fwd"] = "t";
- try
- {
- twoway->initiateCallbackEx(twowayR, context);
- test(false);
- }
- catch(const CallbackException& ex)
- {
- test(ex.someValue == 3.14);
- test(ex.someString == "3.14");
- }
- test(callbackReceiverImpl->callbackOK());
- cout << "ok" << endl;
- }
-
- {
- cout << "trying twoway callback with fake category... " << flush;
- Context context;
- context["_fwd"] = "t";
- try
- {
- twoway->initiateCallback(fakeTwowayR, context);
- test(false);
- }
- catch(const ObjectNotExistException&)
- {
- cout << "ok" << endl;
- }
- }
-
- {
- cout << "testing whether other allowed category is accepted... " << flush;
- Context context;
- context["_fwd"] = "t";
- CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast(
- twoway->ice_identity(communicator()->stringToIdentity("c2/callback")));
- otherCategoryTwoway->initiateCallback(twowayR, context);
- test(callbackReceiverImpl->callbackOK());
- cout << "ok" << endl;
- }
-
- {
- cout << "testing whether disallowed category gets rejected... " << flush;
- Context context;
- context["_fwd"] = "t";
- try
- {
- CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast(
- twoway->ice_identity(communicator()->stringToIdentity("c3/callback")));
- otherCategoryTwoway->initiateCallback(twowayR, context);
- test(false);
- }
- catch(const ObjectNotExistException&)
- {
- cout << "ok" << endl;
- }
- }
-
- {
- cout << "testing whether user-id as category is accepted... " << flush;
- Context context;
- context["_fwd"] = "t";
- CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast(
- twoway->ice_identity(communicator()->stringToIdentity("_userid/callback")));
- otherCategoryTwoway->initiateCallback(twowayR, context);
- test(callbackReceiverImpl->callbackOK());
- cout << "ok" << endl;
- }
-
- {
- cout << "testing buffered mode... " << flush;
-
- //
- // Start 3 misbehaving clients.
- //
- const int nClients = 3; // Passwords need to be added to the password file if more clients are needed.
- int i;
- vector<MisbehavedClientPtr> clients;
- for(i = 0; i < nClients; ++i)
- {
- clients.push_back(new MisbehavedClient(i));
- clients.back()->start();
- clients.back()->waitForCallback();
- }
-
- //
- // Sleep for one second to make sure the router starts sending
- // the callback with the payload to the clients.
- //
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
-
- //
- // Initiate few callbacks with a large payload. Because of
- // the buffered mode, this shouldn't block even though the
- // misbehaved client are not answering their callback
- // requests.
- //
- Context context;
- context["_fwd"] = "t";
- twoway->initiateCallbackWithPayload(twowayR, context);
- test(callbackReceiverImpl->callbackWithPayloadOK());
- twoway->initiateCallbackWithPayload(twowayR, context);
- test(callbackReceiverImpl->callbackWithPayloadOK());
- twoway->initiateCallbackWithPayload(twowayR, context);
- test(callbackReceiverImpl->callbackWithPayloadOK());
- twoway->initiateCallbackWithPayload(twowayR, context);
- test(callbackReceiverImpl->callbackWithPayloadOK());
-
- for(vector<MisbehavedClientPtr>::const_iterator p = clients.begin(); p != clients.end(); ++p)
- {
- (*p)->notifyWaitCallback();
- (*p)->getThreadControl().join();
- }
-
- cout << "ok" << endl;
- }
-
- {
- cout << "stress test... " << flush;
- const int nClients = 3; // Passwords need to be added to the password file if more clients are needed.
- int i;
- vector<StressClientPtr> clients;
- for(i = 0; i < nClients; ++i)
- {
- switch(IceUtil::random(3))
- {
- case 0:
- clients.push_back(new PingStressClient(i));
- break;
- case 1:
- clients.push_back(new CallbackStressClient(i));
- break;
- case 2:
- clients.push_back(new CallbackWithPayloadStressClient(i));
- break;
- default:
- assert(false);
- break;
- }
- clients.back()->start();
- }
- for(vector<StressClientPtr>::const_iterator p = clients.begin(); p != clients.end(); ++p)
- {
- (*p)->notifyThread();
- }
-
- //
- // Let the stress client run for a bit.
- //
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(3));
-
- //
- // Send some callbacks.
- //
- Context context;
- context["_fwd"] = "t";
- twoway->initiateCallback(twowayR);
- test(callbackReceiverImpl->callbackOK());
-
- //
- // Kill the stress clients.
- //
- for(vector<StressClientPtr>::const_iterator q = clients.begin(); q != clients.end(); ++q)
- {
- (*q)->kill();
- (*q)->getThreadControl().join();
- }
-
-
- cout << "ok" << endl;
- }
-
- {
- cout << "testing server shutdown... " << flush;
- twoway->shutdown();
- // No ping, otherwise the router prints a warning message if it's
- // started with --Ice.Warn.Connections.
- cout << "ok" << endl;
- /*
- try
- {
- base->ice_ping();
- test(false);
- }
- // If we use the glacier router, the exact exception reason gets
- // lost.
- catch(const UnknownLocalException&)
- {
- cout << "ok" << endl;
- }
- */
+ cout << "testing concurrent twoway callback... " << flush;
+ Context context;
+ context["_fwd"] = "t";
+ AMI_Callback_initiateConcurrentCallbackIPtr cb0 = new AMI_Callback_initiateConcurrentCallbackI();
+ twoway->initiateConcurrentCallback_async(cb0, 0, twowayR, context);
+ AMI_Callback_initiateConcurrentCallbackIPtr cb1 = new AMI_Callback_initiateConcurrentCallbackI();
+ twoway->initiateConcurrentCallback_async(cb1, 1, twowayR, context);
+ AMI_Callback_initiateConcurrentCallbackIPtr cb2 = new AMI_Callback_initiateConcurrentCallbackI();
+ twoway->initiateConcurrentCallback_async(cb2, 2, twowayR, context);
+ test(callbackReceiverImpl->answerConcurrentCallbacks(3));
+ test(cb0->waitResponse() == 0);
+ test(cb1->waitResponse() == 1);
+ test(cb2->waitResponse() == 2);
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "ditto, but with user exception... " << flush;
+ Context context;
+ context["_fwd"] = "t";
+ try
+ {
+ twoway->initiateCallbackEx(twowayR, context);
+ test(false);
+ }
+ catch(const CallbackException& ex)
+ {
+ test(ex.someValue == 3.14);
+ test(ex.someString == "3.14");
+ }
+ test(callbackReceiverImpl->callbackOK());
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "trying twoway callback with fake category... " << flush;
+ Context context;
+ context["_fwd"] = "t";
+ try
+ {
+ twoway->initiateCallback(fakeTwowayR, context);
+ test(false);
+ }
+ catch(const ObjectNotExistException&)
+ {
+ cout << "ok" << endl;
+ }
+ }
+
+ {
+ cout << "testing whether other allowed category is accepted... " << flush;
+ Context context;
+ context["_fwd"] = "t";
+ CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast(
+ twoway->ice_identity(communicator()->stringToIdentity("c2/callback")));
+ otherCategoryTwoway->initiateCallback(twowayR, context);
+ test(callbackReceiverImpl->callbackOK());
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "testing whether disallowed category gets rejected... " << flush;
+ Context context;
+ context["_fwd"] = "t";
+ try
+ {
+ CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast(
+ twoway->ice_identity(communicator()->stringToIdentity("c3/callback")));
+ otherCategoryTwoway->initiateCallback(twowayR, context);
+ test(false);
+ }
+ catch(const ObjectNotExistException&)
+ {
+ cout << "ok" << endl;
+ }
+ }
+
+ {
+ cout << "testing whether user-id as category is accepted... " << flush;
+ Context context;
+ context["_fwd"] = "t";
+ CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast(
+ twoway->ice_identity(communicator()->stringToIdentity("_userid/callback")));
+ otherCategoryTwoway->initiateCallback(twowayR, context);
+ test(callbackReceiverImpl->callbackOK());
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "testing buffered mode... " << flush;
+
+ //
+ // Start 3 misbehaving clients.
+ //
+ const int nClients = 3; // Passwords need to be added to the password file if more clients are needed.
+ int i;
+ vector<MisbehavedClientPtr> clients;
+ for(i = 0; i < nClients; ++i)
+ {
+ clients.push_back(new MisbehavedClient(i));
+ clients.back()->start();
+ clients.back()->waitForCallback();
+ }
+
+ //
+ // Sleep for one second to make sure the router starts sending
+ // the callback with the payload to the clients.
+ //
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
+
+ //
+ // Initiate few callbacks with a large payload. Because of
+ // the buffered mode, this shouldn't block even though the
+ // misbehaved client are not answering their callback
+ // requests.
+ //
+ Context context;
+ context["_fwd"] = "t";
+ twoway->initiateCallbackWithPayload(twowayR, context);
+ test(callbackReceiverImpl->callbackWithPayloadOK());
+ twoway->initiateCallbackWithPayload(twowayR, context);
+ test(callbackReceiverImpl->callbackWithPayloadOK());
+ twoway->initiateCallbackWithPayload(twowayR, context);
+ test(callbackReceiverImpl->callbackWithPayloadOK());
+ twoway->initiateCallbackWithPayload(twowayR, context);
+ test(callbackReceiverImpl->callbackWithPayloadOK());
+
+ for(vector<MisbehavedClientPtr>::const_iterator p = clients.begin(); p != clients.end(); ++p)
+ {
+ (*p)->notifyWaitCallback();
+ (*p)->getThreadControl().join();
+ }
+
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "stress test... " << flush;
+ const int nClients = 3; // Passwords need to be added to the password file if more clients are needed.
+ int i;
+ vector<StressClientPtr> clients;
+ for(i = 0; i < nClients; ++i)
+ {
+ switch(IceUtil::random(3))
+ {
+ case 0:
+ clients.push_back(new PingStressClient(i));
+ break;
+ case 1:
+ clients.push_back(new CallbackStressClient(i));
+ break;
+ case 2:
+ clients.push_back(new CallbackWithPayloadStressClient(i));
+ break;
+ default:
+ assert(false);
+ break;
+ }
+ clients.back()->start();
+ }
+ for(vector<StressClientPtr>::const_iterator p = clients.begin(); p != clients.end(); ++p)
+ {
+ (*p)->notifyThread();
+ }
+
+ //
+ // Let the stress client run for a bit.
+ //
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(3));
+
+ //
+ // Send some callbacks.
+ //
+ Context context;
+ context["_fwd"] = "t";
+ twoway->initiateCallback(twowayR);
+ test(callbackReceiverImpl->callbackOK());
+
+ //
+ // Kill the stress clients.
+ //
+ for(vector<StressClientPtr>::const_iterator q = clients.begin(); q != clients.end(); ++q)
+ {
+ (*q)->kill();
+ (*q)->getThreadControl().join();
+ }
+
+
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "testing server shutdown... " << flush;
+ twoway->shutdown();
+ // No ping, otherwise the router prints a warning message if it's
+ // started with --Ice.Warn.Connections.
+ cout << "ok" << endl;
+ /*
+ try
+ {
+ base->ice_ping();
+ test(false);
+ }
+ // If we use the glacier router, the exact exception reason gets
+ // lost.
+ catch(const UnknownLocalException&)
+ {
+ cout << "ok" << endl;
+ }
+ */
}
{
- cout << "destroying session... " << flush;
- try
- {
- router->destroySession();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- catch(const Ice::LocalException&)
- {
- test(false);
- }
- cout << "ok" << endl;
- }
-
- {
- cout << "trying to ping server after session destruction... " << flush;
- try
- {
- base->ice_ping();
- test(false);
- }
- catch(const ConnectionLostException&)
- {
- cout << "ok" << endl;
- }
+ cout << "destroying session... " << flush;
+ try
+ {
+ router->destroySession();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ catch(const Ice::LocalException&)
+ {
+ test(false);
+ }
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "trying to ping server after session destruction... " << flush;
+ try
+ {
+ base->ice_ping();
+ test(false);
+ }
+ catch(const ConnectionLostException&)
+ {
+ cout << "ok" << endl;
+ }
}
if(argc >= 2 && strcmp(argv[1], "--shutdown") == 0)
{
- {
- cout << "uninstalling router with communicator... " << flush;
- communicator()->setDefaultRouter(0);
- cout << "ok" << endl;
- }
+ {
+ cout << "uninstalling router with communicator... " << flush;
+ communicator()->setDefaultRouter(0);
+ cout << "ok" << endl;
+ }
- ObjectPrx adminBase;
+ ObjectPrx adminBase;
- {
- cout << "testing stringToProxy for admin object... " << flush;
- adminBase = communicator()->stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000");
- cout << "ok" << endl;
- }
-
+ {
+ cout << "testing stringToProxy for admin object... " << flush;
+ adminBase = communicator()->stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000");
+ cout << "ok" << endl;
+ }
+
/*
- {
- cout << "uninstalling router with admin object... " << flush;
- adminBase->ice_router(0);
- cout << "ok" << endl;
- }
+ {
+ cout << "uninstalling router with admin object... " << flush;
+ adminBase->ice_router(0);
+ cout << "ok" << endl;
+ }
*/
- Glacier2::AdminPrx admin;
-
- {
- cout << "testing checked cast for admin object... " << flush;
- admin = Glacier2::AdminPrx::checkedCast(adminBase);
- test(admin);
- cout << "ok" << endl;
- }
-
- cout << "testing Glacier2 shutdown... " << flush;
- admin->shutdown();
- try
- {
- admin->ice_ping();
- test(false);
- }
- catch(const Ice::LocalException&)
- {
- cout << "ok" << endl;
- }
+ Glacier2::AdminPrx admin;
+
+ {
+ cout << "testing checked cast for admin object... " << flush;
+ admin = Glacier2::AdminPrx::checkedCast(adminBase);
+ test(admin);
+ cout << "ok" << endl;
+ }
+
+ cout << "testing Glacier2 shutdown... " << flush;
+ admin->shutdown();
+ try
+ {
+ admin->ice_ping();
+ test(false);
+ }
+ catch(const Ice::LocalException&)
+ {
+ cout << "ok" << endl;
+ }
}
return EXIT_SUCCESS;
diff --git a/cpp/test/Glacier2/sessionControl/Client.cpp b/cpp/test/Glacier2/sessionControl/Client.cpp
index 35b7f03f58c..e80822b6731 100644
--- a/cpp/test/Glacier2/sessionControl/Client.cpp
+++ b/cpp/test/Glacier2/sessionControl/Client.cpp
@@ -36,7 +36,7 @@ main(int argc, char* argv[])
//
initData.properties->setProperty("Ice.RetryIntervals", "-1");
initData.properties->setProperty("Ice.Warn.Connections", "0");
-
+
SessionControlClient app;
return app.main(argc, argv, initData);
}
@@ -60,8 +60,8 @@ SessionControlClient::run(int argc, char* argv[])
cout << "testing destroy... " << flush;
try
{
- session->destroyFromClient();
- test(false);
+ session->destroyFromClient();
+ test(false);
}
catch(const Ice::ConnectionLostException&)
{
@@ -69,7 +69,7 @@ SessionControlClient::run(int argc, char* argv[])
try
{
session->ice_ping();
- test(false);
+ test(false);
}
catch(const Ice::ConnectionLostException&)
{
@@ -79,16 +79,16 @@ SessionControlClient::run(int argc, char* argv[])
cout << "testing create exceptions... " << flush;
try
{
- router->createSession("rejectme", "abc123");
- test(false);
+ router->createSession("rejectme", "abc123");
+ test(false);
}
catch(const Glacier2::CannotCreateSessionException&)
{
}
try
{
- router->createSession("localexception", "abc123");
- test(false);
+ router->createSession("localexception", "abc123");
+ test(false);
}
catch(const Glacier2::CannotCreateSessionException&)
{
@@ -105,12 +105,12 @@ SessionControlClient::run(int argc, char* argv[])
admin->shutdown();
try
{
- admin->ice_ping();
- test(false);
+ admin->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
return EXIT_SUCCESS;
diff --git a/cpp/test/Glacier2/sessionControl/SessionI.cpp b/cpp/test/Glacier2/sessionControl/SessionI.cpp
index 9b88eed6126..b0d14cbb01b 100644
--- a/cpp/test/Glacier2/sessionControl/SessionI.cpp
+++ b/cpp/test/Glacier2/sessionControl/SessionI.cpp
@@ -25,13 +25,13 @@ public:
void
ice_response()
{
- _cb->ice_response();
+ _cb->ice_response();
}
void
ice_exception(const IceUtil::Exception&)
{
- test(false);
+ test(false);
}
private:
@@ -41,15 +41,15 @@ private:
Glacier2::SessionPrx
SessionManagerI::create(const string& userId, const Glacier2::SessionControlPrx& sessionControl,
- const Ice::Current& current)
+ const Ice::Current& current)
{
if(userId == "rejectme")
{
- throw Glacier2::CannotCreateSessionException("");
+ throw Glacier2::CannotCreateSessionException("");
}
if(userId == "localexception")
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(new SessionI(sessionControl)));
}
diff --git a/cpp/test/Glacier2/sessionControl/run.py b/cpp/test/Glacier2/sessionControl/run.py
index 36c3a117e1d..7cc29d5fc31 100755
--- a/cpp/test/Glacier2/sessionControl/run.py
+++ b/cpp/test/Glacier2/sessionControl/run.py
@@ -37,8 +37,8 @@ command = router + TestUtil.clientServerOptions + \
r' --Ice.OA.Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \
r' --Ice.OA.Glacier2.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' \
r' --Ice.OA.Glacier2.Server.Endpoints="default -p 12349 -t 10000"' + \
- r' --Glacier2.SessionManager="SessionManager:tcp -h 127.0.0.1 -p 12010 -t 10000"' \
- r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"'
+ r' --Glacier2.SessionManager="SessionManager:tcp -h 127.0.0.1 -p 12010 -t 10000"' \
+ r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"'
print "starting router...",
starterPipe = os.popen(command + " 2>&1")
diff --git a/cpp/test/Glacier2/ssl/Client.cpp b/cpp/test/Glacier2/ssl/Client.cpp
index 0daff0085b4..3c3e2f24b24 100755
--- a/cpp/test/Glacier2/ssl/Client.cpp
+++ b/cpp/test/Glacier2/ssl/Client.cpp
@@ -42,7 +42,7 @@ int
CallbackClient::run(int argc, char* argv[])
{
Glacier2::RouterPrx router = Glacier2::RouterPrx::uncheckedCast(
- communicator()->stringToProxy("Glacier2/router:tcp -h 127.0.0.1 -p 12347 -t 10000"));
+ communicator()->stringToProxy("Glacier2/router:tcp -h 127.0.0.1 -p 12347 -t 10000"));
communicator()->setDefaultRouter(router);
//
@@ -51,24 +51,24 @@ CallbackClient::run(int argc, char* argv[])
cout << "creating non-ssl session with tcp connection... ";
try
{
- Glacier2::SessionPrx session = router->createSession("nossl", "");
- session->ice_ping();
- router->destroySession();
+ Glacier2::SessionPrx session = router->createSession("nossl", "");
+ session->ice_ping();
+ router->destroySession();
}
catch(const Ice::ConnectionLostException&)
{
}
catch(const Glacier2::PermissionDeniedException&)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
cout << "creating ssl session with tcp connection... ";
try
{
- Glacier2::SessionPrx session = router->createSessionFromSecureConnection();
- test(false);
+ Glacier2::SessionPrx session = router->createSessionFromSecureConnection();
+ test(false);
}
catch(const Glacier2::PermissionDeniedException&)
{
@@ -81,7 +81,7 @@ CallbackClient::run(int argc, char* argv[])
//
communicator()->setDefaultRouter(Glacier2::RouterPrx());
router = Glacier2::RouterPrx::uncheckedCast(
- communicator()->stringToProxy("Glacier2/router:ssl -h 127.0.0.1 -p 12348 -t 10000"));
+ communicator()->stringToProxy("Glacier2/router:ssl -h 127.0.0.1 -p 12348 -t 10000"));
communicator()->setDefaultRouter(router);
//
@@ -90,38 +90,38 @@ CallbackClient::run(int argc, char* argv[])
cout << "creating non-ssl session with ssl connection... ";
try
{
- Glacier2::SessionPrx session = router->createSession("nossl", "");
- session->ice_ping();
- router->destroySession();
+ Glacier2::SessionPrx session = router->createSession("nossl", "");
+ session->ice_ping();
+ router->destroySession();
}
catch(const Ice::ConnectionLostException&)
{
}
catch(const Glacier2::PermissionDeniedException&)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
cout << "creating ssl session with ssl connection... ";
try
{
- Glacier2::SessionPrx session = router->createSessionFromSecureConnection();
- session->ice_ping();
- router->destroySession();
+ Glacier2::SessionPrx session = router->createSessionFromSecureConnection();
+ session->ice_ping();
+ router->destroySession();
}
catch(const Ice::ConnectionLostException&)
{
}
catch(const Glacier2::PermissionDeniedException&)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
communicator()->setDefaultRouter(0);
Glacier2::AdminPrx admin = Glacier2::AdminPrx::checkedCast(
- communicator()->stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12349 -t 10000"));
+ communicator()->stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12349 -t 10000"));
admin->shutdown();
return EXIT_SUCCESS;
diff --git a/cpp/test/Glacier2/ssl/Server.cpp b/cpp/test/Glacier2/ssl/Server.cpp
index 1f4ba1db3f6..8221b47f966 100755
--- a/cpp/test/Glacier2/ssl/Server.cpp
+++ b/cpp/test/Glacier2/ssl/Server.cpp
@@ -22,15 +22,15 @@ public:
virtual bool
authorize(const Glacier2::SSLInfo& info, string&, const Ice::Current& current) const
{
- IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
- test(cert->getIssuerDN() == IceSSL::DistinguishedName(
- "emailAddress=info@zeroc.com,CN=ZeroC Test CA,OU=Ice,O=ZeroC\\, Inc.,"
- "L=Palm Beach Gardens,ST=Florida,C=US"));
- test(cert->getSubjectDN() == IceSSL::DistinguishedName(
- "CN=Client,emailAddress=info@zeroc.com,OU=Ice,O=ZeroC\\, Inc.,ST=Florida,C=US"));
- test(cert->checkValidity());
-
- return true;
+ IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
+ test(cert->getIssuerDN() == IceSSL::DistinguishedName(
+ "emailAddress=info@zeroc.com,CN=ZeroC Test CA,OU=Ice,O=ZeroC\\, Inc.,"
+ "L=Palm Beach Gardens,ST=Florida,C=US"));
+ test(cert->getSubjectDN() == IceSSL::DistinguishedName(
+ "CN=Client,emailAddress=info@zeroc.com,OU=Ice,O=ZeroC\\, Inc.,ST=Florida,C=US"));
+ test(cert->checkValidity());
+
+ return true;
}
};
@@ -45,20 +45,20 @@ public:
virtual void
destroy(const Ice::Current& current)
{
- //
- // If SSL, test that Glacier2.AddSSLContext is working.
- //
+ //
+ // If SSL, test that Glacier2.AddSSLContext is working.
+ //
if(_ssl)
- {
- Ice::Context::const_iterator p = current.ctx.find("SSL.Active");
- assert(p != current.ctx.end() && p->second == "1");
- }
-
- current.adapter->remove(current.id);
- if(_shutdown)
- {
- current.adapter->getCommunicator()->shutdown();
- }
+ {
+ Ice::Context::const_iterator p = current.ctx.find("SSL.Active");
+ assert(p != current.ctx.end() && p->second == "1");
+ }
+
+ current.adapter->remove(current.id);
+ if(_shutdown)
+ {
+ current.adapter->getCommunicator()->shutdown();
+ }
}
private:
const bool _shutdown;
@@ -72,8 +72,8 @@ public:
virtual Glacier2::SessionPrx
create(const string& userId, const Glacier2::SessionControlPrx&, const Ice::Current& current)
{
- Glacier2::SessionPtr session = new SessionI(false, false);
- return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session));
+ Glacier2::SessionPtr session = new SessionI(false, false);
+ return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session));
}
};
@@ -84,26 +84,26 @@ public:
virtual Glacier2::SessionPrx
create(const Glacier2::SSLInfo& info, const Glacier2::SessionControlPrx&, const Ice::Current& current)
{
- test(info.remoteHost == "127.0.0.1");
- test(info.localHost == "127.0.0.1");
- test(info.localPort == 12348);
- try
- {
- IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
- test(cert->getIssuerDN() == IceSSL::DistinguishedName(
- "emailAddress=info@zeroc.com,CN=ZeroC Test CA,OU=Ice,O=ZeroC\\, Inc.,L=Palm Beach Gardens,"
- "ST=Florida,C=US"));
- test(cert->getSubjectDN() == IceSSL::DistinguishedName(
- "CN=Client,emailAddress=info@zeroc.com,OU=Ice,O=ZeroC\\, Inc.,ST=Florida,C=US"));
- test(cert->checkValidity());
- }
- catch(const IceSSL::CertificateReadException&)
- {
- test(false);
- }
-
- Glacier2::SessionPtr session = new SessionI(true, true);
- return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session));
+ test(info.remoteHost == "127.0.0.1");
+ test(info.localHost == "127.0.0.1");
+ test(info.localPort == 12348);
+ try
+ {
+ IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
+ test(cert->getIssuerDN() == IceSSL::DistinguishedName(
+ "emailAddress=info@zeroc.com,CN=ZeroC Test CA,OU=Ice,O=ZeroC\\, Inc.,L=Palm Beach Gardens,"
+ "ST=Florida,C=US"));
+ test(cert->getSubjectDN() == IceSSL::DistinguishedName(
+ "CN=Client,emailAddress=info@zeroc.com,OU=Ice,O=ZeroC\\, Inc.,ST=Florida,C=US"));
+ test(cert->checkValidity());
+ }
+ catch(const IceSSL::CertificateReadException&)
+ {
+ test(false);
+ }
+
+ Glacier2::SessionPtr session = new SessionI(true, true);
+ return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session));
}
};
@@ -125,7 +125,7 @@ int
SessionServer::run(int argc, char* argv[])
{
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints(
- "SessionServer", "tcp -h 127.0.0.1 -p 12350 -t 10000");
+ "SessionServer", "tcp -h 127.0.0.1 -p 12350 -t 10000");
adapter->add(new SSLPermissionsVerifierI, communicator()->stringToIdentity("sslverifier"));
adapter->add(new SessionManagerI, communicator()->stringToIdentity("sessionmanager"));
adapter->add(new SSLSessionManagerI, communicator()->stringToIdentity("sslsessionmanager"));
diff --git a/cpp/test/Glacier2/ssl/run.py b/cpp/test/Glacier2/ssl/run.py
index 607229590c2..627efff9342 100755
--- a/cpp/test/Glacier2/ssl/run.py
+++ b/cpp/test/Glacier2/ssl/run.py
@@ -43,7 +43,7 @@ command = router + TestUtil.clientServerOptions + \
r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \
r' --Glacier2.SSLSessionManager="sslsessionmanager:tcp -h 127.0.0.1 -p 12350 -t 10000"' + \
r' --Glacier2.SSLPermissionsVerifier="sslverifier:tcp -h 127.0.0.1 -p 12350 -t 10000"' + \
- r" --Ice.Plugin.IceSSL=IceSSL:createIceSSL" + \
+ r" --Ice.Plugin.IceSSL=IceSSL:createIceSSL" + \
r" --IceSSL.DefaultDir=" + os.path.join(toplevel, "certs") + \
r' --IceSSL.CertFile=s_rsa1024_pub.pem' + \
r' --IceSSL.KeyFile=s_rsa1024_priv.pem' + \
@@ -57,7 +57,7 @@ print "ok"
client = os.path.join(testdir, "client")
command = client + TestUtil.clientOptions + \
- " --Ice.Plugin.IceSSL=IceSSL:createIceSSL" + \
+ " --Ice.Plugin.IceSSL=IceSSL:createIceSSL" + \
" --IceSSL.DefaultDir=" + os.path.join(toplevel, "certs") + \
" --IceSSL.CertFile=c_rsa1024_pub.pem" + \
" --IceSSL.KeyFile=c_rsa1024_priv.pem" + \
diff --git a/cpp/test/Glacier2/staticFiltering/Client.cpp b/cpp/test/Glacier2/staticFiltering/Client.cpp
index 4863e858857..d6990d801e5 100755
--- a/cpp/test/Glacier2/staticFiltering/Client.cpp
+++ b/cpp/test/Glacier2/staticFiltering/Client.cpp
@@ -38,7 +38,7 @@ main(int argc, char* argv[])
// proxies, even with regular retries disabled.
//
initData.properties->setProperty("Ice.RetryIntervals", "-1");
-
+
AttackClient app;
return app.main(argc, argv, initData);
}
@@ -56,85 +56,85 @@ AttackClient::run(int argc, char* argv[])
PropertyDict badProxies = communicator()->getProperties()->getPropertiesForPrefix("Reject.Proxy.");
for(p = badProxies.begin(); p != badProxies.end(); ++p)
{
- try
- {
- Glacier2::SessionPrx session = router->createSession("userid", "abc123");
- }
- catch(const Glacier2::CannotCreateSessionException&)
- {
- test("Unable to create new session" == 0);
- }
- BackendPrx backend = BackendPrx::uncheckedCast(communicator()->stringToProxy(p->second));
- try
- {
- backend->ice_ping();
- cerr << "Test failed on : " << p->second << endl;
- test("Expected exception" == 0);
- }
- catch(const ConnectionLostException&)
- {
- //
- // This is ok.
- //
- }
- catch(const CloseConnectionException&)
- {
- //
- // This is also ok.
- //
- }
- catch(const ObjectNotExistException&)
- {
- //
- // This is ok for non-address filters.
- //
- try
- {
- router->destroySession();
- }
- catch(...)
- {
- }
- }
- catch(const LocalException& e)
- {
- cerr << e << endl;
- test("Unexpected local exception" == 0);
- }
+ try
+ {
+ Glacier2::SessionPrx session = router->createSession("userid", "abc123");
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ test("Unable to create new session" == 0);
+ }
+ BackendPrx backend = BackendPrx::uncheckedCast(communicator()->stringToProxy(p->second));
+ try
+ {
+ backend->ice_ping();
+ cerr << "Test failed on : " << p->second << endl;
+ test("Expected exception" == 0);
+ }
+ catch(const ConnectionLostException&)
+ {
+ //
+ // This is ok.
+ //
+ }
+ catch(const CloseConnectionException&)
+ {
+ //
+ // This is also ok.
+ //
+ }
+ catch(const ObjectNotExistException&)
+ {
+ //
+ // This is ok for non-address filters.
+ //
+ try
+ {
+ router->destroySession();
+ }
+ catch(...)
+ {
+ }
+ }
+ catch(const LocalException& e)
+ {
+ cerr << e << endl;
+ test("Unexpected local exception" == 0);
+ }
}
PropertyDict goodProxies = communicator()->getProperties()->getPropertiesForPrefix("Accept.Proxy.");
for(p = goodProxies.begin(); p != goodProxies.end(); ++p)
{
- try
- {
- Glacier2::SessionPrx session = router->createSession("userid", "abc123");
- }
- catch(const Glacier2::CannotCreateSessionException&)
- {
- test("Unable to create new session" == 0);
- }
- BackendPrx backend = BackendPrx::uncheckedCast(communicator()->stringToProxy(p->second));
- try
- {
- backend->ice_ping();
- }
- catch(const LocalException& ex)
- {
- cerr << p->second << endl;
- cerr << ex << endl;
- test("Unexpected local exception" == 0);
- }
- try
- {
- router->destroySession();
- }
- catch(const LocalException&)
- {
- //
- // Expected.
- //
- }
+ try
+ {
+ Glacier2::SessionPrx session = router->createSession("userid", "abc123");
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ test("Unable to create new session" == 0);
+ }
+ BackendPrx backend = BackendPrx::uncheckedCast(communicator()->stringToProxy(p->second));
+ try
+ {
+ backend->ice_ping();
+ }
+ catch(const LocalException& ex)
+ {
+ cerr << p->second << endl;
+ cerr << ex << endl;
+ test("Unexpected local exception" == 0);
+ }
+ try
+ {
+ router->destroySession();
+ }
+ catch(const LocalException&)
+ {
+ //
+ // Expected.
+ //
+ }
}
//
@@ -144,28 +144,28 @@ AttackClient::run(int argc, char* argv[])
communicator()->setDefaultRouter(0);
try
{
- BackendPrx backend = BackendPrx::checkedCast(communicator()->stringToProxy("dummy:tcp -p 12010 -t 10000"));
- backend->shutdown();
+ BackendPrx backend = BackendPrx::checkedCast(communicator()->stringToProxy("dummy:tcp -p 12010 -t 10000"));
+ backend->shutdown();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
try
{
- ObjectPrx adminBase = communicator()->stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000");
- Glacier2::AdminPrx admin = Glacier2::AdminPrx::checkedCast(adminBase);
- test(admin);
- admin->shutdown();
- try
- {
- admin->ice_ping();
- test(false);
- }
- catch(const Ice::LocalException&)
- {
- }
+ ObjectPrx adminBase = communicator()->stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000");
+ Glacier2::AdminPrx admin = Glacier2::AdminPrx::checkedCast(adminBase);
+ test(admin);
+ admin->shutdown();
+ try
+ {
+ admin->ice_ping();
+ test(false);
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
}
catch(const Ice::LocalException&)
{
diff --git a/cpp/test/Glacier2/staticFiltering/Server.cpp b/cpp/test/Glacier2/staticFiltering/Server.cpp
index 522747f23c9..e12ef11ac56 100644
--- a/cpp/test/Glacier2/staticFiltering/Server.cpp
+++ b/cpp/test/Glacier2/staticFiltering/Server.cpp
@@ -26,23 +26,23 @@ public:
virtual void
setAdapterDirectProxy_async(const AMD_LocatorRegistry_setAdapterDirectProxyPtr& cb, const string&,
- const ObjectPrx&, const Current&)
+ const ObjectPrx&, const Current&)
{
- cb->ice_response();
+ cb->ice_response();
}
virtual void
setReplicatedAdapterDirectProxy_async(const AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr& cb,
- const string&, const string&, const ObjectPrx&, const Current&)
+ const string&, const string&, const ObjectPrx&, const Current&)
{
- cb->ice_response();
+ cb->ice_response();
}
virtual void
setServerProcessProxy_async(const AMD_LocatorRegistry_setServerProcessProxyPtr& cb,
- const string&, const ProcessPrx&, const Current&)
+ const string&, const ProcessPrx&, const Current&)
{
- cb->ice_response();
+ cb->ice_response();
}
};
@@ -50,30 +50,30 @@ class ServerLocatorI : virtual public Locator
{
public:
ServerLocatorI(const BackendPtr& backend, const ObjectAdapterPtr& adapter) :
- _backend(backend),
- _adapter(adapter),
- _registryPrx(
- LocatorRegistryPrx::uncheckedCast(
- adapter->add(new ServerLocatorRegistry, _adapter->getCommunicator()->stringToIdentity("registry"))))
+ _backend(backend),
+ _adapter(adapter),
+ _registryPrx(
+ LocatorRegistryPrx::uncheckedCast(
+ adapter->add(new ServerLocatorRegistry, _adapter->getCommunicator()->stringToIdentity("registry"))))
{
}
virtual void
findObjectById_async(const AMD_Locator_findObjectByIdPtr& cb, const Identity& id, const Current&) const
{
- cb->ice_response(_adapter->createProxy(id));
+ cb->ice_response(_adapter->createProxy(id));
}
virtual void
findAdapterById_async(const AMD_Locator_findAdapterByIdPtr& cb, const string& id, const Current& current) const
{
- cb->ice_response(_adapter->createDirectProxy(_adapter->getCommunicator()->stringToIdentity("dummy")));
+ cb->ice_response(_adapter->createDirectProxy(_adapter->getCommunicator()->stringToIdentity("dummy")));
}
virtual LocatorRegistryPrx
getRegistry(const Current&) const
{
- return _registryPrx;
+ return _registryPrx;
}
private:
@@ -87,13 +87,13 @@ class ServantLocatorI : virtual public ServantLocator
public:
ServantLocatorI(const BackendPtr& backend) :
- _backend(backend)
+ _backend(backend)
{
}
-
+
virtual ObjectPtr locate(const Current&, LocalObjectPtr&)
{
- return _backend;
+ return _backend;
}
virtual void finished(const Current&, const ObjectPtr&, const LocalObjectPtr&)
@@ -127,8 +127,8 @@ int
BackendServer::run(int argc, char* argv[])
{
string endpoints =
- communicator()->getProperties()->getPropertyWithDefault("Ice.OA.BackendAdapter.Endpoints",
- "tcp -p 12010 -t 20000:ssl -p 12011 -t 20000");
+ communicator()->getProperties()->getPropertyWithDefault("Ice.OA.BackendAdapter.Endpoints",
+ "tcp -p 12010 -t 20000:ssl -p 12011 -t 20000");
communicator()->getProperties()->setProperty("Ice.OA.BackendAdapter.Endpoints", endpoints);
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("BackendAdapter");
diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py
index bdf613b49ad..9cd9fba26d3 100755
--- a/cpp/test/Glacier2/staticFiltering/run.py
+++ b/cpp/test/Glacier2/staticFiltering/run.py
@@ -69,9 +69,9 @@ else:
# the FQDN.
#
if fqdn == hostname:
- hostname = hostname[:dot]
+ hostname = hostname[:dot]
if domainname == "":
- limitedTests = True
+ limitedTests = True
try:
testaddr = socket.gethostbyname(fqdn)
testaddr = socket.gethostbyname(hostname)
@@ -82,106 +82,106 @@ except:
domainname = ""
testcases = [
- ('testing category filter',
- ('', '', '', 'foo "a cat with spaces"', '', ''),
- [(True, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010')], []),
- ('testing adapter id filter',
- ('', '*', '', '', '', 'foo "an adapter with spaces"'),
- [(False, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
- (False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'helloE @ bar'),
- (True, 'helloF1 @ "an adapter with spaces"'),
- (True, 'helloF @ foo')], []),
- ('test identity filters',
- ('', '', '', '', 'myident cata/fooa "a funny id/that might mess it up"', ''),
- [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
- (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
- ('test mixing filters',
- ('', '', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up" "a\\"nother"',
- 'myadapter'),
- [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
- (True, 'mycat/foo @ jimbo'),
- (False, 'hiscatA @ jimbo'),
- (True, 'hiscat @ myadapter'),
- (True, 'a\"nother @ jimbo'),
- (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
- (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
- ('test mixing filters (indirect only)',
- ('', '*', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up"', 'myadapter'),
- [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (False, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (False, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
- (True, 'mycat/foo @ jimbo'),
- (False, 'hiscatA @ jimbo'),
- (True, 'hiscat @ myadapter'),
- (False, 'myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a funny id/that might mess it up" @ myadapter'),
- (False, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
- ]
+ ('testing category filter',
+ ('', '', '', 'foo "a cat with spaces"', '', ''),
+ [(True, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010')], []),
+ ('testing adapter id filter',
+ ('', '*', '', '', '', 'foo "an adapter with spaces"'),
+ [(False, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
+ (False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'helloE @ bar'),
+ (True, 'helloF1 @ "an adapter with spaces"'),
+ (True, 'helloF @ foo')], []),
+ ('test identity filters',
+ ('', '', '', '', 'myident cata/fooa "a funny id/that might mess it up"', ''),
+ [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
+ ('test mixing filters',
+ ('', '', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up" "a\\"nother"',
+ 'myadapter'),
+ [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
+ (True, 'mycat/foo @ jimbo'),
+ (False, 'hiscatA @ jimbo'),
+ (True, 'hiscat @ myadapter'),
+ (True, 'a\"nother @ jimbo'),
+ (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
+ ('test mixing filters (indirect only)',
+ ('', '*', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up"', 'myadapter'),
+ [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (False, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
+ (True, 'mycat/foo @ jimbo'),
+ (False, 'hiscatA @ jimbo'),
+ (True, 'hiscat @ myadapter'),
+ (False, 'myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a funny id/that might mess it up" @ myadapter'),
+ (False, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
+ ]
if not limitedTests:
testcases.extend([
- ('testing reject all',
- (r'', r'*', r'', '', '', ''),
- [(False, 'helloA:tcp -h %s -p 12010' % fqdn),
- (False, 'helloB:tcp -h %s -p 12010' % hostname),
- (False, 'helloC:tcp -h 127.0.0.1 -p 12010'),
- (True, 'bar @ foo')], []),
- ('testing loopback only rule',
- (r'127.0.0.1 localhost', r'', r'', '', '', ''),
- [(False, 'hello:tcp -h %s -p 12010' % fqdn),
- (False, 'hello:tcp -h %s -p 12010' % hostname),
- (False, '127.0.0.1:tcp -h %s -p 12010' % hostname),
- (False, 'localhost:tcp -h %s -p 12010' % hostname),
- (False, 'localhost/127.0.0.1:tcp -h %s -p 12010' % hostname),
- (True, 'localhost:tcp -h 127.0.0.1 -p 12010'),
- (True, 'localhost/127.0.0.1:tcp -h localhost -p 12010'),
- (True, r'hello:tcp -h 127.0.0.1 -p 12010'),
- (True, r'hello/somecat:tcp -h localhost -p 12010')], []),
- ('testing domain filter rule (accept)',
- ("*" + domainname, r'', r'', '', '', ''),
- [(True, 'hello:tcp -h %s -p 12010' % fqdn),
- (False, 'hello:tcp -h %s -p 12010' % hostname)], []),
- ('testing domain filter rule (reject)',
- (r'', "*" + domainname, r'', '', '', ''),
- [(False, 'hello:tcp -h %s -p 12010' % fqdn),
- (True, 'hello:tcp -h %s -p 12010' % hostname),
- (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
- ('testing domain filter rule (mixed)',
- ("127.0.0.1", fqdn, r'', '', '', ''),
- [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn),
- (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
- ('testing maximum proxy length rule',
- (r'', r'', r'40', '', '', ''),
- [(True, 'hello:tcp -h 127.0.0.1 -p 12010'),
- (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []),
- ])
+ ('testing reject all',
+ (r'', r'*', r'', '', '', ''),
+ [(False, 'helloA:tcp -h %s -p 12010' % fqdn),
+ (False, 'helloB:tcp -h %s -p 12010' % hostname),
+ (False, 'helloC:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'bar @ foo')], []),
+ ('testing loopback only rule',
+ (r'127.0.0.1 localhost', r'', r'', '', '', ''),
+ [(False, 'hello:tcp -h %s -p 12010' % fqdn),
+ (False, 'hello:tcp -h %s -p 12010' % hostname),
+ (False, '127.0.0.1:tcp -h %s -p 12010' % hostname),
+ (False, 'localhost:tcp -h %s -p 12010' % hostname),
+ (False, 'localhost/127.0.0.1:tcp -h %s -p 12010' % hostname),
+ (True, 'localhost:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'localhost/127.0.0.1:tcp -h localhost -p 12010'),
+ (True, r'hello:tcp -h 127.0.0.1 -p 12010'),
+ (True, r'hello/somecat:tcp -h localhost -p 12010')], []),
+ ('testing domain filter rule (accept)',
+ ("*" + domainname, r'', r'', '', '', ''),
+ [(True, 'hello:tcp -h %s -p 12010' % fqdn),
+ (False, 'hello:tcp -h %s -p 12010' % hostname)], []),
+ ('testing domain filter rule (reject)',
+ (r'', "*" + domainname, r'', '', '', ''),
+ [(False, 'hello:tcp -h %s -p 12010' % fqdn),
+ (True, 'hello:tcp -h %s -p 12010' % hostname),
+ (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
+ ('testing domain filter rule (mixed)',
+ ("127.0.0.1", fqdn, r'', '', '', ''),
+ [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn),
+ (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
+ ('testing maximum proxy length rule',
+ (r'', r'', r'40', '', '', ''),
+ [(True, 'hello:tcp -h 127.0.0.1 -p 12010'),
+ (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []),
+ ])
if len(testcases) == 0:
print "WARNING: You are running this test with SSL disabled and the network "
@@ -214,20 +214,20 @@ for testcase in testcases:
sys.stdout.write(description)
for expect, proxy in attacks:
- if expect:
- attackcfg.write('Accept.Proxy.' + str(accepts) + '=')
- accepts +=1
- else:
- attackcfg.write('Reject.Proxy.' + str(rejects) + '=')
- rejects +=1
- attackcfg.write(proxy + '\n')
+ if expect:
+ attackcfg.write('Accept.Proxy.' + str(accepts) + '=')
+ accepts +=1
+ else:
+ attackcfg.write('Reject.Proxy.' + str(rejects) + '=')
+ rejects +=1
+ attackcfg.write(proxy + '\n')
attackcfg.close()
pingProgress()
hostArg = ""
if limitedTests:
- hostArg = " --Ice.Default.Host=127.0.0.1"
+ hostArg = " --Ice.Default.Host=127.0.0.1"
#
@@ -237,8 +237,8 @@ for testcase in testcases:
#
commonClientOptions = " --Ice.NullHandleAbort=1 --Ice.PrintProcessId=1" + hostArg
commonServerOptions = r' --Ice.PrintProcessId --Ice.PrintAdapterReady --Ice.NullHandleAbort=1' + \
- r' --Ice.ServerIdleTime=600 --Ice.ThreadPool.Server.Size=2 --Ice.ThreadPool.Server.SizeMax=10' + \
- r' --Glacier2.RoutingTable.MaxSize=10 ' + hostArg
+ r' --Ice.ServerIdleTime=600 --Ice.ThreadPool.Server.Size=2 --Ice.ThreadPool.Server.SizeMax=10' + \
+ r' --Glacier2.RoutingTable.MaxSize=10 ' + hostArg
#
# We cannot use the TestUtil options because they use localhost as the default host which doesn't really work for
@@ -267,36 +267,36 @@ for testcase in testcases:
# Regular expression syntax can easily confuse the command line.
#
if not len(acceptFilter) == 0:
- routerConfig.write("Glacier2.Filter.Address.Accept=%s\n" % acceptFilter)
+ routerConfig.write("Glacier2.Filter.Address.Accept=%s\n" % acceptFilter)
if not len(rejectFilter) == 0:
- routerConfig.write("Glacier2.Filter.Address.Reject=%s\n" % rejectFilter)
+ routerConfig.write("Glacier2.Filter.Address.Reject=%s\n" % rejectFilter)
if not len(maxEndpoints) == 0:
- routerConfig.write("Glacier2.Filter.ProxySizeMax=%s\n" % maxEndpoints)
+ routerConfig.write("Glacier2.Filter.ProxySizeMax=%s\n" % maxEndpoints)
if not len(categoryFilter) == 0:
- routerConfig.write("Glacier2.Filter.Category.Accept=%s\n" % categoryFilter)
+ routerConfig.write("Glacier2.Filter.Category.Accept=%s\n" % categoryFilter)
if not len(idFilter) == 0:
- routerConfig.write("Glacier2.Filter.Identity.Accept=%s\n" % idFilter)
+ routerConfig.write("Glacier2.Filter.Identity.Accept=%s\n" % idFilter)
if not len(adapterFilter) == 0:
- routerConfig.write("Glacier2.Filter.AdapterId.Accept=%s\n" % adapterFilter)
+ routerConfig.write("Glacier2.Filter.AdapterId.Accept=%s\n" % adapterFilter)
routerConfig.close()
if TestUtil.debug:
- print "(" + routerCmd + ")",
+ print "(" + routerCmd + ")",
starterPipe = os.popen(routerCmd + " 2>&1")
TestUtil.getServerPid(starterPipe)
TestUtil.getAdapterReady(starterPipe)
pingProgress()
if TestUtil.protocol != "ssl":
- serverConfig = file(os.path.join(testdir, "server.cfg"), "w")
- serverOptions = ' --Ice.Config=' + os.path.join(testdir, "server.cfg") + " " + serverOptions
- serverConfig.write("Ice.OA.BackendAdapter.Endpoints=tcp -p 12010 -t 20000\n")
- serverConfig.close()
+ serverConfig = file(os.path.join(testdir, "server.cfg"), "w")
+ serverOptions = ' --Ice.Config=' + os.path.join(testdir, "server.cfg") + " " + serverOptions
+ serverConfig.write("Ice.OA.BackendAdapter.Endpoints=tcp -p 12010 -t 20000\n")
+ serverConfig.close()
serverCmd = os.path.join(testdir, 'server') + serverOptions
if TestUtil.debug:
- print "(" + serverCmd + ")",
+ print "(" + serverCmd + ")",
serverPipe = os.popen(serverCmd + " 2>&1")
TestUtil.getServerPid(serverPipe)
TestUtil.getAdapterReady(serverPipe)
@@ -312,7 +312,7 @@ for testcase in testcases:
clientCmd = os.path.join(testdir, 'client') + clientOptions + \
" --Ice.Config=" + os.path.join(testdir, 'attack.cfg') + " "
if TestUtil.debug:
- print "(" + clientCmd + ")",
+ print "(" + clientCmd + ")",
clientPipe = os.popen(clientCmd + " 2>&1")
TestUtil.ignorePid(clientPipe)
@@ -320,9 +320,9 @@ for testcase in testcases:
clientStatus = TestUtil.closePipe(clientPipe)
if clientStatus:
- TestUtil.killServers()
+ TestUtil.killServers()
if clientStatus or TestUtil.serverStatus():
- sys.exit(1)
+ sys.exit(1)
sys.exit(0)
diff --git a/cpp/test/Ice/adapterDeactivation/AllTests.cpp b/cpp/test/Ice/adapterDeactivation/AllTests.cpp
index e449ad33f54..4b39523946a 100644
--- a/cpp/test/Ice/adapterDeactivation/AllTests.cpp
+++ b/cpp/test/Ice/adapterDeactivation/AllTests.cpp
@@ -31,23 +31,23 @@ allTests(const CommunicatorPtr& communicator)
{
cout << "creating/destroying/recreating object adapter... " << flush;
- ObjectAdapterPtr adapter =
- communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
- try
- {
- communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998");
- test(false);
- }
- catch(const AlreadyRegisteredException&)
- {
- }
- adapter->destroy();
+ ObjectAdapterPtr adapter =
+ communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
+ try
+ {
+ communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998");
+ test(false);
+ }
+ catch(const AlreadyRegisteredException&)
+ {
+ }
+ adapter->destroy();
- //
- // Use a different port than the first adapter to avoid an "address already in use" error.
- //
- adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998");
- adapter->destroy();
+ //
+ // Use a different port than the first adapter to avoid an "address already in use" error.
+ //
+ adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998");
+ adapter->destroy();
cout << "ok" << endl;
}
@@ -62,12 +62,12 @@ allTests(const CommunicatorPtr& communicator)
cout << "testing whether server is gone... " << flush;
try
{
- obj->ice_ping();
- test(false);
+ obj->ice_ping();
+ test(false);
}
catch(const LocalException&)
{
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
return obj;
diff --git a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp
index 67e361ab6b5..2347ebac86e 100644
--- a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp
+++ b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp
@@ -40,7 +40,7 @@ ServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie
void
ServantLocatorI::finished(const Ice::Current& current, const Ice::ObjectPtr& servant,
- const Ice::LocalObjectPtr& cookie)
+ const Ice::LocalObjectPtr& cookie)
{
test(!_deactivated);
diff --git a/cpp/test/Ice/adapterDeactivation/TestI.cpp b/cpp/test/Ice/adapterDeactivation/TestI.cpp
index f43409c46f3..18bd51cb0ae 100644
--- a/cpp/test/Ice/adapterDeactivation/TestI.cpp
+++ b/cpp/test/Ice/adapterDeactivation/TestI.cpp
@@ -20,7 +20,7 @@ TestI::transient(const Current& current)
CommunicatorPtr communicator = current.adapter->getCommunicator();
ObjectAdapterPtr adapter =
- communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
+ communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
adapter->activate();
adapter->destroy();
}
diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp
index 15502bfcfaf..5503d099c78 100644
--- a/cpp/test/Ice/binding/AllTests.cpp
+++ b/cpp/test/Ice/binding/AllTests.cpp
@@ -33,27 +33,27 @@ public:
virtual void
ice_response(const string& name)
{
- Lock sync(*this);
- assert(!name.empty());
- _name = name;
- notify();
+ Lock sync(*this);
+ assert(!name.empty());
+ _name = name;
+ notify();
}
virtual void
ice_exception(const Ice::Exception&)
{
- test(false);
+ test(false);
}
virtual string
getResult()
{
- Lock sync(*this);
- while(_name.empty())
- {
- wait();
- }
- return _name;
+ Lock sync(*this);
+ while(_name.empty())
+ {
+ wait();
+ }
+ return _name;
}
private:
@@ -77,9 +77,9 @@ createTestIntfPrx(vector<RemoteObjectAdapterPrx>& adapters)
TestIntfPrx test;
for(vector<RemoteObjectAdapterPrx>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- test = (*p)->getTestIntf();
- Ice::EndpointSeq edpts = test->ice_getEndpoints();
- endpoints.insert(endpoints.end(), edpts.begin(), edpts.end());
+ test = (*p)->getTestIntf();
+ Ice::EndpointSeq edpts = test->ice_getEndpoints();
+ endpoints.insert(endpoints.end(), edpts.begin(), edpts.end());
}
return TestIntfPrx::uncheckedCast(test->ice_endpoints(endpoints));
}
@@ -89,7 +89,7 @@ deactivate(const RemoteCommunicatorPrx& com, vector<RemoteObjectAdapterPrx>& ada
{
for(vector<RemoteObjectAdapterPrx>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- com->deactivateObjectAdapter(*p);
+ com->deactivateObjectAdapter(*p);
}
}
@@ -103,600 +103,600 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing binding with single endpoint... " << flush;
{
- RemoteObjectAdapterPrx adapter = com->createObjectAdapter("Adapter", "default");
-
- TestIntfPrx test1 = adapter->getTestIntf();
- TestIntfPrx test2 = adapter->getTestIntf();
- test(test1->ice_getConnection() == test2->ice_getConnection());
-
- test1->ice_ping();
- test2->ice_ping();
-
- com->deactivateObjectAdapter(adapter);
-
- TestIntfPrx test3 = TestIntfPrx::uncheckedCast(test1);
- test(test3->ice_getConnection() == test1->ice_getConnection());
- test(test3->ice_getConnection() == test2->ice_getConnection());
-
- try
- {
- test3->ice_ping();
- test(false);
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
+ RemoteObjectAdapterPrx adapter = com->createObjectAdapter("Adapter", "default");
+
+ TestIntfPrx test1 = adapter->getTestIntf();
+ TestIntfPrx test2 = adapter->getTestIntf();
+ test(test1->ice_getConnection() == test2->ice_getConnection());
+
+ test1->ice_ping();
+ test2->ice_ping();
+
+ com->deactivateObjectAdapter(adapter);
+
+ TestIntfPrx test3 = TestIntfPrx::uncheckedCast(test1);
+ test(test3->ice_getConnection() == test1->ice_getConnection());
+ test(test3->ice_getConnection() == test2->ice_getConnection());
+
+ try
+ {
+ test3->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
}
cout << "ok" << endl;
cout << "testing binding with multiple endpoints... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("Adapter11", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter12", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter13", "default"));
-
- //
- // Ensure that when a connection is opened it's reused for new
- // proxies and that all endpoints are eventually tried.
- //
- set<string> names;
- names.insert("Adapter11");
- names.insert("Adapter12");
- names.insert("Adapter13");
- while(!names.empty())
- {
- vector<RemoteObjectAdapterPrx> adpts = adapters;
-
- TestIntfPrx test1 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test2 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test3 = createTestIntfPrx(adpts);
-
- test(test1->ice_getConnection() == test2->ice_getConnection());
- test(test2->ice_getConnection() == test3->ice_getConnection());
-
- names.erase(test1->getAdapterName());
- test1->ice_getConnection()->close(false);
- }
-
- //
- // Ensure that the proxy correctly caches the connection (we
- // always send the request over the same connection.)
- //
- {
- for(vector<RemoteObjectAdapterPrx>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
- {
- (*p)->getTestIntf()->ice_ping();
- }
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- string name = test->getAdapterName();
- const int nRetry = 10;
- int i;
- for(i = 0; i < nRetry && test->getAdapterName() == name; i++);
- test(i == nRetry);
-
- for(vector<RemoteObjectAdapterPrx>::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
- {
- (*q)->getTestIntf()->ice_getConnection()->close(false);
- }
- }
-
- //
- // Deactivate an adapter and ensure that we can still
- // establish the connection to the remaining adapters.
- //
- com->deactivateObjectAdapter(adapters[0]);
- names.insert("Adapter12");
- names.insert("Adapter13");
- while(!names.empty())
- {
- vector<RemoteObjectAdapterPrx> adpts = adapters;
-
- TestIntfPrx test1 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test2 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test3 = createTestIntfPrx(adpts);
-
- test(test1->ice_getConnection() == test2->ice_getConnection());
- test(test2->ice_getConnection() == test3->ice_getConnection());
-
- names.erase(test1->getAdapterName());
- test1->ice_getConnection()->close(false);
- }
-
- //
- // Deactivate an adapter and ensure that we can still
- // establish the connection to the remaining adapter.
- //
- com->deactivateObjectAdapter(adapters[2]);
- TestIntfPrx test = createTestIntfPrx(adapters);
- test(test->getAdapterName() == "Adapter12");
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("Adapter11", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter12", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter13", "default"));
+
+ //
+ // Ensure that when a connection is opened it's reused for new
+ // proxies and that all endpoints are eventually tried.
+ //
+ set<string> names;
+ names.insert("Adapter11");
+ names.insert("Adapter12");
+ names.insert("Adapter13");
+ while(!names.empty())
+ {
+ vector<RemoteObjectAdapterPrx> adpts = adapters;
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1->ice_getConnection() == test2->ice_getConnection());
+ test(test2->ice_getConnection() == test3->ice_getConnection());
+
+ names.erase(test1->getAdapterName());
+ test1->ice_getConnection()->close(false);
+ }
+
+ //
+ // Ensure that the proxy correctly caches the connection (we
+ // always send the request over the same connection.)
+ //
+ {
+ for(vector<RemoteObjectAdapterPrx>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
+ {
+ (*p)->getTestIntf()->ice_ping();
+ }
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ string name = test->getAdapterName();
+ const int nRetry = 10;
+ int i;
+ for(i = 0; i < nRetry && test->getAdapterName() == name; i++);
+ test(i == nRetry);
+
+ for(vector<RemoteObjectAdapterPrx>::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
+ {
+ (*q)->getTestIntf()->ice_getConnection()->close(false);
+ }
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapters.
+ //
+ com->deactivateObjectAdapter(adapters[0]);
+ names.insert("Adapter12");
+ names.insert("Adapter13");
+ while(!names.empty())
+ {
+ vector<RemoteObjectAdapterPrx> adpts = adapters;
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1->ice_getConnection() == test2->ice_getConnection());
+ test(test2->ice_getConnection() == test3->ice_getConnection());
+
+ names.erase(test1->getAdapterName());
+ test1->ice_getConnection()->close(false);
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapter.
+ //
+ com->deactivateObjectAdapter(adapters[2]);
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test->getAdapterName() == "Adapter12");
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing binding with multiple endpoints and AMI... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("AdapterAMI11", "default"));
- adapters.push_back(com->createObjectAdapter("AdapterAMI12", "default"));
- adapters.push_back(com->createObjectAdapter("AdapterAMI13", "default"));
-
- //
- // Ensure that when a connection is opened it's reused for new
- // proxies and that all endpoints are eventually tried.
- //
- set<string> names;
- names.insert("AdapterAMI11");
- names.insert("AdapterAMI12");
- names.insert("AdapterAMI13");
- while(!names.empty())
- {
- vector<RemoteObjectAdapterPrx> adpts = adapters;
-
- TestIntfPrx test1 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test2 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test3 = createTestIntfPrx(adpts);
-
- test(test1->ice_getConnection() == test2->ice_getConnection());
- test(test2->ice_getConnection() == test3->ice_getConnection());
-
- names.erase(getAdapterNameWithAMI(test1));
- test1->ice_getConnection()->close(false);
- }
-
- //
- // Ensure that the proxy correctly caches the connection (we
- // always send the request over the same connection.)
- //
- {
- for(vector<RemoteObjectAdapterPrx>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
- {
- (*p)->getTestIntf()->ice_ping();
- }
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- string name = getAdapterNameWithAMI(test);
- const int nRetry = 10;
- int i;
- for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == name; i++);
- test(i == nRetry);
-
- for(vector<RemoteObjectAdapterPrx>::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
- {
- (*q)->getTestIntf()->ice_getConnection()->close(false);
- }
- }
-
- //
- // Deactivate an adapter and ensure that we can still
- // establish the connection to the remaining adapters.
- //
- com->deactivateObjectAdapter(adapters[0]);
- names.insert("AdapterAMI12");
- names.insert("AdapterAMI13");
- while(!names.empty())
- {
- vector<RemoteObjectAdapterPrx> adpts = adapters;
-
- TestIntfPrx test1 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test2 = createTestIntfPrx(adpts);
- random_shuffle(adpts.begin(), adpts.end(), rng);
- TestIntfPrx test3 = createTestIntfPrx(adpts);
-
- test(test1->ice_getConnection() == test2->ice_getConnection());
- test(test2->ice_getConnection() == test3->ice_getConnection());
-
- names.erase(test1->getAdapterName());
- test1->ice_getConnection()->close(false);
- }
-
- //
- // Deactivate an adapter and ensure that we can still
- // establish the connection to the remaining adapter.
- //
- com->deactivateObjectAdapter(adapters[2]);
- TestIntfPrx test = createTestIntfPrx(adapters);
- test(test->getAdapterName() == "AdapterAMI12");
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("AdapterAMI11", "default"));
+ adapters.push_back(com->createObjectAdapter("AdapterAMI12", "default"));
+ adapters.push_back(com->createObjectAdapter("AdapterAMI13", "default"));
+
+ //
+ // Ensure that when a connection is opened it's reused for new
+ // proxies and that all endpoints are eventually tried.
+ //
+ set<string> names;
+ names.insert("AdapterAMI11");
+ names.insert("AdapterAMI12");
+ names.insert("AdapterAMI13");
+ while(!names.empty())
+ {
+ vector<RemoteObjectAdapterPrx> adpts = adapters;
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1->ice_getConnection() == test2->ice_getConnection());
+ test(test2->ice_getConnection() == test3->ice_getConnection());
+
+ names.erase(getAdapterNameWithAMI(test1));
+ test1->ice_getConnection()->close(false);
+ }
+
+ //
+ // Ensure that the proxy correctly caches the connection (we
+ // always send the request over the same connection.)
+ //
+ {
+ for(vector<RemoteObjectAdapterPrx>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
+ {
+ (*p)->getTestIntf()->ice_ping();
+ }
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ string name = getAdapterNameWithAMI(test);
+ const int nRetry = 10;
+ int i;
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == name; i++);
+ test(i == nRetry);
+
+ for(vector<RemoteObjectAdapterPrx>::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
+ {
+ (*q)->getTestIntf()->ice_getConnection()->close(false);
+ }
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapters.
+ //
+ com->deactivateObjectAdapter(adapters[0]);
+ names.insert("AdapterAMI12");
+ names.insert("AdapterAMI13");
+ while(!names.empty())
+ {
+ vector<RemoteObjectAdapterPrx> adpts = adapters;
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ random_shuffle(adpts.begin(), adpts.end(), rng);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1->ice_getConnection() == test2->ice_getConnection());
+ test(test2->ice_getConnection() == test3->ice_getConnection());
+
+ names.erase(test1->getAdapterName());
+ test1->ice_getConnection()->close(false);
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapter.
+ //
+ com->deactivateObjectAdapter(adapters[2]);
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test->getAdapterName() == "AdapterAMI12");
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing random endpoint selection... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("Adapter21", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter22", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter23", "default"));
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- test(test->ice_getEndpointSelection() == Ice::Random);
-
- set<string> names;
- names.insert("Adapter21");
- names.insert("Adapter22");
- names.insert("Adapter23");
- while(!names.empty())
- {
- names.erase(test->getAdapterName());
- test->ice_getConnection()->close(false);
- }
-
- test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Random));
- test(test->ice_getEndpointSelection() == Ice::Random);
-
- names.insert("Adapter21");
- names.insert("Adapter22");
- names.insert("Adapter23");
- while(!names.empty())
- {
- names.erase(test->getAdapterName());
- test->ice_getConnection()->close(false);
- }
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("Adapter21", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter22", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter23", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test->ice_getEndpointSelection() == Ice::Random);
+
+ set<string> names;
+ names.insert("Adapter21");
+ names.insert("Adapter22");
+ names.insert("Adapter23");
+ while(!names.empty())
+ {
+ names.erase(test->getAdapterName());
+ test->ice_getConnection()->close(false);
+ }
+
+ test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Random));
+ test(test->ice_getEndpointSelection() == Ice::Random);
+
+ names.insert("Adapter21");
+ names.insert("Adapter22");
+ names.insert("Adapter23");
+ while(!names.empty())
+ {
+ names.erase(test->getAdapterName());
+ test->ice_getConnection()->close(false);
+ }
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing ordered endpoint selection... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("Adapter31", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter32", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter33", "default"));
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Ordered));
- test(test->ice_getEndpointSelection() == Ice::Ordered);
- const int nRetry = 5;
- int i;
-
- //
- // Ensure that endpoints are tried in order by deactiving the adapters
- // one after the other.
- //
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter31"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[0]);
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter32"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[1]);
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter33"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[2]);
-
- try
- {
- test->getAdapterName();
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
-
- Ice::EndpointSeq endpoints = test->ice_getEndpoints();
-
- adapters.clear();
-
- //
- // Now, re-activate the adapters with the same endpoints in the opposite
- // order.
- //
- adapters.push_back(com->createObjectAdapter("Adapter36", endpoints[2]->toString()));
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter36"; i++);
- test(i == nRetry);
- test->ice_getConnection()->close(false);
- adapters.push_back(com->createObjectAdapter("Adapter35", endpoints[1]->toString()));
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter35"; i++);
- test(i == nRetry);
- test->ice_getConnection()->close(false);
- adapters.push_back(com->createObjectAdapter("Adapter34", endpoints[0]->toString()));
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter34"; i++);
- test(i == nRetry);
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("Adapter31", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter32", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter33", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Ordered));
+ test(test->ice_getEndpointSelection() == Ice::Ordered);
+ const int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter31"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[0]);
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter32"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[1]);
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter33"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[2]);
+
+ try
+ {
+ test->getAdapterName();
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
+
+ Ice::EndpointSeq endpoints = test->ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.push_back(com->createObjectAdapter("Adapter36", endpoints[2]->toString()));
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter36"; i++);
+ test(i == nRetry);
+ test->ice_getConnection()->close(false);
+ adapters.push_back(com->createObjectAdapter("Adapter35", endpoints[1]->toString()));
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter35"; i++);
+ test(i == nRetry);
+ test->ice_getConnection()->close(false);
+ adapters.push_back(com->createObjectAdapter("Adapter34", endpoints[0]->toString()));
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter34"; i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing per request binding with single endpoint... " << flush;
{
- RemoteObjectAdapterPrx adapter = com->createObjectAdapter("Adapter41", "default");
-
- TestIntfPrx test1 = TestIntfPrx::uncheckedCast(adapter->getTestIntf()->ice_connectionCached(false));
- TestIntfPrx test2 = TestIntfPrx::uncheckedCast(adapter->getTestIntf()->ice_connectionCached(false));
- test(!test1->ice_isConnectionCached());
- test(!test2->ice_isConnectionCached());
- test(test1->ice_getConnection() == test2->ice_getConnection());
-
- test1->ice_ping();
-
- com->deactivateObjectAdapter(adapter);
-
- TestIntfPrx test3 = TestIntfPrx::uncheckedCast(test1);
- try
- {
- test(test3->ice_getConnection() == test1->ice_getConnection());
- test(false);
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
+ RemoteObjectAdapterPrx adapter = com->createObjectAdapter("Adapter41", "default");
+
+ TestIntfPrx test1 = TestIntfPrx::uncheckedCast(adapter->getTestIntf()->ice_connectionCached(false));
+ TestIntfPrx test2 = TestIntfPrx::uncheckedCast(adapter->getTestIntf()->ice_connectionCached(false));
+ test(!test1->ice_isConnectionCached());
+ test(!test2->ice_isConnectionCached());
+ test(test1->ice_getConnection() == test2->ice_getConnection());
+
+ test1->ice_ping();
+
+ com->deactivateObjectAdapter(adapter);
+
+ TestIntfPrx test3 = TestIntfPrx::uncheckedCast(test1);
+ try
+ {
+ test(test3->ice_getConnection() == test1->ice_getConnection());
+ test(false);
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
}
cout << "ok" << endl;
cout << "testing per request binding with multiple endpoints... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("Adapter51", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter52", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter53", "default"));
-
- TestIntfPrx test = TestIntfPrx::uncheckedCast(createTestIntfPrx(adapters)->ice_connectionCached(false));
- test(!test->ice_isConnectionCached());
-
- set<string> names;
- names.insert("Adapter51");
- names.insert("Adapter52");
- names.insert("Adapter53");
- while(!names.empty())
- {
- names.erase(test->getAdapterName());
- }
-
- com->deactivateObjectAdapter(adapters[0]);
-
- names.insert("Adapter52");
- names.insert("Adapter53");
- while(!names.empty())
- {
- names.erase(test->getAdapterName());
- }
-
- com->deactivateObjectAdapter(adapters[2]);
-
-
- test(test->getAdapterName() == "Adapter52");
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("Adapter51", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter52", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter53", "default"));
+
+ TestIntfPrx test = TestIntfPrx::uncheckedCast(createTestIntfPrx(adapters)->ice_connectionCached(false));
+ test(!test->ice_isConnectionCached());
+
+ set<string> names;
+ names.insert("Adapter51");
+ names.insert("Adapter52");
+ names.insert("Adapter53");
+ while(!names.empty())
+ {
+ names.erase(test->getAdapterName());
+ }
+
+ com->deactivateObjectAdapter(adapters[0]);
+
+ names.insert("Adapter52");
+ names.insert("Adapter53");
+ while(!names.empty())
+ {
+ names.erase(test->getAdapterName());
+ }
+
+ com->deactivateObjectAdapter(adapters[2]);
+
+
+ test(test->getAdapterName() == "Adapter52");
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing per request binding with multiple endpoints and AMI... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("AdapterAMI51", "default"));
- adapters.push_back(com->createObjectAdapter("AdapterAMI52", "default"));
- adapters.push_back(com->createObjectAdapter("AdapterAMI53", "default"));
-
- TestIntfPrx test = TestIntfPrx::uncheckedCast(createTestIntfPrx(adapters)->ice_connectionCached(false));
- test(!test->ice_isConnectionCached());
-
- set<string> names;
- names.insert("AdapterAMI51");
- names.insert("AdapterAMI52");
- names.insert("AdapterAMI53");
- while(!names.empty())
- {
- names.erase(getAdapterNameWithAMI(test));
- }
-
- com->deactivateObjectAdapter(adapters[0]);
-
- names.insert("AdapterAMI52");
- names.insert("AdapterAMI53");
- while(!names.empty())
- {
- names.erase(getAdapterNameWithAMI(test));
- }
-
- com->deactivateObjectAdapter(adapters[2]);
-
- test(test->getAdapterName() == "AdapterAMI52");
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("AdapterAMI51", "default"));
+ adapters.push_back(com->createObjectAdapter("AdapterAMI52", "default"));
+ adapters.push_back(com->createObjectAdapter("AdapterAMI53", "default"));
+
+ TestIntfPrx test = TestIntfPrx::uncheckedCast(createTestIntfPrx(adapters)->ice_connectionCached(false));
+ test(!test->ice_isConnectionCached());
+
+ set<string> names;
+ names.insert("AdapterAMI51");
+ names.insert("AdapterAMI52");
+ names.insert("AdapterAMI53");
+ while(!names.empty())
+ {
+ names.erase(getAdapterNameWithAMI(test));
+ }
+
+ com->deactivateObjectAdapter(adapters[0]);
+
+ names.insert("AdapterAMI52");
+ names.insert("AdapterAMI53");
+ while(!names.empty())
+ {
+ names.erase(getAdapterNameWithAMI(test));
+ }
+
+ com->deactivateObjectAdapter(adapters[2]);
+
+ test(test->getAdapterName() == "AdapterAMI52");
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing per request binding and ordered endpoint selection... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("Adapter61", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter62", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter63", "default"));
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Ordered));
- test(test->ice_getEndpointSelection() == Ice::Ordered);
- test = TestIntfPrx::uncheckedCast(test->ice_connectionCached(false));
- test(!test->ice_isConnectionCached());
- const int nRetry = 5;
- int i;
-
- //
- // Ensure that endpoints are tried in order by deactiving the adapters
- // one after the other.
- //
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter61"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[0]);
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter62"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[1]);
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter63"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[2]);
-
- try
- {
- test->getAdapterName();
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
-
- Ice::EndpointSeq endpoints = test->ice_getEndpoints();
-
- adapters.clear();
-
- //
- // Now, re-activate the adapters with the same endpoints in the opposite
- // order.
- //
- adapters.push_back(com->createObjectAdapter("Adapter66", endpoints[2]->toString()));
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter66"; i++);
- test(i == nRetry);
- adapters.push_back(com->createObjectAdapter("Adapter65", endpoints[1]->toString()));
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter65"; i++);
- test(i == nRetry);
- adapters.push_back(com->createObjectAdapter("Adapter64", endpoints[0]->toString()));
- for(i = 0; i < nRetry && test->getAdapterName() == "Adapter64"; i++);
- test(i == nRetry);
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("Adapter61", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter62", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter63", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Ordered));
+ test(test->ice_getEndpointSelection() == Ice::Ordered);
+ test = TestIntfPrx::uncheckedCast(test->ice_connectionCached(false));
+ test(!test->ice_isConnectionCached());
+ const int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter61"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[0]);
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter62"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[1]);
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter63"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[2]);
+
+ try
+ {
+ test->getAdapterName();
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
+
+ Ice::EndpointSeq endpoints = test->ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.push_back(com->createObjectAdapter("Adapter66", endpoints[2]->toString()));
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter66"; i++);
+ test(i == nRetry);
+ adapters.push_back(com->createObjectAdapter("Adapter65", endpoints[1]->toString()));
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter65"; i++);
+ test(i == nRetry);
+ adapters.push_back(com->createObjectAdapter("Adapter64", endpoints[0]->toString()));
+ for(i = 0; i < nRetry && test->getAdapterName() == "Adapter64"; i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing per request binding and ordered endpoint selection and AMI... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("AdapterAMI61", "default"));
- adapters.push_back(com->createObjectAdapter("AdapterAMI62", "default"));
- adapters.push_back(com->createObjectAdapter("AdapterAMI63", "default"));
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Ordered));
- test(test->ice_getEndpointSelection() == Ice::Ordered);
- test = TestIntfPrx::uncheckedCast(test->ice_connectionCached(false));
- test(!test->ice_isConnectionCached());
- const int nRetry = 5;
- int i;
-
- //
- // Ensure that endpoints are tried in order by deactiving the adapters
- // one after the other.
- //
- for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI61"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[0]);
- for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI62"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[1]);
- for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI63"; i++);
- test(i == nRetry);
- com->deactivateObjectAdapter(adapters[2]);
-
- try
- {
- test->getAdapterName();
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
-
- Ice::EndpointSeq endpoints = test->ice_getEndpoints();
-
- adapters.clear();
-
- //
- // Now, re-activate the adapters with the same endpoints in the opposite
- // order.
- //
- adapters.push_back(com->createObjectAdapter("AdapterAMI66", endpoints[2]->toString()));
- for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI66"; i++);
- test(i == nRetry);
- adapters.push_back(com->createObjectAdapter("AdapterAMI65", endpoints[1]->toString()));
- for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI65"; i++);
- test(i == nRetry);
- adapters.push_back(com->createObjectAdapter("AdapterAMI64", endpoints[0]->toString()));
- for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI64"; i++);
- test(i == nRetry);
-
- deactivate(com, adapters);
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("AdapterAMI61", "default"));
+ adapters.push_back(com->createObjectAdapter("AdapterAMI62", "default"));
+ adapters.push_back(com->createObjectAdapter("AdapterAMI63", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrx::uncheckedCast(test->ice_endpointSelection(Ice::Ordered));
+ test(test->ice_getEndpointSelection() == Ice::Ordered);
+ test = TestIntfPrx::uncheckedCast(test->ice_connectionCached(false));
+ test(!test->ice_isConnectionCached());
+ const int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI61"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[0]);
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI62"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[1]);
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI63"; i++);
+ test(i == nRetry);
+ com->deactivateObjectAdapter(adapters[2]);
+
+ try
+ {
+ test->getAdapterName();
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
+
+ Ice::EndpointSeq endpoints = test->ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.push_back(com->createObjectAdapter("AdapterAMI66", endpoints[2]->toString()));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI66"; i++);
+ test(i == nRetry);
+ adapters.push_back(com->createObjectAdapter("AdapterAMI65", endpoints[1]->toString()));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI65"; i++);
+ test(i == nRetry);
+ adapters.push_back(com->createObjectAdapter("AdapterAMI64", endpoints[0]->toString()));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test) == "AdapterAMI64"; i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
}
cout << "ok" << endl;
cout << "testing endpoint mode filtering... " << flush;
{
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("Adapter71", "default"));
- adapters.push_back(com->createObjectAdapter("Adapter72", "udp"));
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- test(test->getAdapterName() == "Adapter71");
-
- TestIntfPrx testUDP = TestIntfPrx::uncheckedCast(test->ice_datagram());
- test(test->ice_getConnection() != testUDP->ice_getConnection());
- try
- {
- testUDP->getAdapterName();
- }
- catch(const Ice::TwowayOnlyException&)
- {
- }
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("Adapter71", "default"));
+ adapters.push_back(com->createObjectAdapter("Adapter72", "udp"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test->getAdapterName() == "Adapter71");
+
+ TestIntfPrx testUDP = TestIntfPrx::uncheckedCast(test->ice_datagram());
+ test(test->ice_getConnection() != testUDP->ice_getConnection());
+ try
+ {
+ testUDP->getAdapterName();
+ }
+ catch(const Ice::TwowayOnlyException&)
+ {
+ }
}
cout << "ok" << endl;
if(!communicator->getProperties()->getProperty("Ice.Plugin.IceSSL").empty())
{
- cout << "testing unsecure vs. secure endpoints... " << flush;
- {
- vector<RemoteObjectAdapterPrx> adapters;
- adapters.push_back(com->createObjectAdapter("Adapter81", "ssl"));
- adapters.push_back(com->createObjectAdapter("Adapter82", "tcp"));
-
- TestIntfPrx test = createTestIntfPrx(adapters);
- int i;
- for(i = 0; i < 5; i++)
- {
- test(test->getAdapterName() == "Adapter82");
- test->ice_getConnection()->close(false);
- }
-
- TestIntfPrx testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(true));
- test(testSecure->ice_isSecure());
- testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(false));
- test(!testSecure->ice_isSecure());
- testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(true));
- test(testSecure->ice_isSecure());
- test(test->ice_getConnection() != testSecure->ice_getConnection());
-
- com->deactivateObjectAdapter(adapters[1]);
-
- for(i = 0; i < 5; i++)
- {
- test(test->getAdapterName() == "Adapter81");
- test->ice_getConnection()->close(false);
- }
-
- com->createObjectAdapter("Adapter83", (test->ice_getEndpoints()[1])->toString()); // Reactive tcp OA.
-
- for(i = 0; i < 5; i++)
- {
- test(test->getAdapterName() == "Adapter83");
- test->ice_getConnection()->close(false);
- }
-
- com->deactivateObjectAdapter(adapters[0]);
- try
- {
- testSecure->ice_ping();
- test(false);
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
-
- deactivate(com, adapters);
- }
- cout << "ok" << endl;
+ cout << "testing unsecure vs. secure endpoints... " << flush;
+ {
+ vector<RemoteObjectAdapterPrx> adapters;
+ adapters.push_back(com->createObjectAdapter("Adapter81", "ssl"));
+ adapters.push_back(com->createObjectAdapter("Adapter82", "tcp"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ int i;
+ for(i = 0; i < 5; i++)
+ {
+ test(test->getAdapterName() == "Adapter82");
+ test->ice_getConnection()->close(false);
+ }
+
+ TestIntfPrx testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(true));
+ test(testSecure->ice_isSecure());
+ testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(false));
+ test(!testSecure->ice_isSecure());
+ testSecure = TestIntfPrx::uncheckedCast(test->ice_secure(true));
+ test(testSecure->ice_isSecure());
+ test(test->ice_getConnection() != testSecure->ice_getConnection());
+
+ com->deactivateObjectAdapter(adapters[1]);
+
+ for(i = 0; i < 5; i++)
+ {
+ test(test->getAdapterName() == "Adapter81");
+ test->ice_getConnection()->close(false);
+ }
+
+ com->createObjectAdapter("Adapter83", (test->ice_getEndpoints()[1])->toString()); // Reactive tcp OA.
+
+ for(i = 0; i < 5; i++)
+ {
+ test(test->getAdapterName() == "Adapter83");
+ test->ice_getConnection()->close(false);
+ }
+
+ com->deactivateObjectAdapter(adapters[0]);
+ try
+ {
+ testSecure->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
+
+ deactivate(com, adapters);
+ }
+ cout << "ok" << endl;
}
com->shutdown();
diff --git a/cpp/test/Ice/binding/Client.cpp b/cpp/test/Ice/binding/Client.cpp
index 0527d790712..a0f1ccc1976 100644
--- a/cpp/test/Ice/binding/Client.cpp
+++ b/cpp/test/Ice/binding/Client.cpp
@@ -29,26 +29,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/binding/Server.cpp b/cpp/test/Ice/binding/Server.cpp
index 99d9b2beafd..ca6e34b3b7d 100644
--- a/cpp/test/Ice/binding/Server.cpp
+++ b/cpp/test/Ice/binding/Server.cpp
@@ -36,26 +36,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/binding/TestI.cpp b/cpp/test/Ice/binding/TestI.cpp
index cbbad4a6e11..8407ebff887 100644
--- a/cpp/test/Ice/binding/TestI.cpp
+++ b/cpp/test/Ice/binding/TestI.cpp
@@ -41,7 +41,7 @@ RemoteCommunicatorI::shutdown(const Ice::Current& current)
RemoteObjectAdapterI::RemoteObjectAdapterI(const Ice::ObjectAdapterPtr& adapter) :
_adapter(adapter),
_testIntf(TestIntfPrx::uncheckedCast(_adapter->add(new TestI(),
- adapter->getCommunicator()->stringToIdentity("test"))))
+ adapter->getCommunicator()->stringToIdentity("test"))))
{
_adapter->activate();
}
@@ -57,7 +57,7 @@ RemoteObjectAdapterI::deactivate(const Ice::Current&)
{
try
{
- _adapter->destroy();
+ _adapter->destroy();
}
catch(const ObjectAdapterDeactivatedException&)
{
diff --git a/cpp/test/Ice/binding/TestI.h b/cpp/test/Ice/binding/TestI.h
index b17e3585bcc..569f6f24965 100644
--- a/cpp/test/Ice/binding/TestI.h
+++ b/cpp/test/Ice/binding/TestI.h
@@ -17,7 +17,7 @@ class RemoteCommunicatorI : public Test::RemoteCommunicator
public:
virtual Test::RemoteObjectAdapterPrx createObjectAdapter(const std::string&, const std::string&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void deactivateObjectAdapter(const Test::RemoteObjectAdapterPrx&, const Ice::Current&);
virtual void shutdown(const Ice::Current&);
};
diff --git a/cpp/test/Ice/checksum/client/Client.cpp b/cpp/test/Ice/checksum/client/Client.cpp
index e9d573432c0..792d51c0beb 100644
--- a/cpp/test/Ice/checksum/client/Client.cpp
+++ b/cpp/test/Ice/checksum/client/Client.cpp
@@ -30,26 +30,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/checksum/server/Server.cpp b/cpp/test/Ice/checksum/server/Server.cpp
index 273c04de334..261564c6ca8 100644
--- a/cpp/test/Ice/checksum/server/Server.cpp
+++ b/cpp/test/Ice/checksum/server/Server.cpp
@@ -32,26 +32,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/custom/AllTests.cpp b/cpp/test/Ice/custom/AllTests.cpp
index 535fe84ffba..e7e70631422 100644
--- a/cpp/test/Ice/custom/AllTests.cpp
+++ b/cpp/test/Ice/custom/AllTests.cpp
@@ -69,7 +69,7 @@ public:
virtual void ice_response(const Test::BoolSeq& ret, const Test::BoolSeq& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -95,18 +95,18 @@ public:
}
virtual void ice_response(const pair<const Ice::Byte*, const Ice::Byte*>& ret,
- const pair<const Ice::Byte*, const Ice::Byte*>& out)
+ const pair<const Ice::Byte*, const Ice::Byte*>& out)
{
test(_in.second - _in.first == out.second - out.first);
test(_in.second - _in.first == ret.second - ret.first);
- Ice::Byte* b = const_cast<Ice::Byte*>(_in.first);
- Ice::Byte* r = const_cast<Ice::Byte*>(ret.first);
- Ice::Byte* o = const_cast<Ice::Byte*>(out.first);
- while(b != _in.second)
- {
- test(*r++ == *b);
- test(*o++ == *b++);
- }
+ Ice::Byte* b = const_cast<Ice::Byte*>(_in.first);
+ Ice::Byte* r = const_cast<Ice::Byte*>(ret.first);
+ Ice::Byte* o = const_cast<Ice::Byte*>(out.first);
+ while(b != _in.second)
+ {
+ test(*r++ == *b);
+ test(*o++ == *b++);
+ }
called();
}
@@ -134,7 +134,7 @@ public:
virtual void ice_response(const Test::VariableList& ret, const Test::VariableList& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -162,7 +162,7 @@ public:
virtual void ice_response(const Test::BoolSeq& ret, const Test::BoolSeq& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -188,18 +188,18 @@ public:
}
virtual void ice_response(const pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& ret,
- const pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& out)
+ const pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& out)
{
test(ice_distance(out.first, out.second) == static_cast<Ice::Int>(_in.size()));
test(ice_distance(ret.first, ret.second) == static_cast<Ice::Int>(_in.size()));
- Test::ByteList::const_iterator b;
- Test::ByteList::const_iterator o = out.first;
- Test::ByteList::const_iterator r = ret.first;
- for(b = _in.begin(); b != _in.end(); ++b)
- {
- test(*b == *o++);
- test(*b == *r++);
- }
+ Test::ByteList::const_iterator b;
+ Test::ByteList::const_iterator o = out.first;
+ Test::ByteList::const_iterator r = ret.first;
+ for(b = _in.begin(); b != _in.end(); ++b)
+ {
+ test(*b == *o++);
+ test(*b == *r++);
+ }
called();
}
@@ -227,7 +227,7 @@ public:
virtual void ice_response(const Test::VariableList& ret, const Test::VariableList& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -255,7 +255,7 @@ public:
virtual void ice_response(const Test::BoolSeq& ret, const Test::BoolSeq& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -283,7 +283,7 @@ public:
virtual void ice_response(const Test::ByteList& ret, const Test::ByteList& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -311,7 +311,7 @@ public:
virtual void ice_response(const Test::VariableList& ret, const Test::VariableList& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -339,7 +339,7 @@ public:
virtual void ice_response(const deque<bool>& ret, const deque<bool>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -367,7 +367,7 @@ public:
virtual void ice_response(const list<bool>& ret, const list<bool>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -395,7 +395,7 @@ public:
virtual void ice_response(const deque<Ice::Byte>& ret, const deque<Ice::Byte>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -423,7 +423,7 @@ public:
virtual void ice_response(const list<Ice::Byte>& ret, const list<Ice::Byte>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -451,7 +451,7 @@ public:
virtual void ice_response(const MyByteSeq& ret, const MyByteSeq& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -479,7 +479,7 @@ public:
virtual void ice_response(const deque<string>& ret, const deque<string>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -507,7 +507,7 @@ public:
virtual void ice_response(const list<string>& ret, const list<string>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -535,7 +535,7 @@ public:
virtual void ice_response(const deque<Test::Fixed>& ret, const deque<Test::Fixed>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -563,7 +563,7 @@ public:
virtual void ice_response(const list<Test::Fixed>& ret, const list<Test::Fixed>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -591,7 +591,7 @@ public:
virtual void ice_response(const deque<Test::Variable>& ret, const deque<Test::Variable>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -619,7 +619,7 @@ public:
virtual void ice_response(const list<Test::Variable>& ret, const list<Test::Variable>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -647,7 +647,7 @@ public:
virtual void ice_response(const deque<Test::StringStringDict>& ret, const deque<Test::StringStringDict>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -675,7 +675,7 @@ public:
virtual void ice_response(const list<Test::StringStringDict>& ret, const list<Test::StringStringDict>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -703,7 +703,7 @@ public:
virtual void ice_response(const deque<Test::E>& ret, const deque<Test::E>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -731,7 +731,7 @@ public:
virtual void ice_response(const list<Test::E>& ret, const list<Test::E>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -759,7 +759,7 @@ public:
virtual void ice_response(const deque<Test::CPrx>& ret, const deque<Test::CPrx>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -787,7 +787,7 @@ public:
virtual void ice_response(const list<Test::CPrx>& ret, const list<Test::CPrx>& out)
{
test(out == _in);
- test(ret == _in);
+ test(ret == _in);
called();
}
@@ -814,13 +814,13 @@ public:
virtual void ice_response(const deque<Test::CPtr>& ret, const deque<Test::CPtr>& out)
{
- test(out.size() == _in.size());
- test(ret.size() == _in.size());
- for(unsigned int i = 1; i < _in.size(); ++i)
- {
- test(out[i] == out[0]);
- test(ret[i] == out[i]);
- }
+ test(out.size() == _in.size());
+ test(ret.size() == _in.size());
+ for(unsigned int i = 1; i < _in.size(); ++i)
+ {
+ test(out[i] == out[0]);
+ test(ret[i] == out[i]);
+ }
called();
}
@@ -847,14 +847,14 @@ public:
virtual void ice_response(const list<Test::CPtr>& ret, const list<Test::CPtr>& out)
{
- test(out.size() == _in.size());
- test(ret.size() == _in.size());
- list<Test::CPtr>::const_iterator p1;
- list<Test::CPtr>::const_iterator p2;
- for(p1 = out.begin(), p2 = ret.begin(); p1 != out.end(); ++p1, ++p2)
- {
- test(*p1 == *p2);
- }
+ test(out.size() == _in.size());
+ test(ret.size() == _in.size());
+ list<Test::CPtr>::const_iterator p1;
+ list<Test::CPtr>::const_iterator p2;
+ for(p1 = out.begin(), p2 = ret.begin(); p1 != out.end(); ++p1, ++p2)
+ {
+ test(*p1 == *p2);
+ }
called();
}
@@ -875,17 +875,17 @@ class AMI_TestIntf_opClassStructI : public Test::AMI_TestIntf_opClassStruct, pub
public:
AMI_TestIntf_opClassStructI(const Test::ClassStructPtr& cs, const Test::ClassStructSeq& csseq1) :
- _cs(cs), _csseq1(csseq1)
+ _cs(cs), _csseq1(csseq1)
{
}
virtual void ice_response(const ::Test::ClassStructPtr& ret,
- const ::Test::ClassStructPtr& cs1,
- const ::Test::ClassStructSeq& seq)
+ const ::Test::ClassStructPtr& cs1,
+ const ::Test::ClassStructSeq& seq)
{
- test(ret == _cs);
- test(cs1 == _cs);
- test(seq == _csseq1);
+ test(ret == _cs);
+ test(cs1 == _cs);
+ test(seq == _csseq1);
called();
}
@@ -912,9 +912,9 @@ public:
virtual void ice_response(const wstring& ret, const wstring& out)
{
- test(out == _in);
- test(ret == _in);
- called();
+ test(out == _in);
+ test(ret == _in);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
@@ -940,9 +940,9 @@ public:
virtual void ice_response(const wstring& ret, const wstring& out)
{
- test(out == _in);
- test(ret == _in);
- called();
+ test(out == _in);
+ test(ret == _in);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
@@ -974,18 +974,18 @@ public:
virtual void ice_exception(const ::Ice::Exception& ex)
{
try
- {
- ex.ice_throw();
- }
- catch(const Test1::WstringException& e)
- {
- test(e.reason == _in);
- called();
- }
- catch(...)
- {
+ {
+ ex.ice_throw();
+ }
+ catch(const Test1::WstringException& e)
+ {
+ test(e.reason == _in);
+ called();
+ }
+ catch(...)
+ {
test(false);
- }
+ }
}
private:
@@ -1012,18 +1012,18 @@ public:
virtual void ice_exception(const ::Ice::Exception& ex)
{
try
- {
- ex.ice_throw();
- }
- catch(const Test2::WstringException& e)
- {
- test(e.reason == _in);
- called();
- }
- catch(...)
- {
+ {
+ ex.ice_throw();
+ }
+ catch(const Test2::WstringException& e)
+ {
+ test(e.reason == _in);
+ called();
+ }
+ catch(...)
+ {
test(false);
- }
+ }
}
private:
@@ -1038,7 +1038,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
cout << "testing stringToProxy... " << flush;
string ref = communicator->getProperties()->getPropertyWithDefault(
- "Custom.Proxy", "test:default -p 12010 -t 10000");
+ "Custom.Proxy", "test:default -p 12010 -t 10000");
Ice::ObjectPrx base = communicator->stringToProxy(ref);
test(base);
cout << "ok" << endl;
@@ -1053,487 +1053,487 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
Test::DoubleSeq in(5);
- in[0] = 3.14;
- in[1] = 1 / 3;
- in[2] = 0.375;
- in[3] = 4 / 3;
- in[4] = -5.725;
- Ice::Double inArray[5];
- for(int i = 0; i < 5; ++i)
- {
- inArray[i] = in[i];
- }
- pair<const Ice::Double*, const Ice::Double*> inPair(inArray, inArray + 5);
+ in[0] = 3.14;
+ in[1] = 1 / 3;
+ in[2] = 0.375;
+ in[3] = 4 / 3;
+ in[4] = -5.725;
+ Ice::Double inArray[5];
+ for(int i = 0; i < 5; ++i)
+ {
+ inArray[i] = in[i];
+ }
+ pair<const Ice::Double*, const Ice::Double*> inPair(inArray, inArray + 5);
- Test::DoubleSeq out;
- Test::DoubleSeq ret = t->opDoubleArray(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::DoubleSeq out;
+ Test::DoubleSeq ret = t->opDoubleArray(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- bool inArray[5];
- for(int i = 0; i < 5; ++i)
- {
- inArray[i] = in[i];
- }
- pair<const bool*, const bool*> inPair(inArray, inArray + 5);
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ bool inArray[5];
+ for(int i = 0; i < 5; ++i)
+ {
+ inArray[i] = in[i];
+ }
+ pair<const bool*, const bool*> inPair(inArray, inArray + 5);
- Test::BoolSeq out;
- Test::BoolSeq ret = t->opBoolArray(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::BoolSeq out;
+ Test::BoolSeq ret = t->opBoolArray(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::ByteList in;
- Ice::Byte inArray[5];
- inArray[0] = '1';
- in.push_back(inArray[0]);
- inArray[1] = '2';
- in.push_back(inArray[1]);
- inArray[2] = '3';
- in.push_back(inArray[2]);
- inArray[3] = '4';
- in.push_back(inArray[3]);
- inArray[4] = '5';
- in.push_back(inArray[4]);
- pair<const Ice::Byte*, const Ice::Byte*> inPair(inArray, inArray + 5);
-
- Test::ByteList out;
- Test::ByteList ret = t->opByteArray(inPair, out);
- test(out == in);
- test(ret == in);
+ Ice::Byte inArray[5];
+ inArray[0] = '1';
+ in.push_back(inArray[0]);
+ inArray[1] = '2';
+ in.push_back(inArray[1]);
+ inArray[2] = '3';
+ in.push_back(inArray[2]);
+ inArray[3] = '4';
+ in.push_back(inArray[3]);
+ inArray[4] = '5';
+ in.push_back(inArray[4]);
+ pair<const Ice::Byte*, const Ice::Byte*> inPair(inArray, inArray + 5);
+
+ Test::ByteList out;
+ Test::ByteList ret = t->opByteArray(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::VariableList in;
- Test::Variable inArray[5];
- inArray[0].s = "These";
- in.push_back(inArray[0]);
- inArray[1].s = "are";
- in.push_back(inArray[1]);
- inArray[2].s = "five";
- in.push_back(inArray[2]);
- inArray[3].s = "short";
- in.push_back(inArray[3]);
- inArray[4].s = "strings.";
- in.push_back(inArray[4]);
- pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5);
-
- Test::VariableList out;
- Test::VariableList ret = t->opVariableArray(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::Variable inArray[5];
+ inArray[0].s = "These";
+ in.push_back(inArray[0]);
+ inArray[1].s = "are";
+ in.push_back(inArray[1]);
+ inArray[2].s = "five";
+ in.push_back(inArray[2]);
+ inArray[3].s = "short";
+ in.push_back(inArray[3]);
+ inArray[4].s = "strings.";
+ in.push_back(inArray[4]);
+ pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5);
+
+ Test::VariableList out;
+ Test::VariableList ret = t->opVariableArray(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end());
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end());
- Test::BoolSeq out;
- Test::BoolSeq ret = t->opBoolRange(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::BoolSeq out;
+ Test::BoolSeq ret = t->opBoolRange(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::ByteList in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
- pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+ pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
- Test::ByteList out;
- Test::ByteList ret = t->opByteRange(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::ByteList out;
+ Test::ByteList ret = t->opByteRange(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::VariableList in;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- v.s = "are";
- in.push_back(v);
- v.s = "five";
- in.push_back(v);
- v.s = "short";
- in.push_back(v);
- v.s = "strings.";
- in.push_back(v);
- pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end());
-
- Test::VariableList out;
- Test::VariableList ret = t->opVariableRange(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+ pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end());
+
+ Test::VariableList out;
+ Test::VariableList ret = t->opVariableRange(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- bool inArray[5];
- for(int i = 0; i < 5; ++i)
- {
- inArray[i] = in[i];
- }
- pair<const bool*, const bool*> inPair(inArray, inArray + 5);
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ bool inArray[5];
+ for(int i = 0; i < 5; ++i)
+ {
+ inArray[i] = in[i];
+ }
+ pair<const bool*, const bool*> inPair(inArray, inArray + 5);
- Test::BoolSeq out;
- Test::BoolSeq ret = t->opBoolRangeType(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::BoolSeq out;
+ Test::BoolSeq ret = t->opBoolRangeType(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::ByteList in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
- pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+ pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
- Test::ByteList out;
- Test::ByteList ret = t->opByteRangeType(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::ByteList out;
+ Test::ByteList ret = t->opByteRangeType(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::VariableList in;
- deque<Test::Variable> inSeq;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "are";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "five";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "short";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "strings.";
- in.push_back(v);
- inSeq.push_back(v);
- pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator>
- inPair(inSeq.begin(), inSeq.end());
-
- Test::VariableList out;
- Test::VariableList ret = t->opVariableRangeType(inPair, out);
- test(out == in);
- test(ret == in);
+ deque<Test::Variable> inSeq;
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+ inSeq.push_back(v);
+ pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator>
+ inPair(inSeq.begin(), inSeq.end());
+
+ Test::VariableList out;
+ Test::VariableList ret = t->opVariableRangeType(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<bool> in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
- deque<bool> out;
- deque<bool> ret = t->opBoolSeq(in, out);
- test(out == in);
- test(ret == in);
+ deque<bool> out;
+ deque<bool> ret = t->opBoolSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<bool> in;
- in.push_back(false);
- in.push_back(true);
- in.push_back(true);
- in.push_back(false);
- in.push_back(true);
+ in.push_back(false);
+ in.push_back(true);
+ in.push_back(true);
+ in.push_back(false);
+ in.push_back(true);
- list<bool> out;
- list<bool> ret = t->opBoolList(in, out);
- test(out == in);
- test(ret == in);
+ list<bool> out;
+ list<bool> ret = t->opBoolList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque< ::Ice::Byte> in(5);
- in[0] = '1';
- in[1] = '2';
- in[2] = '3';
- in[3] = '4';
- in[4] = '5';
+ in[0] = '1';
+ in[1] = '2';
+ in[2] = '3';
+ in[3] = '4';
+ in[4] = '5';
- deque< ::Ice::Byte> out;
- deque< ::Ice::Byte> ret = t->opByteSeq(in, out);
- test(out == in);
- test(ret == in);
+ deque< ::Ice::Byte> out;
+ deque< ::Ice::Byte> ret = t->opByteSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list< ::Ice::Byte> in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
- list< ::Ice::Byte> out;
- list< ::Ice::Byte> ret = t->opByteList(in, out);
- test(out == in);
- test(ret == in);
+ list< ::Ice::Byte> out;
+ list< ::Ice::Byte> ret = t->opByteList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
MyByteSeq in(5);
- int i = 0;
- for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p)
- {
- *p = '1' + i++;
- }
+ int i = 0;
+ for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p)
+ {
+ *p = '1' + i++;
+ }
- MyByteSeq out;
- MyByteSeq ret = t->opMyByteSeq(in, out);
- test(out == in);
- test(ret == in);
+ MyByteSeq out;
+ MyByteSeq ret = t->opMyByteSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<string> in(5);
- in[0] = "These";
- in[1] = "are";
- in[2] = "five";
- in[3] = "short";
- in[4] = "strings.";
+ in[0] = "These";
+ in[1] = "are";
+ in[2] = "five";
+ in[3] = "short";
+ in[4] = "strings.";
- deque<string> out;
- deque<string> ret = t->opStringSeq(in, out);
- test(out == in);
- test(ret == in);
+ deque<string> out;
+ deque<string> ret = t->opStringSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<string> in;
- in.push_back("These");
- in.push_back("are");
- in.push_back("five");
- in.push_back("short");
- in.push_back("strings.");
+ in.push_back("These");
+ in.push_back("are");
+ in.push_back("five");
+ in.push_back("short");
+ in.push_back("strings.");
- list<string> out;
- list<string> ret = t->opStringList(in, out);
- test(out == in);
- test(ret == in);
+ list<string> out;
+ list<string> ret = t->opStringList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::Fixed> in(5);
- in[0].s = 1;
- in[1].s = 2;
- in[2].s = 3;
- in[3].s = 4;
- in[4].s = 5;
+ in[0].s = 1;
+ in[1].s = 2;
+ in[2].s = 3;
+ in[3].s = 4;
+ in[4].s = 5;
- deque<Test::Fixed> out;
- deque<Test::Fixed> ret = t->opFixedSeq(in, out);
- test(out == in);
- test(ret == in);
+ deque<Test::Fixed> out;
+ deque<Test::Fixed> ret = t->opFixedSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::Fixed> in(5);
- short num = 1;
- for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p)
- {
- (*p).s = num++;
- }
+ short num = 1;
+ for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p)
+ {
+ (*p).s = num++;
+ }
- list<Test::Fixed> out;
- list<Test::Fixed> ret = t->opFixedList(in, out);
- test(out == in);
- test(ret == in);
+ list<Test::Fixed> out;
+ list<Test::Fixed> ret = t->opFixedList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::Variable> in(5);
- in[0].s = "These";
- in[1].s = "are";
- in[2].s = "five";
- in[3].s = "short";
- in[4].s = "strings.";
+ in[0].s = "These";
+ in[1].s = "are";
+ in[2].s = "five";
+ in[3].s = "short";
+ in[4].s = "strings.";
- deque<Test::Variable> out;
- deque<Test::Variable> ret = t->opVariableSeq(in, out);
- test(out == in);
- test(ret == in);
+ deque<Test::Variable> out;
+ deque<Test::Variable> ret = t->opVariableSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::Variable> in;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- v.s = "are";
- in.push_back(v);
- v.s = "five";
- in.push_back(v);
- v.s = "short";
- in.push_back(v);
- v.s = "strings.";
- in.push_back(v);
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
- list<Test::Variable> out;
- list<Test::Variable> ret = t->opVariableList(in, out);
- test(out == in);
- test(ret == in);
+ list<Test::Variable> out;
+ list<Test::Variable> ret = t->opVariableList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::StringStringDict> in(5);
- in[0]["A"] = "a";
- in[1]["B"] = "b";
- in[2]["C"] = "c";
- in[3]["D"] = "d";
- in[4]["E"] = "e";
+ in[0]["A"] = "a";
+ in[1]["B"] = "b";
+ in[2]["C"] = "c";
+ in[3]["D"] = "d";
+ in[4]["E"] = "e";
- deque<Test::StringStringDict> out;
- deque<Test::StringStringDict> ret = t->opStringStringDictSeq(in, out);
- test(out == in);
- test(ret == in);
+ deque<Test::StringStringDict> out;
+ deque<Test::StringStringDict> ret = t->opStringStringDictSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::StringStringDict> in;
- Test::StringStringDict ssd;
- ssd["A"] = "a";
- in.push_back(ssd);
- ssd["B"] = "b";
- in.push_back(ssd);
- ssd["C"] = "c";
- in.push_back(ssd);
- ssd["D"] = "d";
- in.push_back(ssd);
- ssd["E"] = "e";
- in.push_back(ssd);
+ Test::StringStringDict ssd;
+ ssd["A"] = "a";
+ in.push_back(ssd);
+ ssd["B"] = "b";
+ in.push_back(ssd);
+ ssd["C"] = "c";
+ in.push_back(ssd);
+ ssd["D"] = "d";
+ in.push_back(ssd);
+ ssd["E"] = "e";
+ in.push_back(ssd);
- list<Test::StringStringDict> out;
- list<Test::StringStringDict> ret = t->opStringStringDictList(in, out);
- test(out == in);
- test(ret == in);
+ list<Test::StringStringDict> out;
+ list<Test::StringStringDict> ret = t->opStringStringDictList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::E> in(5);
- in[0] = Test::E1;
- in[1] = Test::E2;
- in[2] = Test::E3;
- in[3] = Test::E1;
- in[4] = Test::E3;
+ in[0] = Test::E1;
+ in[1] = Test::E2;
+ in[2] = Test::E3;
+ in[3] = Test::E1;
+ in[4] = Test::E3;
- deque<Test::E> out;
- deque<Test::E> ret = t->opESeq(in, out);
- test(out == in);
- test(ret == in);
+ deque<Test::E> out;
+ deque<Test::E> ret = t->opESeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::E> in;
- in.push_back(Test::E1);
- in.push_back(Test::E2);
- in.push_back(Test::E3);
- in.push_back(Test::E1);
- in.push_back(Test::E3);
+ in.push_back(Test::E1);
+ in.push_back(Test::E2);
+ in.push_back(Test::E3);
+ in.push_back(Test::E1);
+ in.push_back(Test::E3);
- list<Test::E> out;
- list<Test::E> ret = t->opEList(in, out);
- test(out == in);
- test(ret == in);
+ list<Test::E> out;
+ list<Test::E> ret = t->opEList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::CPrx> in(5);
- in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"));
- in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"));
- in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"));
- in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"));
- in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"));
+ in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"));
+ in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"));
+ in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"));
+ in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"));
+ in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"));
- deque<Test::CPrx> out;
- deque<Test::CPrx> ret = t->opCPrxSeq(in, out);
- test(out == in);
- test(ret == in);
+ deque<Test::CPrx> out;
+ deque<Test::CPrx> ret = t->opCPrxSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::CPrx> in;
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")));
- list<Test::CPrx> out;
- list<Test::CPrx> ret = t->opCPrxList(in, out);
- test(out == in);
- test(ret == in);
+ list<Test::CPrx> out;
+ list<Test::CPrx> ret = t->opCPrxList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::CPtr> in(5);
- in[0] = new Test::C();
- in[1] = in[0];
- in[2] = in[0];
- in[3] = in[0];
- in[4] = in[0];
-
- deque<Test::CPtr> out;
- deque<Test::CPtr> ret = t->opCSeq(in, out);
- test(out.size() == in.size());
- test(ret.size() == in.size());
- for(unsigned int i = 1; i < in.size(); ++i)
- {
- test(out[i] == out[0]);
- test(ret[i] == out[i]);
- }
+ in[0] = new Test::C();
+ in[1] = in[0];
+ in[2] = in[0];
+ in[3] = in[0];
+ in[4] = in[0];
+
+ deque<Test::CPtr> out;
+ deque<Test::CPtr> ret = t->opCSeq(in, out);
+ test(out.size() == in.size());
+ test(ret.size() == in.size());
+ for(unsigned int i = 1; i < in.size(); ++i)
+ {
+ test(out[i] == out[0]);
+ test(ret[i] == out[i]);
+ }
}
{
list<Test::CPtr> in;
- in.push_back(new Test::C());
- in.push_back(new Test::C());
- in.push_back(new Test::C());
- in.push_back(new Test::C());
- in.push_back(new Test::C());
-
- list<Test::CPtr> out;
- list<Test::CPtr> ret = t->opCList(in, out);
- test(out.size() == in.size());
- test(ret.size() == in.size());
- list<Test::CPtr>::const_iterator p1;
- list<Test::CPtr>::const_iterator p2;
- for(p1 = out.begin(), p2 = ret.begin(); p1 != out.end(); ++p1, ++p2)
- {
- test(*p1 == *p2);
- }
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+
+ list<Test::CPtr> out;
+ list<Test::CPtr> ret = t->opCList(in, out);
+ test(out.size() == in.size());
+ test(ret.size() == in.size());
+ list<Test::CPtr>::const_iterator p1;
+ list<Test::CPtr>::const_iterator p2;
+ for(p1 = out.begin(), p2 = ret.begin(); p1 != out.end(); ++p1, ++p2)
+ {
+ test(*p1 == *p2);
+ }
}
cout << "ok" << endl;
@@ -1544,422 +1544,422 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- bool inArray[5];
- for(int i = 0; i < 5; ++i)
- {
- inArray[i] = in[i];
- }
- pair<const bool*, const bool*> inPair(inArray, inArray + 5);
-
- AMI_TestIntf_opBoolArrayIPtr cb = new AMI_TestIntf_opBoolArrayI(in);
- t->opBoolArray_async(cb, inPair);
- test(cb->check());
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ bool inArray[5];
+ for(int i = 0; i < 5; ++i)
+ {
+ inArray[i] = in[i];
+ }
+ pair<const bool*, const bool*> inPair(inArray, inArray + 5);
+
+ AMI_TestIntf_opBoolArrayIPtr cb = new AMI_TestIntf_opBoolArrayI(in);
+ t->opBoolArray_async(cb, inPair);
+ test(cb->check());
}
{
- Ice::Byte in[5];
- in[0] = '1';
- in[1] = '2';
- in[2] = '3';
- in[3] = '4';
- in[4] = '5';
- pair<const Ice::Byte*, const Ice::Byte*> inPair(in, in + 5);
-
- AMI_TestIntf_opByteArrayIPtr cb = new AMI_TestIntf_opByteArrayI(inPair);
- t->opByteArray_async(cb, inPair);
- test(cb->check());
+ Ice::Byte in[5];
+ in[0] = '1';
+ in[1] = '2';
+ in[2] = '3';
+ in[3] = '4';
+ in[4] = '5';
+ pair<const Ice::Byte*, const Ice::Byte*> inPair(in, in + 5);
+
+ AMI_TestIntf_opByteArrayIPtr cb = new AMI_TestIntf_opByteArrayI(inPair);
+ t->opByteArray_async(cb, inPair);
+ test(cb->check());
}
{
Test::VariableList in;
- Test::Variable inArray[5];
- inArray[0].s = "These";
- in.push_back(inArray[0]);
- inArray[1].s = "are";
- in.push_back(inArray[1]);
- inArray[2].s = "five";
- in.push_back(inArray[2]);
- inArray[3].s = "short";
- in.push_back(inArray[3]);
- inArray[4].s = "strings.";
- in.push_back(inArray[4]);
- pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5);
-
- AMI_TestIntf_opVariableArrayIPtr cb = new AMI_TestIntf_opVariableArrayI(in);
- t->opVariableArray_async(cb, inPair);
- test(cb->check());
+ Test::Variable inArray[5];
+ inArray[0].s = "These";
+ in.push_back(inArray[0]);
+ inArray[1].s = "are";
+ in.push_back(inArray[1]);
+ inArray[2].s = "five";
+ in.push_back(inArray[2]);
+ inArray[3].s = "short";
+ in.push_back(inArray[3]);
+ inArray[4].s = "strings.";
+ in.push_back(inArray[4]);
+ pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5);
+
+ AMI_TestIntf_opVariableArrayIPtr cb = new AMI_TestIntf_opVariableArrayI(in);
+ t->opVariableArray_async(cb, inPair);
+ test(cb->check());
}
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end());
-
- AMI_TestIntf_opBoolRangeIPtr cb = new AMI_TestIntf_opBoolRangeI(in);
- t->opBoolRange_async(cb, inPair);
- test(cb->check());
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end());
+
+ AMI_TestIntf_opBoolRangeIPtr cb = new AMI_TestIntf_opBoolRangeI(in);
+ t->opBoolRange_async(cb, inPair);
+ test(cb->check());
}
{
Test::ByteList in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
- pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
-
- AMI_TestIntf_opByteRangeIPtr cb = new AMI_TestIntf_opByteRangeI(in);
- t->opByteRange_async(cb, inPair);
- test(cb->check());
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+ pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
+
+ AMI_TestIntf_opByteRangeIPtr cb = new AMI_TestIntf_opByteRangeI(in);
+ t->opByteRange_async(cb, inPair);
+ test(cb->check());
}
{
Test::VariableList in;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- v.s = "are";
- in.push_back(v);
- v.s = "five";
- in.push_back(v);
- v.s = "short";
- in.push_back(v);
- v.s = "strings.";
- in.push_back(v);
- pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end());
-
- AMI_TestIntf_opVariableRangeIPtr cb = new AMI_TestIntf_opVariableRangeI(in);
- t->opVariableRange_async(cb, inPair);
- test(cb->check());
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+ pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end());
+
+ AMI_TestIntf_opVariableRangeIPtr cb = new AMI_TestIntf_opVariableRangeI(in);
+ t->opVariableRange_async(cb, inPair);
+ test(cb->check());
}
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- bool inArray[5];
- for(int i = 0; i < 5; ++i)
- {
- inArray[i] = in[i];
- }
- pair<const bool*, const bool*> inPair(inArray, inArray + 5);
-
- AMI_TestIntf_opBoolRangeTypeIPtr cb = new AMI_TestIntf_opBoolRangeTypeI(in);
- t->opBoolRangeType_async(cb, inPair);
- test(cb->check());
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ bool inArray[5];
+ for(int i = 0; i < 5; ++i)
+ {
+ inArray[i] = in[i];
+ }
+ pair<const bool*, const bool*> inPair(inArray, inArray + 5);
+
+ AMI_TestIntf_opBoolRangeTypeIPtr cb = new AMI_TestIntf_opBoolRangeTypeI(in);
+ t->opBoolRangeType_async(cb, inPair);
+ test(cb->check());
}
{
Test::ByteList in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
- pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
-
- AMI_TestIntf_opByteRangeTypeIPtr cb = new AMI_TestIntf_opByteRangeTypeI(in);
- t->opByteRangeType_async(cb, inPair);
- test(cb->check());
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+ pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
+
+ AMI_TestIntf_opByteRangeTypeIPtr cb = new AMI_TestIntf_opByteRangeTypeI(in);
+ t->opByteRangeType_async(cb, inPair);
+ test(cb->check());
}
{
Test::VariableList in;
- deque<Test::Variable> inSeq;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "are";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "five";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "short";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "strings.";
- in.push_back(v);
- inSeq.push_back(v);
- pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator>
- inPair(inSeq.begin(), inSeq.end());
-
- AMI_TestIntf_opVariableRangeTypeIPtr cb = new AMI_TestIntf_opVariableRangeTypeI(in);
- t->opVariableRangeType_async(cb, inPair);
- test(cb->check());
+ deque<Test::Variable> inSeq;
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+ inSeq.push_back(v);
+ pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator>
+ inPair(inSeq.begin(), inSeq.end());
+
+ AMI_TestIntf_opVariableRangeTypeIPtr cb = new AMI_TestIntf_opVariableRangeTypeI(in);
+ t->opVariableRangeType_async(cb, inPair);
+ test(cb->check());
}
{
deque<bool> in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
-
- AMI_TestIntf_opBoolSeqIPtr cb = new AMI_TestIntf_opBoolSeqI(in);
- t->opBoolSeq_async(cb, in);
- test(cb->check());
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+
+ AMI_TestIntf_opBoolSeqIPtr cb = new AMI_TestIntf_opBoolSeqI(in);
+ t->opBoolSeq_async(cb, in);
+ test(cb->check());
}
{
list<bool> in;
- in.push_back(false);
- in.push_back(true);
- in.push_back(true);
- in.push_back(false);
- in.push_back(true);
-
- AMI_TestIntf_opBoolListIPtr cb = new AMI_TestIntf_opBoolListI(in);
- t->opBoolList_async(cb, in);
- test(cb->check());
+ in.push_back(false);
+ in.push_back(true);
+ in.push_back(true);
+ in.push_back(false);
+ in.push_back(true);
+
+ AMI_TestIntf_opBoolListIPtr cb = new AMI_TestIntf_opBoolListI(in);
+ t->opBoolList_async(cb, in);
+ test(cb->check());
}
{
deque< ::Ice::Byte> in(5);
- in[0] = '1';
- in[1] = '2';
- in[2] = '3';
- in[3] = '4';
- in[4] = '5';
-
- AMI_TestIntf_opByteSeqIPtr cb = new AMI_TestIntf_opByteSeqI(in);
- t->opByteSeq_async(cb, in);
- test(cb->check());
+ in[0] = '1';
+ in[1] = '2';
+ in[2] = '3';
+ in[3] = '4';
+ in[4] = '5';
+
+ AMI_TestIntf_opByteSeqIPtr cb = new AMI_TestIntf_opByteSeqI(in);
+ t->opByteSeq_async(cb, in);
+ test(cb->check());
}
{
list< ::Ice::Byte> in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
-
- AMI_TestIntf_opByteListIPtr cb = new AMI_TestIntf_opByteListI(in);
- t->opByteList_async(cb, in);
- test(cb->check());
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+
+ AMI_TestIntf_opByteListIPtr cb = new AMI_TestIntf_opByteListI(in);
+ t->opByteList_async(cb, in);
+ test(cb->check());
}
{
MyByteSeq in(5);
- int i = 0;
- for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p)
- {
- *p = '1' + i++;
- }
-
- AMI_TestIntf_opMyByteSeqIPtr cb = new AMI_TestIntf_opMyByteSeqI(in);
- t->opMyByteSeq_async(cb, in);
- test(cb->check());
+ int i = 0;
+ for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p)
+ {
+ *p = '1' + i++;
+ }
+
+ AMI_TestIntf_opMyByteSeqIPtr cb = new AMI_TestIntf_opMyByteSeqI(in);
+ t->opMyByteSeq_async(cb, in);
+ test(cb->check());
}
{
deque<string> in(5);
- in[0] = "These";
- in[1] = "are";
- in[2] = "five";
- in[3] = "short";
- in[4] = "strings.";
-
- AMI_TestIntf_opStringSeqIPtr cb = new AMI_TestIntf_opStringSeqI(in);
- t->opStringSeq_async(cb, in);
- test(cb->check());
+ in[0] = "These";
+ in[1] = "are";
+ in[2] = "five";
+ in[3] = "short";
+ in[4] = "strings.";
+
+ AMI_TestIntf_opStringSeqIPtr cb = new AMI_TestIntf_opStringSeqI(in);
+ t->opStringSeq_async(cb, in);
+ test(cb->check());
}
{
list<string> in;
- in.push_back("These");
- in.push_back("are");
- in.push_back("five");
- in.push_back("short");
- in.push_back("strings.");
-
- AMI_TestIntf_opStringListIPtr cb = new AMI_TestIntf_opStringListI(in);
- t->opStringList_async(cb, in);
- test(cb->check());
+ in.push_back("These");
+ in.push_back("are");
+ in.push_back("five");
+ in.push_back("short");
+ in.push_back("strings.");
+
+ AMI_TestIntf_opStringListIPtr cb = new AMI_TestIntf_opStringListI(in);
+ t->opStringList_async(cb, in);
+ test(cb->check());
}
{
deque<Test::Fixed> in(5);
- in[0].s = 1;
- in[1].s = 2;
- in[2].s = 3;
- in[3].s = 4;
- in[4].s = 5;
-
- AMI_TestIntf_opFixedSeqIPtr cb = new AMI_TestIntf_opFixedSeqI(in);
- t->opFixedSeq_async(cb, in);
- test(cb->check());
+ in[0].s = 1;
+ in[1].s = 2;
+ in[2].s = 3;
+ in[3].s = 4;
+ in[4].s = 5;
+
+ AMI_TestIntf_opFixedSeqIPtr cb = new AMI_TestIntf_opFixedSeqI(in);
+ t->opFixedSeq_async(cb, in);
+ test(cb->check());
}
{
list<Test::Fixed> in(5);
- short num = 1;
- for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p)
- {
- (*p).s = num++;
- }
-
- AMI_TestIntf_opFixedListIPtr cb = new AMI_TestIntf_opFixedListI(in);
- t->opFixedList_async(cb, in);
- test(cb->check());
+ short num = 1;
+ for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p)
+ {
+ (*p).s = num++;
+ }
+
+ AMI_TestIntf_opFixedListIPtr cb = new AMI_TestIntf_opFixedListI(in);
+ t->opFixedList_async(cb, in);
+ test(cb->check());
}
{
deque<Test::Variable> in(5);
- in[0].s = "These";
- in[1].s = "are";
- in[2].s = "five";
- in[3].s = "short";
- in[4].s = "strings.";
-
- AMI_TestIntf_opVariableSeqIPtr cb = new AMI_TestIntf_opVariableSeqI(in);
- t->opVariableSeq_async(cb, in);
- test(cb->check());
+ in[0].s = "These";
+ in[1].s = "are";
+ in[2].s = "five";
+ in[3].s = "short";
+ in[4].s = "strings.";
+
+ AMI_TestIntf_opVariableSeqIPtr cb = new AMI_TestIntf_opVariableSeqI(in);
+ t->opVariableSeq_async(cb, in);
+ test(cb->check());
}
{
list<Test::Variable> in;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- v.s = "are";
- in.push_back(v);
- v.s = "five";
- in.push_back(v);
- v.s = "short";
- in.push_back(v);
- v.s = "strings.";
- in.push_back(v);
-
- AMI_TestIntf_opVariableListIPtr cb = new AMI_TestIntf_opVariableListI(in);
- t->opVariableList_async(cb, in);
- test(cb->check());
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+
+ AMI_TestIntf_opVariableListIPtr cb = new AMI_TestIntf_opVariableListI(in);
+ t->opVariableList_async(cb, in);
+ test(cb->check());
}
{
deque<Test::StringStringDict> in(5);
- in[0]["A"] = "a";
- in[1]["B"] = "b";
- in[2]["C"] = "c";
- in[3]["D"] = "d";
- in[4]["E"] = "e";
-
- AMI_TestIntf_opStringStringDictSeqIPtr cb = new AMI_TestIntf_opStringStringDictSeqI(in);
- t->opStringStringDictSeq_async(cb, in);
- test(cb->check());
+ in[0]["A"] = "a";
+ in[1]["B"] = "b";
+ in[2]["C"] = "c";
+ in[3]["D"] = "d";
+ in[4]["E"] = "e";
+
+ AMI_TestIntf_opStringStringDictSeqIPtr cb = new AMI_TestIntf_opStringStringDictSeqI(in);
+ t->opStringStringDictSeq_async(cb, in);
+ test(cb->check());
}
{
list<Test::StringStringDict> in;
- Test::StringStringDict ssd;
- ssd["A"] = "a";
- in.push_back(ssd);
- ssd["B"] = "b";
- in.push_back(ssd);
- ssd["C"] = "c";
- in.push_back(ssd);
- ssd["D"] = "d";
- in.push_back(ssd);
- ssd["E"] = "e";
- in.push_back(ssd);
-
- AMI_TestIntf_opStringStringDictListIPtr cb = new AMI_TestIntf_opStringStringDictListI(in);
- t->opStringStringDictList_async(cb, in);
- test(cb->check());
+ Test::StringStringDict ssd;
+ ssd["A"] = "a";
+ in.push_back(ssd);
+ ssd["B"] = "b";
+ in.push_back(ssd);
+ ssd["C"] = "c";
+ in.push_back(ssd);
+ ssd["D"] = "d";
+ in.push_back(ssd);
+ ssd["E"] = "e";
+ in.push_back(ssd);
+
+ AMI_TestIntf_opStringStringDictListIPtr cb = new AMI_TestIntf_opStringStringDictListI(in);
+ t->opStringStringDictList_async(cb, in);
+ test(cb->check());
}
{
deque<Test::E> in(5);
- in[0] = Test::E1;
- in[1] = Test::E2;
- in[2] = Test::E3;
- in[3] = Test::E1;
- in[4] = Test::E3;
-
- AMI_TestIntf_opESeqIPtr cb = new AMI_TestIntf_opESeqI(in);
- t->opESeq_async(cb, in);
- test(cb->check());
+ in[0] = Test::E1;
+ in[1] = Test::E2;
+ in[2] = Test::E3;
+ in[3] = Test::E1;
+ in[4] = Test::E3;
+
+ AMI_TestIntf_opESeqIPtr cb = new AMI_TestIntf_opESeqI(in);
+ t->opESeq_async(cb, in);
+ test(cb->check());
}
{
list<Test::E> in;
- in.push_back(Test::E1);
- in.push_back(Test::E2);
- in.push_back(Test::E3);
- in.push_back(Test::E1);
- in.push_back(Test::E3);
-
- AMI_TestIntf_opEListIPtr cb = new AMI_TestIntf_opEListI(in);
- t->opEList_async(cb, in);
- test(cb->check());
+ in.push_back(Test::E1);
+ in.push_back(Test::E2);
+ in.push_back(Test::E3);
+ in.push_back(Test::E1);
+ in.push_back(Test::E3);
+
+ AMI_TestIntf_opEListIPtr cb = new AMI_TestIntf_opEListI(in);
+ t->opEList_async(cb, in);
+ test(cb->check());
}
{
deque<Test::CPrx> in(5);
- in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"));
- in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"));
- in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"));
- in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"));
- in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"));
-
- AMI_TestIntf_opCPrxSeqIPtr cb = new AMI_TestIntf_opCPrxSeqI(in);
- t->opCPrxSeq_async(cb, in);
- test(cb->check());
+ in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"));
+ in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"));
+ in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"));
+ in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"));
+ in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"));
+
+ AMI_TestIntf_opCPrxSeqIPtr cb = new AMI_TestIntf_opCPrxSeqI(in);
+ t->opCPrxSeq_async(cb, in);
+ test(cb->check());
}
{
list<Test::CPrx> in;
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")));
-
- AMI_TestIntf_opCPrxListIPtr cb = new AMI_TestIntf_opCPrxListI(in);
- t->opCPrxList_async(cb, in);
- test(cb->check());
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")));
+
+ AMI_TestIntf_opCPrxListIPtr cb = new AMI_TestIntf_opCPrxListI(in);
+ t->opCPrxList_async(cb, in);
+ test(cb->check());
}
{
deque<Test::CPtr> in(5);
- in[0] = new Test::C();
- in[1] = in[0];
- in[2] = in[0];
- in[3] = in[0];
- in[4] = in[0];
-
- AMI_TestIntf_opCSeqIPtr cb = new AMI_TestIntf_opCSeqI(in);
- t->opCSeq_async(cb, in);
- test(cb->check());
+ in[0] = new Test::C();
+ in[1] = in[0];
+ in[2] = in[0];
+ in[3] = in[0];
+ in[4] = in[0];
+
+ AMI_TestIntf_opCSeqIPtr cb = new AMI_TestIntf_opCSeqI(in);
+ t->opCSeq_async(cb, in);
+ test(cb->check());
}
{
list<Test::CPtr> in;
- in.push_back(new Test::C());
- in.push_back(new Test::C());
- in.push_back(new Test::C());
- in.push_back(new Test::C());
- in.push_back(new Test::C());
-
- AMI_TestIntf_opCListIPtr cb = new AMI_TestIntf_opCListI(in);
- t->opCList_async(cb, in);
- test(cb->check());
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+ in.push_back(new Test::C());
+
+ AMI_TestIntf_opCListIPtr cb = new AMI_TestIntf_opCListI(in);
+ t->opCList_async(cb, in);
+ test(cb->check());
}
cout << "ok" << endl;
@@ -1987,10 +1987,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
cout << "testing class mapped structs with AMI... " << flush;
- AMI_TestIntf_opClassStructIPtr cb = new AMI_TestIntf_opClassStructI(cs, csseq1);
- t->opClassStruct_async(cb, cs, csseq1);
- test(cb->check());
- cout << "ok" << endl;
+ AMI_TestIntf_opClassStructIPtr cb = new AMI_TestIntf_opClassStructI(cs, csseq1);
+ t->opClassStruct_async(cb, cs, csseq1);
+ test(cb->check());
+ cout << "ok" << endl;
}
cout << "testing wstring... " << flush;
@@ -2008,14 +2008,14 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
wdict2 = wdict1;
ref = communicator->getProperties()->getPropertyWithDefault(
- "Custom.WstringProxy1", "wstring1:default -p 12010 -t 10000");
+ "Custom.WstringProxy1", "wstring1:default -p 12010 -t 10000");
base = communicator->stringToProxy(ref);
test(base);
Test1::WstringClassPrx wsc1 = Test1::WstringClassPrx::checkedCast(base);
test(t);
ref = communicator->getProperties()->getPropertyWithDefault(
- "Custom.WstringProxy2", "wstring2:default -p 12010 -t 10000");
+ "Custom.WstringProxy2", "wstring2:default -p 12010 -t 10000");
base = communicator->stringToProxy(ref);
test(base);
Test2::WstringClassPrx wsc2 = Test2::WstringClassPrx::checkedCast(base);
@@ -2029,9 +2029,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
- AMI_Test1_opStringIPtr cb = new AMI_Test1_opStringI(wstr);
- wsc1->opString_async(cb, wstr);
- test(cb->check());
+ AMI_Test1_opStringIPtr cb = new AMI_Test1_opStringI(wstr);
+ wsc1->opString_async(cb, wstr);
+ test(cb->check());
}
ret = wsc2->opString(wstr, out);
@@ -2040,9 +2040,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
- AMI_Test2_opStringIPtr cb = new AMI_Test2_opStringI(wstr);
- wsc2->opString_async(cb, wstr);
- test(cb->check());
+ AMI_Test2_opStringIPtr cb = new AMI_Test2_opStringI(wstr);
+ wsc2->opString_async(cb, wstr);
+ test(cb->check());
}
Test1::WstringStruct wss1;
@@ -2070,9 +2070,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
- AMI_Test1_throwExceptIPtr cb = new AMI_Test1_throwExceptI(wstr);
- wsc1->throwExcept_async(cb, wstr);
- test(cb->check());
+ AMI_Test1_throwExceptIPtr cb = new AMI_Test1_throwExceptI(wstr);
+ wsc1->throwExcept_async(cb, wstr);
+ test(cb->check());
}
try
@@ -2086,9 +2086,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
- AMI_Test2_throwExceptIPtr cb = new AMI_Test2_throwExceptI(wstr);
- wsc2->throwExcept_async(cb, wstr);
- test(cb->check());
+ AMI_Test2_throwExceptIPtr cb = new AMI_Test2_throwExceptI(wstr);
+ wsc2->throwExcept_async(cb, wstr);
+ test(cb->check());
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/custom/Client.cpp b/cpp/test/Ice/custom/Client.cpp
index 14e524cc20e..6241f91a320 100644
--- a/cpp/test/Ice/custom/Client.cpp
+++ b/cpp/test/Ice/custom/Client.cpp
@@ -33,8 +33,8 @@ main(int argc, char** argv)
try
{
Ice::InitializationData initData;
- initData.stringConverter = new Test::StringConverterI();
- initData.wstringConverter = new Test::WstringConverterI();
+ initData.stringConverter = new Test::StringConverterI();
+ initData.wstringConverter = new Test::WstringConverterI();
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/custom/Collocated.cpp b/cpp/test/Ice/custom/Collocated.cpp
index fea1ce2681a..b7da06a2c82 100644
--- a/cpp/test/Ice/custom/Collocated.cpp
+++ b/cpp/test/Ice/custom/Collocated.cpp
@@ -38,11 +38,11 @@ main(int argc, char** argv)
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000");
- initData.stringConverter = new Test::StringConverterI();
- initData.wstringConverter = new Test::WstringConverterI();
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ initData.stringConverter = new Test::StringConverterI();
+ initData.wstringConverter = new Test::WstringConverterI();
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/custom/MyByteSeq.cpp b/cpp/test/Ice/custom/MyByteSeq.cpp
index de8306692cc..0fcdf2b4f74 100644
--- a/cpp/test/Ice/custom/MyByteSeq.cpp
+++ b/cpp/test/Ice/custom/MyByteSeq.cpp
@@ -31,7 +31,7 @@ MyByteSeq::MyByteSeq(const MyByteSeq& seq)
if(_size != 0)
{
_data = (Ice::Byte*)malloc(_size);
- memcpy(_data, seq._data, _size);
+ memcpy(_data, seq._data, _size);
}
else
{
@@ -82,13 +82,13 @@ MyByteSeq::operator=(const MyByteSeq& rhs)
if(_data != 0)
{
free(_data);
- _data = 0;
+ _data = 0;
}
_size = rhs._size;
if(_size != 0)
{
_data = (Ice::Byte*)malloc(_size);
- memcpy(_data, rhs._data, _size);
+ memcpy(_data, rhs._data, _size);
}
}
diff --git a/cpp/test/Ice/custom/Server.cpp b/cpp/test/Ice/custom/Server.cpp
index 0e3925e6c08..15ef0f01bf9 100644
--- a/cpp/test/Ice/custom/Server.cpp
+++ b/cpp/test/Ice/custom/Server.cpp
@@ -37,11 +37,11 @@ main(int argc, char** argv)
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000");
- initData.stringConverter = new Test::StringConverterI();
- initData.wstringConverter = new Test::WstringConverterI();
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ initData.stringConverter = new Test::StringConverterI();
+ initData.wstringConverter = new Test::WstringConverterI();
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/custom/ServerAMD.cpp b/cpp/test/Ice/custom/ServerAMD.cpp
index 92c0fad867c..d4ccd779899 100644
--- a/cpp/test/Ice/custom/ServerAMD.cpp
+++ b/cpp/test/Ice/custom/ServerAMD.cpp
@@ -37,12 +37,12 @@ main(int argc, char** argv)
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
-
- initData.properties->setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000");
- initData.stringConverter = new Test::StringConverterI();
- initData.wstringConverter = new Test::WstringConverterI();
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+
+ initData.properties->setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ initData.stringConverter = new Test::StringConverterI();
+ initData.wstringConverter = new Test::WstringConverterI();
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/custom/StringConverterI.cpp b/cpp/test/Ice/custom/StringConverterI.cpp
index f3798ad5db5..626a3626476 100644
--- a/cpp/test/Ice/custom/StringConverterI.cpp
+++ b/cpp/test/Ice/custom/StringConverterI.cpp
@@ -30,7 +30,7 @@ Test::StringConverterI::toUTF8(const char* sourceStart, const char* sourceEnd, I
void
Test::StringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- string& target) const
+ string& target) const
{
size_t size = static_cast<size_t>(sourceEnd - sourceStart);
target.resize(size);
@@ -63,7 +63,7 @@ Test::WstringConverterI::toUTF8(const wchar_t* sourceStart, const wchar_t* sourc
void
Test::WstringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- wstring& target) const
+ wstring& target) const
{
size_t size = static_cast<size_t>(sourceEnd - sourceStart);
string s;
diff --git a/cpp/test/Ice/custom/StringConverterI.h b/cpp/test/Ice/custom/StringConverterI.h
index 6d555358398..9a2d63cfd9b 100644
--- a/cpp/test/Ice/custom/StringConverterI.h
+++ b/cpp/test/Ice/custom/StringConverterI.h
@@ -26,7 +26,7 @@ public:
virtual Ice::Byte* toUTF8(const char*, const char*, Ice::UTF8Buffer&) const;
virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- std::string& target) const;
+ std::string& target) const;
};
class WstringConverterI : public Ice::WstringConverter
@@ -35,7 +35,7 @@ public:
virtual Ice::Byte* toUTF8(const wchar_t*, const wchar_t*, Ice::UTF8Buffer&) const;
virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- std::wstring& target) const;
+ std::wstring& target) const;
};
diff --git a/cpp/test/Ice/custom/Test.ice b/cpp/test/Ice/custom/Test.ice
index baa8cceb1e3..ec21d2d7802 100644
--- a/cpp/test/Ice/custom/Test.ice
+++ b/cpp/test/Ice/custom/Test.ice
@@ -139,7 +139,7 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq
opByteSeq(["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq inSeq,
- out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq);
+ out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq);
ByteList opByteList(ByteList inSeq, out ByteList outSeq);
@@ -148,7 +148,7 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque<std::string>"] StringSeq
opStringSeq(["cpp:type:std::deque<std::string>"] StringSeq inSeq,
- out ["cpp:type:std::deque<std::string>"] StringSeq outSeq);
+ out ["cpp:type:std::deque<std::string>"] StringSeq outSeq);
StringList opStringList(StringList inSeq, out StringList outSeq);
@@ -160,13 +160,13 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque< ::Test::Variable>"] VariableSeq
opVariableSeq(["cpp:type:std::deque< ::Test::Variable>"] VariableSeq inSeq,
- out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq);
VariableList opVariableList(VariableList inSeq, out VariableList outSeq);
["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq
opStringStringDictSeq(["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq inSeq,
- out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq);
StringStringDictList opStringStringDictList(StringStringDictList inSeq, out StringStringDictList outSeq);
@@ -177,7 +177,7 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq
opCPrxSeq(["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq inSeq,
- out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq);
CPrxList opCPrxList(CPrxList inSeq, out CPrxList outSeq);
diff --git a/cpp/test/Ice/custom/TestAMD.ice b/cpp/test/Ice/custom/TestAMD.ice
index 736131296fe..b0c8383855b 100644
--- a/cpp/test/Ice/custom/TestAMD.ice
+++ b/cpp/test/Ice/custom/TestAMD.ice
@@ -139,7 +139,7 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq
opByteSeq(["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq inSeq,
- out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq);
+ out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq);
ByteList opByteList(ByteList inSeq, out ByteList outSeq);
@@ -148,7 +148,7 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque<std::string>"] StringSeq
opStringSeq(["cpp:type:std::deque<std::string>"] StringSeq inSeq,
- out ["cpp:type:std::deque<std::string>"] StringSeq outSeq);
+ out ["cpp:type:std::deque<std::string>"] StringSeq outSeq);
StringList opStringList(StringList inSeq, out StringList outSeq);
@@ -160,13 +160,13 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque< ::Test::Variable>"] VariableSeq
opVariableSeq(["cpp:type:std::deque< ::Test::Variable>"] VariableSeq inSeq,
- out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq);
VariableList opVariableList(VariableList inSeq, out VariableList outSeq);
["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq
opStringStringDictSeq(["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq inSeq,
- out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq);
StringStringDictList opStringStringDictList(StringStringDictList inSeq, out StringStringDictList outSeq);
@@ -177,7 +177,7 @@ sequence<ClassStruct> ClassStructSeq;
["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq
opCPrxSeq(["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq inSeq,
- out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq);
CPrxList opCPrxList(CPrxList inSeq, out CPrxList outSeq);
diff --git a/cpp/test/Ice/custom/TestAMDI.cpp b/cpp/test/Ice/custom/TestAMDI.cpp
index b7c4cd26c79..e323194c210 100644
--- a/cpp/test/Ice/custom/TestAMDI.cpp
+++ b/cpp/test/Ice/custom/TestAMDI.cpp
@@ -17,8 +17,8 @@ TestIntfI::TestIntfI(const Ice::CommunicatorPtr& communicator)
void
TestIntfI::opDoubleArray_async(const Test::AMD_TestIntf_opDoubleArrayPtr& opDoubleArrayCB,
- const std::pair<const Ice::Double*, const Ice::Double*>& inSeq,
- const Ice::Current& current)
+ const std::pair<const Ice::Double*, const Ice::Double*>& inSeq,
+ const Ice::Current& current)
{
Test::DoubleSeq outSeq(inSeq.first, inSeq.second);
opDoubleArrayCB->ice_response(outSeq, outSeq);
@@ -26,8 +26,8 @@ TestIntfI::opDoubleArray_async(const Test::AMD_TestIntf_opDoubleArrayPtr& opDoub
void
TestIntfI::opBoolArray_async(const Test::AMD_TestIntf_opBoolArrayPtr& opBoolArrayCB,
- const std::pair<const bool*, const bool*>& inSeq,
- const Ice::Current& current)
+ const std::pair<const bool*, const bool*>& inSeq,
+ const Ice::Current& current)
{
Test::BoolSeq outSeq(inSeq.first, inSeq.second);
opBoolArrayCB->ice_response(outSeq, outSeq);
@@ -35,16 +35,16 @@ TestIntfI::opBoolArray_async(const Test::AMD_TestIntf_opBoolArrayPtr& opBoolArra
void
TestIntfI::opByteArray_async(const Test::AMD_TestIntf_opByteArrayPtr& opByteArrayCB,
- const std::pair<const Ice::Byte*, const Ice::Byte*>& inSeq,
- const Ice::Current& current)
+ const std::pair<const Ice::Byte*, const Ice::Byte*>& inSeq,
+ const Ice::Current& current)
{
opByteArrayCB->ice_response(inSeq, inSeq);
}
void
TestIntfI::opVariableArray_async(const Test::AMD_TestIntf_opVariableArrayPtr& opVariableArrayCB,
- const std::pair<const Test::Variable*, const Test::Variable*>& inSeq,
- const Ice::Current& current)
+ const std::pair<const Test::Variable*, const Test::Variable*>& inSeq,
+ const Ice::Current& current)
{
Test::VariableList outSeq(inSeq.first, inSeq.second);
opVariableArrayCB->ice_response(outSeq, outSeq);
@@ -52,8 +52,8 @@ TestIntfI::opVariableArray_async(const Test::AMD_TestIntf_opVariableArrayPtr& op
void
TestIntfI::opBoolRange_async(const Test::AMD_TestIntf_opBoolRangePtr& opBoolRangeCB,
- const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>& inSeq,
- const Ice::Current& current)
+ const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>& inSeq,
+ const Ice::Current& current)
{
Test::BoolSeq outSeq(inSeq.first, inSeq.second);
opBoolRangeCB->ice_response(outSeq, outSeq);
@@ -61,17 +61,17 @@ TestIntfI::opBoolRange_async(const Test::AMD_TestIntf_opBoolRangePtr& opBoolRang
void
TestIntfI::opByteRange_async(const Test::AMD_TestIntf_opByteRangePtr& opByteRangeCB,
- const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
- const Ice::Current& current)
+ const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
+ const Ice::Current& current)
{
opByteRangeCB->ice_response(inSeq, inSeq);
}
void
TestIntfI::opVariableRange_async(const Test::AMD_TestIntf_opVariableRangePtr& opVariableRangeCB,
- const std::pair<Test::VariableList::const_iterator,
- Test::VariableList::const_iterator>& inSeq,
- const Ice::Current& current)
+ const std::pair<Test::VariableList::const_iterator,
+ Test::VariableList::const_iterator>& inSeq,
+ const Ice::Current& current)
{
Test::VariableList outSeq(inSeq.first, inSeq.second);
opVariableRangeCB->ice_response(outSeq, outSeq);
@@ -79,8 +79,8 @@ TestIntfI::opVariableRange_async(const Test::AMD_TestIntf_opVariableRangePtr& op
void
TestIntfI::opBoolRangeType_async(const Test::AMD_TestIntf_opBoolRangeTypePtr& opBoolRangeTypeCB,
- const std::pair<const bool*, const bool*>& inSeq,
- const Ice::Current& current)
+ const std::pair<const bool*, const bool*>& inSeq,
+ const Ice::Current& current)
{
Test::BoolSeq outSeq(inSeq.first, inSeq.second);
opBoolRangeTypeCB->ice_response(outSeq, outSeq);
@@ -88,8 +88,8 @@ TestIntfI::opBoolRangeType_async(const Test::AMD_TestIntf_opBoolRangeTypePtr& op
void
TestIntfI::opByteRangeType_async(const Test::AMD_TestIntf_opByteRangeTypePtr& opByteRangeTypeCB,
- const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
- const Ice::Current& current)
+ const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
+ const Ice::Current& current)
{
Test::ByteList outSeq(inSeq.first, inSeq.second);
opByteRangeTypeCB->ice_response(outSeq, outSeq);
@@ -97,22 +97,22 @@ TestIntfI::opByteRangeType_async(const Test::AMD_TestIntf_opByteRangeTypePtr& op
void
TestIntfI::opVariableRangeType_async(const Test::AMD_TestIntf_opVariableRangeTypePtr& opVariableRangeTypeCB,
- const std::pair<std::deque<Test::Variable>::const_iterator,
- std::deque<Test::Variable>::const_iterator>& inSeq,
- const Ice::Current& current)
+ const std::pair<std::deque<Test::Variable>::const_iterator,
+ std::deque<Test::Variable>::const_iterator>& inSeq,
+ const Ice::Current& current)
{
Test::VariableList outSeq;
for(std::deque<Test::Variable>::const_iterator p = inSeq.first; p != inSeq.second; ++p)
{
- outSeq.push_back(*p);
+ outSeq.push_back(*p);
}
opVariableRangeTypeCB->ice_response(outSeq, outSeq);
}
void
TestIntfI::opBoolSeq_async(const Test::AMD_TestIntf_opBoolSeqPtr& opBoolSeqCB,
- const std::deque<bool>& inSeq,
- const Ice::Current& current)
+ const std::deque<bool>& inSeq,
+ const Ice::Current& current)
{
std::deque<bool> outSeq(inSeq);
opBoolSeqCB->ice_response(outSeq, outSeq);
@@ -120,8 +120,8 @@ TestIntfI::opBoolSeq_async(const Test::AMD_TestIntf_opBoolSeqPtr& opBoolSeqCB,
void
TestIntfI::opBoolList_async(const Test::AMD_TestIntf_opBoolListPtr& opBoolListCB,
- const Test::BoolList& inSeq,
- const Ice::Current& current)
+ const Test::BoolList& inSeq,
+ const Ice::Current& current)
{
Test::BoolList outSeq(inSeq);
opBoolListCB->ice_response(outSeq, outSeq);
@@ -129,8 +129,8 @@ TestIntfI::opBoolList_async(const Test::AMD_TestIntf_opBoolListPtr& opBoolListCB
void
TestIntfI::opByteSeq_async(const Test::AMD_TestIntf_opByteSeqPtr& opByteSeqCB,
- const std::deque<Ice::Byte>& inSeq,
- const Ice::Current& current)
+ const std::deque<Ice::Byte>& inSeq,
+ const Ice::Current& current)
{
std::deque<Ice::Byte> outSeq(inSeq);
opByteSeqCB->ice_response(outSeq, outSeq);
@@ -138,8 +138,8 @@ TestIntfI::opByteSeq_async(const Test::AMD_TestIntf_opByteSeqPtr& opByteSeqCB,
void
TestIntfI::opByteList_async(const Test::AMD_TestIntf_opByteListPtr& opByteListCB,
- const Test::ByteList& inSeq,
- const Ice::Current& current)
+ const Test::ByteList& inSeq,
+ const Ice::Current& current)
{
Test::ByteList outSeq(inSeq);
opByteListCB->ice_response(outSeq, outSeq);
@@ -147,8 +147,8 @@ TestIntfI::opByteList_async(const Test::AMD_TestIntf_opByteListPtr& opByteListCB
void
TestIntfI::opMyByteSeq_async(const Test::AMD_TestIntf_opMyByteSeqPtr& opMyByteSeqCB,
- const MyByteSeq& inSeq,
- const Ice::Current& current)
+ const MyByteSeq& inSeq,
+ const Ice::Current& current)
{
MyByteSeq outSeq(inSeq);
opMyByteSeqCB->ice_response(outSeq, outSeq);
@@ -156,8 +156,8 @@ TestIntfI::opMyByteSeq_async(const Test::AMD_TestIntf_opMyByteSeqPtr& opMyByteSe
void
TestIntfI::opStringSeq_async(const Test::AMD_TestIntf_opStringSeqPtr& opStringSeqCB,
- const std::deque<std::string>& inSeq,
- const Ice::Current& current)
+ const std::deque<std::string>& inSeq,
+ const Ice::Current& current)
{
std::deque<std::string> outSeq(inSeq);
opStringSeqCB->ice_response(outSeq, outSeq);
@@ -165,8 +165,8 @@ TestIntfI::opStringSeq_async(const Test::AMD_TestIntf_opStringSeqPtr& opStringSe
void
TestIntfI::opStringList_async(const Test::AMD_TestIntf_opStringListPtr& opStringListCB,
- const Test::StringList& inSeq,
- const Ice::Current& current)
+ const Test::StringList& inSeq,
+ const Ice::Current& current)
{
Test::StringList outSeq(inSeq);
opStringListCB->ice_response(outSeq, outSeq);
@@ -174,8 +174,8 @@ TestIntfI::opStringList_async(const Test::AMD_TestIntf_opStringListPtr& opString
void
TestIntfI::opFixedSeq_async(const Test::AMD_TestIntf_opFixedSeqPtr& opFixedSeqCB,
- const std::deque<Test::Fixed>& inSeq,
- const Ice::Current& current)
+ const std::deque<Test::Fixed>& inSeq,
+ const Ice::Current& current)
{
std::deque<Test::Fixed> outSeq(inSeq);
opFixedSeqCB->ice_response(outSeq, outSeq);
@@ -183,8 +183,8 @@ TestIntfI::opFixedSeq_async(const Test::AMD_TestIntf_opFixedSeqPtr& opFixedSeqCB
void
TestIntfI::opFixedList_async(const Test::AMD_TestIntf_opFixedListPtr& opFixedListCB,
- const Test::FixedList& inSeq,
- const Ice::Current& current)
+ const Test::FixedList& inSeq,
+ const Ice::Current& current)
{
Test::FixedList outSeq(inSeq);
opFixedListCB->ice_response(outSeq, outSeq);
@@ -192,8 +192,8 @@ TestIntfI::opFixedList_async(const Test::AMD_TestIntf_opFixedListPtr& opFixedLis
void
TestIntfI::opVariableSeq_async(const Test::AMD_TestIntf_opVariableSeqPtr& opVariableSeqCB,
- const std::deque<Test::Variable>& inSeq,
- const Ice::Current& current)
+ const std::deque<Test::Variable>& inSeq,
+ const Ice::Current& current)
{
std::deque<Test::Variable> outSeq(inSeq);
opVariableSeqCB->ice_response(outSeq, outSeq);
@@ -201,8 +201,8 @@ TestIntfI::opVariableSeq_async(const Test::AMD_TestIntf_opVariableSeqPtr& opVari
void
TestIntfI::opVariableList_async(const Test::AMD_TestIntf_opVariableListPtr& opVariableListCB,
- const Test::VariableList& inSeq,
- const Ice::Current& current)
+ const Test::VariableList& inSeq,
+ const Ice::Current& current)
{
Test::VariableList outSeq(inSeq);
opVariableListCB->ice_response(outSeq, outSeq);
@@ -210,8 +210,8 @@ TestIntfI::opVariableList_async(const Test::AMD_TestIntf_opVariableListPtr& opVa
void
TestIntfI::opStringStringDictSeq_async(const Test::AMD_TestIntf_opStringStringDictSeqPtr& opStringStringDictSeqCB,
- const std::deque<Test::StringStringDict>& inSeq,
- const Ice::Current& current)
+ const std::deque<Test::StringStringDict>& inSeq,
+ const Ice::Current& current)
{
std::deque<Test::StringStringDict> outSeq(inSeq);
opStringStringDictSeqCB->ice_response(outSeq, outSeq);
@@ -219,8 +219,8 @@ TestIntfI::opStringStringDictSeq_async(const Test::AMD_TestIntf_opStringStringDi
void
TestIntfI::opStringStringDictList_async(const Test::AMD_TestIntf_opStringStringDictListPtr& opStringStringDictListCB,
- const Test::StringStringDictList& inSeq,
- const Ice::Current& current)
+ const Test::StringStringDictList& inSeq,
+ const Ice::Current& current)
{
Test::StringStringDictList outSeq(inSeq);
opStringStringDictListCB->ice_response(outSeq, outSeq);
@@ -228,8 +228,8 @@ TestIntfI::opStringStringDictList_async(const Test::AMD_TestIntf_opStringStringD
void
TestIntfI::opESeq_async(const Test::AMD_TestIntf_opESeqPtr& opESeqCB,
- const std::deque<Test::E>& inSeq,
- const Ice::Current& current)
+ const std::deque<Test::E>& inSeq,
+ const Ice::Current& current)
{
std::deque<Test::E> outSeq(inSeq);
opESeqCB->ice_response(outSeq, outSeq);
@@ -237,8 +237,8 @@ TestIntfI::opESeq_async(const Test::AMD_TestIntf_opESeqPtr& opESeqCB,
void
TestIntfI::opEList_async(const Test::AMD_TestIntf_opEListPtr& opEListCB,
- const Test::EList& inSeq,
- const Ice::Current& current)
+ const Test::EList& inSeq,
+ const Ice::Current& current)
{
Test::EList outSeq(inSeq);
opEListCB->ice_response(outSeq, outSeq);
@@ -246,8 +246,8 @@ TestIntfI::opEList_async(const Test::AMD_TestIntf_opEListPtr& opEListCB,
void
TestIntfI::opCPrxSeq_async(const Test::AMD_TestIntf_opCPrxSeqPtr& opCPrxSeqCB,
- const std::deque<Test::CPrx>& inSeq,
- const Ice::Current& current)
+ const std::deque<Test::CPrx>& inSeq,
+ const Ice::Current& current)
{
std::deque<Test::CPrx> outSeq(inSeq);
opCPrxSeqCB->ice_response(outSeq, outSeq);
@@ -255,8 +255,8 @@ TestIntfI::opCPrxSeq_async(const Test::AMD_TestIntf_opCPrxSeqPtr& opCPrxSeqCB,
void
TestIntfI::opCPrxList_async(const Test::AMD_TestIntf_opCPrxListPtr& opCPrxListCB,
- const Test::CPrxList& inSeq,
- const Ice::Current& current)
+ const Test::CPrxList& inSeq,
+ const Ice::Current& current)
{
Test::CPrxList outSeq(inSeq);
opCPrxListCB->ice_response(outSeq, outSeq);
@@ -264,8 +264,8 @@ TestIntfI::opCPrxList_async(const Test::AMD_TestIntf_opCPrxListPtr& opCPrxListCB
void
TestIntfI::opCSeq_async(const Test::AMD_TestIntf_opCSeqPtr& opCSeqCB,
- const std::deque<Test::CPtr>& inSeq,
- const Ice::Current& current)
+ const std::deque<Test::CPtr>& inSeq,
+ const Ice::Current& current)
{
std::deque<Test::CPtr> outSeq(inSeq);
opCSeqCB->ice_response(outSeq, outSeq);
@@ -273,8 +273,8 @@ TestIntfI::opCSeq_async(const Test::AMD_TestIntf_opCSeqPtr& opCSeqCB,
void
TestIntfI::opCList_async(const Test::AMD_TestIntf_opCListPtr& opCListCB,
- const Test::CList& inSeq,
- const Ice::Current& current)
+ const Test::CList& inSeq,
+ const Ice::Current& current)
{
Test::CList outSeq(inSeq);
opCListCB->ice_response(outSeq, outSeq);
@@ -282,16 +282,16 @@ TestIntfI::opCList_async(const Test::AMD_TestIntf_opCListPtr& opCListCB,
void
TestIntfI::opClassStruct_async(const ::Test::AMD_TestIntf_opClassStructPtr& cb,
- const ::Test::ClassStructPtr& inS,
- const ::Test::ClassStructSeq& inSeq,
- const ::Ice::Current&)
+ const ::Test::ClassStructPtr& inS,
+ const ::Test::ClassStructSeq& inSeq,
+ const ::Ice::Current&)
{
cb->ice_response(inS, inS, inSeq);
}
void
TestIntfI::shutdown_async(const Test::AMD_TestIntf_shutdownPtr& shutdownCB,
- const Ice::Current& current)
+ const Ice::Current& current)
{
_communicator->shutdown();
shutdownCB->ice_response();
diff --git a/cpp/test/Ice/custom/TestAMDI.h b/cpp/test/Ice/custom/TestAMDI.h
index 634d7f64ce8..04133eb2e50 100644
--- a/cpp/test/Ice/custom/TestAMDI.h
+++ b/cpp/test/Ice/custom/TestAMDI.h
@@ -19,130 +19,130 @@ public:
TestIntfI(const Ice::CommunicatorPtr&);
virtual void opDoubleArray_async(const Test::AMD_TestIntf_opDoubleArrayPtr&,
- const std::pair<const Ice::Double*, const Ice::Double*>&,
- const Ice::Current&);
+ const std::pair<const Ice::Double*, const Ice::Double*>&,
+ const Ice::Current&);
virtual void opBoolArray_async(const Test::AMD_TestIntf_opBoolArrayPtr&,
- const std::pair<const bool*, const bool*>&,
- const Ice::Current&);
+ const std::pair<const bool*, const bool*>&,
+ const Ice::Current&);
virtual void opByteArray_async(const Test::AMD_TestIntf_opByteArrayPtr&,
- const std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- const Ice::Current&);
+ const std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
+ const Ice::Current&);
virtual void opVariableArray_async(const Test::AMD_TestIntf_opVariableArrayPtr&,
- const std::pair<const Test::Variable*, const Test::Variable*>&,
- const Ice::Current&);
+ const std::pair<const Test::Variable*, const Test::Variable*>&,
+ const Ice::Current&);
virtual void opBoolRange_async(const Test::AMD_TestIntf_opBoolRangePtr&,
- const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>&,
- const Ice::Current&);
+ const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>&,
+ const Ice::Current&);
virtual void opByteRange_async(const Test::AMD_TestIntf_opByteRangePtr&,
- const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&,
- const Ice::Current&);
+ const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&,
+ const Ice::Current&);
virtual void opVariableRange_async(const Test::AMD_TestIntf_opVariableRangePtr&,
- const std::pair<Test::VariableList::const_iterator,
- Test::VariableList::const_iterator>&,
- const Ice::Current&);
+ const std::pair<Test::VariableList::const_iterator,
+ Test::VariableList::const_iterator>&,
+ const Ice::Current&);
virtual void opBoolRangeType_async(const Test::AMD_TestIntf_opBoolRangeTypePtr&,
- const std::pair<const bool*, const bool*>&,
- const Ice::Current&);
+ const std::pair<const bool*, const bool*>&,
+ const Ice::Current&);
virtual void opByteRangeType_async(const Test::AMD_TestIntf_opByteRangeTypePtr&,
- const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&,
- const Ice::Current&);
+ const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&,
+ const Ice::Current&);
virtual void opVariableRangeType_async(const Test::AMD_TestIntf_opVariableRangeTypePtr&,
- const std::pair<std::deque<Test::Variable>::const_iterator,
- std::deque<Test::Variable>::const_iterator>&,
- const Ice::Current&);
+ const std::pair<std::deque<Test::Variable>::const_iterator,
+ std::deque<Test::Variable>::const_iterator>&,
+ const Ice::Current&);
virtual void opBoolSeq_async(const Test::AMD_TestIntf_opBoolSeqPtr&,
- const std::deque<bool>&,
- const Ice::Current&);
+ const std::deque<bool>&,
+ const Ice::Current&);
virtual void opBoolList_async(const Test::AMD_TestIntf_opBoolListPtr&,
- const Test::BoolList&,
- const Ice::Current&);
+ const Test::BoolList&,
+ const Ice::Current&);
virtual void opByteSeq_async(const Test::AMD_TestIntf_opByteSeqPtr&,
- const std::deque<Ice::Byte>&,
- const Ice::Current&);
+ const std::deque<Ice::Byte>&,
+ const Ice::Current&);
virtual void opByteList_async(const Test::AMD_TestIntf_opByteListPtr&,
- const Test::ByteList&,
- const Ice::Current&);
+ const Test::ByteList&,
+ const Ice::Current&);
virtual void opMyByteSeq_async(const Test::AMD_TestIntf_opMyByteSeqPtr&,
- const MyByteSeq&,
- const Ice::Current&);
+ const MyByteSeq&,
+ const Ice::Current&);
virtual void opStringSeq_async(const Test::AMD_TestIntf_opStringSeqPtr&,
- const std::deque<std::string>&,
- const Ice::Current&);
+ const std::deque<std::string>&,
+ const Ice::Current&);
virtual void opStringList_async(const Test::AMD_TestIntf_opStringListPtr&,
- const Test::StringList&,
- const Ice::Current&);
+ const Test::StringList&,
+ const Ice::Current&);
virtual void opFixedSeq_async(const Test::AMD_TestIntf_opFixedSeqPtr&,
- const std::deque<Test::Fixed>&,
- const Ice::Current&);
+ const std::deque<Test::Fixed>&,
+ const Ice::Current&);
virtual void opFixedList_async(const Test::AMD_TestIntf_opFixedListPtr&,
- const Test::FixedList&,
- const Ice::Current&);
+ const Test::FixedList&,
+ const Ice::Current&);
virtual void opVariableSeq_async(const Test::AMD_TestIntf_opVariableSeqPtr&,
- const std::deque<Test::Variable>&,
- const Ice::Current&);
+ const std::deque<Test::Variable>&,
+ const Ice::Current&);
virtual void opVariableList_async(const Test::AMD_TestIntf_opVariableListPtr&,
- const Test::VariableList&,
- const Ice::Current&);
+ const Test::VariableList&,
+ const Ice::Current&);
virtual void opStringStringDictSeq_async(const Test::AMD_TestIntf_opStringStringDictSeqPtr&,
- const std::deque<Test::StringStringDict>&,
- const Ice::Current&);
+ const std::deque<Test::StringStringDict>&,
+ const Ice::Current&);
virtual void opStringStringDictList_async(const Test::AMD_TestIntf_opStringStringDictListPtr&,
- const Test::StringStringDictList&,
- const Ice::Current&);
+ const Test::StringStringDictList&,
+ const Ice::Current&);
virtual void opESeq_async(const Test::AMD_TestIntf_opESeqPtr&,
- const std::deque<Test::E>&,
- const Ice::Current&);
+ const std::deque<Test::E>&,
+ const Ice::Current&);
virtual void opEList_async(const Test::AMD_TestIntf_opEListPtr&,
- const Test::EList&,
- const Ice::Current&);
+ const Test::EList&,
+ const Ice::Current&);
virtual void opCPrxSeq_async(const Test::AMD_TestIntf_opCPrxSeqPtr&,
- const std::deque<Test::CPrx>&,
- const Ice::Current&);
+ const std::deque<Test::CPrx>&,
+ const Ice::Current&);
virtual void opCPrxList_async(const Test::AMD_TestIntf_opCPrxListPtr&,
- const Test::CPrxList&,
- const Ice::Current&);
+ const Test::CPrxList&,
+ const Ice::Current&);
virtual void opCSeq_async(const Test::AMD_TestIntf_opCSeqPtr&,
- const std::deque<Test::CPtr>&,
- const Ice::Current&);
+ const std::deque<Test::CPtr>&,
+ const Ice::Current&);
virtual void opCList_async(const Test::AMD_TestIntf_opCListPtr&,
- const Test::CList&,
- const Ice::Current&);
+ const Test::CList&,
+ const Ice::Current&);
virtual void opClassStruct_async(const ::Test::AMD_TestIntf_opClassStructPtr&,
- const ::Test::ClassStructPtr&,
- const ::Test::ClassStructSeq&,
- const ::Ice::Current&);
+ const ::Test::ClassStructPtr&,
+ const ::Test::ClassStructSeq&,
+ const ::Ice::Current&);
virtual void shutdown_async(const Test::AMD_TestIntf_shutdownPtr&,
- const Ice::Current&);
+ const Ice::Current&);
private:
diff --git a/cpp/test/Ice/custom/TestI.cpp b/cpp/test/Ice/custom/TestI.cpp
index e25e467d09a..df9e4f055da 100644
--- a/cpp/test/Ice/custom/TestI.cpp
+++ b/cpp/test/Ice/custom/TestI.cpp
@@ -17,8 +17,8 @@ TestIntfI::TestIntfI(const Ice::CommunicatorPtr& communicator)
Test::DoubleSeq
TestIntfI::opDoubleArray(const std::pair<const Ice::Double*, const Ice::Double*>& inSeq,
- Test::DoubleSeq& outSeq,
- const Ice::Current& current)
+ Test::DoubleSeq& outSeq,
+ const Ice::Current& current)
{
Test::DoubleSeq(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -26,8 +26,8 @@ TestIntfI::opDoubleArray(const std::pair<const Ice::Double*, const Ice::Double*>
Test::BoolSeq
TestIntfI::opBoolArray(const std::pair<const bool*, const bool*>& inSeq,
- Test::BoolSeq& outSeq,
- const Ice::Current& current)
+ Test::BoolSeq& outSeq,
+ const Ice::Current& current)
{
Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -35,8 +35,8 @@ TestIntfI::opBoolArray(const std::pair<const bool*, const bool*>& inSeq,
Test::ByteList
TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSeq,
- Test::ByteList& outSeq,
- const Ice::Current& current)
+ Test::ByteList& outSeq,
+ const Ice::Current& current)
{
Test::ByteList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -44,8 +44,8 @@ TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSe
Test::VariableList
TestIntfI::opVariableArray(const std::pair<const Test::Variable*, const Test::Variable*>& inSeq,
- Test::VariableList& outSeq,
- const Ice::Current& current)
+ Test::VariableList& outSeq,
+ const Ice::Current& current)
{
Test::VariableList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -53,8 +53,8 @@ TestIntfI::opVariableArray(const std::pair<const Test::Variable*, const Test::Va
Test::BoolSeq
TestIntfI::opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>& inSeq,
- Test::BoolSeq& outSeq,
- const Ice::Current&)
+ Test::BoolSeq& outSeq,
+ const Ice::Current&)
{
Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -62,8 +62,8 @@ TestIntfI::opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::Bool
Test::ByteList
TestIntfI::opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
- Test::ByteList& outSeq,
- const Ice::Current&)
+ Test::ByteList& outSeq,
+ const Ice::Current&)
{
Test::ByteList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -71,9 +71,9 @@ TestIntfI::opByteRange(const std::pair<Test::ByteList::const_iterator, Test::Byt
Test::VariableList
TestIntfI::opVariableRange(
- const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>& inSeq,
- Test::VariableList& outSeq,
- const Ice::Current&)
+ const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>& inSeq,
+ Test::VariableList& outSeq,
+ const Ice::Current&)
{
Test::VariableList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -81,8 +81,8 @@ TestIntfI::opVariableRange(
Test::BoolSeq
TestIntfI::opBoolRangeType(const std::pair<const bool*, const bool*>& inSeq,
- Test::BoolSeq& outSeq,
- const Ice::Current&)
+ Test::BoolSeq& outSeq,
+ const Ice::Current&)
{
Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -90,8 +90,8 @@ TestIntfI::opBoolRangeType(const std::pair<const bool*, const bool*>& inSeq,
Test::ByteList
TestIntfI::opByteRangeType(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
- Test::ByteList& outSeq,
- const Ice::Current&)
+ Test::ByteList& outSeq,
+ const Ice::Current&)
{
Test::ByteList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -99,21 +99,21 @@ TestIntfI::opByteRangeType(const std::pair<Test::ByteList::const_iterator, Test:
Test::VariableList
TestIntfI::opVariableRangeType(
- const std::pair<std::deque<Test::Variable>::const_iterator, std::deque<Test::Variable>::const_iterator>& inSeq,
- Test::VariableList& outSeq,
- const Ice::Current&)
+ const std::pair<std::deque<Test::Variable>::const_iterator, std::deque<Test::Variable>::const_iterator>& inSeq,
+ Test::VariableList& outSeq,
+ const Ice::Current&)
{
for(std::deque<Test::Variable>::const_iterator p = inSeq.first; p != inSeq.second; ++p)
{
- outSeq.push_back(*p);
+ outSeq.push_back(*p);
}
return outSeq;
}
std::deque<bool>
TestIntfI::opBoolSeq(const std::deque<bool>& inSeq,
- std::deque<bool>& outSeq,
- const Ice::Current& current)
+ std::deque<bool>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -121,8 +121,8 @@ TestIntfI::opBoolSeq(const std::deque<bool>& inSeq,
std::list<bool>
TestIntfI::opBoolList(const std::list<bool>& inSeq,
- std::list<bool>& outSeq,
- const Ice::Current& current)
+ std::list<bool>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -130,8 +130,8 @@ TestIntfI::opBoolList(const std::list<bool>& inSeq,
std::deque< ::Ice::Byte>
TestIntfI::opByteSeq(const std::deque< ::Ice::Byte>& inSeq,
- std::deque< ::Ice::Byte>& outSeq,
- const Ice::Current& current)
+ std::deque< ::Ice::Byte>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -139,8 +139,8 @@ TestIntfI::opByteSeq(const std::deque< ::Ice::Byte>& inSeq,
std::list< ::Ice::Byte>
TestIntfI::opByteList(const std::list< ::Ice::Byte>& inSeq,
- std::list< ::Ice::Byte>& outSeq,
- const Ice::Current& current)
+ std::list< ::Ice::Byte>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -148,8 +148,8 @@ TestIntfI::opByteList(const std::list< ::Ice::Byte>& inSeq,
MyByteSeq
TestIntfI::opMyByteSeq(const MyByteSeq& inSeq,
- MyByteSeq& outSeq,
- const Ice::Current& current)
+ MyByteSeq& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -157,8 +157,8 @@ TestIntfI::opMyByteSeq(const MyByteSeq& inSeq,
std::deque< ::std::string>
TestIntfI::opStringSeq(const std::deque< ::std::string>& inSeq,
- std::deque< ::std::string>& outSeq,
- const Ice::Current& current)
+ std::deque< ::std::string>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -166,8 +166,8 @@ TestIntfI::opStringSeq(const std::deque< ::std::string>& inSeq,
std::list< ::std::string>
TestIntfI::opStringList(const std::list< ::std::string>& inSeq,
- std::list< ::std::string>& outSeq,
- const Ice::Current& current)
+ std::list< ::std::string>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -175,8 +175,8 @@ TestIntfI::opStringList(const std::list< ::std::string>& inSeq,
std::deque< ::Test::Fixed>
TestIntfI::opFixedSeq(const std::deque< ::Test::Fixed>& inSeq,
- std::deque< ::Test::Fixed>& outSeq,
- const Ice::Current& current)
+ std::deque< ::Test::Fixed>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -184,8 +184,8 @@ TestIntfI::opFixedSeq(const std::deque< ::Test::Fixed>& inSeq,
std::list< ::Test::Fixed>
TestIntfI::opFixedList(const std::list< ::Test::Fixed>& inSeq,
- std::list< ::Test::Fixed>& outSeq,
- const Ice::Current& current)
+ std::list< ::Test::Fixed>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -193,8 +193,8 @@ TestIntfI::opFixedList(const std::list< ::Test::Fixed>& inSeq,
std::deque< ::Test::Variable>
TestIntfI::opVariableSeq(const std::deque< ::Test::Variable>& inSeq,
- std::deque< ::Test::Variable>& outSeq,
- const Ice::Current& current)
+ std::deque< ::Test::Variable>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -202,8 +202,8 @@ TestIntfI::opVariableSeq(const std::deque< ::Test::Variable>& inSeq,
std::list< ::Test::Variable>
TestIntfI::opVariableList(const std::list< ::Test::Variable>& inSeq,
- std::list< ::Test::Variable>& outSeq,
- const Ice::Current& current)
+ std::list< ::Test::Variable>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -283,10 +283,10 @@ TestIntfI::opCList(const std::list< ::Test::CPtr>& inSeq,
::Test::ClassStructPtr
TestIntfI::opClassStruct(const ::Test::ClassStructPtr& inS,
- const ::Test::ClassStructSeq& inSeq,
- ::Test::ClassStructPtr& out,
- ::Test::ClassStructSeq& outSeq,
- const Ice::Current&)
+ const ::Test::ClassStructSeq& inSeq,
+ ::Test::ClassStructPtr& out,
+ ::Test::ClassStructSeq& outSeq,
+ const Ice::Current&)
{
outSeq = inSeq;
out = inS;
diff --git a/cpp/test/Ice/custom/TestI.h b/cpp/test/Ice/custom/TestI.h
index c8800c755e4..c0aaa4b4416 100644
--- a/cpp/test/Ice/custom/TestI.h
+++ b/cpp/test/Ice/custom/TestI.h
@@ -19,92 +19,92 @@ public:
TestIntfI(const Ice::CommunicatorPtr&);
virtual Test::DoubleSeq opDoubleArray(const std::pair<const Ice::Double*, const Ice::Double*>&,
- Test::DoubleSeq&,
- const Ice::Current&);
+ Test::DoubleSeq&,
+ const Ice::Current&);
virtual Test::BoolSeq opBoolArray(const std::pair<const bool*, const bool*>&,
- Test::BoolSeq&,
- const Ice::Current&);
+ Test::BoolSeq&,
+ const Ice::Current&);
virtual Test::ByteList opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>&,
- Test::ByteList&,
- const Ice::Current&);
+ Test::ByteList&,
+ const Ice::Current&);
virtual Test::VariableList opVariableArray(const std::pair<const Test::Variable*, const Test::Variable*>&,
- Test::VariableList&,
- const Ice::Current&);
+ Test::VariableList&,
+ const Ice::Current&);
virtual Test::BoolSeq opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>&,
- Test::BoolSeq&,
- const Ice::Current&);
+ Test::BoolSeq&,
+ const Ice::Current&);
virtual Test::ByteList opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&,
- Test::ByteList&,
- const Ice::Current&);
+ Test::ByteList&,
+ const Ice::Current&);
virtual Test::VariableList
opVariableRange(const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>&,
- Test::VariableList&,
- const Ice::Current&);
+ Test::VariableList&,
+ const Ice::Current&);
virtual Test::BoolSeq opBoolRangeType(const std::pair<const bool*, const bool*>&,
- Test::BoolSeq&,
- const Ice::Current&);
+ Test::BoolSeq&,
+ const Ice::Current&);
virtual Test::ByteList opByteRangeType(const std::pair<Test::ByteList::const_iterator,
- Test::ByteList::const_iterator>&,
- Test::ByteList&,
- const Ice::Current&);
+ Test::ByteList::const_iterator>&,
+ Test::ByteList&,
+ const Ice::Current&);
virtual Test::VariableList
opVariableRangeType(const std::pair<std::deque<Test::Variable>::const_iterator,
- std::deque<Test::Variable>::const_iterator>&,
- Test::VariableList&,
- const Ice::Current&);
+ std::deque<Test::Variable>::const_iterator>&,
+ Test::VariableList&,
+ const Ice::Current&);
virtual std::deque<bool> opBoolSeq(const std::deque<bool>&,
- std::deque<bool>&,
- const Ice::Current&);
+ std::deque<bool>&,
+ const Ice::Current&);
virtual std::list<bool> opBoolList(const std::list<bool>&,
- std::list<bool>&,
- const Ice::Current&);
+ std::list<bool>&,
+ const Ice::Current&);
virtual std::deque< ::Ice::Byte> opByteSeq(const std::deque< ::Ice::Byte>&,
- std::deque< ::Ice::Byte>&,
- const Ice::Current&);
+ std::deque< ::Ice::Byte>&,
+ const Ice::Current&);
virtual std::list< ::Ice::Byte> opByteList(const std::list< ::Ice::Byte>&,
- std::list< ::Ice::Byte>&,
- const Ice::Current&);
+ std::list< ::Ice::Byte>&,
+ const Ice::Current&);
virtual MyByteSeq opMyByteSeq(const MyByteSeq&,
- MyByteSeq&,
- const Ice::Current&);
+ MyByteSeq&,
+ const Ice::Current&);
virtual std::deque< ::std::string> opStringSeq(const std::deque< ::std::string>&,
- std::deque< ::std::string>&,
- const Ice::Current&);
+ std::deque< ::std::string>&,
+ const Ice::Current&);
virtual std::list< ::std::string> opStringList(const std::list< ::std::string>&,
- std::list< ::std::string>&,
- const Ice::Current&);
+ std::list< ::std::string>&,
+ const Ice::Current&);
virtual std::deque< ::Test::Fixed> opFixedSeq(const std::deque< ::Test::Fixed>&,
- std::deque< ::Test::Fixed>&,
- const Ice::Current&);
+ std::deque< ::Test::Fixed>&,
+ const Ice::Current&);
virtual std::list< ::Test::Fixed> opFixedList(const std::list< ::Test::Fixed>&,
- std::list< ::Test::Fixed>&,
- const Ice::Current&);
+ std::list< ::Test::Fixed>&,
+ const Ice::Current&);
virtual std::deque< ::Test::Variable> opVariableSeq(const std::deque< ::Test::Variable>&,
- std::deque< ::Test::Variable>&,
- const Ice::Current&);
+ std::deque< ::Test::Variable>&,
+ const Ice::Current&);
virtual std::list< ::Test::Variable> opVariableList(const std::list< ::Test::Variable>&,
- std::list< ::Test::Variable>&,
- const Ice::Current&);
+ std::list< ::Test::Variable>&,
+ const Ice::Current&);
virtual std::deque< ::Test::StringStringDict> opStringStringDictSeq(const std::deque< ::Test::StringStringDict>&,
std::deque< ::Test::StringStringDict>&,
@@ -139,10 +139,10 @@ public:
const Ice::Current&);
virtual ::Test::ClassStructPtr opClassStruct(const ::Test::ClassStructPtr&,
- const ::Test::ClassStructSeq&,
- ::Test::ClassStructPtr& out,
- ::Test::ClassStructSeq& outSeq,
- const Ice::Current&);
+ const ::Test::ClassStructSeq&,
+ ::Test::ClassStructPtr& out,
+ ::Test::ClassStructSeq& outSeq,
+ const Ice::Current&);
virtual void shutdown(const Ice::Current&);
diff --git a/cpp/test/Ice/custom/WstringAMDI.cpp b/cpp/test/Ice/custom/WstringAMDI.cpp
index 9e827b7e870..1663c138aea 100644
--- a/cpp/test/Ice/custom/WstringAMDI.cpp
+++ b/cpp/test/Ice/custom/WstringAMDI.cpp
@@ -11,24 +11,24 @@
void
Test1::WstringClassI::opString_async(const ::Test1::AMD_WstringClass_opStringPtr& opStringCB,
- const ::std::wstring& s1,
- const Ice::Current& current)
+ const ::std::wstring& s1,
+ const Ice::Current& current)
{
opStringCB->ice_response(s1, s1);
}
void
Test1::WstringClassI::opStruct_async(const ::Test1::AMD_WstringClass_opStructPtr& opStructCB,
- const ::Test1::WstringStruct& s1,
- const Ice::Current& current)
+ const ::Test1::WstringStruct& s1,
+ const Ice::Current& current)
{
opStructCB->ice_response(s1, s1);
}
void
Test1::WstringClassI::throwExcept_async(const ::Test1::AMD_WstringClass_throwExceptPtr& throwExceptCB,
- const ::std::wstring& reason,
- const Ice::Current& current)
+ const ::std::wstring& reason,
+ const Ice::Current& current)
{
Test1::WstringException ex;
ex.reason = reason;
@@ -37,24 +37,24 @@ Test1::WstringClassI::throwExcept_async(const ::Test1::AMD_WstringClass_throwExc
void
Test2::WstringClassI::opString_async(const ::Test2::AMD_WstringClass_opStringPtr& opStringCB,
- const ::std::wstring& s1,
- const Ice::Current& current)
+ const ::std::wstring& s1,
+ const Ice::Current& current)
{
opStringCB->ice_response(s1, s1);
}
void
Test2::WstringClassI::opStruct_async(const ::Test2::AMD_WstringClass_opStructPtr& opStructCB,
- const ::Test2::WstringStruct& s1,
- const Ice::Current& current)
+ const ::Test2::WstringStruct& s1,
+ const Ice::Current& current)
{
opStructCB->ice_response(s1, s1);
}
void
Test2::WstringClassI::throwExcept_async(const ::Test2::AMD_WstringClass_throwExceptPtr& throwExceptCB,
- const ::std::wstring& reason,
- const Ice::Current& current)
+ const ::std::wstring& reason,
+ const Ice::Current& current)
{
Test2::WstringException ex;
ex.reason = reason;
diff --git a/cpp/test/Ice/custom/WstringAMDI.h b/cpp/test/Ice/custom/WstringAMDI.h
index 2f5058c1f6a..a2eadd58cf4 100644
--- a/cpp/test/Ice/custom/WstringAMDI.h
+++ b/cpp/test/Ice/custom/WstringAMDI.h
@@ -20,16 +20,16 @@ class WstringClassI : virtual public WstringClass
public:
virtual void opString_async(const ::Test1::AMD_WstringClass_opStringPtr&,
- const ::std::wstring&,
- const Ice::Current&);
+ const ::std::wstring&,
+ const Ice::Current&);
virtual void opStruct_async(const ::Test1::AMD_WstringClass_opStructPtr&,
- const ::Test1::WstringStruct&,
- const Ice::Current&);
+ const ::Test1::WstringStruct&,
+ const Ice::Current&);
virtual void throwExcept_async(const ::Test1::AMD_WstringClass_throwExceptPtr&,
- const ::std::wstring&,
- const Ice::Current&);
+ const ::std::wstring&,
+ const Ice::Current&);
};
}
@@ -42,16 +42,16 @@ class WstringClassI : virtual public WstringClass
public:
virtual void opString_async(const ::Test2::AMD_WstringClass_opStringPtr&,
- const ::std::wstring&,
- const Ice::Current&);
+ const ::std::wstring&,
+ const Ice::Current&);
virtual void opStruct_async(const ::Test2::AMD_WstringClass_opStructPtr&,
- const ::Test2::WstringStruct&,
- const Ice::Current&);
+ const ::Test2::WstringStruct&,
+ const Ice::Current&);
virtual void throwExcept_async(const ::Test2::AMD_WstringClass_throwExceptPtr&,
- const ::std::wstring&,
- const Ice::Current&);
+ const ::std::wstring&,
+ const Ice::Current&);
};
}
diff --git a/cpp/test/Ice/custom/WstringI.cpp b/cpp/test/Ice/custom/WstringI.cpp
index 75681f1f195..58af4234727 100644
--- a/cpp/test/Ice/custom/WstringI.cpp
+++ b/cpp/test/Ice/custom/WstringI.cpp
@@ -11,8 +11,8 @@
::std::wstring
Test1::WstringClassI::opString(const ::std::wstring& s1,
- ::std::wstring& s2,
- const Ice::Current& current)
+ ::std::wstring& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -20,8 +20,8 @@ Test1::WstringClassI::opString(const ::std::wstring& s1,
::Test1::WstringStruct
Test1::WstringClassI::opStruct(const ::Test1::WstringStruct& s1,
- ::Test1::WstringStruct& s2,
- const Ice::Current& current)
+ ::Test1::WstringStruct& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -29,7 +29,7 @@ Test1::WstringClassI::opStruct(const ::Test1::WstringStruct& s1,
void
Test1::WstringClassI::throwExcept(const ::std::wstring& reason,
- const Ice::Current& current)
+ const Ice::Current& current)
{
Test1::WstringException ex;
ex.reason = reason;
@@ -38,8 +38,8 @@ Test1::WstringClassI::throwExcept(const ::std::wstring& reason,
::std::wstring
Test2::WstringClassI::opString(const ::std::wstring& s1,
- ::std::wstring& s2,
- const Ice::Current& current)
+ ::std::wstring& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -47,8 +47,8 @@ Test2::WstringClassI::opString(const ::std::wstring& s1,
::Test2::WstringStruct
Test2::WstringClassI::opStruct(const ::Test2::WstringStruct& s1,
- ::Test2::WstringStruct& s2,
- const Ice::Current& current)
+ ::Test2::WstringStruct& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -56,7 +56,7 @@ Test2::WstringClassI::opStruct(const ::Test2::WstringStruct& s1,
void
Test2::WstringClassI::throwExcept(const ::std::wstring& reason,
- const Ice::Current& current)
+ const Ice::Current& current)
{
Test2::WstringException ex;
ex.reason = reason;
diff --git a/cpp/test/Ice/custom/WstringI.h b/cpp/test/Ice/custom/WstringI.h
index e785a8ed33f..87fa6397e38 100644
--- a/cpp/test/Ice/custom/WstringI.h
+++ b/cpp/test/Ice/custom/WstringI.h
@@ -20,15 +20,15 @@ class WstringClassI : virtual public WstringClass
public:
virtual ::std::wstring opString(const ::std::wstring&,
- ::std::wstring&,
- const Ice::Current&);
+ ::std::wstring&,
+ const Ice::Current&);
virtual ::Test1::WstringStruct opStruct(const ::Test1::WstringStruct&,
- ::Test1::WstringStruct&,
- const Ice::Current&);
+ ::Test1::WstringStruct&,
+ const Ice::Current&);
virtual void throwExcept(const ::std::wstring&,
- const Ice::Current&);
+ const Ice::Current&);
};
}
@@ -41,15 +41,15 @@ class WstringClassI : virtual public WstringClass
public:
virtual ::std::wstring opString(const ::std::wstring&,
- ::std::wstring&,
- const Ice::Current&);
+ ::std::wstring&,
+ const Ice::Current&);
virtual ::Test2::WstringStruct opStruct(const ::Test2::WstringStruct&,
- ::Test2::WstringStruct&,
- const Ice::Current&);
+ ::Test2::WstringStruct&,
+ const Ice::Current&);
virtual void throwExcept(const ::std::wstring&,
- const Ice::Current&);
+ const Ice::Current&);
};
}
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp
index ef140647a36..95009807260 100644
--- a/cpp/test/Ice/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/exceptions/AllTests.cpp
@@ -39,7 +39,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -49,26 +49,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -82,24 +82,24 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const A& ex)
- {
- test(ex.aMem == 1);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const A& ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -116,25 +116,25 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::ObjectNotExistException& ex)
- {
- Ice::Identity id = _communicator->stringToIdentity("does not exist");
- test(ex.id == id);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::ObjectNotExistException& ex)
+ {
+ Ice::Identity id = _communicator->stringToIdentity("does not exist");
+ test(ex.id == id);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
private:
@@ -150,24 +150,24 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::FacetNotExistException& ex)
- {
- test(ex.facet == "no such facet");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::FacetNotExistException& ex)
+ {
+ test(ex.facet == "no such facet");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -179,28 +179,28 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const A& ex)
- {
- test(ex.aMem == 1);
- }
- catch(const D& ex)
- {
- test(ex.dMem == -1);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const A& ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(const D& ex)
+ {
+ test(ex.dMem == -1);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -212,25 +212,25 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const B& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const B& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -242,26 +242,26 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const C& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const C& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -273,25 +273,25 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const B& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const B& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -303,26 +303,26 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const C& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const C& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -334,26 +334,26 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const C& ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const C& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -366,31 +366,31 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Mod::A& ex)
- {
- test(ex.aMem == 1);
- test(ex.a2Mem == 2);
- }
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Mod::A& ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.a2Mem == 2);
+ }
catch(const Ice::OperationNotExistException&)
{
//
// This operation is not supported in Java.
//
}
- catch(...)
- {
- test(false);
- }
- called();
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -404,23 +404,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -432,23 +432,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -460,23 +460,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -488,23 +488,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownLocalException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownLocalException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -516,23 +516,23 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::UnknownException&)
- {
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::UnknownException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -544,24 +544,24 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::OperationNotExistException& ex)
- {
- test(ex.operation == "noSuchOperation");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Ice::OperationNotExistException& ex)
+ {
+ test(ex.operation == "noSuchOperation");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -572,107 +572,107 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
cout << "testing object adapter registration exceptions... " << flush;
{
- Ice::ObjectAdapterPtr first;
+ Ice::ObjectAdapterPtr first;
+ try
+ {
+ first = communicator->createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(const Ice::InitializationException&)
+ {
+ // Expected
+ }
+
+ communicator->getProperties()->setProperty("Ice.OA.TestAdapter0.Endpoints", "default");
+ first = communicator->createObjectAdapter("TestAdapter0");
+ try
+ {
+ Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected
+ }
+
try
- {
- first = communicator->createObjectAdapter("TestAdapter0");
- test(false);
- }
- catch(const Ice::InitializationException&)
- {
- // Expected
- }
-
- communicator->getProperties()->setProperty("Ice.OA.TestAdapter0.Endpoints", "default");
- first = communicator->createObjectAdapter("TestAdapter0");
- try
- {
- Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- // Expected
- }
-
- try
- {
- Ice::ObjectAdapterPtr second =
- communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- // Expected.
- }
- //
- // Properties must remain unaffected if an exception occurs.
- //
- test(communicator->getProperties()->getProperty("Ice.OA.TestAdapter0.Endpoints") == "default");
- first->deactivate();
+ {
+ Ice::ObjectAdapterPtr second =
+ communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected.
+ }
+ //
+ // Properties must remain unaffected if an exception occurs.
+ //
+ test(communicator->getProperties()->getProperty("Ice.OA.TestAdapter0.Endpoints") == "default");
+ first->deactivate();
}
cout << "ok" << endl;
cout << "testing servant registration exceptions... " << flush;
{
- communicator->getProperties()->setProperty("Ice.OA.TestAdapter1.Endpoints", "default");
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1");
- Ice::ObjectPtr obj = new EmptyI;
- adapter->add(obj, communicator->stringToIdentity("x"));
- try
- {
- adapter->add(obj, communicator->stringToIdentity("x"));
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- }
-
- adapter->remove(communicator->stringToIdentity("x"));
- try
- {
- adapter->remove(communicator->stringToIdentity("x"));
- test(false);
- }
- catch(const Ice::NotRegisteredException&)
- {
- }
-
- adapter->deactivate();
+ communicator->getProperties()->setProperty("Ice.OA.TestAdapter1.Endpoints", "default");
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1");
+ Ice::ObjectPtr obj = new EmptyI;
+ adapter->add(obj, communicator->stringToIdentity("x"));
+ try
+ {
+ adapter->add(obj, communicator->stringToIdentity("x"));
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ }
+
+ adapter->remove(communicator->stringToIdentity("x"));
+ try
+ {
+ adapter->remove(communicator->stringToIdentity("x"));
+ test(false);
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ }
+
+ adapter->deactivate();
}
cout << "ok" << endl;
cout << "testing servant locator registrations exceptions... " << flush;
{
- communicator->getProperties()->setProperty("Ice.OA.TestAdapter2.Endpoints", "default");
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter2");
- Ice::ServantLocatorPtr loc = new ServantLocatorI;
- adapter->addServantLocator(loc, "x");
- try
- {
- adapter->addServantLocator(loc, "x");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- }
-
- adapter->deactivate();
+ communicator->getProperties()->setProperty("Ice.OA.TestAdapter2.Endpoints", "default");
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter2");
+ Ice::ServantLocatorPtr loc = new ServantLocatorI;
+ adapter->addServantLocator(loc, "x");
+ try
+ {
+ adapter->addServantLocator(loc, "x");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ }
+
+ adapter->deactivate();
}
cout << "ok" << endl;
cout << "testing object factory registration exception... " << flush;
{
- Ice::ObjectFactoryPtr of = new ObjectFactoryI;
- communicator->addObjectFactory(of, "x");
- try
- {
- communicator->addObjectFactory(of, "x");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- }
+ Ice::ObjectFactoryPtr of = new ObjectFactoryI;
+ communicator->addObjectFactory(of, "x");
+ try
+ {
+ communicator->addObjectFactory(of, "x");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ }
}
cout << "ok" << endl;
@@ -692,80 +692,80 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwAasA(1);
- test(false);
+ thrower->throwAasA(1);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(const Ice::Exception& ex)
{
- cout << ex << endl;
- test(false);
+ cout << ex << endl;
+ test(false);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwAorDasAorD(1);
- test(false);
+ thrower->throwAorDasAorD(1);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwAorDasAorD(-1);
- test(false);
+ thrower->throwAorDasAorD(-1);
+ test(false);
}
catch(const D& ex)
{
- test(ex.dMem == -1);
+ test(ex.dMem == -1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwBasB(1, 2);
- test(false);
+ thrower->throwBasB(1, 2);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasC(1, 2, 3);
- test(false);
+ thrower->throwCasC(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
@@ -774,23 +774,23 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
//
try
{
- thrower->throwModA(1, 2);
- test(false);
+ thrower->throwModA(1, 2);
+ test(false);
}
catch(const Mod::A& ex)
{
- test(ex.aMem == 1);
- test(ex.a2Mem == 2);
+ test(ex.aMem == 1);
+ test(ex.a2Mem == 2);
}
catch(const Ice::OperationNotExistException&)
{
- //
+ //
// This operation is not supported in Java.
//
}
catch(...)
{
- test(false);
+ test(false);
}
#endif
@@ -800,31 +800,31 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwBasB(1, 2);
- test(false);
+ thrower->throwBasB(1, 2);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasC(1, 2, 3);
- test(false);
+ thrower->throwCasC(1, 2, 3);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
@@ -833,167 +833,167 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
//
try
{
- thrower->throwModA(1, 2);
- test(false);
+ thrower->throwModA(1, 2);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(const Ice::OperationNotExistException&)
{
- //
+ //
// This operation is not supported in Java.
//
}
catch(...)
{
- test(false);
+ test(false);
}
#endif
cout << "ok" << endl;
cout << "catching derived types... " << flush;
-
+
try
{
- thrower->throwBasA(1, 2);
- test(false);
+ thrower->throwBasA(1, 2);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasA(1, 2, 3);
- test(false);
+ thrower->throwCasA(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasB(1, 2, 3);
- test(false);
+ thrower->throwCasB(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
if(thrower->supportsUndeclaredExceptions())
{
- cout << "catching unknown user exception... " << flush;
-
- try
- {
- thrower->throwUndeclaredA(1);
- test(false);
- }
- catch(const A& ex)
- {
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
- test(ex.aMem == 1);
- }
- catch(const Ice::UnknownUserException&)
- {
- //
- // We get an unknown user exception without collocation
- // optimization.
- //
- test(!collocated);
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredB(1, 2);
- test(false);
- }
- catch(const B& ex)
- {
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(const Ice::UnknownUserException&)
- {
- //
- // We get an unknown user exception without collocation
- // optimization.
- //
- test(!collocated);
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredC(1, 2, 3);
- test(false);
- }
- catch(const C& ex)
- {
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(const Ice::UnknownUserException&)
- {
- //
- // We get an unknown user exception without
- // collocation optimization.
- //
- test(!collocated);
- }
- catch(...)
- {
- test(false);
- }
-
- cout << "ok" << endl;
+ cout << "catching unknown user exception... " << flush;
+
+ try
+ {
+ thrower->throwUndeclaredA(1);
+ test(false);
+ }
+ catch(const A& ex)
+ {
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
+ test(ex.aMem == 1);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ //
+ // We get an unknown user exception without collocation
+ // optimization.
+ //
+ test(!collocated);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredB(1, 2);
+ test(false);
+ }
+ catch(const B& ex)
+ {
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ //
+ // We get an unknown user exception without collocation
+ // optimization.
+ //
+ test(!collocated);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredC(1, 2, 3);
+ test(false);
+ }
+ catch(const C& ex)
+ {
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ //
+ // We get an unknown user exception without
+ // collocation optimization.
+ //
+ test(!collocated);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ cout << "ok" << endl;
}
cout << "catching object not exist exception... " << flush;
@@ -1001,18 +1001,18 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
Ice::Identity id = communicator->stringToIdentity("does not exist");
try
{
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
- thrower2->throwAasA(1);
-// thrower2->ice_ping();
- test(false);
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
+ thrower2->throwAasA(1);
+// thrower2->ice_ping();
+ test(false);
}
catch(const Ice::ObjectNotExistException& ex)
{
- test(ex.id == id);
+ test(ex.id == id);
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1021,20 +1021,20 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
- try
- {
- thrower2->ice_ping();
- test(false);
- }
- catch(const Ice::FacetNotExistException& ex)
- {
- test(ex.facet == "no such facet");
- }
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
+ try
+ {
+ thrower2->ice_ping();
+ test(false);
+ }
+ catch(const Ice::FacetNotExistException& ex)
+ {
+ test(ex.facet == "no such facet");
+ }
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1043,17 +1043,17 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower);
- thrower2->noSuchOperation();
- test(false);
+ WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower);
+ thrower2->noSuchOperation();
+ test(false);
}
catch(const Ice::OperationNotExistException& ex)
{
- test(ex.operation == "noSuchOperation");
+ test(ex.operation == "noSuchOperation");
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1062,28 +1062,28 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwLocalException();
- test(false);
+ thrower->throwLocalException();
+ test(false);
}
catch(const Ice::TimeoutException&)
{
- //
- // We get the original exception with collocation
- // optimization.
- //
- test(collocated);
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ test(collocated);
}
catch(const Ice::UnknownLocalException&)
{
- //
- // We get an unknown local exception without collocation
- // optimization.
- //
- test(!collocated);
+ //
+ // We get an unknown local exception without collocation
+ // optimization.
+ //
+ test(!collocated);
}
catch(...)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
@@ -1092,180 +1092,180 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
try
{
- thrower->throwNonIceException();
- test(false);
+ thrower->throwNonIceException();
+ test(false);
}
catch(const Ice::UnknownException&)
{
- //
- // We get an unknown exception without collocation
- // optimization.
- //
- assert(!collocated);
+ //
+ // We get an unknown exception without collocation
+ // optimization.
+ //
+ assert(!collocated);
}
catch(...)
{
- //
- // We get the original exception with collocation
- // optimization.
- //
- assert(collocated);
+ //
+ // We get the original exception with collocation
+ // optimization.
+ //
+ assert(collocated);
}
cout << "ok" << endl;
if(!collocated)
{
- cout << "catching exact types with AMI... " << flush;
-
- {
- AMI_Thrower_throwAasAIPtr cb = new AMI_Thrower_throwAasAI;
- thrower->throwAasA_async(cb, 1);
- test(cb->check());
- // Let's check if we can reuse the same callback object for another call.
- thrower->throwAasA_async(cb, 1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
- thrower->throwAorDasAorD_async(cb, 1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
- thrower->throwAorDasAorD_async(cb, -1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwBasBIPtr cb = new AMI_Thrower_throwBasBI;
- thrower->throwBasB_async(cb, 1, 2);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwCasCIPtr cb = new AMI_Thrower_throwCasCI;
- thrower->throwCasC_async(cb, 1, 2, 3);
- test(cb->check());
- // Let's check if we can reuse the same callback object for another call.
- thrower->throwCasC_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
+ cout << "catching exact types with AMI... " << flush;
+
+ {
+ AMI_Thrower_throwAasAIPtr cb = new AMI_Thrower_throwAasAI;
+ thrower->throwAasA_async(cb, 1);
+ test(cb->check());
+ // Let's check if we can reuse the same callback object for another call.
+ thrower->throwAasA_async(cb, 1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
+ thrower->throwAorDasAorD_async(cb, 1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwAorDasAorDIPtr cb = new AMI_Thrower_throwAorDasAorDI;
+ thrower->throwAorDasAorD_async(cb, -1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwBasBIPtr cb = new AMI_Thrower_throwBasBI;
+ thrower->throwBasB_async(cb, 1, 2);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwCasCIPtr cb = new AMI_Thrower_throwCasCI;
+ thrower->throwCasC_async(cb, 1, 2, 3);
+ test(cb->check());
+ // Let's check if we can reuse the same callback object for another call.
+ thrower->throwCasC_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
//
// With VC6 SP5, there is no way to call ::A::__write from ::Mod::A
//
- {
- AMI_Thrower_throwModAIPtr cb = new AMI_Thrower_throwModAI;
- thrower->throwModA_async(cb, 1, 2);
- test(cb->check());
- }
+ {
+ AMI_Thrower_throwModAIPtr cb = new AMI_Thrower_throwModAI;
+ thrower->throwModA_async(cb, 1, 2);
+ test(cb->check());
+ }
#endif
- cout << "ok" << endl;
-
- cout << "catching derived types... " << flush;
-
- {
- AMI_Thrower_throwBasAIPtr cb = new AMI_Thrower_throwBasAI;
- thrower->throwBasA_async(cb, 1, 2);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwCasAIPtr cb = new AMI_Thrower_throwCasAI;
- thrower->throwCasA_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwCasBIPtr cb = new AMI_Thrower_throwCasBI;
- thrower->throwCasB_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- if(thrower->supportsUndeclaredExceptions())
- {
- cout << "catching unknown user exception with AMI... " << flush;
-
- {
- AMI_Thrower_throwUndeclaredAIPtr cb = new AMI_Thrower_throwUndeclaredAI;
- thrower->throwUndeclaredA_async(cb, 1);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwUndeclaredBIPtr cb = new AMI_Thrower_throwUndeclaredBI;
- thrower->throwUndeclaredB_async(cb, 1, 2);
- test(cb->check());
- }
-
- {
- AMI_Thrower_throwUndeclaredCIPtr cb = new AMI_Thrower_throwUndeclaredCI;
- thrower->throwUndeclaredC_async(cb, 1, 2, 3);
- test(cb->check());
- }
-
- cout << "ok" << endl;
- }
-
- cout << "catching object not exist exception with AMI... " << flush;
-
- {
- id = communicator->stringToIdentity("does not exist");
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
- AMI_Thrower_throwAasAObjectNotExistIPtr cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
- thrower2->throwAasA_async(cb, 1);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- cout << "catching facet not exist exception with AMI... " << flush;
-
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
- {
- AMI_Thrower_throwAasAFacetNotExistIPtr cb = new AMI_Thrower_throwAasAFacetNotExistI;
- thrower2->throwAasA_async(cb, 1);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- cout << "catching operation not exist exception with AMI... " << flush;
-
- {
- AMI_WrongOperation_noSuchOperationIPtr cb = new AMI_WrongOperation_noSuchOperationI;
- WrongOperationPrx thrower4 = WrongOperationPrx::uncheckedCast(thrower);
- thrower4->noSuchOperation_async(cb);
- test(cb->check());
- }
-
- cout << "ok" << endl;
+ cout << "ok" << endl;
+
+ cout << "catching derived types... " << flush;
+
+ {
+ AMI_Thrower_throwBasAIPtr cb = new AMI_Thrower_throwBasAI;
+ thrower->throwBasA_async(cb, 1, 2);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwCasAIPtr cb = new AMI_Thrower_throwCasAI;
+ thrower->throwCasA_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwCasBIPtr cb = new AMI_Thrower_throwCasBI;
+ thrower->throwCasB_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ if(thrower->supportsUndeclaredExceptions())
+ {
+ cout << "catching unknown user exception with AMI... " << flush;
+
+ {
+ AMI_Thrower_throwUndeclaredAIPtr cb = new AMI_Thrower_throwUndeclaredAI;
+ thrower->throwUndeclaredA_async(cb, 1);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwUndeclaredBIPtr cb = new AMI_Thrower_throwUndeclaredBI;
+ thrower->throwUndeclaredB_async(cb, 1, 2);
+ test(cb->check());
+ }
+
+ {
+ AMI_Thrower_throwUndeclaredCIPtr cb = new AMI_Thrower_throwUndeclaredCI;
+ thrower->throwUndeclaredC_async(cb, 1, 2, 3);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+ }
+
+ cout << "catching object not exist exception with AMI... " << flush;
+
+ {
+ id = communicator->stringToIdentity("does not exist");
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
+ AMI_Thrower_throwAasAObjectNotExistIPtr cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator);
+ thrower2->throwAasA_async(cb, 1);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ cout << "catching facet not exist exception with AMI... " << flush;
+
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
+ {
+ AMI_Thrower_throwAasAFacetNotExistIPtr cb = new AMI_Thrower_throwAasAFacetNotExistI;
+ thrower2->throwAasA_async(cb, 1);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ cout << "catching operation not exist exception with AMI... " << flush;
+
+ {
+ AMI_WrongOperation_noSuchOperationIPtr cb = new AMI_WrongOperation_noSuchOperationI;
+ WrongOperationPrx thrower4 = WrongOperationPrx::uncheckedCast(thrower);
+ thrower4->noSuchOperation_async(cb);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
- cout << "catching unknown local exception with AMI... " << flush;
-
- {
- AMI_Thrower_throwLocalExceptionIPtr cb = new AMI_Thrower_throwLocalExceptionI;
- thrower->throwLocalException_async(cb);
- test(cb->check());
- }
-
- cout << "ok" << endl;
-
- cout << "catching unknown non-Ice exception with AMI... " << flush;
-
- AMI_Thrower_throwNonIceExceptionIPtr cb = new AMI_Thrower_throwNonIceExceptionI;
- thrower->throwNonIceException_async(cb);
- test(cb->check());
-
- cout << "ok" << endl;
-
+ cout << "catching unknown local exception with AMI... " << flush;
+
+ {
+ AMI_Thrower_throwLocalExceptionIPtr cb = new AMI_Thrower_throwLocalExceptionI;
+ thrower->throwLocalException_async(cb);
+ test(cb->check());
+ }
+
+ cout << "ok" << endl;
+
+ cout << "catching unknown non-Ice exception with AMI... " << flush;
+
+ AMI_Thrower_throwNonIceExceptionIPtr cb = new AMI_Thrower_throwNonIceExceptionI;
+ thrower->throwNonIceException_async(cb);
+ test(cb->check());
+
+ cout << "ok" << endl;
+
}
return thrower;
diff --git a/cpp/test/Ice/exceptions/Client.cpp b/cpp/test/Ice/exceptions/Client.cpp
index ddffc3942bc..684fb41d824 100644
--- a/cpp/test/Ice/exceptions/Client.cpp
+++ b/cpp/test/Ice/exceptions/Client.cpp
@@ -31,26 +31,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/exceptions/Collocated.cpp b/cpp/test/Ice/exceptions/Collocated.cpp
index 7f609905298..19b9b0eff09 100644
--- a/cpp/test/Ice/exceptions/Collocated.cpp
+++ b/cpp/test/Ice/exceptions/Collocated.cpp
@@ -35,26 +35,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp
index 566d3d98fc6..a21d497727d 100644
--- a/cpp/test/Ice/exceptions/Server.cpp
+++ b/cpp/test/Ice/exceptions/Server.cpp
@@ -34,26 +34,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/exceptions/ServerAMD.cpp b/cpp/test/Ice/exceptions/ServerAMD.cpp
index 6e1985d2025..cb58072e087 100644
--- a/cpp/test/Ice/exceptions/ServerAMD.cpp
+++ b/cpp/test/Ice/exceptions/ServerAMD.cpp
@@ -34,26 +34,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/exceptions/Test.ice b/cpp/test/Ice/exceptions/Test.ice
index 0844993df14..296d76f7005 100644
--- a/cpp/test/Ice/exceptions/Test.ice
+++ b/cpp/test/Ice/exceptions/Test.ice
@@ -43,7 +43,7 @@ module Mod
{
exception A extends ::Test::A
{
- int a2Mem;
+ int a2Mem;
};
};
diff --git a/cpp/test/Ice/exceptions/TestAMD.ice b/cpp/test/Ice/exceptions/TestAMD.ice
index a3efb41c18e..9c0eb3ad93b 100644
--- a/cpp/test/Ice/exceptions/TestAMD.ice
+++ b/cpp/test/Ice/exceptions/TestAMD.ice
@@ -39,7 +39,7 @@ module Mod
{
exception A extends ::Test::A
{
- int a2Mem;
+ int a2Mem;
};
};
diff --git a/cpp/test/Ice/exceptions/TestAMDI.cpp b/cpp/test/Ice/exceptions/TestAMDI.cpp
index 34aef3df1c0..8d2924f270f 100644
--- a/cpp/test/Ice/exceptions/TestAMDI.cpp
+++ b/cpp/test/Ice/exceptions/TestAMDI.cpp
@@ -19,7 +19,7 @@ ThrowerI::ThrowerI(const Ice::ObjectAdapterPtr& adapter) :
void
ThrowerI::shutdown_async(const AMD_Thrower_shutdownPtr& cb,
- const Ice::Current&)
+ const Ice::Current&)
{
_adapter->getCommunicator()->shutdown();
cb->ice_response();
@@ -27,21 +27,21 @@ ThrowerI::shutdown_async(const AMD_Thrower_shutdownPtr& cb,
void
ThrowerI::supportsUndeclaredExceptions_async(const AMD_Thrower_supportsUndeclaredExceptionsPtr& cb,
- const Ice::Current&)
+ const Ice::Current&)
{
cb->ice_response(true);
}
void
ThrowerI::supportsAssertException_async(const AMD_Thrower_supportsAssertExceptionPtr& cb,
- const Ice::Current&)
+ const Ice::Current&)
{
cb->ice_response(false);
}
void
ThrowerI::throwAasA_async(const AMD_Thrower_throwAasAPtr& cb,
- Ice::Int a, const Ice::Current&)
+ Ice::Int a, const Ice::Current&)
{
A ex;
ex.aMem = a;
@@ -50,25 +50,25 @@ ThrowerI::throwAasA_async(const AMD_Thrower_throwAasAPtr& cb,
void
ThrowerI::throwAorDasAorD_async(const AMD_Thrower_throwAorDasAorDPtr& cb,
- Ice::Int a, const Ice::Current&)
+ Ice::Int a, const Ice::Current&)
{
if(a > 0)
{
- A ex;
- ex.aMem = a;
- cb->ice_exception(ex);
+ A ex;
+ ex.aMem = a;
+ cb->ice_exception(ex);
}
else
{
- D ex;
- ex.dMem = a;
- cb->ice_exception(ex);
+ D ex;
+ ex.dMem = a;
+ cb->ice_exception(ex);
}
}
void
ThrowerI::throwBasA_async(const AMD_Thrower_throwBasAPtr& cb,
- Ice::Int a, Ice::Int b, const Ice::Current& current)
+ Ice::Int a, Ice::Int b, const Ice::Current& current)
{
B ex;
ex.aMem = a;
@@ -79,7 +79,7 @@ ThrowerI::throwBasA_async(const AMD_Thrower_throwBasAPtr& cb,
void
ThrowerI::throwCasA_async(const AMD_Thrower_throwCasAPtr& cb,
- Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current& current)
+ Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current& current)
{
C ex;
ex.aMem = a;
@@ -90,7 +90,7 @@ ThrowerI::throwCasA_async(const AMD_Thrower_throwCasAPtr& cb,
void
ThrowerI::throwBasB_async(const AMD_Thrower_throwBasBPtr& cb,
- Ice::Int a, Ice::Int b, const Ice::Current&)
+ Ice::Int a, Ice::Int b, const Ice::Current&)
{
B ex;
ex.aMem = a;
@@ -101,7 +101,7 @@ ThrowerI::throwBasB_async(const AMD_Thrower_throwBasBPtr& cb,
void
ThrowerI::throwCasB_async(const AMD_Thrower_throwCasBPtr& cb,
- Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current& current)
+ Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current& current)
{
C ex;
ex.aMem = a;
@@ -112,7 +112,7 @@ ThrowerI::throwCasB_async(const AMD_Thrower_throwCasBPtr& cb,
void
ThrowerI::throwCasC_async(const AMD_Thrower_throwCasCPtr& cb,
- Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current&)
+ Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current&)
{
C ex;
ex.aMem = a;
@@ -123,7 +123,7 @@ ThrowerI::throwCasC_async(const AMD_Thrower_throwCasCPtr& cb,
void
ThrowerI::throwModA_async(const AMD_Thrower_throwModAPtr& cb,
- Ice::Int a, Ice::Int a2, const Ice::Current&)
+ Ice::Int a, Ice::Int a2, const Ice::Current&)
{
Mod::A ex;
ex.aMem = a;
@@ -134,7 +134,7 @@ ThrowerI::throwModA_async(const AMD_Thrower_throwModAPtr& cb,
void
ThrowerI::throwUndeclaredA_async(const AMD_Thrower_throwUndeclaredAPtr& cb,
- Ice::Int a, const Ice::Current&)
+ Ice::Int a, const Ice::Current&)
{
A ex;
ex.aMem = a;
@@ -143,7 +143,7 @@ ThrowerI::throwUndeclaredA_async(const AMD_Thrower_throwUndeclaredAPtr& cb,
void
ThrowerI::throwUndeclaredB_async(const AMD_Thrower_throwUndeclaredBPtr& cb,
- Ice::Int a, Ice::Int b, const Ice::Current&)
+ Ice::Int a, Ice::Int b, const Ice::Current&)
{
B ex;
ex.aMem = a;
@@ -154,7 +154,7 @@ ThrowerI::throwUndeclaredB_async(const AMD_Thrower_throwUndeclaredBPtr& cb,
void
ThrowerI::throwUndeclaredC_async(const AMD_Thrower_throwUndeclaredCPtr& cb,
- Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current&)
+ Ice::Int a, Ice::Int b, Ice::Int c, const Ice::Current&)
{
C ex;
ex.aMem = a;
@@ -165,21 +165,21 @@ ThrowerI::throwUndeclaredC_async(const AMD_Thrower_throwUndeclaredCPtr& cb,
void
ThrowerI::throwLocalException_async(const AMD_Thrower_throwLocalExceptionPtr& cb,
- const Ice::Current&)
+ const Ice::Current&)
{
cb->ice_exception(Ice::TimeoutException(__FILE__, __LINE__));
}
void
ThrowerI::throwNonIceException_async(const AMD_Thrower_throwNonIceExceptionPtr&,
- const Ice::Current&)
+ const Ice::Current&)
{
throw int(12345);
}
void
ThrowerI::throwAssertException_async(const AMD_Thrower_throwAssertExceptionPtr&,
- const Ice::Current&)
+ const Ice::Current&)
{
assert(false); // Not supported in C++.
}
diff --git a/cpp/test/Ice/exceptions/TestAMDI.h b/cpp/test/Ice/exceptions/TestAMDI.h
index 3b16b849d12..bdd7971b5fa 100644
--- a/cpp/test/Ice/exceptions/TestAMDI.h
+++ b/cpp/test/Ice/exceptions/TestAMDI.h
@@ -19,42 +19,42 @@ public:
ThrowerI(const Ice::ObjectAdapterPtr&);
virtual void shutdown_async(const Test::AMD_Thrower_shutdownPtr&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void supportsUndeclaredExceptions_async(const Test::AMD_Thrower_supportsUndeclaredExceptionsPtr&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void supportsAssertException_async(const Test::AMD_Thrower_supportsAssertExceptionPtr&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void throwAasA_async(const Test::AMD_Thrower_throwAasAPtr&,
- Ice::Int, const Ice::Current&);
+ Ice::Int, const Ice::Current&);
virtual void throwAorDasAorD_async(const Test::AMD_Thrower_throwAorDasAorDPtr&,
- Ice::Int, const Ice::Current&);
+ Ice::Int, const Ice::Current&);
virtual void throwBasA_async(const Test::AMD_Thrower_throwBasAPtr&,
- Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwCasA_async(const Test::AMD_Thrower_throwCasAPtr&,
- Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwBasB_async(const Test::AMD_Thrower_throwBasBPtr&,
- Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwCasB_async(const Test::AMD_Thrower_throwCasBPtr&,
- Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwCasC_async(const Test::AMD_Thrower_throwCasCPtr&,
- Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwModA_async(const Test::AMD_Thrower_throwModAPtr&,
- Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwUndeclaredA_async(const Test::AMD_Thrower_throwUndeclaredAPtr&,
- Ice::Int, const Ice::Current&);
+ Ice::Int, const Ice::Current&);
virtual void throwUndeclaredB_async(const Test::AMD_Thrower_throwUndeclaredBPtr&,
- Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwUndeclaredC_async(const Test::AMD_Thrower_throwUndeclaredCPtr&,
- Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
+ Ice::Int, Ice::Int, Ice::Int, const Ice::Current&);
virtual void throwLocalException_async(const Test::AMD_Thrower_throwLocalExceptionPtr&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void throwNonIceException_async(const Test::AMD_Thrower_throwNonIceExceptionPtr&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void throwAssertException_async(const Test::AMD_Thrower_throwAssertExceptionPtr&,
- const Ice::Current&);
+ const Ice::Current&);
private:
diff --git a/cpp/test/Ice/exceptions/TestI.cpp b/cpp/test/Ice/exceptions/TestI.cpp
index 2b95046467f..05a1e1d7863 100644
--- a/cpp/test/Ice/exceptions/TestI.cpp
+++ b/cpp/test/Ice/exceptions/TestI.cpp
@@ -48,15 +48,15 @@ ThrowerI::throwAorDasAorD(Ice::Int a, const Ice::Current&)
{
if(a > 0)
{
- A ex;
- ex.aMem = a;
- throw ex;
+ A ex;
+ ex.aMem = a;
+ throw ex;
}
else
{
- D ex;
- ex.dMem = a;
- throw ex;
+ D ex;
+ ex.dMem = a;
+ throw ex;
}
}
diff --git a/cpp/test/Ice/facets/AllTests.cpp b/cpp/test/Ice/facets/AllTests.cpp
index 4122e0cc203..34090065ae0 100644
--- a/cpp/test/Ice/facets/AllTests.cpp
+++ b/cpp/test/Ice/facets/AllTests.cpp
@@ -29,8 +29,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
try
{
- adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
- test(false);
+ adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
+ test(false);
}
catch(Ice::AlreadyRegisteredException&)
{
@@ -38,8 +38,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
try
{
- adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
- test(false);
+ adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
+ test(false);
}
catch(Ice::NotRegisteredException&)
{
@@ -61,8 +61,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(fm["f2"] == obj2);
try
{
- adapter->removeAllFacets(communicator->stringToIdentity("id1"));
- test(false);
+ adapter->removeAllFacets(communicator->stringToIdentity("id1"));
+ test(false);
}
catch(Ice::NotRegisteredException&)
{
diff --git a/cpp/test/Ice/facets/Client.cpp b/cpp/test/Ice/facets/Client.cpp
index 4932992110d..769e96f91e7 100644
--- a/cpp/test/Ice/facets/Client.cpp
+++ b/cpp/test/Ice/facets/Client.cpp
@@ -31,26 +31,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/facets/Collocated.cpp b/cpp/test/Ice/facets/Collocated.cpp
index 77ceb993408..f1f5a14040a 100644
--- a/cpp/test/Ice/facets/Collocated.cpp
+++ b/cpp/test/Ice/facets/Collocated.cpp
@@ -40,26 +40,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/facets/Server.cpp b/cpp/test/Ice/facets/Server.cpp
index cb4850bf414..34c8d3a10c7 100644
--- a/cpp/test/Ice/facets/Server.cpp
+++ b/cpp/test/Ice/facets/Server.cpp
@@ -39,26 +39,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp
index abaf9d2ccd1..f450b1d5798 100644
--- a/cpp/test/Ice/faultTolerance/AllTests.cpp
+++ b/cpp/test/Ice/faultTolerance/AllTests.cpp
@@ -19,7 +19,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -29,26 +29,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(30)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(30)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -62,18 +62,18 @@ public:
virtual void ice_response(Ice::Int pid)
{
- _pid = pid;
- called();
+ _pid = pid;
+ called();
}
virtual void ice_exception(const Ice::Exception& ex)
{
- test(false);
+ test(false);
}
Ice::Int pid() const
{
- return _pid;
+ return _pid;
}
private:
@@ -89,12 +89,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -106,27 +106,27 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& ex)
{
- try
- {
- ex.ice_throw();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- catch(const Ice::ConnectFailedException&)
- {
- }
- catch(Ice::Exception& ex)
- {
- cout << ex << endl;
- test(false);
- }
- called();
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ catch(const Ice::ConnectFailedException&)
+ {
+ }
+ catch(Ice::Exception& ex)
+ {
+ cout << ex << endl;
+ test(false);
+ }
+ called();
}
};
@@ -136,27 +136,27 @@ class AMI_Test_idempotentAbortI : public AMI_TestIntf_idempotentAbort, public Ca
{
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const Ice::Exception& ex)
{
- try
- {
- ex.ice_throw();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- catch(const Ice::ConnectFailedException&)
- {
- }
- catch(Ice::Exception& ex)
- {
- cout << ex << endl;
- test(false);
- }
- called();
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ catch(const Ice::ConnectFailedException&)
+ {
+ }
+ catch(Ice::Exception& ex)
+ {
+ cout << ex << endl;
+ test(false);
+ }
+ called();
}
};
@@ -170,7 +170,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
ref << "test";
for(vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p)
{
- ref << ":default -t 60000 -p " << *p;
+ ref << ":default -t 60000 -p " << *p;
}
Ice::ObjectPrx base = communicator->stringToProxy(ref.str());
test(base);
@@ -186,121 +186,121 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
bool ami = false;
for(unsigned int i = 1, j = 0; i <= ports.size(); ++i, ++j)
{
- if(j > 3)
- {
- j = 0;
- ami = !ami;
- }
-
- if(!ami)
- {
- cout << "testing server #" << i << "... " << flush;
- int pid = obj->pid();
- test(pid != oldPid);
- cout << "ok" << endl;
- oldPid = pid;
- }
- else
- {
- cout << "testing server #" << i << " with AMI... " << flush;
- AMI_Test_pidIPtr cb = new AMI_Test_pidI();
- obj->pid_async(cb);
- test(cb->check());
- int pid = cb->pid();
- test(pid != oldPid);
- cout << "ok" << endl;
- oldPid = pid;
- }
-
- if(j == 0)
- {
- if(!ami)
- {
- cout << "shutting down server #" << i << "... " << flush;
- obj->shutdown();
- cout << "ok" << endl;
- }
- else
- {
- cout << "shutting down server #" << i << " with AMI... " << flush;
- AMI_Test_shutdownIPtr cb = new AMI_Test_shutdownI;
- obj->shutdown_async(cb);
- test(cb->check());
- cout << "ok" << endl;
- }
- }
- else if(j == 1 || i + 1 > ports.size())
- {
- if(!ami)
- {
- cout << "aborting server #" << i << "... " << flush;
- try
- {
- obj->abort();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- cout << "ok" << endl;
- }
- catch(const Ice::ConnectFailedException&)
- {
- cout << "ok" << endl;
- }
- }
- else
- {
- cout << "aborting server #" << i << " with AMI... " << flush;
- AMI_Test_abortIPtr cb = new AMI_Test_abortI;
- obj->abort_async(cb);
- test(cb->check());
- cout << "ok" << endl;
- }
- }
- else if(j == 2 || j == 3)
- {
- if(!ami)
- {
- cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent call... " << flush;
- try
- {
- obj->idempotentAbort();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- cout << "ok" << endl;
- }
- catch(const Ice::ConnectFailedException&)
- {
- cout << "ok" << endl;
- }
- }
- else
- {
- cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent AMI call... " << flush;
- AMI_Test_idempotentAbortIPtr cb = new AMI_Test_idempotentAbortI;
- obj->idempotentAbort_async(cb);
- test(cb->check());
- cout << "ok" << endl;
- }
-
- ++i;
- }
- else
- {
- assert(false);
- }
+ if(j > 3)
+ {
+ j = 0;
+ ami = !ami;
+ }
+
+ if(!ami)
+ {
+ cout << "testing server #" << i << "... " << flush;
+ int pid = obj->pid();
+ test(pid != oldPid);
+ cout << "ok" << endl;
+ oldPid = pid;
+ }
+ else
+ {
+ cout << "testing server #" << i << " with AMI... " << flush;
+ AMI_Test_pidIPtr cb = new AMI_Test_pidI();
+ obj->pid_async(cb);
+ test(cb->check());
+ int pid = cb->pid();
+ test(pid != oldPid);
+ cout << "ok" << endl;
+ oldPid = pid;
+ }
+
+ if(j == 0)
+ {
+ if(!ami)
+ {
+ cout << "shutting down server #" << i << "... " << flush;
+ obj->shutdown();
+ cout << "ok" << endl;
+ }
+ else
+ {
+ cout << "shutting down server #" << i << " with AMI... " << flush;
+ AMI_Test_shutdownIPtr cb = new AMI_Test_shutdownI;
+ obj->shutdown_async(cb);
+ test(cb->check());
+ cout << "ok" << endl;
+ }
+ }
+ else if(j == 1 || i + 1 > ports.size())
+ {
+ if(!ami)
+ {
+ cout << "aborting server #" << i << "... " << flush;
+ try
+ {
+ obj->abort();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ cout << "ok" << endl;
+ }
+ catch(const Ice::ConnectFailedException&)
+ {
+ cout << "ok" << endl;
+ }
+ }
+ else
+ {
+ cout << "aborting server #" << i << " with AMI... " << flush;
+ AMI_Test_abortIPtr cb = new AMI_Test_abortI;
+ obj->abort_async(cb);
+ test(cb->check());
+ cout << "ok" << endl;
+ }
+ }
+ else if(j == 2 || j == 3)
+ {
+ if(!ami)
+ {
+ cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent call... " << flush;
+ try
+ {
+ obj->idempotentAbort();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ cout << "ok" << endl;
+ }
+ catch(const Ice::ConnectFailedException&)
+ {
+ cout << "ok" << endl;
+ }
+ }
+ else
+ {
+ cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent AMI call... " << flush;
+ AMI_Test_idempotentAbortIPtr cb = new AMI_Test_idempotentAbortI;
+ obj->idempotentAbort_async(cb);
+ test(cb->check());
+ cout << "ok" << endl;
+ }
+
+ ++i;
+ }
+ else
+ {
+ assert(false);
+ }
}
cout << "testing whether all servers are gone... " << flush;
try
{
- obj->ice_ping();
- test(false);
+ obj->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
}
diff --git a/cpp/test/Ice/faultTolerance/Client.cpp b/cpp/test/Ice/faultTolerance/Client.cpp
index 26332a7b4db..c7a9561d4ae 100644
--- a/cpp/test/Ice/faultTolerance/Client.cpp
+++ b/cpp/test/Ice/faultTolerance/Client.cpp
@@ -25,32 +25,32 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
vector<int> ports;
for(int i = 1; i < argc; ++i)
{
- if(argv[i][0] == '-')
- {
- cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(argv[i][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- ports.push_back(atoi(argv[i]));
+ ports.push_back(atoi(argv[i]));
}
if(ports.empty())
{
- cerr << argv[0] << ": no ports specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no ports specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
try
{
- void allTests(const Ice::CommunicatorPtr&, const vector<int>&);
- allTests(communicator, ports);
+ void allTests(const Ice::CommunicatorPtr&, const vector<int>&);
+ allTests(communicator, ports);
}
catch(const Ice::Exception& ex)
{
- cout << ex << endl;
- test(false);
+ cout << ex << endl;
+ test(false);
}
return EXIT_SUCCESS;
@@ -64,34 +64,34 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
- //
- // This test aborts servers, so we don't want warnings.
- //
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test aborts servers, so we don't want warnings.
+ //
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp
index 90618e949d7..089190cee08 100644
--- a/cpp/test/Ice/faultTolerance/Server.cpp
+++ b/cpp/test/Ice/faultTolerance/Server.cpp
@@ -24,28 +24,28 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
int port = 0;
for(int i = 1; i < argc; ++i)
{
- if(argv[i][0] == '-')
- {
- cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(argv[i][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- if(port > 0)
- {
- cerr << argv[0] << ": only one port can be specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(port > 0)
+ {
+ cerr << argv[0] << ": only one port can be specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- port = atoi(argv[i]);
+ port = atoi(argv[i]);
}
if(port <= 0)
{
- cerr << argv[0] << ": no port specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": no port specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
ostringstream endpts;
@@ -68,34 +68,34 @@ main(int argc, char* argv[])
try
{
//
- // In this test, we need a longer server idle time, otherwise
- // our test servers may time out before they are used in the
- // test.
- //
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.ServerIdleTime", "120"); // Two minutes.
+ // In this test, we need a longer server idle time, otherwise
+ // our test servers may time out before they are used in the
+ // test.
+ //
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.ServerIdleTime", "120"); // Two minutes.
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/gc/Client.cpp b/cpp/test/Ice/gc/Client.cpp
index 0e0f6fae130..86d599a91fb 100644
--- a/cpp/test/Ice/gc/Client.cpp
+++ b/cpp/test/Ice/gc/Client.cpp
@@ -45,12 +45,12 @@ struct N : public C
{
N()
{
- incNum();
+ incNum();
}
~N()
{
- decNum();
+ decNum();
}
};
@@ -60,12 +60,12 @@ struct N2 : public C2
{
N2()
{
- incNum();
+ incNum();
}
~N2()
{
- decNum();
+ decNum();
}
};
@@ -75,12 +75,12 @@ struct NN : public Node
{
NN()
{
- incNum();
+ incNum();
}
~NN()
{
- decNum();
+ decNum();
}
};
@@ -90,12 +90,12 @@ struct NL : public Leaf
{
NL()
{
- incNum();
+ incNum();
}
~NL()
{
- decNum();
+ decNum();
}
};
@@ -107,138 +107,138 @@ public:
GarbageProducer()
{
- _stop = false;
+ _stop = false;
}
virtual void run()
{
- ::IceUtil::ThreadControl t = getThreadControl();
-
- while(true)
- {
- {
- ::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
- if(_stop)
- {
- return;
- }
- }
-
- t.yield();
-
- {
- NPtr n = new N;
- n->left = n;
- }
-
- {
- NPtr n = new N;
- n->left = n;
- n->right = n;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- n1->left = n2;
- n2->left = n1;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- n1->left = n2;
- n2->left = n1;
- n1->right = n2;
- n2->right = n1;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- n1->left = n2;
- n2->left = n1;
- n1->right = n1;
- n2->right = n2;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- n1->left = n2;
- n2->left = n3;
- n3->left = n1;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- n1->left = n2;
- n2->left = n3;
- n3->left = n1;
- n1->right = n2;
- n2->right = n3;
- n3->right = n1;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- n1->left = n2;
- n2->left = n3;
- n3->left = n1;
- n1->right = n3;
- n2->right = n1;
- n3->right = n2;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- NPtr n4 = new N;
- n1->left = n2;
- n2->left = n1;
- n2->right = n3;
- n3->left = n4;
- }
-
- {
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- NPtr n4 = new N;
- NPtr n5 = new N;
- NPtr n6 = new N;
- n1->left = n2;
- n2->left = n1;
- n2->right = n3;
- n3->left = n4;
- n4->right = n5;
- n5->right = n6;
- n6->right = n5;
- }
- }
+ ::IceUtil::ThreadControl t = getThreadControl();
+
+ while(true)
+ {
+ {
+ ::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
+ if(_stop)
+ {
+ return;
+ }
+ }
+
+ t.yield();
+
+ {
+ NPtr n = new N;
+ n->left = n;
+ }
+
+ {
+ NPtr n = new N;
+ n->left = n;
+ n->right = n;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n1->right = n2;
+ n2->right = n1;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n1->right = n1;
+ n2->right = n2;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ n1->left = n2;
+ n2->left = n3;
+ n3->left = n1;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ n1->left = n2;
+ n2->left = n3;
+ n3->left = n1;
+ n1->right = n2;
+ n2->right = n3;
+ n3->right = n1;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ n1->left = n2;
+ n2->left = n3;
+ n3->left = n1;
+ n1->right = n3;
+ n2->right = n1;
+ n3->right = n2;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ NPtr n4 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n2->right = n3;
+ n3->left = n4;
+ }
+
+ {
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ NPtr n4 = new N;
+ NPtr n5 = new N;
+ NPtr n6 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n2->right = n3;
+ n3->left = n4;
+ n4->right = n5;
+ n5->right = n6;
+ n6->right = n5;
+ }
+ }
}
void stop()
{
- {
- ::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
- _stop = true;
- notify();
- }
- getThreadControl().join();
+ {
+ ::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
+ _stop = true;
+ notify();
+ }
+ getThreadControl().join();
}
void randomWait()
{
- ::IceUtil::Time waitTime = ::IceUtil::Time::milliSeconds(10 + rand() % 50);
- ::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
- timedWait(waitTime);
+ ::IceUtil::Time waitTime = ::IceUtil::Time::milliSeconds(10 + rand() % 50);
+ ::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
+ timedWait(waitTime);
}
private:
@@ -258,10 +258,10 @@ MyApplication::run(int argc, char* argv[])
{
cout << "testing single instance... " << flush;
{
- NPtr n = new N;
- test(getNum() == 1);
- Ice::collectGarbage();
- test(getNum() == 1);
+ NPtr n = new N;
+ test(getNum() == 1);
+ Ice::collectGarbage();
+ test(getNum() == 1);
}
test(getNum() == 0);
Ice::collectGarbage();
@@ -270,11 +270,11 @@ MyApplication::run(int argc, char* argv[])
cout << "testing single instance cycle... " << flush;
{
- NPtr n = new N;
- n->left = n;
- test(getNum() == 1);
- Ice::collectGarbage();
- test(getNum() == 1);
+ NPtr n = new N;
+ n->left = n;
+ test(getNum() == 1);
+ Ice::collectGarbage();
+ test(getNum() == 1);
}
test(getNum() == 1);
Ice::collectGarbage();
@@ -283,12 +283,12 @@ MyApplication::run(int argc, char* argv[])
cout << "testing single instance cycle with double pointers... " << flush;
{
- NPtr n = new N;
- n->left = n;
- n->right = n;
- test(getNum() == 1);
- Ice::collectGarbage();
- test(getNum() == 1);
+ NPtr n = new N;
+ n->left = n;
+ n->right = n;
+ test(getNum() == 1);
+ Ice::collectGarbage();
+ test(getNum() == 1);
}
test(getNum() == 1);
Ice::collectGarbage();
@@ -297,13 +297,13 @@ MyApplication::run(int argc, char* argv[])
cout << "testing double instance cycle... " << flush;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- n1->left = n2;
- n2->left = n1;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
test(getNum() == 2);
Ice::collectGarbage();
@@ -312,15 +312,15 @@ MyApplication::run(int argc, char* argv[])
cout << "testing double instance cycle with double pointers... " << flush;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- n1->left = n2;
- n2->left = n1;
- n1->right = n2;
- n2->right = n1;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n1->right = n2;
+ n2->right = n1;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
test(getNum() == 2);
Ice::collectGarbage();
@@ -329,15 +329,15 @@ MyApplication::run(int argc, char* argv[])
cout << "testing double instance cycle with looped pointers... " << flush;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- n1->left = n2;
- n2->left = n1;
- n1->right = n1;
- n2->right = n2;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n1->right = n1;
+ n2->right = n2;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
test(getNum() == 2);
Ice::collectGarbage();
@@ -346,15 +346,15 @@ MyApplication::run(int argc, char* argv[])
cout << "testing triple instance cycle... " << flush;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- n1->left = n2;
- n2->left = n3;
- n3->left = n1;
- test(getNum() == 3);
- Ice::collectGarbage();
- test(getNum() == 3);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ n1->left = n2;
+ n2->left = n3;
+ n3->left = n1;
+ test(getNum() == 3);
+ Ice::collectGarbage();
+ test(getNum() == 3);
}
test(getNum() == 3);
Ice::collectGarbage();
@@ -363,18 +363,18 @@ MyApplication::run(int argc, char* argv[])
cout << "testing triple instance cycle with double pointers... " << flush;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- n1->left = n2;
- n2->left = n3;
- n3->left = n1;
- n1->right = n2;
- n2->right = n3;
- n3->right = n1;
- test(getNum() == 3);
- Ice::collectGarbage();
- test(getNum() == 3);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ n1->left = n2;
+ n2->left = n3;
+ n3->left = n1;
+ n1->right = n2;
+ n2->right = n3;
+ n3->right = n1;
+ test(getNum() == 3);
+ Ice::collectGarbage();
+ test(getNum() == 3);
}
test(getNum() == 3);
Ice::collectGarbage();
@@ -383,18 +383,18 @@ MyApplication::run(int argc, char* argv[])
cout << "testing triple instance cycle with opposing pointers... " << flush;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- n1->left = n2;
- n2->left = n3;
- n3->left = n1;
- n1->right = n3;
- n2->right = n1;
- n3->right = n2;
- test(getNum() == 3);
- Ice::collectGarbage();
- test(getNum() == 3);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ n1->left = n2;
+ n2->left = n3;
+ n3->left = n1;
+ n1->right = n3;
+ n2->right = n1;
+ n3->right = n2;
+ test(getNum() == 3);
+ Ice::collectGarbage();
+ test(getNum() == 3);
}
test(getNum() == 3);
Ice::collectGarbage();
@@ -404,18 +404,18 @@ MyApplication::run(int argc, char* argv[])
cout << "testing cycle with trailing instances... " << flush;
NPtr n;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- NPtr n4 = new N;
- n1->left = n2;
- n2->left = n1;
- n2->right = n3;
- n3->left = n4;
- n = n3;
- test(getNum() == 4);
- Ice::collectGarbage();
- test(getNum() == 4);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ NPtr n4 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n2->right = n3;
+ n3->left = n4;
+ n = n3;
+ test(getNum() == 4);
+ Ice::collectGarbage();
+ test(getNum() == 4);
}
test(getNum() == 4);
Ice::collectGarbage();
@@ -428,23 +428,23 @@ MyApplication::run(int argc, char* argv[])
cout << "testing cycle with trailing instances and trailing cycle... " << flush;
{
- NPtr n1 = new N;
- NPtr n2 = new N;
- NPtr n3 = new N;
- NPtr n4 = new N;
- NPtr n5 = new N;
- NPtr n6 = new N;
- n1->left = n2;
- n2->left = n1;
- n2->right = n3;
- n3->left = n4;
- n4->right = n5;
- n5->right = n6;
- n6->right = n5;
- n = n4;
- test(getNum() == 6);
- Ice::collectGarbage();
- test(getNum() == 6);
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ NPtr n3 = new N;
+ NPtr n4 = new N;
+ NPtr n5 = new N;
+ NPtr n6 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ n2->right = n3;
+ n3->left = n4;
+ n4->right = n5;
+ n5->right = n6;
+ n6->right = n5;
+ n = n4;
+ test(getNum() == 6);
+ Ice::collectGarbage();
+ test(getNum() == 6);
}
test(getNum() == 6);
Ice::collectGarbage();
@@ -457,14 +457,14 @@ MyApplication::run(int argc, char* argv[])
cout << "testing sequence element cycle... " << flush;
{
- CSeq cs;
- cs.push_back(new N);
- cs.push_back(new N);
- cs[0]->left = cs[1];
- cs[1]->left = cs[0];
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ CSeq cs;
+ cs.push_back(new N);
+ cs.push_back(new N);
+ cs[0]->left = cs[1];
+ cs[1]->left = cs[0];
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
Ice::collectGarbage();
test(getNum() == 0);
@@ -472,16 +472,16 @@ MyApplication::run(int argc, char* argv[])
cout << "testing dictionary element cycle... " << flush;
{
- CDict cd;
- NPtr n1 = new N;
- NPtr n2 = new N;
- n1->left = n2;
- n2->left = n1;
- cd[0] = n1;
- cd[1] = n2;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ CDict cd;
+ NPtr n1 = new N;
+ NPtr n2 = new N;
+ n1->left = n2;
+ n2->left = n1;
+ cd[0] = n1;
+ cd[1] = n2;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
Ice::collectGarbage();
test(getNum() == 0);
@@ -489,18 +489,18 @@ MyApplication::run(int argc, char* argv[])
cout << "testing sequence of struct cycle... " << flush;
{
- SSeq ss;
- S s;
+ SSeq ss;
+ S s;
- ss.push_back(s);
- ss.push_back(s);
- ss[0].theC = new N;
- ss[1].theC = new N;
- ss[0].theC->left = ss[1].theC;
- ss[1].theC->left = ss[0].theC;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ ss.push_back(s);
+ ss.push_back(s);
+ ss[0].theC = new N;
+ ss[1].theC = new N;
+ ss[0].theC->left = ss[1].theC;
+ ss[1].theC->left = ss[0].theC;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
Ice::collectGarbage();
test(getNum() == 0);
@@ -508,18 +508,18 @@ MyApplication::run(int argc, char* argv[])
cout << "testing sequence of struct of dictionary cycle... " << flush;
{
- N2Ptr n2 = new N2;
- S2 s2;
+ N2Ptr n2 = new N2;
+ S2 s2;
- n2->theS2Seq.push_back(s2);
- n2->theS2Seq.push_back(s2);
- n2->theS2Seq[0].theC2Dict[0] = n2;
- n2->theS2Seq[0].theC2Dict[1] = n2;
- n2->theS2Seq[1].theC2Dict[0] = n2;
- n2->theS2Seq[1].theC2Dict[1] = n2;
- test(getNum() == 1);
- Ice::collectGarbage();
- test(getNum() == 1);
+ n2->theS2Seq.push_back(s2);
+ n2->theS2Seq.push_back(s2);
+ n2->theS2Seq[0].theC2Dict[0] = n2;
+ n2->theS2Seq[0].theC2Dict[1] = n2;
+ n2->theS2Seq[1].theC2Dict[0] = n2;
+ n2->theS2Seq[1].theC2Dict[1] = n2;
+ test(getNum() == 1);
+ Ice::collectGarbage();
+ test(getNum() == 1);
}
Ice::collectGarbage();
test(getNum() == 0);
@@ -529,61 +529,61 @@ MyApplication::run(int argc, char* argv[])
{
NNPtr nn = new NN;
- nn->l = new NL;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ nn->l = new NL;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
Ice::collectGarbage();
test(getNum() == 0);
{
NLPtr p;
- {
- NNPtr nn = new NN;
- p = new NL;
- nn->l = p;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
- }
- Ice::collectGarbage();
- test(getNum() == 1);
+ {
+ NNPtr nn = new NN;
+ p = new NL;
+ nn->l = p;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
+ }
+ Ice::collectGarbage();
+ test(getNum() == 1);
}
test(getNum() == 0);
{
- NNPtr nn = new NN;
- NLPtr nl = new NL;
- nn->l = nl;
- nn->n = nn;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ NNPtr nn = new NN;
+ NLPtr nl = new NL;
+ nn->l = nl;
+ nn->n = nn;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
test(getNum() == 2);
Ice::collectGarbage();
test(getNum() == 0);
{
- NNPtr nn1 = new NN;
- NNPtr nn2 = new NN;
- NLPtr nl = new NL;
- nn1->l = nl;
- nn1->n = nn2;
- nn2->l = nl;
- nn2->n = nn1;
- test(getNum() == 3);
- Ice::collectGarbage();
- test(getNum() == 3);
+ NNPtr nn1 = new NN;
+ NNPtr nn2 = new NN;
+ NLPtr nl = new NL;
+ nn1->l = nl;
+ nn1->n = nn2;
+ nn2->l = nl;
+ nn2->n = nn1;
+ test(getNum() == 3);
+ Ice::collectGarbage();
+ test(getNum() == 3);
}
test(getNum() == 3);
Ice::collectGarbage();
test(getNum() == 0);
{
- NLPtr nl = new NL;
- test(getNum() == 1);
+ NLPtr nl = new NL;
+ test(getNum() == 1);
}
test(getNum() == 0);
Ice::collectGarbage();
@@ -591,10 +591,10 @@ MyApplication::run(int argc, char* argv[])
{
NNPtr nn1 = new NN;
- nn1->n = new NN;
- test(getNum() == 2);
- Ice::collectGarbage();
- test(getNum() == 2);
+ nn1->n = new NN;
+ test(getNum() == 2);
+ Ice::collectGarbage();
+ test(getNum() == 2);
}
test(getNum() == 0);
Ice::collectGarbage();
@@ -619,12 +619,12 @@ MyApplication::run(int argc, char* argv[])
for(int i = 0; i < 50; ++i)
{
- if(interrupted())
- {
- break;
- }
- garbageThread->randomWait();
- Ice::collectGarbage();
+ if(interrupted())
+ {
+ break;
+ }
+ garbageThread->randomWait();
+ Ice::collectGarbage();
}
garbageThread->stop();
@@ -632,13 +632,13 @@ MyApplication::run(int argc, char* argv[])
Ice::collectGarbage();
if(!interrupted())
{
- test(getNum() == 0);
- cout << "ok" << endl;
- return EXIT_SUCCESS;
+ test(getNum() == 0);
+ cout << "ok" << endl;
+ return EXIT_SUCCESS;
}
else
{
- return 130; // SIGINT + 128
+ return 130; // SIGINT + 128
}
}
diff --git a/cpp/test/Ice/gc/Test.ice b/cpp/test/Ice/gc/Test.ice
index e2451aa5ceb..bc367837722 100644
--- a/cpp/test/Ice/gc/Test.ice
+++ b/cpp/test/Ice/gc/Test.ice
@@ -64,31 +64,31 @@ class Node
// Sequence of structs defined above.
-sequence<C2Dict> C2DictSeq; // Sequence of dictionary.
+sequence<C2Dict> C2DictSeq; // Sequence of dictionary.
-sequence<CSeq> CSeqSeq; // Sequence of sequence.
+sequence<CSeq> CSeqSeq; // Sequence of sequence.
// Struct containing classes defined above.
-struct A // Struct containing sequence.
+struct A // Struct containing sequence.
{
SSeq theSSeq;
};
// Struct containing dictionary defined above.
-struct B // Struct containing struct.
+struct B // Struct containing struct.
{
S theS;
};
// Dictionary of classes defined above.
-dictionary<int, CSeq> CSeqDict; // Dictionary containing sequence.
+dictionary<int, CSeq> CSeqDict; // Dictionary containing sequence.
-dictionary<int, S> SDict; // Dictionary containing struct.
+dictionary<int, S> SDict; // Dictionary containing struct.
-dictionary<int, CDict> CDictDict; // Dictionary containing dictionary.
+dictionary<int, CDict> CDictDict; // Dictionary containing dictionary.
class CTest
{
@@ -114,18 +114,18 @@ module AAA
dictionary<int, B> BDict;
struct BStruct
{
- B bMem;
+ B bMem;
};
class C
{
- Object obj1;
- Object obj2;
+ Object obj1;
+ Object obj2;
B b1;
B b2;
BSeq x;
- BDict y;
- BStruct z;
+ BDict y;
+ BStruct z;
};
};
@@ -135,18 +135,18 @@ module AAA
dictionary<int, C> CDict;
struct CStruct
{
- C cMem;
+ C cMem;
};
class B
{
- Object obj1;
- Object obj2;
- C c1;
- C c2;
+ Object obj1;
+ Object obj2;
+ C c1;
+ C c2;
CSeq x;
- CDict y;
- CStruct z;
+ CDict y;
+ CStruct z;
};
};
@@ -167,24 +167,24 @@ module DDD
{
interface I
{
- void op();
+ void op();
};
class C
{
- void op();
+ void op();
};
class C2;
class U
{
- I myI;
- I* myIstar;
- C myC;
- C* myCstar;
- C2 myC2;
- C2* myC2star;
+ I myI;
+ I* myIstar;
+ C myC;
+ C* myCstar;
+ C2 myC2;
+ C2* myC2star;
};
class C2
diff --git a/cpp/test/Ice/hold/AllTests.cpp b/cpp/test/Ice/hold/AllTests.cpp
index 656afd3f066..929fdcf53b8 100644
--- a/cpp/test/Ice/hold/AllTests.cpp
+++ b/cpp/test/Ice/hold/AllTests.cpp
@@ -32,7 +32,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "changing state between active and hold rapidly... " << flush;
for(int i = 0; i < 100; ++i)
{
- hold->putOnHold(0);
+ hold->putOnHold(0);
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/hold/Client.cpp b/cpp/test/Ice/hold/Client.cpp
index aaa0e585955..0162051684d 100644
--- a/cpp/test/Ice/hold/Client.cpp
+++ b/cpp/test/Ice/hold/Client.cpp
@@ -30,26 +30,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/hold/Server.cpp b/cpp/test/Ice/hold/Server.cpp
index 1b4c0a5784e..ba0dfe8fbba 100644
--- a/cpp/test/Ice/hold/Server.cpp
+++ b/cpp/test/Ice/hold/Server.cpp
@@ -32,26 +32,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/hold/TestI.cpp b/cpp/test/Ice/hold/TestI.cpp
index bd5200168e5..63015a458f9 100644
--- a/cpp/test/Ice/hold/TestI.cpp
+++ b/cpp/test/Ice/hold/TestI.cpp
@@ -15,12 +15,12 @@ HoldI::putOnHold(Ice::Int seconds, const Ice::Current& current)
{
if(seconds <= 0)
{
- current.adapter->hold();
- current.adapter->activate();
+ current.adapter->hold();
+ current.adapter->activate();
}
else
{
- assert(false); // TODO
+ assert(false); // TODO
}
}
diff --git a/cpp/test/Ice/inheritance/Client.cpp b/cpp/test/Ice/inheritance/Client.cpp
index 5e73131b1c9..cd9f5e04e0e 100644
--- a/cpp/test/Ice/inheritance/Client.cpp
+++ b/cpp/test/Ice/inheritance/Client.cpp
@@ -31,26 +31,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/inheritance/Collocated.cpp b/cpp/test/Ice/inheritance/Collocated.cpp
index da1f7d58fe7..215c3a5e3b6 100644
--- a/cpp/test/Ice/inheritance/Collocated.cpp
+++ b/cpp/test/Ice/inheritance/Collocated.cpp
@@ -35,26 +35,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/inheritance/Server.cpp b/cpp/test/Ice/inheritance/Server.cpp
index 20635c31e8f..a28e1fa33a8 100644
--- a/cpp/test/Ice/inheritance/Server.cpp
+++ b/cpp/test/Ice/inheritance/Server.cpp
@@ -32,26 +32,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/inheritance/TestI.h b/cpp/test/Ice/inheritance/TestI.h
index 90cbb433848..72918965061 100644
--- a/cpp/test/Ice/inheritance/TestI.h
+++ b/cpp/test/Ice/inheritance/TestI.h
@@ -74,7 +74,7 @@ class IB1I : virtual public Test::MB::IB1, virtual public IAI
{
public:
- virtual Test::MB::IB1Prx ib1op(const Test::MB::IB1Prx&, const Ice::Current&);
+ virtual Test::MB::IB1Prx ib1op(const Test::MB::IB1Prx&, const Ice::Current&);
};
class IB2I : virtual public Test::MB::IB2, virtual public IAI
diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp
index 8250e3c8701..c5993bb19fe 100644
--- a/cpp/test/Ice/location/AllTests.cpp
+++ b/cpp/test/Ice/location/AllTests.cpp
@@ -23,7 +23,7 @@ public:
virtual void
sayHello(const Ice::Current& foo)
{
- // Do nothing, this is just a dummy servant.
+ // Do nothing, this is just a dummy servant.
}
};
@@ -101,13 +101,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
@@ -116,13 +116,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
manager->startServer();
try
{
- obj6 = TestIntfPrx::checkedCast(base6);
- obj6->ice_ping();
+ obj6 = TestIntfPrx::checkedCast(base6);
+ obj6->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
@@ -131,123 +131,123 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
manager->startServer();
try
{
- obj3 = TestIntfPrx::checkedCast(base3);
- obj3->ice_ping();
+ obj3 = TestIntfPrx::checkedCast(base3);
+ obj3->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
try
{
- obj3 = TestIntfPrx::checkedCast(base3);
- obj3->ice_ping();
+ obj3 = TestIntfPrx::checkedCast(base3);
+ obj3->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj3 = TestIntfPrx::checkedCast(base3);
- obj3->ice_ping();
+ obj3 = TestIntfPrx::checkedCast(base3);
+ obj3->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj5 = TestIntfPrx::checkedCast(base5);
- obj5->ice_ping();
+ obj5 = TestIntfPrx::checkedCast(base5);
+ obj5->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing proxy with unknown identity... " << flush;
try
{
- base = communicator->stringToProxy("unknown/unknown");
- base->ice_ping();
- test(false);
+ base = communicator->stringToProxy("unknown/unknown");
+ base->ice_ping();
+ test(false);
}
catch (const Ice::NotRegisteredException& ex)
{
- test(ex.kindOfObject == "object");
- test(ex.id == "unknown/unknown");
+ test(ex.kindOfObject == "object");
+ test(ex.id == "unknown/unknown");
}
cout << "ok" << endl;
cout << "testing proxy with unknown adapter... " << flush;
try
{
- base = communicator->stringToProxy("test @ TestAdapterUnknown");
- base->ice_ping();
- test(false);
+ base = communicator->stringToProxy("test @ TestAdapterUnknown");
+ base->ice_ping();
+ test(false);
}
catch (const Ice::NotRegisteredException& ex)
{
- test(ex.kindOfObject == "object adapter");
- test(ex.id == "TestAdapterUnknown");
+ test(ex.kindOfObject == "object adapter");
+ test(ex.id == "TestAdapterUnknown");
}
cout << "ok" << endl;
@@ -319,24 +319,24 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
cout << "testing whether server is gone... " << flush;
try
{
- obj2->ice_ping();
- test(false);
+ obj2->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
}
try
{
- obj3->ice_ping();
- test(false);
+ obj3->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
}
try
{
- obj5->ice_ping();
- test(false);
+ obj5->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
@@ -362,9 +362,9 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
try
{
- HelloPrx helloPrx = HelloPrx::checkedCast(communicator->stringToProxy(communicator->identityToString(id)));
- Ice::ConnectionPtr connection = helloPrx->ice_getConnection();
- test(false);
+ HelloPrx helloPrx = HelloPrx::checkedCast(communicator->stringToProxy(communicator->identityToString(id)));
+ Ice::ConnectionPtr connection = helloPrx->ice_getConnection();
+ test(false);
}
catch(const Ice::CollocationOptimizationException&)
{
diff --git a/cpp/test/Ice/location/Client.cpp b/cpp/test/Ice/location/Client.cpp
index aa5e1d2d4cc..410164bb3fd 100644
--- a/cpp/test/Ice/location/Client.cpp
+++ b/cpp/test/Ice/location/Client.cpp
@@ -30,28 +30,28 @@ main(int argc, char* argv[])
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.Default.Locator", "locator:default -p 12010");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.Default.Locator", "locator:default -p 12010");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/location/Server.cpp b/cpp/test/Ice/location/Server.cpp
index e76326f9e0d..e327819beb1 100644
--- a/cpp/test/Ice/location/Server.cpp
+++ b/cpp/test/Ice/location/Server.cpp
@@ -39,7 +39,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator,
adapter->add(object, communicator->stringToIdentity("ServerManager"));
Ice::LocatorRegistryPrx registryPrx =
- Ice::LocatorRegistryPrx::uncheckedCast(adapter->add(registry, communicator->stringToIdentity("registry")));
+ Ice::LocatorRegistryPrx::uncheckedCast(adapter->add(registry, communicator->stringToIdentity("registry")));
Ice::LocatorPtr locator = new ServerLocator(registry, registryPrx);
adapter->add(locator, communicator->stringToIdentity("locator"));
@@ -58,30 +58,30 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- communicator = Ice::initialize(argc, argv, initData);
- assert(initData.properties != communicator->getProperties());
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
+ assert(initData.properties != communicator->getProperties());
- status = run(argc, argv, communicator, initData);
+ status = run(argc, argv, communicator, initData);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/location/ServerLocator.cpp b/cpp/test/Ice/location/ServerLocator.cpp
index c6fe03a8c1e..b6eb03caba3 100644
--- a/cpp/test/Ice/location/ServerLocator.cpp
+++ b/cpp/test/Ice/location/ServerLocator.cpp
@@ -19,8 +19,8 @@ ServerLocatorRegistry::ServerLocatorRegistry()
void
ServerLocatorRegistry::setAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setAdapterDirectProxyPtr& cb,
- const std::string& adapter, const ::Ice::ObjectPrx& object,
- const ::Ice::Current&)
+ const std::string& adapter, const ::Ice::ObjectPrx& object,
+ const ::Ice::Current&)
{
_adapters[adapter] = object;
cb->ice_response();
@@ -39,7 +39,7 @@ ServerLocatorRegistry::setReplicatedAdapterDirectProxy_async(
void
ServerLocatorRegistry::setServerProcessProxy_async(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr& cb,
- const ::std::string&, const Ice::ProcessPrx&, const ::Ice::Current&)
+ const ::std::string&, const Ice::ProcessPrx&, const ::Ice::Current&)
{
cb->ice_response();
}
@@ -56,7 +56,7 @@ ServerLocatorRegistry::getAdapter(const ::std::string& adapter) const
::std::map< string, ::Ice::ObjectPrx>::const_iterator p = _adapters.find(adapter);
if(_adapters.find(adapter) == _adapters.end())
{
- throw Ice::AdapterNotFoundException();
+ throw Ice::AdapterNotFoundException();
}
return p->second;
}
@@ -67,7 +67,7 @@ ServerLocatorRegistry::getObject(const ::Ice::Identity& id) const
::std::map< ::Ice::Identity, ::Ice::ObjectPrx>::const_iterator p = _objects.find(id);
if(p == _objects.end())
{
- throw Ice::ObjectNotFoundException();
+ throw Ice::ObjectNotFoundException();
}
return p->second;
@@ -88,7 +88,7 @@ ServerLocator::ServerLocator(const ServerLocatorRegistryPtr& registry, const ::I
void
ServerLocator::findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr& response, const Ice::Identity& id,
- const Ice::Current& current) const
+ const Ice::Current& current) const
{
++const_cast<int&>(_requestCount);
response->ice_response(_registry->getObject(id));
@@ -96,7 +96,7 @@ ServerLocator::findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr& re
void
ServerLocator::findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr& response, const string& id,
- const Ice::Current& current) const
+ const Ice::Current& current) const
{
++const_cast<int&>(_requestCount);
response->ice_response(_registry->getAdapter(id));
diff --git a/cpp/test/Ice/location/ServerLocator.h b/cpp/test/Ice/location/ServerLocator.h
index 7b2a7131cd9..73da5c18e8d 100644
--- a/cpp/test/Ice/location/ServerLocator.h
+++ b/cpp/test/Ice/location/ServerLocator.h
@@ -21,12 +21,12 @@ public:
ServerLocatorRegistry();
virtual void setAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setAdapterDirectProxyPtr&,
- const ::std::string&, const ::Ice::ObjectPrx&, const ::Ice::Current&);
+ const ::std::string&, const ::Ice::ObjectPrx&, const ::Ice::Current&);
virtual void setReplicatedAdapterDirectProxy_async(
- const Ice::AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr&,
- const std::string&, const ::std::string&, const ::Ice::ObjectPrx&, const ::Ice::Current&);
+ const Ice::AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr&,
+ const std::string&, const ::std::string&, const ::Ice::ObjectPrx&, const ::Ice::Current&);
virtual void setServerProcessProxy_async(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr&,
- const ::std::string&, const ::Ice::ProcessPrx&, const ::Ice::Current&);
+ const ::std::string&, const ::Ice::ProcessPrx&, const ::Ice::Current&);
void addObject(const ::Ice::ObjectPrx&, const ::Ice::Current&);
//
@@ -51,10 +51,10 @@ public:
ServerLocator(const ::ServerLocatorRegistryPtr&, const ::Ice::LocatorRegistryPrx&);
virtual void findObjectById_async(const ::Ice::AMD_Locator_findObjectByIdPtr&, const ::Ice::Identity&,
- const ::Ice::Current&) const;
+ const ::Ice::Current&) const;
virtual void findAdapterById_async(const ::Ice::AMD_Locator_findAdapterByIdPtr&, const ::std::string&,
- const ::Ice::Current&) const;
+ const ::Ice::Current&) const;
virtual ::Ice::LocatorRegistryPrx getRegistry(const ::Ice::Current&) const;
diff --git a/cpp/test/Ice/location/TestI.cpp b/cpp/test/Ice/location/TestI.cpp
index 1eb60dea2bf..d5f22b48672 100644
--- a/cpp/test/Ice/location/TestI.cpp
+++ b/cpp/test/Ice/location/TestI.cpp
@@ -14,8 +14,8 @@
using namespace Test;
ServerManagerI::ServerManagerI(const Ice::ObjectAdapterPtr& adapter,
- const ServerLocatorRegistryPtr& registry,
- const Ice::InitializationData& initData) :
+ const ServerLocatorRegistryPtr& registry,
+ const Ice::InitializationData& initData) :
_adapter(adapter), _registry(registry), _initData(initData)
{
_initData.properties->setProperty("Ice.OA.TestAdapter.Endpoints", "default");
@@ -33,8 +33,8 @@ ServerManagerI::startServer(const Ice::Current& current)
{
for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i)
{
- (*i)->waitForShutdown();
- (*i)->destroy();
+ (*i)->waitForShutdown();
+ (*i)->destroy();
}
_communicators.clear();
@@ -70,15 +70,15 @@ ServerManagerI::shutdown(const Ice::Current&)
{
for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i)
{
- (*i)->destroy();
+ (*i)->destroy();
}
_adapter->getCommunicator()->shutdown();
}
TestI::TestI(const Ice::ObjectAdapterPtr& adapter,
- const Ice::ObjectAdapterPtr& adapter2,
- const ServerLocatorRegistryPtr& registry) :
+ const Ice::ObjectAdapterPtr& adapter2,
+ const ServerLocatorRegistryPtr& registry) :
_adapter1(adapter), _adapter2(adapter2), _registry(registry)
{
_registry->addObject(_adapter1->add(new HelloI(), _adapter1->getCommunicator()->stringToIdentity("hello")));
@@ -94,7 +94,7 @@ HelloPrx
TestI::getHello(const Ice::Current&)
{
return HelloPrx::uncheckedCast(_adapter1->createIndirectProxy(
- _adapter1->getCommunicator()->stringToIdentity("hello")));
+ _adapter1->getCommunicator()->stringToIdentity("hello")));
}
HelloPrx
@@ -109,11 +109,11 @@ TestI::migrateHello(const Ice::Current&)
const Ice::Identity id = _adapter1->getCommunicator()->stringToIdentity("hello");
try
{
- _registry->addObject(_adapter2->add(_adapter1->remove(id), id));
+ _registry->addObject(_adapter2->add(_adapter1->remove(id), id));
}
catch(Ice::NotRegisteredException&)
{
- _registry->addObject(_adapter1->add(_adapter2->remove(id), id));
+ _registry->addObject(_adapter1->add(_adapter2->remove(id), id));
}
}
diff --git a/cpp/test/Ice/location/TestI.h b/cpp/test/Ice/location/TestI.h
index ac03b3970ce..c94a16d5452 100644
--- a/cpp/test/Ice/location/TestI.h
+++ b/cpp/test/Ice/location/TestI.h
@@ -19,7 +19,7 @@ class ServerManagerI : public Test::ServerManager
public:
ServerManagerI(const Ice::ObjectAdapterPtr&, const ServerLocatorRegistryPtr&,
- const Ice::InitializationData&);
+ const Ice::InitializationData&);
virtual void startServer(const Ice::Current&);
virtual void shutdown(const Ice::Current&);
diff --git a/cpp/test/Ice/objects/AllTests.cpp b/cpp/test/Ice/objects/AllTests.cpp
index 7144ee7e861..91161ac04c2 100644
--- a/cpp/test/Ice/objects/AllTests.cpp
+++ b/cpp/test/Ice/objects/AllTests.cpp
@@ -140,32 +140,32 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
- cout << "testing UnexpectedObjectException... " << flush;
- ref = "uoet:default -p 12010 -t 10000";
- base = communicator->stringToProxy(ref);
- test(base);
- UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrx::uncheckedCast(base);
- test(uoet);
- try
- {
- uoet->op();
- test(false);
- }
- catch(const Ice::UnexpectedObjectException& ex)
- {
- test(ex.type == "::Test::AlsoEmpty");
- test(ex.expectedType == "::Test::Empty");
- }
- catch(const Ice::Exception& ex)
- {
- cout << ex << endl;
- test(false);
- }
- catch(...)
- {
- test(false);
- }
- cout << "ok" << endl;
+ cout << "testing UnexpectedObjectException... " << flush;
+ ref = "uoet:default -p 12010 -t 10000";
+ base = communicator->stringToProxy(ref);
+ test(base);
+ UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrx::uncheckedCast(base);
+ test(uoet);
+ try
+ {
+ uoet->op();
+ test(false);
+ }
+ catch(const Ice::UnexpectedObjectException& ex)
+ {
+ test(ex.type == "::Test::AlsoEmpty");
+ test(ex.expectedType == "::Test::Empty");
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cout << ex << endl;
+ test(false);
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ cout << "ok" << endl;
}
return initial;
diff --git a/cpp/test/Ice/objects/Client.cpp b/cpp/test/Ice/objects/Client.cpp
index 3c057524e36..3e7f3fcfa13 100644
--- a/cpp/test/Ice/objects/Client.cpp
+++ b/cpp/test/Ice/objects/Client.cpp
@@ -20,25 +20,25 @@ public:
virtual Ice::ObjectPtr create(const string& type)
{
- if(type == "::Test::B")
- {
- return new BI;
- }
- else if(type == "::Test::C")
- {
- return new CI;
- }
- else if(type == "::Test::D")
- {
- return new DI;
- }
- assert(false); // Should never be reached
- return 0;
+ if(type == "::Test::B")
+ {
+ return new BI;
+ }
+ else if(type == "::Test::C")
+ {
+ return new CI;
+ }
+ else if(type == "::Test::D")
+ {
+ return new DI;
+ }
+ assert(false); // Should never be reached
+ return 0;
}
virtual void destroy()
{
- // Nothing to do
+ // Nothing to do
}
};
@@ -64,26 +64,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/objects/Collocated.cpp b/cpp/test/Ice/objects/Collocated.cpp
index a61ce056025..ed26a370e30 100644
--- a/cpp/test/Ice/objects/Collocated.cpp
+++ b/cpp/test/Ice/objects/Collocated.cpp
@@ -35,26 +35,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/objects/Server.cpp b/cpp/test/Ice/objects/Server.cpp
index c5b7d672501..25379cd3be7 100644
--- a/cpp/test/Ice/objects/Server.cpp
+++ b/cpp/test/Ice/objects/Server.cpp
@@ -35,26 +35,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/objects/TestI.cpp b/cpp/test/Ice/objects/TestI.cpp
index 9f141b6a63a..4beaa5477fc 100644
--- a/cpp/test/Ice/objects/TestI.cpp
+++ b/cpp/test/Ice/objects/TestI.cpp
@@ -162,7 +162,7 @@ InitialI::getAll(BPtr& b1, BPtr& b2, CPtr& c, DPtr& d, const Ice::Current&)
bool
UnexpectedObjectExceptionTestI::ice_invoke(const std::vector<Ice::Byte>&,
std::vector<Ice::Byte>& outParams,
- const Ice::Current& current)
+ const Ice::Current& current)
{
Ice::CommunicatorPtr communicator = current.adapter->getCommunicator();
Ice::OutputStreamPtr out = Ice::createOutputStream(communicator);
diff --git a/cpp/test/Ice/operations/AllTests.cpp b/cpp/test/Ice/operations/AllTests.cpp
index 7f592a449fd..15df53511d6 100644
--- a/cpp/test/Ice/operations/AllTests.cpp
+++ b/cpp/test/Ice/operations/AllTests.cpp
@@ -202,17 +202,17 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
- cout << "testing timeout... " << flush;
- Test::MyClassPrx clTimeout = Test::MyClassPrx::uncheckedCast(cl->ice_timeout(500));
- try
- {
- clTimeout->opSleep(2000);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- }
- cout << "ok" << endl;
+ cout << "testing timeout... " << flush;
+ Test::MyClassPrx clTimeout = Test::MyClassPrx::uncheckedCast(cl->ice_timeout(500));
+ try
+ {
+ clTimeout->opSleep(2000);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ }
+ cout << "ok" << endl;
}
cout << "testing twoway operations... " << flush;
@@ -224,17 +224,17 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
if(!collocated)
{
- cout << "testing twoway operations with AMI... " << flush;
- void twowaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrx&);
- twowaysAMI(communicator, cl);
- twowaysAMI(communicator, derived);
- cout << "ok" << endl;
-
- cout << "testing batch oneway operations... " << flush;
- void batchOneways(const Test::MyClassPrx&);
- batchOneways(cl);
- batchOneways(derived);
- cout << "ok" << endl;
+ cout << "testing twoway operations with AMI... " << flush;
+ void twowaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrx&);
+ twowaysAMI(communicator, cl);
+ twowaysAMI(communicator, derived);
+ cout << "ok" << endl;
+
+ cout << "testing batch oneway operations... " << flush;
+ void batchOneways(const Test::MyClassPrx&);
+ batchOneways(cl);
+ batchOneways(derived);
+ cout << "ok" << endl;
}
return cl;
diff --git a/cpp/test/Ice/operations/BatchOneways.cpp b/cpp/test/Ice/operations/BatchOneways.cpp
index 0556e8bb722..d0394e5cd51 100644
--- a/cpp/test/Ice/operations/BatchOneways.cpp
+++ b/cpp/test/Ice/operations/BatchOneways.cpp
@@ -22,32 +22,32 @@ batchOneways(const Test::MyClassPrx& p)
try
{
- p->opByteSOneway(bs1);
- test(true);
+ p->opByteSOneway(bs1);
+ test(true);
}
catch(const Ice::MemoryLimitException&)
{
- test(false);
+ test(false);
}
try
{
- p->opByteSOneway(bs2);
- test(true);
+ p->opByteSOneway(bs2);
+ test(true);
}
catch(const Ice::MemoryLimitException&)
{
- test(false);
+ test(false);
}
try
{
- p->opByteSOneway(bs3);
- test(false);
+ p->opByteSOneway(bs3);
+ test(false);
}
catch(const Ice::MemoryLimitException&)
{
- test(true);
+ test(true);
}
Test::MyClassPrx batch = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway());
@@ -56,15 +56,15 @@ batchOneways(const Test::MyClassPrx& p)
for(i = 0 ; i < 30 ; ++i)
{
- try
- {
- batch->opByteSOneway(bs1);
- test(true);
- }
- catch(const Ice::MemoryLimitException&)
- {
- test(false);
- }
+ try
+ {
+ batch->opByteSOneway(bs1);
+ test(true);
+ }
+ catch(const Ice::MemoryLimitException&)
+ {
+ test(false);
+ }
}
batch->ice_getConnection()->flushBatchRequests();
diff --git a/cpp/test/Ice/operations/Client.cpp b/cpp/test/Ice/operations/Client.cpp
index 7e7cceb914d..b421a629cf5 100644
--- a/cpp/test/Ice/operations/Client.cpp
+++ b/cpp/test/Ice/operations/Client.cpp
@@ -25,12 +25,12 @@ run(int argc, char* argv[],
myClass->shutdown();
try
{
- myClass->opVoid();
- test(false);
+ myClass->opVoid();
+ test(false);
}
catch(const Ice::LocalException&)
{
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
return EXIT_SUCCESS;
@@ -44,47 +44,47 @@ main(int argc, char* argv[])
try
{
- //
- // In this test, we need at least two threads in the
- // client side thread pool for nested AMI.
- //
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2");
- initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
+ //
+ // In this test, we need at least two threads in the
+ // client side thread pool for nested AMI.
+ //
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2");
+ initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- //
- // We must set MessageSizeMax to an explicit values, because
- // we run tests to check whether Ice.MemoryLimitException is
- // raised as expected.
- //
- initData.properties->setProperty("Ice.MessageSizeMax", "100");
+ //
+ // We must set MessageSizeMax to an explicit values, because
+ // we run tests to check whether Ice.MemoryLimitException is
+ // raised as expected.
+ //
+ initData.properties->setProperty("Ice.MessageSizeMax", "100");
- //
- // We don't want connection warnings because of the timeout test.
- //
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ //
+ // We don't want connection warnings because of the timeout test.
+ //
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator, initData);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator, initData);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp
index dda296e4cae..784cee66f14 100644
--- a/cpp/test/Ice/operations/Collocated.cpp
+++ b/cpp/test/Ice/operations/Collocated.cpp
@@ -37,28 +37,28 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator, initData);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator, initData);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp
index 9e4e511dad9..85979d7424f 100644
--- a/cpp/test/Ice/operations/Server.cpp
+++ b/cpp/test/Ice/operations/Server.cpp
@@ -34,30 +34,30 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/operations/ServerAMD.cpp b/cpp/test/Ice/operations/ServerAMD.cpp
index 251d5068424..0cac6d02a18 100644
--- a/cpp/test/Ice/operations/ServerAMD.cpp
+++ b/cpp/test/Ice/operations/ServerAMD.cpp
@@ -34,30 +34,30 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice
index d655feb0599..043060a5d93 100644
--- a/cpp/test/Ice/operations/Test.ice
+++ b/cpp/test/Ice/operations/Test.ice
@@ -75,75 +75,75 @@ dictionary<string, MyEnum> StringMyEnumD;
void opSleep(int duration);
byte opByte(byte p1, byte p2,
- out byte p3);
+ out byte p3);
bool opBool(bool p1, bool p2,
- out bool p3);
+ out bool p3);
long opShortIntLong(short p1, int p2, long p3,
- out short p4, out int p5, out long p6);
+ out short p4, out int p5, out long p6);
double opFloatDouble(float p1, double p2,
- out float p3, out double p4);
+ out float p3, out double p4);
string opString(string p1, string p2,
- out string p3);
+ out string p3);
MyEnum opMyEnum(MyEnum p1, out MyEnum p2);
MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3);
Structure opStruct(Structure p1, Structure p2,
- out Structure p3);
+ out Structure p3);
ByteS opByteS(ByteS p1, ByteS p2,
- out ByteS p3);
+ out ByteS p3);
BoolS opBoolS(BoolS p1, BoolS p2,
- out BoolS p3);
+ out BoolS p3);
LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3,
- out ::Test::ShortS p4, out IntS p5, out LongS p6);
+ out ::Test::ShortS p4, out IntS p5, out LongS p6);
DoubleS opFloatDoubleS(FloatS p1, DoubleS p2,
- out FloatS p3, out DoubleS p4);
+ out FloatS p3, out DoubleS p4);
StringS opStringS(StringS p1, StringS p2,
- out StringS p3);
+ out StringS p3);
ByteSS opByteSS(ByteSS p1, ByteSS p2,
- out ByteSS p3);
+ out ByteSS p3);
BoolSS opBoolSS(BoolSS p1, BoolSS p2,
- out BoolSS p3);
+ out BoolSS p3);
LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3,
- out ShortSS p4, out IntSS p5, out LongSS p6);
+ out ShortSS p4, out IntSS p5, out LongSS p6);
DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2,
- out FloatSS p3, out DoubleSS p4);
+ out FloatSS p3, out DoubleSS p4);
StringSS opStringSS(StringSS p1, StringSS p2,
- out StringSS p3);
+ out StringSS p3);
StringSSS opStringSSS(StringSSS p1, StringSSS p2,
- out StringSSS p3);
+ out StringSSS p3);
ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2,
- out ByteBoolD p3);
+ out ByteBoolD p3);
ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2,
- out ShortIntD p3);
+ out ShortIntD p3);
LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2,
- out LongFloatD p3);
+ out LongFloatD p3);
StringStringD opStringStringD(StringStringD p1, StringStringD p2,
- out StringStringD p3);
+ out StringStringD p3);
StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
- out StringMyEnumD p3);
+ out StringMyEnumD p3);
IntS opIntS(IntS s);
diff --git a/cpp/test/Ice/operations/TestAMD.ice b/cpp/test/Ice/operations/TestAMD.ice
index 1d58252d323..9bdc8c6fe3b 100644
--- a/cpp/test/Ice/operations/TestAMD.ice
+++ b/cpp/test/Ice/operations/TestAMD.ice
@@ -75,75 +75,75 @@ dictionary<string, MyEnum> StringMyEnumD;
void opSleep(int duration);
byte opByte(byte p1, byte p2,
- out byte p3);
+ out byte p3);
bool opBool(bool p1, bool p2,
- out bool p3);
+ out bool p3);
long opShortIntLong(short p1, int p2, long p3,
- out short p4, out int p5, out long p6);
+ out short p4, out int p5, out long p6);
double opFloatDouble(float p1, double p2,
- out float p3, out double p4);
+ out float p3, out double p4);
string opString(string p1, string p2,
- out string p3);
+ out string p3);
MyEnum opMyEnum(MyEnum p1, out MyEnum p2);
MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3);
Structure opStruct(Structure p1, Structure p2,
- out Structure p3);
+ out Structure p3);
ByteS opByteS(ByteS p1, ByteS p2,
- out ByteS p3);
+ out ByteS p3);
BoolS opBoolS(BoolS p1, BoolS p2,
- out BoolS p3);
+ out BoolS p3);
LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3,
- out ::Test::ShortS p4, out IntS p5, out LongS p6);
+ out ::Test::ShortS p4, out IntS p5, out LongS p6);
DoubleS opFloatDoubleS(FloatS p1, DoubleS p2,
- out FloatS p3, out DoubleS p4);
+ out FloatS p3, out DoubleS p4);
StringS opStringS(StringS p1, StringS p2,
- out StringS p3);
+ out StringS p3);
ByteSS opByteSS(ByteSS p1, ByteSS p2,
- out ByteSS p3);
+ out ByteSS p3);
BoolSS opBoolSS(BoolSS p1, BoolSS p2,
- out BoolSS p3);
+ out BoolSS p3);
LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3,
- out ShortSS p4, out IntSS p5, out LongSS p6);
+ out ShortSS p4, out IntSS p5, out LongSS p6);
DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2,
- out FloatSS p3, out DoubleSS p4);
+ out FloatSS p3, out DoubleSS p4);
StringSS opStringSS(StringSS p1, StringSS p2,
- out StringSS p3);
+ out StringSS p3);
StringSSS opStringSSS(StringSSS p1, StringSSS p2,
- out StringSSS p3);
+ out StringSSS p3);
ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2,
- out ByteBoolD p3);
+ out ByteBoolD p3);
ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2,
- out ShortIntD p3);
+ out ShortIntD p3);
LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2,
- out LongFloatD p3);
+ out LongFloatD p3);
StringStringD opStringStringD(StringStringD p1, StringStringD p2,
- out StringStringD p3);
+ out StringStringD p3);
StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
- out StringMyEnumD p3);
+ out StringMyEnumD p3);
IntS opIntS(IntS s);
diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp
index 48cb26beeed..028993f910a 100644
--- a/cpp/test/Ice/operations/TestAMDI.cpp
+++ b/cpp/test/Ice/operations/TestAMDI.cpp
@@ -20,13 +20,13 @@ class Thread_opVoid : public IceUtil::Thread
public:
Thread_opVoid(const Test::AMD_MyClass_opVoidPtr& cb) :
- _cb(cb)
+ _cb(cb)
{
}
virtual void run()
{
- _cb->ice_response();
+ _cb->ice_response();
}
private:
@@ -45,8 +45,8 @@ MyDerivedClassI::shutdown_async(const Test::AMD_MyClass_shutdownPtr& cb, const I
{
if(_opVoidThread)
{
- _opVoidThread->getThreadControl().join();
- _opVoidThread = 0;
+ _opVoidThread->getThreadControl().join();
+ _opVoidThread = 0;
}
_adapter->getCommunicator()->shutdown();
@@ -58,8 +58,8 @@ MyDerivedClassI::opVoid_async(const Test::AMD_MyClass_opVoidPtr& cb, const Ice::
{
if(_opVoidThread)
{
- _opVoidThread->getThreadControl().join();
- _opVoidThread = 0;
+ _opVoidThread->getThreadControl().join();
+ _opVoidThread = 0;
}
_opVoidThread = new Thread_opVoid(cb);
@@ -68,8 +68,8 @@ MyDerivedClassI::opVoid_async(const Test::AMD_MyClass_opVoidPtr& cb, const Ice::
void
MyDerivedClassI::opSleep_async(const Test::AMD_MyClass_opSleepPtr& cb,
- int duration,
- const Ice::Current&)
+ int duration,
+ const Ice::Current&)
{
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(duration));
cb->ice_response();
@@ -77,74 +77,74 @@ MyDerivedClassI::opSleep_async(const Test::AMD_MyClass_opSleepPtr& cb,
void
MyDerivedClassI::opByte_async(const Test::AMD_MyClass_opBytePtr& cb,
- Ice::Byte p1,
- Ice::Byte p2,
- const Ice::Current&)
+ Ice::Byte p1,
+ Ice::Byte p2,
+ const Ice::Current&)
{
cb->ice_response(p1, p1 ^ p2);
}
void
MyDerivedClassI::opBool_async(const Test::AMD_MyClass_opBoolPtr& cb,
- bool p1,
- bool p2,
- const Ice::Current&)
+ bool p1,
+ bool p2,
+ const Ice::Current&)
{
cb->ice_response(p2, p1);
}
void
MyDerivedClassI::opShortIntLong_async(const Test::AMD_MyClass_opShortIntLongPtr& cb,
- Ice::Short p1,
- Ice::Int p2,
- Ice::Long p3,
- const Ice::Current&)
+ Ice::Short p1,
+ Ice::Int p2,
+ Ice::Long p3,
+ const Ice::Current&)
{
cb->ice_response(p3, p1, p2, p3);
}
void
MyDerivedClassI::opFloatDouble_async(const Test::AMD_MyClass_opFloatDoublePtr& cb,
- Ice::Float p1,
- Ice::Double p2,
- const Ice::Current&)
+ Ice::Float p1,
+ Ice::Double p2,
+ const Ice::Current&)
{
cb->ice_response(p2, p1, p2);
}
void
MyDerivedClassI::opString_async(const Test::AMD_MyClass_opStringPtr& cb,
- const std::string& p1,
- const std::string& p2,
- const Ice::Current&)
+ const std::string& p1,
+ const std::string& p2,
+ const Ice::Current&)
{
cb->ice_response(p1 + " " + p2, p2 + " " + p1);
}
void
MyDerivedClassI::opMyEnum_async(const Test::AMD_MyClass_opMyEnumPtr& cb,
- Test::MyEnum p1,
- const Ice::Current&)
+ Test::MyEnum p1,
+ const Ice::Current&)
{
cb->ice_response(Test::enum3, p1);
}
void
MyDerivedClassI::opMyClass_async(const Test::AMD_MyClass_opMyClassPtr& cb,
- const Test::MyClassPrx& p1,
- const Ice::Current&)
+ const Test::MyClassPrx& p1,
+ const Ice::Current&)
{
Test::MyClassPrx p2 = p1;
Test::MyClassPrx p3 = Test::MyClassPrx::uncheckedCast(_adapter->createProxy(
- _adapter->getCommunicator()->stringToIdentity("noSuchIdentity")));
+ _adapter->getCommunicator()->stringToIdentity("noSuchIdentity")));
cb->ice_response(Test::MyClassPrx::uncheckedCast(_adapter->createProxy(_identity)), p2, p3);
}
void
MyDerivedClassI::opStruct_async(const Test::AMD_MyClass_opStructPtr& cb,
- const Test::Structure& p1,
- const Test::Structure& p2,
- const Ice::Current&)
+ const Test::Structure& p1,
+ const Test::Structure& p2,
+ const Ice::Current&)
{
Test::Structure p3 = p1;
p3.s.s = "a new string";
@@ -153,9 +153,9 @@ MyDerivedClassI::opStruct_async(const Test::AMD_MyClass_opStructPtr& cb,
void
MyDerivedClassI::opByteS_async(const Test::AMD_MyClass_opByteSPtr& cb,
- const Test::ByteS& p1,
- const Test::ByteS& p2,
- const Ice::Current&)
+ const Test::ByteS& p1,
+ const Test::ByteS& p2,
+ const Ice::Current&)
{
Test::ByteS p3;
p3.resize(p1.size());
@@ -167,9 +167,9 @@ MyDerivedClassI::opByteS_async(const Test::AMD_MyClass_opByteSPtr& cb,
void
MyDerivedClassI::opBoolS_async(const Test::AMD_MyClass_opBoolSPtr& cb,
- const Test::BoolS& p1,
- const Test::BoolS& p2,
- const Ice::Current&)
+ const Test::BoolS& p1,
+ const Test::BoolS& p2,
+ const Ice::Current&)
{
Test::BoolS p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -181,10 +181,10 @@ MyDerivedClassI::opBoolS_async(const Test::AMD_MyClass_opBoolSPtr& cb,
void
MyDerivedClassI::opShortIntLongS_async(const Test::AMD_MyClass_opShortIntLongSPtr& cb,
- const Test::ShortS& p1,
- const Test::IntS& p2,
- const Test::LongS& p3,
- const Ice::Current&)
+ const Test::ShortS& p1,
+ const Test::IntS& p2,
+ const Test::LongS& p3,
+ const Ice::Current&)
{
Test::ShortS p4 = p1;
Test::IntS p5;
@@ -197,9 +197,9 @@ MyDerivedClassI::opShortIntLongS_async(const Test::AMD_MyClass_opShortIntLongSPt
void
MyDerivedClassI::opFloatDoubleS_async(const Test::AMD_MyClass_opFloatDoubleSPtr& cb,
- const Test::FloatS& p1,
- const Test::DoubleS& p2,
- const Ice::Current&)
+ const Test::FloatS& p1,
+ const Test::DoubleS& p2,
+ const Ice::Current&)
{
Test::FloatS p3 = p1;
Test::DoubleS p4;
@@ -212,9 +212,9 @@ MyDerivedClassI::opFloatDoubleS_async(const Test::AMD_MyClass_opFloatDoubleSPtr&
void
MyDerivedClassI::opStringS_async(const Test::AMD_MyClass_opStringSPtr& cb,
- const Test::StringS& p1,
- const Test::StringS& p2,
- const Ice::Current&)
+ const Test::StringS& p1,
+ const Test::StringS& p2,
+ const Ice::Current&)
{
Test::StringS p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -226,9 +226,9 @@ MyDerivedClassI::opStringS_async(const Test::AMD_MyClass_opStringSPtr& cb,
void
MyDerivedClassI::opByteSS_async(const Test::AMD_MyClass_opByteSSPtr& cb,
- const Test::ByteSS& p1,
- const Test::ByteSS& p2,
- const Ice::Current&)
+ const Test::ByteSS& p1,
+ const Test::ByteSS& p2,
+ const Ice::Current&)
{
Test::ByteSS p3;
p3.resize(p1.size());
@@ -240,9 +240,9 @@ MyDerivedClassI::opByteSS_async(const Test::AMD_MyClass_opByteSSPtr& cb,
void
MyDerivedClassI::opBoolSS_async(const Test::AMD_MyClass_opBoolSSPtr& cb,
- const Test::BoolSS& p1,
- const Test::BoolSS& p2,
- const Ice::Current&)
+ const Test::BoolSS& p1,
+ const Test::BoolSS& p2,
+ const Ice::Current&)
{
Test::BoolSS p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -254,10 +254,10 @@ MyDerivedClassI::opBoolSS_async(const Test::AMD_MyClass_opBoolSSPtr& cb,
void
MyDerivedClassI::opShortIntLongSS_async(const Test::AMD_MyClass_opShortIntLongSSPtr& cb,
- const Test::ShortSS& p1,
- const Test::IntSS& p2,
- const Test::LongSS& p3,
- const Ice::Current&)
+ const Test::ShortSS& p1,
+ const Test::IntSS& p2,
+ const Test::LongSS& p3,
+ const Ice::Current&)
{
Test::ShortSS p4 = p1;
Test::IntSS p5;
@@ -270,9 +270,9 @@ MyDerivedClassI::opShortIntLongSS_async(const Test::AMD_MyClass_opShortIntLongSS
void
MyDerivedClassI::opFloatDoubleSS_async(const Test::AMD_MyClass_opFloatDoubleSSPtr& cb,
- const Test::FloatSS& p1,
- const Test::DoubleSS& p2,
- const Ice::Current&)
+ const Test::FloatSS& p1,
+ const Test::DoubleSS& p2,
+ const Ice::Current&)
{
Test::FloatSS p3 = p1;
Test::DoubleSS p4;
@@ -285,9 +285,9 @@ MyDerivedClassI::opFloatDoubleSS_async(const Test::AMD_MyClass_opFloatDoubleSSPt
void
MyDerivedClassI::opStringSS_async(const Test::AMD_MyClass_opStringSSPtr& cb,
- const Test::StringSS& p1,
- const Test::StringSS& p2,
- const Ice::Current&)
+ const Test::StringSS& p1,
+ const Test::StringSS& p2,
+ const Ice::Current&)
{
Test::StringSS p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -299,9 +299,9 @@ MyDerivedClassI::opStringSS_async(const Test::AMD_MyClass_opStringSSPtr& cb,
void
MyDerivedClassI::opStringSSS_async(const Test::AMD_MyClass_opStringSSSPtr& cb,
- const Test::StringSSS& p1,
- const Test::StringSSS& p2,
- const Ice::Current&)
+ const Test::StringSSS& p1,
+ const Test::StringSSS& p2,
+ const Ice::Current&)
{
Test::StringSSS p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -313,9 +313,9 @@ MyDerivedClassI::opStringSSS_async(const Test::AMD_MyClass_opStringSSSPtr& cb,
void
MyDerivedClassI::opByteBoolD_async(const Test::AMD_MyClass_opByteBoolDPtr& cb,
- const Test::ByteBoolD& p1,
- const Test::ByteBoolD& p2,
- const Ice::Current&)
+ const Test::ByteBoolD& p1,
+ const Test::ByteBoolD& p2,
+ const Ice::Current&)
{
Test::ByteBoolD p3 = p1;
Test::ByteBoolD r = p1;
@@ -325,9 +325,9 @@ MyDerivedClassI::opByteBoolD_async(const Test::AMD_MyClass_opByteBoolDPtr& cb,
void
MyDerivedClassI::opShortIntD_async(const Test::AMD_MyClass_opShortIntDPtr& cb,
- const Test::ShortIntD& p1,
- const Test::ShortIntD& p2,
- const Ice::Current&)
+ const Test::ShortIntD& p1,
+ const Test::ShortIntD& p2,
+ const Ice::Current&)
{
Test::ShortIntD p3 = p1;
Test::ShortIntD r = p1;
@@ -337,9 +337,9 @@ MyDerivedClassI::opShortIntD_async(const Test::AMD_MyClass_opShortIntDPtr& cb,
void
MyDerivedClassI::opLongFloatD_async(const Test::AMD_MyClass_opLongFloatDPtr& cb,
- const Test::LongFloatD& p1,
- const Test::LongFloatD& p2,
- const Ice::Current&)
+ const Test::LongFloatD& p1,
+ const Test::LongFloatD& p2,
+ const Ice::Current&)
{
Test::LongFloatD p3 = p1;
Test::LongFloatD r = p1;
@@ -349,9 +349,9 @@ MyDerivedClassI::opLongFloatD_async(const Test::AMD_MyClass_opLongFloatDPtr& cb,
void
MyDerivedClassI::opStringStringD_async(const Test::AMD_MyClass_opStringStringDPtr& cb,
- const Test::StringStringD& p1,
- const Test::StringStringD& p2,
- const Ice::Current&)
+ const Test::StringStringD& p1,
+ const Test::StringStringD& p2,
+ const Ice::Current&)
{
Test::StringStringD p3 = p1;
Test::StringStringD r = p1;
@@ -361,9 +361,9 @@ MyDerivedClassI::opStringStringD_async(const Test::AMD_MyClass_opStringStringDPt
void
MyDerivedClassI::opStringMyEnumD_async(const Test::AMD_MyClass_opStringMyEnumDPtr& cb,
- const Test::StringMyEnumD& p1,
- const Test::StringMyEnumD& p2,
- const Ice::Current&)
+ const Test::StringMyEnumD& p1,
+ const Test::StringMyEnumD& p2,
+ const Ice::Current&)
{
Test::StringMyEnumD p3 = p1;
Test::StringMyEnumD r = p1;
@@ -381,7 +381,7 @@ MyDerivedClassI::opIntS_async(const Test::AMD_MyClass_opIntSPtr& cb, const Test:
void
MyDerivedClassI::opByteSOneway_async(const Test::AMD_MyClass_opByteSOnewayPtr& cb, const Test::ByteS& s,
- const Ice::Current&)
+ const Ice::Current&)
{
cb->ice_response();
}
@@ -395,7 +395,7 @@ MyDerivedClassI::opContext_async(const Test::AMD_MyClass_opContextPtr& cb, const
void
MyDerivedClassI::opDoubleMarshaling_async(const Test::AMD_MyClass_opDoubleMarshalingPtr& cb,
- Ice::Double p1, const Test::DoubleS& p2, const Ice::Current&)
+ Ice::Double p1, const Test::DoubleS& p2, const Ice::Current&)
{
Ice::Double d = 1278312346.0 / 13.0;
test(p1 == d);
diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h
index 19c3313bfdb..87098048a1e 100644
--- a/cpp/test/Ice/operations/TestAMDI.h
+++ b/cpp/test/Ice/operations/TestAMDI.h
@@ -20,123 +20,123 @@ public:
MyDerivedClassI(const Ice::ObjectAdapterPtr&, const Ice::Identity&);
virtual void shutdown_async(const Test::AMD_MyClass_shutdownPtr&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void opVoid_async(const Test::AMD_MyClass_opVoidPtr&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void opSleep_async(const Test::AMD_MyClass_opSleepPtr&,
- int,
- const Ice::Current&);
+ int,
+ const Ice::Current&);
virtual void opByte_async(const Test::AMD_MyClass_opBytePtr&,
- Ice::Byte, Ice::Byte,
- const Ice::Current&);
+ Ice::Byte, Ice::Byte,
+ const Ice::Current&);
virtual void opBool_async(const Test::AMD_MyClass_opBoolPtr&,
- bool, bool,
- const Ice::Current&);
+ bool, bool,
+ const Ice::Current&);
virtual void opShortIntLong_async(const Test::AMD_MyClass_opShortIntLongPtr&,
- Ice::Short, Ice::Int, Ice::Long,
- const Ice::Current&);
+ Ice::Short, Ice::Int, Ice::Long,
+ const Ice::Current&);
virtual void opFloatDouble_async(const Test::AMD_MyClass_opFloatDoublePtr&,
- Ice::Float, Ice::Double,
- const Ice::Current&);
+ Ice::Float, Ice::Double,
+ const Ice::Current&);
virtual void opString_async(const Test::AMD_MyClass_opStringPtr&,
- const std::string&, const std::string&,
- const Ice::Current&);
+ const std::string&, const std::string&,
+ const Ice::Current&);
virtual void opMyEnum_async(const Test::AMD_MyClass_opMyEnumPtr&,
- Test::MyEnum,
- const Ice::Current&);
+ Test::MyEnum,
+ const Ice::Current&);
virtual void opMyClass_async(const Test::AMD_MyClass_opMyClassPtr&,
- const Test::MyClassPrx&,
- const Ice::Current&);
+ const Test::MyClassPrx&,
+ const Ice::Current&);
virtual void opStruct_async(const Test::AMD_MyClass_opStructPtr&,
- const Test::Structure&, const Test::Structure&,
- const Ice::Current&);
+ const Test::Structure&, const Test::Structure&,
+ const Ice::Current&);
virtual void opByteS_async(const Test::AMD_MyClass_opByteSPtr&,
- const Test::ByteS&, const Test::ByteS&,
- const Ice::Current&);
+ const Test::ByteS&, const Test::ByteS&,
+ const Ice::Current&);
virtual void opBoolS_async(const Test::AMD_MyClass_opBoolSPtr&,
- const Test::BoolS&, const Test::BoolS&,
- const Ice::Current&);
+ const Test::BoolS&, const Test::BoolS&,
+ const Ice::Current&);
virtual void opShortIntLongS_async(const Test::AMD_MyClass_opShortIntLongSPtr&,
- const Test::ShortS&, const Test::IntS&, const Test::LongS&,
- const Ice::Current&);
+ const Test::ShortS&, const Test::IntS&, const Test::LongS&,
+ const Ice::Current&);
virtual void opFloatDoubleS_async(const Test::AMD_MyClass_opFloatDoubleSPtr&,
- const Test::FloatS&, const Test::DoubleS&,
- const Ice::Current&);
+ const Test::FloatS&, const Test::DoubleS&,
+ const Ice::Current&);
virtual void opStringS_async(const Test::AMD_MyClass_opStringSPtr&,
- const Test::StringS&, const Test::StringS&,
- const Ice::Current&);
+ const Test::StringS&, const Test::StringS&,
+ const Ice::Current&);
virtual void opByteSS_async(const Test::AMD_MyClass_opByteSSPtr&,
- const Test::ByteSS&, const Test::ByteSS&,
- const Ice::Current&);
+ const Test::ByteSS&, const Test::ByteSS&,
+ const Ice::Current&);
virtual void opBoolSS_async(const Test::AMD_MyClass_opBoolSSPtr&,
- const Test::BoolSS&, const Test::BoolSS&,
- const Ice::Current&);
+ const Test::BoolSS&, const Test::BoolSS&,
+ const Ice::Current&);
virtual void opShortIntLongSS_async(const Test::AMD_MyClass_opShortIntLongSSPtr&,
- const Test::ShortSS&, const Test::IntSS&, const Test::LongSS&,
- const Ice::Current&);
+ const Test::ShortSS&, const Test::IntSS&, const Test::LongSS&,
+ const Ice::Current&);
virtual void opFloatDoubleSS_async(const Test::AMD_MyClass_opFloatDoubleSSPtr&,
- const Test::FloatSS&, const Test::DoubleSS&,
- const Ice::Current&);
+ const Test::FloatSS&, const Test::DoubleSS&,
+ const Ice::Current&);
virtual void opStringSS_async(const Test::AMD_MyClass_opStringSSPtr&,
- const Test::StringSS&, const Test::StringSS&,
- const Ice::Current&);
+ const Test::StringSS&, const Test::StringSS&,
+ const Ice::Current&);
virtual void opStringSSS_async(const Test::AMD_MyClass_opStringSSSPtr&,
- const Test::StringSSS&, const Test::StringSSS&,
- const Ice::Current&);
+ const Test::StringSSS&, const Test::StringSSS&,
+ const Ice::Current&);
virtual void opByteBoolD_async(const Test::AMD_MyClass_opByteBoolDPtr&,
- const Test::ByteBoolD&, const Test::ByteBoolD&,
- const Ice::Current&);
+ const Test::ByteBoolD&, const Test::ByteBoolD&,
+ const Ice::Current&);
virtual void opShortIntD_async(const Test::AMD_MyClass_opShortIntDPtr&,
- const Test::ShortIntD&, const Test::ShortIntD&,
- const Ice::Current&);
+ const Test::ShortIntD&, const Test::ShortIntD&,
+ const Ice::Current&);
virtual void opLongFloatD_async(const Test::AMD_MyClass_opLongFloatDPtr&,
- const Test::LongFloatD&, const Test::LongFloatD&,
- const Ice::Current&);
+ const Test::LongFloatD&, const Test::LongFloatD&,
+ const Ice::Current&);
virtual void opStringStringD_async(const Test::AMD_MyClass_opStringStringDPtr&,
- const Test::StringStringD&, const Test::StringStringD&,
- const Ice::Current&);
+ const Test::StringStringD&, const Test::StringStringD&,
+ const Ice::Current&);
virtual void opStringMyEnumD_async(const Test::AMD_MyClass_opStringMyEnumDPtr&,
- const Test::StringMyEnumD&, const Test::StringMyEnumD&,
- const Ice::Current&);
+ const Test::StringMyEnumD&, const Test::StringMyEnumD&,
+ const Ice::Current&);
virtual void opIntS_async(const Test::AMD_MyClass_opIntSPtr&, const Test::IntS&, const Ice::Current&);
virtual void opByteSOneway_async(const Test::AMD_MyClass_opByteSOnewayPtr&, const Test::ByteS&,
- const Ice::Current&);
+ const Ice::Current&);
virtual void opContext_async(const Test::AMD_MyClass_opContextPtr&, const Ice::Current&);
virtual void opDoubleMarshaling_async(const Test::AMD_MyClass_opDoubleMarshalingPtr&,
- Ice::Double, const Test::DoubleS&, const Ice::Current&);
+ Ice::Double, const Test::DoubleS&, const Ice::Current&);
virtual void opDerived_async(const Test::AMD_MyDerivedClass_opDerivedPtr&,
- const Ice::Current&);
+ const Ice::Current&);
private:
diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp
index 77b275b5ae7..e6415f93a87 100644
--- a/cpp/test/Ice/operations/TestI.cpp
+++ b/cpp/test/Ice/operations/TestI.cpp
@@ -41,9 +41,9 @@ MyDerivedClassI::opSleep(int duration, const Ice::Current&)
Ice::Byte
MyDerivedClassI::opByte(Ice::Byte p1,
- Ice::Byte p2,
- Ice::Byte& p3,
- const Ice::Current&)
+ Ice::Byte p2,
+ Ice::Byte& p3,
+ const Ice::Current&)
{
p3 = p1 ^ p2;
return p1;
@@ -51,9 +51,9 @@ MyDerivedClassI::opByte(Ice::Byte p1,
bool
MyDerivedClassI::opBool(bool p1,
- bool p2,
- bool& p3,
- const Ice::Current&)
+ bool p2,
+ bool& p3,
+ const Ice::Current&)
{
p3 = p1;
return p2;
@@ -61,12 +61,12 @@ MyDerivedClassI::opBool(bool p1,
Ice::Long
MyDerivedClassI::opShortIntLong(Ice::Short p1,
- Ice::Int p2,
- Ice::Long p3,
- Ice::Short& p4,
- Ice::Int& p5,
- Ice::Long& p6,
- const Ice::Current&)
+ Ice::Int p2,
+ Ice::Long p3,
+ Ice::Short& p4,
+ Ice::Int& p5,
+ Ice::Long& p6,
+ const Ice::Current&)
{
p4 = p1;
p5 = p2;
@@ -76,10 +76,10 @@ MyDerivedClassI::opShortIntLong(Ice::Short p1,
Ice::Double
MyDerivedClassI::opFloatDouble(Ice::Float p1,
- Ice::Double p2,
- Ice::Float& p3,
- Ice::Double& p4,
- const Ice::Current&)
+ Ice::Double p2,
+ Ice::Float& p3,
+ Ice::Double& p4,
+ const Ice::Current&)
{
p3 = p1;
p4 = p2;
@@ -88,9 +88,9 @@ MyDerivedClassI::opFloatDouble(Ice::Float p1,
std::string
MyDerivedClassI::opString(const std::string& p1,
- const std::string& p2,
- std::string& p3,
- const Ice::Current&)
+ const std::string& p2,
+ std::string& p3,
+ const Ice::Current&)
{
p3 = p2 + " " + p1;
return p1 + " " + p2;
@@ -98,8 +98,8 @@ MyDerivedClassI::opString(const std::string& p1,
Test::MyEnum
MyDerivedClassI::opMyEnum(Test::MyEnum p1,
- Test::MyEnum& p2,
- const Ice::Current&)
+ Test::MyEnum& p2,
+ const Ice::Current&)
{
p2 = p1;
return Test::enum3;
@@ -107,21 +107,21 @@ MyDerivedClassI::opMyEnum(Test::MyEnum p1,
Test::MyClassPrx
MyDerivedClassI::opMyClass(const Test::MyClassPrx& p1,
- Test::MyClassPrx& p2,
- Test::MyClassPrx& p3,
- const Ice::Current&)
+ Test::MyClassPrx& p2,
+ Test::MyClassPrx& p3,
+ const Ice::Current&)
{
p2 = p1;
p3 = Test::MyClassPrx::uncheckedCast(_adapter->createProxy(
- _adapter->getCommunicator()->stringToIdentity("noSuchIdentity")));
+ _adapter->getCommunicator()->stringToIdentity("noSuchIdentity")));
return Test::MyClassPrx::uncheckedCast(_adapter->createProxy(_identity));
}
Test::Structure
MyDerivedClassI::opStruct(const Test::Structure& p1,
- const ::Test::Structure& p2,
- ::Test::Structure& p3,
- const Ice::Current&)
+ const ::Test::Structure& p2,
+ ::Test::Structure& p3,
+ const Ice::Current&)
{
p3 = p1;
p3.s.s = "a new string";
@@ -130,9 +130,9 @@ MyDerivedClassI::opStruct(const Test::Structure& p1,
Test::ByteS
MyDerivedClassI::opByteS(const Test::ByteS& p1,
- const Test::ByteS& p2,
- Test::ByteS& p3,
- const Ice::Current&)
+ const Test::ByteS& p2,
+ Test::ByteS& p3,
+ const Ice::Current&)
{
p3.resize(p1.size());
std::reverse_copy(p1.begin(), p1.end(), p3.begin());
@@ -143,9 +143,9 @@ MyDerivedClassI::opByteS(const Test::ByteS& p1,
Test::BoolS
MyDerivedClassI::opBoolS(const Test::BoolS& p1,
- const Test::BoolS& p2,
- Test::BoolS& p3,
- const Ice::Current&)
+ const Test::BoolS& p2,
+ Test::BoolS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -157,12 +157,12 @@ MyDerivedClassI::opBoolS(const Test::BoolS& p1,
Test::LongS
MyDerivedClassI::opShortIntLongS(const Test::ShortS& p1,
- const Test::IntS& p2,
- const Test::LongS& p3,
- Test::ShortS& p4,
- Test::IntS& p5,
- Test::LongS& p6,
- const Ice::Current&)
+ const Test::IntS& p2,
+ const Test::LongS& p3,
+ Test::ShortS& p4,
+ Test::IntS& p5,
+ Test::LongS& p6,
+ const Ice::Current&)
{
p4 = p1;
p5.resize(p2.size());
@@ -174,10 +174,10 @@ MyDerivedClassI::opShortIntLongS(const Test::ShortS& p1,
Test::DoubleS
MyDerivedClassI::opFloatDoubleS(const Test::FloatS& p1,
- const Test::DoubleS& p2,
- Test::FloatS& p3,
- Test::DoubleS& p4,
- const Ice::Current&)
+ const Test::DoubleS& p2,
+ Test::FloatS& p3,
+ Test::DoubleS& p4,
+ const Ice::Current&)
{
p3 = p1;
p4.resize(p2.size());
@@ -189,9 +189,9 @@ MyDerivedClassI::opFloatDoubleS(const Test::FloatS& p1,
Test::StringS
MyDerivedClassI::opStringS(const Test::StringS& p1,
- const Test::StringS& p2,
- Test::StringS& p3,
- const Ice::Current&)
+ const Test::StringS& p2,
+ Test::StringS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -203,9 +203,9 @@ MyDerivedClassI::opStringS(const Test::StringS& p1,
Test::ByteSS
MyDerivedClassI::opByteSS(const Test::ByteSS& p1,
- const Test::ByteSS& p2,
- Test::ByteSS& p3,
- const Ice::Current&)
+ const Test::ByteSS& p2,
+ Test::ByteSS& p3,
+ const Ice::Current&)
{
p3.resize(p1.size());
std::reverse_copy(p1.begin(), p1.end(), p3.begin());
@@ -216,9 +216,9 @@ MyDerivedClassI::opByteSS(const Test::ByteSS& p1,
Test::BoolSS
MyDerivedClassI::opBoolSS(const Test::BoolSS& p1,
- const Test::BoolSS& p2,
- Test::BoolSS& p3,
- const Ice::Current&)
+ const Test::BoolSS& p2,
+ Test::BoolSS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -230,12 +230,12 @@ MyDerivedClassI::opBoolSS(const Test::BoolSS& p1,
Test::LongSS
MyDerivedClassI::opShortIntLongSS(const Test::ShortSS& p1,
- const Test::IntSS& p2,
- const Test::LongSS& p3,
- Test::ShortSS& p4,
- Test::IntSS& p5,
- Test::LongSS& p6,
- const Ice::Current&)
+ const Test::IntSS& p2,
+ const Test::LongSS& p3,
+ Test::ShortSS& p4,
+ Test::IntSS& p5,
+ Test::LongSS& p6,
+ const Ice::Current&)
{
p4 = p1;
p5.resize(p2.size());
@@ -247,10 +247,10 @@ MyDerivedClassI::opShortIntLongSS(const Test::ShortSS& p1,
Test::DoubleSS
MyDerivedClassI::opFloatDoubleSS(const Test::FloatSS& p1,
- const Test::DoubleSS& p2,
- Test::FloatSS& p3,
- Test::DoubleSS& p4,
- const Ice::Current&)
+ const Test::DoubleSS& p2,
+ Test::FloatSS& p3,
+ Test::DoubleSS& p4,
+ const Ice::Current&)
{
p3 = p1;
p4.resize(p2.size());
@@ -262,9 +262,9 @@ MyDerivedClassI::opFloatDoubleSS(const Test::FloatSS& p1,
Test::StringSS
MyDerivedClassI::opStringSS(const Test::StringSS& p1,
- const Test::StringSS& p2,
- Test::StringSS& p3,
- const Ice::Current&)
+ const Test::StringSS& p2,
+ Test::StringSS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -276,9 +276,9 @@ MyDerivedClassI::opStringSS(const Test::StringSS& p1,
Test::StringSSS
MyDerivedClassI::opStringSSS(const Test::StringSSS& p1,
- const Test::StringSSS& p2,
- Test::StringSSS& p3,
- const ::Ice::Current&)
+ const Test::StringSSS& p2,
+ Test::StringSSS& p3,
+ const ::Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -290,9 +290,9 @@ MyDerivedClassI::opStringSSS(const Test::StringSSS& p1,
Test::ByteBoolD
MyDerivedClassI::opByteBoolD(const Test::ByteBoolD& p1,
- const Test::ByteBoolD& p2,
- Test::ByteBoolD& p3,
- const Ice::Current&)
+ const Test::ByteBoolD& p2,
+ Test::ByteBoolD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::ByteBoolD r = p1;
@@ -302,9 +302,9 @@ MyDerivedClassI::opByteBoolD(const Test::ByteBoolD& p1,
Test::ShortIntD
MyDerivedClassI::opShortIntD(const Test::ShortIntD& p1,
- const Test::ShortIntD& p2,
- Test::ShortIntD& p3,
- const Ice::Current&)
+ const Test::ShortIntD& p2,
+ Test::ShortIntD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::ShortIntD r = p1;
@@ -314,9 +314,9 @@ MyDerivedClassI::opShortIntD(const Test::ShortIntD& p1,
Test::LongFloatD
MyDerivedClassI::opLongFloatD(const Test::LongFloatD& p1,
- const Test::LongFloatD& p2,
- Test::LongFloatD& p3,
- const Ice::Current&)
+ const Test::LongFloatD& p2,
+ Test::LongFloatD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::LongFloatD r = p1;
@@ -326,9 +326,9 @@ MyDerivedClassI::opLongFloatD(const Test::LongFloatD& p1,
Test::StringStringD
MyDerivedClassI::opStringStringD(const Test::StringStringD& p1,
- const Test::StringStringD& p2,
- Test::StringStringD& p3,
- const Ice::Current&)
+ const Test::StringStringD& p2,
+ Test::StringStringD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::StringStringD r = p1;
@@ -338,9 +338,9 @@ MyDerivedClassI::opStringStringD(const Test::StringStringD& p1,
Test::StringMyEnumD
MyDerivedClassI::opStringMyEnumD(const Test::StringMyEnumD& p1,
- const Test::StringMyEnumD& p2,
- Test::StringMyEnumD& p3,
- const Ice::Current&)
+ const Test::StringMyEnumD& p2,
+ Test::StringMyEnumD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::StringMyEnumD r = p1;
diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h
index 5a396df41e9..d5f8be15477 100644
--- a/cpp/test/Ice/operations/TestI.h
+++ b/cpp/test/Ice/operations/TestI.h
@@ -25,128 +25,128 @@ public:
virtual void opSleep(int, const Ice::Current&);
virtual Ice::Byte opByte(Ice::Byte,
- Ice::Byte,
- Ice::Byte&,
- const Ice::Current&);
+ Ice::Byte,
+ Ice::Byte&,
+ const Ice::Current&);
virtual bool opBool(bool,
- bool,
- bool&,
- const Ice::Current&);
+ bool,
+ bool&,
+ const Ice::Current&);
virtual Ice::Long opShortIntLong(Ice::Short,
- Ice::Int,
- Ice::Long,
- Ice::Short&,
- Ice::Int&,
- Ice::Long&,
- const Ice::Current&);
+ Ice::Int,
+ Ice::Long,
+ Ice::Short&,
+ Ice::Int&,
+ Ice::Long&,
+ const Ice::Current&);
virtual Ice::Double opFloatDouble(Ice::Float,
- Ice::Double,
- Ice::Float&,
- Ice::Double&,
- const Ice::Current&);
+ Ice::Double,
+ Ice::Float&,
+ Ice::Double&,
+ const Ice::Current&);
virtual std::string opString(const std::string&,
- const std::string&,
- std::string&,
- const Ice::Current&);
+ const std::string&,
+ std::string&,
+ const Ice::Current&);
virtual Test::MyEnum opMyEnum(Test::MyEnum,
- Test::MyEnum&,
- const Ice::Current&);
+ Test::MyEnum&,
+ const Ice::Current&);
virtual Test::MyClassPrx opMyClass(const Test::MyClassPrx&,
- Test::MyClassPrx&, Test::MyClassPrx&,
- const Ice::Current&);
+ Test::MyClassPrx&, Test::MyClassPrx&,
+ const Ice::Current&);
virtual Test::Structure opStruct(const Test::Structure&, const Test::Structure&,
- Test::Structure&,
- const Ice::Current&);
+ Test::Structure&,
+ const Ice::Current&);
virtual Test::ByteS opByteS(const Test::ByteS&,
- const Test::ByteS&,
- Test::ByteS&,
- const Ice::Current&);
+ const Test::ByteS&,
+ Test::ByteS&,
+ const Ice::Current&);
virtual Test::BoolS opBoolS(const Test::BoolS&,
- const Test::BoolS&,
- Test::BoolS&,
- const Ice::Current&);
+ const Test::BoolS&,
+ Test::BoolS&,
+ const Ice::Current&);
virtual Test::LongS opShortIntLongS(const Test::ShortS&,
- const Test::IntS&,
- const Test::LongS&,
- Test::ShortS&,
- Test::IntS&,
- Test::LongS&,
- const Ice::Current&);
+ const Test::IntS&,
+ const Test::LongS&,
+ Test::ShortS&,
+ Test::IntS&,
+ Test::LongS&,
+ const Ice::Current&);
virtual Test::DoubleS opFloatDoubleS(const Test::FloatS&,
- const Test::DoubleS&,
- Test::FloatS&,
- Test::DoubleS&,
- const Ice::Current&);
+ const Test::DoubleS&,
+ Test::FloatS&,
+ Test::DoubleS&,
+ const Ice::Current&);
virtual Test::StringS opStringS(const Test::StringS&,
- const Test::StringS&,
- Test::StringS&,
- const Ice::Current&);
+ const Test::StringS&,
+ Test::StringS&,
+ const Ice::Current&);
virtual Test::ByteSS opByteSS(const Test::ByteSS&,
- const Test::ByteSS&,
- Test::ByteSS&,
- const Ice::Current&);
+ const Test::ByteSS&,
+ Test::ByteSS&,
+ const Ice::Current&);
virtual Test::BoolSS opBoolSS(const Test::BoolSS&,
- const Test::BoolSS&,
- Test::BoolSS&,
- const Ice::Current&);
+ const Test::BoolSS&,
+ Test::BoolSS&,
+ const Ice::Current&);
virtual Test::LongSS opShortIntLongSS(const Test::ShortSS&,
- const Test::IntSS&,
- const Test::LongSS&,
- Test::ShortSS&,
- Test::IntSS&,
- Test::LongSS&,
- const Ice::Current&);
+ const Test::IntSS&,
+ const Test::LongSS&,
+ Test::ShortSS&,
+ Test::IntSS&,
+ Test::LongSS&,
+ const Ice::Current&);
virtual Test::DoubleSS opFloatDoubleSS(const Test::FloatSS&,
- const Test::DoubleSS&,
- Test::FloatSS&,
- Test::DoubleSS&,
- const Ice::Current&);
+ const Test::DoubleSS&,
+ Test::FloatSS&,
+ Test::DoubleSS&,
+ const Ice::Current&);
virtual Test::StringSS opStringSS(const Test::StringSS&,
- const Test::StringSS&,
- Test::StringSS&,
- const Ice::Current&);
+ const Test::StringSS&,
+ Test::StringSS&,
+ const Ice::Current&);
virtual Test::StringSSS opStringSSS(const Test::StringSSS&,
- const Test::StringSSS&,
- Test::StringSSS&,
- const ::Ice::Current&);
+ const Test::StringSSS&,
+ Test::StringSSS&,
+ const ::Ice::Current&);
virtual Test::ByteBoolD opByteBoolD(const Test::ByteBoolD&, const Test::ByteBoolD&,
- Test::ByteBoolD&,
- const Ice::Current&);
+ Test::ByteBoolD&,
+ const Ice::Current&);
virtual Test::ShortIntD opShortIntD(const Test::ShortIntD&, const Test::ShortIntD&,
- Test::ShortIntD&,
- const Ice::Current&);
+ Test::ShortIntD&,
+ const Ice::Current&);
virtual Test::LongFloatD opLongFloatD(const Test::LongFloatD&, const Test::LongFloatD&,
- Test::LongFloatD&,
- const Ice::Current&);
+ Test::LongFloatD&,
+ const Ice::Current&);
virtual Test::StringStringD opStringStringD(const Test::StringStringD&, const Test::StringStringD&,
- Test::StringStringD&,
- const Ice::Current&);
+ Test::StringStringD&,
+ const Ice::Current&);
virtual Test::StringMyEnumD opStringMyEnumD(const Test::StringMyEnumD&, const Test::StringMyEnumD&,
- Test::StringMyEnumD&,
- const Ice::Current&);
+ Test::StringMyEnumD&,
+ const Ice::Current&);
virtual Test::IntS opIntS(const Test::IntS&, const Ice::Current&);
diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp
index 107e198a5d6..27f7133b622 100644
--- a/cpp/test/Ice/operations/Twoways.cpp
+++ b/cpp/test/Ice/operations/Twoways.cpp
@@ -28,723 +28,723 @@ void
twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
{
{
- p->opVoid();
+ p->opVoid();
}
{
- Ice::Byte b;
- Ice::Byte r;
+ Ice::Byte b;
+ Ice::Byte r;
- r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b);
- test(b == Ice::Byte(0xf0));
- test(r == Ice::Byte(0xff));
+ r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b);
+ test(b == Ice::Byte(0xf0));
+ test(r == Ice::Byte(0xff));
}
{
- bool b;
- bool r;
+ bool b;
+ bool r;
- r = p->opBool(true, false, b);
- test(b);
- test(!r);
+ r = p->opBool(true, false, b);
+ test(b);
+ test(!r);
}
{
- Ice::Short s;
- Ice::Int i;
- Ice::Long l;
- Ice::Long r;
-
- r = p->opShortIntLong(10, 11, 12, s, i, l);
- test(s == 10);
- test(i == 11);
- test(l == 12);
- test(r == 12);
-
- r = p->opShortIntLong(numeric_limits<Ice::Short>::min(), numeric_limits<Ice::Int>::min(),
- numeric_limits<Ice::Long>::min(), s, i, l);
- test(s == numeric_limits<Ice::Short>::min());
- test(i == numeric_limits<Ice::Int>::min());
- test(l == numeric_limits<Ice::Long>::min());
- test(r == numeric_limits<Ice::Long>::min());
-
- r = p->opShortIntLong(numeric_limits<Ice::Short>::max(), numeric_limits<Ice::Int>::max(),
- numeric_limits<Ice::Long>::max(), s, i, l);
- test(s == numeric_limits<Ice::Short>::max());
- test(i == numeric_limits<Ice::Int>::max());
- test(l == numeric_limits<Ice::Long>::max());
- test(r == numeric_limits<Ice::Long>::max());
+ Ice::Short s;
+ Ice::Int i;
+ Ice::Long l;
+ Ice::Long r;
+
+ r = p->opShortIntLong(10, 11, 12, s, i, l);
+ test(s == 10);
+ test(i == 11);
+ test(l == 12);
+ test(r == 12);
+
+ r = p->opShortIntLong(numeric_limits<Ice::Short>::min(), numeric_limits<Ice::Int>::min(),
+ numeric_limits<Ice::Long>::min(), s, i, l);
+ test(s == numeric_limits<Ice::Short>::min());
+ test(i == numeric_limits<Ice::Int>::min());
+ test(l == numeric_limits<Ice::Long>::min());
+ test(r == numeric_limits<Ice::Long>::min());
+
+ r = p->opShortIntLong(numeric_limits<Ice::Short>::max(), numeric_limits<Ice::Int>::max(),
+ numeric_limits<Ice::Long>::max(), s, i, l);
+ test(s == numeric_limits<Ice::Short>::max());
+ test(i == numeric_limits<Ice::Int>::max());
+ test(l == numeric_limits<Ice::Long>::max());
+ test(r == numeric_limits<Ice::Long>::max());
}
{
- Ice::Float f;
- Ice::Double d;
- Ice::Double r;
-
- r = p->opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), f, d);
- test(f == Ice::Float(3.14));
- test(d == Ice::Double(1.1E10));
- test(r == Ice::Double(1.1E10));
-
- r = p->opFloatDouble(numeric_limits<Ice::Float>::min(), numeric_limits<Ice::Double>::min(), f, d);
- test(f == numeric_limits<Ice::Float>::min());
- test(d == numeric_limits<Ice::Double>::min());
- test(r == numeric_limits<Ice::Double>::min());
-
- r = p->opFloatDouble(numeric_limits<Ice::Float>::max(), numeric_limits<Ice::Double>::max(), f, d);
- test(f == numeric_limits<Ice::Float>::max());
- test(d == numeric_limits<Ice::Double>::max());
- test(r == numeric_limits<Ice::Double>::max());
+ Ice::Float f;
+ Ice::Double d;
+ Ice::Double r;
+
+ r = p->opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), f, d);
+ test(f == Ice::Float(3.14));
+ test(d == Ice::Double(1.1E10));
+ test(r == Ice::Double(1.1E10));
+
+ r = p->opFloatDouble(numeric_limits<Ice::Float>::min(), numeric_limits<Ice::Double>::min(), f, d);
+ test(f == numeric_limits<Ice::Float>::min());
+ test(d == numeric_limits<Ice::Double>::min());
+ test(r == numeric_limits<Ice::Double>::min());
+
+ r = p->opFloatDouble(numeric_limits<Ice::Float>::max(), numeric_limits<Ice::Double>::max(), f, d);
+ test(f == numeric_limits<Ice::Float>::max());
+ test(d == numeric_limits<Ice::Double>::max());
+ test(r == numeric_limits<Ice::Double>::max());
}
{
- string s;
- string r;
+ string s;
+ string r;
- r = p->opString("hello", "world", s);
- test(s == "world hello");
- test(r == "hello world");
+ r = p->opString("hello", "world", s);
+ test(s == "world hello");
+ test(r == "hello world");
}
{
- Test::MyEnum e;
- Test::MyEnum r;
-
- r = p->opMyEnum(Test::enum2, e);
- test(e == Test::enum2);
- test(r == Test::enum3);
+ Test::MyEnum e;
+ Test::MyEnum r;
+
+ r = p->opMyEnum(Test::enum2, e);
+ test(e == Test::enum2);
+ test(r == Test::enum3);
}
{
- Test::MyClassPrx c1;
- Test::MyClassPrx c2;
- Test::MyClassPrx r;
-
- r = p->opMyClass(p, c1, c2);
- test(Ice::proxyIdentityAndFacetEqual(c1, p));
- test(!Ice::proxyIdentityAndFacetEqual(c2, p));
- test(Ice::proxyIdentityAndFacetEqual(r, p));
- test(c1->ice_getIdentity() == communicator->stringToIdentity("test"));
- test(c2->ice_getIdentity() == communicator->stringToIdentity("noSuchIdentity"));
- test(r->ice_getIdentity() == communicator->stringToIdentity("test"));
- r->opVoid();
- c1->opVoid();
- try
- {
- c2->opVoid();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- r = p->opMyClass(0, c1, c2);
- test(c1 == 0);
- test(c2 != 0);
- test(Ice::proxyIdentityAndFacetEqual(r, p));
- r->opVoid();
+ Test::MyClassPrx c1;
+ Test::MyClassPrx c2;
+ Test::MyClassPrx r;
+
+ r = p->opMyClass(p, c1, c2);
+ test(Ice::proxyIdentityAndFacetEqual(c1, p));
+ test(!Ice::proxyIdentityAndFacetEqual(c2, p));
+ test(Ice::proxyIdentityAndFacetEqual(r, p));
+ test(c1->ice_getIdentity() == communicator->stringToIdentity("test"));
+ test(c2->ice_getIdentity() == communicator->stringToIdentity("noSuchIdentity"));
+ test(r->ice_getIdentity() == communicator->stringToIdentity("test"));
+ r->opVoid();
+ c1->opVoid();
+ try
+ {
+ c2->opVoid();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ r = p->opMyClass(0, c1, c2);
+ test(c1 == 0);
+ test(c2 != 0);
+ test(Ice::proxyIdentityAndFacetEqual(r, p));
+ r->opVoid();
}
{
- Test::Structure si1;
- si1.p = p;
- si1.e = Test::enum3;
- si1.s.s = "abc";
- Test::Structure si2;
- si2.p = 0;
- si2.e = Test::enum2;
- si2.s.s = "def";
-
- Test::Structure so;
- Test::Structure rso = p->opStruct(si1, si2, so);
- test(rso.p == 0);
- test(rso.e == Test::enum2);
- test(rso.s.s == "def");
- test(so.p == p);
- test(so.e == Test::enum3);
- test(so.s.s == "a new string");
- so.p->opVoid();
+ Test::Structure si1;
+ si1.p = p;
+ si1.e = Test::enum3;
+ si1.s.s = "abc";
+ Test::Structure si2;
+ si2.p = 0;
+ si2.e = Test::enum2;
+ si2.s.s = "def";
+
+ Test::Structure so;
+ Test::Structure rso = p->opStruct(si1, si2, so);
+ test(rso.p == 0);
+ test(rso.e == Test::enum2);
+ test(rso.s.s == "def");
+ test(so.p == p);
+ test(so.e == Test::enum3);
+ test(so.s.s == "a new string");
+ so.p->opVoid();
}
{
- Test::ByteS bsi1;
- Test::ByteS bsi2;
-
- bsi1.push_back(Ice::Byte(0x01));
- bsi1.push_back(Ice::Byte(0x11));
- bsi1.push_back(Ice::Byte(0x12));
- bsi1.push_back(Ice::Byte(0x22));
-
- bsi2.push_back(Ice::Byte(0xf1));
- bsi2.push_back(Ice::Byte(0xf2));
- bsi2.push_back(Ice::Byte(0xf3));
- bsi2.push_back(Ice::Byte(0xf4));
-
- Test::ByteS bso;
- Test::ByteS rso;
-
- rso = p->opByteS(bsi1, bsi2, bso);
- test(bso.size() == 4);
- test(bso[0] == Ice::Byte(0x22));
- test(bso[1] == Ice::Byte(0x12));
- test(bso[2] == Ice::Byte(0x11));
- test(bso[3] == Ice::Byte(0x01));
- test(rso.size() == 8);
- test(rso[0] == Ice::Byte(0x01));
- test(rso[1] == Ice::Byte(0x11));
- test(rso[2] == Ice::Byte(0x12));
- test(rso[3] == Ice::Byte(0x22));
- test(rso[4] == Ice::Byte(0xf1));
- test(rso[5] == Ice::Byte(0xf2));
- test(rso[6] == Ice::Byte(0xf3));
- test(rso[7] == Ice::Byte(0xf4));
+ Test::ByteS bsi1;
+ Test::ByteS bsi2;
+
+ bsi1.push_back(Ice::Byte(0x01));
+ bsi1.push_back(Ice::Byte(0x11));
+ bsi1.push_back(Ice::Byte(0x12));
+ bsi1.push_back(Ice::Byte(0x22));
+
+ bsi2.push_back(Ice::Byte(0xf1));
+ bsi2.push_back(Ice::Byte(0xf2));
+ bsi2.push_back(Ice::Byte(0xf3));
+ bsi2.push_back(Ice::Byte(0xf4));
+
+ Test::ByteS bso;
+ Test::ByteS rso;
+
+ rso = p->opByteS(bsi1, bsi2, bso);
+ test(bso.size() == 4);
+ test(bso[0] == Ice::Byte(0x22));
+ test(bso[1] == Ice::Byte(0x12));
+ test(bso[2] == Ice::Byte(0x11));
+ test(bso[3] == Ice::Byte(0x01));
+ test(rso.size() == 8);
+ test(rso[0] == Ice::Byte(0x01));
+ test(rso[1] == Ice::Byte(0x11));
+ test(rso[2] == Ice::Byte(0x12));
+ test(rso[3] == Ice::Byte(0x22));
+ test(rso[4] == Ice::Byte(0xf1));
+ test(rso[5] == Ice::Byte(0xf2));
+ test(rso[6] == Ice::Byte(0xf3));
+ test(rso[7] == Ice::Byte(0xf4));
}
{
- Test::BoolS bsi1;
- Test::BoolS bsi2;
-
- bsi1.push_back(true);
- bsi1.push_back(true);
- bsi1.push_back(false);
-
- bsi2.push_back(false);
-
- Test::BoolS bso;
- Test::BoolS rso;
-
- rso = p->opBoolS(bsi1, bsi2, bso);
- test(bso.size() == 4);
- test(bso[0]);
- test(bso[1]);
- test(!bso[2]);
- test(!bso[3]);
- test(rso.size() == 3);
- test(!rso[0]);
- test(rso[1]);
- test(rso[2]);
+ Test::BoolS bsi1;
+ Test::BoolS bsi2;
+
+ bsi1.push_back(true);
+ bsi1.push_back(true);
+ bsi1.push_back(false);
+
+ bsi2.push_back(false);
+
+ Test::BoolS bso;
+ Test::BoolS rso;
+
+ rso = p->opBoolS(bsi1, bsi2, bso);
+ test(bso.size() == 4);
+ test(bso[0]);
+ test(bso[1]);
+ test(!bso[2]);
+ test(!bso[3]);
+ test(rso.size() == 3);
+ test(!rso[0]);
+ test(rso[1]);
+ test(rso[2]);
}
{
- Test::ShortS ssi;
- Test::IntS isi;
- Test::LongS lsi;
-
- ssi.push_back(1);
- ssi.push_back(2);
- ssi.push_back(3);
-
- isi.push_back(5);
- isi.push_back(6);
- isi.push_back(7);
- isi.push_back(8);
-
- lsi.push_back(10);
- lsi.push_back(30);
- lsi.push_back(20);
-
- Test::ShortS sso;
- Test::IntS iso;
- Test::LongS lso;
- Test::LongS rso;
-
- rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso);
- test(sso.size() == 3);
- test(sso[0] == 1);
- test(sso[1] == 2);
- test(sso[2] == 3);
- test(iso.size() == 4);
- test(iso[0] == 8);
- test(iso[1] == 7);
- test(iso[2] == 6);
- test(iso[3] == 5);
- test(lso.size() == 6);
- test(lso[0] == 10);
- test(lso[1] == 30);
- test(lso[2] == 20);
- test(lso[3] == 10);
- test(lso[4] == 30);
- test(lso[5] == 20);
- test(rso.size() == 3);
- test(rso[0] == 10);
- test(rso[1] == 30);
- test(rso[2] == 20);
+ Test::ShortS ssi;
+ Test::IntS isi;
+ Test::LongS lsi;
+
+ ssi.push_back(1);
+ ssi.push_back(2);
+ ssi.push_back(3);
+
+ isi.push_back(5);
+ isi.push_back(6);
+ isi.push_back(7);
+ isi.push_back(8);
+
+ lsi.push_back(10);
+ lsi.push_back(30);
+ lsi.push_back(20);
+
+ Test::ShortS sso;
+ Test::IntS iso;
+ Test::LongS lso;
+ Test::LongS rso;
+
+ rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso);
+ test(sso.size() == 3);
+ test(sso[0] == 1);
+ test(sso[1] == 2);
+ test(sso[2] == 3);
+ test(iso.size() == 4);
+ test(iso[0] == 8);
+ test(iso[1] == 7);
+ test(iso[2] == 6);
+ test(iso[3] == 5);
+ test(lso.size() == 6);
+ test(lso[0] == 10);
+ test(lso[1] == 30);
+ test(lso[2] == 20);
+ test(lso[3] == 10);
+ test(lso[4] == 30);
+ test(lso[5] == 20);
+ test(rso.size() == 3);
+ test(rso[0] == 10);
+ test(rso[1] == 30);
+ test(rso[2] == 20);
}
{
- Test::FloatS fsi;
- Test::DoubleS dsi;
-
- fsi.push_back(Ice::Float(3.14));
- fsi.push_back(Ice::Float(1.11));
-
- dsi.push_back(Ice::Double(1.1E10));
- dsi.push_back(Ice::Double(1.2E10));
- dsi.push_back(Ice::Double(1.3E10));
-
- Test::FloatS fso;
- Test::DoubleS dso;
- Test::DoubleS rso;
-
- rso = p->opFloatDoubleS(fsi, dsi, fso, dso);
- test(fso.size() == 2);
- test(fso[0] == ::Ice::Float(3.14));
- test(fso[1] == ::Ice::Float(1.11));
- test(dso.size() == 3);
- test(dso[0] == ::Ice::Double(1.3E10));
- test(dso[1] == ::Ice::Double(1.2E10));
- test(dso[2] == ::Ice::Double(1.1E10));
- test(rso.size() == 5);
- test(rso[0] == ::Ice::Double(1.1E10));
- test(rso[1] == ::Ice::Double(1.2E10));
- test(rso[2] == ::Ice::Double(1.3E10));
- test(::Ice::Float(rso[3]) == ::Ice::Float(3.14));
- test(::Ice::Float(rso[4]) == ::Ice::Float(1.11));
+ Test::FloatS fsi;
+ Test::DoubleS dsi;
+
+ fsi.push_back(Ice::Float(3.14));
+ fsi.push_back(Ice::Float(1.11));
+
+ dsi.push_back(Ice::Double(1.1E10));
+ dsi.push_back(Ice::Double(1.2E10));
+ dsi.push_back(Ice::Double(1.3E10));
+
+ Test::FloatS fso;
+ Test::DoubleS dso;
+ Test::DoubleS rso;
+
+ rso = p->opFloatDoubleS(fsi, dsi, fso, dso);
+ test(fso.size() == 2);
+ test(fso[0] == ::Ice::Float(3.14));
+ test(fso[1] == ::Ice::Float(1.11));
+ test(dso.size() == 3);
+ test(dso[0] == ::Ice::Double(1.3E10));
+ test(dso[1] == ::Ice::Double(1.2E10));
+ test(dso[2] == ::Ice::Double(1.1E10));
+ test(rso.size() == 5);
+ test(rso[0] == ::Ice::Double(1.1E10));
+ test(rso[1] == ::Ice::Double(1.2E10));
+ test(rso[2] == ::Ice::Double(1.3E10));
+ test(::Ice::Float(rso[3]) == ::Ice::Float(3.14));
+ test(::Ice::Float(rso[4]) == ::Ice::Float(1.11));
}
{
- Test::StringS ssi1;
- Test::StringS ssi2;
-
- ssi1.push_back("abc");
- ssi1.push_back("de");
- ssi1.push_back("fghi");
-
- ssi2.push_back("xyz");
-
- Test::StringS sso;
- Test::StringS rso;
-
- rso = p->opStringS(ssi1, ssi2, sso);
- test(sso.size() == 4);
- test(sso[0] == "abc");
- test(sso[1] == "de");
- test(sso[2] == "fghi");
- test(sso[3] == "xyz");
- test(rso.size() == 3);
- test(rso[0] == "fghi");
- test(rso[1] == "de");
- test(rso[2] == "abc");
+ Test::StringS ssi1;
+ Test::StringS ssi2;
+
+ ssi1.push_back("abc");
+ ssi1.push_back("de");
+ ssi1.push_back("fghi");
+
+ ssi2.push_back("xyz");
+
+ Test::StringS sso;
+ Test::StringS rso;
+
+ rso = p->opStringS(ssi1, ssi2, sso);
+ test(sso.size() == 4);
+ test(sso[0] == "abc");
+ test(sso[1] == "de");
+ test(sso[2] == "fghi");
+ test(sso[3] == "xyz");
+ test(rso.size() == 3);
+ test(rso[0] == "fghi");
+ test(rso[1] == "de");
+ test(rso[2] == "abc");
}
{
- Test::ByteSS bsi1;
- bsi1.resize(2);
- Test::ByteSS bsi2;
- bsi2.resize(2);
-
- bsi1[0].push_back(Ice::Byte(0x01));
- bsi1[0].push_back(Ice::Byte(0x11));
- bsi1[0].push_back(Ice::Byte(0x12));
- bsi1[1].push_back(Ice::Byte(0xff));
-
- bsi2[0].push_back(Ice::Byte(0x0e));
- bsi2[1].push_back(Ice::Byte(0xf2));
- bsi2[1].push_back(Ice::Byte(0xf1));
-
- Test::ByteSS bso;
- Test::ByteSS rso;
-
- rso = p->opByteSS(bsi1, bsi2, bso);
- test(bso.size() == 2);
- test(bso[0].size() == 1);
- test(bso[0][0] == Ice::Byte(0xff));
- test(bso[1].size() == 3);
- test(bso[1][0] == Ice::Byte(0x01));
- test(bso[1][1] == Ice::Byte(0x11));
- test(bso[1][2] == Ice::Byte(0x12));
- test(rso.size() == 4);
- test(rso[0].size() == 3);
- test(rso[0][0] == Ice::Byte(0x01));
- test(rso[0][1] == Ice::Byte(0x11));
- test(rso[0][2] == Ice::Byte(0x12));
- test(rso[1].size() == 1);
- test(rso[1][0] == Ice::Byte(0xff));
- test(rso[2].size() == 1);
- test(rso[2][0] == Ice::Byte(0x0e));
- test(rso[3].size() == 2);
- test(rso[3][0] == Ice::Byte(0xf2));
- test(rso[3][1] == Ice::Byte(0xf1));
+ Test::ByteSS bsi1;
+ bsi1.resize(2);
+ Test::ByteSS bsi2;
+ bsi2.resize(2);
+
+ bsi1[0].push_back(Ice::Byte(0x01));
+ bsi1[0].push_back(Ice::Byte(0x11));
+ bsi1[0].push_back(Ice::Byte(0x12));
+ bsi1[1].push_back(Ice::Byte(0xff));
+
+ bsi2[0].push_back(Ice::Byte(0x0e));
+ bsi2[1].push_back(Ice::Byte(0xf2));
+ bsi2[1].push_back(Ice::Byte(0xf1));
+
+ Test::ByteSS bso;
+ Test::ByteSS rso;
+
+ rso = p->opByteSS(bsi1, bsi2, bso);
+ test(bso.size() == 2);
+ test(bso[0].size() == 1);
+ test(bso[0][0] == Ice::Byte(0xff));
+ test(bso[1].size() == 3);
+ test(bso[1][0] == Ice::Byte(0x01));
+ test(bso[1][1] == Ice::Byte(0x11));
+ test(bso[1][2] == Ice::Byte(0x12));
+ test(rso.size() == 4);
+ test(rso[0].size() == 3);
+ test(rso[0][0] == Ice::Byte(0x01));
+ test(rso[0][1] == Ice::Byte(0x11));
+ test(rso[0][2] == Ice::Byte(0x12));
+ test(rso[1].size() == 1);
+ test(rso[1][0] == Ice::Byte(0xff));
+ test(rso[2].size() == 1);
+ test(rso[2][0] == Ice::Byte(0x0e));
+ test(rso[3].size() == 2);
+ test(rso[3][0] == Ice::Byte(0xf2));
+ test(rso[3][1] == Ice::Byte(0xf1));
}
{
- Test::FloatSS fsi;
- fsi.resize(3);
- Test::DoubleSS dsi;
- dsi.resize(1);
-
- fsi[0].push_back(Ice::Float(3.14));
- fsi[1].push_back(Ice::Float(1.11));
-
- dsi[0].push_back(Ice::Double(1.1E10));
- dsi[0].push_back(Ice::Double(1.2E10));
- dsi[0].push_back(Ice::Double(1.3E10));
-
- Test::FloatSS fso;
- Test::DoubleSS dso;
- Test::DoubleSS rso;
-
- rso = p->opFloatDoubleSS(fsi, dsi, fso, dso);
- test(fso.size() == 3);
- test(fso[0].size() == 1);
- test(fso[0][0] == ::Ice::Float(3.14));
- test(fso[1].size() == 1);
- test(fso[1][0] == ::Ice::Float(1.11));
- test(fso[2].size() == 0);
- test(dso.size() == 1);
- test(dso[0].size() == 3);
- test(dso[0][0] == ::Ice::Double(1.1E10));
- test(dso[0][1] == ::Ice::Double(1.2E10));
- test(dso[0][2] == ::Ice::Double(1.3E10));
- test(rso.size() == 2);
- test(rso[0].size() == 3);
- test(rso[0][0] == ::Ice::Double(1.1E10));
- test(rso[0][1] == ::Ice::Double(1.2E10));
- test(rso[0][2] == ::Ice::Double(1.3E10));
- test(rso[1].size() == 3);
- test(rso[1][0] == ::Ice::Double(1.1E10));
- test(rso[1][1] == ::Ice::Double(1.2E10));
- test(rso[1][2] == ::Ice::Double(1.3E10));
+ Test::FloatSS fsi;
+ fsi.resize(3);
+ Test::DoubleSS dsi;
+ dsi.resize(1);
+
+ fsi[0].push_back(Ice::Float(3.14));
+ fsi[1].push_back(Ice::Float(1.11));
+
+ dsi[0].push_back(Ice::Double(1.1E10));
+ dsi[0].push_back(Ice::Double(1.2E10));
+ dsi[0].push_back(Ice::Double(1.3E10));
+
+ Test::FloatSS fso;
+ Test::DoubleSS dso;
+ Test::DoubleSS rso;
+
+ rso = p->opFloatDoubleSS(fsi, dsi, fso, dso);
+ test(fso.size() == 3);
+ test(fso[0].size() == 1);
+ test(fso[0][0] == ::Ice::Float(3.14));
+ test(fso[1].size() == 1);
+ test(fso[1][0] == ::Ice::Float(1.11));
+ test(fso[2].size() == 0);
+ test(dso.size() == 1);
+ test(dso[0].size() == 3);
+ test(dso[0][0] == ::Ice::Double(1.1E10));
+ test(dso[0][1] == ::Ice::Double(1.2E10));
+ test(dso[0][2] == ::Ice::Double(1.3E10));
+ test(rso.size() == 2);
+ test(rso[0].size() == 3);
+ test(rso[0][0] == ::Ice::Double(1.1E10));
+ test(rso[0][1] == ::Ice::Double(1.2E10));
+ test(rso[0][2] == ::Ice::Double(1.3E10));
+ test(rso[1].size() == 3);
+ test(rso[1][0] == ::Ice::Double(1.1E10));
+ test(rso[1][1] == ::Ice::Double(1.2E10));
+ test(rso[1][2] == ::Ice::Double(1.3E10));
}
{
- Test::StringSS ssi1;
- ssi1.resize(2);
- Test::StringSS ssi2;
- ssi2.resize(3);
-
- ssi1[0].push_back("abc");
- ssi1[1].push_back("de");
- ssi1[1].push_back("fghi");
-
- ssi2[2].push_back("xyz");
-
- Test::StringSS sso;
- Test::StringSS rso;
-
- rso = p->opStringSS(ssi1, ssi2, sso);
- test(sso.size() == 5);
- test(sso[0].size() == 1);
- test(sso[0][0] == "abc");
- test(sso[1].size() == 2);
- test(sso[1][0] == "de");
- test(sso[1][1] == "fghi");
- test(sso[2].size() == 0);
- test(sso[3].size() == 0);
- test(sso[4].size() == 1);
- test(sso[4][0] == "xyz");
- test(rso.size() == 3);
- test(rso[0].size() == 1);
- test(rso[0][0] == "xyz");
- test(rso[1].size() == 0);
- test(rso[2].size() == 0);
+ Test::StringSS ssi1;
+ ssi1.resize(2);
+ Test::StringSS ssi2;
+ ssi2.resize(3);
+
+ ssi1[0].push_back("abc");
+ ssi1[1].push_back("de");
+ ssi1[1].push_back("fghi");
+
+ ssi2[2].push_back("xyz");
+
+ Test::StringSS sso;
+ Test::StringSS rso;
+
+ rso = p->opStringSS(ssi1, ssi2, sso);
+ test(sso.size() == 5);
+ test(sso[0].size() == 1);
+ test(sso[0][0] == "abc");
+ test(sso[1].size() == 2);
+ test(sso[1][0] == "de");
+ test(sso[1][1] == "fghi");
+ test(sso[2].size() == 0);
+ test(sso[3].size() == 0);
+ test(sso[4].size() == 1);
+ test(sso[4][0] == "xyz");
+ test(rso.size() == 3);
+ test(rso[0].size() == 1);
+ test(rso[0][0] == "xyz");
+ test(rso[1].size() == 0);
+ test(rso[2].size() == 0);
}
{
- Test::StringSSS sssi1;
- sssi1.resize(2);
- sssi1[0].resize(2);
- sssi1[0][0].push_back("abc");
- sssi1[0][0].push_back("de");
- sssi1[0][1].push_back("xyz");
- sssi1[1].resize(1);
- sssi1[1][0].push_back("hello");
-
- Test::StringSSS sssi2;
- sssi2.resize(3);
- sssi2[0].resize(2);
- sssi2[0][0].push_back("");
- sssi2[0][0].push_back("");
- sssi2[0][1].push_back("abcd");
- sssi2[1].resize(1);
- sssi2[1][0].push_back("");
-
- Test::StringSSS ssso;
- Test::StringSSS rsso;
-
- rsso = p->opStringSSS(sssi1, sssi2, ssso);
- test(ssso.size() == 5);
- test(ssso[0].size() == 2);
- test(ssso[0][0].size() == 2);
- test(ssso[0][1].size() == 1);
- test(ssso[1].size() == 1);
- test(ssso[1][0].size() == 1);
- test(ssso[2].size() == 2);
- test(ssso[2][0].size() == 2);
- test(ssso[2][1].size() == 1);
- test(ssso[3].size() == 1);
- test(ssso[3][0].size() == 1);
- test(ssso[4].size() == 0);
- test(ssso[0][0][0] == "abc");
- test(ssso[0][0][1] == "de");
- test(ssso[0][1][0] == "xyz");
- test(ssso[1][0][0] == "hello");
- test(ssso[2][0][0] == "");
- test(ssso[2][0][1] == "");
- test(ssso[2][1][0] == "abcd");
- test(ssso[3][0][0] == "");
-
- test(rsso.size() == 3);
- test(rsso[0].size() == 0);
- test(rsso[1].size() == 1);
- test(rsso[1][0].size() == 1);
- test(rsso[2].size() == 2);
- test(rsso[2][0].size() == 2);
- test(rsso[2][1].size() == 1);
- test(rsso[1][0][0] == "");
- test(rsso[2][0][0] == "");
- test(rsso[2][0][1] == "");
- test(rsso[2][1][0] == "abcd");
+ Test::StringSSS sssi1;
+ sssi1.resize(2);
+ sssi1[0].resize(2);
+ sssi1[0][0].push_back("abc");
+ sssi1[0][0].push_back("de");
+ sssi1[0][1].push_back("xyz");
+ sssi1[1].resize(1);
+ sssi1[1][0].push_back("hello");
+
+ Test::StringSSS sssi2;
+ sssi2.resize(3);
+ sssi2[0].resize(2);
+ sssi2[0][0].push_back("");
+ sssi2[0][0].push_back("");
+ sssi2[0][1].push_back("abcd");
+ sssi2[1].resize(1);
+ sssi2[1][0].push_back("");
+
+ Test::StringSSS ssso;
+ Test::StringSSS rsso;
+
+ rsso = p->opStringSSS(sssi1, sssi2, ssso);
+ test(ssso.size() == 5);
+ test(ssso[0].size() == 2);
+ test(ssso[0][0].size() == 2);
+ test(ssso[0][1].size() == 1);
+ test(ssso[1].size() == 1);
+ test(ssso[1][0].size() == 1);
+ test(ssso[2].size() == 2);
+ test(ssso[2][0].size() == 2);
+ test(ssso[2][1].size() == 1);
+ test(ssso[3].size() == 1);
+ test(ssso[3][0].size() == 1);
+ test(ssso[4].size() == 0);
+ test(ssso[0][0][0] == "abc");
+ test(ssso[0][0][1] == "de");
+ test(ssso[0][1][0] == "xyz");
+ test(ssso[1][0][0] == "hello");
+ test(ssso[2][0][0] == "");
+ test(ssso[2][0][1] == "");
+ test(ssso[2][1][0] == "abcd");
+ test(ssso[3][0][0] == "");
+
+ test(rsso.size() == 3);
+ test(rsso[0].size() == 0);
+ test(rsso[1].size() == 1);
+ test(rsso[1][0].size() == 1);
+ test(rsso[2].size() == 2);
+ test(rsso[2][0].size() == 2);
+ test(rsso[2][1].size() == 1);
+ test(rsso[1][0][0] == "");
+ test(rsso[2][0][0] == "");
+ test(rsso[2][0][1] == "");
+ test(rsso[2][1][0] == "abcd");
}
{
- Test::ByteBoolD di1;
- di1[10] = true;
- di1[100] = false;
- Test::ByteBoolD di2;
- di2[10] = true;
- di2[11] = false;
- di2[101] = true;
-
- Test::ByteBoolD _do;
- Test::ByteBoolD ro = p->opByteBoolD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro[10] == true);
- test(ro[11] == false);
- test(ro[100] == false);
- test(ro[101] == true);
+ Test::ByteBoolD di1;
+ di1[10] = true;
+ di1[100] = false;
+ Test::ByteBoolD di2;
+ di2[10] = true;
+ di2[11] = false;
+ di2[101] = true;
+
+ Test::ByteBoolD _do;
+ Test::ByteBoolD ro = p->opByteBoolD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro[10] == true);
+ test(ro[11] == false);
+ test(ro[100] == false);
+ test(ro[101] == true);
}
{
- Test::ShortIntD di1;
- di1[110] = -1;
- di1[1100] = 123123;
- Test::ShortIntD di2;
- di2[110] = -1;
- di2[111] = -100;
- di2[1101] = 0;
-
- Test::ShortIntD _do;
- Test::ShortIntD ro = p->opShortIntD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro[110] == -1);
- test(ro[111] == -100);
- test(ro[1100] == 123123);
- test(ro[1101] == 0);
+ Test::ShortIntD di1;
+ di1[110] = -1;
+ di1[1100] = 123123;
+ Test::ShortIntD di2;
+ di2[110] = -1;
+ di2[111] = -100;
+ di2[1101] = 0;
+
+ Test::ShortIntD _do;
+ Test::ShortIntD ro = p->opShortIntD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro[110] == -1);
+ test(ro[111] == -100);
+ test(ro[1100] == 123123);
+ test(ro[1101] == 0);
}
{
- Test::LongFloatD di1;
- di1[999999110] = Ice::Float(-1.1);
- di1[999999111] = Ice::Float(123123.2);
- Test::LongFloatD di2;
- di2[999999110] = Ice::Float(-1.1);
- di2[999999120] = Ice::Float(-100.4);
- di2[999999130] = Ice::Float(0.5);
-
- Test::LongFloatD _do;
- Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro[999999110] == Ice::Float(-1.1));
- test(ro[999999120] == Ice::Float(-100.4));
- test(ro[999999111] == Ice::Float(123123.2));
- test(ro[999999130] == Ice::Float(0.5));
+ Test::LongFloatD di1;
+ di1[999999110] = Ice::Float(-1.1);
+ di1[999999111] = Ice::Float(123123.2);
+ Test::LongFloatD di2;
+ di2[999999110] = Ice::Float(-1.1);
+ di2[999999120] = Ice::Float(-100.4);
+ di2[999999130] = Ice::Float(0.5);
+
+ Test::LongFloatD _do;
+ Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro[999999110] == Ice::Float(-1.1));
+ test(ro[999999120] == Ice::Float(-100.4));
+ test(ro[999999111] == Ice::Float(123123.2));
+ test(ro[999999130] == Ice::Float(0.5));
}
{
- Test::StringStringD di1;
- di1["foo"] = "abc -1.1";
- di1["bar"] = "abc 123123.2";
- Test::StringStringD di2;
- di2["foo"] = "abc -1.1";
- di2["FOO"] = "abc -100.4";
- di2["BAR"] = "abc 0.5";
-
- Test::StringStringD _do;
- Test::StringStringD ro = p->opStringStringD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro["foo"] == "abc -1.1");
- test(ro["FOO"] == "abc -100.4");
- test(ro["bar"] == "abc 123123.2");
- test(ro["BAR"] == "abc 0.5");
+ Test::StringStringD di1;
+ di1["foo"] = "abc -1.1";
+ di1["bar"] = "abc 123123.2";
+ Test::StringStringD di2;
+ di2["foo"] = "abc -1.1";
+ di2["FOO"] = "abc -100.4";
+ di2["BAR"] = "abc 0.5";
+
+ Test::StringStringD _do;
+ Test::StringStringD ro = p->opStringStringD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro["foo"] == "abc -1.1");
+ test(ro["FOO"] == "abc -100.4");
+ test(ro["bar"] == "abc 123123.2");
+ test(ro["BAR"] == "abc 0.5");
}
{
- Test::StringMyEnumD di1;
- di1["abc"] = Test::enum1;
- di1[""] = Test::enum2;
- Test::StringMyEnumD di2;
- di2["abc"] = Test::enum1;
- di2["qwerty"] = Test::enum3;
- di2["Hello!!"] = Test::enum2;
-
- Test::StringMyEnumD _do;
- Test::StringMyEnumD ro = p->opStringMyEnumD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro["abc"] == Test::enum1);
- test(ro["qwerty"] == Test::enum3);
- test(ro[""] == Test::enum2);
- test(ro["Hello!!"] == Test::enum2);
+ Test::StringMyEnumD di1;
+ di1["abc"] = Test::enum1;
+ di1[""] = Test::enum2;
+ Test::StringMyEnumD di2;
+ di2["abc"] = Test::enum1;
+ di2["qwerty"] = Test::enum3;
+ di2["Hello!!"] = Test::enum2;
+
+ Test::StringMyEnumD _do;
+ Test::StringMyEnumD ro = p->opStringMyEnumD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro["abc"] == Test::enum1);
+ test(ro["qwerty"] == Test::enum3);
+ test(ro[""] == Test::enum2);
+ test(ro["Hello!!"] == Test::enum2);
}
{
- const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
-
- for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
- {
- Test::IntS s;
- for(int i = 0; i < lengths[l]; ++i)
- {
- s.push_back(i);
- }
- Test::IntS r = p->opIntS(s);
- test(r.size() == static_cast<size_t>(lengths[l]));
- for(int j = 0; j < static_cast<int>(r.size()); ++j)
- {
- test(r[j] == -j);
- }
- }
+ const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
+ {
+ Test::IntS s;
+ for(int i = 0; i < lengths[l]; ++i)
+ {
+ s.push_back(i);
+ }
+ Test::IntS r = p->opIntS(s);
+ test(r.size() == static_cast<size_t>(lengths[l]));
+ for(int j = 0; j < static_cast<int>(r.size()); ++j)
+ {
+ test(r[j] == -j);
+ }
+ }
}
{
- Ice::Context ctx;
- ctx["one"] = "ONE";
- ctx["two"] = "TWO";
- ctx["three"] = "THREE";
- {
- Test::StringStringD r = p->opContext();
- test(p->ice_getContext().empty());
- test(r != ctx);
- }
- {
- Test::StringStringD r = p->opContext(ctx);
- test(p->ice_getContext().empty());
- test(r == ctx);
- }
- {
- Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
- test(p2->ice_getContext() == ctx);
- Test::StringStringD r = p2->opContext();
- test(r == ctx);
- r = p2->opContext(ctx);
- test(r == ctx);
- }
-
- {
- //
- // Test that default context is obtained correctly from communicator.
- //
+ Ice::Context ctx;
+ ctx["one"] = "ONE";
+ ctx["two"] = "TWO";
+ ctx["three"] = "THREE";
+ {
+ Test::StringStringD r = p->opContext();
+ test(p->ice_getContext().empty());
+ test(r != ctx);
+ }
+ {
+ Test::StringStringD r = p->opContext(ctx);
+ test(p->ice_getContext().empty());
+ test(r == ctx);
+ }
+ {
+ Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
+ test(p2->ice_getContext() == ctx);
+ Test::StringStringD r = p2->opContext();
+ test(r == ctx);
+ r = p2->opContext(ctx);
+ test(r == ctx);
+ }
+
+ {
+ //
+ // Test that default context is obtained correctly from communicator.
+ //
/* DEPRECATED
- Ice::Context dflt;
- dflt["a"] = "b";
- communicator->setDefaultContext(dflt);
- test(p->opContext() != dflt);
+ Ice::Context dflt;
+ dflt["a"] = "b";
+ communicator->setDefaultContext(dflt);
+ test(p->opContext() != dflt);
- Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context()));
- test(p2->opContext().empty());
+ Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context()));
+ test(p2->opContext().empty());
- p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext());
- test(p2->opContext() == dflt);
+ p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext());
+ test(p2->opContext() == dflt);
- communicator->setDefaultContext(Ice::Context());
- test(!p2->opContext().empty());
+ communicator->setDefaultContext(Ice::Context());
+ test(!p2->opContext().empty());
- communicator->setDefaultContext(dflt);
- Test::MyClassPrx c = Test::MyClassPrx::checkedCast(
- communicator->stringToProxy("test:default -p 12010 -t 10000"));
- test(c->opContext() == dflt);
+ communicator->setDefaultContext(dflt);
+ Test::MyClassPrx c = Test::MyClassPrx::checkedCast(
+ communicator->stringToProxy("test:default -p 12010 -t 10000"));
+ test(c->opContext() == dflt);
- dflt["a"] = "c";
- Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt));
- test(c2->opContext()["a"] == "c");
+ dflt["a"] = "c";
+ Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt));
+ test(c2->opContext()["a"] == "c");
- dflt.clear();
- Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt));
- Ice::Context tmp = c3->opContext();
- test(tmp.find("a") == tmp.end());
+ dflt.clear();
+ Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt));
+ Ice::Context tmp = c3->opContext();
+ test(tmp.find("a") == tmp.end());
- Test::MyClassPrx c4 = Test::MyClassPrx::uncheckedCast(c2->ice_defaultContext());
- test(c4->opContext()["a"] == "b");
+ Test::MyClassPrx c4 = Test::MyClassPrx::uncheckedCast(c2->ice_defaultContext());
+ test(c4->opContext()["a"] == "b");
- dflt["a"] = "d";
- communicator->setDefaultContext(dflt);
+ dflt["a"] = "d";
+ communicator->setDefaultContext(dflt);
- Test::MyClassPrx c5 = Test::MyClassPrx::uncheckedCast(c->ice_defaultContext());
- test(c5->opContext()["a"] == "d");
+ Test::MyClassPrx c5 = Test::MyClassPrx::uncheckedCast(c->ice_defaultContext());
+ test(c5->opContext()["a"] == "d");
- communicator->setDefaultContext(Ice::Context());
+ communicator->setDefaultContext(Ice::Context());
*/
- }
-
- {
- //
- // Test implicit context propagation
- //
-
- string impls[] = {"Shared", "SharedWithoutLocking", "PerThread"};
- for(int i = 0; i < 3; i++)
- {
- Ice::InitializationData initData;
- initData.properties = communicator->getProperties()->clone();
- initData.properties->setProperty("Ice.ImplicitContext", impls[i]);
-
- Ice::CommunicatorPtr ic = Ice::initialize(initData);
-
- Ice::Context ctx;
- ctx["one"] = "ONE";
- ctx["two"] = "TWO";
- ctx["three"] = "THREE";
-
- Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(
- ic->stringToProxy("test:default -p 12010 -t 10000"));
-
- ic->getImplicitContext()->setContext(ctx);
- test(ic->getImplicitContext()->getContext() == ctx);
- test(p->opContext() == ctx);
-
- ic->getImplicitContext()->set("zero", "ZERO");
- test(ic->getImplicitContext()->get("zero") == "ZERO");
- test(ic->getImplicitContext()->getWithDefault("foobar", "foo") == "foo");
-
- ctx = ic->getImplicitContext()->getContext();
- test(p->opContext() == ctx);
-
- Ice::Context prxContext;
- prxContext["one"] = "UN";
- prxContext["four"] = "QUATRE";
-
- Ice::Context combined = prxContext;
- combined.insert(ctx.begin(), ctx.end());
- test(combined["one"] == "UN");
-
- p = Test::MyClassPrx::uncheckedCast(p->ice_context(prxContext));
-
- ic->getImplicitContext()->setContext(Ice::Context());
- test(p->opContext() == prxContext);
-
- ic->getImplicitContext()->setContext(ctx);
- test(p->opContext() == combined);
-
- ic->destroy();
- }
- }
-
+ }
+
+ {
+ //
+ // Test implicit context propagation
+ //
+
+ string impls[] = {"Shared", "SharedWithoutLocking", "PerThread"};
+ for(int i = 0; i < 3; i++)
+ {
+ Ice::InitializationData initData;
+ initData.properties = communicator->getProperties()->clone();
+ initData.properties->setProperty("Ice.ImplicitContext", impls[i]);
+
+ Ice::CommunicatorPtr ic = Ice::initialize(initData);
+
+ Ice::Context ctx;
+ ctx["one"] = "ONE";
+ ctx["two"] = "TWO";
+ ctx["three"] = "THREE";
+
+ Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(
+ ic->stringToProxy("test:default -p 12010 -t 10000"));
+
+ ic->getImplicitContext()->setContext(ctx);
+ test(ic->getImplicitContext()->getContext() == ctx);
+ test(p->opContext() == ctx);
+
+ ic->getImplicitContext()->set("zero", "ZERO");
+ test(ic->getImplicitContext()->get("zero") == "ZERO");
+ test(ic->getImplicitContext()->getWithDefault("foobar", "foo") == "foo");
+
+ ctx = ic->getImplicitContext()->getContext();
+ test(p->opContext() == ctx);
+
+ Ice::Context prxContext;
+ prxContext["one"] = "UN";
+ prxContext["four"] = "QUATRE";
+
+ Ice::Context combined = prxContext;
+ combined.insert(ctx.begin(), ctx.end());
+ test(combined["one"] == "UN");
+
+ p = Test::MyClassPrx::uncheckedCast(p->ice_context(prxContext));
+
+ ic->getImplicitContext()->setContext(Ice::Context());
+ test(p->opContext() == prxContext);
+
+ ic->getImplicitContext()->setContext(ctx);
+ test(p->opContext() == combined);
+
+ ic->destroy();
+ }
+ }
+
}
{
Ice::Double d = 1278312346.0 / 13.0;
- Test::DoubleS ds(5, d);
- p->opDoubleMarshaling(d, ds);
+ Test::DoubleS ds(5, d);
+ p->opDoubleMarshaling(d, ds);
}
}
diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp
index 55cfdaf9841..37bdf2895b4 100644
--- a/cpp/test/Ice/operations/TwowaysAMI.cpp
+++ b/cpp/test/Ice/operations/TwowaysAMI.cpp
@@ -29,7 +29,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -39,26 +39,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -72,12 +72,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -89,12 +89,12 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex));
+ test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex));
called();
}
};
@@ -107,14 +107,14 @@ public:
virtual void ice_response(::Ice::Byte r, ::Ice::Byte b)
{
- test(b == Ice::Byte(0xf0));
- test(r == Ice::Byte(0xff));
- called();
+ test(b == Ice::Byte(0xf0));
+ test(r == Ice::Byte(0xff));
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -126,12 +126,12 @@ public:
virtual void ice_response(::Ice::Byte r, ::Ice::Byte b)
{
- test(false);
+ test(false);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex));
+ test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex));
called();
}
};
@@ -145,14 +145,14 @@ public:
virtual void ice_response(bool r, bool b)
{
- test(b);
- test(!r);
- called();
+ test(b);
+ test(!r);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -164,16 +164,16 @@ public:
virtual void ice_response(::Ice::Long r, ::Ice::Short s, ::Ice::Int i, ::Ice::Long l)
{
- test(s == 10);
- test(i == 11);
- test(l == 12);
- test(r == 12);
- called();
+ test(s == 10);
+ test(i == 11);
+ test(l == 12);
+ test(r == 12);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -185,15 +185,15 @@ public:
virtual void ice_response(::Ice::Double r, ::Ice::Float f, ::Ice::Double d)
{
- test(f == Ice::Float(3.14));
- test(d == Ice::Double(1.1E10));
- test(r == Ice::Double(1.1E10));
- called();
+ test(f == Ice::Float(3.14));
+ test(d == Ice::Double(1.1E10));
+ test(r == Ice::Double(1.1E10));
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -205,14 +205,14 @@ public:
virtual void ice_response(const ::std::string& r, const ::std::string& s)
{
- test(s == "world hello");
- test(r == "hello world");
- called();
+ test(s == "world hello");
+ test(r == "hello world");
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -224,14 +224,14 @@ public:
virtual void ice_response(::Test::MyEnum r, ::Test::MyEnum e)
{
- test(e == Test::enum2);
- test(r == Test::enum3);
- called();
+ test(e == Test::enum2);
+ test(r == Test::enum3);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -248,29 +248,29 @@ public:
virtual void ice_response(const ::Test::MyClassPrx& r, const ::Test::MyClassPrx& c1, const ::Test::MyClassPrx& c2)
{
- test(c1->ice_getIdentity() == _communicator->stringToIdentity("test"));
- test(c2->ice_getIdentity() == _communicator->stringToIdentity("noSuchIdentity"));
- test(r->ice_getIdentity() == _communicator->stringToIdentity("test"));
- // We can't do the callbacks below in thread per connection mode.
- if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection"))
- {
- r->opVoid();
- c1->opVoid();
- try
- {
- c2->opVoid();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- }
- called();
+ test(c1->ice_getIdentity() == _communicator->stringToIdentity("test"));
+ test(c2->ice_getIdentity() == _communicator->stringToIdentity("noSuchIdentity"));
+ test(r->ice_getIdentity() == _communicator->stringToIdentity("test"));
+ // We can't do the callbacks below in thread per connection mode.
+ if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection"))
+ {
+ r->opVoid();
+ c1->opVoid();
+ try
+ {
+ c2->opVoid();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ }
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
private:
@@ -291,22 +291,22 @@ public:
virtual void ice_response(const ::Test::Structure& rso, const ::Test::Structure& so)
{
- test(rso.p == 0);
- test(rso.e == Test::enum2);
- test(rso.s.s == "def");
- test(so.e == Test::enum3);
- test(so.s.s == "a new string");
- // We can't do the callbacks below in thread per connection mode.
- if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection"))
- {
- so.p->opVoid();
- }
- called();
+ test(rso.p == 0);
+ test(rso.e == Test::enum2);
+ test(rso.s.s == "def");
+ test(so.e == Test::enum3);
+ test(so.s.s == "a new string");
+ // We can't do the callbacks below in thread per connection mode.
+ if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection"))
+ {
+ so.p->opVoid();
+ }
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
private:
@@ -322,26 +322,26 @@ public:
virtual void ice_response(const ::Test::ByteS& rso, const ::Test::ByteS& bso)
{
- test(bso.size() == 4);
- test(bso[0] == Ice::Byte(0x22));
- test(bso[1] == Ice::Byte(0x12));
- test(bso[2] == Ice::Byte(0x11));
- test(bso[3] == Ice::Byte(0x01));
- test(rso.size() == 8);
- test(rso[0] == Ice::Byte(0x01));
- test(rso[1] == Ice::Byte(0x11));
- test(rso[2] == Ice::Byte(0x12));
- test(rso[3] == Ice::Byte(0x22));
- test(rso[4] == Ice::Byte(0xf1));
- test(rso[5] == Ice::Byte(0xf2));
- test(rso[6] == Ice::Byte(0xf3));
- test(rso[7] == Ice::Byte(0xf4));
- called();
+ test(bso.size() == 4);
+ test(bso[0] == Ice::Byte(0x22));
+ test(bso[1] == Ice::Byte(0x12));
+ test(bso[2] == Ice::Byte(0x11));
+ test(bso[3] == Ice::Byte(0x01));
+ test(rso.size() == 8);
+ test(rso[0] == Ice::Byte(0x01));
+ test(rso[1] == Ice::Byte(0x11));
+ test(rso[2] == Ice::Byte(0x12));
+ test(rso[3] == Ice::Byte(0x22));
+ test(rso[4] == Ice::Byte(0xf1));
+ test(rso[5] == Ice::Byte(0xf2));
+ test(rso[6] == Ice::Byte(0xf3));
+ test(rso[7] == Ice::Byte(0xf4));
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -353,21 +353,21 @@ public:
virtual void ice_response(const ::Test::BoolS& rso, const ::Test::BoolS& bso)
{
- test(bso.size() == 4);
- test(bso[0]);
- test(bso[1]);
- test(!bso[2]);
- test(!bso[3]);
- test(rso.size() == 3);
- test(!rso[0]);
- test(rso[1]);
- test(rso[2]);
- called();
+ test(bso.size() == 4);
+ test(bso[0]);
+ test(bso[1]);
+ test(!bso[2]);
+ test(!bso[3]);
+ test(rso.size() == 3);
+ test(!rso[0]);
+ test(rso[1]);
+ test(rso[2]);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -378,34 +378,34 @@ class AMI_MyClass_opShortIntLongSI : public Test::AMI_MyClass_opShortIntLongS, p
public:
virtual void ice_response(const ::Test::LongS& rso, const ::Test::ShortS& sso, const ::Test::IntS& iso,
- const ::Test::LongS& lso)
- {
- test(sso.size() == 3);
- test(sso[0] == 1);
- test(sso[1] == 2);
- test(sso[2] == 3);
- test(iso.size() == 4);
- test(iso[0] == 8);
- test(iso[1] == 7);
- test(iso[2] == 6);
- test(iso[3] == 5);
- test(lso.size() == 6);
- test(lso[0] == 10);
- test(lso[1] == 30);
- test(lso[2] == 20);
- test(lso[3] == 10);
- test(lso[4] == 30);
- test(lso[5] == 20);
- test(rso.size() == 3);
- test(rso[0] == 10);
- test(rso[1] == 30);
- test(rso[2] == 20);
- called();
+ const ::Test::LongS& lso)
+ {
+ test(sso.size() == 3);
+ test(sso[0] == 1);
+ test(sso[1] == 2);
+ test(sso[2] == 3);
+ test(iso.size() == 4);
+ test(iso[0] == 8);
+ test(iso[1] == 7);
+ test(iso[2] == 6);
+ test(iso[3] == 5);
+ test(lso.size() == 6);
+ test(lso[0] == 10);
+ test(lso[1] == 30);
+ test(lso[2] == 20);
+ test(lso[3] == 10);
+ test(lso[4] == 30);
+ test(lso[5] == 20);
+ test(rso.size() == 3);
+ test(rso[0] == 10);
+ test(rso[1] == 30);
+ test(rso[2] == 20);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -417,25 +417,25 @@ public:
virtual void ice_response(const ::Test::DoubleS& rso, const ::Test::FloatS& fso, const ::Test::DoubleS& dso)
{
- test(fso.size() == 2);
- test(fso[0] == ::Ice::Float(3.14));
- test(fso[1] == ::Ice::Float(1.11));
- test(dso.size() == 3);
- test(dso[0] == ::Ice::Double(1.3E10));
- test(dso[1] == ::Ice::Double(1.2E10));
- test(dso[2] == ::Ice::Double(1.1E10));
- test(rso.size() == 5);
- test(rso[0] == ::Ice::Double(1.1E10));
- test(rso[1] == ::Ice::Double(1.2E10));
- test(rso[2] == ::Ice::Double(1.3E10));
- test(::Ice::Float(rso[3]) == ::Ice::Float(3.14));
- test(::Ice::Float(rso[4]) == ::Ice::Float(1.11));
- called();
+ test(fso.size() == 2);
+ test(fso[0] == ::Ice::Float(3.14));
+ test(fso[1] == ::Ice::Float(1.11));
+ test(dso.size() == 3);
+ test(dso[0] == ::Ice::Double(1.3E10));
+ test(dso[1] == ::Ice::Double(1.2E10));
+ test(dso[2] == ::Ice::Double(1.1E10));
+ test(rso.size() == 5);
+ test(rso[0] == ::Ice::Double(1.1E10));
+ test(rso[1] == ::Ice::Double(1.2E10));
+ test(rso[2] == ::Ice::Double(1.3E10));
+ test(::Ice::Float(rso[3]) == ::Ice::Float(3.14));
+ test(::Ice::Float(rso[4]) == ::Ice::Float(1.11));
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -447,21 +447,21 @@ public:
virtual void ice_response(const ::Test::StringS& rso, const ::Test::StringS& sso)
{
- test(sso.size() == 4);
- test(sso[0] == "abc");
- test(sso[1] == "de");
- test(sso[2] == "fghi");
- test(sso[3] == "xyz");
- test(rso.size() == 3);
- test(rso[0] == "fghi");
- test(rso[1] == "de");
- test(rso[2] == "abc");
- called();
+ test(sso.size() == 4);
+ test(sso[0] == "abc");
+ test(sso[1] == "de");
+ test(sso[2] == "fghi");
+ test(sso[3] == "xyz");
+ test(rso.size() == 3);
+ test(rso[0] == "fghi");
+ test(rso[1] == "de");
+ test(rso[2] == "abc");
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -473,31 +473,31 @@ public:
virtual void ice_response(const ::Test::ByteSS& rso, const ::Test::ByteSS& bso)
{
- test(bso.size() == 2);
- test(bso[0].size() == 1);
- test(bso[0][0] == Ice::Byte(0xff));
- test(bso[1].size() == 3);
- test(bso[1][0] == Ice::Byte(0x01));
- test(bso[1][1] == Ice::Byte(0x11));
- test(bso[1][2] == Ice::Byte(0x12));
- test(rso.size() == 4);
- test(rso[0].size() == 3);
- test(rso[0][0] == Ice::Byte(0x01));
- test(rso[0][1] == Ice::Byte(0x11));
- test(rso[0][2] == Ice::Byte(0x12));
- test(rso[1].size() == 1);
- test(rso[1][0] == Ice::Byte(0xff));
- test(rso[2].size() == 1);
- test(rso[2][0] == Ice::Byte(0x0e));
- test(rso[3].size() == 2);
- test(rso[3][0] == Ice::Byte(0xf2));
- test(rso[3][1] == Ice::Byte(0xf1));
- called();
+ test(bso.size() == 2);
+ test(bso[0].size() == 1);
+ test(bso[0][0] == Ice::Byte(0xff));
+ test(bso[1].size() == 3);
+ test(bso[1][0] == Ice::Byte(0x01));
+ test(bso[1][1] == Ice::Byte(0x11));
+ test(bso[1][2] == Ice::Byte(0x12));
+ test(rso.size() == 4);
+ test(rso[0].size() == 3);
+ test(rso[0][0] == Ice::Byte(0x01));
+ test(rso[0][1] == Ice::Byte(0x11));
+ test(rso[0][2] == Ice::Byte(0x12));
+ test(rso[1].size() == 1);
+ test(rso[1][0] == Ice::Byte(0xff));
+ test(rso[2].size() == 1);
+ test(rso[2][0] == Ice::Byte(0x0e));
+ test(rso[3].size() == 2);
+ test(rso[3][0] == Ice::Byte(0xf2));
+ test(rso[3][1] == Ice::Byte(0xf1));
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -509,12 +509,12 @@ public:
virtual void ice_response(const ::Test::BoolSS&, const ::Test::BoolSS& bso)
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -525,14 +525,14 @@ class AMI_MyClass_opShortIntLongSSI : public Test::AMI_MyClass_opShortIntLongSS,
public:
virtual void ice_response(const ::Test::LongSS&, const ::Test::ShortSS&, const ::Test::IntSS&,
- const ::Test::LongSS&)
+ const ::Test::LongSS&)
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -544,32 +544,32 @@ public:
virtual void ice_response(const ::Test::DoubleSS& rso, const ::Test::FloatSS& fso, const ::Test::DoubleSS& dso)
{
- test(fso.size() == 3);
- test(fso[0].size() == 1);
- test(fso[0][0] == ::Ice::Float(3.14));
- test(fso[1].size() == 1);
- test(fso[1][0] == ::Ice::Float(1.11));
- test(fso[2].size() == 0);
- test(dso.size() == 1);
- test(dso[0].size() == 3);
- test(dso[0][0] == ::Ice::Double(1.1E10));
- test(dso[0][1] == ::Ice::Double(1.2E10));
- test(dso[0][2] == ::Ice::Double(1.3E10));
- test(rso.size() == 2);
- test(rso[0].size() == 3);
- test(rso[0][0] == ::Ice::Double(1.1E10));
- test(rso[0][1] == ::Ice::Double(1.2E10));
- test(rso[0][2] == ::Ice::Double(1.3E10));
- test(rso[1].size() == 3);
- test(rso[1][0] == ::Ice::Double(1.1E10));
- test(rso[1][1] == ::Ice::Double(1.2E10));
- test(rso[1][2] == ::Ice::Double(1.3E10));
- called();
+ test(fso.size() == 3);
+ test(fso[0].size() == 1);
+ test(fso[0][0] == ::Ice::Float(3.14));
+ test(fso[1].size() == 1);
+ test(fso[1][0] == ::Ice::Float(1.11));
+ test(fso[2].size() == 0);
+ test(dso.size() == 1);
+ test(dso[0].size() == 3);
+ test(dso[0][0] == ::Ice::Double(1.1E10));
+ test(dso[0][1] == ::Ice::Double(1.2E10));
+ test(dso[0][2] == ::Ice::Double(1.3E10));
+ test(rso.size() == 2);
+ test(rso[0].size() == 3);
+ test(rso[0][0] == ::Ice::Double(1.1E10));
+ test(rso[0][1] == ::Ice::Double(1.2E10));
+ test(rso[0][2] == ::Ice::Double(1.3E10));
+ test(rso[1].size() == 3);
+ test(rso[1][0] == ::Ice::Double(1.1E10));
+ test(rso[1][1] == ::Ice::Double(1.2E10));
+ test(rso[1][2] == ::Ice::Double(1.3E10));
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -581,27 +581,27 @@ public:
virtual void ice_response(const ::Test::StringSS& rso, const ::Test::StringSS& sso)
{
- test(sso.size() == 5);
- test(sso[0].size() == 1);
- test(sso[0][0] == "abc");
- test(sso[1].size() == 2);
- test(sso[1][0] == "de");
- test(sso[1][1] == "fghi");
- test(sso[2].size() == 0);
- test(sso[3].size() == 0);
- test(sso[4].size() == 1);
- test(sso[4][0] == "xyz");
- test(rso.size() == 3);
- test(rso[0].size() == 1);
- test(rso[0][0] == "xyz");
- test(rso[1].size() == 0);
- test(rso[2].size() == 0);
- called();
+ test(sso.size() == 5);
+ test(sso[0].size() == 1);
+ test(sso[0][0] == "abc");
+ test(sso[1].size() == 2);
+ test(sso[1][0] == "de");
+ test(sso[1][1] == "fghi");
+ test(sso[2].size() == 0);
+ test(sso[3].size() == 0);
+ test(sso[4].size() == 1);
+ test(sso[4][0] == "xyz");
+ test(rso.size() == 3);
+ test(rso[0].size() == 1);
+ test(rso[0][0] == "xyz");
+ test(rso[1].size() == 0);
+ test(rso[2].size() == 0);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -613,25 +613,25 @@ public:
virtual void ice_response(const ::Test::ByteBoolD& ro, const ::Test::ByteBoolD& _do)
{
- Test::ByteBoolD di1;
- di1[10] = true;
- di1[100] = false;
- test(_do == di1);
- test(ro.size() == 4);
- test(ro.find(10) != ro.end());
- test(ro.find(10)->second == true);
- test(ro.find(11) != ro.end());
- test(ro.find(11)->second == false);
- test(ro.find(100) != ro.end());
- test(ro.find(100)->second == false);
- test(ro.find(101) != ro.end());
- test(ro.find(101)->second == true);
- called();
+ Test::ByteBoolD di1;
+ di1[10] = true;
+ di1[100] = false;
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro.find(10) != ro.end());
+ test(ro.find(10)->second == true);
+ test(ro.find(11) != ro.end());
+ test(ro.find(11)->second == false);
+ test(ro.find(100) != ro.end());
+ test(ro.find(100)->second == false);
+ test(ro.find(101) != ro.end());
+ test(ro.find(101)->second == true);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -643,25 +643,25 @@ public:
virtual void ice_response(const ::Test::ShortIntD& ro, const ::Test::ShortIntD& _do)
{
- Test::ShortIntD di1;
- di1[110] = -1;
- di1[1100] = 123123;
- test(_do == di1);
- test(ro.size() == 4);
- test(ro.find(110) != ro.end());
- test(ro.find(110)->second == -1);
- test(ro.find(111) != ro.end());
- test(ro.find(111)->second == -100);
- test(ro.find(1100) != ro.end());
- test(ro.find(1100)->second == 123123);
- test(ro.find(1101) != ro.end());
- test(ro.find(1101)->second == 0);
- called();
+ Test::ShortIntD di1;
+ di1[110] = -1;
+ di1[1100] = 123123;
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro.find(110) != ro.end());
+ test(ro.find(110)->second == -1);
+ test(ro.find(111) != ro.end());
+ test(ro.find(111)->second == -100);
+ test(ro.find(1100) != ro.end());
+ test(ro.find(1100)->second == 123123);
+ test(ro.find(1101) != ro.end());
+ test(ro.find(1101)->second == 0);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -673,25 +673,25 @@ public:
virtual void ice_response(const ::Test::LongFloatD& ro, const ::Test::LongFloatD& _do)
{
- Test::LongFloatD di1;
- di1[999999110] = Ice::Float(-1.1);
- di1[999999111] = Ice::Float(123123.2);
- test(_do == di1);
- test(ro.size() == 4);
- test(ro.find(999999110) != ro.end());
- test(ro.find(999999110)->second == Ice::Float(-1.1));
- test(ro.find(999999120) != ro.end());
- test(ro.find(999999120)->second == Ice::Float(-100.4));
- test(ro.find(999999111) != ro.end());
- test(ro.find(999999111)->second == Ice::Float(123123.2));
- test(ro.find(999999130) != ro.end());
- test(ro.find(999999130)->second == Ice::Float(0.5));
- called();
+ Test::LongFloatD di1;
+ di1[999999110] = Ice::Float(-1.1);
+ di1[999999111] = Ice::Float(123123.2);
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro.find(999999110) != ro.end());
+ test(ro.find(999999110)->second == Ice::Float(-1.1));
+ test(ro.find(999999120) != ro.end());
+ test(ro.find(999999120)->second == Ice::Float(-100.4));
+ test(ro.find(999999111) != ro.end());
+ test(ro.find(999999111)->second == Ice::Float(123123.2));
+ test(ro.find(999999130) != ro.end());
+ test(ro.find(999999130)->second == Ice::Float(0.5));
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -703,25 +703,25 @@ public:
virtual void ice_response(const ::Test::StringStringD& ro, const ::Test::StringStringD& _do)
{
- Test::StringStringD di1;
- di1["foo"] = "abc -1.1";
- di1["bar"] = "abc 123123.2";
- test(_do == di1);
- test(ro.size() == 4);
- test(ro.find("foo") != ro.end());
- test(ro.find("foo")->second == "abc -1.1");
- test(ro.find("FOO") != ro.end());
- test(ro.find("FOO")->second == "abc -100.4");
- test(ro.find("bar") != ro.end());
- test(ro.find("bar")->second == "abc 123123.2");
- test(ro.find("BAR") != ro.end());
- test(ro.find("BAR")->second == "abc 0.5");
- called();
+ Test::StringStringD di1;
+ di1["foo"] = "abc -1.1";
+ di1["bar"] = "abc 123123.2";
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro.find("foo") != ro.end());
+ test(ro.find("foo")->second == "abc -1.1");
+ test(ro.find("FOO") != ro.end());
+ test(ro.find("FOO")->second == "abc -100.4");
+ test(ro.find("bar") != ro.end());
+ test(ro.find("bar")->second == "abc 123123.2");
+ test(ro.find("BAR") != ro.end());
+ test(ro.find("BAR")->second == "abc 0.5");
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -733,25 +733,25 @@ public:
virtual void ice_response(const ::Test::StringMyEnumD& ro, const ::Test::StringMyEnumD& _do)
{
- Test::StringMyEnumD di1;
- di1["abc"] = Test::enum1;
- di1[""] = Test::enum2;
- test(_do == di1);
- test(ro.size() == 4);
- test(ro.find("abc") != ro.end());
- test(ro.find("abc")->second == Test::enum1);
- test(ro.find("qwerty") != ro.end());
- test(ro.find("qwerty")->second == Test::enum3);
- test(ro.find("") != ro.end());
- test(ro.find("")->second == Test::enum2);
- test(ro.find("Hello!!") != ro.end());
- test(ro.find("Hello!!")->second == Test::enum2);
- called();
+ Test::StringMyEnumD di1;
+ di1["abc"] = Test::enum1;
+ di1[""] = Test::enum2;
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro.find("abc") != ro.end());
+ test(ro.find("abc")->second == Test::enum1);
+ test(ro.find("qwerty") != ro.end());
+ test(ro.find("qwerty")->second == Test::enum3);
+ test(ro.find("") != ro.end());
+ test(ro.find("")->second == Test::enum2);
+ test(ro.find("Hello!!") != ro.end());
+ test(ro.find("Hello!!")->second == Test::enum2);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -765,17 +765,17 @@ public:
virtual void ice_response(const Test::IntS& r)
{
- test(r.size() == static_cast<size_t>(_l));
- for(int j = 0; j < _l; ++j)
- {
- test(r[j] == -j);
- }
- called();
+ test(r.size() == static_cast<size_t>(_l));
+ for(int j = 0; j < _l; ++j)
+ {
+ test(r[j] == -j);
+ }
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
private:
@@ -795,13 +795,13 @@ public:
virtual void ice_response(const Test::StringStringD& r)
{
- test(r == _d);
- called();
+ test(r == _d);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
private:
@@ -821,13 +821,13 @@ public:
virtual void ice_response(const Test::StringStringD& r)
{
- test(r != _d);
- called();
+ test(r != _d);
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
private:
@@ -843,12 +843,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -860,12 +860,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(false);
+ test(false);
}
};
@@ -876,541 +876,541 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
{
{
// Check that a call to a void operation raises TwowayOnlyException
- // in the ice_exception() callback instead of at the point of call.
- Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway());
- AMI_MyClass_opVoidExIPtr cb = new AMI_MyClass_opVoidExI;
- try {
- oneway->opVoid_async(cb);
- }
- catch(const Ice::Exception&)
- {
- test(false);
- }
- test(cb->check());
+ // in the ice_exception() callback instead of at the point of call.
+ Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway());
+ AMI_MyClass_opVoidExIPtr cb = new AMI_MyClass_opVoidExI;
+ try {
+ oneway->opVoid_async(cb);
+ }
+ catch(const Ice::Exception&)
+ {
+ test(false);
+ }
+ test(cb->check());
}
{
// Check that a call to a twoway operation raises TwowayOnlyException
- // in the ice_exception() callback instead of at the point of call.
- Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway());
- AMI_MyClass_opByteExIPtr cb = new AMI_MyClass_opByteExI;
- try
- {
- oneway->opByte_async(cb, 0, 0);
- }
- catch(const Ice::Exception&)
- {
- test(false);
- }
- test(cb->check());
+ // in the ice_exception() callback instead of at the point of call.
+ Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway());
+ AMI_MyClass_opByteExIPtr cb = new AMI_MyClass_opByteExI;
+ try
+ {
+ oneway->opByte_async(cb, 0, 0);
+ }
+ catch(const Ice::Exception&)
+ {
+ test(false);
+ }
+ test(cb->check());
}
{
- AMI_MyClass_opVoidIPtr cb = new AMI_MyClass_opVoidI;
- p->opVoid_async(cb);
- test(cb->check());
- // Let's check if we can reuse the same callback object for another call.
- p->opVoid_async(cb);
- test(cb->check());
+ AMI_MyClass_opVoidIPtr cb = new AMI_MyClass_opVoidI;
+ p->opVoid_async(cb);
+ test(cb->check());
+ // Let's check if we can reuse the same callback object for another call.
+ p->opVoid_async(cb);
+ test(cb->check());
}
{
- AMI_MyClass_opByteIPtr cb = new AMI_MyClass_opByteI;
- p->opByte_async(cb, Ice::Byte(0xff), Ice::Byte(0x0f));
- test(cb->check());
+ AMI_MyClass_opByteIPtr cb = new AMI_MyClass_opByteI;
+ p->opByte_async(cb, Ice::Byte(0xff), Ice::Byte(0x0f));
+ test(cb->check());
}
{
- AMI_MyClass_opBoolIPtr cb = new AMI_MyClass_opBoolI;
- p->opBool_async(cb, true, false);
- test(cb->check());
+ AMI_MyClass_opBoolIPtr cb = new AMI_MyClass_opBoolI;
+ p->opBool_async(cb, true, false);
+ test(cb->check());
}
{
- AMI_MyClass_opShortIntLongIPtr cb = new AMI_MyClass_opShortIntLongI;
- p->opShortIntLong_async(cb, 10, 11, 12);
- test(cb->check());
+ AMI_MyClass_opShortIntLongIPtr cb = new AMI_MyClass_opShortIntLongI;
+ p->opShortIntLong_async(cb, 10, 11, 12);
+ test(cb->check());
}
{
- AMI_MyClass_opFloatDoubleIPtr cb = new AMI_MyClass_opFloatDoubleI;
- p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));
- test(cb->check());
- // Let's check if we can reuse the same callback object for another call.
- p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));
- test(cb->check());
+ AMI_MyClass_opFloatDoubleIPtr cb = new AMI_MyClass_opFloatDoubleI;
+ p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));
+ test(cb->check());
+ // Let's check if we can reuse the same callback object for another call.
+ p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));
+ test(cb->check());
}
{
- AMI_MyClass_opStringIPtr cb = new AMI_MyClass_opStringI;
- p->opString_async(cb, "hello", "world");
- test(cb->check());
+ AMI_MyClass_opStringIPtr cb = new AMI_MyClass_opStringI;
+ p->opString_async(cb, "hello", "world");
+ test(cb->check());
}
{
- AMI_MyClass_opMyEnumIPtr cb = new AMI_MyClass_opMyEnumI;
- p->opMyEnum_async(cb, Test::enum2);
- test(cb->check());
+ AMI_MyClass_opMyEnumIPtr cb = new AMI_MyClass_opMyEnumI;
+ p->opMyEnum_async(cb, Test::enum2);
+ test(cb->check());
}
{
- AMI_MyClass_opMyClassIPtr cb = new AMI_MyClass_opMyClassI(communicator);
- p->opMyClass_async(cb, p);
- test(cb->check());
+ AMI_MyClass_opMyClassIPtr cb = new AMI_MyClass_opMyClassI(communicator);
+ p->opMyClass_async(cb, p);
+ test(cb->check());
}
{
- Test::Structure si1;
- si1.p = p;
- si1.e = Test::enum3;
- si1.s.s = "abc";
- Test::Structure si2;
- si2.p = 0;
- si2.e = Test::enum2;
- si2.s.s = "def";
-
- AMI_MyClass_opStructIPtr cb = new AMI_MyClass_opStructI(communicator);
- p->opStruct_async(cb, si1, si2);
- test(cb->check());
+ Test::Structure si1;
+ si1.p = p;
+ si1.e = Test::enum3;
+ si1.s.s = "abc";
+ Test::Structure si2;
+ si2.p = 0;
+ si2.e = Test::enum2;
+ si2.s.s = "def";
+
+ AMI_MyClass_opStructIPtr cb = new AMI_MyClass_opStructI(communicator);
+ p->opStruct_async(cb, si1, si2);
+ test(cb->check());
}
{
- Test::ByteS bsi1;
- Test::ByteS bsi2;
+ Test::ByteS bsi1;
+ Test::ByteS bsi2;
- bsi1.push_back(Ice::Byte(0x01));
- bsi1.push_back(Ice::Byte(0x11));
- bsi1.push_back(Ice::Byte(0x12));
- bsi1.push_back(Ice::Byte(0x22));
+ bsi1.push_back(Ice::Byte(0x01));
+ bsi1.push_back(Ice::Byte(0x11));
+ bsi1.push_back(Ice::Byte(0x12));
+ bsi1.push_back(Ice::Byte(0x22));
- bsi2.push_back(Ice::Byte(0xf1));
- bsi2.push_back(Ice::Byte(0xf2));
- bsi2.push_back(Ice::Byte(0xf3));
- bsi2.push_back(Ice::Byte(0xf4));
+ bsi2.push_back(Ice::Byte(0xf1));
+ bsi2.push_back(Ice::Byte(0xf2));
+ bsi2.push_back(Ice::Byte(0xf3));
+ bsi2.push_back(Ice::Byte(0xf4));
- AMI_MyClass_opByteSIPtr cb = new AMI_MyClass_opByteSI;
- p->opByteS_async(cb, bsi1, bsi2);
- test(cb->check());
+ AMI_MyClass_opByteSIPtr cb = new AMI_MyClass_opByteSI;
+ p->opByteS_async(cb, bsi1, bsi2);
+ test(cb->check());
}
{
- Test::BoolS bsi1;
- Test::BoolS bsi2;
+ Test::BoolS bsi1;
+ Test::BoolS bsi2;
- bsi1.push_back(true);
- bsi1.push_back(true);
- bsi1.push_back(false);
+ bsi1.push_back(true);
+ bsi1.push_back(true);
+ bsi1.push_back(false);
- bsi2.push_back(false);
+ bsi2.push_back(false);
- AMI_MyClass_opBoolSIPtr cb = new AMI_MyClass_opBoolSI;
- p->opBoolS_async(cb, bsi1, bsi2);
- test(cb->check());
+ AMI_MyClass_opBoolSIPtr cb = new AMI_MyClass_opBoolSI;
+ p->opBoolS_async(cb, bsi1, bsi2);
+ test(cb->check());
}
{
- Test::ShortS ssi;
- Test::IntS isi;
- Test::LongS lsi;
+ Test::ShortS ssi;
+ Test::IntS isi;
+ Test::LongS lsi;
- ssi.push_back(1);
- ssi.push_back(2);
- ssi.push_back(3);
+ ssi.push_back(1);
+ ssi.push_back(2);
+ ssi.push_back(3);
- isi.push_back(5);
- isi.push_back(6);
- isi.push_back(7);
- isi.push_back(8);
+ isi.push_back(5);
+ isi.push_back(6);
+ isi.push_back(7);
+ isi.push_back(8);
- lsi.push_back(10);
- lsi.push_back(30);
- lsi.push_back(20);
+ lsi.push_back(10);
+ lsi.push_back(30);
+ lsi.push_back(20);
- AMI_MyClass_opShortIntLongSIPtr cb = new AMI_MyClass_opShortIntLongSI;
- p->opShortIntLongS_async(cb, ssi, isi, lsi);
- test(cb->check());
+ AMI_MyClass_opShortIntLongSIPtr cb = new AMI_MyClass_opShortIntLongSI;
+ p->opShortIntLongS_async(cb, ssi, isi, lsi);
+ test(cb->check());
}
{
- Test::FloatS fsi;
- Test::DoubleS dsi;
+ Test::FloatS fsi;
+ Test::DoubleS dsi;
- fsi.push_back(Ice::Float(3.14));
- fsi.push_back(Ice::Float(1.11));
+ fsi.push_back(Ice::Float(3.14));
+ fsi.push_back(Ice::Float(1.11));
- dsi.push_back(Ice::Double(1.1E10));
- dsi.push_back(Ice::Double(1.2E10));
- dsi.push_back(Ice::Double(1.3E10));
+ dsi.push_back(Ice::Double(1.1E10));
+ dsi.push_back(Ice::Double(1.2E10));
+ dsi.push_back(Ice::Double(1.3E10));
- AMI_MyClass_opFloatDoubleSIPtr cb = new AMI_MyClass_opFloatDoubleSI;
- p->opFloatDoubleS_async(cb, fsi, dsi);
- test(cb->check());
+ AMI_MyClass_opFloatDoubleSIPtr cb = new AMI_MyClass_opFloatDoubleSI;
+ p->opFloatDoubleS_async(cb, fsi, dsi);
+ test(cb->check());
}
{
- Test::StringS ssi1;
- Test::StringS ssi2;
+ Test::StringS ssi1;
+ Test::StringS ssi2;
- ssi1.push_back("abc");
- ssi1.push_back("de");
- ssi1.push_back("fghi");
+ ssi1.push_back("abc");
+ ssi1.push_back("de");
+ ssi1.push_back("fghi");
- ssi2.push_back("xyz");
+ ssi2.push_back("xyz");
- AMI_MyClass_opStringSIPtr cb = new AMI_MyClass_opStringSI;
- p->opStringS_async(cb, ssi1, ssi2);
- test(cb->check());
+ AMI_MyClass_opStringSIPtr cb = new AMI_MyClass_opStringSI;
+ p->opStringS_async(cb, ssi1, ssi2);
+ test(cb->check());
}
{
- Test::ByteSS bsi1;
- bsi1.resize(2);
- Test::ByteSS bsi2;
- bsi2.resize(2);
+ Test::ByteSS bsi1;
+ bsi1.resize(2);
+ Test::ByteSS bsi2;
+ bsi2.resize(2);
- bsi1[0].push_back(Ice::Byte(0x01));
- bsi1[0].push_back(Ice::Byte(0x11));
- bsi1[0].push_back(Ice::Byte(0x12));
- bsi1[1].push_back(Ice::Byte(0xff));
+ bsi1[0].push_back(Ice::Byte(0x01));
+ bsi1[0].push_back(Ice::Byte(0x11));
+ bsi1[0].push_back(Ice::Byte(0x12));
+ bsi1[1].push_back(Ice::Byte(0xff));
- bsi2[0].push_back(Ice::Byte(0x0e));
- bsi2[1].push_back(Ice::Byte(0xf2));
- bsi2[1].push_back(Ice::Byte(0xf1));
+ bsi2[0].push_back(Ice::Byte(0x0e));
+ bsi2[1].push_back(Ice::Byte(0xf2));
+ bsi2[1].push_back(Ice::Byte(0xf1));
- AMI_MyClass_opByteSSIPtr cb = new AMI_MyClass_opByteSSI;
- p->opByteSS_async(cb, bsi1, bsi2);
- test(cb->check());
+ AMI_MyClass_opByteSSIPtr cb = new AMI_MyClass_opByteSSI;
+ p->opByteSS_async(cb, bsi1, bsi2);
+ test(cb->check());
}
{
- Test::FloatSS fsi;
- fsi.resize(3);
- Test::DoubleSS dsi;
- dsi.resize(1);
+ Test::FloatSS fsi;
+ fsi.resize(3);
+ Test::DoubleSS dsi;
+ dsi.resize(1);
- fsi[0].push_back(Ice::Float(3.14));
- fsi[1].push_back(Ice::Float(1.11));
+ fsi[0].push_back(Ice::Float(3.14));
+ fsi[1].push_back(Ice::Float(1.11));
- dsi[0].push_back(Ice::Double(1.1E10));
- dsi[0].push_back(Ice::Double(1.2E10));
- dsi[0].push_back(Ice::Double(1.3E10));
+ dsi[0].push_back(Ice::Double(1.1E10));
+ dsi[0].push_back(Ice::Double(1.2E10));
+ dsi[0].push_back(Ice::Double(1.3E10));
- AMI_MyClass_opFloatDoubleSSIPtr cb = new AMI_MyClass_opFloatDoubleSSI;
- p->opFloatDoubleSS_async(cb, fsi, dsi);
- test(cb->check());
+ AMI_MyClass_opFloatDoubleSSIPtr cb = new AMI_MyClass_opFloatDoubleSSI;
+ p->opFloatDoubleSS_async(cb, fsi, dsi);
+ test(cb->check());
}
{
- Test::StringSS ssi1;
- ssi1.resize(2);
- Test::StringSS ssi2;
- ssi2.resize(3);
+ Test::StringSS ssi1;
+ ssi1.resize(2);
+ Test::StringSS ssi2;
+ ssi2.resize(3);
- ssi1[0].push_back("abc");
- ssi1[1].push_back("de");
- ssi1[1].push_back("fghi");
+ ssi1[0].push_back("abc");
+ ssi1[1].push_back("de");
+ ssi1[1].push_back("fghi");
- ssi2[2].push_back("xyz");
+ ssi2[2].push_back("xyz");
- AMI_MyClass_opStringSSIPtr cb = new AMI_MyClass_opStringSSI;
- p->opStringSS_async(cb, ssi1, ssi2);
- test(cb->check());
+ AMI_MyClass_opStringSSIPtr cb = new AMI_MyClass_opStringSSI;
+ p->opStringSS_async(cb, ssi1, ssi2);
+ test(cb->check());
}
{
- Test::ByteBoolD di1;
- di1[10] = true;
- di1[100] = false;
- Test::ByteBoolD di2;
- di2[10] = true;
- di2[11] = false;
- di2[101] = true;
+ Test::ByteBoolD di1;
+ di1[10] = true;
+ di1[100] = false;
+ Test::ByteBoolD di2;
+ di2[10] = true;
+ di2[11] = false;
+ di2[101] = true;
- AMI_MyClass_opByteBoolDIPtr cb = new AMI_MyClass_opByteBoolDI;
- p->opByteBoolD_async(cb, di1, di2);
- test(cb->check());
+ AMI_MyClass_opByteBoolDIPtr cb = new AMI_MyClass_opByteBoolDI;
+ p->opByteBoolD_async(cb, di1, di2);
+ test(cb->check());
}
{
- Test::ShortIntD di1;
- di1[110] = -1;
- di1[1100] = 123123;
- Test::ShortIntD di2;
- di2[110] = -1;
- di2[111] = -100;
- di2[1101] = 0;
+ Test::ShortIntD di1;
+ di1[110] = -1;
+ di1[1100] = 123123;
+ Test::ShortIntD di2;
+ di2[110] = -1;
+ di2[111] = -100;
+ di2[1101] = 0;
- AMI_MyClass_opShortIntDIPtr cb = new AMI_MyClass_opShortIntDI;
- p->opShortIntD_async(cb, di1, di2);
- test(cb->check());
+ AMI_MyClass_opShortIntDIPtr cb = new AMI_MyClass_opShortIntDI;
+ p->opShortIntD_async(cb, di1, di2);
+ test(cb->check());
}
{
- Test::LongFloatD di1;
- di1[999999110] = Ice::Float(-1.1);
- di1[999999111] = Ice::Float(123123.2);
- Test::LongFloatD di2;
- di2[999999110] = Ice::Float(-1.1);
- di2[999999120] = Ice::Float(-100.4);
- di2[999999130] = Ice::Float(0.5);
+ Test::LongFloatD di1;
+ di1[999999110] = Ice::Float(-1.1);
+ di1[999999111] = Ice::Float(123123.2);
+ Test::LongFloatD di2;
+ di2[999999110] = Ice::Float(-1.1);
+ di2[999999120] = Ice::Float(-100.4);
+ di2[999999130] = Ice::Float(0.5);
- AMI_MyClass_opLongFloatDIPtr cb = new AMI_MyClass_opLongFloatDI;
- p->opLongFloatD_async(cb, di1, di2);
- test(cb->check());
+ AMI_MyClass_opLongFloatDIPtr cb = new AMI_MyClass_opLongFloatDI;
+ p->opLongFloatD_async(cb, di1, di2);
+ test(cb->check());
}
{
- Test::StringStringD di1;
- di1["foo"] = "abc -1.1";
- di1["bar"] = "abc 123123.2";
- Test::StringStringD di2;
- di2["foo"] = "abc -1.1";
- di2["FOO"] = "abc -100.4";
- di2["BAR"] = "abc 0.5";
+ Test::StringStringD di1;
+ di1["foo"] = "abc -1.1";
+ di1["bar"] = "abc 123123.2";
+ Test::StringStringD di2;
+ di2["foo"] = "abc -1.1";
+ di2["FOO"] = "abc -100.4";
+ di2["BAR"] = "abc 0.5";
- AMI_MyClass_opStringStringDIPtr cb = new AMI_MyClass_opStringStringDI;
- p->opStringStringD_async(cb, di1, di2);
- test(cb->check());
+ AMI_MyClass_opStringStringDIPtr cb = new AMI_MyClass_opStringStringDI;
+ p->opStringStringD_async(cb, di1, di2);
+ test(cb->check());
}
{
- Test::StringMyEnumD di1;
- di1["abc"] = Test::enum1;
- di1[""] = Test::enum2;
- Test::StringMyEnumD di2;
- di2["abc"] = Test::enum1;
- di2["qwerty"] = Test::enum3;
- di2["Hello!!"] = Test::enum2;
-
- AMI_MyClass_opStringMyEnumDIPtr cb = new AMI_MyClass_opStringMyEnumDI;
- p->opStringMyEnumD_async(cb, di1, di2);
- test(cb->check());
- }
+ Test::StringMyEnumD di1;
+ di1["abc"] = Test::enum1;
+ di1[""] = Test::enum2;
+ Test::StringMyEnumD di2;
+ di2["abc"] = Test::enum1;
+ di2["qwerty"] = Test::enum3;
+ di2["Hello!!"] = Test::enum2;
+
+ AMI_MyClass_opStringMyEnumDIPtr cb = new AMI_MyClass_opStringMyEnumDI;
+ p->opStringMyEnumD_async(cb, di1, di2);
+ test(cb->check());
+ }
{
- const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
-
- for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
- {
- Test::IntS s;
- for(int i = 0; i < lengths[l]; ++i)
- {
- s.push_back(i);
- }
- AMI_MyClass_opIntSIPtr cb = new AMI_MyClass_opIntSI(lengths[l]);
- p->opIntS_async(cb, s);
- test(cb->check());
- }
- }
-
- {
- Test::StringStringD ctx;
- ctx["one"] = "ONE";
- ctx["two"] = "TWO";
- ctx["three"] = "THREE";
- {
- test(p->ice_getContext().empty());
- AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(ctx);
- p->opContext_async(cb);
- test(cb->check());
- }
- {
- test(p->ice_getContext().empty());
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p->opContext_async(cb, ctx);
- test(cb->check());
- }
- Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
- test(p2->ice_getContext() == ctx);
- {
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p2->opContext_async(cb);
- test(cb->check());
- }
- {
- Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p2->opContext_async(cb, ctx);
- test(cb->check());
- }
-
- {
- //
- // Test that default context is obtained correctly from communicator.
- //
+ const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
+ {
+ Test::IntS s;
+ for(int i = 0; i < lengths[l]; ++i)
+ {
+ s.push_back(i);
+ }
+ AMI_MyClass_opIntSIPtr cb = new AMI_MyClass_opIntSI(lengths[l]);
+ p->opIntS_async(cb, s);
+ test(cb->check());
+ }
+ }
+
+ {
+ Test::StringStringD ctx;
+ ctx["one"] = "ONE";
+ ctx["two"] = "TWO";
+ ctx["three"] = "THREE";
+ {
+ test(p->ice_getContext().empty());
+ AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(ctx);
+ p->opContext_async(cb);
+ test(cb->check());
+ }
+ {
+ test(p->ice_getContext().empty());
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
+ p->opContext_async(cb, ctx);
+ test(cb->check());
+ }
+ Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
+ test(p2->ice_getContext() == ctx);
+ {
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
+ p2->opContext_async(cb);
+ test(cb->check());
+ }
+ {
+ Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
+ p2->opContext_async(cb, ctx);
+ test(cb->check());
+ }
+
+ {
+ //
+ // Test that default context is obtained correctly from communicator.
+ //
/* DEPRECATED
- Ice::Context dflt;
- dflt["a"] = "b";
- communicator->setDefaultContext(dflt);
- {
- AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(dflt);
- p->opContext_async(cb);
- test(cb->check());
- }
-
- Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context()));
- {
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(Ice::Context());
- p2->opContext_async(cb);
- test(cb->check());
- }
-
- p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext());
- {
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(dflt);
- p2->opContext_async(cb);
- test(cb->check());
- }
-
- communicator->setDefaultContext(Ice::Context());
- {
- AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(Ice::Context());
- p2->opContext_async(cb);
- test(cb->check());
- }
-
- communicator->setDefaultContext(dflt);
- Test::MyClassPrx c = Test::MyClassPrx::checkedCast(
- communicator->stringToProxy("test:default -p 12010 -t 10000"));
- {
- Ice::Context tmp;
- tmp["a"] = "b";
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
- c->opContext_async(cb);
- test(cb->check());
- }
-
- dflt["a"] = "c";
- Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt));
- {
- Ice::Context tmp;
- tmp["a"] = "c";
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
- c2->opContext_async(cb);
- test(cb->check());
- }
-
- dflt.clear();
- Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt));
- {
- Ice::Context tmp;
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
- c3->opContext_async(cb);
- test(cb->check());
- }
-
- Test::MyClassPrx c4 = Test::MyClassPrx::uncheckedCast(c2->ice_defaultContext());
- {
- Ice::Context tmp;
- tmp["a"] = "b";
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
- c4->opContext_async(cb);
- test(cb->check());
- }
-
- dflt["a"] = "d";
- communicator->setDefaultContext(dflt);
-
- Test::MyClassPrx c5 = Test::MyClassPrx::uncheckedCast(c->ice_defaultContext());
- {
- Ice::Context tmp;
- tmp["a"] = "d";
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
- c5->opContext_async(cb);
- test(cb->check());
- }
-
- communicator->setDefaultContext(Ice::Context());
+ Ice::Context dflt;
+ dflt["a"] = "b";
+ communicator->setDefaultContext(dflt);
+ {
+ AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(dflt);
+ p->opContext_async(cb);
+ test(cb->check());
+ }
+
+ Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context()));
+ {
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(Ice::Context());
+ p2->opContext_async(cb);
+ test(cb->check());
+ }
+
+ p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext());
+ {
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(dflt);
+ p2->opContext_async(cb);
+ test(cb->check());
+ }
+
+ communicator->setDefaultContext(Ice::Context());
+ {
+ AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(Ice::Context());
+ p2->opContext_async(cb);
+ test(cb->check());
+ }
+
+ communicator->setDefaultContext(dflt);
+ Test::MyClassPrx c = Test::MyClassPrx::checkedCast(
+ communicator->stringToProxy("test:default -p 12010 -t 10000"));
+ {
+ Ice::Context tmp;
+ tmp["a"] = "b";
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
+ c->opContext_async(cb);
+ test(cb->check());
+ }
+
+ dflt["a"] = "c";
+ Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt));
+ {
+ Ice::Context tmp;
+ tmp["a"] = "c";
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
+ c2->opContext_async(cb);
+ test(cb->check());
+ }
+
+ dflt.clear();
+ Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt));
+ {
+ Ice::Context tmp;
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
+ c3->opContext_async(cb);
+ test(cb->check());
+ }
+
+ Test::MyClassPrx c4 = Test::MyClassPrx::uncheckedCast(c2->ice_defaultContext());
+ {
+ Ice::Context tmp;
+ tmp["a"] = "b";
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
+ c4->opContext_async(cb);
+ test(cb->check());
+ }
+
+ dflt["a"] = "d";
+ communicator->setDefaultContext(dflt);
+
+ Test::MyClassPrx c5 = Test::MyClassPrx::uncheckedCast(c->ice_defaultContext());
+ {
+ Ice::Context tmp;
+ tmp["a"] = "d";
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp);
+ c5->opContext_async(cb);
+ test(cb->check());
+ }
+
+ communicator->setDefaultContext(Ice::Context());
*/
- }
-
- {
- //
- // Test implicit context propagation
- //
-
- string impls[] = {"Shared", "SharedWithoutLocking", "PerThread"};
- for(int i = 0; i < 3; i++)
- {
- Ice::InitializationData initData;
- initData.properties = communicator->getProperties()->clone();
- initData.properties->setProperty("Ice.ImplicitContext", impls[i]);
-
- Ice::CommunicatorPtr ic = Ice::initialize(initData);
-
- Ice::Context ctx;
- ctx["one"] = "ONE";
- ctx["two"] = "TWO";
- ctx["three"] = "THREE";
-
-
- Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(
- ic->stringToProxy("test:default -p 12010 -t 10000"));
-
-
- ic->getImplicitContext()->setContext(ctx);
- test(ic->getImplicitContext()->getContext() == ctx);
- {
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p->opContext_async(cb);
- test(cb->check());
- }
-
- ic->getImplicitContext()->set("zero", "ZERO");
- test(ic->getImplicitContext()->get("zero") == "ZERO");
- test(ic->getImplicitContext()->getWithDefault("foobar", "foo") == "foo");
-
- ctx = ic->getImplicitContext()->getContext();
- {
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p->opContext_async(cb);
- test(cb->check());
- }
-
- Ice::Context prxContext;
- prxContext["one"] = "UN";
- prxContext["four"] = "QUATRE";
-
- Ice::Context combined = prxContext;
- combined.insert(ctx.begin(), ctx.end());
- test(combined["one"] == "UN");
-
- p = Test::MyClassPrx::uncheckedCast(p->ice_context(prxContext));
-
- ic->getImplicitContext()->setContext(Ice::Context());
- {
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(prxContext);
- p->opContext_async(cb);
- test(cb->check());
- }
-
- ic->getImplicitContext()->setContext(ctx);
- {
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(combined);
- p->opContext_async(cb);
- test(cb->check());
- }
-
- ic->destroy();
- }
- }
+ }
+
+ {
+ //
+ // Test implicit context propagation
+ //
+
+ string impls[] = {"Shared", "SharedWithoutLocking", "PerThread"};
+ for(int i = 0; i < 3; i++)
+ {
+ Ice::InitializationData initData;
+ initData.properties = communicator->getProperties()->clone();
+ initData.properties->setProperty("Ice.ImplicitContext", impls[i]);
+
+ Ice::CommunicatorPtr ic = Ice::initialize(initData);
+
+ Ice::Context ctx;
+ ctx["one"] = "ONE";
+ ctx["two"] = "TWO";
+ ctx["three"] = "THREE";
+
+
+ Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(
+ ic->stringToProxy("test:default -p 12010 -t 10000"));
+
+
+ ic->getImplicitContext()->setContext(ctx);
+ test(ic->getImplicitContext()->getContext() == ctx);
+ {
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
+ p->opContext_async(cb);
+ test(cb->check());
+ }
+
+ ic->getImplicitContext()->set("zero", "ZERO");
+ test(ic->getImplicitContext()->get("zero") == "ZERO");
+ test(ic->getImplicitContext()->getWithDefault("foobar", "foo") == "foo");
+
+ ctx = ic->getImplicitContext()->getContext();
+ {
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
+ p->opContext_async(cb);
+ test(cb->check());
+ }
+
+ Ice::Context prxContext;
+ prxContext["one"] = "UN";
+ prxContext["four"] = "QUATRE";
+
+ Ice::Context combined = prxContext;
+ combined.insert(ctx.begin(), ctx.end());
+ test(combined["one"] == "UN");
+
+ p = Test::MyClassPrx::uncheckedCast(p->ice_context(prxContext));
+
+ ic->getImplicitContext()->setContext(Ice::Context());
+ {
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(prxContext);
+ p->opContext_async(cb);
+ test(cb->check());
+ }
+
+ ic->getImplicitContext()->setContext(ctx);
+ {
+ AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(combined);
+ p->opContext_async(cb);
+ test(cb->check());
+ }
+
+ ic->destroy();
+ }
+ }
}
{
Ice::Double d = 1278312346.0 / 13.0;
- Test::DoubleS ds(5, d);
- AMI_MyClass_opDoubleMarshalingIPtr cb = new AMI_MyClass_opDoubleMarshalingI;
- p->opDoubleMarshaling_async(cb, d, ds);
- test(cb->check());
+ Test::DoubleS ds(5, d);
+ AMI_MyClass_opDoubleMarshalingIPtr cb = new AMI_MyClass_opDoubleMarshalingI;
+ p->opDoubleMarshaling_async(cb, d, ds);
+ test(cb->check());
}
{
- Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p);
- test(derived);
- AMI_MyDerivedClass_opDerivedIPtr cb = new AMI_MyDerivedClass_opDerivedI;
- derived->opDerived_async(cb);
- test(cb->check());
+ Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p);
+ test(derived);
+ AMI_MyDerivedClass_opDerivedIPtr cb = new AMI_MyDerivedClass_opDerivedI;
+ derived->opDerived_async(cb);
+ test(cb->check());
}
}
diff --git a/cpp/test/Ice/retry/AllTests.cpp b/cpp/test/Ice/retry/AllTests.cpp
index 9e9c9f353fb..4ebb0915d56 100644
--- a/cpp/test/Ice/retry/AllTests.cpp
+++ b/cpp/test/Ice/retry/AllTests.cpp
@@ -19,7 +19,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -29,26 +29,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -62,12 +62,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
@@ -79,13 +79,13 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(dynamic_cast<const Ice::ConnectionLostException*>(&ex));
- called();
+ test(dynamic_cast<const Ice::ConnectionLostException*>(&ex));
+ called();
}
};
@@ -118,12 +118,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "calling operation to kill connection with second proxy... " << flush;
try
{
- retry2->op(true);
- test(false);
+ retry2->op(true);
+ test(false);
}
catch(Ice::ConnectionLostException)
{
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
cout << "calling regular operation with first proxy again... " << flush;
diff --git a/cpp/test/Ice/retry/Client.cpp b/cpp/test/Ice/retry/Client.cpp
index cd47cb999cc..17cad12407f 100644
--- a/cpp/test/Ice/retry/Client.cpp
+++ b/cpp/test/Ice/retry/Client.cpp
@@ -31,38 +31,38 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
- //
- // For this test, we want to disable retries.
- //
- initData.properties->setProperty("Ice.RetryIntervals", "-1");
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties->setProperty("Ice.RetryIntervals", "-1");
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception&)
{
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/retry/Server.cpp b/cpp/test/Ice/retry/Server.cpp
index 628bd83a2c2..2fc3aa5d171 100644
--- a/cpp/test/Ice/retry/Server.cpp
+++ b/cpp/test/Ice/retry/Server.cpp
@@ -32,26 +32,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/retry/TestI.cpp b/cpp/test/Ice/retry/TestI.cpp
index e8c05542146..3bd0d68364d 100644
--- a/cpp/test/Ice/retry/TestI.cpp
+++ b/cpp/test/Ice/retry/TestI.cpp
@@ -15,7 +15,7 @@ RetryI::op(bool kill, const Ice::Current& current)
{
if(kill)
{
- current.con->close(true);
+ current.con->close(true);
}
}
diff --git a/cpp/test/Ice/servantLocator/AllTests.cpp b/cpp/test/Ice/servantLocator/AllTests.cpp
index 36f9fecf4d1..cbfda04dcd1 100644
--- a/cpp/test/Ice/servantLocator/AllTests.cpp
+++ b/cpp/test/Ice/servantLocator/AllTests.cpp
@@ -21,121 +21,121 @@ testExceptions(const TestIntfPrx& obj, bool collocated)
{
try
{
- obj->requestFailedException();
- test(false);
+ obj->requestFailedException();
+ test(false);
}
catch(const ObjectNotExistException& ex)
{
- if(!collocated)
- {
- test(ex.id == obj->ice_getIdentity());
- test(ex.facet == obj->ice_getFacet());
- test(ex.operation == "requestFailedException");
- }
+ if(!collocated)
+ {
+ test(ex.id == obj->ice_getIdentity());
+ test(ex.facet == obj->ice_getFacet());
+ test(ex.operation == "requestFailedException");
+ }
}
try
{
- obj->unknownUserException();
- test(false);
+ obj->unknownUserException();
+ test(false);
}
catch(const UnknownUserException& ex)
{
- test(ex.unknown == "reason");
+ test(ex.unknown == "reason");
}
try
{
- obj->unknownLocalException();
- test(false);
+ obj->unknownLocalException();
+ test(false);
}
catch(const UnknownLocalException& ex)
{
- test(ex.unknown == "reason");
+ test(ex.unknown == "reason");
}
try
{
- obj->unknownException();
- test(false);
+ obj->unknownException();
+ test(false);
}
catch(const UnknownException& ex)
{
- test(ex.unknown == "reason");
+ test(ex.unknown == "reason");
}
try
{
- obj->userException();
- test(false);
+ obj->userException();
+ test(false);
}
catch(const UnknownUserException& ex)
{
- //cerr << ex.unknown << endl;
- test(!collocated);
- test(ex.unknown == "Test::TestIntfUserException");
+ //cerr << ex.unknown << endl;
+ test(!collocated);
+ test(ex.unknown == "Test::TestIntfUserException");
}
catch(const TestIntfUserException&)
{
- test(collocated);
+ test(collocated);
}
try
{
- obj->localException();
- test(false);
+ obj->localException();
+ test(false);
}
catch(const UnknownLocalException& ex)
{
- //cerr << ex.unknown << endl;
- test(!collocated);
- test(ex.unknown.find("Ice::SocketException:\nsocket exception: unknown error") != string::npos);
+ //cerr << ex.unknown << endl;
+ test(!collocated);
+ test(ex.unknown.find("Ice::SocketException:\nsocket exception: unknown error") != string::npos);
}
catch(const SocketException&)
{
- test(collocated);
+ test(collocated);
}
try
{
- obj->stdException();
- test(false);
+ obj->stdException();
+ test(false);
}
catch(const UnknownException& ex)
{
- //cerr << ex.unknown << endl;
- test(!collocated);
- test(ex.unknown == "std::exception: Hello");
+ //cerr << ex.unknown << endl;
+ test(!collocated);
+ test(ex.unknown == "std::exception: Hello");
}
catch(const std::runtime_error&)
{
- test(collocated);
+ test(collocated);
}
try
{
- obj->cppException();
- test(false);
+ obj->cppException();
+ test(false);
}
catch(const UnknownException& ex)
{
- //cerr << ex.unknown << endl;
- test(!collocated);
- test(ex.unknown == "unknown c++ exception");
+ //cerr << ex.unknown << endl;
+ test(!collocated);
+ test(ex.unknown == "unknown c++ exception");
}
catch(const int&)
{
- test(collocated);
+ test(collocated);
}
try
{
- obj->unknownExceptionWithServantException();
- test(false);
+ obj->unknownExceptionWithServantException();
+ test(false);
}
catch(const UnknownException& ex)
{
- test(ex.unknown == "reason");
+ test(ex.unknown == "reason");
}
}
@@ -158,7 +158,7 @@ allTests(const CommunicatorPtr& communicator, bool collocated)
obj = TestIntfPrx::checkedCast(base);
try
{
- TestIntfPrx::checkedCast(communicator->stringToProxy("category/unknown:default -p 12010 -t 10000"));
+ TestIntfPrx::checkedCast(communicator->stringToProxy("category/unknown:default -p 12010 -t 10000"));
}
catch(const ObjectNotExistException&)
{
@@ -172,14 +172,14 @@ allTests(const CommunicatorPtr& communicator, bool collocated)
obj = TestIntfPrx::checkedCast(base);
try
{
- TestIntfPrx::checkedCast(communicator->stringToProxy("anothercategory/unknown:default -p 12010 -t 10000"));
+ TestIntfPrx::checkedCast(communicator->stringToProxy("anothercategory/unknown:default -p 12010 -t 10000"));
}
catch(const ObjectNotExistException&)
{
}
try
{
- TestIntfPrx::checkedCast(communicator->stringToProxy("unknown:default -p 12010 -t 10000"));
+ TestIntfPrx::checkedCast(communicator->stringToProxy("unknown:default -p 12010 -t 10000"));
}
catch(const Ice::ObjectNotExistException&)
{
diff --git a/cpp/test/Ice/servantLocator/Collocated.cpp b/cpp/test/Ice/servantLocator/Collocated.cpp
index fec4143c667..53348a0799e 100644
--- a/cpp/test/Ice/servantLocator/Collocated.cpp
+++ b/cpp/test/Ice/servantLocator/Collocated.cpp
@@ -29,22 +29,22 @@ protected:
virtual Ice::ObjectPtr
newServantAndCookie(Ice::LocalObjectPtr& cookie) const
{
- cookie = new CookieI();
- return new TestI();
+ cookie = new CookieI();
+ return new TestI();
}
virtual void
checkCookie(const Ice::LocalObjectPtr& cookie) const
{
- Test::CookiePtr co = Test::CookiePtr::dynamicCast(cookie);
- test(co);
- test(co->message() == "blahblah");
+ Test::CookiePtr co = Test::CookiePtr::dynamicCast(cookie);
+ test(co);
+ test(co->message() == "blahblah");
}
virtual void
throwTestIntfUserException() const
{
- throw Test::TestIntfUserException();
+ throw Test::TestIntfUserException();
}
};
diff --git a/cpp/test/Ice/servantLocator/ServantLocatorI.cpp b/cpp/test/Ice/servantLocator/ServantLocatorI.cpp
index 4b51ac1cf29..93727d24be1 100644
--- a/cpp/test/Ice/servantLocator/ServantLocatorI.cpp
+++ b/cpp/test/Ice/servantLocator/ServantLocatorI.cpp
@@ -35,13 +35,13 @@ ServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie
if(current.id.name == "unknown")
{
- return 0;
+ return 0;
}
test(current.id.name == "locate" || current.id.name == "finished");
if(current.id.name == "locate")
{
- exception(current);
+ exception(current);
}
return newServantAndCookie(cookie);
@@ -49,7 +49,7 @@ ServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie
void
ServantLocatorI::finished(const Ice::Current& current, const Ice::ObjectPtr& servant,
- const Ice::LocalObjectPtr& cookie)
+ const Ice::LocalObjectPtr& cookie)
{
test(!_deactivated);
test(current.id.category == _category || _category.empty());
@@ -57,7 +57,7 @@ ServantLocatorI::finished(const Ice::Current& current, const Ice::ObjectPtr& ser
if(current.id.name == "finished")
{
- exception(current);
+ exception(current);
}
checkCookie(cookie);
@@ -76,38 +76,38 @@ ServantLocatorI::exception(const Ice::Current& current)
{
if(current.operation == "requestFailedException")
{
- throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
else if(current.operation == "unknownUserException")
{
- throw UnknownUserException(__FILE__, __LINE__, "reason");
+ throw UnknownUserException(__FILE__, __LINE__, "reason");
}
else if(current.operation == "unknownLocalException")
{
- throw UnknownLocalException(__FILE__, __LINE__, "reason");
+ throw UnknownLocalException(__FILE__, __LINE__, "reason");
}
else if(current.operation == "unknownException")
{
- throw UnknownException(__FILE__, __LINE__, "reason");
+ throw UnknownException(__FILE__, __LINE__, "reason");
}
else if(current.operation == "userException")
{
- throwTestIntfUserException();
+ throwTestIntfUserException();
}
else if(current.operation == "localException")
{
- throw Ice::SocketException(__FILE__, __LINE__, 0);
+ throw Ice::SocketException(__FILE__, __LINE__, 0);
}
else if(current.operation == "stdException")
{
- throw std::runtime_error("Hello");
+ throw std::runtime_error("Hello");
}
else if(current.operation == "cppException")
{
- throw 5;
+ throw 5;
}
else if(current.operation == "unknownExceptionWithServantException")
{
- throw UnknownException(__FILE__, __LINE__, "reason");
+ throw UnknownException(__FILE__, __LINE__, "reason");
}
}
diff --git a/cpp/test/Ice/servantLocator/Server.cpp b/cpp/test/Ice/servantLocator/Server.cpp
index d07116aed9f..8777fcd5135 100644
--- a/cpp/test/Ice/servantLocator/Server.cpp
+++ b/cpp/test/Ice/servantLocator/Server.cpp
@@ -28,22 +28,22 @@ protected:
virtual Ice::ObjectPtr
newServantAndCookie(Ice::LocalObjectPtr& cookie) const
{
- cookie = new CookieI();
- return new TestI();
+ cookie = new CookieI();
+ return new TestI();
}
virtual void
checkCookie(const Ice::LocalObjectPtr& cookie) const
{
- Test::CookiePtr co = Test::CookiePtr::dynamicCast(cookie);
- test(co);
- test(co->message() == "blahblah");
+ Test::CookiePtr co = Test::CookiePtr::dynamicCast(cookie);
+ test(co);
+ test(co->message() == "blahblah");
}
virtual void
throwTestIntfUserException() const
{
- throw Test::TestIntfUserException();
+ throw Test::TestIntfUserException();
}
};
diff --git a/cpp/test/Ice/servantLocator/ServerAMD.cpp b/cpp/test/Ice/servantLocator/ServerAMD.cpp
index 59ae7efe8dd..470a67c51c7 100644
--- a/cpp/test/Ice/servantLocator/ServerAMD.cpp
+++ b/cpp/test/Ice/servantLocator/ServerAMD.cpp
@@ -28,22 +28,22 @@ protected:
virtual Ice::ObjectPtr
newServantAndCookie(Ice::LocalObjectPtr& cookie) const
{
- cookie = new CookieI();
- return new TestAMDI();
+ cookie = new CookieI();
+ return new TestAMDI();
}
virtual void
checkCookie(const Ice::LocalObjectPtr& cookie) const
{
- Test::CookiePtr co = Test::CookiePtr::dynamicCast(cookie);
- test(co);
- test(co->message() == "blahblah");
+ Test::CookiePtr co = Test::CookiePtr::dynamicCast(cookie);
+ test(co);
+ test(co->message() == "blahblah");
}
virtual void
throwTestIntfUserException() const
{
- throw Test::TestIntfUserException();
+ throw Test::TestIntfUserException();
}
};
diff --git a/cpp/test/Ice/slicing/exceptions/AllTests.cpp b/cpp/test/Ice/slicing/exceptions/AllTests.cpp
index 49dc930773f..4a43cc2823f 100644
--- a/cpp/test/Ice/slicing/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/slicing/exceptions/AllTests.cpp
@@ -19,7 +19,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -29,26 +29,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -61,26 +61,26 @@ class AMI_Test_baseAsBaseI : public AMI_TestIntf_baseAsBase, public CallbackBase
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Base& b)
- {
- test(b.b == "Base.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "Base.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -91,26 +91,26 @@ class AMI_Test_unknownDerivedAsBaseI : public AMI_TestIntf_unknownDerivedAsBase,
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownDerived.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownDerived.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -121,27 +121,27 @@ class AMI_Test_knownDerivedAsBaseI : public AMI_TestIntf_knownDerivedAsBase, pub
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownDerived& k)
- {
- test(k.b == "KnownDerived.b");
- test(k.kd == "KnownDerived.kd");
- test(k.ice_name() =="Test::KnownDerived");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownDerived& k)
+ {
+ test(k.b == "KnownDerived.b");
+ test(k.kd == "KnownDerived.kd");
+ test(k.ice_name() =="Test::KnownDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -152,27 +152,27 @@ class AMI_Test_knownDerivedAsKnownDerivedI : public AMI_TestIntf_knownDerivedAsK
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownDerived& k)
- {
- test(k.b == "KnownDerived.b");
- test(k.kd == "KnownDerived.kd");
- test(k.ice_name() =="Test::KnownDerived");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownDerived& k)
+ {
+ test(k.b == "KnownDerived.b");
+ test(k.kd == "KnownDerived.kd");
+ test(k.ice_name() =="Test::KnownDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -183,26 +183,26 @@ class AMI_Test_unknownIntermediateAsBaseI : public AMI_TestIntf_unknownIntermedi
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownIntermediate.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownIntermediate.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -213,60 +213,60 @@ class AMI_Test_knownIntermediateAsBaseI : public AMI_TestIntf_knownIntermediateA
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "KnownIntermediate.b");
- test(ki.ki == "KnownIntermediate.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "KnownIntermediate.b");
+ test(ki.ki == "KnownIntermediate.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
typedef IceUtil::Handle<AMI_Test_knownIntermediateAsBaseI> AMI_Test_knownIntermediateAsBaseIPtr;
class AMI_Test_knownMostDerivedAsBaseI : public AMI_TestIntf_knownMostDerivedAsBase,
- public CallbackBase
+ public CallbackBase
{
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -278,27 +278,27 @@ class AMI_Test_knownIntermediateAsKnownIntermediateI : public AMI_TestIntf_known
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "KnownIntermediate.b");
- test(ki.ki == "KnownIntermediate.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "KnownIntermediate.b");
+ test(ki.ki == "KnownIntermediate.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -310,28 +310,28 @@ class AMI_Test_knownMostDerivedAsKnownMostDerivedI : public AMI_TestIntf_knownMo
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -343,28 +343,28 @@ class AMI_Test_knownMostDerivedAsKnownIntermediateI : public AMI_TestIntf_knownM
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -376,27 +376,27 @@ class AMI_Test_unknownMostDerived1AsBaseI : public AMI_TestIntf_unknownMostDeriv
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "UnknownMostDerived1.b");
- test(ki.ki == "UnknownMostDerived1.ki");
- test(string(ki.ice_name()) =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "UnknownMostDerived1.b");
+ test(ki.ki == "UnknownMostDerived1.ki");
+ test(string(ki.ice_name()) =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -408,32 +408,32 @@ class AMI_Test_unknownMostDerived1AsKnownIntermediateI : public AMI_TestIntf_unk
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "UnknownMostDerived1.b");
- test(ki.ki == "UnknownMostDerived1.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "UnknownMostDerived1.b");
+ test(ki.ki == "UnknownMostDerived1.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
typedef IceUtil::Handle<AMI_Test_unknownMostDerived1AsKnownIntermediateI>
- AMI_Test_unknownMostDerived1AsKnownIntermediateIPtr;
+ AMI_Test_unknownMostDerived1AsKnownIntermediateIPtr;
class AMI_Test_unknownMostDerived2AsBaseI : public AMI_TestIntf_unknownMostDerived2AsBase,
public CallbackBase
@@ -441,26 +441,26 @@ class AMI_Test_unknownMostDerived2AsBaseI : public AMI_TestIntf_unknownMostDeriv
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- try
- {
- exc.ice_throw();
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownMostDerived2.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
- called();
+ try
+ {
+ exc.ice_throw();
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownMostDerived2.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
+ called();
}
};
@@ -474,364 +474,364 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "base... " << flush;
{
- try
- {
- test->baseAsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "Base.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->baseAsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "Base.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "base (AMI)... " << flush;
{
- AMI_Test_baseAsBaseIPtr cb = new AMI_Test_baseAsBaseI;
- test->baseAsBase_async(cb);
- test(cb->check());
+ AMI_Test_baseAsBaseIPtr cb = new AMI_Test_baseAsBaseI;
+ test->baseAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "slicing of unknown derived... " << flush;
{
- try
- {
- test->unknownDerivedAsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownDerived.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownDerivedAsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownDerived.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "slicing of unknown derived (AMI)... " << flush;
{
- AMI_Test_unknownDerivedAsBaseIPtr cb = new AMI_Test_unknownDerivedAsBaseI;
- test->unknownDerivedAsBase_async(cb);
- test(cb->check());
+ AMI_Test_unknownDerivedAsBaseIPtr cb = new AMI_Test_unknownDerivedAsBaseI;
+ test->unknownDerivedAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "non-slicing of known derived as base... " << flush;
{
- try
- {
- test->knownDerivedAsBase();
- test(false);
- }
- catch(const KnownDerived& k)
- {
- test(k.b == "KnownDerived.b");
- test(k.kd == "KnownDerived.kd");
- test(k.ice_name() =="Test::KnownDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownDerivedAsBase();
+ test(false);
+ }
+ catch(const KnownDerived& k)
+ {
+ test(k.b == "KnownDerived.b");
+ test(k.kd == "KnownDerived.kd");
+ test(k.ice_name() =="Test::KnownDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "non-slicing of known derived as base (AMI)... " << flush;
{
- AMI_Test_knownDerivedAsBaseIPtr cb = new AMI_Test_knownDerivedAsBaseI;
- test->knownDerivedAsBase_async(cb);
- test(cb->check());
+ AMI_Test_knownDerivedAsBaseIPtr cb = new AMI_Test_knownDerivedAsBaseI;
+ test->knownDerivedAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "non-slicing of known derived as derived... " << flush;
{
- try
- {
- test->knownDerivedAsKnownDerived();
- test(false);
- }
- catch(const KnownDerived& k)
- {
- test(k.b == "KnownDerived.b");
- test(k.kd == "KnownDerived.kd");
- test(k.ice_name() =="Test::KnownDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownDerivedAsKnownDerived();
+ test(false);
+ }
+ catch(const KnownDerived& k)
+ {
+ test(k.b == "KnownDerived.b");
+ test(k.kd == "KnownDerived.kd");
+ test(k.ice_name() =="Test::KnownDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "non-slicing of known derived as derived (AMI)... " << flush;
{
- AMI_Test_knownDerivedAsKnownDerivedIPtr cb = new AMI_Test_knownDerivedAsKnownDerivedI;
- test->knownDerivedAsKnownDerived_async(cb);
- test(cb->check());
+ AMI_Test_knownDerivedAsKnownDerivedIPtr cb = new AMI_Test_knownDerivedAsKnownDerivedI;
+ test->knownDerivedAsKnownDerived_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "slicing of unknown intermediate as base... " << flush;
{
- try
- {
- test->unknownIntermediateAsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownIntermediate.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownIntermediateAsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownIntermediate.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "slicing of unknown intermediate as base (AMI)... " << flush;
{
- AMI_Test_unknownIntermediateAsBaseIPtr cb = new AMI_Test_unknownIntermediateAsBaseI;
- test->unknownIntermediateAsBase_async(cb);
- test(cb->check());
+ AMI_Test_unknownIntermediateAsBaseIPtr cb = new AMI_Test_unknownIntermediateAsBaseI;
+ test->unknownIntermediateAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "slicing of known intermediate as base... " << flush;
{
- try
- {
- test->knownIntermediateAsBase();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "KnownIntermediate.b");
- test(ki.ki == "KnownIntermediate.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownIntermediateAsBase();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "KnownIntermediate.b");
+ test(ki.ki == "KnownIntermediate.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "slicing of known intermediate as base (AMI)... " << flush;
{
- AMI_Test_knownIntermediateAsBaseIPtr cb = new AMI_Test_knownIntermediateAsBaseI;
- test->knownIntermediateAsBase_async(cb);
- test(cb->check());
+ AMI_Test_knownIntermediateAsBaseIPtr cb = new AMI_Test_knownIntermediateAsBaseI;
+ test->knownIntermediateAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "slicing of known most derived as base... " << flush;
{
- try
- {
- test->knownMostDerivedAsBase();
- test(false);
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownMostDerivedAsBase();
+ test(false);
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "slicing of known most derived as base (AMI)... " << flush;
{
- AMI_Test_knownMostDerivedAsBaseIPtr cb = new AMI_Test_knownMostDerivedAsBaseI;
- test->knownMostDerivedAsBase_async(cb);
- test(cb->check());
+ AMI_Test_knownMostDerivedAsBaseIPtr cb = new AMI_Test_knownMostDerivedAsBaseI;
+ test->knownMostDerivedAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "non-slicing of known intermediate as intermediate... " << flush;
{
- try
- {
- test->knownIntermediateAsKnownIntermediate();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "KnownIntermediate.b");
- test(ki.ki == "KnownIntermediate.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownIntermediateAsKnownIntermediate();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "KnownIntermediate.b");
+ test(ki.ki == "KnownIntermediate.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "non-slicing of known intermediate as intermediate (AMI)... " << flush;
{
- AMI_Test_knownIntermediateAsKnownIntermediateIPtr cb = new AMI_Test_knownIntermediateAsKnownIntermediateI;
- test->knownIntermediateAsKnownIntermediate_async(cb);
- test(cb->check());
+ AMI_Test_knownIntermediateAsKnownIntermediateIPtr cb = new AMI_Test_knownIntermediateAsKnownIntermediateI;
+ test->knownIntermediateAsKnownIntermediate_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "non-slicing of known most derived exception as intermediate... " << flush;
{
- try
- {
- test->knownMostDerivedAsKnownIntermediate();
- test(false);
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownMostDerivedAsKnownIntermediate();
+ test(false);
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "non-slicing of known most derived as intermediate (AMI)... " << flush;
{
- AMI_Test_knownMostDerivedAsKnownIntermediateIPtr cb = new AMI_Test_knownMostDerivedAsKnownIntermediateI;
- test->knownMostDerivedAsKnownIntermediate_async(cb);
- test(cb->check());
+ AMI_Test_knownMostDerivedAsKnownIntermediateIPtr cb = new AMI_Test_knownMostDerivedAsKnownIntermediateI;
+ test->knownMostDerivedAsKnownIntermediate_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "non-slicing of known most derived as most derived... " << flush;
{
- try
- {
- test->knownMostDerivedAsKnownMostDerived();
- test(false);
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownMostDerivedAsKnownMostDerived();
+ test(false);
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "non-slicing of known most derived as most derived (AMI)... " << flush;
{
- AMI_Test_knownMostDerivedAsKnownMostDerivedIPtr cb = new AMI_Test_knownMostDerivedAsKnownMostDerivedI;
- test->knownMostDerivedAsKnownMostDerived_async(cb);
- test(cb->check());
+ AMI_Test_knownMostDerivedAsKnownMostDerivedIPtr cb = new AMI_Test_knownMostDerivedAsKnownMostDerivedI;
+ test->knownMostDerivedAsKnownMostDerived_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "slicing of unknown most derived, known intermediate as base... " << flush;
{
- try
- {
- test->unknownMostDerived1AsBase();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "UnknownMostDerived1.b");
- test(ki.ki == "UnknownMostDerived1.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownMostDerived1AsBase();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "UnknownMostDerived1.b");
+ test(ki.ki == "UnknownMostDerived1.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "slicing of unknown most derived, known intermediate as base (AMI)... " << flush;
{
- AMI_Test_unknownMostDerived1AsBaseIPtr cb = new AMI_Test_unknownMostDerived1AsBaseI;
- test->unknownMostDerived1AsBase_async(cb);
- test(cb->check());
+ AMI_Test_unknownMostDerived1AsBaseIPtr cb = new AMI_Test_unknownMostDerived1AsBaseI;
+ test->unknownMostDerived1AsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "slicing of unknown most derived, known intermediate as intermediate... " << flush;
{
- try
- {
- test->unknownMostDerived1AsKnownIntermediate();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "UnknownMostDerived1.b");
- test(ki.ki == "UnknownMostDerived1.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownMostDerived1AsKnownIntermediate();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "UnknownMostDerived1.b");
+ test(ki.ki == "UnknownMostDerived1.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "slicing of unknown most derived, known intermediate as intermediate (AMI)... " << flush;
{
- AMI_Test_unknownMostDerived1AsKnownIntermediateIPtr cb = new AMI_Test_unknownMostDerived1AsKnownIntermediateI;
- test->unknownMostDerived1AsKnownIntermediate_async(cb);
- test(cb->check());
+ AMI_Test_unknownMostDerived1AsKnownIntermediateIPtr cb = new AMI_Test_unknownMostDerived1AsKnownIntermediateI;
+ test->unknownMostDerived1AsKnownIntermediate_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "slicing of unknown most derived, unknown intermediate as base... " << flush;
{
- try
- {
- test->unknownMostDerived2AsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownMostDerived2.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownMostDerived2AsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownMostDerived2.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "slicing of unknown most derived, unknown intermediate as base (AMI)... " << flush;
{
- AMI_Test_unknownMostDerived2AsBaseIPtr cb = new AMI_Test_unknownMostDerived2AsBaseI;
- test->unknownMostDerived2AsBase_async(cb);
- test(cb->check());
+ AMI_Test_unknownMostDerived2AsBaseIPtr cb = new AMI_Test_unknownMostDerived2AsBaseI;
+ test->unknownMostDerived2AsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/slicing/exceptions/Client.cpp b/cpp/test/Ice/slicing/exceptions/Client.cpp
index f3ac4fd8322..a48e0a0bf39 100644
--- a/cpp/test/Ice/slicing/exceptions/Client.cpp
+++ b/cpp/test/Ice/slicing/exceptions/Client.cpp
@@ -31,26 +31,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/slicing/exceptions/Server.cpp b/cpp/test/Ice/slicing/exceptions/Server.cpp
index 9a7ad52c084..697d3b3cbfa 100644
--- a/cpp/test/Ice/slicing/exceptions/Server.cpp
+++ b/cpp/test/Ice/slicing/exceptions/Server.cpp
@@ -34,26 +34,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp b/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
index f19fcbf7f44..16190251017 100644
--- a/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
+++ b/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
@@ -34,26 +34,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp b/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp
index e1286426788..f6f2810fcff 100644
--- a/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp
+++ b/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp
@@ -82,7 +82,7 @@ TestI::knownMostDerivedAsBase_async(const AMD_TestIntf_knownMostDerivedAsBasePtr
void
TestI::knownIntermediateAsKnownIntermediate_async(const AMD_TestIntf_knownIntermediateAsKnownIntermediatePtr& cb,
- const ::Ice::Current&)
+ const ::Ice::Current&)
{
KnownIntermediate ki;
ki.b = "KnownIntermediate.b";
@@ -92,7 +92,7 @@ TestI::knownIntermediateAsKnownIntermediate_async(const AMD_TestIntf_knownInterm
void
TestI::knownMostDerivedAsKnownIntermediate_async(const AMD_TestIntf_knownMostDerivedAsKnownIntermediatePtr& cb,
- const ::Ice::Current&)
+ const ::Ice::Current&)
{
KnownMostDerived kmd;
kmd.b = "KnownMostDerived.b";
@@ -104,7 +104,7 @@ TestI::knownMostDerivedAsKnownIntermediate_async(const AMD_TestIntf_knownMostDer
void
TestI::
knownMostDerivedAsKnownMostDerived_async(const AMD_TestIntf_knownMostDerivedAsKnownMostDerivedPtr& cb,
- const ::Ice::Current&)
+ const ::Ice::Current&)
{
KnownMostDerived kmd;
kmd.b = "KnownMostDerived.b";
@@ -125,7 +125,7 @@ TestI::unknownMostDerived1AsBase_async(const AMD_TestIntf_unknownMostDerived1AsB
void
TestI::unknownMostDerived1AsKnownIntermediate_async(const AMD_TestIntf_unknownMostDerived1AsKnownIntermediatePtr& cb,
- const ::Ice::Current&)
+ const ::Ice::Current&)
{
UnknownMostDerived1 umd1;
umd1.b = "UnknownMostDerived1.b";
diff --git a/cpp/test/Ice/slicing/exceptions/TestAMDI.h b/cpp/test/Ice/slicing/exceptions/TestAMDI.h
index d390cf82bd9..a806e61c5aa 100644
--- a/cpp/test/Ice/slicing/exceptions/TestAMDI.h
+++ b/cpp/test/Ice/slicing/exceptions/TestAMDI.h
@@ -22,33 +22,33 @@ public:
virtual void unknownDerivedAsBase_async(const ::Test::AMD_TestIntf_unknownDerivedAsBasePtr&, const ::Ice::Current&);
virtual void knownDerivedAsBase_async(const ::Test::AMD_TestIntf_knownDerivedAsBasePtr&, const ::Ice::Current&);
virtual void knownDerivedAsKnownDerived_async(const ::Test::AMD_TestIntf_knownDerivedAsKnownDerivedPtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void unknownIntermediateAsBase_async(const ::Test::AMD_TestIntf_unknownIntermediateAsBasePtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void knownIntermediateAsBase_async(const ::Test::AMD_TestIntf_knownIntermediateAsBasePtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void knownMostDerivedAsBase_async(const ::Test::AMD_TestIntf_knownMostDerivedAsBasePtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void knownIntermediateAsKnownIntermediate_async(
- const ::Test::AMD_TestIntf_knownIntermediateAsKnownIntermediatePtr&,
- const ::Ice::Current&);
+ const ::Test::AMD_TestIntf_knownIntermediateAsKnownIntermediatePtr&,
+ const ::Ice::Current&);
virtual void knownMostDerivedAsKnownIntermediate_async(
- const ::Test::AMD_TestIntf_knownMostDerivedAsKnownIntermediatePtr&,
- const ::Ice::Current&);
+ const ::Test::AMD_TestIntf_knownMostDerivedAsKnownIntermediatePtr&,
+ const ::Ice::Current&);
virtual void knownMostDerivedAsKnownMostDerived_async(
- const ::Test::AMD_TestIntf_knownMostDerivedAsKnownMostDerivedPtr&,
- const ::Ice::Current&);
+ const ::Test::AMD_TestIntf_knownMostDerivedAsKnownMostDerivedPtr&,
+ const ::Ice::Current&);
virtual void unknownMostDerived1AsBase_async(
- const ::Test::AMD_TestIntf_unknownMostDerived1AsBasePtr&,
- const ::Ice::Current&);
+ const ::Test::AMD_TestIntf_unknownMostDerived1AsBasePtr&,
+ const ::Ice::Current&);
virtual void unknownMostDerived1AsKnownIntermediate_async(
- const ::Test::AMD_TestIntf_unknownMostDerived1AsKnownIntermediatePtr&,
- const ::Ice::Current&);
+ const ::Test::AMD_TestIntf_unknownMostDerived1AsKnownIntermediatePtr&,
+ const ::Ice::Current&);
virtual void unknownMostDerived2AsBase_async(
- const ::Test::AMD_TestIntf_unknownMostDerived2AsBasePtr&,
- const ::Ice::Current&);
+ const ::Test::AMD_TestIntf_unknownMostDerived2AsBasePtr&,
+ const ::Ice::Current&);
virtual void shutdown_async(const ::Test::AMD_TestIntf_shutdownPtr&, const ::Ice::Current&);
diff --git a/cpp/test/Ice/slicing/objects/AllTests.cpp b/cpp/test/Ice/slicing/objects/AllTests.cpp
index 7646554dcca..b9f102b6c5a 100644
--- a/cpp/test/Ice/slicing/objects/AllTests.cpp
+++ b/cpp/test/Ice/slicing/objects/AllTests.cpp
@@ -20,7 +20,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -30,26 +30,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -62,18 +62,18 @@ class AMI_Test_SBaseAsObjectI : public AMI_TestIntf_SBaseAsObject, public Callba
virtual void
ice_response(const ::Ice::ObjectPtr& o)
{
- test(o);
- test(o->ice_id() == "::Test::SBase");
- SBasePtr sb = SBasePtr::dynamicCast(o);
- test(sb);
- test(sb->sb == "SBase.sb");
- called();
+ test(o);
+ test(o->ice_id() == "::Test::SBase");
+ SBasePtr sb = SBasePtr::dynamicCast(o);
+ test(sb);
+ test(sb->sb == "SBase.sb");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -84,14 +84,14 @@ class AMI_Test_SBaseAsSBaseI : public AMI_TestIntf_SBaseAsSBase, public Callback
virtual void
ice_response(const SBasePtr& sb)
{
- test(sb->sb == "SBase.sb");
- called();
+ test(sb->sb == "SBase.sb");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -102,16 +102,16 @@ class AMI_Test_SBSKnownDerivedAsSBaseI : public AMI_TestIntf_SBSKnownDerivedAsSB
virtual void
ice_response(const SBasePtr& sb)
{
- SBSKnownDerivedPtr sbskd = SBSKnownDerivedPtr::dynamicCast(sb);
- test(sbskd);
- test(sbskd->sbskd == "SBSKnownDerived.sbskd");
- called();
+ SBSKnownDerivedPtr sbskd = SBSKnownDerivedPtr::dynamicCast(sb);
+ test(sbskd);
+ test(sbskd->sbskd == "SBSKnownDerived.sbskd");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -123,14 +123,14 @@ class AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI
virtual void
ice_response(const SBSKnownDerivedPtr& sbskd)
{
- test(sbskd->sbskd == "SBSKnownDerived.sbskd");
- called();
+ test(sbskd->sbskd == "SBSKnownDerived.sbskd");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -141,14 +141,14 @@ class AMI_Test_SBSUnknownDerivedAsSBaseI : public AMI_TestIntf_SBSUnknownDerived
virtual void
ice_response(const SBasePtr& sb)
{
- test(sb->sb == "SBSUnknownDerived.sb");
- called();
+ test(sb->sb == "SBSUnknownDerived.sb");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -159,14 +159,14 @@ class AMI_Test_SUnknownAsObjectI : public AMI_TestIntf_SUnknownAsObject, public
virtual void
ice_response(const Ice::ObjectPtr& o)
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const Ice::Exception& exc)
{
test(exc.ice_name() == "Ice::NoObjectFactoryException");
- called();
+ called();
}
};
@@ -177,17 +177,17 @@ class AMI_Test_oneElementCycleI : public AMI_TestIntf_oneElementCycle, public Ca
virtual void
ice_response(const BPtr& b)
{
- test(b);
- test(b->ice_id() == "::Test::B");
- test(b->sb == "B1.sb");
- test(b->pb == b);
- called();
+ test(b);
+ test(b->ice_id() == "::Test::B");
+ test(b->sb == "B1.sb");
+ test(b->pb == b);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -198,22 +198,22 @@ class AMI_Test_twoElementCycleI : public AMI_TestIntf_twoElementCycle, public Ca
virtual void
ice_response(const BPtr& b1)
{
- test(b1);
- test(b1->ice_id() == "::Test::B");
- test(b1->sb == "B1.sb");
+ test(b1);
+ test(b1->ice_id() == "::Test::B");
+ test(b1->sb == "B1.sb");
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->ice_id() == "::Test::B");
- test(b2->sb == "B2.sb");
- test(b2->pb == b1);
- called();
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->ice_id() == "::Test::B");
+ test(b2->sb == "B2.sb");
+ test(b2->pb == b1);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -224,30 +224,30 @@ class AMI_Test_D1AsBI : public AMI_TestIntf_D1AsB, public CallbackBase
virtual void
ice_response(const BPtr& b1)
{
- test(b1);
- test(b1->ice_id() == "::Test::D1");
- test(b1->sb == "D1.sb");
- test(b1->pb);
- test(b1->pb != b1);
- D1Ptr d1 = D1Ptr::dynamicCast(b1);
- test(d1);
- test(d1->sd1 == "D1.sd1");
- test(d1->pd1);
- test(d1->pd1 != b1);
- test(b1->pb == d1->pd1);
-
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->pb == b1);
- test(b2->sb == "D2.sb");
- test(b2->ice_id() == "::Test::B");
- called();
+ test(b1);
+ test(b1->ice_id() == "::Test::D1");
+ test(b1->sb == "D1.sb");
+ test(b1->pb);
+ test(b1->pb != b1);
+ D1Ptr d1 = D1Ptr::dynamicCast(b1);
+ test(d1);
+ test(d1->sd1 == "D1.sd1");
+ test(d1->pd1);
+ test(d1->pd1 != b1);
+ test(b1->pb == d1->pd1);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->pb == b1);
+ test(b2->sb == "D2.sb");
+ test(b2->ice_id() == "::Test::B");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -258,24 +258,24 @@ class AMI_Test_D1AsD1I : public AMI_TestIntf_D1AsD1, public CallbackBase
virtual void
ice_response(const D1Ptr& d1)
{
- test(d1);
- test(d1->ice_id() == "::Test::D1");
- test(d1->sb == "D1.sb");
- test(d1->pb);
- test(d1->pb != d1);
+ test(d1);
+ test(d1->ice_id() == "::Test::D1");
+ test(d1->sb == "D1.sb");
+ test(d1->pb);
+ test(d1->pb != d1);
- BPtr b2 = d1->pb;
- test(b2);
- test(b2->ice_id() == "::Test::B");
- test(b2->sb == "D2.sb");
- test(b2->pb == d1);
- called();
+ BPtr b2 = d1->pb;
+ test(b2);
+ test(b2->ice_id() == "::Test::B");
+ test(b2->sb == "D2.sb");
+ test(b2->pb == d1);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -286,28 +286,28 @@ class AMI_Test_D2AsBI : public AMI_TestIntf_D2AsB, public CallbackBase
virtual void
ice_response(const BPtr& b2)
{
- test(b2);
- test(b2->ice_id() == "::Test::B");
- test(b2->sb == "D2.sb");
- test(b2->pb);
- test(b2->pb != b2);
+ test(b2);
+ test(b2->ice_id() == "::Test::B");
+ test(b2->sb == "D2.sb");
+ test(b2->pb);
+ test(b2->pb != b2);
- BPtr b1 = b2->pb;
- test(b1);
- test(b1->ice_id() == "::Test::D1");
- test(b1->sb == "D1.sb");
- test(b1->pb == b2);
- D1Ptr d1 = D1Ptr::dynamicCast(b1);
- test(d1);
- test(d1->sd1 == "D1.sd1");
- test(d1->pd1 == b2);
- called();
+ BPtr b1 = b2->pb;
+ test(b1);
+ test(b1->ice_id() == "::Test::D1");
+ test(b1->sb == "D1.sb");
+ test(b1->pb == b2);
+ D1Ptr d1 = D1Ptr::dynamicCast(b1);
+ test(d1);
+ test(d1->sd1 == "D1.sd1");
+ test(d1->pd1 == b2);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -318,26 +318,26 @@ class AMI_Test_paramTest1I : public AMI_TestIntf_paramTest1, public CallbackBase
virtual void
ice_response(const BPtr& b1, const BPtr& b2)
{
- test(b1);
- test(b1->ice_id() == "::Test::D1");
- test(b1->sb == "D1.sb");
- test(b1->pb == b2);
- D1Ptr d1 = D1Ptr::dynamicCast(b1);
- test(d1);
- test(d1->sd1 == "D1.sd1");
- test(d1->pd1 == b2);
+ test(b1);
+ test(b1->ice_id() == "::Test::D1");
+ test(b1->sb == "D1.sb");
+ test(b1->pb == b2);
+ D1Ptr d1 = D1Ptr::dynamicCast(b1);
+ test(d1);
+ test(d1->sd1 == "D1.sd1");
+ test(d1->pd1 == b2);
- test(b2);
- test(b2->ice_id() == "::Test::B"); // No factory, must be sliced
- test(b2->sb == "D2.sb");
- test(b2->pb == b1);
- called();
+ test(b2);
+ test(b2->ice_id() == "::Test::B"); // No factory, must be sliced
+ test(b2->sb == "D2.sb");
+ test(b2->pb == b1);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -348,14 +348,14 @@ class AMI_Test_returnTest1I : public AMI_TestIntf_returnTest1, public CallbackBa
virtual void
ice_response(const BPtr& r, const BPtr& p1, const BPtr& p2)
{
- test(r == p1);
- called();
+ test(r == p1);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -366,14 +366,14 @@ class AMI_Test_returnTest2I : public AMI_TestIntf_returnTest2, public CallbackBa
virtual void
ice_response(const BPtr& r, const BPtr& p1, const BPtr& p2)
{
- test(r == p1);
- called();
+ test(r == p1);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -385,14 +385,14 @@ public:
virtual void
ice_response(const BPtr& b)
{
- r = b;
- called();
+ r = b;
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
BPtr r;
@@ -405,27 +405,27 @@ class AMI_Test_paramTest3I : public AMI_TestIntf_paramTest3, public CallbackBase
virtual void
ice_response(const BPtr& ret, const BPtr& p1, const BPtr& p2)
{
- test(p1);
- test(p1->sb == "D2.sb (p1 1)");
- test(p1->pb == 0);
- test(p1->ice_id() == "::Test::B");
+ test(p1);
+ test(p1->sb == "D2.sb (p1 1)");
+ test(p1->pb == 0);
+ test(p1->ice_id() == "::Test::B");
- test(p2);
- test(p2->sb == "D2.sb (p2 1)");
- test(p2->pb == 0);
- test(p2->ice_id() == "::Test::B");
+ test(p2);
+ test(p2->sb == "D2.sb (p2 1)");
+ test(p2->pb == 0);
+ test(p2->ice_id() == "::Test::B");
- test(ret);
- test(ret->sb == "D1.sb (p2 2)");
- test(ret->pb == 0);
- test(ret->ice_id() == "::Test::D1");
- called();
+ test(ret);
+ test(ret->sb == "D1.sb (p2 2)");
+ test(ret->pb == 0);
+ test(ret->ice_id() == "::Test::D1");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -436,22 +436,22 @@ class AMI_Test_paramTest4I : public AMI_TestIntf_paramTest4, public CallbackBase
virtual void
ice_response(const BPtr& ret, const BPtr& b)
{
- test(b);
- test(b->sb == "D4.sb (1)");
- test(b->pb == 0);
- test(b->ice_id() == "::Test::B");
+ test(b);
+ test(b->sb == "D4.sb (1)");
+ test(b->pb == 0);
+ test(b->ice_id() == "::Test::B");
- test(ret);
- test(ret->sb == "B.sb (2)");
- test(ret->pb == 0);
- test(ret->ice_id() == "::Test::B");
- called();
+ test(ret);
+ test(ret->sb == "B.sb (2)");
+ test(ret->pb == 0);
+ test(ret->ice_id() == "::Test::B");
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -462,14 +462,14 @@ class AMI_Test_sequenceTestI : public AMI_TestIntf_sequenceTest, public Callback
virtual void
ice_response(const SS& ss)
{
- r = ss;
- called();
+ r = ss;
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
public:
@@ -484,15 +484,15 @@ class AMI_Test_dictionaryTestI : public AMI_TestIntf_dictionaryTest, public Call
virtual void
ice_response(const BDict& r, const BDict& bout)
{
- this->r = r;
- this->bout = bout;
- called();
+ this->r = r;
+ this->bout = bout;
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
public:
@@ -508,19 +508,19 @@ class AMI_Test_throwBaseAsBaseI : public AMI_TestIntf_throwBaseAsBase, public Ca
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const ::Ice::Exception& ex)
{
- test(ex.ice_name() == "Test::BaseException");
- const BaseException& e = dynamic_cast<const BaseException&>(ex);
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb");
- test(e.pb->pb == e.pb);
- called();
+ test(ex.ice_name() == "Test::BaseException");
+ const BaseException& e = dynamic_cast<const BaseException&>(ex);
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb");
+ test(e.pb->pb == e.pb);
+ called();
}
};
@@ -531,25 +531,25 @@ class AMI_Test_throwDerivedAsBaseI : public AMI_TestIntf_throwDerivedAsBase, pub
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const ::Ice::Exception& ex)
{
- test(ex.ice_name() == "Test::DerivedException");
- const DerivedException& e = dynamic_cast<const DerivedException&>(ex);
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb1");
- test(e.pb->pb == e.pb);
- test(e.sde == "sde1");
- test(e.pd1);
- test(e.pd1->sb == "sb2");
- test(e.pd1->pb == e.pd1);
- test(e.pd1->sd1 == "sd2");
- test(e.pd1->pd1 == e.pd1);
- called();
+ test(ex.ice_name() == "Test::DerivedException");
+ const DerivedException& e = dynamic_cast<const DerivedException&>(ex);
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb1");
+ test(e.pb->pb == e.pb);
+ test(e.sde == "sde1");
+ test(e.pd1);
+ test(e.pd1->sb == "sb2");
+ test(e.pd1->pb == e.pd1);
+ test(e.pd1->sd1 == "sd2");
+ test(e.pd1->pd1 == e.pd1);
+ called();
}
};
@@ -560,25 +560,25 @@ class AMI_Test_throwDerivedAsDerivedI : public AMI_TestIntf_throwDerivedAsDerive
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const ::Ice::Exception& ex)
{
- test(ex.ice_name() == "Test::DerivedException");
- const DerivedException& e = dynamic_cast<const DerivedException&>(ex);
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb1");
- test(e.pb->pb == e.pb);
- test(e.sde == "sde1");
- test(e.pd1);
- test(e.pd1->sb == "sb2");
- test(e.pd1->pb == e.pd1);
- test(e.pd1->sd1 == "sd2");
- test(e.pd1->pd1 == e.pd1);
- called();
+ test(ex.ice_name() == "Test::DerivedException");
+ const DerivedException& e = dynamic_cast<const DerivedException&>(ex);
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb1");
+ test(e.pb->pb == e.pb);
+ test(e.sde == "sde1");
+ test(e.pd1);
+ test(e.pd1->sb == "sb2");
+ test(e.pd1->pb == e.pd1);
+ test(e.pd1->sd1 == "sd2");
+ test(e.pd1->pd1 == e.pd1);
+ called();
}
};
@@ -589,19 +589,19 @@ class AMI_Test_throwUnknownDerivedAsBaseI : public AMI_TestIntf_throwUnknownDeri
virtual void
ice_response()
{
- test(false);
+ test(false);
}
virtual void
ice_exception(const ::Ice::Exception& ex)
{
- test(ex.ice_name() == "Test::BaseException");
- const BaseException& e = dynamic_cast<const BaseException&>(ex);
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb d2");
- test(e.pb->pb == e.pb);
- called();
+ test(ex.ice_name() == "Test::BaseException");
+ const BaseException& e = dynamic_cast<const BaseException&>(ex);
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb d2");
+ test(e.pb->pb == e.pb);
+ called();
}
};
@@ -612,14 +612,14 @@ class AMI_Test_useForwardI : public AMI_TestIntf_useForward, public CallbackBase
virtual void
ice_response(const ForwardPtr& f)
{
- test(f);
- called();
+ test(f);
+ called();
}
virtual void
ice_exception(const Ice::Exception& exc)
{
- test(false);
+ test(false);
}
};
@@ -633,1281 +633,1281 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "base as Object... " << flush;
{
- Ice::ObjectPtr o;
- try
- {
- o = test->SBaseAsObject();
- test(o);
- test(o->ice_id() == "::Test::SBase");
- }
- catch(...)
- {
- test(0);
- }
- SBasePtr sb = SBasePtr::dynamicCast(o);
- test(sb);
- test(sb->sb == "SBase.sb");
+ Ice::ObjectPtr o;
+ try
+ {
+ o = test->SBaseAsObject();
+ test(o);
+ test(o->ice_id() == "::Test::SBase");
+ }
+ catch(...)
+ {
+ test(0);
+ }
+ SBasePtr sb = SBasePtr::dynamicCast(o);
+ test(sb);
+ test(sb->sb == "SBase.sb");
}
cout << "ok" << endl;
cout << "base as Object (AMI)... " << flush;
{
- AMI_Test_SBaseAsObjectIPtr cb = new AMI_Test_SBaseAsObjectI;
- test->SBaseAsObject_async(cb);
- test(cb->check());
+ AMI_Test_SBaseAsObjectIPtr cb = new AMI_Test_SBaseAsObjectI;
+ test->SBaseAsObject_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "base as base... " << flush;
{
- SBasePtr sb;
- try
- {
- sb = test->SBaseAsSBase();
- test(sb->sb == "SBase.sb");
- }
- catch(...)
- {
- test(0);
- }
+ SBasePtr sb;
+ try
+ {
+ sb = test->SBaseAsSBase();
+ test(sb->sb == "SBase.sb");
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "base as base (AMI)... " << flush;
{
- AMI_Test_SBaseAsSBaseIPtr cb = new AMI_Test_SBaseAsSBaseI;
- test->SBaseAsSBase_async(cb);
- test(cb->check());
+ AMI_Test_SBaseAsSBaseIPtr cb = new AMI_Test_SBaseAsSBaseI;
+ test->SBaseAsSBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "base with known derived as base... " << flush;
{
- SBasePtr sb;
- try
- {
- sb = test->SBSKnownDerivedAsSBase();
- test(sb->sb == "SBSKnownDerived.sb");
- }
- catch(...)
- {
- test(0);
- }
- SBSKnownDerivedPtr sbskd = SBSKnownDerivedPtr::dynamicCast(sb);
- test(sbskd);
- test(sbskd->sbskd == "SBSKnownDerived.sbskd");
+ SBasePtr sb;
+ try
+ {
+ sb = test->SBSKnownDerivedAsSBase();
+ test(sb->sb == "SBSKnownDerived.sb");
+ }
+ catch(...)
+ {
+ test(0);
+ }
+ SBSKnownDerivedPtr sbskd = SBSKnownDerivedPtr::dynamicCast(sb);
+ test(sbskd);
+ test(sbskd->sbskd == "SBSKnownDerived.sbskd");
}
cout << "ok" << endl;
cout << "base with known derived as base (AMI)... " << flush;
{
- AMI_Test_SBSKnownDerivedAsSBaseIPtr cb = new AMI_Test_SBSKnownDerivedAsSBaseI;
- test->SBSKnownDerivedAsSBase_async(cb);
- test(cb->check());
+ AMI_Test_SBSKnownDerivedAsSBaseIPtr cb = new AMI_Test_SBSKnownDerivedAsSBaseI;
+ test->SBSKnownDerivedAsSBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "base with known derived as known derived... " << flush;
{
- SBSKnownDerivedPtr sbskd;
- try
- {
- sbskd = test->SBSKnownDerivedAsSBSKnownDerived();
- test(sbskd->sbskd == "SBSKnownDerived.sbskd");
- }
- catch(...)
- {
- test(0);
- }
+ SBSKnownDerivedPtr sbskd;
+ try
+ {
+ sbskd = test->SBSKnownDerivedAsSBSKnownDerived();
+ test(sbskd->sbskd == "SBSKnownDerived.sbskd");
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "base with known derived as known derived (AMI)... " << flush;
{
- AMI_Test_SBSKnownDerivedAsSBSKnownDerivedIPtr cb = new AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI;
- test->SBSKnownDerivedAsSBSKnownDerived_async(cb);
- test(cb->check());
+ AMI_Test_SBSKnownDerivedAsSBSKnownDerivedIPtr cb = new AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI;
+ test->SBSKnownDerivedAsSBSKnownDerived_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "base with unknown derived as base... " << flush;
{
- SBasePtr sb;
- try
- {
- sb = test->SBSUnknownDerivedAsSBase();
- test(sb->sb == "SBSUnknownDerived.sb");
- }
- catch(...)
- {
- test(0);
- }
+ SBasePtr sb;
+ try
+ {
+ sb = test->SBSUnknownDerivedAsSBase();
+ test(sb->sb == "SBSUnknownDerived.sb");
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "base with unknown derived as base (AMI)... " << flush;
{
- AMI_Test_SBSUnknownDerivedAsSBaseIPtr cb = new AMI_Test_SBSUnknownDerivedAsSBaseI;
- test->SBSUnknownDerivedAsSBase_async(cb);
- test(cb->check());
+ AMI_Test_SBSUnknownDerivedAsSBaseIPtr cb = new AMI_Test_SBSUnknownDerivedAsSBaseI;
+ test->SBSUnknownDerivedAsSBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "unknown with Object as Object... " << flush;
{
- Ice::ObjectPtr o;
- try
- {
- o = test->SUnknownAsObject();
- test(0);
- }
- catch(const Ice::NoObjectFactoryException&)
- {
- }
- catch(...)
- {
- test(0);
- }
+ Ice::ObjectPtr o;
+ try
+ {
+ o = test->SUnknownAsObject();
+ test(0);
+ }
+ catch(const Ice::NoObjectFactoryException&)
+ {
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "unknown with Object as Object (AMI)... " << flush;
{
- try
- {
- AMI_Test_SUnknownAsObjectIPtr cb = new AMI_Test_SUnknownAsObjectI;
- test->SUnknownAsObject_async(cb);
- test(cb->check());
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ AMI_Test_SUnknownAsObjectIPtr cb = new AMI_Test_SUnknownAsObjectI;
+ test->SUnknownAsObject_async(cb);
+ test(cb->check());
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "one-element cycle... " << flush;
{
- try
- {
- BPtr b = test->oneElementCycle();
- test(b);
- test(b->ice_id() == "::Test::B");
- test(b->sb == "B1.sb");
- test(b->pb == b);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b = test->oneElementCycle();
+ test(b);
+ test(b->ice_id() == "::Test::B");
+ test(b->sb == "B1.sb");
+ test(b->pb == b);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "one-element cycle (AMI)... " << flush;
{
- AMI_Test_oneElementCycleIPtr cb = new AMI_Test_oneElementCycleI;
- test->oneElementCycle_async(cb);
- test(cb->check());
+ AMI_Test_oneElementCycleIPtr cb = new AMI_Test_oneElementCycleI;
+ test->oneElementCycle_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "two-element cycle... " << flush;
{
- try
- {
- BPtr b1 = test->twoElementCycle();
- test(b1);
- test(b1->ice_id() == "::Test::B");
- test(b1->sb == "B1.sb");
-
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->ice_id() == "::Test::B");
- test(b2->sb == "B2.sb");
- test(b2->pb == b1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b1 = test->twoElementCycle();
+ test(b1);
+ test(b1->ice_id() == "::Test::B");
+ test(b1->sb == "B1.sb");
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->ice_id() == "::Test::B");
+ test(b2->sb == "B2.sb");
+ test(b2->pb == b1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "two-element cycle (AMI)... " << flush;
{
- AMI_Test_twoElementCycleIPtr cb = new AMI_Test_twoElementCycleI;
- test->twoElementCycle_async(cb);
- test(cb->check());
+ AMI_Test_twoElementCycleIPtr cb = new AMI_Test_twoElementCycleI;
+ test->twoElementCycle_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "known derived pointer slicing as base... " << flush;
{
- try
- {
- BPtr b1;
- b1 = test->D1AsB();
- test(b1);
- test(b1->ice_id() == "::Test::D1");
- test(b1->sb == "D1.sb");
- test(b1->pb);
- test(b1->pb != b1);
- D1Ptr d1 = D1Ptr::dynamicCast(b1);
- test(d1);
- test(d1->sd1 == "D1.sd1");
- test(d1->pd1);
- test(d1->pd1 != b1);
- test(b1->pb == d1->pd1);
-
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->pb == b1);
- test(b2->sb == "D2.sb");
- test(b2->ice_id() == "::Test::B");
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b1;
+ b1 = test->D1AsB();
+ test(b1);
+ test(b1->ice_id() == "::Test::D1");
+ test(b1->sb == "D1.sb");
+ test(b1->pb);
+ test(b1->pb != b1);
+ D1Ptr d1 = D1Ptr::dynamicCast(b1);
+ test(d1);
+ test(d1->sd1 == "D1.sd1");
+ test(d1->pd1);
+ test(d1->pd1 != b1);
+ test(b1->pb == d1->pd1);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->pb == b1);
+ test(b2->sb == "D2.sb");
+ test(b2->ice_id() == "::Test::B");
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "known derived pointer slicing as base (AMI)... " << flush;
{
- AMI_Test_D1AsBIPtr cb = new AMI_Test_D1AsBI;
- test->D1AsB_async(cb);
- test(cb->check());
+ AMI_Test_D1AsBIPtr cb = new AMI_Test_D1AsBI;
+ test->D1AsB_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "known derived pointer slicing as derived... " << flush;
{
- try
- {
- D1Ptr d1;
- d1 = test->D1AsD1();
- test(d1);
- test(d1->ice_id() == "::Test::D1");
- test(d1->sb == "D1.sb");
- test(d1->pb);
- test(d1->pb != d1);
-
- BPtr b2 = d1->pb;
- test(b2);
- test(b2->ice_id() == "::Test::B");
- test(b2->sb == "D2.sb");
- test(b2->pb == d1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ D1Ptr d1;
+ d1 = test->D1AsD1();
+ test(d1);
+ test(d1->ice_id() == "::Test::D1");
+ test(d1->sb == "D1.sb");
+ test(d1->pb);
+ test(d1->pb != d1);
+
+ BPtr b2 = d1->pb;
+ test(b2);
+ test(b2->ice_id() == "::Test::B");
+ test(b2->sb == "D2.sb");
+ test(b2->pb == d1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "known derived pointer slicing as derived (AMI)... " << flush;
{
- AMI_Test_D1AsD1IPtr cb = new AMI_Test_D1AsD1I;
- test->D1AsD1_async(cb);
- test(cb->check());
+ AMI_Test_D1AsD1IPtr cb = new AMI_Test_D1AsD1I;
+ test->D1AsD1_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "unknown derived pointer slicing as base... " << flush;
{
- try
- {
- BPtr b2;
- b2 = test->D2AsB();
- test(b2);
- test(b2->ice_id() == "::Test::B");
- test(b2->sb == "D2.sb");
- test(b2->pb);
- test(b2->pb != b2);
-
- BPtr b1 = b2->pb;
- test(b1);
- test(b1->ice_id() == "::Test::D1");
- test(b1->sb == "D1.sb");
- test(b1->pb == b2);
- D1Ptr d1 = D1Ptr::dynamicCast(b1);
- test(d1);
- test(d1->sd1 == "D1.sd1");
- test(d1->pd1 == b2);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b2;
+ b2 = test->D2AsB();
+ test(b2);
+ test(b2->ice_id() == "::Test::B");
+ test(b2->sb == "D2.sb");
+ test(b2->pb);
+ test(b2->pb != b2);
+
+ BPtr b1 = b2->pb;
+ test(b1);
+ test(b1->ice_id() == "::Test::D1");
+ test(b1->sb == "D1.sb");
+ test(b1->pb == b2);
+ D1Ptr d1 = D1Ptr::dynamicCast(b1);
+ test(d1);
+ test(d1->sd1 == "D1.sd1");
+ test(d1->pd1 == b2);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "unknown derived pointer slicing as base (AMI)... " << flush;
{
- AMI_Test_D2AsBIPtr cb = new AMI_Test_D2AsBI;
- test->D2AsB_async(cb);
- test(cb->check());
+ AMI_Test_D2AsBIPtr cb = new AMI_Test_D2AsBI;
+ test->D2AsB_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "param ptr slicing with known first... " << flush;
{
- try
- {
- BPtr b1;
- BPtr b2;
- test->paramTest1(b1, b2);
-
- test(b1);
- test(b1->ice_id() == "::Test::D1");
- test(b1->sb == "D1.sb");
- test(b1->pb == b2);
- D1Ptr d1 = D1Ptr::dynamicCast(b1);
- test(d1);
- test(d1->sd1 == "D1.sd1");
- test(d1->pd1 == b2);
-
- test(b2);
- test(b2->ice_id() == "::Test::B"); // No factory, must be sliced
- test(b2->sb == "D2.sb");
- test(b2->pb == b1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b1;
+ BPtr b2;
+ test->paramTest1(b1, b2);
+
+ test(b1);
+ test(b1->ice_id() == "::Test::D1");
+ test(b1->sb == "D1.sb");
+ test(b1->pb == b2);
+ D1Ptr d1 = D1Ptr::dynamicCast(b1);
+ test(d1);
+ test(d1->sd1 == "D1.sd1");
+ test(d1->pd1 == b2);
+
+ test(b2);
+ test(b2->ice_id() == "::Test::B"); // No factory, must be sliced
+ test(b2->sb == "D2.sb");
+ test(b2->pb == b1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "param ptr slicing with known first (AMI)... " << flush;
{
- AMI_Test_paramTest1IPtr cb = new AMI_Test_paramTest1I;
- test->paramTest1_async(cb);
- test(cb->check());
+ AMI_Test_paramTest1IPtr cb = new AMI_Test_paramTest1I;
+ test->paramTest1_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "param ptr slicing with unknown first... " << flush;
{
- try
- {
- BPtr b2;
- BPtr b1;
- test->paramTest2(b2, b1);
-
- test(b1);
- test(b1->ice_id() == "::Test::D1");
- test(b1->sb == "D1.sb");
- test(b1->pb == b2);
- D1Ptr d1 = D1Ptr::dynamicCast(b1);
- test(d1);
- test(d1->sd1 == "D1.sd1");
- test(d1->pd1 == b2);
-
- test(b2);
- test(b2->ice_id() == "::Test::B"); // No factory, must be sliced
- test(b2->sb == "D2.sb");
- test(b2->pb == b1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b2;
+ BPtr b1;
+ test->paramTest2(b2, b1);
+
+ test(b1);
+ test(b1->ice_id() == "::Test::D1");
+ test(b1->sb == "D1.sb");
+ test(b1->pb == b2);
+ D1Ptr d1 = D1Ptr::dynamicCast(b1);
+ test(d1);
+ test(d1->sd1 == "D1.sd1");
+ test(d1->pd1 == b2);
+
+ test(b2);
+ test(b2->ice_id() == "::Test::B"); // No factory, must be sliced
+ test(b2->sb == "D2.sb");
+ test(b2->pb == b1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "return value identity with known first... " << flush;
{
- try
- {
- BPtr p1;
- BPtr p2;
- BPtr r = test->returnTest1(p1, p2);
- test(r == p1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr p1;
+ BPtr p2;
+ BPtr r = test->returnTest1(p1, p2);
+ test(r == p1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "return value identity with known first (AMI)... " << flush;
{
- AMI_Test_returnTest1IPtr cb = new AMI_Test_returnTest1I;
- test->returnTest1_async(cb);
- test(cb->check());
+ AMI_Test_returnTest1IPtr cb = new AMI_Test_returnTest1I;
+ test->returnTest1_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "return value identity with unknown first... " << flush;
{
- try
- {
- BPtr p1;
- BPtr p2;
- BPtr r = test->returnTest2(p1, p2);
- test(r == p1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr p1;
+ BPtr p2;
+ BPtr r = test->returnTest2(p1, p2);
+ test(r == p1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "return value identity with unknown first (AMI)... " << flush;
{
- AMI_Test_returnTest2IPtr cb = new AMI_Test_returnTest2I;
- test->returnTest2_async(cb);
- test(cb->check());
+ AMI_Test_returnTest2IPtr cb = new AMI_Test_returnTest2I;
+ test->returnTest2_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "return value identity for input params known first... " << flush;
{
- try
- {
- D1Ptr d1 = new D1;
- d1->sb = "D1.sb";
- d1->sd1 = "D1.sd1";
- D3Ptr d3 = new D3;
- d3->pb = d1;
- d3->sb = "D3.sb";
- d3->sd3 = "D3.sd3";
- d3->pd3 = d1;
- d1->pb = d3;
- d1->pd1 = d3;
-
- BPtr b1 = test->returnTest3(d1, d3);
-
- test(b1);
- test(b1->sb == "D1.sb");
- test(b1->ice_id() == "::Test::D1");
- D1Ptr p1 = D1Ptr::dynamicCast(b1);
- test(p1);
- test(p1->sd1 == "D1.sd1");
- test(p1->pd1 == b1->pb);
-
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->sb == "D3.sb");
- test(b2->ice_id() == "::Test::B"); // Sliced by server
- test(b2->pb == b1);
- D3Ptr p3 = D3Ptr::dynamicCast(b2);
- test(!p3);
-
- test(b1 != d1);
- test(b1 != d3);
- test(b2 != d1);
- test(b2 != d3);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D3Ptr d3 = new D3;
+ d3->pb = d1;
+ d3->sb = "D3.sb";
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = d1;
+ d1->pb = d3;
+ d1->pd1 = d3;
+
+ BPtr b1 = test->returnTest3(d1, d3);
+
+ test(b1);
+ test(b1->sb == "D1.sb");
+ test(b1->ice_id() == "::Test::D1");
+ D1Ptr p1 = D1Ptr::dynamicCast(b1);
+ test(p1);
+ test(p1->sd1 == "D1.sd1");
+ test(p1->pd1 == b1->pb);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D3.sb");
+ test(b2->ice_id() == "::Test::B"); // Sliced by server
+ test(b2->pb == b1);
+ D3Ptr p3 = D3Ptr::dynamicCast(b2);
+ test(!p3);
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "return value identity for input params known first (AMI)... " << flush;
{
- try
- {
- D1Ptr d1 = new D1;
- d1->sb = "D1.sb";
- d1->sd1 = "D1.sd1";
- D3Ptr d3 = new D3;
- d3->pb = d1;
- d3->sb = "D3.sb";
- d3->sd3 = "D3.sd3";
- d3->pd3 = d1;
- d1->pb = d3;
- d1->pd1 = d3;
-
- AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
- test->returnTest3_async(cb, d1, d3);
- test(cb->check());
- BPtr b1 = cb->r;
-
- test(b1);
- test(b1->sb == "D1.sb");
- test(b1->ice_id() == "::Test::D1");
- D1Ptr p1 = D1Ptr::dynamicCast(b1);
- test(p1);
- test(p1->sd1 == "D1.sd1");
- test(p1->pd1 == b1->pb);
-
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->sb == "D3.sb");
- test(b2->ice_id() == "::Test::B"); // Sliced by server
- test(b2->pb == b1);
- D3Ptr p3 = D3Ptr::dynamicCast(b2);
- test(!p3);
-
- test(b1 != d1);
- test(b1 != d3);
- test(b2 != d1);
- test(b2 != d3);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D3Ptr d3 = new D3;
+ d3->pb = d1;
+ d3->sb = "D3.sb";
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = d1;
+ d1->pb = d3;
+ d1->pd1 = d3;
+
+ AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
+ test->returnTest3_async(cb, d1, d3);
+ test(cb->check());
+ BPtr b1 = cb->r;
+
+ test(b1);
+ test(b1->sb == "D1.sb");
+ test(b1->ice_id() == "::Test::D1");
+ D1Ptr p1 = D1Ptr::dynamicCast(b1);
+ test(p1);
+ test(p1->sd1 == "D1.sd1");
+ test(p1->pd1 == b1->pb);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D3.sb");
+ test(b2->ice_id() == "::Test::B"); // Sliced by server
+ test(b2->pb == b1);
+ D3Ptr p3 = D3Ptr::dynamicCast(b2);
+ test(!p3);
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "return value identity for input params unknown first... " << flush;
{
- try
- {
- D1Ptr d1 = new D1;
- d1->sb = "D1.sb";
- d1->sd1 = "D1.sd1";
- D3Ptr d3 = new D3;
- d3->pb = d1;
- d3->sb = "D3.sb";
- d3->sd3 = "D3.sd3";
- d3->pd3 = d1;
- d1->pb = d3;
- d1->pd1 = d3;
-
- BPtr b1 = test->returnTest3(d3, d1);
-
- test(b1);
- test(b1->sb == "D3.sb");
- test(b1->ice_id() == "::Test::B"); // Sliced by server
- D3Ptr p1 = D3Ptr::dynamicCast(b1);
- test(!p1);
-
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->sb == "D1.sb");
- test(b2->ice_id() == "::Test::D1");
- test(b2->pb == b1);
- D1Ptr p3 = D1Ptr::dynamicCast(b2);
- test(p3);
- test(p3->sd1 == "D1.sd1");
- test(p3->pd1 == b1);
-
- test(b1 != d1);
- test(b1 != d3);
- test(b2 != d1);
- test(b2 != d3);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D3Ptr d3 = new D3;
+ d3->pb = d1;
+ d3->sb = "D3.sb";
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = d1;
+ d1->pb = d3;
+ d1->pd1 = d3;
+
+ BPtr b1 = test->returnTest3(d3, d1);
+
+ test(b1);
+ test(b1->sb == "D3.sb");
+ test(b1->ice_id() == "::Test::B"); // Sliced by server
+ D3Ptr p1 = D3Ptr::dynamicCast(b1);
+ test(!p1);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D1.sb");
+ test(b2->ice_id() == "::Test::D1");
+ test(b2->pb == b1);
+ D1Ptr p3 = D1Ptr::dynamicCast(b2);
+ test(p3);
+ test(p3->sd1 == "D1.sd1");
+ test(p3->pd1 == b1);
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "return value identity for input params unknown first (AMI)... " << flush;
{
- try
- {
- D1Ptr d1 = new D1;
- d1->sb = "D1.sb";
- d1->sd1 = "D1.sd1";
- D3Ptr d3 = new D3;
- d3->pb = d1;
- d3->sb = "D3.sb";
- d3->sd3 = "D3.sd3";
- d3->pd3 = d1;
- d1->pb = d3;
- d1->pd1 = d3;
-
- AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
- test->returnTest3_async(cb, d3, d1);
- test(cb->check());
- BPtr b1 = cb->r;
-
- test(b1);
- test(b1->sb == "D3.sb");
- test(b1->ice_id() == "::Test::B"); // Sliced by server
- D3Ptr p1 = D3Ptr::dynamicCast(b1);
- test(!p1);
-
- BPtr b2 = b1->pb;
- test(b2);
- test(b2->sb == "D1.sb");
- test(b2->ice_id() == "::Test::D1");
- test(b2->pb == b1);
- D1Ptr p3 = D1Ptr::dynamicCast(b2);
- test(p3);
- test(p3->sd1 == "D1.sd1");
- test(p3->pd1 == b1);
-
- test(b1 != d1);
- test(b1 != d3);
- test(b2 != d1);
- test(b2 != d3);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ D1Ptr d1 = new D1;
+ d1->sb = "D1.sb";
+ d1->sd1 = "D1.sd1";
+ D3Ptr d3 = new D3;
+ d3->pb = d1;
+ d3->sb = "D3.sb";
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = d1;
+ d1->pb = d3;
+ d1->pd1 = d3;
+
+ AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
+ test->returnTest3_async(cb, d3, d1);
+ test(cb->check());
+ BPtr b1 = cb->r;
+
+ test(b1);
+ test(b1->sb == "D3.sb");
+ test(b1->ice_id() == "::Test::B"); // Sliced by server
+ D3Ptr p1 = D3Ptr::dynamicCast(b1);
+ test(!p1);
+
+ BPtr b2 = b1->pb;
+ test(b2);
+ test(b2->sb == "D1.sb");
+ test(b2->ice_id() == "::Test::D1");
+ test(b2->pb == b1);
+ D1Ptr p3 = D1Ptr::dynamicCast(b2);
+ test(p3);
+ test(p3->sd1 == "D1.sd1");
+ test(p3->pd1 == b1);
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "remainder unmarshaling (3 instances)... " << flush;
{
- try
- {
- BPtr p1;
- BPtr p2;
- BPtr ret = test->paramTest3(p1, p2);
-
- test(p1);
- test(p1->sb == "D2.sb (p1 1)");
- test(p1->pb == 0);
- test(p1->ice_id() == "::Test::B");
-
- test(p2);
- test(p2->sb == "D2.sb (p2 1)");
- test(p2->pb == 0);
- test(p2->ice_id() == "::Test::B");
-
- test(ret);
- test(ret->sb == "D1.sb (p2 2)");
- test(ret->pb == 0);
- test(ret->ice_id() == "::Test::D1");
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr p1;
+ BPtr p2;
+ BPtr ret = test->paramTest3(p1, p2);
+
+ test(p1);
+ test(p1->sb == "D2.sb (p1 1)");
+ test(p1->pb == 0);
+ test(p1->ice_id() == "::Test::B");
+
+ test(p2);
+ test(p2->sb == "D2.sb (p2 1)");
+ test(p2->pb == 0);
+ test(p2->ice_id() == "::Test::B");
+
+ test(ret);
+ test(ret->sb == "D1.sb (p2 2)");
+ test(ret->pb == 0);
+ test(ret->ice_id() == "::Test::D1");
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "remainder unmarshaling (3 instances) (AMI)... " << flush;
{
- AMI_Test_paramTest3IPtr cb = new AMI_Test_paramTest3I;
- test->paramTest3_async(cb);
- test(cb->check());
+ AMI_Test_paramTest3IPtr cb = new AMI_Test_paramTest3I;
+ test->paramTest3_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "remainder unmarshaling (4 instances)... " << flush;
{
- try
- {
- BPtr b;
- BPtr ret = test->paramTest4(b);
-
- test(b);
- test(b->sb == "D4.sb (1)");
- test(b->pb == 0);
- test(b->ice_id() == "::Test::B");
-
- test(ret);
- test(ret->sb == "B.sb (2)");
- test(ret->pb == 0);
- test(ret->ice_id() == "::Test::B");
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b;
+ BPtr ret = test->paramTest4(b);
+
+ test(b);
+ test(b->sb == "D4.sb (1)");
+ test(b->pb == 0);
+ test(b->ice_id() == "::Test::B");
+
+ test(ret);
+ test(ret->sb == "B.sb (2)");
+ test(ret->pb == 0);
+ test(ret->ice_id() == "::Test::B");
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "remainder unmarshaling (4 instances) (AMI)... " << flush;
{
- BPtr b;
- AMI_Test_paramTest4IPtr cb = new AMI_Test_paramTest4I;
- test->paramTest4_async(cb);
- test(cb->check());
+ BPtr b;
+ AMI_Test_paramTest4IPtr cb = new AMI_Test_paramTest4I;
+ test->paramTest4_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "param ptr slicing, instance marshaled in unknown derived as base... " << flush;
{
- try
- {
- BPtr b1 = new B;
- b1->sb = "B.sb(1)";
- b1->pb = b1;
-
- D3Ptr d3 = new D3;
- d3->sb = "D3.sb";
- d3->pb = d3;
- d3->sd3 = "D3.sd3";
- d3->pd3 = b1;
-
- BPtr b2 = new B;
- b2->sb = "B.sb(2)";
- b2->pb = b1;
-
- BPtr r = test->returnTest3(d3, b2);
-
- test(r);
- test(r->ice_id() == "::Test::B");
- test(r->sb == "D3.sb");
- test(r->pb == r);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b1 = new B;
+ b1->sb = "B.sb(1)";
+ b1->pb = b1;
+
+ D3Ptr d3 = new D3;
+ d3->sb = "D3.sb";
+ d3->pb = d3;
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = b1;
+
+ BPtr b2 = new B;
+ b2->sb = "B.sb(2)";
+ b2->pb = b1;
+
+ BPtr r = test->returnTest3(d3, b2);
+
+ test(r);
+ test(r->ice_id() == "::Test::B");
+ test(r->sb == "D3.sb");
+ test(r->pb == r);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "param ptr slicing, instance marshaled in unknown derived as base (AMI)... " << flush;
{
- try
- {
- BPtr b1 = new B;
- b1->sb = "B.sb(1)";
- b1->pb = b1;
-
- D3Ptr d3 = new D3;
- d3->sb = "D3.sb";
- d3->pb = d3;
- d3->sd3 = "D3.sd3";
- d3->pd3 = b1;
-
- BPtr b2 = new B;
- b2->sb = "B.sb(2)";
- b2->pb = b1;
-
- AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
- test->returnTest3_async(cb, d3, b2);
- test(cb->check());
- BPtr r = cb->r;
-
- test(r);
- test(r->ice_id() == "::Test::B");
- test(r->sb == "D3.sb");
- test(r->pb == r);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ BPtr b1 = new B;
+ b1->sb = "B.sb(1)";
+ b1->pb = b1;
+
+ D3Ptr d3 = new D3;
+ d3->sb = "D3.sb";
+ d3->pb = d3;
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = b1;
+
+ BPtr b2 = new B;
+ b2->sb = "B.sb(2)";
+ b2->pb = b1;
+
+ AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
+ test->returnTest3_async(cb, d3, b2);
+ test(cb->check());
+ BPtr r = cb->r;
+
+ test(r);
+ test(r->ice_id() == "::Test::B");
+ test(r->sb == "D3.sb");
+ test(r->pb == r);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "param ptr slicing, instance marshaled in unknown derived as derived... "
- << flush;
- {
- try
- {
- D1Ptr d11 = new D1;
- d11->sb = "D1.sb(1)";
- d11->pb = d11;
- d11->sd1 = "D1.sd1(1)";
-
- D3Ptr d3 = new D3;
- d3->sb = "D3.sb";
- d3->pb = d3;
- d3->sd3 = "D3.sd3";
- d3->pd3 = d11;
-
- D1Ptr d12 = new D1;
- d12->sb = "D1.sb(2)";
- d12->pb = d12;
- d12->sd1 = "D1.sd1(2)";
- d12->pd1 = d11;
-
- BPtr r = test->returnTest3(d3, d12);
- test(r);
- test(r->ice_id() == "::Test::B");
- test(r->sb == "D3.sb");
- test(r->pb == r);
- }
- catch(...)
- {
- test(0);
- }
+ << flush;
+ {
+ try
+ {
+ D1Ptr d11 = new D1;
+ d11->sb = "D1.sb(1)";
+ d11->pb = d11;
+ d11->sd1 = "D1.sd1(1)";
+
+ D3Ptr d3 = new D3;
+ d3->sb = "D3.sb";
+ d3->pb = d3;
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = d11;
+
+ D1Ptr d12 = new D1;
+ d12->sb = "D1.sb(2)";
+ d12->pb = d12;
+ d12->sd1 = "D1.sd1(2)";
+ d12->pd1 = d11;
+
+ BPtr r = test->returnTest3(d3, d12);
+ test(r);
+ test(r->ice_id() == "::Test::B");
+ test(r->sb == "D3.sb");
+ test(r->pb == r);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "param ptr slicing, instance marshaled in unknown derived as derived (AMI)... "
- << flush;
- {
- try
- {
- D1Ptr d11 = new D1;
- d11->sb = "D1.sb(1)";
- d11->pb = d11;
- d11->sd1 = "D1.sd1(1)";
-
- D3Ptr d3 = new D3;
- d3->sb = "D3.sb";
- d3->pb = d3;
- d3->sd3 = "D3.sd3";
- d3->pd3 = d11;
-
- D1Ptr d12 = new D1;
- d12->sb = "D1.sb(2)";
- d12->pb = d12;
- d12->sd1 = "D1.sd1(2)";
- d12->pd1 = d11;
-
- AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
- test->returnTest3_async(cb, d3, d12);
- test(cb->check());
- BPtr r = cb->r;
- test(r);
- test(r->ice_id() == "::Test::B");
- test(r->sb == "D3.sb");
- test(r->pb == r);
- }
- catch(...)
- {
- test(0);
- }
+ << flush;
+ {
+ try
+ {
+ D1Ptr d11 = new D1;
+ d11->sb = "D1.sb(1)";
+ d11->pb = d11;
+ d11->sd1 = "D1.sd1(1)";
+
+ D3Ptr d3 = new D3;
+ d3->sb = "D3.sb";
+ d3->pb = d3;
+ d3->sd3 = "D3.sd3";
+ d3->pd3 = d11;
+
+ D1Ptr d12 = new D1;
+ d12->sb = "D1.sb(2)";
+ d12->pb = d12;
+ d12->sd1 = "D1.sd1(2)";
+ d12->pd1 = d11;
+
+ AMI_Test_returnTest3IPtr cb = new AMI_Test_returnTest3I;
+ test->returnTest3_async(cb, d3, d12);
+ test(cb->check());
+ BPtr r = cb->r;
+ test(r);
+ test(r->ice_id() == "::Test::B");
+ test(r->sb == "D3.sb");
+ test(r->pb == r);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "sequence slicing... " << flush;
{
- try
- {
- SS ss;
- {
- BPtr ss1b = new B;
- ss1b->sb = "B.sb";
- ss1b->pb = ss1b;
-
- D1Ptr ss1d1 = new D1;
- ss1d1->sb = "D1.sb";
- ss1d1->sd1 = "D1.sd1";
- ss1d1->pb = ss1b;
-
- D3Ptr ss1d3 = new D3;
- ss1d3->sb = "D3.sb";
- ss1d3->sd3 = "D3.sd3";
- ss1d3->pb = ss1b;
-
- BPtr ss2b = new B;
- ss2b->sb = "B.sb";
- ss2b->pb = ss1b;
-
- D1Ptr ss2d1 = new D1;
- ss2d1->sb = "D1.sb";
- ss2d1->sd1 = "D1.sd1";
- ss2d1->pb = ss2b;
-
- D3Ptr ss2d3 = new D3;
- ss2d3->sb = "D3.sb";
- ss2d3->sd3 = "D3.sd3";
- ss2d3->pb = ss2b;
-
- ss1d1->pd1 = ss2b;
- ss1d3->pd3 = ss2d1;
-
- ss2d1->pd1 = ss1d3;
- ss2d3->pd3 = ss1d1;
-
- SS1Ptr ss1 = new SS1;
- ss1->s.push_back(ss1b);
- ss1->s.push_back(ss1d1);
- ss1->s.push_back(ss1d3);
-
- SS2Ptr ss2 = new SS2;
- ss2->s.push_back(ss2b);
- ss2->s.push_back(ss2d1);
- ss2->s.push_back(ss2d3);
-
- ss = test->sequenceTest(ss1, ss2);
- }
-
- test(ss.c1);
- BPtr ss1b = ss.c1->s[0];
- BPtr ss1d1 = ss.c1->s[1];
- test(ss.c2);
- BPtr ss1d3 = ss.c1->s[2];
-
- test(ss.c2);
- BPtr ss2b = ss.c2->s[0];
- BPtr ss2d1 = ss.c2->s[1];
- BPtr ss2d3 = ss.c2->s[2];
-
- test(ss1b->pb == ss1b);
- test(ss1d1->pb == ss1b);
- test(ss1d3->pb == ss1b);
-
- test(ss2b->pb == ss1b);
- test(ss2d1->pb == ss2b);
- test(ss2d3->pb == ss2b);
-
- test(ss1b->ice_id() == "::Test::B");
- test(ss1d1->ice_id() == "::Test::D1");
- test(ss1d3->ice_id() == "::Test::B");
-
- test(ss2b->ice_id() == "::Test::B");
- test(ss2d1->ice_id() == "::Test::D1");
- test(ss2d3->ice_id() == "::Test::B");
- }
- catch(const ::Ice::Exception&)
- {
- test(0);
- }
+ try
+ {
+ SS ss;
+ {
+ BPtr ss1b = new B;
+ ss1b->sb = "B.sb";
+ ss1b->pb = ss1b;
+
+ D1Ptr ss1d1 = new D1;
+ ss1d1->sb = "D1.sb";
+ ss1d1->sd1 = "D1.sd1";
+ ss1d1->pb = ss1b;
+
+ D3Ptr ss1d3 = new D3;
+ ss1d3->sb = "D3.sb";
+ ss1d3->sd3 = "D3.sd3";
+ ss1d3->pb = ss1b;
+
+ BPtr ss2b = new B;
+ ss2b->sb = "B.sb";
+ ss2b->pb = ss1b;
+
+ D1Ptr ss2d1 = new D1;
+ ss2d1->sb = "D1.sb";
+ ss2d1->sd1 = "D1.sd1";
+ ss2d1->pb = ss2b;
+
+ D3Ptr ss2d3 = new D3;
+ ss2d3->sb = "D3.sb";
+ ss2d3->sd3 = "D3.sd3";
+ ss2d3->pb = ss2b;
+
+ ss1d1->pd1 = ss2b;
+ ss1d3->pd3 = ss2d1;
+
+ ss2d1->pd1 = ss1d3;
+ ss2d3->pd3 = ss1d1;
+
+ SS1Ptr ss1 = new SS1;
+ ss1->s.push_back(ss1b);
+ ss1->s.push_back(ss1d1);
+ ss1->s.push_back(ss1d3);
+
+ SS2Ptr ss2 = new SS2;
+ ss2->s.push_back(ss2b);
+ ss2->s.push_back(ss2d1);
+ ss2->s.push_back(ss2d3);
+
+ ss = test->sequenceTest(ss1, ss2);
+ }
+
+ test(ss.c1);
+ BPtr ss1b = ss.c1->s[0];
+ BPtr ss1d1 = ss.c1->s[1];
+ test(ss.c2);
+ BPtr ss1d3 = ss.c1->s[2];
+
+ test(ss.c2);
+ BPtr ss2b = ss.c2->s[0];
+ BPtr ss2d1 = ss.c2->s[1];
+ BPtr ss2d3 = ss.c2->s[2];
+
+ test(ss1b->pb == ss1b);
+ test(ss1d1->pb == ss1b);
+ test(ss1d3->pb == ss1b);
+
+ test(ss2b->pb == ss1b);
+ test(ss2d1->pb == ss2b);
+ test(ss2d3->pb == ss2b);
+
+ test(ss1b->ice_id() == "::Test::B");
+ test(ss1d1->ice_id() == "::Test::D1");
+ test(ss1d3->ice_id() == "::Test::B");
+
+ test(ss2b->ice_id() == "::Test::B");
+ test(ss2d1->ice_id() == "::Test::D1");
+ test(ss2d3->ice_id() == "::Test::B");
+ }
+ catch(const ::Ice::Exception&)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "sequence slicing (AMI)... " << flush;
{
- try
- {
- SS ss;
- {
- BPtr ss1b = new B;
- ss1b->sb = "B.sb";
- ss1b->pb = ss1b;
-
- D1Ptr ss1d1 = new D1;
- ss1d1->sb = "D1.sb";
- ss1d1->sd1 = "D1.sd1";
- ss1d1->pb = ss1b;
-
- D3Ptr ss1d3 = new D3;
- ss1d3->sb = "D3.sb";
- ss1d3->sd3 = "D3.sd3";
- ss1d3->pb = ss1b;
-
- BPtr ss2b = new B;
- ss2b->sb = "B.sb";
- ss2b->pb = ss1b;
-
- D1Ptr ss2d1 = new D1;
- ss2d1->sb = "D1.sb";
- ss2d1->sd1 = "D1.sd1";
- ss2d1->pb = ss2b;
-
- D3Ptr ss2d3 = new D3;
- ss2d3->sb = "D3.sb";
- ss2d3->sd3 = "D3.sd3";
- ss2d3->pb = ss2b;
-
- ss1d1->pd1 = ss2b;
- ss1d3->pd3 = ss2d1;
-
- ss2d1->pd1 = ss1d3;
- ss2d3->pd3 = ss1d1;
-
- SS1Ptr ss1 = new SS1;
- ss1->s.push_back(ss1b);
- ss1->s.push_back(ss1d1);
- ss1->s.push_back(ss1d3);
-
- SS2Ptr ss2 = new SS2;
- ss2->s.push_back(ss2b);
- ss2->s.push_back(ss2d1);
- ss2->s.push_back(ss2d3);
-
- AMI_Test_sequenceTestIPtr cb = new AMI_Test_sequenceTestI;
- test->sequenceTest_async(cb, ss1, ss2);
- test(cb->check());
- ss = cb->r;
- }
-
- test(ss.c1);
- BPtr ss1b = ss.c1->s[0];
- BPtr ss1d1 = ss.c1->s[1];
- test(ss.c2);
- BPtr ss1d3 = ss.c1->s[2];
-
- test(ss.c2);
- BPtr ss2b = ss.c2->s[0];
- BPtr ss2d1 = ss.c2->s[1];
- BPtr ss2d3 = ss.c2->s[2];
-
- test(ss1b->pb == ss1b);
- test(ss1d1->pb == ss1b);
- test(ss1d3->pb == ss1b);
-
- test(ss2b->pb == ss1b);
- test(ss2d1->pb == ss2b);
- test(ss2d3->pb == ss2b);
-
- test(ss1b->ice_id() == "::Test::B");
- test(ss1d1->ice_id() == "::Test::D1");
- test(ss1d3->ice_id() == "::Test::B");
-
- test(ss2b->ice_id() == "::Test::B");
- test(ss2d1->ice_id() == "::Test::D1");
- test(ss2d3->ice_id() == "::Test::B");
- }
- catch(const ::Ice::Exception&)
- {
- test(0);
- }
+ try
+ {
+ SS ss;
+ {
+ BPtr ss1b = new B;
+ ss1b->sb = "B.sb";
+ ss1b->pb = ss1b;
+
+ D1Ptr ss1d1 = new D1;
+ ss1d1->sb = "D1.sb";
+ ss1d1->sd1 = "D1.sd1";
+ ss1d1->pb = ss1b;
+
+ D3Ptr ss1d3 = new D3;
+ ss1d3->sb = "D3.sb";
+ ss1d3->sd3 = "D3.sd3";
+ ss1d3->pb = ss1b;
+
+ BPtr ss2b = new B;
+ ss2b->sb = "B.sb";
+ ss2b->pb = ss1b;
+
+ D1Ptr ss2d1 = new D1;
+ ss2d1->sb = "D1.sb";
+ ss2d1->sd1 = "D1.sd1";
+ ss2d1->pb = ss2b;
+
+ D3Ptr ss2d3 = new D3;
+ ss2d3->sb = "D3.sb";
+ ss2d3->sd3 = "D3.sd3";
+ ss2d3->pb = ss2b;
+
+ ss1d1->pd1 = ss2b;
+ ss1d3->pd3 = ss2d1;
+
+ ss2d1->pd1 = ss1d3;
+ ss2d3->pd3 = ss1d1;
+
+ SS1Ptr ss1 = new SS1;
+ ss1->s.push_back(ss1b);
+ ss1->s.push_back(ss1d1);
+ ss1->s.push_back(ss1d3);
+
+ SS2Ptr ss2 = new SS2;
+ ss2->s.push_back(ss2b);
+ ss2->s.push_back(ss2d1);
+ ss2->s.push_back(ss2d3);
+
+ AMI_Test_sequenceTestIPtr cb = new AMI_Test_sequenceTestI;
+ test->sequenceTest_async(cb, ss1, ss2);
+ test(cb->check());
+ ss = cb->r;
+ }
+
+ test(ss.c1);
+ BPtr ss1b = ss.c1->s[0];
+ BPtr ss1d1 = ss.c1->s[1];
+ test(ss.c2);
+ BPtr ss1d3 = ss.c1->s[2];
+
+ test(ss.c2);
+ BPtr ss2b = ss.c2->s[0];
+ BPtr ss2d1 = ss.c2->s[1];
+ BPtr ss2d3 = ss.c2->s[2];
+
+ test(ss1b->pb == ss1b);
+ test(ss1d1->pb == ss1b);
+ test(ss1d3->pb == ss1b);
+
+ test(ss2b->pb == ss1b);
+ test(ss2d1->pb == ss2b);
+ test(ss2d3->pb == ss2b);
+
+ test(ss1b->ice_id() == "::Test::B");
+ test(ss1d1->ice_id() == "::Test::D1");
+ test(ss1d3->ice_id() == "::Test::B");
+
+ test(ss2b->ice_id() == "::Test::B");
+ test(ss2d1->ice_id() == "::Test::D1");
+ test(ss2d3->ice_id() == "::Test::B");
+ }
+ catch(const ::Ice::Exception&)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "dictionary slicing... " << flush;
{
- try
- {
- BDict bin;
- BDict bout;
- BDict r;
- int i;
- for(i = 0; i < 10; ++i)
- {
- ostringstream s;
- s << "D1." << i;
- D1Ptr d1 = new D1;
- d1->sb = s.str();
- d1->pb = d1;
- d1->sd1 = s.str();
- bin[i] = d1;
- }
-
- r = test->dictionaryTest(bin, bout);
-
- test(bout.size() == 10);
- for(i = 0; i < 10; ++i)
- {
- BPtr b = bout.find(i * 10)->second;
- test(b);
- std::ostringstream s;
- s << "D1." << i;
- test(b->sb == s.str());
- test(b->pb);
- test(b->pb != b);
- test(b->pb->sb == s.str());
- test(b->pb->pb == b->pb);
- }
-
- test(r.size() == 10);
- for(i = 0; i < 10; ++i)
- {
- BPtr b = r.find(i * 20)->second;
- test(b);
- std::ostringstream s;
- s << "D1." << i * 20;
- test(b->sb == s.str());
- test(b->pb == (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second));
- D1Ptr d1 = D1Ptr::dynamicCast(b);
- test(d1);
- test(d1->sd1 == s.str());
- test(d1->pd1 == d1);
- }
- }
- catch(const ::Ice::Exception&)
- {
- test(0);
- }
+ try
+ {
+ BDict bin;
+ BDict bout;
+ BDict r;
+ int i;
+ for(i = 0; i < 10; ++i)
+ {
+ ostringstream s;
+ s << "D1." << i;
+ D1Ptr d1 = new D1;
+ d1->sb = s.str();
+ d1->pb = d1;
+ d1->sd1 = s.str();
+ bin[i] = d1;
+ }
+
+ r = test->dictionaryTest(bin, bout);
+
+ test(bout.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ BPtr b = bout.find(i * 10)->second;
+ test(b);
+ std::ostringstream s;
+ s << "D1." << i;
+ test(b->sb == s.str());
+ test(b->pb);
+ test(b->pb != b);
+ test(b->pb->sb == s.str());
+ test(b->pb->pb == b->pb);
+ }
+
+ test(r.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ BPtr b = r.find(i * 20)->second;
+ test(b);
+ std::ostringstream s;
+ s << "D1." << i * 20;
+ test(b->sb == s.str());
+ test(b->pb == (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second));
+ D1Ptr d1 = D1Ptr::dynamicCast(b);
+ test(d1);
+ test(d1->sd1 == s.str());
+ test(d1->pd1 == d1);
+ }
+ }
+ catch(const ::Ice::Exception&)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "dictionary slicing (AMI)... " << flush;
{
- try
- {
- BDict bin;
- BDict bout;
- BDict r;
- int i;
- for(i = 0; i < 10; ++i)
- {
- ostringstream s;
- s << "D1." << i;
- D1Ptr d1 = new D1;
- d1->sb = s.str();
- d1->pb = d1;
- d1->sd1 = s.str();
- bin[i] = d1;
- }
-
- AMI_Test_dictionaryTestIPtr cb = new AMI_Test_dictionaryTestI;
- test->dictionaryTest_async(cb, bin);
- test(cb->check());
- bout = cb->bout;
- r = cb->r;
-
- test(bout.size() == 10);
- for(i = 0; i < 10; ++i)
- {
- BPtr b = bout.find(i * 10)->second;
- test(b);
- std::ostringstream s;
- s << "D1." << i;
- test(b->sb == s.str());
- test(b->pb);
- test(b->pb != b);
- test(b->pb->sb == s.str());
- test(b->pb->pb == b->pb);
- }
-
- test(r.size() == 10);
- for(i = 0; i < 10; ++i)
- {
- BPtr b = r.find(i * 20)->second;
- test(b);
- std::ostringstream s;
- s << "D1." << i * 20;
- test(b->sb == s.str());
- test(b->pb == (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second));
- D1Ptr d1 = D1Ptr::dynamicCast(b);
- test(d1);
- test(d1->sd1 == s.str());
- test(d1->pd1 == d1);
- }
- }
- catch(const ::Ice::Exception&)
- {
- test(0);
- }
+ try
+ {
+ BDict bin;
+ BDict bout;
+ BDict r;
+ int i;
+ for(i = 0; i < 10; ++i)
+ {
+ ostringstream s;
+ s << "D1." << i;
+ D1Ptr d1 = new D1;
+ d1->sb = s.str();
+ d1->pb = d1;
+ d1->sd1 = s.str();
+ bin[i] = d1;
+ }
+
+ AMI_Test_dictionaryTestIPtr cb = new AMI_Test_dictionaryTestI;
+ test->dictionaryTest_async(cb, bin);
+ test(cb->check());
+ bout = cb->bout;
+ r = cb->r;
+
+ test(bout.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ BPtr b = bout.find(i * 10)->second;
+ test(b);
+ std::ostringstream s;
+ s << "D1." << i;
+ test(b->sb == s.str());
+ test(b->pb);
+ test(b->pb != b);
+ test(b->pb->sb == s.str());
+ test(b->pb->pb == b->pb);
+ }
+
+ test(r.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ BPtr b = r.find(i * 20)->second;
+ test(b);
+ std::ostringstream s;
+ s << "D1." << i * 20;
+ test(b->sb == s.str());
+ test(b->pb == (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second));
+ D1Ptr d1 = D1Ptr::dynamicCast(b);
+ test(d1);
+ test(d1->sd1 == s.str());
+ test(d1->pd1 == d1);
+ }
+ }
+ catch(const ::Ice::Exception&)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "base exception thrown as base exception... " << flush;
{
- try
- {
- test->throwBaseAsBase();
- test(0);
- }
- catch(const BaseException& e)
- {
- test(e.ice_name() == "Test::BaseException");
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb");
- test(e.pb->pb == e.pb);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ test->throwBaseAsBase();
+ test(0);
+ }
+ catch(const BaseException& e)
+ {
+ test(e.ice_name() == "Test::BaseException");
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb");
+ test(e.pb->pb == e.pb);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "base exception thrown as base exception (AMI)... " << flush;
{
- AMI_Test_throwBaseAsBaseIPtr cb = new AMI_Test_throwBaseAsBaseI;
- test->throwBaseAsBase_async(cb);
- test(cb->check());
+ AMI_Test_throwBaseAsBaseIPtr cb = new AMI_Test_throwBaseAsBaseI;
+ test->throwBaseAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "derived exception thrown as base exception... " << flush;
{
- try
- {
- test->throwDerivedAsBase();
- test(0);
- }
- catch(const DerivedException& e)
- {
- test(e.ice_name() == "Test::DerivedException");
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb1");
- test(e.pb->pb == e.pb);
- test(e.sde == "sde1");
- test(e.pd1);
- test(e.pd1->sb == "sb2");
- test(e.pd1->pb == e.pd1);
- test(e.pd1->sd1 == "sd2");
- test(e.pd1->pd1 == e.pd1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ test->throwDerivedAsBase();
+ test(0);
+ }
+ catch(const DerivedException& e)
+ {
+ test(e.ice_name() == "Test::DerivedException");
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb1");
+ test(e.pb->pb == e.pb);
+ test(e.sde == "sde1");
+ test(e.pd1);
+ test(e.pd1->sb == "sb2");
+ test(e.pd1->pb == e.pd1);
+ test(e.pd1->sd1 == "sd2");
+ test(e.pd1->pd1 == e.pd1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "derived exception thrown as base exception (AMI)... " << flush;
{
- AMI_Test_throwDerivedAsBaseIPtr cb = new AMI_Test_throwDerivedAsBaseI;
- test->throwDerivedAsBase_async(cb);
- test(cb->check());
+ AMI_Test_throwDerivedAsBaseIPtr cb = new AMI_Test_throwDerivedAsBaseI;
+ test->throwDerivedAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "derived exception thrown as derived exception... " << flush;
{
- try
- {
- test->throwDerivedAsDerived();
- test(0);
- }
- catch(const DerivedException& e)
- {
- test(e.ice_name() == "Test::DerivedException");
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb1");
- test(e.pb->pb == e.pb);
- test(e.sde == "sde1");
- test(e.pd1);
- test(e.pd1->sb == "sb2");
- test(e.pd1->pb == e.pd1);
- test(e.pd1->sd1 == "sd2");
- test(e.pd1->pd1 == e.pd1);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ test->throwDerivedAsDerived();
+ test(0);
+ }
+ catch(const DerivedException& e)
+ {
+ test(e.ice_name() == "Test::DerivedException");
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb1");
+ test(e.pb->pb == e.pb);
+ test(e.sde == "sde1");
+ test(e.pd1);
+ test(e.pd1->sb == "sb2");
+ test(e.pd1->pb == e.pd1);
+ test(e.pd1->sd1 == "sd2");
+ test(e.pd1->pd1 == e.pd1);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "derived exception thrown as derived exception (AMI)... " << flush;
{
- AMI_Test_throwDerivedAsDerivedIPtr cb = new AMI_Test_throwDerivedAsDerivedI;
- test->throwDerivedAsDerived_async(cb);
- test(cb->check());
+ AMI_Test_throwDerivedAsDerivedIPtr cb = new AMI_Test_throwDerivedAsDerivedI;
+ test->throwDerivedAsDerived_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "unknown derived exception thrown as base exception... " << flush;
{
- try
- {
- test->throwUnknownDerivedAsBase();
- test(0);
- }
- catch(const BaseException& e)
- {
- test(e.ice_name() == "Test::BaseException");
- test(e.sbe == "sbe");
- test(e.pb);
- test(e.pb->sb == "sb d2");
- test(e.pb->pb == e.pb);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ test->throwUnknownDerivedAsBase();
+ test(0);
+ }
+ catch(const BaseException& e)
+ {
+ test(e.ice_name() == "Test::BaseException");
+ test(e.sbe == "sbe");
+ test(e.pb);
+ test(e.pb->sb == "sb d2");
+ test(e.pb->pb == e.pb);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "unknown derived exception thrown as base exception (AMI)... " << flush;
{
- AMI_Test_throwUnknownDerivedAsBaseIPtr cb = new AMI_Test_throwUnknownDerivedAsBaseI;
- test->throwUnknownDerivedAsBase_async(cb);
- test(cb->check());
+ AMI_Test_throwUnknownDerivedAsBaseIPtr cb = new AMI_Test_throwUnknownDerivedAsBaseI;
+ test->throwUnknownDerivedAsBase_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "forward-declared class... " << flush;
{
- try
- {
- ForwardPtr f;
- test->useForward(f);
- test(f);
- }
- catch(...)
- {
- test(0);
- }
+ try
+ {
+ ForwardPtr f;
+ test->useForward(f);
+ test(f);
+ }
+ catch(...)
+ {
+ test(0);
+ }
}
cout << "ok" << endl;
cout << "forward-declared class (AMI)... " << flush;
{
- AMI_Test_useForwardIPtr cb = new AMI_Test_useForwardI;
- test->useForward_async(cb);
- test(cb->check());
+ AMI_Test_useForwardIPtr cb = new AMI_Test_useForwardI;
+ test->useForward_async(cb);
+ test(cb->check());
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/slicing/objects/Client.cpp b/cpp/test/Ice/slicing/objects/Client.cpp
index 94509fc0099..f3ca8da558d 100644
--- a/cpp/test/Ice/slicing/objects/Client.cpp
+++ b/cpp/test/Ice/slicing/objects/Client.cpp
@@ -31,26 +31,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/slicing/objects/Server.cpp b/cpp/test/Ice/slicing/objects/Server.cpp
index 9a7ad52c084..697d3b3cbfa 100644
--- a/cpp/test/Ice/slicing/objects/Server.cpp
+++ b/cpp/test/Ice/slicing/objects/Server.cpp
@@ -34,26 +34,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/slicing/objects/ServerAMD.cpp b/cpp/test/Ice/slicing/objects/ServerAMD.cpp
index f19fcbf7f44..16190251017 100644
--- a/cpp/test/Ice/slicing/objects/ServerAMD.cpp
+++ b/cpp/test/Ice/slicing/objects/ServerAMD.cpp
@@ -34,26 +34,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/slicing/objects/Test.ice b/cpp/test/Ice/slicing/objects/Test.ice
index 9d31ce660b5..01e91579311 100644
--- a/cpp/test/Ice/slicing/objects/Test.ice
+++ b/cpp/test/Ice/slicing/objects/Test.ice
@@ -67,7 +67,7 @@ exception DerivedException extends BaseException
D1 pd1;
};
-class Forward; // Forward-declared class defined in another compilation unit
+class Forward; // Forward-declared class defined in another compilation unit
["ami"] interface TestIntf
{
@@ -104,7 +104,7 @@ class Forward; // Forward-declared class defined in another compilation unit
void throwDerivedAsDerived() throws DerivedException;
void throwUnknownDerivedAsBase() throws BaseException;
- void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly.
+ void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly.
void shutdown();
};
diff --git a/cpp/test/Ice/slicing/objects/TestAMD.ice b/cpp/test/Ice/slicing/objects/TestAMD.ice
index 9303d9e8325..1fe41bec3f5 100644
--- a/cpp/test/Ice/slicing/objects/TestAMD.ice
+++ b/cpp/test/Ice/slicing/objects/TestAMD.ice
@@ -67,7 +67,7 @@ exception DerivedException extends BaseException
D1 pd1;
};
-class Forward; // Forward-declared class defined in another compilation unit
+class Forward; // Forward-declared class defined in another compilation unit
["ami", "amd"] interface TestIntf
{
@@ -104,7 +104,7 @@ class Forward; // Forward-declared class defined in another compilation unit
void throwDerivedAsDerived() throws DerivedException;
void throwUnknownDerivedAsBase() throws BaseException;
- void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly.
+ void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly.
void shutdown();
};
diff --git a/cpp/test/Ice/slicing/objects/TestAMDI.cpp b/cpp/test/Ice/slicing/objects/TestAMDI.cpp
index b8ca525e84c..ec4dfa48769 100644
--- a/cpp/test/Ice/slicing/objects/TestAMDI.cpp
+++ b/cpp/test/Ice/slicing/objects/TestAMDI.cpp
@@ -45,7 +45,7 @@ TestI::SBSKnownDerivedAsSBase_async(const AMD_TestIntf_SBSKnownDerivedAsSBasePtr
void
TestI::SBSKnownDerivedAsSBSKnownDerived_async(const AMD_TestIntf_SBSKnownDerivedAsSBSKnownDerivedPtr& cb,
- const ::Ice::Current&)
+ const ::Ice::Current&)
{
SBSKnownDerivedPtr sbskd = new SBSKnownDerived;
sbskd->sb = "SBSKnownDerived.sb";
@@ -254,7 +254,7 @@ TestI::returnTest3_async(const AMD_TestIntf_returnTest3Ptr& cb, const BPtr& p1,
void
TestI::sequenceTest_async(const AMD_TestIntf_sequenceTestPtr& cb,
- const SS1Ptr& p1, const SS2Ptr& p2, const ::Ice::Current&)
+ const SS1Ptr& p1, const SS2Ptr& p2, const ::Ice::Current&)
{
SS ss;
ss.c1 = p1;
@@ -269,25 +269,25 @@ TestI::dictionaryTest_async(const AMD_TestIntf_dictionaryTestPtr& cb, const BDic
int i;
for(i = 0; i < 10; ++i)
{
- BPtr b = bin.find(i)->second;
- D2Ptr d2 = new D2;
- d2->sb = b->sb;
- d2->pb = b->pb;
- d2->sd2 = "D2";
- d2->pd2 = d2;
- bout[i * 10] = d2;
+ BPtr b = bin.find(i)->second;
+ D2Ptr d2 = new D2;
+ d2->sb = b->sb;
+ d2->pb = b->pb;
+ d2->sd2 = "D2";
+ d2->pd2 = d2;
+ bout[i * 10] = d2;
}
BDict r;
for(i = 0; i < 10; ++i)
{
- std::ostringstream s;
- s << "D1." << i * 20;
- D1Ptr d1 = new D1;
- d1->sb = s.str();
- d1->pb = (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second);
- d1->sd1 = s.str();
- d1->pd1 = d1;
- r[i * 20] = d1;
+ std::ostringstream s;
+ s << "D1." << i * 20;
+ D1Ptr d1 = new D1;
+ d1->sb = s.str();
+ d1->pb = (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second);
+ d1->sd1 = s.str();
+ d1->pd1 = d1;
+ r[i * 20] = d1;
}
cb->ice_response(r, bout);
}
diff --git a/cpp/test/Ice/slicing/objects/TestAMDI.h b/cpp/test/Ice/slicing/objects/TestAMDI.h
index edb10690fce..81224a27376 100644
--- a/cpp/test/Ice/slicing/objects/TestAMDI.h
+++ b/cpp/test/Ice/slicing/objects/TestAMDI.h
@@ -22,12 +22,12 @@ public:
virtual void SBaseAsObject_async(const ::Test::AMD_TestIntf_SBaseAsObjectPtr&, const ::Ice::Current&);
virtual void SBaseAsSBase_async(const ::Test::AMD_TestIntf_SBaseAsSBasePtr&, const ::Ice::Current&);
virtual void SBSKnownDerivedAsSBase_async(const ::Test::AMD_TestIntf_SBSKnownDerivedAsSBasePtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void SBSKnownDerivedAsSBSKnownDerived_async(const ::Test::AMD_TestIntf_SBSKnownDerivedAsSBSKnownDerivedPtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void SBSUnknownDerivedAsSBase_async(const ::Test::AMD_TestIntf_SBSUnknownDerivedAsSBasePtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void SUnknownAsObject_async(const ::Test::AMD_TestIntf_SUnknownAsObjectPtr&, const ::Ice::Current&);
@@ -46,20 +46,20 @@ public:
virtual void returnTest1_async(const ::Test::AMD_TestIntf_returnTest1Ptr&, const ::Ice::Current&);
virtual void returnTest2_async(const ::Test::AMD_TestIntf_returnTest2Ptr&, const ::Ice::Current&);
virtual void returnTest3_async(const ::Test::AMD_TestIntf_returnTest3Ptr&, const ::Test::BPtr&, const ::Test::BPtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void sequenceTest_async(const ::Test::AMD_TestIntf_sequenceTestPtr&,
- const ::Test::SS1Ptr&, const ::Test::SS2Ptr&, const ::Ice::Current&);
+ const ::Test::SS1Ptr&, const ::Test::SS2Ptr&, const ::Ice::Current&);
virtual void dictionaryTest_async(const ::Test::AMD_TestIntf_dictionaryTestPtr&,
- const ::Test::BDict&, const ::Ice::Current&);
+ const ::Test::BDict&, const ::Ice::Current&);
virtual void throwBaseAsBase_async(const ::Test::AMD_TestIntf_throwBaseAsBasePtr&, const ::Ice::Current&);
virtual void throwDerivedAsBase_async(const ::Test::AMD_TestIntf_throwDerivedAsBasePtr&, const ::Ice::Current&);
virtual void throwDerivedAsDerived_async(const ::Test::AMD_TestIntf_throwDerivedAsDerivedPtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void throwUnknownDerivedAsBase_async(const ::Test::AMD_TestIntf_throwUnknownDerivedAsBasePtr&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
virtual void useForward_async(const ::Test::AMD_TestIntf_useForwardPtr&, const ::Ice::Current&);
diff --git a/cpp/test/Ice/slicing/objects/TestI.cpp b/cpp/test/Ice/slicing/objects/TestI.cpp
index 660ba0b86dc..bf33febf78d 100644
--- a/cpp/test/Ice/slicing/objects/TestI.cpp
+++ b/cpp/test/Ice/slicing/objects/TestI.cpp
@@ -245,25 +245,25 @@ TestI::dictionaryTest(const BDict& bin, BDict& bout, const ::Ice::Current&)
int i;
for(i = 0; i < 10; ++i)
{
- BPtr b = bin.find(i)->second;
- D2Ptr d2 = new D2;
- d2->sb = b->sb;
- d2->pb = b->pb;
- d2->sd2 = "D2";
- d2->pd2 = d2;
- bout[i * 10] = d2;
+ BPtr b = bin.find(i)->second;
+ D2Ptr d2 = new D2;
+ d2->sb = b->sb;
+ d2->pb = b->pb;
+ d2->sd2 = "D2";
+ d2->pd2 = d2;
+ bout[i * 10] = d2;
}
BDict r;
for(i = 0; i < 10; ++i)
{
- std::ostringstream s;
- s << "D1." << i * 20;
- D1Ptr d1 = new D1;
- d1->sb = s.str();
- d1->pb = (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second);
- d1->sd1 = s.str();
- d1->pd1 = d1;
- r[i * 20] = d1;
+ std::ostringstream s;
+ s << "D1." << i * 20;
+ D1Ptr d1 = new D1;
+ d1->sb = s.str();
+ d1->pb = (i == 0 ? BPtr(0) : r.find((i - 1) * 20)->second);
+ d1->sd1 = s.str();
+ d1->pd1 = d1;
+ r[i * 20] = d1;
}
return r;
}
diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp
index 6861067f468..efa8f77f459 100644
--- a/cpp/test/Ice/stream/Client.cpp
+++ b/cpp/test/Ice/stream/Client.cpp
@@ -99,7 +99,7 @@ public:
virtual Ice::ObjectPtr
create(const string& type)
{
- return _factory->create(type);
+ return _factory->create(type);
}
virtual void
@@ -110,7 +110,7 @@ public:
void
setFactory(const Ice::ObjectFactoryPtr& factory)
{
- _factory = factory;
+ _factory = factory;
}
private:
diff --git a/cpp/test/Ice/timeout/AllTests.cpp b/cpp/test/Ice/timeout/AllTests.cpp
index 71af9e97b60..694604304f9 100644
--- a/cpp/test/Ice/timeout/AllTests.cpp
+++ b/cpp/test/Ice/timeout/AllTests.cpp
@@ -19,7 +19,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -29,26 +29,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -62,12 +62,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
typedef IceUtil::Handle<AMISendData> AMISendDataPtr;
@@ -78,13 +78,13 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(dynamic_cast<const Ice::TimeoutException*>(&ex));
- called();
+ test(dynamic_cast<const Ice::TimeoutException*>(&ex));
+ called();
}
};
typedef IceUtil::Handle<AMISendDataEx> AMISendDataExPtr;
@@ -95,12 +95,12 @@ public:
virtual void ice_response()
{
- called();
+ called();
}
virtual void ice_exception(const ::Ice::Exception&)
{
- test(false);
+ test(false);
}
};
typedef IceUtil::Handle<AMISleep> AMISleepPtr;
@@ -111,13 +111,13 @@ public:
virtual void ice_response()
{
- test(false);
+ test(false);
}
virtual void ice_exception(const ::Ice::Exception& ex)
{
- test(dynamic_cast<const Ice::TimeoutException*>(&ex));
- called();
+ test(dynamic_cast<const Ice::TimeoutException*>(&ex));
+ called();
}
};
typedef IceUtil::Handle<AMISleepEx> AMISleepExPtr;
@@ -134,249 +134,249 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing connect timeout... " << flush;
{
- //
- // Expect ConnectTimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- to->holdAdapter(750);
- to->ice_getConnection()->close(true); // Force a reconnect.
- try
- {
- to->op();
- test(false);
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- // Expected.
- }
+ //
+ // Expect ConnectTimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ to->holdAdapter(750);
+ to->ice_getConnection()->close(true); // Force a reconnect.
+ try
+ {
+ to->op();
+ test(false);
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ // Expected.
+ }
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- to->holdAdapter(500);
- to->ice_getConnection()->close(true); // Force a reconnect.
- try
- {
- to->op();
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- test(false);
- }
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ to->holdAdapter(500);
+ to->ice_getConnection()->close(true); // Force a reconnect.
+ try
+ {
+ to->op();
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "testing read timeout... " << flush;
{
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- try
- {
- to->sleep(750);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ try
+ {
+ to->sleep(750);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- try
- {
- to->sleep(500);
- }
- catch(const Ice::TimeoutException&)
- {
- test(false);
- }
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ try
+ {
+ to->sleep(500);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "testing write timeout... " << flush;
{
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- to->holdAdapter(750);
- try
- {
- ByteSeq seq(100000);
- to->sendData(seq);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ to->holdAdapter(750);
+ try
+ {
+ ByteSeq seq(100000);
+ to->sendData(seq);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- to->holdAdapter(500);
- try
- {
- ByteSeq seq(100000);
- to->sendData(seq);
- }
- catch(const Ice::TimeoutException&)
- {
- test(false);
- }
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ to->holdAdapter(500);
+ try
+ {
+ ByteSeq seq(100000);
+ to->sendData(seq);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
cout << "testing AMI read timeout... " << flush;
{
- //
- // The resolution of AMI timeouts is limited by the connection monitor
- // thread. We set Ice.MonitorConnections=1 (one second) in main().
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- AMISleepExPtr cb = new AMISleepEx;
- to->sleep_async(cb, 2000);
- test(cb->check());
+ //
+ // The resolution of AMI timeouts is limited by the connection monitor
+ // thread. We set Ice.MonitorConnections=1 (one second) in main().
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ AMISleepExPtr cb = new AMISleepEx;
+ to->sleep_async(cb, 2000);
+ test(cb->check());
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- AMISleepPtr cb = new AMISleep;
- to->sleep_async(cb, 500);
- test(cb->check());
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ AMISleepPtr cb = new AMISleep;
+ to->sleep_async(cb, 500);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "testing AMI write timeout... " << flush;
{
- //
- // The resolution of AMI timeouts is limited by the connection monitor
- // thread. We set Ice.MonitorConnections=1 (one second) in main().
- //
- // Expect TimeoutException.
- //
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
- to->holdAdapter(2000);
- ByteSeq seq(100000);
- AMISendDataExPtr cb = new AMISendDataEx;
- to->sendData_async(cb, seq);
- test(cb->check());
+ //
+ // The resolution of AMI timeouts is limited by the connection monitor
+ // thread. We set Ice.MonitorConnections=1 (one second) in main().
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(500));
+ to->holdAdapter(2000);
+ ByteSeq seq(100000);
+ AMISendDataExPtr cb = new AMISendDataEx;
+ to->sendData_async(cb, seq);
+ test(cb->check());
}
{
- //
- // Expect success.
- //
- timeout->op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
- to->holdAdapter(500);
- ByteSeq seq(100000);
- AMISendDataPtr cb = new AMISendData;
- to->sendData_async(cb, seq);
- test(cb->check());
+ //
+ // Expect success.
+ //
+ timeout->op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(obj->ice_timeout(1000));
+ to->holdAdapter(500);
+ ByteSeq seq(100000);
+ AMISendDataPtr cb = new AMISendData;
+ to->sendData_async(cb, seq);
+ test(cb->check());
}
cout << "ok" << endl;
cout << "testing timeout overrides... " << flush;
{
- //
- // Test Ice.Override.Timeout. This property overrides all
- // endpoint timeouts.
- //
- Ice::InitializationData initData;
- initData.properties = communicator->getProperties()->clone();
- initData.properties->setProperty("Ice.Override.Timeout", "500");
- Ice::CommunicatorPtr comm = Ice::initialize(initData);
- TimeoutPrx to = TimeoutPrx::checkedCast(comm->stringToProxy(sref));
- try
- {
- to->sleep(750);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
- //
- // Calling ice_timeout() should have no effect.
- //
- timeout->op(); // Ensure adapter is active.
- to = TimeoutPrx::checkedCast(to->ice_timeout(1000));
- try
- {
- to->sleep(750);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
- comm->destroy();
+ //
+ // Test Ice.Override.Timeout. This property overrides all
+ // endpoint timeouts.
+ //
+ Ice::InitializationData initData;
+ initData.properties = communicator->getProperties()->clone();
+ initData.properties->setProperty("Ice.Override.Timeout", "500");
+ Ice::CommunicatorPtr comm = Ice::initialize(initData);
+ TimeoutPrx to = TimeoutPrx::checkedCast(comm->stringToProxy(sref));
+ try
+ {
+ to->sleep(750);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
+ //
+ // Calling ice_timeout() should have no effect.
+ //
+ timeout->op(); // Ensure adapter is active.
+ to = TimeoutPrx::checkedCast(to->ice_timeout(1000));
+ try
+ {
+ to->sleep(750);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
+ comm->destroy();
}
{
- //
- // Test Ice.Override.ConnectTimeout.
- //
- Ice::InitializationData initData;
- initData.properties = communicator->getProperties()->clone();
- initData.properties->setProperty("Ice.Override.ConnectTimeout", "750");
- Ice::CommunicatorPtr comm = Ice::initialize(initData);
- timeout->holdAdapter(1000);
- TimeoutPrx to = TimeoutPrx::uncheckedCast(comm->stringToProxy(sref));
- try
- {
- to->op();
- test(false);
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- // Expected.
- }
- //
- // Calling ice_timeout() should have no effect on the connect timeout.
- //
- timeout->op(); // Ensure adapter is active.
- timeout->holdAdapter(1000);
- to = TimeoutPrx::uncheckedCast(to->ice_timeout(1250));
- try
- {
- to->op();
- test(false);
- }
- catch(const Ice::ConnectTimeoutException&)
- {
- // Expected.
- }
- //
- // Verify that timeout set via ice_timeout() is still used for requests.
- //
- to->op(); // Force connection.
- try
- {
- to->sleep(1500);
- test(false);
- }
- catch(const Ice::TimeoutException&)
- {
- // Expected.
- }
- comm->destroy();
+ //
+ // Test Ice.Override.ConnectTimeout.
+ //
+ Ice::InitializationData initData;
+ initData.properties = communicator->getProperties()->clone();
+ initData.properties->setProperty("Ice.Override.ConnectTimeout", "750");
+ Ice::CommunicatorPtr comm = Ice::initialize(initData);
+ timeout->holdAdapter(1000);
+ TimeoutPrx to = TimeoutPrx::uncheckedCast(comm->stringToProxy(sref));
+ try
+ {
+ to->op();
+ test(false);
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ // Expected.
+ }
+ //
+ // Calling ice_timeout() should have no effect on the connect timeout.
+ //
+ timeout->op(); // Ensure adapter is active.
+ timeout->holdAdapter(1000);
+ to = TimeoutPrx::uncheckedCast(to->ice_timeout(1250));
+ try
+ {
+ to->op();
+ test(false);
+ }
+ catch(const Ice::ConnectTimeoutException&)
+ {
+ // Expected.
+ }
+ //
+ // Verify that timeout set via ice_timeout() is still used for requests.
+ //
+ to->op(); // Force connection.
+ try
+ {
+ to->sleep(1500);
+ test(false);
+ }
+ catch(const Ice::TimeoutException&)
+ {
+ // Expected.
+ }
+ comm->destroy();
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/timeout/Client.cpp b/cpp/test/Ice/timeout/Client.cpp
index fef4d9c797e..b3c9c744c72 100644
--- a/cpp/test/Ice/timeout/Client.cpp
+++ b/cpp/test/Ice/timeout/Client.cpp
@@ -31,44 +31,44 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
- //
- // For this test, we want to disable retries.
- //
- initData.properties->setProperty("Ice.RetryIntervals", "-1");
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties->setProperty("Ice.RetryIntervals", "-1");
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- //
- // Check for AMI timeouts every second.
- //
- initData.properties->setProperty("Ice.MonitorConnections", "1");
+ //
+ // Check for AMI timeouts every second.
+ //
+ initData.properties->setProperty("Ice.MonitorConnections", "1");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/timeout/Server.cpp b/cpp/test/Ice/timeout/Server.cpp
index bed1e7aeeaf..cd1d2159c86 100644
--- a/cpp/test/Ice/timeout/Server.cpp
+++ b/cpp/test/Ice/timeout/Server.cpp
@@ -32,34 +32,34 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/Ice/timeout/TestI.cpp b/cpp/test/Ice/timeout/TestI.cpp
index 23356bfb4a8..b69ac089a70 100644
--- a/cpp/test/Ice/timeout/TestI.cpp
+++ b/cpp/test/Ice/timeout/TestI.cpp
@@ -19,15 +19,15 @@ class ActivateAdapterThread : public IceUtil::Thread
public:
ActivateAdapterThread(const ObjectAdapterPtr& adapter, int timeout) :
- _adapter(adapter), _timeout(timeout)
+ _adapter(adapter), _timeout(timeout)
{
}
virtual void
run()
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_timeout));
- _adapter->activate();
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_timeout));
+ _adapter->activate();
}
private:
diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp
index 26460fe700f..8777ab9cba7 100644
--- a/cpp/test/IceGrid/activation/AllTests.cpp
+++ b/cpp/test/IceGrid/activation/AllTests.cpp
@@ -23,14 +23,14 @@ waitForServerState(const IceGrid::AdminPrx& admin, const std::string& server, Ic
int nRetry = 0;
while(admin->getServerState(server) != state && nRetry < 15)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
}
if(admin->getServerState(server) != state)
{
- cerr << "server state change timed out:" << endl;
- cerr << "server: " << server << endl;
- cerr << "state: " << state << endl;
+ cerr << "server state change timed out:" << endl;
+ cerr << "server: " << server << endl;
+ cerr << "state: " << state << endl;
}
}
@@ -39,42 +39,42 @@ class PingThread : public IceUtil::Thread, IceUtil::Monitor<IceUtil::Mutex>
public:
PingThread(const Ice::ObjectPrx& proxy, int nRepetitions) :
- _proxy(proxy), _finished(false), _nRepetitions(nRepetitions)
+ _proxy(proxy), _finished(false), _nRepetitions(nRepetitions)
{
}
virtual void run()
{
- for(int i = 0; i < _nRepetitions; ++i)
- {
- try
- {
- _proxy->ice_ping();
- }
- catch(const Ice::LocalException& ex)
- {
- _exception.reset(dynamic_cast<Ice::LocalException*>(ex.ice_clone()));
- }
- catch(...)
- {
- assert(false);
- }
- }
-
- Lock sync(*this);
- _finished = true;
- notifyAll();
+ for(int i = 0; i < _nRepetitions; ++i)
+ {
+ try
+ {
+ _proxy->ice_ping();
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ _exception.reset(dynamic_cast<Ice::LocalException*>(ex.ice_clone()));
+ }
+ catch(...)
+ {
+ assert(false);
+ }
+ }
+
+ Lock sync(*this);
+ _finished = true;
+ notifyAll();
}
auto_ptr<Ice::LocalException>
waitUntilFinished()
{
- Lock sync(*this);
- while(!_finished)
- {
- wait();
- }
- return _exception;
+ Lock sync(*this);
+ while(!_finished)
+ {
+ wait();
+ }
+ return _exception;
}
private:
@@ -91,7 +91,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -106,15 +106,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -155,220 +155,220 @@ allTests(const Ice::CommunicatorPtr& communicator)
int nRetry = 0;
while(!admin->pingNode("node-1") && nRetry < 15)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
+ ++nRetry;
}
nRetry = 0;
while(!admin->pingNode("node-2") && nRetry < 15)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
+ ++nRetry;
}
cout << "testing on-demand activation... " << flush;
try
{
- test(admin->getServerState("server") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server"));
- waitForServerState(admin, "server", IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server", IceGrid::Inactive);
- nRetry = 4;
- while(--nRetry > 0)
- {
- obj->shutdown();
- }
- waitForServerState(admin, "server", IceGrid::Inactive);
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server"));
+ waitForServerState(admin, "server", IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server", IceGrid::Inactive);
+ nRetry = 4;
+ while(--nRetry > 0)
+ {
+ obj->shutdown();
+ }
+ waitForServerState(admin, "server", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing manual activation... " << flush;
try
{
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- TestIntfPrx obj;
- try
- {
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->startServer("server-manual");
- test(admin->getServerState("server-manual") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
- test(admin->getServerState("server-manual") == IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server-manual", IceGrid::Inactive);
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ TestIntfPrx obj;
+ try
+ {
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->startServer("server-manual");
+ test(admin->getServerState("server-manual") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-manual"));
+ test(admin->getServerState("server-manual") == IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server-manual", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing always activation... " << flush;
try
{
- waitForServerState(admin, "server-always", IceGrid::Active);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-always"));
- admin->stopServer("server-always");
- waitForServerState(admin, "server-always", IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server-always", IceGrid::Active);
- nRetry = 4;
- while(--nRetry > 0)
- {
- obj->shutdown();
- }
- waitForServerState(admin, "server-always", IceGrid::Active);
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server-always"));
+ admin->stopServer("server-always");
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ nRetry = 4;
+ while(--nRetry > 0)
+ {
+ obj->shutdown();
+ }
+ waitForServerState(admin, "server-always", IceGrid::Active);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing session activation... " << flush;
try
{
- IceGrid::SessionPrx session = registry->createSession("test", "");
-
- test(admin->getServerState("server-session") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-session"));
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- session->allocateObjectById(obj->ice_getIdentity());
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- obj->shutdown();
- waitForServerState(admin, "server-session", IceGrid::Inactive);
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- nRetry = 4;
- while(--nRetry > 0)
- {
- obj->shutdown();
- }
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- session->releaseObject(obj->ice_getIdentity());
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- waitForServerState(admin, "server-session", IceGrid::Inactive);
-
- session->allocateObjectById(obj->ice_getIdentity());
- obj->ice_ping();
- waitForServerState(admin, "server-session", IceGrid::Active);
- session->destroy();
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- waitForServerState(admin, "server-session", IceGrid::Inactive);
+ IceGrid::SessionPrx session = registry->createSession("test", "");
+
+ test(admin->getServerState("server-session") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-session"));
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ session->allocateObjectById(obj->ice_getIdentity());
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ obj->shutdown();
+ waitForServerState(admin, "server-session", IceGrid::Inactive);
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ nRetry = 4;
+ while(--nRetry > 0)
+ {
+ obj->shutdown();
+ }
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ session->releaseObject(obj->ice_getIdentity());
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ waitForServerState(admin, "server-session", IceGrid::Inactive);
+
+ session->allocateObjectById(obj->ice_getIdentity());
+ obj->ice_ping();
+ waitForServerState(admin, "server-session", IceGrid::Active);
+ session->destroy();
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ waitForServerState(admin, "server-session", IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing server disable... " << flush;
try
{
- test(admin->getServerState("server") == IceGrid::Inactive);
- admin->enableServer("server", false);
- try
- {
- communicator->stringToProxy("server")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- try
- {
- admin->startServer("server");
- test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server") == IceGrid::Inactive);
-
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->enableServer("server-manual", false);
- try
- {
- communicator->stringToProxy("server-manual")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- try
- {
- admin->startServer("server-manual");
- test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
-
- test(admin->getServerState("server-always") == IceGrid::Active);
- admin->enableServer("server-always", false);
- admin->stopServer("server-always");
- test(admin->getServerState("server-always") == IceGrid::Inactive);
- try
- {
- communicator->stringToProxy("server-always")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- try
- {
- admin->startServer("server-always");
- test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server-always") == IceGrid::Inactive);
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ admin->enableServer("server", false);
+ try
+ {
+ communicator->stringToProxy("server")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server");
+ test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->enableServer("server-manual", false);
+ try
+ {
+ communicator->stringToProxy("server-manual")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server-manual");
+ test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-always") == IceGrid::Active);
+ admin->enableServer("server-always", false);
+ admin->stopServer("server-always");
+ test(admin->getServerState("server-always") == IceGrid::Inactive);
+ try
+ {
+ communicator->stringToProxy("server-always")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ try
+ {
+ admin->startServer("server-always");
+ test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-always") == IceGrid::Inactive);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
@@ -376,277 +376,277 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing server enable... " << flush;
try
{
- test(admin->getServerState("server") == IceGrid::Inactive);
- admin->enableServer("server", true);
- communicator->stringToProxy("server")->ice_ping();
- admin->stopServer("server");
- test(admin->getServerState("server") == IceGrid::Inactive);
- admin->startServer("server");
- test(admin->getServerState("server") == IceGrid::Active);
- admin->stopServer("server");
- test(admin->getServerState("server") == IceGrid::Inactive);
-
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->enableServer("server-manual", true);
- try
- {
- communicator->stringToProxy("server-manual")->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
- admin->startServer("server-manual");
- test(admin->getServerState("server-manual") == IceGrid::Active);
- admin->stopServer("server-manual");
- test(admin->getServerState("server-manual") == IceGrid::Inactive);
-
- test(admin->getServerState("server-always") == IceGrid::Inactive);
- admin->enableServer("server-always", true);
- waitForServerState(admin, "server-always", IceGrid::Active);
- admin->stopServer("server-always");
- try
- {
- admin->startServer("server-always");
-// test(false);
- }
- catch(const IceGrid::ServerStartException&)
- {
- }
- test(admin->getServerState("server-always") == IceGrid::Active);
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ admin->enableServer("server", true);
+ communicator->stringToProxy("server")->ice_ping();
+ admin->stopServer("server");
+ test(admin->getServerState("server") == IceGrid::Inactive);
+ admin->startServer("server");
+ test(admin->getServerState("server") == IceGrid::Active);
+ admin->stopServer("server");
+ test(admin->getServerState("server") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->enableServer("server-manual", true);
+ try
+ {
+ communicator->stringToProxy("server-manual")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+ admin->startServer("server-manual");
+ test(admin->getServerState("server-manual") == IceGrid::Active);
+ admin->stopServer("server-manual");
+ test(admin->getServerState("server-manual") == IceGrid::Inactive);
+
+ test(admin->getServerState("server-always") == IceGrid::Inactive);
+ admin->enableServer("server-always", true);
+ waitForServerState(admin, "server-always", IceGrid::Active);
+ admin->stopServer("server-always");
+ try
+ {
+ admin->startServer("server-always");
+// test(false);
+ }
+ catch(const IceGrid::ServerStartException&)
+ {
+ }
+ test(admin->getServerState("server-always") == IceGrid::Active);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing activation failure... " << flush;
try
{
- int i;
- const int nThreads = 3;
- Ice::ObjectPrx invalid = communicator->stringToProxy("invalid-exe");
-
- vector<PingThreadPtr> threads;
- threads.reserve(nThreads);
- vector<PingThreadPtr>::const_iterator p;
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(invalid, 10));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- threads.resize(0);
-
- invalid = communicator->stringToProxy("invalid-pwd");
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(invalid, 10));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- threads.resize(0);
-
- invalid = communicator->stringToProxy("fail-on-startup");
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(invalid, 5));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- threads.resize(0);
+ int i;
+ const int nThreads = 3;
+ Ice::ObjectPrx invalid = communicator->stringToProxy("invalid-exe");
+
+ vector<PingThreadPtr> threads;
+ threads.reserve(nThreads);
+ vector<PingThreadPtr>::const_iterator p;
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(invalid, 10));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ threads.resize(0);
+
+ invalid = communicator->stringToProxy("invalid-pwd");
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(invalid, 10));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ threads.resize(0);
+
+ invalid = communicator->stringToProxy("fail-on-startup");
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(invalid, 5));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ threads.resize(0);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "testing activation timeout... " << flush;
try
{
- test(admin->getServerState("server-activation-timeout") == IceGrid::Inactive);
- const int nThreads = 5;
- Ice::ObjectPrx proxy = communicator->stringToProxy("server-activation-timeout");
- vector<PingThreadPtr> threads;
- threads.reserve(nThreads);
- vector<PingThreadPtr>::const_iterator p;
- int i;
- for(i = 0; i < nThreads; i++)
- {
- threads.push_back(new PingThread(proxy, 1));
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->start();
- }
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
- test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
- }
- admin->stopServer("server-activation-timeout");
+ test(admin->getServerState("server-activation-timeout") == IceGrid::Inactive);
+ const int nThreads = 5;
+ Ice::ObjectPrx proxy = communicator->stringToProxy("server-activation-timeout");
+ vector<PingThreadPtr> threads;
+ threads.reserve(nThreads);
+ vector<PingThreadPtr>::const_iterator p;
+ int i;
+ for(i = 0; i < nThreads; i++)
+ {
+ threads.push_back(new PingThread(proxy, 1));
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->start();
+ }
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ auto_ptr<Ice::LocalException> ex((*p)->waitUntilFinished());
+ test(dynamic_cast<Ice::NoEndpointException*>(ex.get()));
+ }
+ admin->stopServer("server-activation-timeout");
}
catch(const IceGrid::ServerStopException& ex)
{
- cerr << ex << ": " << ex.reason << endl;
- test(false);
+ cerr << ex << ": " << ex.reason << endl;
+ test(false);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing deactivation timeout... " << flush;
try
{
- test(admin->getServerState("server-deactivation-timeout") == IceGrid::Inactive);
- communicator->stringToProxy("server-deactivation-timeout")->ice_ping();
- admin->stopServer("server-deactivation-timeout");
+ test(admin->getServerState("server-deactivation-timeout") == IceGrid::Inactive);
+ communicator->stringToProxy("server-deactivation-timeout")->ice_ping();
+ admin->stopServer("server-deactivation-timeout");
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing permanent disable on failure... " << flush;
try
{
- test(admin->getServerState("server1") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1"));
- waitForServerState(admin, "server1", IceGrid::Active);
- obj->fail();
- waitForServerState(admin, "server1", IceGrid::Inactive);
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(!admin->isServerEnabled("server1"));
-
- test(admin->getServerState("server1-manual") == IceGrid::Inactive);
- admin->startServer("server1-manual");
- test(admin->getServerState("server1-manual") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-manual"));
- test(admin->getServerState("server1-manual") == IceGrid::Active);
- obj->fail();
- waitForServerState(admin, "server1-manual", IceGrid::Inactive);
- test(!admin->isServerEnabled("server1-manual"));
-
- test(admin->getServerState("server1-always") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-always"));
- obj->fail();
- waitForServerState(admin, "server1-always", IceGrid::Inactive);
- test(!admin->isServerEnabled("server1-always"));
+ test(admin->getServerState("server1") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1"));
+ waitForServerState(admin, "server1", IceGrid::Active);
+ obj->fail();
+ waitForServerState(admin, "server1", IceGrid::Inactive);
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(!admin->isServerEnabled("server1"));
+
+ test(admin->getServerState("server1-manual") == IceGrid::Inactive);
+ admin->startServer("server1-manual");
+ test(admin->getServerState("server1-manual") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-manual"));
+ test(admin->getServerState("server1-manual") == IceGrid::Active);
+ obj->fail();
+ waitForServerState(admin, "server1-manual", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server1-manual"));
+
+ test(admin->getServerState("server1-always") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server1-always"));
+ obj->fail();
+ waitForServerState(admin, "server1-always", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server1-always"));
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
- cout << "ok" << endl;
+ cout << "ok" << endl;
cout << "testing temporary disable on failure... " << flush;
try
{
- test(admin->getServerState("server2") == IceGrid::Inactive);
- TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2"));
- waitForServerState(admin, "server2", IceGrid::Active);
- obj->fail();
- waitForServerState(admin, "server2", IceGrid::Inactive);
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- test(!admin->isServerEnabled("server2"));
- nRetry = 0;
- while(!admin->isServerEnabled("server2") && nRetry < 15)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- try
- {
- obj->ice_ping();
- }
- catch(const Ice::NoEndpointException&)
- {
- }
- }
- test(admin->isServerEnabled("server2"));
- waitForServerState(admin, "server2", IceGrid::Active);
- obj->ice_ping();
- admin->stopServer("server2");
-
- test(admin->getServerState("server2-manual") == IceGrid::Inactive);
- admin->startServer("server2-manual");
- test(admin->getServerState("server2-manual") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-manual"));
- obj->fail();
- waitForServerState(admin, "server2-manual", IceGrid::Inactive);
- test(!admin->isServerEnabled("server2-manual"));
- admin->startServer("server2-manual");
- test(admin->isServerEnabled("server2-manual"));
- test(admin->getServerState("server2-manual") == IceGrid::Active);
- admin->stopServer("server2-manual");
-
- test(admin->getServerState("server2-always") == IceGrid::Active);
- obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-always"));
- obj->fail();
- waitForServerState(admin, "server2-always", IceGrid::Inactive);
- test(!admin->isServerEnabled("server2-always"));
- nRetry = 0;
- while((!admin->isServerEnabled("server2-always") ||
- admin->getServerState("server2-always") != IceGrid::Active) &&
- nRetry < 15)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(admin->isServerEnabled("server2-always") && admin->getServerState("server2-always") == IceGrid::Active);
- obj->ice_ping();
+ test(admin->getServerState("server2") == IceGrid::Inactive);
+ TestIntfPrx obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2"));
+ waitForServerState(admin, "server2", IceGrid::Active);
+ obj->fail();
+ waitForServerState(admin, "server2", IceGrid::Inactive);
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ test(!admin->isServerEnabled("server2"));
+ nRetry = 0;
+ while(!admin->isServerEnabled("server2") && nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ try
+ {
+ obj->ice_ping();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+ }
+ test(admin->isServerEnabled("server2"));
+ waitForServerState(admin, "server2", IceGrid::Active);
+ obj->ice_ping();
+ admin->stopServer("server2");
+
+ test(admin->getServerState("server2-manual") == IceGrid::Inactive);
+ admin->startServer("server2-manual");
+ test(admin->getServerState("server2-manual") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-manual"));
+ obj->fail();
+ waitForServerState(admin, "server2-manual", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server2-manual"));
+ admin->startServer("server2-manual");
+ test(admin->isServerEnabled("server2-manual"));
+ test(admin->getServerState("server2-manual") == IceGrid::Active);
+ admin->stopServer("server2-manual");
+
+ test(admin->getServerState("server2-always") == IceGrid::Active);
+ obj = TestIntfPrx::checkedCast(communicator->stringToProxy("server2-always"));
+ obj->fail();
+ waitForServerState(admin, "server2-always", IceGrid::Inactive);
+ test(!admin->isServerEnabled("server2-always"));
+ nRetry = 0;
+ while((!admin->isServerEnabled("server2-always") ||
+ admin->getServerState("server2-always") != IceGrid::Active) &&
+ nRetry < 15)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(admin->isServerEnabled("server2-always") && admin->getServerState("server2-always") == IceGrid::Active);
+ obj->ice_ping();
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
diff --git a/cpp/test/IceGrid/activation/Client.cpp b/cpp/test/IceGrid/activation/Client.cpp
index aaa0e585955..0162051684d 100644
--- a/cpp/test/IceGrid/activation/Client.cpp
+++ b/cpp/test/IceGrid/activation/Client.cpp
@@ -30,26 +30,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/activation/Server.cpp b/cpp/test/IceGrid/activation/Server.cpp
index d9e5e6e0e4c..721c2132427 100644
--- a/cpp/test/IceGrid/activation/Server.cpp
+++ b/cpp/test/IceGrid/activation/Server.cpp
@@ -30,7 +30,7 @@ Server::run(int argc, char* argv[])
Ice::stringSeqToArgs(args, argc, argv);
if(properties->getPropertyAsInt("FailOnStartup") > 0)
{
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
@@ -41,13 +41,13 @@ Server::run(int argc, char* argv[])
int delay = properties->getPropertyAsInt("ActivationDelay");
if(delay > 0)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
}
shutdownOnInterrupt();
try
{
- adapter->activate();
+ adapter->activate();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
@@ -58,7 +58,7 @@ Server::run(int argc, char* argv[])
delay = properties->getPropertyAsInt("DeactivationDelay");
if(delay > 0)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
}
return test->isFailed() ? EXIT_FAILURE : EXIT_SUCCESS;
diff --git a/cpp/test/IceGrid/allocation/AllTests.cpp b/cpp/test/IceGrid/allocation/AllTests.cpp
index 7079f31c4ed..dfc515d904f 100644
--- a/cpp/test/IceGrid/allocation/AllTests.cpp
+++ b/cpp/test/IceGrid/allocation/AllTests.cpp
@@ -32,47 +32,47 @@ public:
void
response(const Ice::ObjectPrx& obj)
{
- Lock sync(*this);
- _response = true;
- _obj = obj;
- notify();
+ Lock sync(*this);
+ _response = true;
+ _obj = obj;
+ notify();
}
void
exception()
{
- Lock sync(*this);
- _exception = true;
- notify();
+ Lock sync(*this);
+ _exception = true;
+ notify();
}
void
waitResponse(const char* file, int line)
{
- Lock sync(*this);
- while(!_response && !_exception)
- {
- if(!timedWait(IceUtil::Time::seconds(3)))
- {
- cerr << "timeout: " << file << ":" << line << endl;
- test(false); // Timeout
- }
- }
+ Lock sync(*this);
+ while(!_response && !_exception)
+ {
+ if(!timedWait(IceUtil::Time::seconds(3)))
+ {
+ cerr << "timeout: " << file << ":" << line << endl;
+ test(false); // Timeout
+ }
+ }
}
bool
hasResponse(Ice::ObjectPrx& obj)
{
- Lock sync(*this);
- obj = _obj;
- return _response;
+ Lock sync(*this);
+ obj = _obj;
+ return _response;
}
bool
hasException()
{
- Lock sync(*this);
- return _exception;
+ Lock sync(*this);
+ return _exception;
}
private:
@@ -106,171 +106,171 @@ public:
StressClient(int id, const RegistryPrx& registry, bool destroySession) :
_communicator(registry->ice_getCommunicator()),
- _id(id),
- _registry(registry),
- _notified(false),
- _terminated(false),
- _destroySession(destroySession)
+ _id(id),
+ _registry(registry),
+ _notified(false),
+ _terminated(false),
+ _destroySession(destroySession)
{
}
StressClient(int id, const SessionPrx& session) :
_communicator(session->ice_getCommunicator()),
- _id(id),
- _session(session),
- _notified(false),
- _terminated(false),
- _destroySession(false)
+ _id(id),
+ _session(session),
+ _notified(false),
+ _terminated(false),
+ _destroySession(false)
{
}
virtual
void run()
{
- {
- Lock sync(*this);
- while(!_notified)
- {
- wait();
- }
- }
-
- SessionPrx session;
- while(true)
- {
- {
- Lock sync(*this);
- if(_terminated)
- {
- if(!_session && session)
- {
- session->destroy();
- }
- return;
- }
- }
-
- if(!session)
- {
- ostringstream os;
- os << "Client-" << _id;
- if(_session)
- {
- session = _session;
- }
- else
- {
- session = _registry->createSession(os.str(), "");
- session->setAllocationTimeout(IceUtil::random(200)); // 200ms timeout
- }
- }
-
- assert(session);
- session->keepAlive();
-
- Ice::ObjectPrx object;
- switch(IceUtil::random(_destroySession ? 4 : 2))
- {
- case 0:
- object = allocate(session);
- break;
- case 1:
- object = allocateByType(session);
- break;
- case 2:
- assert(!_session);
- allocateAndDestroy(session);
- session = 0;
- break;
- case 3:
- assert(!_session);
- allocateByTypeAndDestroy(session);
- session = 0;
- break;
- }
-
- if(object)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(IceUtil::random(20)));
- switch(IceUtil::random(_destroySession ? 2 : 1))
- {
- case 0:
- session->releaseObject(object->ice_getIdentity());
- break;
- case 1:
- assert(!_session);
- session->destroy();
- session = 0;
- break;
- }
- }
- }
+ {
+ Lock sync(*this);
+ while(!_notified)
+ {
+ wait();
+ }
+ }
+
+ SessionPrx session;
+ while(true)
+ {
+ {
+ Lock sync(*this);
+ if(_terminated)
+ {
+ if(!_session && session)
+ {
+ session->destroy();
+ }
+ return;
+ }
+ }
+
+ if(!session)
+ {
+ ostringstream os;
+ os << "Client-" << _id;
+ if(_session)
+ {
+ session = _session;
+ }
+ else
+ {
+ session = _registry->createSession(os.str(), "");
+ session->setAllocationTimeout(IceUtil::random(200)); // 200ms timeout
+ }
+ }
+
+ assert(session);
+ session->keepAlive();
+
+ Ice::ObjectPrx object;
+ switch(IceUtil::random(_destroySession ? 4 : 2))
+ {
+ case 0:
+ object = allocate(session);
+ break;
+ case 1:
+ object = allocateByType(session);
+ break;
+ case 2:
+ assert(!_session);
+ allocateAndDestroy(session);
+ session = 0;
+ break;
+ case 3:
+ assert(!_session);
+ allocateByTypeAndDestroy(session);
+ session = 0;
+ break;
+ }
+
+ if(object)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(IceUtil::random(20)));
+ switch(IceUtil::random(_destroySession ? 2 : 1))
+ {
+ case 0:
+ session->releaseObject(object->ice_getIdentity());
+ break;
+ case 1:
+ assert(!_session);
+ session->destroy();
+ session = 0;
+ break;
+ }
+ }
+ }
}
Ice::ObjectPrx
allocate(const SessionPrx& session)
{
- ostringstream os;
- os << "stress-" << IceUtil::random(6) + 1;
- try
- {
- return session->allocateObjectById(_communicator->stringToIdentity(os.str()));
- }
- catch(const AllocationTimeoutException&)
- {
- }
- catch(const AllocationException&)
- {
- // This can only happen if we are using the common session
- // and the object is already allocated.
- test(_session);
- }
- return 0;
+ ostringstream os;
+ os << "stress-" << IceUtil::random(6) + 1;
+ try
+ {
+ return session->allocateObjectById(_communicator->stringToIdentity(os.str()));
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ catch(const AllocationException&)
+ {
+ // This can only happen if we are using the common session
+ // and the object is already allocated.
+ test(_session);
+ }
+ return 0;
}
Ice::ObjectPrx
allocateByType(const SessionPrx& session)
{
- try
- {
- return session->allocateObjectByType("::StressTest");
- }
- catch(const AllocationTimeoutException&)
- {
- }
- return 0;
+ try
+ {
+ return session->allocateObjectByType("::StressTest");
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ return 0;
}
void
allocateAndDestroy(const SessionPrx& session)
{
- ostringstream os;
- os << "stress-" << IceUtil::random(3);
- session->allocateObjectById_async(new AllocateObjectByIdCallback(), _communicator->stringToIdentity(os.str()));
- session->destroy();
+ ostringstream os;
+ os << "stress-" << IceUtil::random(3);
+ session->allocateObjectById_async(new AllocateObjectByIdCallback(), _communicator->stringToIdentity(os.str()));
+ session->destroy();
}
void
allocateByTypeAndDestroy(const SessionPrx& session)
{
- session->allocateObjectByType_async(new AllocateObjectByTypeCallback(), "::StressTest");
- session->destroy();
+ session->allocateObjectByType_async(new AllocateObjectByTypeCallback(), "::StressTest");
+ session->destroy();
}
void
notifyThread()
{
- Lock sync(*this);
- _notified = true;
- notify();
+ Lock sync(*this);
+ _notified = true;
+ notify();
}
void
terminate()
{
- Lock sync(*this);
- _terminated = true;
- notify();
+ Lock sync(*this);
+ _terminated = true;
+ notify();
}
protected:
@@ -290,72 +290,72 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const Ice::LoggerPtr& logger, const IceUtil::Time& timeout) :
- _logger(logger),
- _timeout(timeout),
- _terminated(false)
+ _logger(logger),
+ _timeout(timeout),
+ _terminated(false)
{
}
virtual void
run()
{
- Lock sync(*this);
- while(!_terminated)
- {
- timedWait(_timeout);
- if(!_terminated)
- {
- vector<SessionPrx>::iterator p = _sessions.begin();
- while(p != _sessions.end())
- {
- try
- {
- (*p)->keepAlive();
- ++p;
- }
- catch(const Ice::Exception&)
- {
- p = _sessions.erase(p);
- }
- }
-
- vector<AdminSessionPrx>::iterator q = _adminSessions.begin();
- while(q != _adminSessions.end())
- {
- try
- {
- (*q)->keepAlive();
- ++q;
- }
- catch(const Ice::Exception&)
- {
- q = _adminSessions.erase(q);
- }
- }
- }
- }
+ Lock sync(*this);
+ while(!_terminated)
+ {
+ timedWait(_timeout);
+ if(!_terminated)
+ {
+ vector<SessionPrx>::iterator p = _sessions.begin();
+ while(p != _sessions.end())
+ {
+ try
+ {
+ (*p)->keepAlive();
+ ++p;
+ }
+ catch(const Ice::Exception&)
+ {
+ p = _sessions.erase(p);
+ }
+ }
+
+ vector<AdminSessionPrx>::iterator q = _adminSessions.begin();
+ while(q != _adminSessions.end())
+ {
+ try
+ {
+ (*q)->keepAlive();
+ ++q;
+ }
+ catch(const Ice::Exception&)
+ {
+ q = _adminSessions.erase(q);
+ }
+ }
+ }
+ }
}
void
add(const SessionPrx& session)
{
- Lock sync(*this);
- _sessions.push_back(session);
+ Lock sync(*this);
+ _sessions.push_back(session);
}
void
add(const AdminSessionPrx& session)
{
- Lock sync(*this);
- _adminSessions.push_back(session);
+ Lock sync(*this);
+ _adminSessions.push_back(session);
}
void
terminate()
{
- Lock sync(*this);
- _terminated = true;
- notify();
+ Lock sync(*this);
+ _terminated = true;
+ notify();
}
private:
@@ -372,7 +372,7 @@ void
allTests(const Ice::CommunicatorPtr& communicator)
{
SessionKeepAliveThreadPtr keepAlive = new SessionKeepAliveThread(
- communicator->getLogger(), IceUtil::Time::seconds(5));
+ communicator->getLogger(), IceUtil::Time::seconds(5));
keepAlive->start();
RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(communicator->stringToProxy("IceGrid/Registry"));
@@ -387,12 +387,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "starting router... " << flush;
try
{
- admin->startServer("Glacier2");
+ admin->startServer("Glacier2");
}
catch(const ServerStartException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
cout << "ok" << endl;
@@ -403,756 +403,756 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- cout << "testing create session... " << flush;
- SessionPrx session1 = registry->createSession("Client1", "");
- SessionPrx session2 = registry->createSession("Client2", "");
-
- keepAlive->add(session1);
- keepAlive->add(session2);
+ cout << "testing create session... " << flush;
+ SessionPrx session1 = registry->createSession("Client1", "");
+ SessionPrx session2 = registry->createSession("Client2", "");
+
+ keepAlive->add(session1);
+ keepAlive->add(session2);
- cout << "ok" << endl;
-
- cout << "testing allocate object by identity... " << flush;
-
- Ice::Identity allocatable = communicator->stringToIdentity("allocatable");
- Ice::Identity allocatablebis = communicator->stringToIdentity("allocatablebis");
-
- try
- {
- session1->allocateObjectById(communicator->stringToIdentity("dummy"));
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
- try
- {
- session1->releaseObject(communicator->stringToIdentity("dummy"));
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- try
- {
- session1->allocateObjectById(communicator->stringToIdentity("nonallocatable"));
- test(false);
- }
- catch(const AllocationException&)
- {
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- try
- {
- session2->allocateObjectById(communicator->stringToIdentity("nonallocatable"));
- test(false);
- }
- catch(const AllocationException&)
- {
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- try
- {
- session1->releaseObject(communicator->stringToIdentity("nonallocatable"));
- test(false);
- }
- catch(const AllocationException&)
- {
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- try
- {
- session2->releaseObject(communicator->stringToIdentity("nonallocatable"));
- test(false);
- }
- catch(const AllocationException&)
- {
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- session1->allocateObjectById(allocatable);
- try
- {
- session1->allocateObjectById(allocatable);
- test(false);
- }
- catch(const AllocationException&)
- {
- }
-
- session1->setAllocationTimeout(0);
- session2->setAllocationTimeout(0);
-
- try
- {
- session2->allocateObjectById(allocatable);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- try
- {
- session2->releaseObject(allocatable);
- test(false);
- }
- catch(const AllocationException&)
- {
- }
-
- session1->allocateObjectById(allocatablebis);
- try
- {
- session2->allocateObjectById(allocatablebis);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- session1->releaseObject(allocatablebis);
- session2->allocateObjectById(allocatablebis);
- try
- {
- session1->allocateObjectById(allocatablebis);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- session2->releaseObject(allocatablebis);
+ cout << "ok" << endl;
+
+ cout << "testing allocate object by identity... " << flush;
+
+ Ice::Identity allocatable = communicator->stringToIdentity("allocatable");
+ Ice::Identity allocatablebis = communicator->stringToIdentity("allocatablebis");
+
+ try
+ {
+ session1->allocateObjectById(communicator->stringToIdentity("dummy"));
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+ try
+ {
+ session1->releaseObject(communicator->stringToIdentity("dummy"));
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ try
+ {
+ session1->allocateObjectById(communicator->stringToIdentity("nonallocatable"));
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ try
+ {
+ session2->allocateObjectById(communicator->stringToIdentity("nonallocatable"));
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ try
+ {
+ session1->releaseObject(communicator->stringToIdentity("nonallocatable"));
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ try
+ {
+ session2->releaseObject(communicator->stringToIdentity("nonallocatable"));
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ session1->allocateObjectById(allocatable);
+ try
+ {
+ session1->allocateObjectById(allocatable);
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ }
+
+ session1->setAllocationTimeout(0);
+ session2->setAllocationTimeout(0);
+
+ try
+ {
+ session2->allocateObjectById(allocatable);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ try
+ {
+ session2->releaseObject(allocatable);
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ }
+
+ session1->allocateObjectById(allocatablebis);
+ try
+ {
+ session2->allocateObjectById(allocatablebis);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ session1->releaseObject(allocatablebis);
+ session2->allocateObjectById(allocatablebis);
+ try
+ {
+ session1->allocateObjectById(allocatablebis);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ session2->releaseObject(allocatablebis);
- session2->setAllocationTimeout(allocationTimeout);
- AllocateObjectByIdCallbackPtr cb1 = new AllocateObjectByIdCallback();
- session2->allocateObjectById_async(cb1, allocatable);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb1->hasResponse(dummy));
- session1->releaseObject(allocatable);
- cb1->waitResponse(__FILE__, __LINE__);
- test(cb1->hasResponse(dummy));
-
- session1->setAllocationTimeout(0);
- try
- {
- session1->allocateObjectById(allocatable);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- try
- {
- session1->releaseObject(allocatable);
- test(false);
- }
- catch(const AllocationException&)
- {
- }
- session1->setAllocationTimeout(allocationTimeout);
- cb1 = new AllocateObjectByIdCallback();
- session1->allocateObjectById_async(cb1, allocatable);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb1->hasResponse(dummy));
- session2->releaseObject(allocatable);
- cb1->waitResponse(__FILE__, __LINE__);
- test(cb1->hasResponse(dummy));
-
- session1->releaseObject(allocatable);
-
- cout << "ok" << endl;
-
- cout << "testing allocate object by type... " << flush;
+ session2->setAllocationTimeout(allocationTimeout);
+ AllocateObjectByIdCallbackPtr cb1 = new AllocateObjectByIdCallback();
+ session2->allocateObjectById_async(cb1, allocatable);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb1->hasResponse(dummy));
+ session1->releaseObject(allocatable);
+ cb1->waitResponse(__FILE__, __LINE__);
+ test(cb1->hasResponse(dummy));
+
+ session1->setAllocationTimeout(0);
+ try
+ {
+ session1->allocateObjectById(allocatable);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ try
+ {
+ session1->releaseObject(allocatable);
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ }
+ session1->setAllocationTimeout(allocationTimeout);
+ cb1 = new AllocateObjectByIdCallback();
+ session1->allocateObjectById_async(cb1, allocatable);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb1->hasResponse(dummy));
+ session2->releaseObject(allocatable);
+ cb1->waitResponse(__FILE__, __LINE__);
+ test(cb1->hasResponse(dummy));
+
+ session1->releaseObject(allocatable);
+
+ cout << "ok" << endl;
+
+ cout << "testing allocate object by type... " << flush;
- session1->setAllocationTimeout(0);
- session2->setAllocationTimeout(0);
-
-
- try
- {
- obj = session1->allocateObjectByType("::Unknown");
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- test(false);
- }
- catch(const AllocationException&)
- {
- }
-
- try
- {
- obj = session1->allocateObjectByType("::NotAllocatable");
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- test(false);
- }
- catch(const AllocationException&)
- {
- }
-
- obj = session1->allocateObjectByType("::Test");
- test(obj && obj->ice_getIdentity().name == "allocatable");
- try
- {
- session1->allocateObjectByType("::Test");
- test(false);
- }
- catch(const AllocationException&)
- {
- }
- try
- {
- session2->allocateObjectByType("::Test");
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- try
- {
- session2->releaseObject(obj->ice_getIdentity());
- }
- catch(const AllocationException&)
- {
- }
-
- session1->releaseObject(obj->ice_getIdentity());
- try
- {
- session1->releaseObject(obj->ice_getIdentity());
- }
- catch(const AllocationException&)
- {
- }
-
- obj = session2->allocateObjectByType("::Test"); // Allocate the object
- test(obj && obj->ice_getIdentity().name == "allocatable");
- try
- {
- session2->allocateObjectByType("::Test");
- test(false);
- }
- catch(const AllocationException&)
- {
- }
- try
- {
- session1->allocateObjectByType("::Test");
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- session1->allocateObjectByType("::TestBis");
- try
- {
- session2->allocateObjectByType("::TestBis");
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- session1->releaseObject(allocatablebis);
- session2->allocateObjectByType("::TestBis");
- try
- {
- session1->allocateObjectByType("::TestBis");
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- session2->releaseObject(allocatablebis);
-
- session1->setAllocationTimeout(allocationTimeout);
- AllocateObjectByTypeCallbackPtr cb3 = new AllocateObjectByTypeCallback();
- session1->allocateObjectByType_async(cb3, "::Test");
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb3->hasResponse(dummy));
- session2->releaseObject(obj->ice_getIdentity());
- cb3->waitResponse(__FILE__, __LINE__);
- test(cb3->hasResponse(obj));
-
- session1->releaseObject(obj->ice_getIdentity());
+ session1->setAllocationTimeout(0);
+ session2->setAllocationTimeout(0);
+
+
+ try
+ {
+ obj = session1->allocateObjectByType("::Unknown");
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ }
+
+ try
+ {
+ obj = session1->allocateObjectByType("::NotAllocatable");
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ }
+
+ obj = session1->allocateObjectByType("::Test");
+ test(obj && obj->ice_getIdentity().name == "allocatable");
+ try
+ {
+ session1->allocateObjectByType("::Test");
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ }
+ try
+ {
+ session2->allocateObjectByType("::Test");
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ try
+ {
+ session2->releaseObject(obj->ice_getIdentity());
+ }
+ catch(const AllocationException&)
+ {
+ }
+
+ session1->releaseObject(obj->ice_getIdentity());
+ try
+ {
+ session1->releaseObject(obj->ice_getIdentity());
+ }
+ catch(const AllocationException&)
+ {
+ }
+
+ obj = session2->allocateObjectByType("::Test"); // Allocate the object
+ test(obj && obj->ice_getIdentity().name == "allocatable");
+ try
+ {
+ session2->allocateObjectByType("::Test");
+ test(false);
+ }
+ catch(const AllocationException&)
+ {
+ }
+ try
+ {
+ session1->allocateObjectByType("::Test");
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ session1->allocateObjectByType("::TestBis");
+ try
+ {
+ session2->allocateObjectByType("::TestBis");
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ session1->releaseObject(allocatablebis);
+ session2->allocateObjectByType("::TestBis");
+ try
+ {
+ session1->allocateObjectByType("::TestBis");
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ session2->releaseObject(allocatablebis);
+
+ session1->setAllocationTimeout(allocationTimeout);
+ AllocateObjectByTypeCallbackPtr cb3 = new AllocateObjectByTypeCallback();
+ session1->allocateObjectByType_async(cb3, "::Test");
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb3->hasResponse(dummy));
+ session2->releaseObject(obj->ice_getIdentity());
+ cb3->waitResponse(__FILE__, __LINE__);
+ test(cb3->hasResponse(obj));
+
+ session1->releaseObject(obj->ice_getIdentity());
- cout << "ok" << endl;
-
- cout << "testing object allocation timeout... " << flush;
-
- session1->allocateObjectById(allocatable);
- IceUtil::Time time = IceUtil::Time::now();
- session2->setAllocationTimeout(500);
- try
- {
- session2->allocateObjectById(allocatable);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- test(time + IceUtil::Time::milliSeconds(100) < IceUtil::Time::now());
- }
- time = IceUtil::Time::now();
- try
- {
- session2->allocateObjectById(allocatable);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- test(time + IceUtil::Time::milliSeconds(100) < IceUtil::Time::now());
- time = IceUtil::Time::now();
- try
- {
- session2->allocateObjectByType("::Test");
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- test(time + IceUtil::Time::milliSeconds(100) < IceUtil::Time::now());
-
- session1->releaseObject(allocatable);
- session2->setAllocationTimeout(0);
-
- cout << "ok" << endl;
-
- cout << "testing server allocation... " << flush;
-
- session1->setAllocationTimeout(0);
- session2->setAllocationTimeout(0);
-
- Ice::Identity allocatable3 = communicator->stringToIdentity("allocatable3");
- Ice::Identity allocatable4 = communicator->stringToIdentity("allocatable4");
-
- session1->allocateObjectById(allocatable3);
- try
- {
- session2->allocateObjectById(allocatable3);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- try
- {
- session2->allocateObjectById(allocatable4);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
-
- session1->allocateObjectById(allocatable4);
- session1->releaseObject(allocatable3);
- try
- {
- session2->allocateObjectById(allocatable3);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- session1->releaseObject(allocatable4);
- session2->allocateObjectById(allocatable3);
- try
- {
- session1->allocateObjectById(allocatable3);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- try
- {
- session1->allocateObjectById(allocatable4);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- session2->allocateObjectById(allocatable4);
- session2->releaseObject(allocatable3);
- try
- {
- session1->allocateObjectById(allocatable3);
- test(false);
- }
- catch(const AllocationTimeoutException&)
- {
- }
- try
- {
- session1->allocateObjectByType("::TestServer1");
- test(false);
- }
- catch(AllocationException&)
- {
- }
- try
- {
- session1->allocateObjectByType("::TestServer2");
- test(false);
- }
- catch(AllocationException&)
- {
- }
- test(session2->allocateObjectByType("::TestServer1"));
- try
- {
- session2->allocateObjectByType("::TestServer1");
- test(false);
- }
- catch(AllocationException&)
- {
- }
- try
- {
- session2->allocateObjectByType("::TestServer2");
- test(false);
- }
- catch(AllocationException&)
- {
- }
- session2->releaseObject(allocatable3);
- session2->releaseObject(allocatable4);
-
- session1->allocateObjectById(allocatable3);
- session1->allocateObjectById(allocatable4);
-
- session2->setAllocationTimeout(allocationTimeout);
- cb1 = new AllocateObjectByIdCallback();
- session2->allocateObjectById_async(cb1, allocatable3);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb1->hasResponse(dummy));
- session1->releaseObject(allocatable3);
- test(!cb1->hasResponse(dummy));
- session1->releaseObject(allocatable4);
- cb1->waitResponse(__FILE__, __LINE__);
- test(cb1->hasResponse(dummy));
- session2->releaseObject(allocatable3);
-
- session1->setAllocationTimeout(allocationTimeout);
- test(session2->allocateObjectByType("::TestServer1"));
- cb3 = new AllocateObjectByTypeCallback();
- session1->allocateObjectByType_async(cb3, "::TestServer2");
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb3->hasResponse(dummy));
- session2->releaseObject(allocatable3);
- cb3->waitResponse(__FILE__, __LINE__);
- test(cb3->hasResponse(dummy));
- session1->releaseObject(allocatable4);
-
- session1->setAllocationTimeout(0);
- session2->setAllocationTimeout(0);
- test(session1->allocateObjectByType("::TestMultipleByServer"));
- try
- {
- session2->allocateObjectByType("::TestMultipleByServer");
- test(false);
- }
- catch(AllocationException&)
- {
- }
- test(session1->allocateObjectByType("::TestMultipleByServer"));
- session1->releaseObject(communicator->stringToIdentity("allocatable31"));
- session1->releaseObject(communicator->stringToIdentity("allocatable41"));
- test(session2->allocateObjectByType("::TestMultipleByServer"));
- try
- {
- session1->allocateObjectByType("::TestMultipleByServer");
- test(false);
- }
- catch(AllocationException&)
- {
- }
- test(session2->allocateObjectByType("::TestMultipleByServer"));
- session2->releaseObject(communicator->stringToIdentity("allocatable31"));
- session2->releaseObject(communicator->stringToIdentity("allocatable41"));
-
- Ice::ObjectPrx obj1 = session1->allocateObjectByType("::TestMultipleServer");
- test(obj1);
- Ice::ObjectPrx obj2 = session2->allocateObjectByType("::TestMultipleServer");
- test(obj2);
- try
- {
- session1->allocateObjectByType("::TestMultipleServer");
- test(false);
- }
- catch(AllocationTimeoutException&)
- {
- }
- try
- {
- session2->allocateObjectByType("::TestMultipleServer");
- test(false);
- }
- catch(AllocationTimeoutException&)
- {
- }
- session1->releaseObject(obj1->ice_getIdentity());
- obj1 = session2->allocateObjectByType("::TestMultipleServer");
- session2->releaseObject(obj1->ice_getIdentity());
- session2->releaseObject(obj2->ice_getIdentity());
-
- cout << "ok" << endl;
-
- cout << "testing concurrent allocations... " << flush;
-
- session1->setAllocationTimeout(allocationTimeout);
- session2->setAllocationTimeout(allocationTimeout);
-
- session2->allocateObjectById(allocatable);
- AllocateObjectByIdCallbackPtr cb11 = new AllocateObjectByIdCallback();
- AllocateObjectByIdCallbackPtr cb12 = new AllocateObjectByIdCallback();
- session1->allocateObjectById_async(cb11, allocatable);
- session1->allocateObjectById_async(cb12, allocatable);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb11->hasResponse(dummy));
- test(!cb12->hasResponse(dummy));
- session2->releaseObject(allocatable);
- cb11->waitResponse(__FILE__, __LINE__);
- cb12->waitResponse(__FILE__, __LINE__);
- test(cb11->hasResponse(dummy) ? cb12->hasException() : cb12->hasResponse(dummy));
- test(cb12->hasResponse(dummy) ? cb11->hasException() : cb11->hasResponse(dummy));
- session1->releaseObject(allocatable);
-
- session2->allocateObjectById(allocatable);
- AllocateObjectByTypeCallbackPtr cb31 = new AllocateObjectByTypeCallback();
- AllocateObjectByTypeCallbackPtr cb32 = new AllocateObjectByTypeCallback();
- session1->allocateObjectByType_async(cb31, "::Test");
- session1->allocateObjectByType_async(cb32, "::Test");
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb31->hasResponse(dummy));
- test(!cb32->hasResponse(dummy));
- session2->releaseObject(allocatable);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
- do
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
- }
- while(!cb31->hasResponse(dummy) && !cb32->hasResponse(dummy));
- test(cb31->hasResponse(dummy) && dummy && !cb32->hasResponse(dummy) ||
- cb32->hasResponse(dummy) && dummy && !cb31->hasResponse(dummy));
- session1->releaseObject(allocatable);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
- AllocateObjectByTypeCallbackPtr cb33 = cb31->hasResponse(dummy) ? cb32 : cb31;
- cb33->waitResponse(__FILE__, __LINE__);
- test(cb33->hasResponse(dummy) && dummy);
- session1->releaseObject(allocatable);
-
- session2->allocateObjectById(allocatable3);
- cb11 = new AllocateObjectByIdCallback();
- cb12 = new AllocateObjectByIdCallback();
- session1->allocateObjectById_async(cb11, allocatable3);
- session1->allocateObjectById_async(cb12, allocatable3);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb11->hasResponse(dummy));
- test(!cb12->hasResponse(dummy));
- session2->releaseObject(allocatable3);
- cb11->waitResponse(__FILE__, __LINE__);
- cb12->waitResponse(__FILE__, __LINE__);
- test(cb11->hasResponse(dummy) ? cb12->hasException() : cb12->hasResponse(dummy));
- test(cb12->hasResponse(dummy) ? cb11->hasException() : cb11->hasResponse(dummy));
- session1->releaseObject(allocatable3);
-
- session2->allocateObjectById(allocatable3);
- cb31 = new AllocateObjectByTypeCallback();
- cb32 = new AllocateObjectByTypeCallback();
- session1->allocateObjectByType_async(cb31, "::TestServer1");
- session1->allocateObjectByType_async(cb32, "::TestServer1");
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb31->hasResponse(dummy));
- test(!cb32->hasResponse(dummy));
- session2->releaseObject(allocatable3);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
- do
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
- }
- while(!cb31->hasResponse(dummy) && !cb32->hasResponse(dummy));
- test(cb31->hasResponse(dummy) && dummy && !cb32->hasResponse(dummy) ||
- cb32->hasResponse(dummy) && dummy && !cb31->hasResponse(dummy));
- session1->releaseObject(allocatable3);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
- cb33 = cb31->hasResponse(dummy) ? cb32 : cb31;
- cb33->waitResponse(__FILE__, __LINE__);
- test(cb33->hasResponse(dummy) && dummy);
- session1->releaseObject(allocatable3);
-
- session1->allocateObjectById(allocatable3);
- cb31 = new AllocateObjectByTypeCallback();
- cb32 = new AllocateObjectByTypeCallback();
- session1->allocateObjectByType_async(cb31, "::TestServer1");
- session1->allocateObjectByType_async(cb32, "::TestServer1");
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb31->hasResponse(dummy));
- test(!cb32->hasResponse(dummy));
- session1->releaseObject(allocatable3);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
- do
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
- }
- while(!cb31->hasResponse(dummy) && !cb32->hasResponse(dummy));
- test(cb31->hasResponse(dummy) && dummy && !cb32->hasResponse(dummy) ||
- cb32->hasResponse(dummy) && dummy && !cb31->hasResponse(dummy));
- session1->releaseObject(allocatable3);
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
- cb33 = cb31->hasResponse(dummy) ? cb32 : cb31;
- cb33->waitResponse(__FILE__, __LINE__);
- test(cb33->hasResponse(dummy) && dummy);
- session1->releaseObject(allocatable3);
-
- cout << "ok" << endl;
-
- cout << "testing session destroy... " << flush;
-
- obj = session2->allocateObjectByType("::Test"); // Allocate the object
- test(obj && obj->ice_getIdentity().name == "allocatable");
-
- session1->setAllocationTimeout(allocationTimeout);
- cb3 = new AllocateObjectByTypeCallback();
- session1->allocateObjectByType_async(cb3, "::Test");
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- test(!cb3->hasResponse(dummy));
- session2->destroy();
- cb3->waitResponse(__FILE__, __LINE__);
- test(cb3->hasResponse(obj));
- session1->destroy();
-
- session2 = SessionPrx::uncheckedCast(registry->createSession("Client2", ""));
- session2->setAllocationTimeout(0);
- session2->allocateObjectById(allocatable);
- session2->destroy();
-
- cout << "ok" << endl;
-
- cout << "testing allocation with Glacier2 session... " << flush;
- Ice::ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347");
- Glacier2::RouterPrx router1 = Glacier2::RouterPrx::checkedCast(routerBase->ice_connectionId("client1"));
- test(router1);
-
- Glacier2::SessionPrx sessionBase = router1->createSession("test1", "abc123");
- try
- {
- session1 = IceGrid::SessionPrx::checkedCast(sessionBase->ice_connectionId("client1")->ice_router(router1));
- test(session1);
- session1->ice_ping();
-
- Ice::ObjectPrx obj;
- obj = session1->allocateObjectById(allocatable)->ice_connectionId("client1")->ice_router(router1);
- obj->ice_ping();
- session1->releaseObject(allocatable);
- try
- {
- obj->ice_ping();
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- obj = session1->allocateObjectById(allocatable3)->ice_connectionId("client1")->ice_router(router1);
- obj->ice_ping();
- obj2 = communicator->stringToProxy("allocatable4")->ice_connectionId("client1")->ice_router(router1);
- obj2->ice_ping();
- session1->releaseObject(allocatable3);
- try
- {
- obj->ice_ping();
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- obj2->ice_ping();
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- session1->destroy();
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- cout << "ok" << endl;
-
- cout << "stress test... " << flush;
-
- SessionPrx stressSession = registry->createSession("StressSession", "");
- keepAlive->add(stressSession);
-
- const int nClients = 10;
- int i;
- vector<StressClientPtr> clients;
- for(i = 0; i < nClients - 2; ++i)
- {
- if(IceUtil::random(2) == 1)
- {
- clients.push_back(new StressClient(i, registry, false));
- }
- else
- {
- clients.push_back(new StressClient(i, stressSession));
- }
- clients.back()->start();
- }
- clients.push_back(new StressClient(i++, registry, true));
- clients.back()->start();
- clients.push_back(new StressClient(i++, registry, true));
- clients.back()->start();
-
- for(vector<StressClientPtr>::const_iterator p = clients.begin(); p != clients.end(); ++p)
- {
- (*p)->notifyThread();
- }
-
- //
- // Let the stress client run for a bit.
- //
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(8));
-
- //
- // Terminate the stress clients.
- //
- for(vector<StressClientPtr>::const_iterator q = clients.begin(); q != clients.end(); ++q)
- {
- (*q)->terminate();
- (*q)->getThreadControl().join();
- }
-
- stressSession->destroy();
-
- cout << "ok" << endl;
+ cout << "ok" << endl;
+
+ cout << "testing object allocation timeout... " << flush;
+
+ session1->allocateObjectById(allocatable);
+ IceUtil::Time time = IceUtil::Time::now();
+ session2->setAllocationTimeout(500);
+ try
+ {
+ session2->allocateObjectById(allocatable);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ test(time + IceUtil::Time::milliSeconds(100) < IceUtil::Time::now());
+ }
+ time = IceUtil::Time::now();
+ try
+ {
+ session2->allocateObjectById(allocatable);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ test(time + IceUtil::Time::milliSeconds(100) < IceUtil::Time::now());
+ time = IceUtil::Time::now();
+ try
+ {
+ session2->allocateObjectByType("::Test");
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ test(time + IceUtil::Time::milliSeconds(100) < IceUtil::Time::now());
+
+ session1->releaseObject(allocatable);
+ session2->setAllocationTimeout(0);
+
+ cout << "ok" << endl;
+
+ cout << "testing server allocation... " << flush;
+
+ session1->setAllocationTimeout(0);
+ session2->setAllocationTimeout(0);
+
+ Ice::Identity allocatable3 = communicator->stringToIdentity("allocatable3");
+ Ice::Identity allocatable4 = communicator->stringToIdentity("allocatable4");
+
+ session1->allocateObjectById(allocatable3);
+ try
+ {
+ session2->allocateObjectById(allocatable3);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ try
+ {
+ session2->allocateObjectById(allocatable4);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+
+ session1->allocateObjectById(allocatable4);
+ session1->releaseObject(allocatable3);
+ try
+ {
+ session2->allocateObjectById(allocatable3);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ session1->releaseObject(allocatable4);
+ session2->allocateObjectById(allocatable3);
+ try
+ {
+ session1->allocateObjectById(allocatable3);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ try
+ {
+ session1->allocateObjectById(allocatable4);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ session2->allocateObjectById(allocatable4);
+ session2->releaseObject(allocatable3);
+ try
+ {
+ session1->allocateObjectById(allocatable3);
+ test(false);
+ }
+ catch(const AllocationTimeoutException&)
+ {
+ }
+ try
+ {
+ session1->allocateObjectByType("::TestServer1");
+ test(false);
+ }
+ catch(AllocationException&)
+ {
+ }
+ try
+ {
+ session1->allocateObjectByType("::TestServer2");
+ test(false);
+ }
+ catch(AllocationException&)
+ {
+ }
+ test(session2->allocateObjectByType("::TestServer1"));
+ try
+ {
+ session2->allocateObjectByType("::TestServer1");
+ test(false);
+ }
+ catch(AllocationException&)
+ {
+ }
+ try
+ {
+ session2->allocateObjectByType("::TestServer2");
+ test(false);
+ }
+ catch(AllocationException&)
+ {
+ }
+ session2->releaseObject(allocatable3);
+ session2->releaseObject(allocatable4);
+
+ session1->allocateObjectById(allocatable3);
+ session1->allocateObjectById(allocatable4);
+
+ session2->setAllocationTimeout(allocationTimeout);
+ cb1 = new AllocateObjectByIdCallback();
+ session2->allocateObjectById_async(cb1, allocatable3);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb1->hasResponse(dummy));
+ session1->releaseObject(allocatable3);
+ test(!cb1->hasResponse(dummy));
+ session1->releaseObject(allocatable4);
+ cb1->waitResponse(__FILE__, __LINE__);
+ test(cb1->hasResponse(dummy));
+ session2->releaseObject(allocatable3);
+
+ session1->setAllocationTimeout(allocationTimeout);
+ test(session2->allocateObjectByType("::TestServer1"));
+ cb3 = new AllocateObjectByTypeCallback();
+ session1->allocateObjectByType_async(cb3, "::TestServer2");
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb3->hasResponse(dummy));
+ session2->releaseObject(allocatable3);
+ cb3->waitResponse(__FILE__, __LINE__);
+ test(cb3->hasResponse(dummy));
+ session1->releaseObject(allocatable4);
+
+ session1->setAllocationTimeout(0);
+ session2->setAllocationTimeout(0);
+ test(session1->allocateObjectByType("::TestMultipleByServer"));
+ try
+ {
+ session2->allocateObjectByType("::TestMultipleByServer");
+ test(false);
+ }
+ catch(AllocationException&)
+ {
+ }
+ test(session1->allocateObjectByType("::TestMultipleByServer"));
+ session1->releaseObject(communicator->stringToIdentity("allocatable31"));
+ session1->releaseObject(communicator->stringToIdentity("allocatable41"));
+ test(session2->allocateObjectByType("::TestMultipleByServer"));
+ try
+ {
+ session1->allocateObjectByType("::TestMultipleByServer");
+ test(false);
+ }
+ catch(AllocationException&)
+ {
+ }
+ test(session2->allocateObjectByType("::TestMultipleByServer"));
+ session2->releaseObject(communicator->stringToIdentity("allocatable31"));
+ session2->releaseObject(communicator->stringToIdentity("allocatable41"));
+
+ Ice::ObjectPrx obj1 = session1->allocateObjectByType("::TestMultipleServer");
+ test(obj1);
+ Ice::ObjectPrx obj2 = session2->allocateObjectByType("::TestMultipleServer");
+ test(obj2);
+ try
+ {
+ session1->allocateObjectByType("::TestMultipleServer");
+ test(false);
+ }
+ catch(AllocationTimeoutException&)
+ {
+ }
+ try
+ {
+ session2->allocateObjectByType("::TestMultipleServer");
+ test(false);
+ }
+ catch(AllocationTimeoutException&)
+ {
+ }
+ session1->releaseObject(obj1->ice_getIdentity());
+ obj1 = session2->allocateObjectByType("::TestMultipleServer");
+ session2->releaseObject(obj1->ice_getIdentity());
+ session2->releaseObject(obj2->ice_getIdentity());
+
+ cout << "ok" << endl;
+
+ cout << "testing concurrent allocations... " << flush;
+
+ session1->setAllocationTimeout(allocationTimeout);
+ session2->setAllocationTimeout(allocationTimeout);
+
+ session2->allocateObjectById(allocatable);
+ AllocateObjectByIdCallbackPtr cb11 = new AllocateObjectByIdCallback();
+ AllocateObjectByIdCallbackPtr cb12 = new AllocateObjectByIdCallback();
+ session1->allocateObjectById_async(cb11, allocatable);
+ session1->allocateObjectById_async(cb12, allocatable);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb11->hasResponse(dummy));
+ test(!cb12->hasResponse(dummy));
+ session2->releaseObject(allocatable);
+ cb11->waitResponse(__FILE__, __LINE__);
+ cb12->waitResponse(__FILE__, __LINE__);
+ test(cb11->hasResponse(dummy) ? cb12->hasException() : cb12->hasResponse(dummy));
+ test(cb12->hasResponse(dummy) ? cb11->hasException() : cb11->hasResponse(dummy));
+ session1->releaseObject(allocatable);
+
+ session2->allocateObjectById(allocatable);
+ AllocateObjectByTypeCallbackPtr cb31 = new AllocateObjectByTypeCallback();
+ AllocateObjectByTypeCallbackPtr cb32 = new AllocateObjectByTypeCallback();
+ session1->allocateObjectByType_async(cb31, "::Test");
+ session1->allocateObjectByType_async(cb32, "::Test");
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb31->hasResponse(dummy));
+ test(!cb32->hasResponse(dummy));
+ session2->releaseObject(allocatable);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
+ do
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
+ }
+ while(!cb31->hasResponse(dummy) && !cb32->hasResponse(dummy));
+ test(cb31->hasResponse(dummy) && dummy && !cb32->hasResponse(dummy) ||
+ cb32->hasResponse(dummy) && dummy && !cb31->hasResponse(dummy));
+ session1->releaseObject(allocatable);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
+ AllocateObjectByTypeCallbackPtr cb33 = cb31->hasResponse(dummy) ? cb32 : cb31;
+ cb33->waitResponse(__FILE__, __LINE__);
+ test(cb33->hasResponse(dummy) && dummy);
+ session1->releaseObject(allocatable);
+
+ session2->allocateObjectById(allocatable3);
+ cb11 = new AllocateObjectByIdCallback();
+ cb12 = new AllocateObjectByIdCallback();
+ session1->allocateObjectById_async(cb11, allocatable3);
+ session1->allocateObjectById_async(cb12, allocatable3);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb11->hasResponse(dummy));
+ test(!cb12->hasResponse(dummy));
+ session2->releaseObject(allocatable3);
+ cb11->waitResponse(__FILE__, __LINE__);
+ cb12->waitResponse(__FILE__, __LINE__);
+ test(cb11->hasResponse(dummy) ? cb12->hasException() : cb12->hasResponse(dummy));
+ test(cb12->hasResponse(dummy) ? cb11->hasException() : cb11->hasResponse(dummy));
+ session1->releaseObject(allocatable3);
+
+ session2->allocateObjectById(allocatable3);
+ cb31 = new AllocateObjectByTypeCallback();
+ cb32 = new AllocateObjectByTypeCallback();
+ session1->allocateObjectByType_async(cb31, "::TestServer1");
+ session1->allocateObjectByType_async(cb32, "::TestServer1");
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb31->hasResponse(dummy));
+ test(!cb32->hasResponse(dummy));
+ session2->releaseObject(allocatable3);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
+ do
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
+ }
+ while(!cb31->hasResponse(dummy) && !cb32->hasResponse(dummy));
+ test(cb31->hasResponse(dummy) && dummy && !cb32->hasResponse(dummy) ||
+ cb32->hasResponse(dummy) && dummy && !cb31->hasResponse(dummy));
+ session1->releaseObject(allocatable3);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
+ cb33 = cb31->hasResponse(dummy) ? cb32 : cb31;
+ cb33->waitResponse(__FILE__, __LINE__);
+ test(cb33->hasResponse(dummy) && dummy);
+ session1->releaseObject(allocatable3);
+
+ session1->allocateObjectById(allocatable3);
+ cb31 = new AllocateObjectByTypeCallback();
+ cb32 = new AllocateObjectByTypeCallback();
+ session1->allocateObjectByType_async(cb31, "::TestServer1");
+ session1->allocateObjectByType_async(cb32, "::TestServer1");
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb31->hasResponse(dummy));
+ test(!cb32->hasResponse(dummy));
+ session1->releaseObject(allocatable3);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
+ do
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(200));
+ }
+ while(!cb31->hasResponse(dummy) && !cb32->hasResponse(dummy));
+ test(cb31->hasResponse(dummy) && dummy && !cb32->hasResponse(dummy) ||
+ cb32->hasResponse(dummy) && dummy && !cb31->hasResponse(dummy));
+ session1->releaseObject(allocatable3);
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(300));
+ cb33 = cb31->hasResponse(dummy) ? cb32 : cb31;
+ cb33->waitResponse(__FILE__, __LINE__);
+ test(cb33->hasResponse(dummy) && dummy);
+ session1->releaseObject(allocatable3);
+
+ cout << "ok" << endl;
+
+ cout << "testing session destroy... " << flush;
+
+ obj = session2->allocateObjectByType("::Test"); // Allocate the object
+ test(obj && obj->ice_getIdentity().name == "allocatable");
+
+ session1->setAllocationTimeout(allocationTimeout);
+ cb3 = new AllocateObjectByTypeCallback();
+ session1->allocateObjectByType_async(cb3, "::Test");
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ test(!cb3->hasResponse(dummy));
+ session2->destroy();
+ cb3->waitResponse(__FILE__, __LINE__);
+ test(cb3->hasResponse(obj));
+ session1->destroy();
+
+ session2 = SessionPrx::uncheckedCast(registry->createSession("Client2", ""));
+ session2->setAllocationTimeout(0);
+ session2->allocateObjectById(allocatable);
+ session2->destroy();
+
+ cout << "ok" << endl;
+
+ cout << "testing allocation with Glacier2 session... " << flush;
+ Ice::ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347");
+ Glacier2::RouterPrx router1 = Glacier2::RouterPrx::checkedCast(routerBase->ice_connectionId("client1"));
+ test(router1);
+
+ Glacier2::SessionPrx sessionBase = router1->createSession("test1", "abc123");
+ try
+ {
+ session1 = IceGrid::SessionPrx::checkedCast(sessionBase->ice_connectionId("client1")->ice_router(router1));
+ test(session1);
+ session1->ice_ping();
+
+ Ice::ObjectPrx obj;
+ obj = session1->allocateObjectById(allocatable)->ice_connectionId("client1")->ice_router(router1);
+ obj->ice_ping();
+ session1->releaseObject(allocatable);
+ try
+ {
+ obj->ice_ping();
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ obj = session1->allocateObjectById(allocatable3)->ice_connectionId("client1")->ice_router(router1);
+ obj->ice_ping();
+ obj2 = communicator->stringToProxy("allocatable4")->ice_connectionId("client1")->ice_router(router1);
+ obj2->ice_ping();
+ session1->releaseObject(allocatable3);
+ try
+ {
+ obj->ice_ping();
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ obj2->ice_ping();
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ session1->destroy();
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ cout << "stress test... " << flush;
+
+ SessionPrx stressSession = registry->createSession("StressSession", "");
+ keepAlive->add(stressSession);
+
+ const int nClients = 10;
+ int i;
+ vector<StressClientPtr> clients;
+ for(i = 0; i < nClients - 2; ++i)
+ {
+ if(IceUtil::random(2) == 1)
+ {
+ clients.push_back(new StressClient(i, registry, false));
+ }
+ else
+ {
+ clients.push_back(new StressClient(i, stressSession));
+ }
+ clients.back()->start();
+ }
+ clients.push_back(new StressClient(i++, registry, true));
+ clients.back()->start();
+ clients.push_back(new StressClient(i++, registry, true));
+ clients.back()->start();
+
+ for(vector<StressClientPtr>::const_iterator p = clients.begin(); p != clients.end(); ++p)
+ {
+ (*p)->notifyThread();
+ }
+
+ //
+ // Let the stress client run for a bit.
+ //
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(8));
+
+ //
+ // Terminate the stress clients.
+ //
+ for(vector<StressClientPtr>::const_iterator q = clients.begin(); q != clients.end(); ++q)
+ {
+ (*q)->terminate();
+ (*q)->getThreadControl().join();
+ }
+
+ stressSession->destroy();
+
+ cout << "ok" << endl;
}
catch(const AllocationTimeoutException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
catch(const AllocationException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
cout << "shutting down router... " << flush;
diff --git a/cpp/test/IceGrid/allocation/Client.cpp b/cpp/test/IceGrid/allocation/Client.cpp
index 47f910e24da..940ae6bec73 100644
--- a/cpp/test/IceGrid/allocation/Client.cpp
+++ b/cpp/test/IceGrid/allocation/Client.cpp
@@ -27,28 +27,28 @@ main(int argc, char* argv[])
int status;
Ice::CommunicatorPtr communicator;
try
- {
- communicator = Ice::initialize(argc, argv);
- communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
- status = run(argc, argv, communicator);
+ {
+ communicator = Ice::initialize(argc, argv);
+ communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/allocation/PermissionsVerifier.cpp b/cpp/test/IceGrid/allocation/PermissionsVerifier.cpp
index d5d8bbd5d0b..37e46baa4e9 100644
--- a/cpp/test/IceGrid/allocation/PermissionsVerifier.cpp
+++ b/cpp/test/IceGrid/allocation/PermissionsVerifier.cpp
@@ -19,7 +19,7 @@ public:
virtual bool
checkPermissions(const string& userId, const string& passwd, string&, const Ice::Current& c) const
{
- return true;
+ return true;
}
};
@@ -29,11 +29,11 @@ public:
virtual int run(int, char*[])
{
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PermissionsVerifier");
- adapter->add(new PermissionsVerifierI, communicator()->stringToIdentity("PermissionsVerifier"));
- adapter->activate();
- communicator()->waitForShutdown();
- return EXIT_SUCCESS;
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PermissionsVerifier");
+ adapter->add(new PermissionsVerifierI, communicator()->stringToIdentity("PermissionsVerifier"));
+ adapter->activate();
+ communicator()->waitForShutdown();
+ return EXIT_SUCCESS;
}
};
diff --git a/cpp/test/IceGrid/deployer/AllTests.cpp b/cpp/test/IceGrid/deployer/AllTests.cpp
index ca0c77d6e78..5a87f264d18 100644
--- a/cpp/test/IceGrid/deployer/AllTests.cpp
+++ b/cpp/test/IceGrid/deployer/AllTests.cpp
@@ -71,7 +71,7 @@ public:
bool
operator()(const Ice::ObjectPrx& p1, const string& id) const
{
- return p1->ice_getIdentity() == _communicator->stringToIdentity(id);
+ return p1->ice_getIdentity() == _communicator->stringToIdentity(id);
}
private:
@@ -84,7 +84,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -99,15 +99,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -180,37 +180,37 @@ allTests(const Ice::CommunicatorPtr& comm)
test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"ReplicatedObject")) != objs.end());
{
- test(comm->identityToString(query->findObjectByType("::TestId1")->ice_getIdentity()) == "cat/name1");
- test(comm->identityToString(query->findObjectByType("::TestId2")->ice_getIdentity()) == "cat1/name1");
- test(comm->identityToString(query->findObjectByType("::TestId3")->ice_getIdentity()) == "cat1/name1-bis");
- test(comm->identityToString(query->findObjectByType("::TestId4")->ice_getIdentity()) == "c2\\/c2/n2\\/n2");
- test(comm->identityToString(query->findObjectByType("::TestId5")->ice_getIdentity()) == "n2\\/n2");
+ test(comm->identityToString(query->findObjectByType("::TestId1")->ice_getIdentity()) == "cat/name1");
+ test(comm->identityToString(query->findObjectByType("::TestId2")->ice_getIdentity()) == "cat1/name1");
+ test(comm->identityToString(query->findObjectByType("::TestId3")->ice_getIdentity()) == "cat1/name1-bis");
+ test(comm->identityToString(query->findObjectByType("::TestId4")->ice_getIdentity()) == "c2\\/c2/n2\\/n2");
+ test(comm->identityToString(query->findObjectByType("::TestId5")->ice_getIdentity()) == "n2\\/n2");
}
{
- Ice::ObjectPrx obj = query->findObjectByType("::Test");
- string id = comm->identityToString(obj->ice_getIdentity());
- test(id == "Server1" || id == "Server2" || id == "SimpleServer" ||
- id == "IceBox1-Service1" || id == "IceBox1-Service2" ||
- id == "IceBox2-Service1" || id == "IceBox2-Service2" ||
- id == "SimpleIceBox-SimpleService" || "ReplicatedObject");
+ Ice::ObjectPrx obj = query->findObjectByType("::Test");
+ string id = comm->identityToString(obj->ice_getIdentity());
+ test(id == "Server1" || id == "Server2" || id == "SimpleServer" ||
+ id == "IceBox1-Service1" || id == "IceBox1-Service2" ||
+ id == "IceBox2-Service1" || id == "IceBox2-Service2" ||
+ id == "SimpleIceBox-SimpleService" || "ReplicatedObject");
}
{
- Ice::ObjectPrx obj = query->findObjectByTypeOnLeastLoadedNode("::Test", LoadSample5);
- string id = comm->identityToString(obj->ice_getIdentity());
- test(id == "Server1" || id == "Server2" || id == "SimpleServer" ||
- id == "IceBox1-Service1" || id == "IceBox1-Service2" ||
- id == "IceBox2-Service1" || id == "IceBox2-Service2" ||
- id == "SimpleIceBox-SimpleService" || "ReplicatedObject");
+ Ice::ObjectPrx obj = query->findObjectByTypeOnLeastLoadedNode("::Test", LoadSample5);
+ string id = comm->identityToString(obj->ice_getIdentity());
+ test(id == "Server1" || id == "Server2" || id == "SimpleServer" ||
+ id == "IceBox1-Service1" || id == "IceBox1-Service2" ||
+ id == "IceBox2-Service1" || id == "IceBox2-Service2" ||
+ id == "SimpleIceBox-SimpleService" || "ReplicatedObject");
}
{
- Ice::ObjectPrx obj = query->findObjectByType("::Foo");
- test(!obj);
+ Ice::ObjectPrx obj = query->findObjectByType("::Foo");
+ test(!obj);
- obj = query->findObjectByTypeOnLeastLoadedNode("::Foo", LoadSample15);
- test(!obj);
+ obj = query->findObjectByTypeOnLeastLoadedNode("::Foo", LoadSample15);
+ test(!obj);
}
cout << "ok" << endl;
@@ -233,7 +233,7 @@ allTests(const Ice::CommunicatorPtr& comm)
obj = TestIntfPrx::checkedCast(comm->stringToProxy("IceBox2-Service1@IceBox2.Service1.Service1"));
obj = TestIntfPrx::checkedCast(comm->stringToProxy("IceBox2-Service2@IceBox2Service2Adapter"));
obj = TestIntfPrx::checkedCast(
- comm->stringToProxy("SimpleIceBox-SimpleService@SimpleIceBox.SimpleService.SimpleService"));
+ comm->stringToProxy("SimpleIceBox-SimpleService@SimpleIceBox.SimpleService.SimpleService"));
cout << "ok" << endl;
cout << "testing server configuration... " << flush;
@@ -280,21 +280,21 @@ allTests(const Ice::CommunicatorPtr& comm)
obj = TestIntfPrx::checkedCast(comm->stringToProxy("SimpleServer@SimpleServer.Server"));
proxies.push_back(obj);
obj = TestIntfPrx::checkedCast(
- comm->stringToProxy("SimpleIceBox-SimpleService@SimpleIceBox.SimpleService.SimpleService"));
+ comm->stringToProxy("SimpleIceBox-SimpleService@SimpleIceBox.SimpleService.SimpleService"));
proxies.push_back(obj);
for(vector<TestIntfPrx>::const_iterator p = proxies.begin(); p != proxies.end(); ++p)
{
- test((*p)->getProperty("AppVarProp") == "AppVar");
- test((*p)->getProperty("NodeVarProp") == "NodeVar");
- test((*p)->getProperty("RecursiveAppVarProp") == "Test");
- test((*p)->getProperty("AppVarOverridedProp") == "OverridedInNode");
- test((*p)->getProperty("AppVarDefinedInNodeProp") == "localnode");
- test((*p)->getProperty("EscapedAppVarProp") == "${escaped}");
- test((*p)->getProperty("RecursiveEscapedAppVarProp") == "${escaped}");
- test((*p)->getProperty("Recursive2EscapedAppVarProp") == "${escaped}");
- test((*p)->getProperty("RecursiveNodeVarProp") == "localnode");
- test((*p)->getProperty("TestDirProp") != "NotThisValue");
+ test((*p)->getProperty("AppVarProp") == "AppVar");
+ test((*p)->getProperty("NodeVarProp") == "NodeVar");
+ test((*p)->getProperty("RecursiveAppVarProp") == "Test");
+ test((*p)->getProperty("AppVarOverridedProp") == "OverridedInNode");
+ test((*p)->getProperty("AppVarDefinedInNodeProp") == "localnode");
+ test((*p)->getProperty("EscapedAppVarProp") == "${escaped}");
+ test((*p)->getProperty("RecursiveEscapedAppVarProp") == "${escaped}");
+ test((*p)->getProperty("Recursive2EscapedAppVarProp") == "${escaped}");
+ test((*p)->getProperty("RecursiveNodeVarProp") == "localnode");
+ test((*p)->getProperty("TestDirProp") != "NotThisValue");
}
cout << "ok" << endl;
@@ -416,17 +416,17 @@ allTests(const Ice::CommunicatorPtr& comm)
desc.serverTemplates["ServerTemplate"] = templ;
try
{
- admin->addApplication(desc);
- test(false);
+ admin->addApplication(desc);
+ test(false);
}
catch(const DeploymentException& ex)
{
- test(ex.reason.find("duplicate parameters") != string::npos);
+ test(ex.reason.find("duplicate parameters") != string::npos);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
cout << "ok" << endl;
@@ -731,7 +731,7 @@ void
allTestsWithTarget(const Ice::CommunicatorPtr& comm)
{
RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
- comm->stringToProxy("IceGrid/Registry"));
+ comm->stringToProxy("IceGrid/Registry"));
test(registry);
AdminSessionPrx session = registry->createAdminSession("foo", "bar");
diff --git a/cpp/test/IceGrid/deployer/Client.cpp b/cpp/test/IceGrid/deployer/Client.cpp
index 1288409798d..50ee597c317 100644
--- a/cpp/test/IceGrid/deployer/Client.cpp
+++ b/cpp/test/IceGrid/deployer/Client.cpp
@@ -20,21 +20,21 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
bool withTemplates = false;
if(argc > 1)
{
- int i = 1;
- while(i < argc)
- {
- if(strcmp(argv[i], "-t") == 0)
- {
- withTarget = true;
- break;
- }
- else if(strcmp(argv[i], "-e") == 0)
- {
- withTemplates = true;
- break;
- }
- i++;
- }
+ int i = 1;
+ while(i < argc)
+ {
+ if(strcmp(argv[i], "-t") == 0)
+ {
+ withTarget = true;
+ break;
+ }
+ else if(strcmp(argv[i], "-e") == 0)
+ {
+ withTemplates = true;
+ break;
+ }
+ i++;
+ }
}
Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
@@ -43,13 +43,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
if(!withTarget)
{
- void allTests(const Ice::CommunicatorPtr&);
- allTests(communicator);
+ void allTests(const Ice::CommunicatorPtr&);
+ allTests(communicator);
}
else
{
- void allTestsWithTarget(const Ice::CommunicatorPtr&);
- allTestsWithTarget(communicator);
+ void allTestsWithTarget(const Ice::CommunicatorPtr&);
+ allTestsWithTarget(communicator);
}
return EXIT_SUCCESS;
@@ -63,26 +63,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/deployer/Service.cpp b/cpp/test/IceGrid/deployer/Service.cpp
index 4e1b5d66e26..0bb30aff9bd 100644
--- a/cpp/test/IceGrid/deployer/Service.cpp
+++ b/cpp/test/IceGrid/deployer/Service.cpp
@@ -28,8 +28,8 @@ public:
virtual ~ServiceI();
virtual void start(const string&,
- const CommunicatorPtr&,
- const StringSeq&);
+ const CommunicatorPtr&,
+ const StringSeq&);
virtual void stop();
};
@@ -58,17 +58,17 @@ ServiceI::~ServiceI()
void
ServiceI::start(const string& name,
- const CommunicatorPtr& communicator,
- const StringSeq& args)
+ const CommunicatorPtr& communicator,
+ const StringSeq& args)
{
Ice::PropertiesPtr properties = communicator->getProperties();
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name);
if(properties->getPropertyAsInt(name + ".Freeze") > 0)
{
- //
- // We do this to ensure the dbenv directory exists.
- //
- Freeze::createConnection(communicator, name);
+ //
+ // We do this to ensure the dbenv directory exists.
+ //
+ Freeze::createConnection(communicator, name);
}
Ice::ObjectPtr object = new TestI(adapter, properties);
adapter->add(object, communicator->stringToIdentity(properties->getProperty(name + ".Identity")));
diff --git a/cpp/test/IceGrid/distribution/AllTests.cpp b/cpp/test/IceGrid/distribution/AllTests.cpp
index d47a3a9263c..c8e0dfc169f 100644
--- a/cpp/test/IceGrid/distribution/AllTests.cpp
+++ b/cpp/test/IceGrid/distribution/AllTests.cpp
@@ -26,7 +26,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -41,15 +41,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -88,9 +88,9 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing distributions... " << flush;
{
- TestIntfPrx test;
- test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all"));
- test(test->getServerFile("rootfile") == "");
+ TestIntfPrx test;
+ test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all"));
+ test(test->getServerFile("rootfile") == "");
try
{
@@ -102,15 +102,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(false);
}
- test(test->getServerFile("rootfile") == "rootfile");
- test(test->getServerFile("dir1/file1") == "dummy-file1");
- test(test->getServerFile("dir1/file2") == "dummy-file2");
- test(test->getServerFile("dir2/file3") == "dummy-file3");
+ test(test->getServerFile("rootfile") == "rootfile");
+ test(test->getServerFile("dir1/file1") == "dummy-file1");
+ test(test->getServerFile("dir1/file2") == "dummy-file2");
+ test(test->getServerFile("dir2/file3") == "dummy-file3");
- test(test->getApplicationFile("rootfile") == "");
- test(test->getApplicationFile("dir1/file1") == "");
- test(test->getApplicationFile("dir1/file2") == "");
- test(test->getApplicationFile("dir2/file3") == "dummy-file3");
+ test(test->getApplicationFile("rootfile") == "");
+ test(test->getApplicationFile("dir1/file1") == "");
+ test(test->getApplicationFile("dir1/file2") == "");
+ test(test->getApplicationFile("dir2/file3") == "dummy-file3");
try
{
@@ -121,17 +121,17 @@ allTests(const Ice::CommunicatorPtr& communicator)
copy(ex.reasons.begin(), ex.reasons.end(), ostream_iterator<string>(cerr, "\n"));
test(false);
}
- test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all-direct"));
+ test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all-direct"));
- test(test->getServerFile("rootfile") == "rootfile");
- test(test->getServerFile("dir1/file1") == "dummy-file1");
- test(test->getServerFile("dir1/file2") == "dummy-file2");
- test(test->getServerFile("dir2/file3") == "dummy-file3");
+ test(test->getServerFile("rootfile") == "rootfile");
+ test(test->getServerFile("dir1/file1") == "dummy-file1");
+ test(test->getServerFile("dir1/file2") == "dummy-file2");
+ test(test->getServerFile("dir2/file3") == "dummy-file3");
- test(test->getApplicationFile("rootfile") == "");
- test(test->getApplicationFile("dir1/file1") == "");
- test(test->getApplicationFile("dir1/file2") == "");
- test(test->getApplicationFile("dir2/file3") == "dummy-file3");
+ test(test->getApplicationFile("rootfile") == "");
+ test(test->getApplicationFile("dir1/file1") == "");
+ test(test->getApplicationFile("dir1/file2") == "");
+ test(test->getApplicationFile("dir2/file3") == "dummy-file3");
try
{
@@ -142,17 +142,17 @@ allTests(const Ice::CommunicatorPtr& communicator)
copy(ex.reasons.begin(), ex.reasons.end(), ostream_iterator<string>(cerr, "\n"));
test(false);
}
- test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-dir1"));
+ test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-dir1"));
- test(test->getServerFile("rootfile") == "");
- test(test->getServerFile("dir1/file1") == "dummy-file1");
- test(test->getServerFile("dir1/file2") == "dummy-file2");
- test(test->getServerFile("dir2/file3") == "");
+ test(test->getServerFile("rootfile") == "");
+ test(test->getServerFile("dir1/file1") == "dummy-file1");
+ test(test->getServerFile("dir1/file2") == "dummy-file2");
+ test(test->getServerFile("dir2/file3") == "");
- test(test->getApplicationFile("rootfile") == "");
- test(test->getApplicationFile("dir1/file1") == "");
- test(test->getApplicationFile("dir1/file2") == "");
- test(test->getApplicationFile("dir2/file3") == "dummy-file3");
+ test(test->getApplicationFile("rootfile") == "");
+ test(test->getApplicationFile("dir1/file1") == "");
+ test(test->getApplicationFile("dir1/file2") == "");
+ test(test->getApplicationFile("dir2/file3") == "dummy-file3");
}
cout << "ok" << endl;
@@ -169,9 +169,9 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing distributions after update... " << flush;
{
- TestIntfPrx test;
- test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all"));
- test(test->getServerFile("rootfile") == "rootfile");
+ TestIntfPrx test;
+ test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all"));
+ test(test->getServerFile("rootfile") == "rootfile");
try
{
@@ -183,17 +183,17 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(false);
}
- test(test->getServerFile("rootfile") == "rootfile-updated!");
- test(test->getServerFile("dir1/file1") == "");
- test(test->getServerFile("dir1/file2") == "dummy-file2-updated!");
- test(test->getServerFile("dir2/file3") == "dummy-file3");
- test(test->getServerFile("dir2/file4") == "dummy-file4");
-
- test(test->getApplicationFile("rootfile") == "");
- test(test->getApplicationFile("dir1/file1") == "");
- test(test->getApplicationFile("dir1/file2") == "");
- test(test->getApplicationFile("dir2/file3") == "dummy-file3");
- test(test->getApplicationFile("dir2/file4") == "dummy-file4");
+ test(test->getServerFile("rootfile") == "rootfile-updated!");
+ test(test->getServerFile("dir1/file1") == "");
+ test(test->getServerFile("dir1/file2") == "dummy-file2-updated!");
+ test(test->getServerFile("dir2/file3") == "dummy-file3");
+ test(test->getServerFile("dir2/file4") == "dummy-file4");
+
+ test(test->getApplicationFile("rootfile") == "");
+ test(test->getApplicationFile("dir1/file1") == "");
+ test(test->getApplicationFile("dir1/file2") == "");
+ test(test->getApplicationFile("dir2/file3") == "dummy-file3");
+ test(test->getApplicationFile("dir2/file4") == "dummy-file4");
try
{
@@ -204,19 +204,19 @@ allTests(const Ice::CommunicatorPtr& communicator)
copy(ex.reasons.begin(), ex.reasons.end(), ostream_iterator<string>(cerr, "\n"));
test(false);
}
- test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all-direct"));
+ test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-all-direct"));
- test(test->getServerFile("rootfile") == "rootfile-updated!");
- test(test->getServerFile("dir1/file1") == "");
- test(test->getServerFile("dir1/file2") == "dummy-file2-updated!");
- test(test->getServerFile("dir2/file3") == "dummy-file3");
- test(test->getServerFile("dir2/file4") == "dummy-file4");
+ test(test->getServerFile("rootfile") == "rootfile-updated!");
+ test(test->getServerFile("dir1/file1") == "");
+ test(test->getServerFile("dir1/file2") == "dummy-file2-updated!");
+ test(test->getServerFile("dir2/file3") == "dummy-file3");
+ test(test->getServerFile("dir2/file4") == "dummy-file4");
- test(test->getApplicationFile("rootfile") == "");
- test(test->getApplicationFile("dir1/file1") == "");
- test(test->getApplicationFile("dir1/file2") == "");
- test(test->getApplicationFile("dir2/file3") == "dummy-file3");
- test(test->getApplicationFile("dir2/file4") == "dummy-file4");
+ test(test->getApplicationFile("rootfile") == "");
+ test(test->getApplicationFile("dir1/file1") == "");
+ test(test->getApplicationFile("dir1/file2") == "");
+ test(test->getApplicationFile("dir2/file3") == "dummy-file3");
+ test(test->getApplicationFile("dir2/file4") == "dummy-file4");
try
{
@@ -227,19 +227,19 @@ allTests(const Ice::CommunicatorPtr& communicator)
copy(ex.reasons.begin(), ex.reasons.end(), ostream_iterator<string>(cerr, "\n"));
test(false);
}
- test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-dir1"));
-
- test(test->getServerFile("rootfile") == "");
- test(test->getServerFile("dir1/file1") == "");
- test(test->getServerFile("dir1/file2") == "dummy-file2-updated!");
- test(test->getServerFile("dir2/file3") == "");
- test(test->getServerFile("dir2/file4") == "");
-
- test(test->getApplicationFile("rootfile") == "");
- test(test->getApplicationFile("dir1/file1") == "");
- test(test->getApplicationFile("dir1/file2") == "");
- test(test->getApplicationFile("dir2/file3") == "dummy-file3");
- test(test->getApplicationFile("dir2/file4") == "dummy-file4");
+ test = TestIntfPrx::uncheckedCast(communicator->stringToProxy("server-dir1"));
+
+ test(test->getServerFile("rootfile") == "");
+ test(test->getServerFile("dir1/file1") == "");
+ test(test->getServerFile("dir1/file2") == "dummy-file2-updated!");
+ test(test->getServerFile("dir2/file3") == "");
+ test(test->getServerFile("dir2/file4") == "");
+
+ test(test->getApplicationFile("rootfile") == "");
+ test(test->getApplicationFile("dir1/file1") == "");
+ test(test->getApplicationFile("dir1/file2") == "");
+ test(test->getApplicationFile("dir2/file3") == "dummy-file3");
+ test(test->getApplicationFile("dir2/file4") == "dummy-file4");
}
cout << "ok" << endl;
diff --git a/cpp/test/IceGrid/distribution/Client.cpp b/cpp/test/IceGrid/distribution/Client.cpp
index 47f910e24da..940ae6bec73 100644
--- a/cpp/test/IceGrid/distribution/Client.cpp
+++ b/cpp/test/IceGrid/distribution/Client.cpp
@@ -27,28 +27,28 @@ main(int argc, char* argv[])
int status;
Ice::CommunicatorPtr communicator;
try
- {
- communicator = Ice::initialize(argc, argv);
- communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
- status = run(argc, argv, communicator);
+ {
+ communicator = Ice::initialize(argc, argv);
+ communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/distribution/TestI.cpp b/cpp/test/IceGrid/distribution/TestI.cpp
index d762e5a3ed0..903c51caeb9 100644
--- a/cpp/test/IceGrid/distribution/TestI.cpp
+++ b/cpp/test/IceGrid/distribution/TestI.cpp
@@ -28,7 +28,7 @@ TestI::getServerFile(const string& path, const Ice::Current&)
string content;
if(is.good())
{
- is >> content;
+ is >> content;
}
return content;
}
@@ -41,7 +41,7 @@ TestI::getApplicationFile(const string& path, const Ice::Current&)
string content;
if(is.good())
{
- is >> content;
+ is >> content;
}
return content;
}
diff --git a/cpp/test/IceGrid/distribution/run.py b/cpp/test/IceGrid/distribution/run.py
index 81ca0f497d7..1e27b744862 100755
--- a/cpp/test/IceGrid/distribution/run.py
+++ b/cpp/test/IceGrid/distribution/run.py
@@ -57,7 +57,7 @@ else:
for [file, content] in files:
file = os.path.join(datadir, file)
if not os.path.exists(os.path.dirname(file)):
- os.makedirs(os.path.dirname(file))
+ os.makedirs(os.path.dirname(file))
f = open(file, 'w')
f.write(content)
f.close()
diff --git a/cpp/test/IceGrid/replicaGroup/AllTests.cpp b/cpp/test/IceGrid/replicaGroup/AllTests.cpp
index 9ae9ce21c3c..d07d69a1c17 100644
--- a/cpp/test/IceGrid/replicaGroup/AllTests.cpp
+++ b/cpp/test/IceGrid/replicaGroup/AllTests.cpp
@@ -27,7 +27,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -42,15 +42,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -86,12 +86,12 @@ instantiateServer(const AdminPrx& admin, const string& templ, const string& node
update.nodes.push_back(nodeUpdate);
try
{
- admin->updateApplication(update);
+ admin->updateApplication(update);
}
catch(DeploymentException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
}
@@ -100,7 +100,7 @@ removeServer(const AdminPrx& admin, const string& id)
{
try
{
- admin->stopServer(id);
+ admin->stopServer(id);
}
catch(const ServerStopException&)
{
@@ -110,8 +110,8 @@ removeServer(const AdminPrx& admin, const string& id)
}
catch(const Ice::UserException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
NodeUpdateDescriptor nodeUpdate;
@@ -122,12 +122,12 @@ removeServer(const AdminPrx& admin, const string& id)
update.nodes.push_back(nodeUpdate);
try
{
- admin->updateApplication(update);
+ admin->updateApplication(update);
}
catch(DeploymentException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
}
@@ -155,434 +155,434 @@ allTests(const Ice::CommunicatorPtr& comm)
cout << "testing Query::findAllReplicas... " << flush;
{
- map<string, string> params;
- params["replicaGroup"] = "RoundRobin";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server3";
- instantiateServer(admin, "Server", "localnode", params);
-
- QueryPrx query = IceGrid::QueryPrx::checkedCast(comm->stringToProxy("IceGrid/Query"));
- test(query);
-
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy@RoundRobin"));
- Ice::ObjectProxySeq objs = query->findAllReplicas(obj);
- test(objs.size() == 3);
- test(serverReplicaIds.find(objs[0]->ice_getAdapterId()) != serverReplicaIds.end());
- test(serverReplicaIds.find(objs[1]->ice_getAdapterId()) != serverReplicaIds.end());
- test(serverReplicaIds.find(objs[2]->ice_getAdapterId()) != serverReplicaIds.end());
-
- obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy@dummy"));
- objs = query->findAllReplicas(obj);
- test(objs.empty());
-
- obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy@Server1.ReplicatedAdapter"));
- objs = query->findAllReplicas(obj);
- test(objs.empty());
-
- obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy:tcp"));
- objs = query->findAllReplicas(obj);
- test(objs.empty());
-
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
- removeServer(admin, "Server3");
+ map<string, string> params;
+ params["replicaGroup"] = "RoundRobin";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server3";
+ instantiateServer(admin, "Server", "localnode", params);
+
+ QueryPrx query = IceGrid::QueryPrx::checkedCast(comm->stringToProxy("IceGrid/Query"));
+ test(query);
+
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy@RoundRobin"));
+ Ice::ObjectProxySeq objs = query->findAllReplicas(obj);
+ test(objs.size() == 3);
+ test(serverReplicaIds.find(objs[0]->ice_getAdapterId()) != serverReplicaIds.end());
+ test(serverReplicaIds.find(objs[1]->ice_getAdapterId()) != serverReplicaIds.end());
+ test(serverReplicaIds.find(objs[2]->ice_getAdapterId()) != serverReplicaIds.end());
+
+ obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy@dummy"));
+ objs = query->findAllReplicas(obj);
+ test(objs.empty());
+
+ obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy@Server1.ReplicatedAdapter"));
+ objs = query->findAllReplicas(obj);
+ test(objs.empty());
+
+ obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("dummy:tcp"));
+ objs = query->findAllReplicas(obj);
+ test(objs.empty());
+
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+ removeServer(admin, "Server3");
}
cout << "ok" << endl;
cout << "testing replication with round-robin load balancing... " << flush;
{
- map<string, string> params;
- params["replicaGroup"] = "RoundRobin";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server3";
- instantiateServer(admin, "Server", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin"));
- try
- {
- test(obj->getReplicaIdAndShutdown() == "Server1.ReplicatedAdapter");
- test(obj->getReplicaIdAndShutdown() == "Server2.ReplicatedAdapter");
- test(obj->getReplicaIdAndShutdown() == "Server3.ReplicatedAdapter");
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
- removeServer(admin, "Server3");
+ map<string, string> params;
+ params["replicaGroup"] = "RoundRobin";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server3";
+ instantiateServer(admin, "Server", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin"));
+ try
+ {
+ test(obj->getReplicaIdAndShutdown() == "Server1.ReplicatedAdapter");
+ test(obj->getReplicaIdAndShutdown() == "Server2.ReplicatedAdapter");
+ test(obj->getReplicaIdAndShutdown() == "Server3.ReplicatedAdapter");
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+ removeServer(admin, "Server3");
}
{
- map<string, string> params;
- params["replicaGroup"] = "RoundRobin";
- params["id"] = "IceBox1";
- instantiateServer(admin, "IceBox", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin"));
- try
- {
- test(obj->getReplicaIdAndShutdown() == "IceBox1.Service1.Service1");
- test(obj->getReplicaIdAndShutdown() == "IceBox1.Service2.Service2");
- test(obj->getReplicaIdAndShutdown() == "IceBox1.Service3.Service3");
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- removeServer(admin, "IceBox1");
+ map<string, string> params;
+ params["replicaGroup"] = "RoundRobin";
+ params["id"] = "IceBox1";
+ instantiateServer(admin, "IceBox", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin"));
+ try
+ {
+ test(obj->getReplicaIdAndShutdown() == "IceBox1.Service1.Service1");
+ test(obj->getReplicaIdAndShutdown() == "IceBox1.Service2.Service2");
+ test(obj->getReplicaIdAndShutdown() == "IceBox1.Service3.Service3");
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ removeServer(admin, "IceBox1");
}
cout << "ok" << endl;
cout << "testing replication with ordered load balancing... " << flush;
{
- map<string, string> params;
- params["replicaGroup"] = "Ordered";
- params["id"] = "Server1";
- params["priority"] = "3";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server2";
- params["priority"] = "1";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server3";
- params["priority"] = "2";
- instantiateServer(admin, "Server", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Ordered"));
- try
- {
- test(obj->getReplicaIdAndShutdown() == "Server2.ReplicatedAdapter");
- admin->enableServer("Server2", false);
- test(obj->getReplicaIdAndShutdown() == "Server3.ReplicatedAdapter");
- admin->enableServer("Server3", false);
- test(obj->getReplicaIdAndShutdown() == "Server1.ReplicatedAdapter");
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
- removeServer(admin, "Server3");
+ map<string, string> params;
+ params["replicaGroup"] = "Ordered";
+ params["id"] = "Server1";
+ params["priority"] = "3";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server2";
+ params["priority"] = "1";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server3";
+ params["priority"] = "2";
+ instantiateServer(admin, "Server", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Ordered"));
+ try
+ {
+ test(obj->getReplicaIdAndShutdown() == "Server2.ReplicatedAdapter");
+ admin->enableServer("Server2", false);
+ test(obj->getReplicaIdAndShutdown() == "Server3.ReplicatedAdapter");
+ admin->enableServer("Server3", false);
+ test(obj->getReplicaIdAndShutdown() == "Server1.ReplicatedAdapter");
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+ removeServer(admin, "Server3");
}
{
- map<string, string> params;
- params["replicaGroup"] = "Ordered";
- params["id"] = "IceBox1";
- instantiateServer(admin, "IceBox", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Ordered"));
- try
- {
- test(obj->getReplicaIdAndShutdown() == "IceBox1.Service3.Service3");
- test(obj->getReplicaIdAndShutdown() == "IceBox1.Service2.Service2");
- test(obj->getReplicaIdAndShutdown() == "IceBox1.Service1.Service1");
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- removeServer(admin, "IceBox1");
+ map<string, string> params;
+ params["replicaGroup"] = "Ordered";
+ params["id"] = "IceBox1";
+ instantiateServer(admin, "IceBox", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Ordered"));
+ try
+ {
+ test(obj->getReplicaIdAndShutdown() == "IceBox1.Service3.Service3");
+ test(obj->getReplicaIdAndShutdown() == "IceBox1.Service2.Service2");
+ test(obj->getReplicaIdAndShutdown() == "IceBox1.Service1.Service1");
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ removeServer(admin, "IceBox1");
}
cout << "ok" << endl;
cout << "testing replication with random load balancing... " << flush;
{
- map<string, string> params;
- params["replicaGroup"] = "Random";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server3";
- instantiateServer(admin, "Server", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
- obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
- obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
- set<string> replicaIds = serverReplicaIds;
- while(!replicaIds.empty())
- {
- try
- {
- replicaIds.erase(obj->getReplicaId());
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- }
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
- removeServer(admin, "Server3");
+ map<string, string> params;
+ params["replicaGroup"] = "Random";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server3";
+ instantiateServer(admin, "Server", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
+ set<string> replicaIds = serverReplicaIds;
+ while(!replicaIds.empty())
+ {
+ try
+ {
+ replicaIds.erase(obj->getReplicaId());
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ }
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+ removeServer(admin, "Server3");
}
{
- map<string, string> params;
- params["replicaGroup"] = "Random";
- params["id"] = "IceBox1";
- instantiateServer(admin, "IceBox", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
- obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
- obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
- set<string> replicaIds = svcReplicaIds;
- while(!replicaIds.empty())
- {
- try
- {
- replicaIds.erase(obj->getReplicaId());
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- }
- removeServer(admin, "IceBox1");
+ map<string, string> params;
+ params["replicaGroup"] = "Random";
+ params["id"] = "IceBox1";
+ instantiateServer(admin, "IceBox", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
+ set<string> replicaIds = svcReplicaIds;
+ while(!replicaIds.empty())
+ {
+ try
+ {
+ replicaIds.erase(obj->getReplicaId());
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ }
+ removeServer(admin, "IceBox1");
}
cout << "ok" << endl;
cout << "testing replication with adaptive load balancing... " << flush;
{
- map<string, string> params;
- params["replicaGroup"] = "Adaptive";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server3";
- instantiateServer(admin, "Server", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Adaptive"));
- obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
- obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
- set<string> replicaIds = serverReplicaIds;
- while(!replicaIds.empty())
- {
- try
- {
- replicaIds.erase(obj->getReplicaId());
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- }
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
- removeServer(admin, "Server3");
+ map<string, string> params;
+ params["replicaGroup"] = "Adaptive";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server3";
+ instantiateServer(admin, "Server", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Adaptive"));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
+ set<string> replicaIds = serverReplicaIds;
+ while(!replicaIds.empty())
+ {
+ try
+ {
+ replicaIds.erase(obj->getReplicaId());
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ }
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+ removeServer(admin, "Server3");
}
{
- map<string, string> params;
- params["replicaGroup"] = "Adaptive";
- params["id"] = "IceBox1";
- instantiateServer(admin, "IceBox", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Adaptive"));
- obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
- obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
- set<string> replicaIds = svcReplicaIds;
- while(!replicaIds.empty())
- {
- try
- {
- replicaIds.erase(obj->getReplicaId());
- }
- catch(const Ice::ConnectionRefusedException&)
- {
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- }
- removeServer(admin, "IceBox1");
+ map<string, string> params;
+ params["replicaGroup"] = "Adaptive";
+ params["id"] = "IceBox1";
+ instantiateServer(admin, "IceBox", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Adaptive"));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(0));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
+ set<string> replicaIds = svcReplicaIds;
+ while(!replicaIds.empty())
+ {
+ try
+ {
+ replicaIds.erase(obj->getReplicaId());
+ }
+ catch(const Ice::ConnectionRefusedException&)
+ {
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ }
+ removeServer(admin, "IceBox1");
}
cout << "ok" << endl;
cout << "testing load balancing n-replicas..." << flush;
{
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin-2"));
- obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(-1));
- obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- map<string, string> params;
- params["replicaGroup"] = "RoundRobin-2";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server3";
- instantiateServer(admin, "Server", "localnode", params);
- try
- {
- set<string> replicaIds;
- set<string> expected;
- replicaIds.insert("Server1.ReplicatedAdapter");
- replicaIds.insert("Server2.ReplicatedAdapter");
- expected = replicaIds;
- while(!replicaIds.empty())
- {
- string replicaId = obj->getReplicaId();
- test(expected.find(replicaId) != expected.end());
- replicaIds.erase(replicaId);
- }
- obj->ice_locatorCacheTimeout(0)->ice_ping();
- replicaIds.insert("Server2.ReplicatedAdapter");
- replicaIds.insert("Server3.ReplicatedAdapter");
- expected = replicaIds;
- while(!replicaIds.empty())
- {
- string replicaId = obj->getReplicaId();
- test(expected.find(replicaId) != expected.end());
- replicaIds.erase(replicaId);
- }
- obj->ice_locatorCacheTimeout(0)->ice_ping();
- replicaIds.insert("Server3.ReplicatedAdapter");
- replicaIds.insert("Server1.ReplicatedAdapter");
- expected = replicaIds;
- while(!replicaIds.empty())
- {
- string replicaId = obj->getReplicaId();
- test(expected.find(replicaId) != expected.end());
- replicaIds.erase(replicaId);
- }
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
- removeServer(admin, "Server3");
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin-2"));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(-1));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ map<string, string> params;
+ params["replicaGroup"] = "RoundRobin-2";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server3";
+ instantiateServer(admin, "Server", "localnode", params);
+ try
+ {
+ set<string> replicaIds;
+ set<string> expected;
+ replicaIds.insert("Server1.ReplicatedAdapter");
+ replicaIds.insert("Server2.ReplicatedAdapter");
+ expected = replicaIds;
+ while(!replicaIds.empty())
+ {
+ string replicaId = obj->getReplicaId();
+ test(expected.find(replicaId) != expected.end());
+ replicaIds.erase(replicaId);
+ }
+ obj->ice_locatorCacheTimeout(0)->ice_ping();
+ replicaIds.insert("Server2.ReplicatedAdapter");
+ replicaIds.insert("Server3.ReplicatedAdapter");
+ expected = replicaIds;
+ while(!replicaIds.empty())
+ {
+ string replicaId = obj->getReplicaId();
+ test(expected.find(replicaId) != expected.end());
+ replicaIds.erase(replicaId);
+ }
+ obj->ice_locatorCacheTimeout(0)->ice_ping();
+ replicaIds.insert("Server3.ReplicatedAdapter");
+ replicaIds.insert("Server1.ReplicatedAdapter");
+ expected = replicaIds;
+ while(!replicaIds.empty())
+ {
+ string replicaId = obj->getReplicaId();
+ test(expected.find(replicaId) != expected.end());
+ replicaIds.erase(replicaId);
+ }
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+ removeServer(admin, "Server3");
}
{
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin-All"));
- obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(-1));
- obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
- try
- {
- obj->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- map<string, string> params;
- params["replicaGroup"] = "RoundRobin-All";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- params["id"] = "Server3";
- instantiateServer(admin, "Server", "localnode", params);
- try
- {
- set<string> replicaIds;
- set<string> expected;
- replicaIds.insert("Server1.ReplicatedAdapter");
- replicaIds.insert("Server2.ReplicatedAdapter");
- replicaIds.insert("Server3.ReplicatedAdapter");
- expected = replicaIds;
- while(!replicaIds.empty())
- {
- string replicaId = obj->getReplicaId();
- test(expected.find(replicaId) != expected.end());
- replicaIds.erase(replicaId);
- }
- obj->ice_locatorCacheTimeout(0)->ice_ping();
- replicaIds.insert("Server1.ReplicatedAdapter");
- replicaIds.insert("Server2.ReplicatedAdapter");
- replicaIds.insert("Server3.ReplicatedAdapter");
- expected = replicaIds;
- while(!replicaIds.empty())
- {
- string replicaId = obj->getReplicaId();
- test(expected.find(replicaId) != expected.end());
- replicaIds.erase(replicaId);
- }
- }
- catch(const Ice::LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
- removeServer(admin, "Server3");
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin-All"));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_locatorCacheTimeout(-1));
+ obj = TestIntfPrx::uncheckedCast(obj->ice_connectionCached(false));
+ try
+ {
+ obj->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ map<string, string> params;
+ params["replicaGroup"] = "RoundRobin-All";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ params["id"] = "Server3";
+ instantiateServer(admin, "Server", "localnode", params);
+ try
+ {
+ set<string> replicaIds;
+ set<string> expected;
+ replicaIds.insert("Server1.ReplicatedAdapter");
+ replicaIds.insert("Server2.ReplicatedAdapter");
+ replicaIds.insert("Server3.ReplicatedAdapter");
+ expected = replicaIds;
+ while(!replicaIds.empty())
+ {
+ string replicaId = obj->getReplicaId();
+ test(expected.find(replicaId) != expected.end());
+ replicaIds.erase(replicaId);
+ }
+ obj->ice_locatorCacheTimeout(0)->ice_ping();
+ replicaIds.insert("Server1.ReplicatedAdapter");
+ replicaIds.insert("Server2.ReplicatedAdapter");
+ replicaIds.insert("Server3.ReplicatedAdapter");
+ expected = replicaIds;
+ while(!replicaIds.empty())
+ {
+ string replicaId = obj->getReplicaId();
+ test(expected.find(replicaId) != expected.end());
+ replicaIds.erase(replicaId);
+ }
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+ removeServer(admin, "Server3");
}
cout << "ok" << endl;
cout << "testing replication with inactive nodes... " << flush;
{
- map<string, string> params;
-
- params["replicaGroup"] = "Random";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "inactivenode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
- test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
-
- //
- // Also make sure that findObjectByTypeOnLeastLoadedNode still work.
- //
- QueryPrx query = IceGrid::QueryPrx::checkedCast(comm->stringToProxy("IceGrid/Query"));
- obj = TestIntfPrx::uncheckedCast(query->findObjectByTypeOnLeastLoadedNode("::Test::TestIntf", LoadSample1));
- test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
-
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
-
- params["replicaGroup"] = "RoundRobin";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "inactivenode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin"));
- test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
-
- params["replicaGroup"] = "Adaptive";
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "inactivenode", params);
- params["id"] = "Server2";
- instantiateServer(admin, "Server", "localnode", params);
- obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Adaptive"));
- test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
- removeServer(admin, "Server1");
- removeServer(admin, "Server2");
-
- params["replicaGroup"] = "Random";
- params["id"] = "IceBox1";
- instantiateServer(admin, "IceBox", "localnode", params);
- params["id"] = "Server1";
- instantiateServer(admin, "Server", "inactivenode", params);
- obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
- test(svcReplicaIds.find(obj->getReplicaId()) != svcReplicaIds.end());
- removeServer(admin, "IceBox1");
- removeServer(admin, "Server1");
+ map<string, string> params;
+
+ params["replicaGroup"] = "Random";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "inactivenode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ TestIntfPrx obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
+ test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
+
+ //
+ // Also make sure that findObjectByTypeOnLeastLoadedNode still work.
+ //
+ QueryPrx query = IceGrid::QueryPrx::checkedCast(comm->stringToProxy("IceGrid/Query"));
+ obj = TestIntfPrx::uncheckedCast(query->findObjectByTypeOnLeastLoadedNode("::Test::TestIntf", LoadSample1));
+ test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
+
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+
+ params["replicaGroup"] = "RoundRobin";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "inactivenode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("RoundRobin"));
+ test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+
+ params["replicaGroup"] = "Adaptive";
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "inactivenode", params);
+ params["id"] = "Server2";
+ instantiateServer(admin, "Server", "localnode", params);
+ obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Adaptive"));
+ test(obj->getReplicaId() == "Server2.ReplicatedAdapter");
+ removeServer(admin, "Server1");
+ removeServer(admin, "Server2");
+
+ params["replicaGroup"] = "Random";
+ params["id"] = "IceBox1";
+ instantiateServer(admin, "IceBox", "localnode", params);
+ params["id"] = "Server1";
+ instantiateServer(admin, "Server", "inactivenode", params);
+ obj = TestIntfPrx::uncheckedCast(comm->stringToProxy("Random"));
+ test(svcReplicaIds.find(obj->getReplicaId()) != svcReplicaIds.end());
+ removeServer(admin, "IceBox1");
+ removeServer(admin, "Server1");
};
cout << "ok" << endl;
diff --git a/cpp/test/IceGrid/replicaGroup/Client.cpp b/cpp/test/IceGrid/replicaGroup/Client.cpp
index 0527d790712..a0f1ccc1976 100644
--- a/cpp/test/IceGrid/replicaGroup/Client.cpp
+++ b/cpp/test/IceGrid/replicaGroup/Client.cpp
@@ -29,26 +29,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/replicaGroup/Service.cpp b/cpp/test/IceGrid/replicaGroup/Service.cpp
index 4948e4914a0..f90125bd4b8 100644
--- a/cpp/test/IceGrid/replicaGroup/Service.cpp
+++ b/cpp/test/IceGrid/replicaGroup/Service.cpp
@@ -27,8 +27,8 @@ public:
virtual ~ServiceI();
virtual void start(const string&,
- const CommunicatorPtr&,
- const StringSeq&);
+ const CommunicatorPtr&,
+ const StringSeq&);
virtual void stop();
};
@@ -57,8 +57,8 @@ ServiceI::~ServiceI()
void
ServiceI::start(const string& name,
- const CommunicatorPtr& communicator,
- const StringSeq& args)
+ const CommunicatorPtr& communicator,
+ const StringSeq& args)
{
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name);
Ice::ObjectPtr object = new TestI(adapter, communicator->getProperties());
diff --git a/cpp/test/IceGrid/replication/AllTests.cpp b/cpp/test/IceGrid/replication/AllTests.cpp
index 6ea8a923372..2ebf0731d48 100644
--- a/cpp/test/IceGrid/replication/AllTests.cpp
+++ b/cpp/test/IceGrid/replication/AllTests.cpp
@@ -28,7 +28,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -43,15 +43,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -78,13 +78,13 @@ waitForServerState(const IceGrid::AdminPrx& admin, const std::string& server, bo
int nRetry = 0;
while(nRetry < 30)
{
- if(admin->getServerState(server) == (up ? Active : Inactive))
- {
- return;
- }
+ if(admin->getServerState(server) == (up ? Active : Inactive))
+ {
+ return;
+ }
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
}
test(false);
}
@@ -95,41 +95,41 @@ waitForNodeState(const IceGrid::AdminPrx& admin, const std::string& node, bool u
int nRetry = 0;
while(nRetry < 30)
{
- try
- {
- if(admin->pingNode(node) == up) // Wait for the node to be removed.
- {
- return;
- }
- }
- catch(const NodeNotExistException&)
- {
- if(!up)
- {
- return;
- }
- }
-
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
+ try
+ {
+ if(admin->pingNode(node) == up) // Wait for the node to be removed.
+ {
+ return;
+ }
+ }
+ catch(const NodeNotExistException&)
+ {
+ if(!up)
+ {
+ return;
+ }
+ }
+
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
}
try
{
- if(admin->pingNode(node) != up)
- {
- cerr << "node state change timed out:" << endl;
- cerr << "node: " << node << endl;
- cerr << "state: " << up << endl;
- }
+ if(admin->pingNode(node) != up)
+ {
+ cerr << "node state change timed out:" << endl;
+ cerr << "node: " << node << endl;
+ cerr << "state: " << up << endl;
+ }
}
catch(NodeNotExistException&)
{
- if(up)
- {
- cerr << "node state change timed out:" << endl;
- cerr << "node: " << node << endl;
- cerr << "state: " << up << endl;
- }
+ if(up)
+ {
+ cerr << "node state change timed out:" << endl;
+ cerr << "node: " << node << endl;
+ cerr << "state: " << up << endl;
+ }
}
}
@@ -147,17 +147,17 @@ instantiateServer(const AdminPrx& admin, const string& templ, const map<string,
update.nodes.push_back(nodeUpdate);
try
{
- admin->updateApplication(update);
+ admin->updateApplication(update);
}
catch(DeploymentException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
catch(const Ice::LocalException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
}
@@ -166,7 +166,7 @@ removeServer(const AdminPrx& admin, const string& id)
{
try
{
- admin->stopServer(id);
+ admin->stopServer(id);
}
catch(const ServerStopException&)
{
@@ -176,8 +176,8 @@ removeServer(const AdminPrx& admin, const string& id)
}
catch(const Ice::UserException& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
NodeUpdateDescriptor nodeUpdate;
@@ -188,12 +188,12 @@ removeServer(const AdminPrx& admin, const string& id)
update.nodes.push_back(nodeUpdate);
try
{
- admin->updateApplication(update);
+ admin->updateApplication(update);
}
catch(DeploymentException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
}
@@ -203,16 +203,16 @@ waitAndPing(const Ice::ObjectPrx& obj)
int nRetry = 0;
while(nRetry < 30)
{
- try
- {
- obj->ice_ping();
- return true;
- }
- catch(const Ice::LocalException&)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
+ try
+ {
+ obj->ice_ping();
+ return true;
+ }
+ catch(const Ice::LocalException&)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
}
return false;
}
@@ -225,7 +225,7 @@ createAdminSession(const Ice::LocatorPrx& locator, const string& replica)
string registryStr("TestIceGrid/Registry");
if(!replica.empty() && replica != "Master")
{
- registryStr += "-" + replica;
+ registryStr += "-" + replica;
}
Ice::ObjectPrx obj = locator->ice_getCommunicator()->stringToProxy(registryStr)->ice_locator(locator);
RegistryPrx registry = RegistryPrx::checkedCast(obj);
@@ -270,14 +270,14 @@ allTests(const Ice::CommunicatorPtr& comm)
instantiateServer(admin, "IceGridRegistry", params);
Ice::LocatorPrx masterLocator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12050"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12050"));
Ice::LocatorPrx slave1Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
Ice::LocatorPrx slave2Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave2:default -p 12052"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave2:default -p 12052"));
Ice::LocatorPrx replicatedLocator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator:default -p 12050:default -p 12051"));
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator:default -p 12050:default -p 12051"));
AdminPrx masterAdmin, slave1Admin, slave2Admin;
@@ -300,203 +300,203 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing replicated locator and query interface... " << flush;
{
- Ice::EndpointSeq endpoints;
- ObjectInfo info;
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- ObjectInfo info1 = slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
- test(info.type == Ice::Locator::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
- test(info.type == IceGrid::Query::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
- int nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
- test(info.type == Ice::Locator::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 3);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
- test(endpoints[2]->toString().find("-p 12052") != string::npos);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
- // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
- nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
- test(info.type == IceGrid::Query::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 3);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
- test(endpoints[2]->toString().find("-p 12052") != string::npos);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
- // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
- nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
- test(info.type == Ice::Locator::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
- nRetry = 0;
- while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++nRetry;
- }
- test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
- test(info.type == IceGrid::Query::ice_staticId());
- endpoints = info.proxy->ice_getEndpoints();
- test(endpoints.size() == 2);
- test(endpoints[0]->toString().find("-p 12050") != string::npos);
- test(endpoints[1]->toString().find("-p 12051") != string::npos);
-
- QueryPrx query;
- query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[0]->toString()));
- Ice::ObjectProxySeq objs = query->findAllObjectsByType("::IceGrid::Registry");
- test(objs.size() == 2);
- query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[1]->toString()));
- test(objs == query->findAllObjectsByType("::IceGrid::Registry"));
+ Ice::EndpointSeq endpoints;
+ ObjectInfo info;
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ ObjectInfo info1 = slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
+ test(info.type == Ice::Locator::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
+ test(info.type == IceGrid::Query::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
+ int nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
+ test(info.type == Ice::Locator::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 3);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+ test(endpoints[2]->toString().find("-p 12052") != string::npos);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
+ // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
+ nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave2Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
+ test(info.type == IceGrid::Query::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 3);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+ test(endpoints[2]->toString().find("-p 12052") != string::npos);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator"));
+ // We eventually need to wait here for the update of the replicated objects to propagate to the replica.
+ nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Locator")) == info);
+ test(info.type == Ice::Locator::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ info = masterAdmin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query"));
+ nRetry = 0;
+ while(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) != info && nRetry < 30)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++nRetry;
+ }
+ test(slave1Admin->getObjectInfo(comm->stringToIdentity("TestIceGrid/Query")) == info);
+ test(info.type == IceGrid::Query::ice_staticId());
+ endpoints = info.proxy->ice_getEndpoints();
+ test(endpoints.size() == 2);
+ test(endpoints[0]->toString().find("-p 12050") != string::npos);
+ test(endpoints[1]->toString().find("-p 12051") != string::npos);
+
+ QueryPrx query;
+ query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[0]->toString()));
+ Ice::ObjectProxySeq objs = query->findAllObjectsByType("::IceGrid::Registry");
+ test(objs.size() == 2);
+ query = QueryPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Query:" + endpoints[1]->toString()));
+ test(objs == query->findAllObjectsByType("::IceGrid::Registry"));
}
cout << "ok" << endl;
cout << "testing well-known IceGrid objects... " << flush;
{
- //
- // Test Registry well-known object (we have already tested
- // admin session creation for the creation of the admin
- // session above!)
- //
- RegistryPrx masterRegistry = RegistryPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/Registry")->ice_locator(replicatedLocator));
- RegistryPrx slave1Registry = RegistryPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/Registry-Slave1")->ice_locator(replicatedLocator));
-
- SessionPrx session = masterRegistry->createSession("dummy", "dummy");
- session->destroy();
- if(comm->getProperties()->getProperty("Ice.Default.Protocol") == "ssl")
- {
- session = masterRegistry->createSessionFromSecureConnection();
- session->destroy();
- }
- else
- {
- try
- {
- masterRegistry->createSessionFromSecureConnection();
- }
- catch(const PermissionDeniedException&)
- {
- }
- }
-
- try
- {
- slave1Registry->createSession("dummy", "");
- }
- catch(const PermissionDeniedException&)
- {
- }
- try
- {
- slave1Registry->createSessionFromSecureConnection();
- }
- catch(const PermissionDeniedException&)
- {
- }
-
- //
- // Test registry user-account mapper.
- //
- UserAccountMapperPrx masterMapper = UserAccountMapperPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper")->ice_locator(replicatedLocator));
- UserAccountMapperPrx slave1Mapper = UserAccountMapperPrx::checkedCast(
- comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper-Slave1")->ice_locator(replicatedLocator));
-
- test(masterMapper->getUserAccount("Dummy User Account1") == "dummy1");
- test(masterMapper->getUserAccount("Dummy User Account2") == "dummy2");
- test(slave1Mapper->getUserAccount("Dummy User Account1") == "dummy1");
- test(slave1Mapper->getUserAccount("Dummy User Account2") == "dummy2");
- try
- {
- masterMapper->getUserAccount("unknown");
- test(false);
- }
- catch(UserAccountNotFoundException&)
- {
- }
- try
- {
- slave1Mapper->getUserAccount("unknown");
- test(false);
- }
- catch(UserAccountNotFoundException&)
- {
- }
-
- //
- // Test SessionManager, SSLSessionManager,
- // AdminSessionManager, AdminSSLSessionManager
- //
- comm->stringToProxy("TestIceGrid/SessionManager")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/SSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
- try
- {
- comm->stringToProxy("TestIceGrid/SessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
- test(false);
- }
- catch(const Ice::NotRegisteredException&)
- {
- }
- try
- {
- comm->stringToProxy("TestIceGrid/SSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
- test(false);
- }
- catch(const Ice::NotRegisteredException&)
- {
- }
-
- comm->stringToProxy("TestIceGrid/AdminSessionManager")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/AdminSSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/AdminSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
- comm->stringToProxy("TestIceGrid/AdminSSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ //
+ // Test Registry well-known object (we have already tested
+ // admin session creation for the creation of the admin
+ // session above!)
+ //
+ RegistryPrx masterRegistry = RegistryPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/Registry")->ice_locator(replicatedLocator));
+ RegistryPrx slave1Registry = RegistryPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/Registry-Slave1")->ice_locator(replicatedLocator));
+
+ SessionPrx session = masterRegistry->createSession("dummy", "dummy");
+ session->destroy();
+ if(comm->getProperties()->getProperty("Ice.Default.Protocol") == "ssl")
+ {
+ session = masterRegistry->createSessionFromSecureConnection();
+ session->destroy();
+ }
+ else
+ {
+ try
+ {
+ masterRegistry->createSessionFromSecureConnection();
+ }
+ catch(const PermissionDeniedException&)
+ {
+ }
+ }
+
+ try
+ {
+ slave1Registry->createSession("dummy", "");
+ }
+ catch(const PermissionDeniedException&)
+ {
+ }
+ try
+ {
+ slave1Registry->createSessionFromSecureConnection();
+ }
+ catch(const PermissionDeniedException&)
+ {
+ }
+
+ //
+ // Test registry user-account mapper.
+ //
+ UserAccountMapperPrx masterMapper = UserAccountMapperPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper")->ice_locator(replicatedLocator));
+ UserAccountMapperPrx slave1Mapper = UserAccountMapperPrx::checkedCast(
+ comm->stringToProxy("TestIceGrid/RegistryUserAccountMapper-Slave1")->ice_locator(replicatedLocator));
+
+ test(masterMapper->getUserAccount("Dummy User Account1") == "dummy1");
+ test(masterMapper->getUserAccount("Dummy User Account2") == "dummy2");
+ test(slave1Mapper->getUserAccount("Dummy User Account1") == "dummy1");
+ test(slave1Mapper->getUserAccount("Dummy User Account2") == "dummy2");
+ try
+ {
+ masterMapper->getUserAccount("unknown");
+ test(false);
+ }
+ catch(UserAccountNotFoundException&)
+ {
+ }
+ try
+ {
+ slave1Mapper->getUserAccount("unknown");
+ test(false);
+ }
+ catch(UserAccountNotFoundException&)
+ {
+ }
+
+ //
+ // Test SessionManager, SSLSessionManager,
+ // AdminSessionManager, AdminSSLSessionManager
+ //
+ comm->stringToProxy("TestIceGrid/SessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/SSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ try
+ {
+ comm->stringToProxy("TestIceGrid/SessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ }
+ try
+ {
+ comm->stringToProxy("TestIceGrid/SSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ }
+
+ comm->stringToProxy("TestIceGrid/AdminSessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/AdminSSLSessionManager")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/AdminSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
+ comm->stringToProxy("TestIceGrid/AdminSSLSessionManager-Slave1")->ice_locator(replicatedLocator)->ice_ping();
}
cout << "ok" << endl;
@@ -511,257 +511,257 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing registry updates... " << flush;
{
- ApplicationDescriptor app;
- app.name = "TestApp";
- app.description = "added application";
-
- AdapterInfo adpt;
- adpt.id = "TestAdpt";
- adpt.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
-
- ObjectInfo obj;
- obj.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
- obj.type = "::Hello";
-
- //
- // We use the locator registry from Slave1 to ensure that the
- // forwarding to the master work (the slave locator registry
- // forwards everything to the master).
- //
- Ice::LocatorRegistryPrx locatorRegistry = slave1Locator->getRegistry();
-
- //
- // Test addition of application, adapter, object.
- //
-
- try
- {
- slave1Admin->addApplication(app);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->addApplication(app);
-
- locatorRegistry->setAdapterDirectProxy(adpt.id, adpt.proxy);
-
- try
- {
- slave1Admin->addObjectWithType(obj.proxy, obj.type);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database
- }
- masterAdmin->addObjectWithType(obj.proxy, obj.type);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "added application");
- test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
- test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
-
- test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
-
- test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- //
- // Test sync of application.
- //
-
- app.description = "updated1 application";
- try
- {
- slave1Admin->syncApplication(app);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->syncApplication(app);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
- test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
- test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- //
- // Test update of application, adapter, object.
- //
-
- ApplicationUpdateDescriptor appUpdate;
- appUpdate.name = "TestApp";
- appUpdate.description = new BoxedString("updated2 application");
- try
- {
- slave1Admin->updateApplication(appUpdate);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->updateApplication(appUpdate);
-
- adpt.replicaGroupId = "TestReplicaGroup";
- locatorRegistry->setReplicatedAdapterDirectProxy(adpt.id, adpt.replicaGroupId, adpt.proxy);
-
- obj.proxy = comm->stringToProxy("dummy:tcp -p 12346 -h 127.0.0.1");
- try
- {
- slave1Admin->updateObject(obj.proxy);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database
- }
- masterAdmin->updateObject(obj.proxy);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
- test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
- test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
-
- test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
- test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
-
- test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
- test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- //
- // Test removal of application, adapter and object.
-
- try
- {
- slave1Admin->removeApplication("TestApp");
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->removeApplication("TestApp");
-
- try
- {
- slave1Admin->removeAdapter("TestAdpt");
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->removeAdapter("TestAdpt");
- try
- {
- slave1Admin->removeObject(obj.proxy->ice_getIdentity());
- }
- catch(const DeploymentException&)
- {
- // Slave can't modify the database.
- }
- masterAdmin->removeObject(obj.proxy->ice_getIdentity());
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- try
- {
- masterAdmin->getApplicationInfo("TestApp");
- test(false);
- }
- catch(const ApplicationNotExistException&)
- {
- }
- try
- {
- slave1Admin->getApplicationInfo("TestApp");
- test(false);
- }
- catch(const ApplicationNotExistException&)
- {
- }
- try
- {
- slave2Admin->getApplicationInfo("TestApp");
- test(false);
- }
- catch(const ApplicationNotExistException&)
- {
- }
- try
- {
- masterAdmin->getAdapterInfo("TestAdpt");
- test(false);
- }
- catch(const AdapterNotExistException&)
- {
- }
- try
- {
- slave1Admin->getAdapterInfo("TestAdpt");
- test(false);
- }
- catch(const AdapterNotExistException&)
- {
- }
- try
- {
- slave2Admin->getAdapterInfo("TestAdpt");
- test(false);
- }
- catch(const AdapterNotExistException&)
- {
- }
- try
- {
- masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity());
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
- try
- {
- slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity());
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
- try
- {
- slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity());
- test(false);
- }
- catch(const ObjectNotRegisteredException&)
- {
- }
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
+ ApplicationDescriptor app;
+ app.name = "TestApp";
+ app.description = "added application";
+
+ AdapterInfo adpt;
+ adpt.id = "TestAdpt";
+ adpt.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
+
+ ObjectInfo obj;
+ obj.proxy = comm->stringToProxy("dummy:tcp -p 12345 -h 127.0.0.1");
+ obj.type = "::Hello";
+
+ //
+ // We use the locator registry from Slave1 to ensure that the
+ // forwarding to the master work (the slave locator registry
+ // forwards everything to the master).
+ //
+ Ice::LocatorRegistryPrx locatorRegistry = slave1Locator->getRegistry();
+
+ //
+ // Test addition of application, adapter, object.
+ //
+
+ try
+ {
+ slave1Admin->addApplication(app);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->addApplication(app);
+
+ locatorRegistry->setAdapterDirectProxy(adpt.id, adpt.proxy);
+
+ try
+ {
+ slave1Admin->addObjectWithType(obj.proxy, obj.type);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database
+ }
+ masterAdmin->addObjectWithType(obj.proxy, obj.type);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "added application");
+ test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
+ test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "added application");
+
+ test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+
+ test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ //
+ // Test sync of application.
+ //
+
+ app.description = "updated1 application";
+ try
+ {
+ slave1Admin->syncApplication(app);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->syncApplication(app);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
+ test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
+ test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated1 application");
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ //
+ // Test update of application, adapter, object.
+ //
+
+ ApplicationUpdateDescriptor appUpdate;
+ appUpdate.name = "TestApp";
+ appUpdate.description = new BoxedString("updated2 application");
+ try
+ {
+ slave1Admin->updateApplication(appUpdate);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->updateApplication(appUpdate);
+
+ adpt.replicaGroupId = "TestReplicaGroup";
+ locatorRegistry->setReplicatedAdapterDirectProxy(adpt.id, adpt.replicaGroupId, adpt.proxy);
+
+ obj.proxy = comm->stringToProxy("dummy:tcp -p 12346 -h 127.0.0.1");
+ try
+ {
+ slave1Admin->updateObject(obj.proxy);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database
+ }
+ masterAdmin->updateObject(obj.proxy);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ test(masterAdmin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
+ test(slave1Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
+ test(slave2Admin->getApplicationInfo("TestApp").descriptor.description == "updated2 application");
+
+ test(masterAdmin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave1Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+ test(slave2Admin->getAdapterInfo("TestAdpt")[0] == adpt);
+
+ test(masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+ test(slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity()) == obj);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ //
+ // Test removal of application, adapter and object.
+
+ try
+ {
+ slave1Admin->removeApplication("TestApp");
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->removeApplication("TestApp");
+
+ try
+ {
+ slave1Admin->removeAdapter("TestAdpt");
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->removeAdapter("TestAdpt");
+ try
+ {
+ slave1Admin->removeObject(obj.proxy->ice_getIdentity());
+ }
+ catch(const DeploymentException&)
+ {
+ // Slave can't modify the database.
+ }
+ masterAdmin->removeObject(obj.proxy->ice_getIdentity());
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ try
+ {
+ masterAdmin->getApplicationInfo("TestApp");
+ test(false);
+ }
+ catch(const ApplicationNotExistException&)
+ {
+ }
+ try
+ {
+ slave1Admin->getApplicationInfo("TestApp");
+ test(false);
+ }
+ catch(const ApplicationNotExistException&)
+ {
+ }
+ try
+ {
+ slave2Admin->getApplicationInfo("TestApp");
+ test(false);
+ }
+ catch(const ApplicationNotExistException&)
+ {
+ }
+ try
+ {
+ masterAdmin->getAdapterInfo("TestAdpt");
+ test(false);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ try
+ {
+ slave1Admin->getAdapterInfo("TestAdpt");
+ test(false);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ try
+ {
+ slave2Admin->getAdapterInfo("TestAdpt");
+ test(false);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ try
+ {
+ masterAdmin->getObjectInfo(obj.proxy->ice_getIdentity());
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+ try
+ {
+ slave1Admin->getObjectInfo(obj.proxy->ice_getIdentity());
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+ try
+ {
+ slave2Admin->getObjectInfo(obj.proxy->ice_getIdentity());
+ test(false);
+ }
+ catch(const ObjectNotRegisteredException&)
+ {
+ }
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
}
cout << "ok" << endl;
@@ -779,12 +779,12 @@ allTests(const Ice::CommunicatorPtr& comm)
app.nodes["Node1"].description = "dummy node";
try
{
- masterAdmin->addApplication(app);
+ masterAdmin->addApplication(app);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- test(false);
+ cerr << ex << endl;
+ test(false);
}
//
@@ -800,104 +800,104 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing node session establishment... " << flush;
{
- admin->startServer("Node1");
-
- waitForNodeState(masterAdmin, "Node1", true);
- waitForNodeState(slave1Admin, "Node1", true);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- waitForNodeState(slave2Admin, "Node1", true); // Node should connect.
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- try
- {
- test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- try
- {
- test(slave2Admin->pingNode("Node1")); // Node should be re-connected even if the master is down.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- try
- {
- test(masterAdmin->pingNode("Node1")); // Node should be re-connected.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- try
- {
- test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- try
- {
- test(masterAdmin->pingNode("Node1"));
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- try
- {
- test(slave2Admin->pingNode("Node1"));
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- try
- {
- test(slave2Admin->pingNode("Node1"));
- }
- catch(const NodeNotExistException&)
- {
- test(false);
- }
+ admin->startServer("Node1");
+
+ waitForNodeState(masterAdmin, "Node1", true);
+ waitForNodeState(slave1Admin, "Node1", true);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ waitForNodeState(slave2Admin, "Node1", true); // Node should connect.
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ try
+ {
+ test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ try
+ {
+ test(slave2Admin->pingNode("Node1")); // Node should be re-connected even if the master is down.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ try
+ {
+ test(masterAdmin->pingNode("Node1")); // Node should be re-connected.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ try
+ {
+ test(slave1Admin->pingNode("Node1")); // Node should be re-connected.
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ test(masterAdmin->pingNode("Node1"));
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ test(slave2Admin->pingNode("Node1"));
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ try
+ {
+ test(slave2Admin->pingNode("Node1"));
+ }
+ catch(const NodeNotExistException&)
+ {
+ test(false);
+ }
}
cout << "ok" << endl;
@@ -906,267 +906,267 @@ allTests(const Ice::CommunicatorPtr& comm)
//
cout << "testing out-of-date replicas... " << flush;
{
- ApplicationDescriptor app;
- app.name = "TestApp";
- app.description = "added application";
-
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "Server";
- server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
- server->pwd = ".";
- server->activation = "on-demand";
- AdapterDescriptor adapter;
- adapter.name = "TestAdapter";
- adapter.id = "TestAdapter.Server";
- adapter.registerProcess = true;
- PropertyDescriptor property;
- property.name = "Ice.OA.TestAdapter.Endpoints";
- property.value = "default";
- server->propertySet.properties.push_back(property);
- property.name = "Identity";
- property.value = "test";
- server->propertySet.properties.push_back(property);
- ObjectDescriptor object;
- object.id = comm->stringToIdentity("test");
- object.type = "::Test::TestIntf";
- adapter.objects.push_back(object);
- server->adapters.push_back(adapter);
- app.nodes["Node1"].servers.push_back(server);
-
- masterAdmin->addApplication(app);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- masterAdmin->stopServer("Server");
-
- //
- // Shutdown Slave2 and update application.
- //
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- ApplicationUpdateDescriptor update;
- update.name = "TestApp";
- NodeUpdateDescriptor node;
- node.name = "Node1";
- node.servers.push_back(server);
- update.nodes.push_back(node);
- property.name = "Dummy";
- property.value = "val";
- server->propertySet.properties.push_back(property);
- masterAdmin->updateApplication(update);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
-
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
- try
- {
- slave2Admin->startServer("Server");
- test(false);
- }
- catch(const DeploymentException&)
- {
- }
- try
- {
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- test(false);
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- //
- // Shutdown Node1 and update the application, then, shutdown
- // the master.
- //
- slave1Admin->shutdownNode("Node1");
- waitForServerState(admin, "Node1", false);
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
-
- property.name = "Dummy2";
- property.value = "val";
- server->propertySet.properties.push_back(property);
- masterAdmin->updateApplication(update);
-
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
-
- //
- // Restart Node1 and Slave2, Slave2 still has the old version
- // of the server so it should be able to load it. Slave1 has
- // a more recent version, so it can't load it.
- //
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- admin->startServer("Node1");
-
- waitForNodeState(slave2Admin, "Node1", true);
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- try
- {
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- }
- catch(const Ice::NoEndpointException&)
- {
- }
-
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- slave2Admin->stopServer("Server");
-
- //
- // Start the master. This will re-load the server on the node
- // and update the out-of-date replicas.
- //
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
- admin->startServer("Slave1");
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- slave2Admin->shutdownNode("Node1");
- waitForServerState(admin, "Node1", false);
- admin->startServer("Node1");
-
- slave2Admin->shutdown();
- waitForServerState(admin, "Slave2", false);
- admin->startServer("Slave2");
- slave2Admin = createAdminSession(slave2Locator, "Slave2");
-
- waitForNodeState(masterAdmin, "Node1", true);
- waitForNodeState(slave1Admin, "Node1", true);
- waitForNodeState(slave2Admin, "Node1", true);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- slave2Admin->stopServer("Server");
-
- masterAdmin->removeApplication("TestApp");
+ ApplicationDescriptor app;
+ app.name = "TestApp";
+ app.description = "added application";
+
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "Server";
+ server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
+ server->pwd = ".";
+ server->activation = "on-demand";
+ AdapterDescriptor adapter;
+ adapter.name = "TestAdapter";
+ adapter.id = "TestAdapter.Server";
+ adapter.registerProcess = true;
+ PropertyDescriptor property;
+ property.name = "Ice.OA.TestAdapter.Endpoints";
+ property.value = "default";
+ server->propertySet.properties.push_back(property);
+ property.name = "Identity";
+ property.value = "test";
+ server->propertySet.properties.push_back(property);
+ ObjectDescriptor object;
+ object.id = comm->stringToIdentity("test");
+ object.type = "::Test::TestIntf";
+ adapter.objects.push_back(object);
+ server->adapters.push_back(adapter);
+ app.nodes["Node1"].servers.push_back(server);
+
+ masterAdmin->addApplication(app);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ masterAdmin->stopServer("Server");
+
+ //
+ // Shutdown Slave2 and update application.
+ //
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ ApplicationUpdateDescriptor update;
+ update.name = "TestApp";
+ NodeUpdateDescriptor node;
+ node.name = "Node1";
+ node.servers.push_back(server);
+ update.nodes.push_back(node);
+ property.name = "Dummy";
+ property.value = "val";
+ server->propertySet.properties.push_back(property);
+ masterAdmin->updateApplication(update);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+ try
+ {
+ slave2Admin->startServer("Server");
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ }
+ try
+ {
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ //
+ // Shutdown Node1 and update the application, then, shutdown
+ // the master.
+ //
+ slave1Admin->shutdownNode("Node1");
+ waitForServerState(admin, "Node1", false);
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+
+ property.name = "Dummy2";
+ property.value = "val";
+ server->propertySet.properties.push_back(property);
+ masterAdmin->updateApplication(update);
+
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+
+ //
+ // Restart Node1 and Slave2, Slave2 still has the old version
+ // of the server so it should be able to load it. Slave1 has
+ // a more recent version, so it can't load it.
+ //
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ admin->startServer("Node1");
+
+ waitForNodeState(slave2Admin, "Node1", true);
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ try
+ {
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ }
+ catch(const Ice::NoEndpointException&)
+ {
+ }
+
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ slave2Admin->stopServer("Server");
+
+ //
+ // Start the master. This will re-load the server on the node
+ // and update the out-of-date replicas.
+ //
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+ admin->startServer("Slave1");
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ slave2Admin->shutdownNode("Node1");
+ waitForServerState(admin, "Node1", false);
+ admin->startServer("Node1");
+
+ slave2Admin->shutdown();
+ waitForServerState(admin, "Slave2", false);
+ admin->startServer("Slave2");
+ slave2Admin = createAdminSession(slave2Locator, "Slave2");
+
+ waitForNodeState(masterAdmin, "Node1", true);
+ waitForNodeState(slave1Admin, "Node1", true);
+ waitForNodeState(slave2Admin, "Node1", true);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ slave2Admin->stopServer("Server");
+
+ masterAdmin->removeApplication("TestApp");
}
cout << "ok" << endl;
cout << "testing master upgrade... " << flush;
{
- ApplicationDescriptor app;
- app.name = "TestApp";
- app.description = "added application";
-
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "Server";
- server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
- server->pwd = ".";
- server->activation = "on-demand";
- AdapterDescriptor adapter;
- adapter.name = "TestAdapter";
- adapter.id = "TestAdapter.Server";
- adapter.registerProcess = true;
- PropertyDescriptor property;
- property.name = "Ice.OA.TestAdapter.Endpoints";
- property.value = "default";
- server->propertySet.properties.push_back(property);
- property.name = "Identity";
- property.value = "test";
- server->propertySet.properties.push_back(property);
- ObjectDescriptor object;
- object.id = comm->stringToIdentity("test");
- object.type = "::Test::TestIntf";
- adapter.objects.push_back(object);
- server->adapters.push_back(adapter);
- app.nodes["Node1"].servers.push_back(server);
-
- masterAdmin->addApplication(app);
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- masterAdmin->stopServer("Server");
-
- //
- // Shutdown the Master, update Slave1 to be the Master.
- //
- masterAdmin->shutdown();
- waitForServerState(admin, "Master", false);
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- params["id"] = "Slave1";
- params["port"] = "12051";
- params["replicaName"] = "Master";
- instantiateServer(admin, "IceGridRegistry", params);
-
- admin->startServer("Slave1");
- slave1Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12051"));
- slave1Admin = createAdminSession(slave1Locator, "");
-
- ApplicationUpdateDescriptor update;
- update.name = "TestApp";
- NodeUpdateDescriptor node;
- node.name = "Node1";
- node.servers.push_back(server);
- update.nodes.push_back(node);
- property.name = "Dummy";
- property.value = "val";
- server->propertySet.properties.push_back(property);
- slave1Admin->updateApplication(update);
-
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- slave1Admin->shutdown();
- waitForServerState(admin, "Slave1", false);
-
- params["id"] = "Slave1";
- params["replicaName"] = "Slave1";
- params["port"] = "12051";
- instantiateServer(admin, "IceGridRegistry", params);
-
- admin->startServer("Master");
- masterAdmin = createAdminSession(masterLocator, "");
-
- admin->startServer("Slave1");
- slave1Locator =
- Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
- slave1Admin = createAdminSession(slave1Locator, "Slave1");
-
- comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
- comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
-
- masterAdmin->stopServer("Server");
-
- masterAdmin->removeApplication("TestApp");
+ ApplicationDescriptor app;
+ app.name = "TestApp";
+ app.description = "added application";
+
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "Server";
+ server->exe = comm->getProperties()->getProperty("TestDir") + "/server";
+ server->pwd = ".";
+ server->activation = "on-demand";
+ AdapterDescriptor adapter;
+ adapter.name = "TestAdapter";
+ adapter.id = "TestAdapter.Server";
+ adapter.registerProcess = true;
+ PropertyDescriptor property;
+ property.name = "Ice.OA.TestAdapter.Endpoints";
+ property.value = "default";
+ server->propertySet.properties.push_back(property);
+ property.name = "Identity";
+ property.value = "test";
+ server->propertySet.properties.push_back(property);
+ ObjectDescriptor object;
+ object.id = comm->stringToIdentity("test");
+ object.type = "::Test::TestIntf";
+ adapter.objects.push_back(object);
+ server->adapters.push_back(adapter);
+ app.nodes["Node1"].servers.push_back(server);
+
+ masterAdmin->addApplication(app);
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ masterAdmin->stopServer("Server");
+
+ //
+ // Shutdown the Master, update Slave1 to be the Master.
+ //
+ masterAdmin->shutdown();
+ waitForServerState(admin, "Master", false);
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ params["id"] = "Slave1";
+ params["port"] = "12051";
+ params["replicaName"] = "Master";
+ instantiateServer(admin, "IceGridRegistry", params);
+
+ admin->startServer("Slave1");
+ slave1Locator =
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Master:default -p 12051"));
+ slave1Admin = createAdminSession(slave1Locator, "");
+
+ ApplicationUpdateDescriptor update;
+ update.name = "TestApp";
+ NodeUpdateDescriptor node;
+ node.name = "Node1";
+ node.servers.push_back(server);
+ update.nodes.push_back(node);
+ property.name = "Dummy";
+ property.value = "val";
+ server->propertySet.properties.push_back(property);
+ slave1Admin->updateApplication(update);
+
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ slave1Admin->shutdown();
+ waitForServerState(admin, "Slave1", false);
+
+ params["id"] = "Slave1";
+ params["replicaName"] = "Slave1";
+ params["port"] = "12051";
+ instantiateServer(admin, "IceGridRegistry", params);
+
+ admin->startServer("Master");
+ masterAdmin = createAdminSession(masterLocator, "");
+
+ admin->startServer("Slave1");
+ slave1Locator =
+ Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("TestIceGrid/Locator-Slave1:default -p 12051"));
+ slave1Admin = createAdminSession(slave1Locator, "Slave1");
+
+ comm->stringToProxy("test")->ice_locator(masterLocator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave1Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+ comm->stringToProxy("test")->ice_locator(slave2Locator)->ice_locatorCacheTimeout(0)->ice_ping();
+
+ masterAdmin->stopServer("Server");
+
+ masterAdmin->removeApplication("TestApp");
}
cout << "ok" << endl;
diff --git a/cpp/test/IceGrid/replication/Client.cpp b/cpp/test/IceGrid/replication/Client.cpp
index cf34f395e60..0d5fbf4b5bd 100644
--- a/cpp/test/IceGrid/replication/Client.cpp
+++ b/cpp/test/IceGrid/replication/Client.cpp
@@ -29,27 +29,27 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp
index 73cb564752f..75b2e6b6031 100644
--- a/cpp/test/IceGrid/session/AllTests.cpp
+++ b/cpp/test/IceGrid/session/AllTests.cpp
@@ -34,51 +34,51 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const Ice::LoggerPtr& logger, const IceUtil::Time& timeout) :
- _logger(logger),
- _timeout(timeout),
- _terminated(false)
+ _logger(logger),
+ _timeout(timeout),
+ _terminated(false)
{
}
virtual void
run()
{
- Lock sync(*this);
- while(!_terminated)
- {
- timedWait(_timeout);
- if(!_terminated)
- {
- vector<AdminSessionPrx>::iterator p = _sessions.begin();
- while(p != _sessions.end())
- {
- try
- {
- (*p)->keepAlive();
- ++p;
- }
- catch(const Ice::Exception&)
- {
- p = _sessions.erase(p);
- }
- }
- }
- }
+ Lock sync(*this);
+ while(!_terminated)
+ {
+ timedWait(_timeout);
+ if(!_terminated)
+ {
+ vector<AdminSessionPrx>::iterator p = _sessions.begin();
+ while(p != _sessions.end())
+ {
+ try
+ {
+ (*p)->keepAlive();
+ ++p;
+ }
+ catch(const Ice::Exception&)
+ {
+ p = _sessions.erase(p);
+ }
+ }
+ }
+ }
}
void
add(const AdminSessionPrx& session)
{
- Lock sync(*this);
- _sessions.push_back(session);
+ Lock sync(*this);
+ _sessions.push_back(session);
}
void
terminate()
{
- Lock sync(*this);
- _terminated = true;
- notify();
+ Lock sync(*this);
+ _terminated = true;
+ notify();
}
private:
@@ -96,59 +96,59 @@ public:
ObserverBase(const string& name) : _name(name), _updated(0)
{
- _observers.insert(make_pair(name, this));
+ _observers.insert(make_pair(name, this));
}
virtual ~ObserverBase()
{
- _observers.erase(_name);
+ _observers.erase(_name);
}
static void
printStack()
{
- map<string, ObserverBase*>::const_iterator p;
- for(p = _observers.begin(); p != _observers.end(); ++p)
- {
- vector<string>::const_iterator q = p->second->_stack.begin();
- if(p->second->_stack.size() > 10)
- {
- q = p->second->_stack.begin() + p->second->_stack.size() - 10;
- }
- cerr << "Last 10 updates of observer `" << p->second->_name << "':" << endl;
- for(; q != p->second->_stack.end(); ++q)
- {
- cerr << " " << *q << endl;
- }
- p->second->_stack.clear();
- }
+ map<string, ObserverBase*>::const_iterator p;
+ for(p = _observers.begin(); p != _observers.end(); ++p)
+ {
+ vector<string>::const_iterator q = p->second->_stack.begin();
+ if(p->second->_stack.size() > 10)
+ {
+ q = p->second->_stack.begin() + p->second->_stack.size() - 10;
+ }
+ cerr << "Last 10 updates of observer `" << p->second->_name << "':" << endl;
+ for(; q != p->second->_stack.end(); ++q)
+ {
+ cerr << " " << *q << endl;
+ }
+ p->second->_stack.clear();
+ }
}
void
trace(const string& msg)
{
- _stack.push_back(msg);
+ _stack.push_back(msg);
}
void
waitForUpdate(const char* file, int line)
{
- Lock sync(*this);
-
- ostringstream os;
- os << "wait for update from line " << line;
- trace(os.str());
-
- while(!_updated)
- {
- if(!timedWait(IceUtil::Time::seconds(10)))
- {
- cerr << "timeout: " << file << ":" << line << endl;
- ObserverBase::printStack();
- test(false); // Timeout
- }
- }
- --_updated;
+ Lock sync(*this);
+
+ ostringstream os;
+ os << "wait for update from line " << line;
+ trace(os.str());
+
+ while(!_updated)
+ {
+ if(!timedWait(IceUtil::Time::seconds(10)))
+ {
+ cerr << "timeout: " << file << ":" << line << endl;
+ ObserverBase::printStack();
+ test(false); // Timeout
+ }
+ }
+ --_updated;
}
protected:
@@ -156,9 +156,9 @@ protected:
void
updated(const string& update)
{
- trace(update);
- ++_updated;
- notifyAll();
+ trace(update);
+ ++_updated;
+ notifyAll();
}
string _name;
@@ -172,54 +172,54 @@ class ApplicationObserverI : public ApplicationObserver, public ObserverBase
{
public:
- ApplicationObserverI(const string& name) : ObserverBase(name)
+ ApplicationObserverI(const string& name) : ObserverBase(name)
{
}
virtual void
applicationInit(int serial, const ApplicationInfoSeq& apps, const Ice::Current&)
{
- Lock sync(*this);
- for(ApplicationInfoSeq::const_iterator p = apps.begin(); p != apps.end(); ++p)
- {
- if(p->descriptor.name != "Test") // Ignore the test application from application.xml!
- {
- this->applications.insert(make_pair(p->descriptor.name, *p));
- }
- }
- updated(updateSerial(serial, "init update"));
+ Lock sync(*this);
+ for(ApplicationInfoSeq::const_iterator p = apps.begin(); p != apps.end(); ++p)
+ {
+ if(p->descriptor.name != "Test") // Ignore the test application from application.xml!
+ {
+ this->applications.insert(make_pair(p->descriptor.name, *p));
+ }
+ }
+ updated(updateSerial(serial, "init update"));
}
virtual void
applicationAdded(int serial, const ApplicationInfo& app, const Ice::Current&)
{
- Lock sync(*this);
- this->applications.insert(make_pair(app.descriptor.name, app));
- updated(updateSerial(serial, "application added `" + app.descriptor.name + "'"));
+ Lock sync(*this);
+ this->applications.insert(make_pair(app.descriptor.name, app));
+ updated(updateSerial(serial, "application added `" + app.descriptor.name + "'"));
}
virtual void
applicationRemoved(int serial, const std::string& name, const Ice::Current&)
{
- Lock sync(*this);
- this->applications.erase(name);
- updated(updateSerial(serial, "application removed `" + name + "'"));
+ Lock sync(*this);
+ this->applications.erase(name);
+ updated(updateSerial(serial, "application removed `" + name + "'"));
}
virtual void
applicationUpdated(int serial, const ApplicationUpdateInfo& info, const Ice::Current&)
{
- Lock sync(*this);
- const ApplicationUpdateDescriptor& desc = info.descriptor;
- for(Ice::StringSeq::const_iterator q = desc.removeVariables.begin(); q != desc.removeVariables.end(); ++q)
- {
- this->applications[desc.name].descriptor.variables.erase(*q);
- }
- for(map<string, string>::const_iterator p = desc.variables.begin(); p != desc.variables.end(); ++p)
- {
- this->applications[desc.name].descriptor.variables[p->first] = p->second;
- }
- updated(updateSerial(serial, "application updated `" + desc.name + "'"));
+ Lock sync(*this);
+ const ApplicationUpdateDescriptor& desc = info.descriptor;
+ for(Ice::StringSeq::const_iterator q = desc.removeVariables.begin(); q != desc.removeVariables.end(); ++q)
+ {
+ this->applications[desc.name].descriptor.variables.erase(*q);
+ }
+ for(map<string, string>::const_iterator p = desc.variables.begin(); p != desc.variables.end(); ++p)
+ {
+ this->applications[desc.name].descriptor.variables[p->first] = p->second;
+ }
+ updated(updateSerial(serial, "application updated `" + desc.name + "'"));
}
int serial;
@@ -230,10 +230,10 @@ private:
string
updateSerial(int serial, const string& update)
{
- this->serial = serial;
- ostringstream os;
- os << update << " (serial = " << serial << ")";
- return os.str();
+ this->serial = serial;
+ ostringstream os;
+ os << update << " (serial = " << serial << ")";
+ return os.str();
}
};
typedef IceUtil::Handle<ApplicationObserverI> ApplicationObserverIPtr;
@@ -249,36 +249,36 @@ public:
virtual void
adapterInit(const AdapterInfoSeq& adapters, const Ice::Current&)
{
- Lock sync(*this);
- for(AdapterInfoSeq::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
- {
- this->adapters.insert(make_pair(q->id, *q));
- }
- updated(updateSerial(0, "init update"));
+ Lock sync(*this);
+ for(AdapterInfoSeq::const_iterator q = adapters.begin(); q != adapters.end(); ++q)
+ {
+ this->adapters.insert(make_pair(q->id, *q));
+ }
+ updated(updateSerial(0, "init update"));
}
void
adapterAdded(const AdapterInfo& info, const Ice::Current&)
{
- Lock sync(*this);
- this->adapters.insert(make_pair(info.id, info));
- updated(updateSerial(0, "adapter added `" + info.id + "'"));
+ Lock sync(*this);
+ this->adapters.insert(make_pair(info.id, info));
+ updated(updateSerial(0, "adapter added `" + info.id + "'"));
}
void
adapterUpdated(const AdapterInfo& info, const Ice::Current&)
{
- Lock sync(*this);
- this->adapters[info.id] = info;
- updated(updateSerial(0, "adapter updated `" + info.id + "'"));
+ Lock sync(*this);
+ this->adapters[info.id] = info;
+ updated(updateSerial(0, "adapter updated `" + info.id + "'"));
}
void
adapterRemoved(const string& id, const Ice::Current&)
{
- Lock sync(*this);
- this->adapters.erase(id);
- updated(updateSerial(0, "adapter removed `" + id + "'"));
+ Lock sync(*this);
+ this->adapters.erase(id);
+ updated(updateSerial(0, "adapter removed `" + id + "'"));
}
int serial;
@@ -289,10 +289,10 @@ private:
string
updateSerial(int serial, const string& update)
{
- this->serial = serial;
- ostringstream os;
- os << update << " (serial = " << serial << ")";
- return os.str();
+ this->serial = serial;
+ ostringstream os;
+ os << update << " (serial = " << serial << ")";
+ return os.str();
}
};
typedef IceUtil::Handle<AdapterObserverI> AdapterObserverIPtr;
@@ -308,37 +308,37 @@ public:
virtual void
objectInit(const ObjectInfoSeq& objects, const Ice::Current&)
{
- Lock sync(*this);
- for(ObjectInfoSeq::const_iterator r = objects.begin(); r != objects.end(); ++r)
- {
- this->objects.insert(make_pair(r->proxy->ice_getIdentity(), *r));
- }
- updated(updateSerial(0, "init update"));
+ Lock sync(*this);
+ for(ObjectInfoSeq::const_iterator r = objects.begin(); r != objects.end(); ++r)
+ {
+ this->objects.insert(make_pair(r->proxy->ice_getIdentity(), *r));
+ }
+ updated(updateSerial(0, "init update"));
}
void
objectAdded(const ObjectInfo& info, const Ice::Current&)
{
- Lock sync(*this);
- this->objects.insert(make_pair(info.proxy->ice_getIdentity(), info));
- updated(updateSerial(0, "object added `" + info.proxy->ice_toString() + "'"));
+ Lock sync(*this);
+ this->objects.insert(make_pair(info.proxy->ice_getIdentity(), info));
+ updated(updateSerial(0, "object added `" + info.proxy->ice_toString() + "'"));
}
void
objectUpdated(const ObjectInfo& info, const Ice::Current&)
{
- Lock sync(*this);
- this->objects[info.proxy->ice_getIdentity()] = info;
- updated(updateSerial(0, "object updated `" + info.proxy->ice_toString() + "'"));
+ Lock sync(*this);
+ this->objects[info.proxy->ice_getIdentity()] = info;
+ updated(updateSerial(0, "object updated `" + info.proxy->ice_toString() + "'"));
}
void
objectRemoved(const Ice::Identity& id, const Ice::Current& current)
{
- Lock sync(*this);
- this->objects.erase(id);
- updated(updateSerial(0, "object removed `" +
- current.adapter->getCommunicator()->identityToString(id) + "'"));
+ Lock sync(*this);
+ this->objects.erase(id);
+ updated(updateSerial(0, "object removed `" +
+ current.adapter->getCommunicator()->identityToString(id) + "'"));
}
int serial;
@@ -349,10 +349,10 @@ private:
string
updateSerial(int serial, const string& update)
{
- this->serial = serial;
- ostringstream os;
- os << update << " (serial = " << serial << ")";
- return os.str();
+ this->serial = serial;
+ ostringstream os;
+ os << update << " (serial = " << serial << ")";
+ return os.str();
}
};
typedef IceUtil::Handle<ObjectObserverI> ObjectObserverIPtr;
@@ -368,136 +368,136 @@ public:
virtual void
nodeInit(const NodeDynamicInfoSeq& info, const Ice::Current& current)
{
- Lock sync(*this);
- for(NodeDynamicInfoSeq::const_iterator p = info.begin(); p != info.end(); ++p)
- {
- this->nodes[p->info.name] = filter(*p);
- }
- updated("init");
+ Lock sync(*this);
+ for(NodeDynamicInfoSeq::const_iterator p = info.begin(); p != info.end(); ++p)
+ {
+ this->nodes[p->info.name] = filter(*p);
+ }
+ updated("init");
}
virtual void
nodeUp(const NodeDynamicInfo& info, const Ice::Current& current)
{
- Lock sync(*this);
- this->nodes[info.info.name] = filter(info);
- updated("node `" + info.info.name + "' up");
+ Lock sync(*this);
+ this->nodes[info.info.name] = filter(info);
+ updated("node `" + info.info.name + "' up");
}
virtual void
nodeDown(const string& name, const Ice::Current& current)
{
- Lock sync(*this);
- this->nodes.erase(name);
- updated("node `" + name + "' down");
+ Lock sync(*this);
+ this->nodes.erase(name);
+ updated("node `" + name + "' down");
}
virtual void
updateServer(const string& node, const ServerDynamicInfo& info, const Ice::Current& current)
{
- if(info.id == "Glacier2" || info.id == "Glacier2Admin" || info.id == "PermissionsVerifierServer")
- {
- return;
- }
-
- Lock sync(*this);
- //cerr << node << " " << info.id << " " << info.state << " " << info.pid << endl;
- ServerDynamicInfoSeq& servers = this->nodes[node].servers;
- ServerDynamicInfoSeq::iterator p;
- for(p = servers.begin(); p != servers.end(); ++p)
- {
- if(p->id == info.id)
- {
- if(info.state == Destroyed)
- {
- servers.erase(p);
- }
- else
- {
- *p = info;
- }
- break;
- }
- }
- if(info.state != Destroyed && p == servers.end())
- {
- servers.push_back(info);
- }
-
- ostringstream os;
- os << "server `" << info.id << "' on node `" << node << "' state updated: " << info.state
- << " (pid = " << info.pid << ")";
- updated(os.str());
+ if(info.id == "Glacier2" || info.id == "Glacier2Admin" || info.id == "PermissionsVerifierServer")
+ {
+ return;
+ }
+
+ Lock sync(*this);
+ //cerr << node << " " << info.id << " " << info.state << " " << info.pid << endl;
+ ServerDynamicInfoSeq& servers = this->nodes[node].servers;
+ ServerDynamicInfoSeq::iterator p;
+ for(p = servers.begin(); p != servers.end(); ++p)
+ {
+ if(p->id == info.id)
+ {
+ if(info.state == Destroyed)
+ {
+ servers.erase(p);
+ }
+ else
+ {
+ *p = info;
+ }
+ break;
+ }
+ }
+ if(info.state != Destroyed && p == servers.end())
+ {
+ servers.push_back(info);
+ }
+
+ ostringstream os;
+ os << "server `" << info.id << "' on node `" << node << "' state updated: " << info.state
+ << " (pid = " << info.pid << ")";
+ updated(os.str());
}
virtual void
updateAdapter(const string& node, const AdapterDynamicInfo& info, const Ice::Current& current)
{
- if(info.id == "PermissionsVerifierServer.Server")
- {
- return;
- }
-
- Lock sync(*this);
- //cerr << "update adapter: " << info.id << " " << (info.proxy ? "active" : "inactive") << endl;
- AdapterDynamicInfoSeq& adapters = this->nodes[node].adapters;
- AdapterDynamicInfoSeq::iterator p;
- for(p = adapters.begin(); p != adapters.end(); ++p)
- {
- if(p->id == info.id)
- {
- if(info.proxy)
- {
- *p = info;
- }
- else
- {
- adapters.erase(p);
- }
- break;
- }
- }
- if(info.proxy && p == adapters.end())
- {
- adapters.push_back(info);
- }
-
- ostringstream os;
- os << "adapter `" << info.id << " on node `" << node << "' state updated: "
- << (info.proxy ? "active" : "inactive");
- updated(os.str());
+ if(info.id == "PermissionsVerifierServer.Server")
+ {
+ return;
+ }
+
+ Lock sync(*this);
+ //cerr << "update adapter: " << info.id << " " << (info.proxy ? "active" : "inactive") << endl;
+ AdapterDynamicInfoSeq& adapters = this->nodes[node].adapters;
+ AdapterDynamicInfoSeq::iterator p;
+ for(p = adapters.begin(); p != adapters.end(); ++p)
+ {
+ if(p->id == info.id)
+ {
+ if(info.proxy)
+ {
+ *p = info;
+ }
+ else
+ {
+ adapters.erase(p);
+ }
+ break;
+ }
+ }
+ if(info.proxy && p == adapters.end())
+ {
+ adapters.push_back(info);
+ }
+
+ ostringstream os;
+ os << "adapter `" << info.id << " on node `" << node << "' state updated: "
+ << (info.proxy ? "active" : "inactive");
+ updated(os.str());
}
NodeDynamicInfo
filter(const NodeDynamicInfo& info)
{
- if(info.info.name != "localnode")
- {
- return info;
- }
-
- NodeDynamicInfo filtered;
- filtered.info = info.info;
-
- for(ServerDynamicInfoSeq::const_iterator p = info.servers.begin(); p != info.servers.end(); ++p)
- {
- if(p->id == "Glacier2" || p->id == "Glacier2Admin" || p->id == "PermissionsVerifierServer")
- {
- continue;
- }
- filtered.servers.push_back(*p);
- }
-
- for(AdapterDynamicInfoSeq::const_iterator a = info.adapters.begin(); a != info.adapters.end(); ++a)
- {
- if(a->id == "PermissionsVerifierServer.Server")
- {
- continue;
- }
- filtered.adapters.push_back(*a);
- }
-
- return filtered;
+ if(info.info.name != "localnode")
+ {
+ return info;
+ }
+
+ NodeDynamicInfo filtered;
+ filtered.info = info.info;
+
+ for(ServerDynamicInfoSeq::const_iterator p = info.servers.begin(); p != info.servers.end(); ++p)
+ {
+ if(p->id == "Glacier2" || p->id == "Glacier2Admin" || p->id == "PermissionsVerifierServer")
+ {
+ continue;
+ }
+ filtered.servers.push_back(*p);
+ }
+
+ for(AdapterDynamicInfoSeq::const_iterator a = info.adapters.begin(); a != info.adapters.end(); ++a)
+ {
+ if(a->id == "PermissionsVerifierServer.Server")
+ {
+ continue;
+ }
+ filtered.adapters.push_back(*a);
+ }
+
+ return filtered;
}
map<string, NodeDynamicInfo> nodes;
@@ -515,29 +515,29 @@ public:
virtual void
registryInit(const RegistryInfoSeq& info, const Ice::Current& current)
{
- Lock sync(*this);
- for(RegistryInfoSeq::const_iterator p = info.begin(); p != info.end(); ++p)
- {
- this->registries[p->name] = *p;
- }
- updated("init");
+ Lock sync(*this);
+ for(RegistryInfoSeq::const_iterator p = info.begin(); p != info.end(); ++p)
+ {
+ this->registries[p->name] = *p;
+ }
+ updated("init");
}
virtual void
registryUp(const RegistryInfo& info, const Ice::Current& current)
{
- Lock sync(*this);
- this->registries[info.name] = info;
- updated("registry `" + info.name + "' up");
+ Lock sync(*this);
+ this->registries[info.name] = info;
+ updated("registry `" + info.name + "' up");
}
virtual void
registryDown(const string& name, const Ice::Current& current)
- {
- Lock sync(*this);
- this->registries.erase(name);
- updated("registry `" + name + "' down");
- }
+ {
+ Lock sync(*this);
+ this->registries.erase(name);
+ updated("registry `" + name + "' down");
+ }
map<string, RegistryInfo> registries;
};
@@ -557,7 +557,7 @@ void
allTests(const Ice::CommunicatorPtr& communicator)
{
SessionKeepAliveThreadPtr keepAlive = new SessionKeepAliveThread(
- communicator->getLogger(), IceUtil::Time::seconds(5));
+ communicator->getLogger(), IceUtil::Time::seconds(5));
keepAlive->start();
RegistryPrx registry = RegistryPrx::checkedCast(communicator->stringToProxy("IceGrid/Registry"));
@@ -572,24 +572,24 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "starting router... " << flush;
try
{
- admin->startServer("Glacier2");
+ admin->startServer("Glacier2");
}
catch(const ServerStartException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
cout << "ok" << endl;
cout << "starting admin router... " << flush;
try
{
- admin->startServer("Glacier2Admin");
+ admin->startServer("Glacier2Admin");
}
catch(const ServerStartException& ex)
{
- cerr << ex.reason << endl;
- test(false);
+ cerr << ex.reason << endl;
+ test(false);
}
cout << "ok" << endl;
@@ -613,1321 +613,1321 @@ allTests(const Ice::CommunicatorPtr& communicator)
//
while(true)
{
- try
- {
- router1->ice_ping();
- adminRouter1->ice_ping();
- break;
- }
- catch(const Ice::LocalException&)
- {
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100));
- }
+ try
+ {
+ router1->ice_ping();
+ adminRouter1->ice_ping();
+ break;
+ }
+ catch(const Ice::LocalException&)
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(100));
+ }
}
{
- cout << "testing username/password sessions... " << flush;
-
- SessionPrx session1, session2;
-
- session1 = SessionPrx::uncheckedCast(registry1->createSession("client1", "test1")->ice_connectionId("reg1"));
- session2 = SessionPrx::uncheckedCast(registry2->createSession("client2", "test2")->ice_connectionId("reg2"));
- try
- {
- registry1->createSession("client3", "test1");
- test(false);
- }
- catch(const IceGrid::PermissionDeniedException&)
- {
- }
-
- session1->ice_ping();
- session2->ice_ping();
-
- try
- {
- session1->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- session2->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- try
- {
- session1->ice_connectionId("reg2")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- session2->ice_connectionId("reg1")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
-
- session1->destroy();
- session2->destroy();
-
- AdminSessionPrx adminSession1, adminSession2;
-
- adminSession1 = AdminSessionPrx::uncheckedCast(
- registry1->createAdminSession("admin1", "test1")->ice_connectionId("reg1"));
- adminSession2 = AdminSessionPrx::uncheckedCast(
- registry2->createAdminSession("admin2", "test2")->ice_connectionId("reg2"));
- try
- {
- registry1->createAdminSession("admin3", "test1");
- test(false);
- }
- catch(const IceGrid::PermissionDeniedException&)
- {
- }
-
- adminSession1->ice_ping();
- adminSession2->ice_ping();
-
- try
- {
- adminSession1->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- adminSession2->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- adminSession1->getAdmin()->ice_connectionId("reg1")->ice_ping();
- adminSession2->getAdmin()->ice_connectionId("reg2")->ice_ping();
-
- try
- {
- adminSession1->getAdmin()->ice_connectionId("reg2")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- adminSession2->getAdmin()->ice_connectionId("reg1")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- adminSession1->destroy();
- adminSession2->destroy();
-
- cout << "ok" << endl;
+ cout << "testing username/password sessions... " << flush;
+
+ SessionPrx session1, session2;
+
+ session1 = SessionPrx::uncheckedCast(registry1->createSession("client1", "test1")->ice_connectionId("reg1"));
+ session2 = SessionPrx::uncheckedCast(registry2->createSession("client2", "test2")->ice_connectionId("reg2"));
+ try
+ {
+ registry1->createSession("client3", "test1");
+ test(false);
+ }
+ catch(const IceGrid::PermissionDeniedException&)
+ {
+ }
+
+ session1->ice_ping();
+ session2->ice_ping();
+
+ try
+ {
+ session1->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ session2->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ try
+ {
+ session1->ice_connectionId("reg2")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ session2->ice_connectionId("reg1")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+
+ session1->destroy();
+ session2->destroy();
+
+ AdminSessionPrx adminSession1, adminSession2;
+
+ adminSession1 = AdminSessionPrx::uncheckedCast(
+ registry1->createAdminSession("admin1", "test1")->ice_connectionId("reg1"));
+ adminSession2 = AdminSessionPrx::uncheckedCast(
+ registry2->createAdminSession("admin2", "test2")->ice_connectionId("reg2"));
+ try
+ {
+ registry1->createAdminSession("admin3", "test1");
+ test(false);
+ }
+ catch(const IceGrid::PermissionDeniedException&)
+ {
+ }
+
+ adminSession1->ice_ping();
+ adminSession2->ice_ping();
+
+ try
+ {
+ adminSession1->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ adminSession2->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ adminSession1->getAdmin()->ice_connectionId("reg1")->ice_ping();
+ adminSession2->getAdmin()->ice_connectionId("reg2")->ice_ping();
+
+ try
+ {
+ adminSession1->getAdmin()->ice_connectionId("reg2")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ adminSession2->getAdmin()->ice_connectionId("reg1")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ adminSession1->destroy();
+ adminSession2->destroy();
+
+ cout << "ok" << endl;
}
if(properties->getProperty("Ice.Default.Protocol") == "ssl")
{
- cout << "testing sessions from secure connection... " << flush;
-
- SessionPrx session1, session2;
-
- session1 = SessionPrx::uncheckedCast(registry1->createSessionFromSecureConnection()->ice_connectionId("reg1"));
- session2 = SessionPrx::uncheckedCast(registry2->createSessionFromSecureConnection()->ice_connectionId("reg2"));
-
- session1->ice_ping();
- session2->ice_ping();
-
- try
- {
- session1->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- session2->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- session1->destroy();
- session2->destroy();
-
- AdminSessionPrx adminSession1, adminSession2;
-
- adminSession1 = AdminSessionPrx::uncheckedCast(
- registry1->createAdminSessionFromSecureConnection()->ice_connectionId("reg1"));
- adminSession2 = AdminSessionPrx::uncheckedCast(
- registry2->createAdminSessionFromSecureConnection()->ice_connectionId("reg2"));
-
- adminSession1->ice_ping();
- adminSession2->ice_ping();
-
- try
- {
- adminSession1->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- adminSession2->ice_connectionId("")->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- adminSession1->destroy();
- adminSession2->destroy();
-
- cout << "ok" << endl;
+ cout << "testing sessions from secure connection... " << flush;
+
+ SessionPrx session1, session2;
+
+ session1 = SessionPrx::uncheckedCast(registry1->createSessionFromSecureConnection()->ice_connectionId("reg1"));
+ session2 = SessionPrx::uncheckedCast(registry2->createSessionFromSecureConnection()->ice_connectionId("reg2"));
+
+ session1->ice_ping();
+ session2->ice_ping();
+
+ try
+ {
+ session1->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ session2->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ session1->destroy();
+ session2->destroy();
+
+ AdminSessionPrx adminSession1, adminSession2;
+
+ adminSession1 = AdminSessionPrx::uncheckedCast(
+ registry1->createAdminSessionFromSecureConnection()->ice_connectionId("reg1"));
+ adminSession2 = AdminSessionPrx::uncheckedCast(
+ registry2->createAdminSessionFromSecureConnection()->ice_connectionId("reg2"));
+
+ adminSession1->ice_ping();
+ adminSession2->ice_ping();
+
+ try
+ {
+ adminSession1->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ adminSession2->ice_connectionId("")->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ adminSession1->destroy();
+ adminSession2->destroy();
+
+ cout << "ok" << endl;
}
else
{
- cout << "testing sessions from secure connection... " << flush;
- try
- {
- registry1->createSessionFromSecureConnection();
- test(false);
- }
- catch(const IceGrid::PermissionDeniedException&)
- {
- }
- try
- {
- registry1->createAdminSessionFromSecureConnection();
- test(false);
- }
- catch(const IceGrid::PermissionDeniedException&)
- {
- }
- cout << "ok" << endl;
+ cout << "testing sessions from secure connection... " << flush;
+ try
+ {
+ registry1->createSessionFromSecureConnection();
+ test(false);
+ }
+ catch(const IceGrid::PermissionDeniedException&)
+ {
+ }
+ try
+ {
+ registry1->createAdminSessionFromSecureConnection();
+ test(false);
+ }
+ catch(const IceGrid::PermissionDeniedException&)
+ {
+ }
+ cout << "ok" << endl;
}
{
- cout << "testing Glacier2 username/password sessions... " << flush;
-
- SessionPrx session1, session2;
-
- Glacier2::SessionPrx base;
-
- base = router1->createSession("client1", "test1");
- test(base);
- session1 = SessionPrx::uncheckedCast(base->ice_connectionId("router1")->ice_router(router1));
-
- base = router2->createSession("client2", "test2");
- test(base);
- session2 = SessionPrx::uncheckedCast(base->ice_connectionId("router2")->ice_router(router2));
-
- try
- {
- router1->createSession("client3", "test1");
- test(false);
- }
- catch(const Glacier2::CannotCreateSessionException&)
- {
- }
-
- session1->ice_ping();
- session2->ice_ping();
-
- try
- {
- session1->ice_connectionId("router2")->ice_router(router2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- session2->ice_connectionId("router1")->ice_router(router1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- Ice::ObjectPrx obj = communicator->stringToProxy("IceGrid/Query");
- obj->ice_connectionId("router1")->ice_router(router1)->ice_ping();
- obj->ice_connectionId("router2")->ice_router(router2)->ice_ping();
-
- obj = communicator->stringToProxy("IceGrid/Registry");
- try
- {
- obj->ice_connectionId("router1")->ice_router(router1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- obj->ice_connectionId("router2")->ice_router(router2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- try
- {
- router1->destroySession();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- try
- {
- router2->destroySession();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
-
- AdminSessionPrx admSession1, admSession2;
-
- base = adminRouter1->createSession("admin1", "test1");
- admSession1 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter1")->ice_router(adminRouter1));
-
- base = adminRouter2->createSession("admin2", "test2");
- admSession2 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter2")->ice_router(adminRouter2));
-
- try
- {
- adminRouter1->createSession("client3", "test1");
- test(false);
- }
- catch(const Glacier2::CannotCreateSessionException&)
- {
- }
-
- admSession1->ice_ping();
- admSession2->ice_ping();
-
- Ice::ObjectPrx admin1 = admSession1->getAdmin()->ice_router(adminRouter1)->ice_connectionId("admRouter1");
- Ice::ObjectPrx admin2 = admSession2->getAdmin()->ice_router(adminRouter2)->ice_connectionId("admRouter2");
-
- admin1->ice_ping();
- admin2->ice_ping();
-
- obj = communicator->stringToProxy("IceGrid/Query");
- obj->ice_connectionId("admRouter1")->ice_router(adminRouter1)->ice_ping();
- obj->ice_connectionId("admRouter2")->ice_router(adminRouter2)->ice_ping();
-
- try
- {
- admSession1->ice_connectionId("admRouter2")->ice_router(adminRouter2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- admSession2->ice_connectionId("admRouter1")->ice_router(adminRouter1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- try
- {
- admin1->ice_connectionId("admRouter2")->ice_router(adminRouter2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- admin2->ice_connectionId("admRouter1")->ice_router(adminRouter1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- try
- {
- adminRouter1->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- try
- {
- adminRouter2->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
-
- cout << "ok" << endl;
+ cout << "testing Glacier2 username/password sessions... " << flush;
+
+ SessionPrx session1, session2;
+
+ Glacier2::SessionPrx base;
+
+ base = router1->createSession("client1", "test1");
+ test(base);
+ session1 = SessionPrx::uncheckedCast(base->ice_connectionId("router1")->ice_router(router1));
+
+ base = router2->createSession("client2", "test2");
+ test(base);
+ session2 = SessionPrx::uncheckedCast(base->ice_connectionId("router2")->ice_router(router2));
+
+ try
+ {
+ router1->createSession("client3", "test1");
+ test(false);
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ }
+
+ session1->ice_ping();
+ session2->ice_ping();
+
+ try
+ {
+ session1->ice_connectionId("router2")->ice_router(router2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ session2->ice_connectionId("router1")->ice_router(router1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ Ice::ObjectPrx obj = communicator->stringToProxy("IceGrid/Query");
+ obj->ice_connectionId("router1")->ice_router(router1)->ice_ping();
+ obj->ice_connectionId("router2")->ice_router(router2)->ice_ping();
+
+ obj = communicator->stringToProxy("IceGrid/Registry");
+ try
+ {
+ obj->ice_connectionId("router1")->ice_router(router1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ obj->ice_connectionId("router2")->ice_router(router2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ try
+ {
+ router1->destroySession();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ try
+ {
+ router2->destroySession();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+
+ AdminSessionPrx admSession1, admSession2;
+
+ base = adminRouter1->createSession("admin1", "test1");
+ admSession1 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter1")->ice_router(adminRouter1));
+
+ base = adminRouter2->createSession("admin2", "test2");
+ admSession2 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter2")->ice_router(adminRouter2));
+
+ try
+ {
+ adminRouter1->createSession("client3", "test1");
+ test(false);
+ }
+ catch(const Glacier2::CannotCreateSessionException&)
+ {
+ }
+
+ admSession1->ice_ping();
+ admSession2->ice_ping();
+
+ Ice::ObjectPrx admin1 = admSession1->getAdmin()->ice_router(adminRouter1)->ice_connectionId("admRouter1");
+ Ice::ObjectPrx admin2 = admSession2->getAdmin()->ice_router(adminRouter2)->ice_connectionId("admRouter2");
+
+ admin1->ice_ping();
+ admin2->ice_ping();
+
+ obj = communicator->stringToProxy("IceGrid/Query");
+ obj->ice_connectionId("admRouter1")->ice_router(adminRouter1)->ice_ping();
+ obj->ice_connectionId("admRouter2")->ice_router(adminRouter2)->ice_ping();
+
+ try
+ {
+ admSession1->ice_connectionId("admRouter2")->ice_router(adminRouter2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ admSession2->ice_connectionId("admRouter1")->ice_router(adminRouter1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ try
+ {
+ admin1->ice_connectionId("admRouter2")->ice_router(adminRouter2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ admin2->ice_connectionId("admRouter1")->ice_router(adminRouter1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ try
+ {
+ adminRouter1->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ try
+ {
+ adminRouter2->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+
+ cout << "ok" << endl;
}
if(properties->getProperty("Ice.Default.Protocol") == "ssl")
{
- cout << "testing Glacier2 sessions from secure connection... " << flush;
-
- SessionPrx session1, session2;
-
- Glacier2::SessionPrx base;
-
- //
- // BUGFIX: We can't re-use the same router proxies because of bug 1034.
- //
- router1 = Glacier2::RouterPrx::uncheckedCast(router1->ice_connectionId("router11"));
- router2 = Glacier2::RouterPrx::uncheckedCast(router2->ice_connectionId("router21"));
-
- base = router1->createSessionFromSecureConnection();
- session1 = SessionPrx::uncheckedCast(base->ice_connectionId("router11")->ice_router(router1));
-
- base = router2->createSessionFromSecureConnection();
- session2 = SessionPrx::uncheckedCast(base->ice_connectionId("router21")->ice_router(router2));
-
- session1->ice_ping();
- session2->ice_ping();
-
- try
- {
- session1->ice_connectionId("router21")->ice_router(router2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- session2->ice_connectionId("router11")->ice_router(router1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- Ice::ObjectPrx obj = communicator->stringToProxy("IceGrid/Query");
- obj->ice_connectionId("router11")->ice_router(router1)->ice_ping();
- obj->ice_connectionId("router21")->ice_router(router2)->ice_ping();
-
- obj = communicator->stringToProxy("IceGrid/Registry");
- try
- {
- obj->ice_connectionId("router11")->ice_router(router1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- obj->ice_connectionId("router21")->ice_router(router2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- try
- {
- router1->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- try
- {
- router2->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
-
- AdminSessionPrx admSession1, admSession2;
-
- //
- // BUGFIX: We can't re-use the same router proxies because of bug 1034.
- //
- adminRouter1 = Glacier2::RouterPrx::uncheckedCast(adminRouter->ice_connectionId("admRouter11"));
- adminRouter2 = Glacier2::RouterPrx::uncheckedCast(adminRouter->ice_connectionId("admRouter21"));
-
- base = adminRouter1->createSessionFromSecureConnection();
- admSession1 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter11")->ice_router(adminRouter1));
-
- base = adminRouter2->createSessionFromSecureConnection();
- admSession2 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter21")->ice_router(adminRouter2));
-
- admSession1->ice_ping();
- admSession2->ice_ping();
-
- Ice::ObjectPrx admin1 = admSession1->getAdmin()->ice_router(adminRouter1)->ice_connectionId("admRouter11");
- Ice::ObjectPrx admin2 = admSession2->getAdmin()->ice_router(adminRouter2)->ice_connectionId("admRouter21");
-
- admin1->ice_ping();
- admin2->ice_ping();
-
- obj = communicator->stringToProxy("IceGrid/Query");
- obj->ice_connectionId("admRouter11")->ice_router(adminRouter1)->ice_ping();
- obj->ice_connectionId("admRouter21")->ice_router(adminRouter2)->ice_ping();
-
- try
- {
- admSession1->ice_connectionId("admRouter21")->ice_router(adminRouter2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- admSession2->ice_connectionId("admRouter11")->ice_router(adminRouter1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- try
- {
- admin1->ice_connectionId("admRouter21")->ice_router(adminRouter2)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
- try
- {
- admin2->ice_connectionId("admRouter11")->ice_router(adminRouter1)->ice_ping();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- try
- {
- adminRouter1->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
- try
- {
- adminRouter2->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- }
-
- cout << "ok" << endl;
+ cout << "testing Glacier2 sessions from secure connection... " << flush;
+
+ SessionPrx session1, session2;
+
+ Glacier2::SessionPrx base;
+
+ //
+ // BUGFIX: We can't re-use the same router proxies because of bug 1034.
+ //
+ router1 = Glacier2::RouterPrx::uncheckedCast(router1->ice_connectionId("router11"));
+ router2 = Glacier2::RouterPrx::uncheckedCast(router2->ice_connectionId("router21"));
+
+ base = router1->createSessionFromSecureConnection();
+ session1 = SessionPrx::uncheckedCast(base->ice_connectionId("router11")->ice_router(router1));
+
+ base = router2->createSessionFromSecureConnection();
+ session2 = SessionPrx::uncheckedCast(base->ice_connectionId("router21")->ice_router(router2));
+
+ session1->ice_ping();
+ session2->ice_ping();
+
+ try
+ {
+ session1->ice_connectionId("router21")->ice_router(router2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ session2->ice_connectionId("router11")->ice_router(router1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ Ice::ObjectPrx obj = communicator->stringToProxy("IceGrid/Query");
+ obj->ice_connectionId("router11")->ice_router(router1)->ice_ping();
+ obj->ice_connectionId("router21")->ice_router(router2)->ice_ping();
+
+ obj = communicator->stringToProxy("IceGrid/Registry");
+ try
+ {
+ obj->ice_connectionId("router11")->ice_router(router1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ obj->ice_connectionId("router21")->ice_router(router2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ try
+ {
+ router1->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ try
+ {
+ router2->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+
+ AdminSessionPrx admSession1, admSession2;
+
+ //
+ // BUGFIX: We can't re-use the same router proxies because of bug 1034.
+ //
+ adminRouter1 = Glacier2::RouterPrx::uncheckedCast(adminRouter->ice_connectionId("admRouter11"));
+ adminRouter2 = Glacier2::RouterPrx::uncheckedCast(adminRouter->ice_connectionId("admRouter21"));
+
+ base = adminRouter1->createSessionFromSecureConnection();
+ admSession1 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter11")->ice_router(adminRouter1));
+
+ base = adminRouter2->createSessionFromSecureConnection();
+ admSession2 = AdminSessionPrx::uncheckedCast(base->ice_connectionId("admRouter21")->ice_router(adminRouter2));
+
+ admSession1->ice_ping();
+ admSession2->ice_ping();
+
+ Ice::ObjectPrx admin1 = admSession1->getAdmin()->ice_router(adminRouter1)->ice_connectionId("admRouter11");
+ Ice::ObjectPrx admin2 = admSession2->getAdmin()->ice_router(adminRouter2)->ice_connectionId("admRouter21");
+
+ admin1->ice_ping();
+ admin2->ice_ping();
+
+ obj = communicator->stringToProxy("IceGrid/Query");
+ obj->ice_connectionId("admRouter11")->ice_router(adminRouter1)->ice_ping();
+ obj->ice_connectionId("admRouter21")->ice_router(adminRouter2)->ice_ping();
+
+ try
+ {
+ admSession1->ice_connectionId("admRouter21")->ice_router(adminRouter2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ admSession2->ice_connectionId("admRouter11")->ice_router(adminRouter1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ try
+ {
+ admin1->ice_connectionId("admRouter21")->ice_router(adminRouter2)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+ try
+ {
+ admin2->ice_connectionId("admRouter11")->ice_router(adminRouter1)->ice_ping();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ try
+ {
+ adminRouter1->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+ try
+ {
+ adminRouter2->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ }
+
+ cout << "ok" << endl;
}
else
{
- cout << "testing Glacier2 sessions from secure connection... " << flush;
- try
- {
- router1->createSessionFromSecureConnection();
- test(false);
- }
- catch(const Glacier2::PermissionDeniedException&)
- {
- }
- try
- {
- adminRouter1->createSessionFromSecureConnection();
- test(false);
- }
- catch(const Glacier2::PermissionDeniedException&)
- {
- }
- cout << "ok" << endl;
+ cout << "testing Glacier2 sessions from secure connection... " << flush;
+ try
+ {
+ router1->createSessionFromSecureConnection();
+ test(false);
+ }
+ catch(const Glacier2::PermissionDeniedException&)
+ {
+ }
+ try
+ {
+ adminRouter1->createSessionFromSecureConnection();
+ test(false);
+ }
+ catch(const Glacier2::PermissionDeniedException&)
+ {
+ }
+ cout << "ok" << endl;
}
{
- cout << "testing updates with admin sessions... " << flush;
- AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
- AdminSessionPrx session2 = registry->createAdminSession("admin2", "test2");
-
- keepAlive->add(session1);
- keepAlive->add(session2);
-
- AdminPrx admin1 = session1->getAdmin();
- AdminPrx admin2 = session2->getAdmin();
-
- Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
- ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.1");
- Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
- NodeObserverIPtr nodeObs1 = new NodeObserverI("nodeObs1");
- Ice::ObjectPrx no1 = adpt1->addWithUUID(nodeObs1);
- adpt1->activate();
- registry->ice_getConnection()->setAdapter(adpt1);
- session1->setObserversByIdentity(Ice::Identity(),
- no1->ice_getIdentity(),
- app1->ice_getIdentity(),
- Ice::Identity(),
- Ice::Identity());
-
- Ice::ObjectAdapterPtr adpt2 = communicator->createObjectAdapterWithEndpoints("Observer2", "default");
- ApplicationObserverIPtr appObs2 = new ApplicationObserverI("appObs2");
- Ice::ObjectPrx app2 = adpt2->addWithUUID(appObs2);
- NodeObserverIPtr nodeObs2 = new NodeObserverI("nodeObs1");
- Ice::ObjectPrx no2 = adpt2->addWithUUID(nodeObs2);
- adpt2->activate();
- session2->setObservers(0,
- NodeObserverPrx::uncheckedCast(no2),
- ApplicationObserverPrx::uncheckedCast(app2),
- 0,
- 0);
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
- appObs2->waitForUpdate(__FILE__, __LINE__);
-
- int serial = appObs1->serial;
- test(serial == appObs2->serial);
-
- try
- {
- session1->getAdmin()->ice_ping();
- }
- catch(const Ice::LocalException&)
- {
- test(false);
- }
-
- try
- {
- int s = session1->startUpdate();
- test(s != serial + 1);
- }
- catch(const AccessDeniedException&)
- {
- test(false);
- }
-
- try
- {
- int s = session1->startUpdate();
- test(s == serial);
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
-
- try
- {
- session2->startUpdate();
- test(false);
- }
- catch(const AccessDeniedException& ex)
- {
- test(ex.lockUserId == "admin1");
- }
-
- try
- {
- session1->finishUpdate();
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
-
- try
- {
- int s = session2->startUpdate();
- test(s == appObs2->serial);
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
-
- try
- {
- ApplicationDescriptor app;
- app.name = "Application";
- admin2->addApplication(app);
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
-
- try
- {
- admin1->addApplication(ApplicationDescriptor());
- test(false);
- }
- catch(const AccessDeniedException&)
- {
- }
-
- try
- {
- session2->finishUpdate();
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
- appObs2->waitForUpdate(__FILE__, __LINE__);
-
- test(serial + 1 == appObs1->serial);
- test(serial + 1 == appObs2->serial);
- ++serial;
-
- try
- {
- int s = session1->startUpdate();
- test(s == serial);
- ApplicationUpdateDescriptor update;
- update.name = "Application";
- update.variables.insert(make_pair(string("test"), string("test")));
- admin1->updateApplication(update);
- session1->finishUpdate();
- }
- catch(const Ice::UserException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
- appObs2->waitForUpdate(__FILE__, __LINE__);
-
- test(serial + 1 == appObs1->serial);
- test(serial + 1 == appObs2->serial);
- ++serial;
-
- //
- // We now allow modifying the database without holding the
- // exclusive lock.
- //
-// try
-// {
-// ApplicationUpdateDescriptor update;
-// update.name = "Application";
-// admin1->updateApplication(update);
-// test(false);
-// }
-// catch(const AccessDeniedException&)
-// {
-// }
-
- try
- {
- int s = session2->startUpdate();
- test(s == serial);
- admin2->removeApplication("Application");
- session2->finishUpdate();
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
- appObs2->waitForUpdate(__FILE__, __LINE__);
-
- test(serial + 1 == appObs1->serial);
- test(serial + 1 == appObs2->serial);
- ++serial;
-
- try
- {
- int s = session1->startUpdate();
- test(s == serial);
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
- session1->destroy();
-
- try
- {
- int s = session2->startUpdate();
- test(s == serial);
- session2->finishUpdate();
- }
- catch(const Ice::UserException&)
- {
- test(false);
- }
- session2->destroy();
-
- adpt1->destroy();
- adpt2->destroy();
-
- //
- // TODO: test session reaping?
- //
-
- cout << "ok" << endl;
+ cout << "testing updates with admin sessions... " << flush;
+ AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
+ AdminSessionPrx session2 = registry->createAdminSession("admin2", "test2");
+
+ keepAlive->add(session1);
+ keepAlive->add(session2);
+
+ AdminPrx admin1 = session1->getAdmin();
+ AdminPrx admin2 = session2->getAdmin();
+
+ Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
+ ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.1");
+ Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
+ NodeObserverIPtr nodeObs1 = new NodeObserverI("nodeObs1");
+ Ice::ObjectPrx no1 = adpt1->addWithUUID(nodeObs1);
+ adpt1->activate();
+ registry->ice_getConnection()->setAdapter(adpt1);
+ session1->setObserversByIdentity(Ice::Identity(),
+ no1->ice_getIdentity(),
+ app1->ice_getIdentity(),
+ Ice::Identity(),
+ Ice::Identity());
+
+ Ice::ObjectAdapterPtr adpt2 = communicator->createObjectAdapterWithEndpoints("Observer2", "default");
+ ApplicationObserverIPtr appObs2 = new ApplicationObserverI("appObs2");
+ Ice::ObjectPrx app2 = adpt2->addWithUUID(appObs2);
+ NodeObserverIPtr nodeObs2 = new NodeObserverI("nodeObs1");
+ Ice::ObjectPrx no2 = adpt2->addWithUUID(nodeObs2);
+ adpt2->activate();
+ session2->setObservers(0,
+ NodeObserverPrx::uncheckedCast(no2),
+ ApplicationObserverPrx::uncheckedCast(app2),
+ 0,
+ 0);
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ appObs2->waitForUpdate(__FILE__, __LINE__);
+
+ int serial = appObs1->serial;
+ test(serial == appObs2->serial);
+
+ try
+ {
+ session1->getAdmin()->ice_ping();
+ }
+ catch(const Ice::LocalException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ int s = session1->startUpdate();
+ test(s != serial + 1);
+ }
+ catch(const AccessDeniedException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ int s = session1->startUpdate();
+ test(s == serial);
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ session2->startUpdate();
+ test(false);
+ }
+ catch(const AccessDeniedException& ex)
+ {
+ test(ex.lockUserId == "admin1");
+ }
+
+ try
+ {
+ session1->finishUpdate();
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ int s = session2->startUpdate();
+ test(s == appObs2->serial);
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ ApplicationDescriptor app;
+ app.name = "Application";
+ admin2->addApplication(app);
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+
+ try
+ {
+ admin1->addApplication(ApplicationDescriptor());
+ test(false);
+ }
+ catch(const AccessDeniedException&)
+ {
+ }
+
+ try
+ {
+ session2->finishUpdate();
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ appObs2->waitForUpdate(__FILE__, __LINE__);
+
+ test(serial + 1 == appObs1->serial);
+ test(serial + 1 == appObs2->serial);
+ ++serial;
+
+ try
+ {
+ int s = session1->startUpdate();
+ test(s == serial);
+ ApplicationUpdateDescriptor update;
+ update.name = "Application";
+ update.variables.insert(make_pair(string("test"), string("test")));
+ admin1->updateApplication(update);
+ session1->finishUpdate();
+ }
+ catch(const Ice::UserException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ appObs2->waitForUpdate(__FILE__, __LINE__);
+
+ test(serial + 1 == appObs1->serial);
+ test(serial + 1 == appObs2->serial);
+ ++serial;
+
+ //
+ // We now allow modifying the database without holding the
+ // exclusive lock.
+ //
+// try
+// {
+// ApplicationUpdateDescriptor update;
+// update.name = "Application";
+// admin1->updateApplication(update);
+// test(false);
+// }
+// catch(const AccessDeniedException&)
+// {
+// }
+
+ try
+ {
+ int s = session2->startUpdate();
+ test(s == serial);
+ admin2->removeApplication("Application");
+ session2->finishUpdate();
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ appObs2->waitForUpdate(__FILE__, __LINE__);
+
+ test(serial + 1 == appObs1->serial);
+ test(serial + 1 == appObs2->serial);
+ ++serial;
+
+ try
+ {
+ int s = session1->startUpdate();
+ test(s == serial);
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+ session1->destroy();
+
+ try
+ {
+ int s = session2->startUpdate();
+ test(s == serial);
+ session2->finishUpdate();
+ }
+ catch(const Ice::UserException&)
+ {
+ test(false);
+ }
+ session2->destroy();
+
+ adpt1->destroy();
+ adpt2->destroy();
+
+ //
+ // TODO: test session reaping?
+ //
+
+ cout << "ok" << endl;
}
{
- cout << "testing application observer... " << flush;
- AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
- AdminPrx admin1 = session1->getAdmin();
-
- keepAlive->add(session1);
-
- Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
- ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.2");
- Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
- adpt1->activate();
- registry->ice_getConnection()->setAdapter(adpt1);
- session1->setObserversByIdentity(Ice::Identity(),
- Ice::Identity(),
- app1->ice_getIdentity(),
- Ice::Identity(),
- Ice::Identity());
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
-
- int serial = appObs1->serial;
- test(appObs1->applications.empty());
-
- try
- {
- ApplicationDescriptor app;
- app.name = "Application";
- int s = session1->startUpdate();
- test(s == serial);
- admin1->addApplication(app);
- appObs1->waitForUpdate(__FILE__, __LINE__);
- test(appObs1->applications.find("Application") != appObs1->applications.end());
- test(++serial == appObs1->serial);
- }
- catch(const Ice::UserException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- try
- {
- ApplicationUpdateDescriptor update;
- update.name = "Application";
- update.variables.insert(make_pair(string("test"), string("test")));
- admin1->updateApplication(update);
- appObs1->waitForUpdate(__FILE__, __LINE__);
- test(appObs1->applications.find("Application") != appObs1->applications.end());
- test(appObs1->applications["Application"].descriptor.variables["test"] == "test");
- test(++serial == appObs1->serial);
- }
- catch(const Ice::UserException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- try
- {
- ApplicationDescriptor app;
- app = appObs1->applications["Application"].descriptor;
- app.variables.clear();
- app.variables["test1"] = "test";
- admin1->syncApplication(app);
- appObs1->waitForUpdate(__FILE__, __LINE__);
- test(appObs1->applications.find("Application") != appObs1->applications.end());
- test(appObs1->applications["Application"].descriptor.variables.size() == 1);
- test(appObs1->applications["Application"].descriptor.variables["test1"] == "test");
- test(++serial == appObs1->serial);
- }
- catch(const Ice::UserException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- try
- {
- admin1->removeApplication("Application");
- appObs1->waitForUpdate(__FILE__, __LINE__);
- test(appObs1->applications.empty());
- test(++serial == appObs1->serial);
- }
- catch(const Ice::UserException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- session1->destroy();
- adpt1->destroy();
-
- cout << "ok" << endl;
+ cout << "testing application observer... " << flush;
+ AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
+ AdminPrx admin1 = session1->getAdmin();
+
+ keepAlive->add(session1);
+
+ Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
+ ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.2");
+ Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
+ adpt1->activate();
+ registry->ice_getConnection()->setAdapter(adpt1);
+ session1->setObserversByIdentity(Ice::Identity(),
+ Ice::Identity(),
+ app1->ice_getIdentity(),
+ Ice::Identity(),
+ Ice::Identity());
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+
+ int serial = appObs1->serial;
+ test(appObs1->applications.empty());
+
+ try
+ {
+ ApplicationDescriptor app;
+ app.name = "Application";
+ int s = session1->startUpdate();
+ test(s == serial);
+ admin1->addApplication(app);
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ test(appObs1->applications.find("Application") != appObs1->applications.end());
+ test(++serial == appObs1->serial);
+ }
+ catch(const Ice::UserException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ try
+ {
+ ApplicationUpdateDescriptor update;
+ update.name = "Application";
+ update.variables.insert(make_pair(string("test"), string("test")));
+ admin1->updateApplication(update);
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ test(appObs1->applications.find("Application") != appObs1->applications.end());
+ test(appObs1->applications["Application"].descriptor.variables["test"] == "test");
+ test(++serial == appObs1->serial);
+ }
+ catch(const Ice::UserException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ try
+ {
+ ApplicationDescriptor app;
+ app = appObs1->applications["Application"].descriptor;
+ app.variables.clear();
+ app.variables["test1"] = "test";
+ admin1->syncApplication(app);
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ test(appObs1->applications.find("Application") != appObs1->applications.end());
+ test(appObs1->applications["Application"].descriptor.variables.size() == 1);
+ test(appObs1->applications["Application"].descriptor.variables["test1"] == "test");
+ test(++serial == appObs1->serial);
+ }
+ catch(const Ice::UserException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ try
+ {
+ admin1->removeApplication("Application");
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ test(appObs1->applications.empty());
+ test(++serial == appObs1->serial);
+ }
+ catch(const Ice::UserException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ session1->destroy();
+ adpt1->destroy();
+
+ cout << "ok" << endl;
}
{
- cout << "testing adapter observer... " << flush;
-
- AdminSessionPrx session1 = AdminSessionPrx::uncheckedCast(registry->createAdminSession("admin1", "test1"));
- AdminPrx admin1 = session1->getAdmin();
-
- keepAlive->add(session1);
-
- Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
- AdapterObserverIPtr adptObs1 = new AdapterObserverI("adptObs1");
- Ice::ObjectPrx adapter1 = adpt1->addWithUUID(adptObs1);
- adpt1->activate();
- registry->ice_getConnection()->setAdapter(adpt1);
- session1->setObserversByIdentity(Ice::Identity(),
- Ice::Identity(),
- Ice::Identity(),
- adapter1->ice_getIdentity(),
- Ice::Identity());
-
- adptObs1->waitForUpdate(__FILE__, __LINE__); // init
-
- try
- {
- Ice::ObjectPrx obj = communicator->stringToProxy("dummy:tcp -p 10000");
-
- Ice::LocatorRegistryPrx locatorRegistry = communicator->getDefaultLocator()->getRegistry();
- locatorRegistry->setAdapterDirectProxy("DummyAdapter", obj);
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters.find("DummyAdapter") != adptObs1->adapters.end());
- test(adptObs1->adapters["DummyAdapter"].proxy == obj);
-
- obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
- locatorRegistry->setAdapterDirectProxy("DummyAdapter", obj);
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters.find("DummyAdapter") != adptObs1->adapters.end());
- test(adptObs1->adapters["DummyAdapter"].proxy == obj);
-
- obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
- locatorRegistry->setReplicatedAdapterDirectProxy("DummyAdapter", "DummyReplicaGroup", obj);
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters.find("DummyAdapter") != adptObs1->adapters.end());
- test(adptObs1->adapters["DummyAdapter"].proxy == obj);
- test(adptObs1->adapters["DummyAdapter"].replicaGroupId == "DummyReplicaGroup");
-
- obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
- locatorRegistry->setReplicatedAdapterDirectProxy("DummyAdapter1", "DummyReplicaGroup", obj);
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters.find("DummyAdapter1") != adptObs1->adapters.end());
- test(adptObs1->adapters["DummyAdapter1"].proxy == obj);
- test(adptObs1->adapters["DummyAdapter1"].replicaGroupId == "DummyReplicaGroup");
-
- obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
- locatorRegistry->setReplicatedAdapterDirectProxy("DummyAdapter2", "DummyReplicaGroup", obj);
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters.find("DummyAdapter2") != adptObs1->adapters.end());
- test(adptObs1->adapters["DummyAdapter2"].proxy == obj);
- test(adptObs1->adapters["DummyAdapter2"].replicaGroupId == "DummyReplicaGroup");
-
- admin->removeAdapter("DummyAdapter2");
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters.find("DummyAdapter2") == adptObs1->adapters.end());
-
- admin->removeAdapter("DummyReplicaGroup");
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters["DummyAdapter"].replicaGroupId == "");
- test(adptObs1->adapters["DummyAdapter1"].replicaGroupId == "");
-
- locatorRegistry->setAdapterDirectProxy("DummyAdapter", 0);
- adptObs1->waitForUpdate(__FILE__, __LINE__);
- test(adptObs1->adapters.find("DummyAdapter") == adptObs1->adapters.end());
- }
- catch(const Ice::UserException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- session1->destroy();
- adpt1->destroy();
-
- cout << "ok" << endl;
+ cout << "testing adapter observer... " << flush;
+
+ AdminSessionPrx session1 = AdminSessionPrx::uncheckedCast(registry->createAdminSession("admin1", "test1"));
+ AdminPrx admin1 = session1->getAdmin();
+
+ keepAlive->add(session1);
+
+ Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
+ AdapterObserverIPtr adptObs1 = new AdapterObserverI("adptObs1");
+ Ice::ObjectPrx adapter1 = adpt1->addWithUUID(adptObs1);
+ adpt1->activate();
+ registry->ice_getConnection()->setAdapter(adpt1);
+ session1->setObserversByIdentity(Ice::Identity(),
+ Ice::Identity(),
+ Ice::Identity(),
+ adapter1->ice_getIdentity(),
+ Ice::Identity());
+
+ adptObs1->waitForUpdate(__FILE__, __LINE__); // init
+
+ try
+ {
+ Ice::ObjectPrx obj = communicator->stringToProxy("dummy:tcp -p 10000");
+
+ Ice::LocatorRegistryPrx locatorRegistry = communicator->getDefaultLocator()->getRegistry();
+ locatorRegistry->setAdapterDirectProxy("DummyAdapter", obj);
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters.find("DummyAdapter") != adptObs1->adapters.end());
+ test(adptObs1->adapters["DummyAdapter"].proxy == obj);
+
+ obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
+ locatorRegistry->setAdapterDirectProxy("DummyAdapter", obj);
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters.find("DummyAdapter") != adptObs1->adapters.end());
+ test(adptObs1->adapters["DummyAdapter"].proxy == obj);
+
+ obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
+ locatorRegistry->setReplicatedAdapterDirectProxy("DummyAdapter", "DummyReplicaGroup", obj);
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters.find("DummyAdapter") != adptObs1->adapters.end());
+ test(adptObs1->adapters["DummyAdapter"].proxy == obj);
+ test(adptObs1->adapters["DummyAdapter"].replicaGroupId == "DummyReplicaGroup");
+
+ obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
+ locatorRegistry->setReplicatedAdapterDirectProxy("DummyAdapter1", "DummyReplicaGroup", obj);
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters.find("DummyAdapter1") != adptObs1->adapters.end());
+ test(adptObs1->adapters["DummyAdapter1"].proxy == obj);
+ test(adptObs1->adapters["DummyAdapter1"].replicaGroupId == "DummyReplicaGroup");
+
+ obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
+ locatorRegistry->setReplicatedAdapterDirectProxy("DummyAdapter2", "DummyReplicaGroup", obj);
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters.find("DummyAdapter2") != adptObs1->adapters.end());
+ test(adptObs1->adapters["DummyAdapter2"].proxy == obj);
+ test(adptObs1->adapters["DummyAdapter2"].replicaGroupId == "DummyReplicaGroup");
+
+ admin->removeAdapter("DummyAdapter2");
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters.find("DummyAdapter2") == adptObs1->adapters.end());
+
+ admin->removeAdapter("DummyReplicaGroup");
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters["DummyAdapter"].replicaGroupId == "");
+ test(adptObs1->adapters["DummyAdapter1"].replicaGroupId == "");
+
+ locatorRegistry->setAdapterDirectProxy("DummyAdapter", 0);
+ adptObs1->waitForUpdate(__FILE__, __LINE__);
+ test(adptObs1->adapters.find("DummyAdapter") == adptObs1->adapters.end());
+ }
+ catch(const Ice::UserException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ session1->destroy();
+ adpt1->destroy();
+
+ cout << "ok" << endl;
}
{
- cout << "testing object observer... " << flush;
-
- AdminSessionPrx session1 = AdminSessionPrx::uncheckedCast(registry->createAdminSession("admin1", "test1"));
- AdminPrx admin1 = session1->getAdmin();
-
- keepAlive->add(session1);
-
- Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
- ObjectObserverIPtr objectObs1 = new ObjectObserverI("objectObs1");
- Ice::ObjectPrx object1 = adpt1->addWithUUID(objectObs1);
- adpt1->activate();
- registry->ice_getConnection()->setAdapter(adpt1);
- session1->setObserversByIdentity(Ice::Identity(),
- Ice::Identity(),
- Ice::Identity(),
- Ice::Identity(),
- object1->ice_getIdentity());
-
- objectObs1->waitForUpdate(__FILE__, __LINE__); // init
-
- try
- {
- Ice::ObjectPrx obj = communicator->stringToProxy("dummy:tcp -p 10000");
-
- admin->addObjectWithType(obj, "::Dummy");
- objectObs1->waitForUpdate(__FILE__, __LINE__);
- test(objectObs1->objects.find(communicator->stringToIdentity("dummy")) != objectObs1->objects.end());
- test(objectObs1->objects[communicator->stringToIdentity("dummy")].type == "::Dummy");
- test(objectObs1->objects[communicator->stringToIdentity("dummy")].proxy == obj);
-
- obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
- admin->updateObject(obj);
- objectObs1->waitForUpdate(__FILE__, __LINE__);
- test(objectObs1->objects.find(communicator->stringToIdentity("dummy")) != objectObs1->objects.end());
- test(objectObs1->objects[communicator->stringToIdentity("dummy")].type == "::Dummy");
- test(objectObs1->objects[communicator->stringToIdentity("dummy")].proxy == obj);
-
- admin->removeObject(obj->ice_getIdentity());
- objectObs1->waitForUpdate(__FILE__, __LINE__);
- test(objectObs1->objects.find(communicator->stringToIdentity("dummy")) == objectObs1->objects.end());
- }
- catch(const Ice::UserException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- session1->destroy();
- adpt1->destroy();
-
- cout << "ok" << endl;
+ cout << "testing object observer... " << flush;
+
+ AdminSessionPrx session1 = AdminSessionPrx::uncheckedCast(registry->createAdminSession("admin1", "test1"));
+ AdminPrx admin1 = session1->getAdmin();
+
+ keepAlive->add(session1);
+
+ Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
+ ObjectObserverIPtr objectObs1 = new ObjectObserverI("objectObs1");
+ Ice::ObjectPrx object1 = adpt1->addWithUUID(objectObs1);
+ adpt1->activate();
+ registry->ice_getConnection()->setAdapter(adpt1);
+ session1->setObserversByIdentity(Ice::Identity(),
+ Ice::Identity(),
+ Ice::Identity(),
+ Ice::Identity(),
+ object1->ice_getIdentity());
+
+ objectObs1->waitForUpdate(__FILE__, __LINE__); // init
+
+ try
+ {
+ Ice::ObjectPrx obj = communicator->stringToProxy("dummy:tcp -p 10000");
+
+ admin->addObjectWithType(obj, "::Dummy");
+ objectObs1->waitForUpdate(__FILE__, __LINE__);
+ test(objectObs1->objects.find(communicator->stringToIdentity("dummy")) != objectObs1->objects.end());
+ test(objectObs1->objects[communicator->stringToIdentity("dummy")].type == "::Dummy");
+ test(objectObs1->objects[communicator->stringToIdentity("dummy")].proxy == obj);
+
+ obj = communicator->stringToProxy("dummy:tcp -p 10000 -h host");
+ admin->updateObject(obj);
+ objectObs1->waitForUpdate(__FILE__, __LINE__);
+ test(objectObs1->objects.find(communicator->stringToIdentity("dummy")) != objectObs1->objects.end());
+ test(objectObs1->objects[communicator->stringToIdentity("dummy")].type == "::Dummy");
+ test(objectObs1->objects[communicator->stringToIdentity("dummy")].proxy == obj);
+
+ admin->removeObject(obj->ice_getIdentity());
+ objectObs1->waitForUpdate(__FILE__, __LINE__);
+ test(objectObs1->objects.find(communicator->stringToIdentity("dummy")) == objectObs1->objects.end());
+ }
+ catch(const Ice::UserException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ session1->destroy();
+ adpt1->destroy();
+
+ cout << "ok" << endl;
}
{
-// cout << "???" << endl;
-
-// //
-// // Setup a descriptor to deploy a node on the node.
-// //
-// ApplicationDescriptor nodeApp;
-// nodeApp.name = "NodeApp";
-// ServerDescriptorPtr server = new ServerDescriptor();
-// server->id = "node-1";
-// server->exe = properties->getProperty("IceDir") + "/bin/icegridnode";
-// server->options.push_back("--nowarn");
-// server->pwd = ".";
-// AdapterDescriptor adapter;
-// adapter.name = "IceGrid.Node";
-// adapter.id = "IceGrid.Node.node-1";
-// adapter.registerProcess = true;
-// adapter.waitForActivation = false;
-// server->adapters.push_back(adapter);
-// addProperty(server, "IceGrid.Node.Name", "node-1");
-// addProperty(server, "IceGrid.Node.Data", properties->getProperty("TestDir") + "/db/node-1");
-// addProperty(server, "Ice.OA.IceGrid.Node.Endpoints", "default");
-// NodeDescriptor node;
-// node.servers.push_back(server);
-// nodeApp.nodes["localnode"] = node;
-
-// try
-// {
-// int s = session1->startUpdate();
-// test(s == serial);
-// admin1->addApplication(nodeApp);
-// appObs1->waitForUpdate(__FILE__, __LINE__); // application added
-// test(appObs1->applications.find("NodeApp") != appObs1->applications.end());
-// test(++serial == appObs1->serial);
-// }
-// catch(const DeploymentException& ex)
-// {
-// cerr << ex.reason << endl;
-// test(false);
-// }
-// catch(const Ice::UserException& ex)
-// {
-// cerr << ex << endl;
-// test(false);
-// }
-
-// try
-// {
-// admin->startServer("node-1");
-// }
-// catch(const NodeUnreachableException& ex)
-// {
-// cerr << ex << ":\n";
-// cerr << "node = " << ex.name << endl;
-// cerr << "reason = " << ex.reason << endl;
-// }
-// appObs1->waitForUpdate(__FILE__, __LINE__); // object added (for node well-known proxy)
-// test(++serial == appObs1->serial);
-
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
-// do
-// {
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeUp
-// }
-// while(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
-
-// try
-// {
-// admin->stopServer("node-1");
-// }
-// catch(const NodeUnreachableException& ex)
-// {
-// cerr << ex << ":\n";
-// cerr << "node = " << ex.name << endl;
-// cerr << "reason = " << ex.reason << endl;
-// }
-// appObs1->waitForUpdate(__FILE__, __LINE__); // object removed (for node well-known proxy)
-// test(++serial == appObs1->serial);
-
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeDown
-// test(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
-
-// try
-// {
-// admin1->removeApplication("NodeApp");
-// appObs1->waitForUpdate(__FILE__, __LINE__); // application removed
-// test(appObs1->applications.empty());
-// test(++serial == appObs1->serial);
-// }
-// catch(const DeploymentException& ex)
-// {
-// cerr << ex.reason << endl;
-// test(false);
-// }
-// catch(const Ice::UserException& ex)
-// {
-// cerr << ex << endl;
-// test(false);
-// }
-
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroying)
-// nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroyed)
-
-// session1->destroy();
-// adpt1->destroy();
-
-// cout << "ok" << endl;
+// cout << "???" << endl;
+
+// //
+// // Setup a descriptor to deploy a node on the node.
+// //
+// ApplicationDescriptor nodeApp;
+// nodeApp.name = "NodeApp";
+// ServerDescriptorPtr server = new ServerDescriptor();
+// server->id = "node-1";
+// server->exe = properties->getProperty("IceDir") + "/bin/icegridnode";
+// server->options.push_back("--nowarn");
+// server->pwd = ".";
+// AdapterDescriptor adapter;
+// adapter.name = "IceGrid.Node";
+// adapter.id = "IceGrid.Node.node-1";
+// adapter.registerProcess = true;
+// adapter.waitForActivation = false;
+// server->adapters.push_back(adapter);
+// addProperty(server, "IceGrid.Node.Name", "node-1");
+// addProperty(server, "IceGrid.Node.Data", properties->getProperty("TestDir") + "/db/node-1");
+// addProperty(server, "Ice.OA.IceGrid.Node.Endpoints", "default");
+// NodeDescriptor node;
+// node.servers.push_back(server);
+// nodeApp.nodes["localnode"] = node;
+
+// try
+// {
+// int s = session1->startUpdate();
+// test(s == serial);
+// admin1->addApplication(nodeApp);
+// appObs1->waitForUpdate(__FILE__, __LINE__); // application added
+// test(appObs1->applications.find("NodeApp") != appObs1->applications.end());
+// test(++serial == appObs1->serial);
+// }
+// catch(const DeploymentException& ex)
+// {
+// cerr << ex.reason << endl;
+// test(false);
+// }
+// catch(const Ice::UserException& ex)
+// {
+// cerr << ex << endl;
+// test(false);
+// }
+
+// try
+// {
+// admin->startServer("node-1");
+// }
+// catch(const NodeUnreachableException& ex)
+// {
+// cerr << ex << ":\n";
+// cerr << "node = " << ex.name << endl;
+// cerr << "reason = " << ex.reason << endl;
+// }
+// appObs1->waitForUpdate(__FILE__, __LINE__); // object added (for node well-known proxy)
+// test(++serial == appObs1->serial);
+
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
+// do
+// {
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeUp
+// }
+// while(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
+
+// try
+// {
+// admin->stopServer("node-1");
+// }
+// catch(const NodeUnreachableException& ex)
+// {
+// cerr << ex << ":\n";
+// cerr << "node = " << ex.name << endl;
+// cerr << "reason = " << ex.reason << endl;
+// }
+// appObs1->waitForUpdate(__FILE__, __LINE__); // object removed (for node well-known proxy)
+// test(++serial == appObs1->serial);
+
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // updateServer
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeDown
+// test(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
+
+// try
+// {
+// admin1->removeApplication("NodeApp");
+// appObs1->waitForUpdate(__FILE__, __LINE__); // application removed
+// test(appObs1->applications.empty());
+// test(++serial == appObs1->serial);
+// }
+// catch(const DeploymentException& ex)
+// {
+// cerr << ex.reason << endl;
+// test(false);
+// }
+// catch(const Ice::UserException& ex)
+// {
+// cerr << ex << endl;
+// test(false);
+// }
+
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroying)
+// nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroyed)
+
+// session1->destroy();
+// adpt1->destroy();
+
+// cout << "ok" << endl;
}
{
- cout << "testing node observer... " << flush;
- AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
-
- keepAlive->add(session1);
-
- Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
- ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.3");
- Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
- NodeObserverIPtr nodeObs1 = new NodeObserverI("nodeObs1");
- Ice::ObjectPrx no1 = adpt1->addWithUUID(nodeObs1);
- adpt1->activate();
- registry->ice_getConnection()->setAdapter(adpt1);
- session1->setObserversByIdentity(Ice::Identity(),
- no1->ice_getIdentity(),
- app1->ice_getIdentity(),
- Ice::Identity(),
- Ice::Identity());
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // init
-
- test(nodeObs1->nodes.find("localnode") != nodeObs1->nodes.end());
- test(appObs1->applications.empty());
-
- ApplicationDescriptor nodeApp;
- nodeApp.name = "NodeApp";
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "node-1";
- server->exe = properties->getProperty("IceDir") + "/bin/icegridnode";
- server->options.push_back("--nowarn");
- server->pwd = ".";
- AdapterDescriptor adapter;
- adapter.name = "IceGrid.Node";
- adapter.id = "IceGrid.Node.node-1";
- adapter.registerProcess = true;
- adapter.serverLifetime = false;
- server->adapters.push_back(adapter);
- addProperty(server, "IceGrid.Node.Name", "node-1");
- addProperty(server, "IceGrid.Node.Data", properties->getProperty("TestDir") + "/db/node-1");
- addProperty(server, "Ice.OA.IceGrid.Node.Endpoints", "default");
- NodeDescriptor node;
- node.servers.push_back(server);
- nodeApp.nodes["localnode"] = node;
-
- session->startUpdate();
- admin->addApplication(nodeApp);
- session->finishUpdate();
- appObs1->waitForUpdate(__FILE__, __LINE__);
-
- admin->startServer("node-1");
-
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- do
- {
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeUp
- }
- while(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
-
- test(nodeObs1->nodes["localnode"].servers.size() == 1);
- test(nodeObs1->nodes["localnode"].servers[0].state == Active);
- admin->stopServer("node-1");
-
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Deactivating)
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Inactive)
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeDown
- test(nodeObs1->nodes["localnode"].servers[0].state == Inactive);
-
- session->startUpdate();
- admin->removeApplication("NodeApp");
- session->finishUpdate();
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroying)
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroyed)
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
- test(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
-
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
-
- server = new ServerDescriptor();
- server->id = "Server";
- server->exe = properties->getProperty("TestDir") + "/server";
- server->pwd = ".";
- adapter.name = "Server";
- adapter.id = "ServerAdapter";
- adapter.registerProcess = true;
- adapter.serverLifetime = true;
- server->adapters.push_back(adapter);
- addProperty(server, "Ice.OA.Server.Endpoints", "default");
- node = NodeDescriptor();
- node.servers.push_back(server);
- testApp.nodes["localnode"] = node;
-
- session->startUpdate();
- admin->addApplication(testApp);
- session->finishUpdate();
- appObs1->waitForUpdate(__FILE__, __LINE__);
-
-
- session->startUpdate();
- admin->startServer("Server");
- session->finishUpdate();
-
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // adapterUpdate
-
- test(nodeObs1->nodes.find("localnode") != nodeObs1->nodes.end());
- test(nodeObs1->nodes["localnode"].servers.size() == 1);
- test(nodeObs1->nodes["localnode"].servers[0].state == Active);
- test(nodeObs1->nodes["localnode"].adapters.size() == 1);
- test(nodeObs1->nodes["localnode"].adapters[0].proxy);
-
- test(nodeObs1->nodes["localnode"].servers[0].enabled);
- admin->enableServer("Server", false);
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- test(!nodeObs1->nodes["localnode"].servers[0].enabled);
- admin->enableServer("Server", true);
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- test(nodeObs1->nodes["localnode"].servers[0].enabled);
-
- admin->stopServer("Server");
-
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // adapterUpdate
-
- test(nodeObs1->nodes.find("localnode") != nodeObs1->nodes.end());
- test(nodeObs1->nodes["localnode"].servers.size() == 1);
- test(nodeObs1->nodes["localnode"].servers[0].state == Inactive);
- test(nodeObs1->nodes["localnode"].adapters.empty());
-
- session->startUpdate();
- admin->removeApplication("TestApp");
- session->finishUpdate();
-
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroying)
- nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroyed)
- test(nodeObs1->nodes["localnode"].servers.empty());
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
-
- cout << "ok" << endl;
+ cout << "testing node observer... " << flush;
+ AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
+
+ keepAlive->add(session1);
+
+ Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
+ ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.3");
+ Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
+ NodeObserverIPtr nodeObs1 = new NodeObserverI("nodeObs1");
+ Ice::ObjectPrx no1 = adpt1->addWithUUID(nodeObs1);
+ adpt1->activate();
+ registry->ice_getConnection()->setAdapter(adpt1);
+ session1->setObserversByIdentity(Ice::Identity(),
+ no1->ice_getIdentity(),
+ app1->ice_getIdentity(),
+ Ice::Identity(),
+ Ice::Identity());
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // init
+
+ test(nodeObs1->nodes.find("localnode") != nodeObs1->nodes.end());
+ test(appObs1->applications.empty());
+
+ ApplicationDescriptor nodeApp;
+ nodeApp.name = "NodeApp";
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "node-1";
+ server->exe = properties->getProperty("IceDir") + "/bin/icegridnode";
+ server->options.push_back("--nowarn");
+ server->pwd = ".";
+ AdapterDescriptor adapter;
+ adapter.name = "IceGrid.Node";
+ adapter.id = "IceGrid.Node.node-1";
+ adapter.registerProcess = true;
+ adapter.serverLifetime = false;
+ server->adapters.push_back(adapter);
+ addProperty(server, "IceGrid.Node.Name", "node-1");
+ addProperty(server, "IceGrid.Node.Data", properties->getProperty("TestDir") + "/db/node-1");
+ addProperty(server, "Ice.OA.IceGrid.Node.Endpoints", "default");
+ NodeDescriptor node;
+ node.servers.push_back(server);
+ nodeApp.nodes["localnode"] = node;
+
+ session->startUpdate();
+ admin->addApplication(nodeApp);
+ session->finishUpdate();
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+
+ admin->startServer("node-1");
+
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ do
+ {
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeUp
+ }
+ while(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
+
+ test(nodeObs1->nodes["localnode"].servers.size() == 1);
+ test(nodeObs1->nodes["localnode"].servers[0].state == Active);
+ admin->stopServer("node-1");
+
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Deactivating)
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Inactive)
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // nodeDown
+ test(nodeObs1->nodes["localnode"].servers[0].state == Inactive);
+
+ session->startUpdate();
+ admin->removeApplication("NodeApp");
+ session->finishUpdate();
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroying)
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroyed)
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ test(nodeObs1->nodes.find("node-1") == nodeObs1->nodes.end());
+
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+
+ server = new ServerDescriptor();
+ server->id = "Server";
+ server->exe = properties->getProperty("TestDir") + "/server";
+ server->pwd = ".";
+ adapter.name = "Server";
+ adapter.id = "ServerAdapter";
+ adapter.registerProcess = true;
+ adapter.serverLifetime = true;
+ server->adapters.push_back(adapter);
+ addProperty(server, "Ice.OA.Server.Endpoints", "default");
+ node = NodeDescriptor();
+ node.servers.push_back(server);
+ testApp.nodes["localnode"] = node;
+
+ session->startUpdate();
+ admin->addApplication(testApp);
+ session->finishUpdate();
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+
+
+ session->startUpdate();
+ admin->startServer("Server");
+ session->finishUpdate();
+
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // adapterUpdate
+
+ test(nodeObs1->nodes.find("localnode") != nodeObs1->nodes.end());
+ test(nodeObs1->nodes["localnode"].servers.size() == 1);
+ test(nodeObs1->nodes["localnode"].servers[0].state == Active);
+ test(nodeObs1->nodes["localnode"].adapters.size() == 1);
+ test(nodeObs1->nodes["localnode"].adapters[0].proxy);
+
+ test(nodeObs1->nodes["localnode"].servers[0].enabled);
+ admin->enableServer("Server", false);
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ test(!nodeObs1->nodes["localnode"].servers[0].enabled);
+ admin->enableServer("Server", true);
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ test(nodeObs1->nodes["localnode"].servers[0].enabled);
+
+ admin->stopServer("Server");
+
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // adapterUpdate
+
+ test(nodeObs1->nodes.find("localnode") != nodeObs1->nodes.end());
+ test(nodeObs1->nodes["localnode"].servers.size() == 1);
+ test(nodeObs1->nodes["localnode"].servers[0].state == Inactive);
+ test(nodeObs1->nodes["localnode"].adapters.empty());
+
+ session->startUpdate();
+ admin->removeApplication("TestApp");
+ session->finishUpdate();
+
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroying)
+ nodeObs1->waitForUpdate(__FILE__, __LINE__); // serverUpdate(Destroyed)
+ test(nodeObs1->nodes["localnode"].servers.empty());
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+
+ cout << "ok" << endl;
}
{
- cout << "testing registry observer... " << flush;
- AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
-
- keepAlive->add(session1);
-
- Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
- ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.4");
- Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
- RegistryObserverIPtr registryObs1 = new RegistryObserverI("registryObs1");
- Ice::ObjectPrx ro1 = adpt1->addWithUUID(registryObs1);
- adpt1->activate();
- registry->ice_getConnection()->setAdapter(adpt1);
- session1->setObserversByIdentity(ro1->ice_getIdentity(),
- Ice::Identity(),
- app1->ice_getIdentity(),
- Ice::Identity(),
- Ice::Identity());
-
- appObs1->waitForUpdate(__FILE__, __LINE__);
- registryObs1->waitForUpdate(__FILE__, __LINE__); // init
-
- test(registryObs1->registries.find("Master") != registryObs1->registries.end());
- test(appObs1->applications.empty());
-
- QueryPrx query = QueryPrx::uncheckedCast(communicator->stringToProxy("IceGrid/Query"));
- Ice::ObjectProxySeq registries = query->findAllObjectsByType("::IceGrid::Registry");
- const string prefix("Registry-");
- for(Ice::ObjectProxySeq::const_iterator p = registries.begin(); p != registries.end(); ++p)
- {
- string name = (*p)->ice_getIdentity().name;
- string::size_type pos = name.find(prefix);
- if(pos != string::npos)
- {
- name = name.substr(prefix.size());
- test(registryObs1->registries.find(name) != registryObs1->registries.end());
- }
- }
- cout << "ok" << endl;
+ cout << "testing registry observer... " << flush;
+ AdminSessionPrx session1 = registry->createAdminSession("admin1", "test1");
+
+ keepAlive->add(session1);
+
+ Ice::ObjectAdapterPtr adpt1 = communicator->createObjectAdapter("");
+ ApplicationObserverIPtr appObs1 = new ApplicationObserverI("appObs1.4");
+ Ice::ObjectPrx app1 = adpt1->addWithUUID(appObs1);
+ RegistryObserverIPtr registryObs1 = new RegistryObserverI("registryObs1");
+ Ice::ObjectPrx ro1 = adpt1->addWithUUID(registryObs1);
+ adpt1->activate();
+ registry->ice_getConnection()->setAdapter(adpt1);
+ session1->setObserversByIdentity(ro1->ice_getIdentity(),
+ Ice::Identity(),
+ app1->ice_getIdentity(),
+ Ice::Identity(),
+ Ice::Identity());
+
+ appObs1->waitForUpdate(__FILE__, __LINE__);
+ registryObs1->waitForUpdate(__FILE__, __LINE__); // init
+
+ test(registryObs1->registries.find("Master") != registryObs1->registries.end());
+ test(appObs1->applications.empty());
+
+ QueryPrx query = QueryPrx::uncheckedCast(communicator->stringToProxy("IceGrid/Query"));
+ Ice::ObjectProxySeq registries = query->findAllObjectsByType("::IceGrid::Registry");
+ const string prefix("Registry-");
+ for(Ice::ObjectProxySeq::const_iterator p = registries.begin(); p != registries.end(); ++p)
+ {
+ string name = (*p)->ice_getIdentity().name;
+ string::size_type pos = name.find(prefix);
+ if(pos != string::npos)
+ {
+ name = name.substr(prefix.size());
+ test(registryObs1->registries.find(name) != registryObs1->registries.end());
+ }
+ }
+ cout << "ok" << endl;
}
diff --git a/cpp/test/IceGrid/session/Client.cpp b/cpp/test/IceGrid/session/Client.cpp
index 3074006cc71..a2b38017c27 100644
--- a/cpp/test/IceGrid/session/Client.cpp
+++ b/cpp/test/IceGrid/session/Client.cpp
@@ -27,30 +27,30 @@ main(int argc, char* argv[])
Ice::CommunicatorPtr communicator;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.Warn.Connections", "0");
- communicator = Ice::initialize(argc, argv, initData);
- communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
- status = run(argc, argv, communicator);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
+ communicator = Ice::initialize(argc, argv, initData);
+ communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/session/PermissionsVerifier.cpp b/cpp/test/IceGrid/session/PermissionsVerifier.cpp
index 11ce11e3e98..726464c29d4 100644
--- a/cpp/test/IceGrid/session/PermissionsVerifier.cpp
+++ b/cpp/test/IceGrid/session/PermissionsVerifier.cpp
@@ -20,13 +20,13 @@ public:
virtual bool
checkPermissions(const string& userId, const string& passwd, string&, const Ice::Current& c) const
{
- if(userId == "shutdown")
- {
- c.adapter->getCommunicator()->shutdown();
- return true;
- }
- return userId == "admin1" && passwd == "test1" || userId == "admin2" && passwd == "test2" ||
- userId == "admin3" && passwd == "test3";
+ if(userId == "shutdown")
+ {
+ c.adapter->getCommunicator()->shutdown();
+ return true;
+ }
+ return userId == "admin1" && passwd == "test1" || userId == "admin2" && passwd == "test2" ||
+ userId == "admin3" && passwd == "test3";
}
};
@@ -36,12 +36,12 @@ public:
virtual int run(int, char*[])
{
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints(
- "PermissionsVerifier", "tcp -p 12002");
- adapter->add(new AdminPermissionsVerifierI, communicator()->stringToIdentity("AdminPermissionsVerifier"));
- adapter->activate();
- communicator()->waitForShutdown();
- return EXIT_SUCCESS;
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints(
+ "PermissionsVerifier", "tcp -p 12002");
+ adapter->add(new AdminPermissionsVerifierI, communicator()->stringToIdentity("AdminPermissionsVerifier"));
+ adapter->activate();
+ communicator()->waitForShutdown();
+ return EXIT_SUCCESS;
}
};
diff --git a/cpp/test/IceGrid/session/Server.cpp b/cpp/test/IceGrid/session/Server.cpp
index a52ac4fa42e..c22cebc53ec 100644
--- a/cpp/test/IceGrid/session/Server.cpp
+++ b/cpp/test/IceGrid/session/Server.cpp
@@ -21,7 +21,7 @@ public:
virtual bool
checkPermissions(const string& userId, const string& passwd, string&, const Ice::Current&) const
{
- return userId == "client1" && passwd == "test1" || userId == "client2" && passwd == "test2";
+ return userId == "client1" && passwd == "test1" || userId == "client2" && passwd == "test2";
}
};
@@ -32,15 +32,15 @@ public:
virtual bool
authorize(const Glacier2::SSLInfo& info, string&, const Ice::Current& current) const
{
- IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
- test(cert->getIssuerDN() == IceSSL::DistinguishedName(
- "emailAddress=info@zeroc.com,CN=ZeroC Test CA,OU=Ice,O=ZeroC\\, Inc.,L=Palm Beach Gardens,"
- "ST=Florida,C=US"));
- test(cert->getSubjectDN() == IceSSL::DistinguishedName(
- "CN=Client,emailAddress=info@zeroc.com,OU=Ice,O=ZeroC\\, Inc.,ST=Florida,C=US"));
- test(cert->checkValidity());
+ IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
+ test(cert->getIssuerDN() == IceSSL::DistinguishedName(
+ "emailAddress=info@zeroc.com,CN=ZeroC Test CA,OU=Ice,O=ZeroC\\, Inc.,L=Palm Beach Gardens,"
+ "ST=Florida,C=US"));
+ test(cert->getSubjectDN() == IceSSL::DistinguishedName(
+ "CN=Client,emailAddress=info@zeroc.com,OU=Ice,O=ZeroC\\, Inc.,ST=Florida,C=US"));
+ test(cert->checkValidity());
- return true;
+ return true;
}
};
@@ -57,8 +57,8 @@ Server::run(int argc, char* argv[])
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Server");
if(communicator()->getProperties()->getPropertyAsInt("AddPermissionsVerifiers") > 0)
{
- adapter->add(new ClientPermissionsVerifierI(), communicator()->stringToIdentity("ClientPermissionsVerifier"));
- adapter->add(new SSLPermissionsVerifierI(), communicator()->stringToIdentity("SSLPermissionsVerifier"));
+ adapter->add(new ClientPermissionsVerifierI(), communicator()->stringToIdentity("ClientPermissionsVerifier"));
+ adapter->add(new SSLPermissionsVerifierI(), communicator()->stringToIdentity("SSLPermissionsVerifier"));
}
adapter->activate();
diff --git a/cpp/test/IceGrid/simple/AllTests.cpp b/cpp/test/IceGrid/simple/AllTests.cpp
index cf759e6d78f..a2e502ae1fc 100644
--- a/cpp/test/IceGrid/simple/AllTests.cpp
+++ b/cpp/test/IceGrid/simple/AllTests.cpp
@@ -22,7 +22,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -37,15 +37,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -116,31 +116,31 @@ allTestsWithDeploy(const Ice::CommunicatorPtr& communicator)
cout << "testing reference with unknown identity... " << flush;
try
{
- communicator->stringToProxy("unknown/unknown")->ice_ping();
- test(false);
+ communicator->stringToProxy("unknown/unknown")->ice_ping();
+ test(false);
}
catch (const Ice::NotRegisteredException& ex)
{
- test(ex.kindOfObject == "object");
- test(ex.id == "unknown/unknown");
+ test(ex.kindOfObject == "object");
+ test(ex.id == "unknown/unknown");
}
cout << "ok" << endl;
cout << "testing reference with unknown adapter... " << flush;
try
{
- communicator->stringToProxy("test @ TestAdapterUnknown")->ice_ping();
- test(false);
+ communicator->stringToProxy("test @ TestAdapterUnknown")->ice_ping();
+ test(false);
}
catch (const Ice::NotRegisteredException& ex)
{
- test(ex.kindOfObject == "object adapter");
- test(ex.id == "TestAdapterUnknown");
+ test(ex.kindOfObject == "object adapter");
+ test(ex.id == "TestAdapterUnknown");
}
cout << "ok" << endl;
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
- communicator->stringToProxy("IceGrid/Registry"));
+ communicator->stringToProxy("IceGrid/Registry"));
test(registry);
IceGrid::AdminSessionPrx session = registry->createAdminSession("foo", "bar");
@@ -156,16 +156,16 @@ allTestsWithDeploy(const Ice::CommunicatorPtr& communicator)
cout << "testing whether server is still reachable... " << flush;
try
{
- obj = TestIntfPrx::checkedCast(base);
- test(false);
+ obj = TestIntfPrx::checkedCast(base);
+ test(false);
}
catch(const Ice::NoEndpointException&)
{
}
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- test(false);
+ obj2 = TestIntfPrx::checkedCast(base2);
+ test(false);
}
catch(const Ice::NoEndpointException&)
{
@@ -175,19 +175,19 @@ allTestsWithDeploy(const Ice::CommunicatorPtr& communicator)
try
{
- obj = TestIntfPrx::checkedCast(base);
+ obj = TestIntfPrx::checkedCast(base);
}
catch(const Ice::NoEndpointException&)
{
- test(false);
+ test(false);
}
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
+ obj2 = TestIntfPrx::checkedCast(base2);
}
catch(const Ice::NoEndpointException&)
{
- test(false);
+ test(false);
}
cout << "ok" << endl;
diff --git a/cpp/test/IceGrid/simple/Client.cpp b/cpp/test/IceGrid/simple/Client.cpp
index 57499a1d856..57c7ae95e38 100644
--- a/cpp/test/IceGrid/simple/Client.cpp
+++ b/cpp/test/IceGrid/simple/Client.cpp
@@ -22,22 +22,22 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
for(int i = 1; i < argc; ++i)
{
- if(strcmp(argv[i], "--with-deploy") == 0)
- {
- withDeploy = true;
- break;
- }
+ if(strcmp(argv[i], "--with-deploy") == 0)
+ {
+ withDeploy = true;
+ break;
+ }
}
if(!withDeploy)
{
- void allTests(const Ice::CommunicatorPtr&);
- allTests(communicator);
+ void allTests(const Ice::CommunicatorPtr&);
+ allTests(communicator);
}
else
{
- void allTestsWithDeploy(const Ice::CommunicatorPtr&);
- allTestsWithDeploy(communicator);
+ void allTestsWithDeploy(const Ice::CommunicatorPtr&);
+ allTestsWithDeploy(communicator);
}
return EXIT_SUCCESS;
@@ -52,26 +52,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/simple/Server.cpp b/cpp/test/IceGrid/simple/Server.cpp
index 17146db154f..0a54b1a3a77 100644
--- a/cpp/test/IceGrid/simple/Server.cpp
+++ b/cpp/test/IceGrid/simple/Server.cpp
@@ -34,7 +34,7 @@ Server::run(int argc, char* argv[])
shutdownOnInterrupt();
try
{
- adapter->activate();
+ adapter->activate();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
diff --git a/cpp/test/IceGrid/simple/run.py b/cpp/test/IceGrid/simple/run.py
index e6a9b24de2d..adda46062b3 100755
--- a/cpp/test/IceGrid/simple/run.py
+++ b/cpp/test/IceGrid/simple/run.py
@@ -27,7 +27,7 @@ name = os.path.join("IceGrid", "simple")
# Test client/server without on demand activation.
#
IceGridAdmin.iceGridClientServerTest(name, "", "--Ice.OA.TestAdapter.Endpoints=default" + \
- " --Ice.OA.TestAdapter.AdapterId=TestAdapter")
+ " --Ice.OA.TestAdapter.AdapterId=TestAdapter")
#
# Test client/server with on demand activation.
diff --git a/cpp/test/IceGrid/update/AllTests.cpp b/cpp/test/IceGrid/update/AllTests.cpp
index 4ab8362766c..37ceba2b818 100644
--- a/cpp/test/IceGrid/update/AllTests.cpp
+++ b/cpp/test/IceGrid/update/AllTests.cpp
@@ -24,7 +24,7 @@ class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<I
public:
SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- _session(session),
+ _session(session),
_timeout(IceUtil::Time::seconds(timeout)),
_destroy(false)
{
@@ -39,15 +39,15 @@ public:
timedWait(_timeout);
if(_destroy)
{
- break;
- }
+ break;
+ }
try
{
_session->keepAlive();
}
catch(const Ice::Exception&)
{
- break;
+ break;
}
}
}
@@ -82,10 +82,10 @@ getProperty(const PropertyDescriptorSeq& properties, const string& name)
{
for(PropertyDescriptorSeq::const_iterator q = properties.begin(); q != properties.end(); ++q)
{
- if(q->name == name)
- {
- return q->value;
- }
+ if(q->name == name)
+ {
+ return q->value;
+ }
}
return "";
}
@@ -103,12 +103,12 @@ bool
hasProperty(const CommunicatorDescriptorPtr& desc, const string& name, const string& value)
{
for(PropertyDescriptorSeq::const_iterator p = desc->propertySet.properties.begin();
- p != desc->propertySet.properties.end(); ++p)
+ p != desc->propertySet.properties.end(); ++p)
{
- if(p->name == name)
- {
- return p->value == value;
- }
+ if(p->name == name)
+ {
+ return p->value == value;
+ }
}
return false;
}
@@ -117,7 +117,7 @@ void
allTests(const Ice::CommunicatorPtr& communicator)
{
RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
- communicator->stringToProxy("IceGrid/Registry"));
+ communicator->stringToProxy("IceGrid/Registry"));
test(registry);
AdminSessionPrx session = registry->createAdminSession("foo", "bar");
@@ -130,1085 +130,1085 @@ allTests(const Ice::CommunicatorPtr& communicator)
Ice::PropertiesPtr properties = communicator->getProperties();
{
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
- admin->addApplication(testApp);
-
- ApplicationUpdateDescriptor empty;
- empty.name = "TestApp";
- NodeUpdateDescriptor node;
- node.name = "localnode";
- empty.nodes.push_back(node);
-
- ApplicationUpdateDescriptor update = empty;
-
- cout << "testing server add... " << flush;
-
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "Server";
- server->exe = properties->getProperty("TestDir") + "/server";
- server->pwd = ".";
- AdapterDescriptor adapter;
- adapter.name = "Server";
- adapter.id = "ServerAdapter";
- adapter.registerProcess = true;
- addProperty(server, "Ice.OA.Server.Endpoints", "default");
- ObjectDescriptor object;
- object.id = communicator->stringToIdentity("test");
- object.type = "::Test::TestIntf";
- adapter.objects.push_back(object);
- server->adapters.push_back(adapter);
- update.nodes[0].servers.push_back(server);
- admin->updateApplication(update);
-
- update.nodes[0].servers[0]->id = "Server2";
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Adapter already exists
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update.nodes[0].servers[0]->adapters[0].id = "ServerAdapter2";
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Object already exists
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update.nodes[0].servers[0]->adapters[0].objects[0].id = communicator->stringToIdentity("test2");
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- TemplateDescriptor templ;
- templ.parameters.push_back("name");
- templ.descriptor = new ServerDescriptor();
- server = ServerDescriptorPtr::dynamicCast(templ.descriptor);
- server->id = "${name}";
- server->exe = "${test.dir}/server";
- server->pwd = ".";
- adapter = AdapterDescriptor();
- adapter.name = "Server";
- adapter.id = "${server}";
- adapter.registerProcess = true;
- addProperty(server, "Ice.OA.Server.Endpoints", "default");
- object = ObjectDescriptor();
- object.id = communicator->stringToIdentity("${server}");
- object.type = "::Test::TestIntf";
- adapter.objects.push_back(object);
- server->adapters.push_back(adapter);
- update = empty;
- update.serverTemplates["ServerTemplate"] = templ;
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update = empty;
- ServerInstanceDescriptor instance;
- instance._cpp_template = "ServerTemplate";
- update.nodes[0].serverInstances.push_back(instance);
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Missing parameter
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update = empty;
- update.variables["test.dir"] = properties->getProperty("TestDir");
- update.variables["variable"] = "";
- instance = ServerInstanceDescriptor();
- instance._cpp_template = "ServerTemplate";
- instance.parameterValues["name"] = "Server1";
- update.nodes[0].serverInstances.push_back(instance);
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- cout << "ok" << endl;
-
- cout << "testing server remove... " << flush;
- update = empty;
- update.nodes[0].removeServers.push_back("Server2");
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- try
- {
- admin->getServerInfo("Server2");
- test(false);
- }
- catch(const ServerNotExistException&)
- {
- }
-
- try
- {
- admin->updateApplication(update);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update = empty;
- update.removeServerTemplates.push_back("ServerTemplate");
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Server without template!
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update = empty;
- update.nodes[0].removeServers.push_back("Server1");
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- try
- {
- admin->getServerInfo("Server1");
- test(false);
- }
- catch(const ServerNotExistException&)
- {
- }
-
- update = empty;
- update.removeServerTemplates.push_back("ServerTemplate");
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- cout << "ok" << endl;
-
- cout << "testing server update... " << flush;
-
- ServerInfo info = admin->getServerInfo("Server");
- test(info.descriptor);
- addProperty(info.descriptor, "test", "test");
- update = empty;
- update.nodes[0].servers.push_back(info.descriptor);
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- info = admin->getServerInfo("Server");
- test(info.descriptor);
- test(getProperty(info.descriptor->propertySet.properties, "test") == "test");
-
- update = empty;
- update.serverTemplates["ServerTemplate"] = templ;
- instance = ServerInstanceDescriptor();
- instance._cpp_template = "ServerTemplate";
- instance.parameterValues["name"] = "Server1";
- update.nodes[0].serverInstances.push_back(instance);
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update = empty;
- addProperty(server, "test", "test");
- assert(templ.descriptor == server);
- update.serverTemplates["ServerTemplate"] = templ;
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- info = admin->getServerInfo("Server1");
- test(info.descriptor);
- test(getProperty(info.descriptor->propertySet.properties, "test") == "test");
-
- info = admin->getServerInfo("Server");
- test(info.descriptor);
- adapter = AdapterDescriptor();
- adapter.id = "Server1";
- info.descriptor->adapters.push_back(adapter);
- update = empty;
- update.nodes[0].servers.push_back(info.descriptor);
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Adapter already exists
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- info = admin->getServerInfo("Server");
- test(info.descriptor);
- adapter = AdapterDescriptor();
- adapter.id = "ServerX";
- object = ObjectDescriptor();
- object.id = communicator->stringToIdentity("test");
- adapter.objects.push_back(object);
- info.descriptor->adapters.push_back(adapter);
- update = empty;
- update.nodes[0].servers.push_back(info.descriptor);
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Object already exists
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- cout << "ok" << endl;
-
- admin->removeApplication("TestApp");
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+ admin->addApplication(testApp);
+
+ ApplicationUpdateDescriptor empty;
+ empty.name = "TestApp";
+ NodeUpdateDescriptor node;
+ node.name = "localnode";
+ empty.nodes.push_back(node);
+
+ ApplicationUpdateDescriptor update = empty;
+
+ cout << "testing server add... " << flush;
+
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "Server";
+ server->exe = properties->getProperty("TestDir") + "/server";
+ server->pwd = ".";
+ AdapterDescriptor adapter;
+ adapter.name = "Server";
+ adapter.id = "ServerAdapter";
+ adapter.registerProcess = true;
+ addProperty(server, "Ice.OA.Server.Endpoints", "default");
+ ObjectDescriptor object;
+ object.id = communicator->stringToIdentity("test");
+ object.type = "::Test::TestIntf";
+ adapter.objects.push_back(object);
+ server->adapters.push_back(adapter);
+ update.nodes[0].servers.push_back(server);
+ admin->updateApplication(update);
+
+ update.nodes[0].servers[0]->id = "Server2";
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Adapter already exists
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update.nodes[0].servers[0]->adapters[0].id = "ServerAdapter2";
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Object already exists
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update.nodes[0].servers[0]->adapters[0].objects[0].id = communicator->stringToIdentity("test2");
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ TemplateDescriptor templ;
+ templ.parameters.push_back("name");
+ templ.descriptor = new ServerDescriptor();
+ server = ServerDescriptorPtr::dynamicCast(templ.descriptor);
+ server->id = "${name}";
+ server->exe = "${test.dir}/server";
+ server->pwd = ".";
+ adapter = AdapterDescriptor();
+ adapter.name = "Server";
+ adapter.id = "${server}";
+ adapter.registerProcess = true;
+ addProperty(server, "Ice.OA.Server.Endpoints", "default");
+ object = ObjectDescriptor();
+ object.id = communicator->stringToIdentity("${server}");
+ object.type = "::Test::TestIntf";
+ adapter.objects.push_back(object);
+ server->adapters.push_back(adapter);
+ update = empty;
+ update.serverTemplates["ServerTemplate"] = templ;
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update = empty;
+ ServerInstanceDescriptor instance;
+ instance._cpp_template = "ServerTemplate";
+ update.nodes[0].serverInstances.push_back(instance);
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Missing parameter
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update = empty;
+ update.variables["test.dir"] = properties->getProperty("TestDir");
+ update.variables["variable"] = "";
+ instance = ServerInstanceDescriptor();
+ instance._cpp_template = "ServerTemplate";
+ instance.parameterValues["name"] = "Server1";
+ update.nodes[0].serverInstances.push_back(instance);
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ cout << "ok" << endl;
+
+ cout << "testing server remove... " << flush;
+ update = empty;
+ update.nodes[0].removeServers.push_back("Server2");
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ try
+ {
+ admin->getServerInfo("Server2");
+ test(false);
+ }
+ catch(const ServerNotExistException&)
+ {
+ }
+
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update = empty;
+ update.removeServerTemplates.push_back("ServerTemplate");
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Server without template!
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update = empty;
+ update.nodes[0].removeServers.push_back("Server1");
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ try
+ {
+ admin->getServerInfo("Server1");
+ test(false);
+ }
+ catch(const ServerNotExistException&)
+ {
+ }
+
+ update = empty;
+ update.removeServerTemplates.push_back("ServerTemplate");
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ cout << "testing server update... " << flush;
+
+ ServerInfo info = admin->getServerInfo("Server");
+ test(info.descriptor);
+ addProperty(info.descriptor, "test", "test");
+ update = empty;
+ update.nodes[0].servers.push_back(info.descriptor);
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ info = admin->getServerInfo("Server");
+ test(info.descriptor);
+ test(getProperty(info.descriptor->propertySet.properties, "test") == "test");
+
+ update = empty;
+ update.serverTemplates["ServerTemplate"] = templ;
+ instance = ServerInstanceDescriptor();
+ instance._cpp_template = "ServerTemplate";
+ instance.parameterValues["name"] = "Server1";
+ update.nodes[0].serverInstances.push_back(instance);
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update = empty;
+ addProperty(server, "test", "test");
+ assert(templ.descriptor == server);
+ update.serverTemplates["ServerTemplate"] = templ;
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ info = admin->getServerInfo("Server1");
+ test(info.descriptor);
+ test(getProperty(info.descriptor->propertySet.properties, "test") == "test");
+
+ info = admin->getServerInfo("Server");
+ test(info.descriptor);
+ adapter = AdapterDescriptor();
+ adapter.id = "Server1";
+ info.descriptor->adapters.push_back(adapter);
+ update = empty;
+ update.nodes[0].servers.push_back(info.descriptor);
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Adapter already exists
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ info = admin->getServerInfo("Server");
+ test(info.descriptor);
+ adapter = AdapterDescriptor();
+ adapter.id = "ServerX";
+ object = ObjectDescriptor();
+ object.id = communicator->stringToIdentity("test");
+ adapter.objects.push_back(object);
+ info.descriptor->adapters.push_back(adapter);
+ update = empty;
+ update.nodes[0].servers.push_back(info.descriptor);
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Object already exists
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ admin->removeApplication("TestApp");
}
{
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
- admin->addApplication(testApp);
-
- ApplicationUpdateDescriptor empty;
- empty.name = "TestApp";
- NodeUpdateDescriptor node;
- node.name = "localnode";
- empty.nodes.push_back(node);
-
- ApplicationUpdateDescriptor update = empty;
-
- cout << "testing icebox server add... " << flush;
-
- ServiceDescriptorPtr service = new ServiceDescriptor();
- service->name = "Service1";
- service->entry = "TestService:create";
- AdapterDescriptor adapter;
- adapter.name = "${service}";
- adapter.id = "${server}.${service}";
- adapter.registerProcess = true;
- addProperty(service, "Ice.OA.${service}.Endpoints", "default");
- service->adapters.push_back(adapter);
-
- IceBoxDescriptorPtr server = new IceBoxDescriptor();
- server->id = "IceBox";
- server->exe = properties->getProperty("IceDir") + "/bin/icebox";
- server->services.resize(3);
- server->services[0].descriptor = ServiceDescriptorPtr::dynamicCast(service->ice_clone());
- service->name = "Service2";
- server->services[1].descriptor = ServiceDescriptorPtr::dynamicCast(service->ice_clone());
- service->name = "Service3";
- server->services[2].descriptor = ServiceDescriptorPtr::dynamicCast(service->ice_clone());
-
- update.nodes[0].servers.push_back(server);
- try
- {
- admin->updateApplication(update);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- cout << "ok" << endl;
-
- cout << "testing service add... " << flush;
- service->name = "First";
- server->services.resize(4);
- server->services[3].descriptor = service;
- try
- {
- admin->updateApplication(update);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- cout << "ok" << endl;
-
- cout << "testing service remove... " << flush;
- server->services.resize(3);
- try
- {
- admin->updateApplication(update);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- cout << "ok" << endl;
-
- admin->removeApplication("TestApp");
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+ admin->addApplication(testApp);
+
+ ApplicationUpdateDescriptor empty;
+ empty.name = "TestApp";
+ NodeUpdateDescriptor node;
+ node.name = "localnode";
+ empty.nodes.push_back(node);
+
+ ApplicationUpdateDescriptor update = empty;
+
+ cout << "testing icebox server add... " << flush;
+
+ ServiceDescriptorPtr service = new ServiceDescriptor();
+ service->name = "Service1";
+ service->entry = "TestService:create";
+ AdapterDescriptor adapter;
+ adapter.name = "${service}";
+ adapter.id = "${server}.${service}";
+ adapter.registerProcess = true;
+ addProperty(service, "Ice.OA.${service}.Endpoints", "default");
+ service->adapters.push_back(adapter);
+
+ IceBoxDescriptorPtr server = new IceBoxDescriptor();
+ server->id = "IceBox";
+ server->exe = properties->getProperty("IceDir") + "/bin/icebox";
+ server->services.resize(3);
+ server->services[0].descriptor = ServiceDescriptorPtr::dynamicCast(service->ice_clone());
+ service->name = "Service2";
+ server->services[1].descriptor = ServiceDescriptorPtr::dynamicCast(service->ice_clone());
+ service->name = "Service3";
+ server->services[2].descriptor = ServiceDescriptorPtr::dynamicCast(service->ice_clone());
+
+ update.nodes[0].servers.push_back(server);
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ cout << "testing service add... " << flush;
+ service->name = "First";
+ server->services.resize(4);
+ server->services[3].descriptor = service;
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ cout << "testing service remove... " << flush;
+ server->services.resize(3);
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ cout << "ok" << endl;
+
+ admin->removeApplication("TestApp");
}
{
- cout << "testing node add... " << flush;
-
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
- NodeDescriptor node;
- node.variables["nodename"] = "node1";
- testApp.nodes["node1"] = node;
-
- try
- {
- admin->addApplication(testApp);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- ApplicationUpdateDescriptor update;
- update.name = "TestApp";
- NodeUpdateDescriptor nodeUpdate;
- nodeUpdate.name = "node2";
- nodeUpdate.variables["nodename"] = "node2";
- update.nodes.push_back(nodeUpdate);
-
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- testApp = admin->getApplicationInfo("TestApp").descriptor;
- test(testApp.nodes.size() == 2);
- test(testApp.nodes["node1"].variables["nodename"] == "node1");
- test(testApp.nodes["node2"].variables["nodename"] == "node2");
- cout << "ok" << endl;
-
- cout << "testing node update... " << flush;
-
- nodeUpdate.name = "node2";
- nodeUpdate.variables["nodename"] = "node2updated";
- update.nodes.back() = nodeUpdate;
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- testApp = admin->getApplicationInfo("TestApp").descriptor;
- test(testApp.nodes.size() == 2);
- test(testApp.nodes["node1"].variables["nodename"] == "node1");
- test(testApp.nodes["node2"].variables["nodename"] == "node2updated");
-
- cout << "ok" << endl;
-
- cout << "testing node remove... " << flush;
-
- update.nodes.clear();
- update.removeNodes.push_back("node1");
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- testApp = admin->getApplicationInfo("TestApp").descriptor;
- test(testApp.nodes.size() == 1);
- test(testApp.nodes["node2"].variables["nodename"] == "node2updated");
-
- admin->removeApplication("TestApp");
-
- cout << "ok" << endl;
- }
+ cout << "testing node add... " << flush;
+
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+ NodeDescriptor node;
+ node.variables["nodename"] = "node1";
+ testApp.nodes["node1"] = node;
+
+ try
+ {
+ admin->addApplication(testApp);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ ApplicationUpdateDescriptor update;
+ update.name = "TestApp";
+ NodeUpdateDescriptor nodeUpdate;
+ nodeUpdate.name = "node2";
+ nodeUpdate.variables["nodename"] = "node2";
+ update.nodes.push_back(nodeUpdate);
+
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ testApp = admin->getApplicationInfo("TestApp").descriptor;
+ test(testApp.nodes.size() == 2);
+ test(testApp.nodes["node1"].variables["nodename"] == "node1");
+ test(testApp.nodes["node2"].variables["nodename"] == "node2");
+ cout << "ok" << endl;
+
+ cout << "testing node update... " << flush;
+
+ nodeUpdate.name = "node2";
+ nodeUpdate.variables["nodename"] = "node2updated";
+ update.nodes.back() = nodeUpdate;
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ testApp = admin->getApplicationInfo("TestApp").descriptor;
+ test(testApp.nodes.size() == 2);
+ test(testApp.nodes["node1"].variables["nodename"] == "node1");
+ test(testApp.nodes["node2"].variables["nodename"] == "node2updated");
+
+ cout << "ok" << endl;
+
+ cout << "testing node remove... " << flush;
+
+ update.nodes.clear();
+ update.removeNodes.push_back("node1");
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ testApp = admin->getApplicationInfo("TestApp").descriptor;
+ test(testApp.nodes.size() == 1);
+ test(testApp.nodes["node2"].variables["nodename"] == "node2updated");
+
+ admin->removeApplication("TestApp");
+
+ cout << "ok" << endl;
+ }
{
- cout << "testing variable update... " << flush;
-
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "${name}";
- server->exe = "server";
- server->pwd = ".";
-
- addProperty(server, "ApplicationVar", "${appvar}");
- addProperty(server, "NodeVar", "${nodevar}");
- addProperty(server, "ServerParamVar", "${serverparamvar}");
-
- TemplateDescriptor templ;
- templ.parameters.push_back("name");
- templ.parameters.push_back("serverparamvar");
- templ.descriptor = server;
-
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
- testApp.variables["appvar"] = "AppValue";
- testApp.serverTemplates["ServerTemplate"] = templ;
-
- NodeDescriptor node;
- node.variables["nodevar"] = "NodeValue";
-
- ServerInstanceDescriptor serverInstance;
- serverInstance._cpp_template = "ServerTemplate";
- serverInstance.parameterValues["name"] = "Server";
- serverInstance.parameterValues["serverparamvar"] = "ServerParamValue";
- node.serverInstances.push_back(serverInstance);
-
- testApp.nodes["node1"] = node;
-
- try
- {
- admin->addApplication(testApp);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- ApplicationUpdateDescriptor empty;
- empty.name = "TestApp";
- ApplicationUpdateDescriptor update = empty;
- update.removeVariables.push_back("appvar");
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Missing app variable
- //cerr << ex.reason << endl;
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update = empty;
- NodeUpdateDescriptor nodeUpdate;
- nodeUpdate.name = "node1";
- nodeUpdate.removeVariables.push_back("nodevar");
- update.nodes.push_back(nodeUpdate);
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Missing node variable
- //cerr << ex.reason << endl;
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- update = empty;
- serverInstance = ServerInstanceDescriptor();
- serverInstance._cpp_template = "ServerTemplate";
- serverInstance.parameterValues["name"] = "Server";
- nodeUpdate = NodeUpdateDescriptor();
- nodeUpdate.name = "node1";
- nodeUpdate.serverInstances.push_back(serverInstance);
- update.nodes.push_back(nodeUpdate);
- try
- {
- admin->updateApplication(update);
- test(false);
- }
- catch(const DeploymentException&)
- {
- // Missing parameter
- //cerr << ex.reason << endl;
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- ServerInfo serverBefore = admin->getServerInfo("Server");
- ApplicationDescriptor origApp = admin->getApplicationInfo("TestApp").descriptor;
-
- update = empty;
- update.variables["nodevar"] = "appoverride";
- nodeUpdate = NodeUpdateDescriptor();
- nodeUpdate.name = "node1";
- nodeUpdate.variables["serverparamvar"] = "nodeoverride";
- update.nodes.push_back(nodeUpdate);
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- ServerInfo serverAfter = admin->getServerInfo("Server");
- test(serverBefore.descriptor->propertySet == serverAfter.descriptor->propertySet);
-
- update = empty;
- nodeUpdate = NodeUpdateDescriptor();
- nodeUpdate.name = "node1";
- nodeUpdate.variables["appvar"] = "nodeoverride";
- update.nodes.push_back(nodeUpdate);
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- serverAfter = admin->getServerInfo("Server");
- PropertyDescriptorSeq newProps = serverAfter.descriptor->propertySet.properties;
- test(getProperty(serverAfter.descriptor->propertySet.properties, "ApplicationVar") == "nodeoverride");
- test(getProperty(serverAfter.descriptor->propertySet.properties, "NodeVar") == "NodeValue");
- test(getProperty(serverAfter.descriptor->propertySet.properties, "ServerParamVar") == "ServerParamValue");
- admin->removeApplication("TestApp");
- cout << "ok" << endl;
+ cout << "testing variable update... " << flush;
+
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "${name}";
+ server->exe = "server";
+ server->pwd = ".";
+
+ addProperty(server, "ApplicationVar", "${appvar}");
+ addProperty(server, "NodeVar", "${nodevar}");
+ addProperty(server, "ServerParamVar", "${serverparamvar}");
+
+ TemplateDescriptor templ;
+ templ.parameters.push_back("name");
+ templ.parameters.push_back("serverparamvar");
+ templ.descriptor = server;
+
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+ testApp.variables["appvar"] = "AppValue";
+ testApp.serverTemplates["ServerTemplate"] = templ;
+
+ NodeDescriptor node;
+ node.variables["nodevar"] = "NodeValue";
+
+ ServerInstanceDescriptor serverInstance;
+ serverInstance._cpp_template = "ServerTemplate";
+ serverInstance.parameterValues["name"] = "Server";
+ serverInstance.parameterValues["serverparamvar"] = "ServerParamValue";
+ node.serverInstances.push_back(serverInstance);
+
+ testApp.nodes["node1"] = node;
+
+ try
+ {
+ admin->addApplication(testApp);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ ApplicationUpdateDescriptor empty;
+ empty.name = "TestApp";
+ ApplicationUpdateDescriptor update = empty;
+ update.removeVariables.push_back("appvar");
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Missing app variable
+ //cerr << ex.reason << endl;
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update = empty;
+ NodeUpdateDescriptor nodeUpdate;
+ nodeUpdate.name = "node1";
+ nodeUpdate.removeVariables.push_back("nodevar");
+ update.nodes.push_back(nodeUpdate);
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Missing node variable
+ //cerr << ex.reason << endl;
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ update = empty;
+ serverInstance = ServerInstanceDescriptor();
+ serverInstance._cpp_template = "ServerTemplate";
+ serverInstance.parameterValues["name"] = "Server";
+ nodeUpdate = NodeUpdateDescriptor();
+ nodeUpdate.name = "node1";
+ nodeUpdate.serverInstances.push_back(serverInstance);
+ update.nodes.push_back(nodeUpdate);
+ try
+ {
+ admin->updateApplication(update);
+ test(false);
+ }
+ catch(const DeploymentException&)
+ {
+ // Missing parameter
+ //cerr << ex.reason << endl;
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ ServerInfo serverBefore = admin->getServerInfo("Server");
+ ApplicationDescriptor origApp = admin->getApplicationInfo("TestApp").descriptor;
+
+ update = empty;
+ update.variables["nodevar"] = "appoverride";
+ nodeUpdate = NodeUpdateDescriptor();
+ nodeUpdate.name = "node1";
+ nodeUpdate.variables["serverparamvar"] = "nodeoverride";
+ update.nodes.push_back(nodeUpdate);
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ ServerInfo serverAfter = admin->getServerInfo("Server");
+ test(serverBefore.descriptor->propertySet == serverAfter.descriptor->propertySet);
+
+ update = empty;
+ nodeUpdate = NodeUpdateDescriptor();
+ nodeUpdate.name = "node1";
+ nodeUpdate.variables["appvar"] = "nodeoverride";
+ update.nodes.push_back(nodeUpdate);
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ serverAfter = admin->getServerInfo("Server");
+ PropertyDescriptorSeq newProps = serverAfter.descriptor->propertySet.properties;
+ test(getProperty(serverAfter.descriptor->propertySet.properties, "ApplicationVar") == "nodeoverride");
+ test(getProperty(serverAfter.descriptor->propertySet.properties, "NodeVar") == "NodeValue");
+ test(getProperty(serverAfter.descriptor->propertySet.properties, "ServerParamVar") == "ServerParamValue");
+ admin->removeApplication("TestApp");
+ cout << "ok" << endl;
}
{
- cout << "testing property set update... " << flush;
-
- ServiceDescriptorPtr service = new ServiceDescriptor();
- service->name = "${name}";
- service->entry = "dummy";
- addProperty(service, "ServiceProp", "test");
-
- TemplateDescriptor svcTempl;
- svcTempl.parameters.push_back("name");
- svcTempl.descriptor = service;
-
- ServiceInstanceDescriptor serviceInstance;
- serviceInstance._cpp_template = "ServiceTemplate";
- serviceInstance.parameterValues["name"] = "Service";
- serviceInstance.propertySet.properties.push_back(createProperty("ServiceInstanceProp", "test"));
-
- IceBoxDescriptorPtr server = new IceBoxDescriptor();
- server->id = "${name}";
- server->exe = "server";
- server->pwd = ".";
- server->propertySet.references.push_back("ApplicationPropertySet");
- server->propertySet.references.push_back("NodePropertySet");
- addProperty(server, "ServerProp", "test");
- server->services.push_back(serviceInstance);
-
- TemplateDescriptor templ;
- templ.parameters.push_back("name");
- templ.descriptor = server;
-
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
- testApp.variables["appvar"] = "AppValue";
- testApp.serverTemplates["ServerTemplate"] = templ;
- testApp.serviceTemplates["ServiceTemplate"] = svcTempl;
- testApp.propertySets["ApplicationPropertySet"].properties.push_back(createProperty("ApplicationProp","test"));
- testApp.propertySets["ApplicationPropertySet1"].properties.push_back(createProperty("ApplicationProp", "d"));
-
- NodeDescriptor node;
- node.variables["nodevar"] = "NodeValue";
- node.propertySets["NodePropertySet"].properties.push_back(createProperty("NodeProp", "test"));
- node.propertySets["NodePropertySet1"].properties.push_back(createProperty("NodeProp", "test"));
-
- ServerInstanceDescriptor serverInstance;
- serverInstance._cpp_template = "ServerTemplate";
- serverInstance.parameterValues["name"] = "Server";
- serverInstance.propertySet.properties.push_back(createProperty("ServerInstanceProp", "test"));
- node.serverInstances.push_back(serverInstance);
-
- testApp.nodes["node1"] = node;
-
- try
- {
- admin->addApplication(testApp);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- ServerInfo info = admin->getServerInfo("Server");
- test(hasProperty(info.descriptor, "ServerProp", "test"));
- test(hasProperty(info.descriptor, "NodeProp", "test"));
- test(hasProperty(info.descriptor, "ApplicationProp", "test"));
- test(hasProperty(info.descriptor, "ServerInstanceProp", "test"));
-
- ServiceDescriptorPtr svc = IceBoxDescriptorPtr::dynamicCast(info.descriptor)->services[0].descriptor;
- test(hasProperty(svc, "ServiceProp", "test"));
-
- ApplicationUpdateDescriptor empty;
- empty.name = "TestApp";
- ApplicationUpdateDescriptor update;
-
- update = empty;
- service->propertySet.properties.clear();
- addProperty(service, "ServiceProp", "updated");
- svcTempl.descriptor = service;
- update.serviceTemplates["ServiceTemplate"] = svcTempl;
- admin->updateApplication(update);
- info = admin->getServerInfo("Server");
- svc = IceBoxDescriptorPtr::dynamicCast(info.descriptor)->services[0].descriptor;
- test(hasProperty(svc, "ServiceProp", "updated"));
-
- update = empty;
- serviceInstance.propertySet.properties.clear();
- serviceInstance.propertySet.properties.push_back(createProperty("ServiceInstanceProp", "updated"));
- server->services.clear();
- server->services.push_back(serviceInstance);
- templ.descriptor = server;
- update.serverTemplates["ServerTemplate"] = templ;
- admin->updateApplication(update);
- info = admin->getServerInfo("Server");
- svc = IceBoxDescriptorPtr::dynamicCast(info.descriptor)->services[0].descriptor;
- test(hasProperty(svc, "ServiceInstanceProp", "updated"));
-
- update = empty;
- server->propertySet.properties.clear();
- addProperty(server, "ServerProp", "updated");
- templ.descriptor = server;
- update.serverTemplates["ServerTemplate"] = templ;
- admin->updateApplication(update);
- info = admin->getServerInfo("Server");
- test(hasProperty(info.descriptor, "ServerProp", "updated"));
-
- update = empty;
- serverInstance.propertySet.properties.clear();
- serverInstance.propertySet.properties.push_back(createProperty("ServerInstanceProp", "updated"));
- NodeUpdateDescriptor nodeUpdate;
- nodeUpdate.name = "node1";
- nodeUpdate.serverInstances.push_back(serverInstance);
- update.nodes.push_back(nodeUpdate);
- admin->updateApplication(update);
- info = admin->getServerInfo("Server");
- test(hasProperty(info.descriptor, "ServerInstanceProp", "updated"));
-
- update = empty;
- nodeUpdate.name = "node1";
- nodeUpdate.serverInstances.clear();
- nodeUpdate.propertySets["NodePropertySet"].properties.clear();
- nodeUpdate.propertySets["NodePropertySet"].properties.push_back(
- createProperty("NodeProp", "updated"));
- nodeUpdate.removePropertySets.push_back("NodePropertySet1");
- update.nodes.push_back(nodeUpdate);
- admin->updateApplication(update);
- info = admin->getServerInfo("Server");
- test(hasProperty(info.descriptor, "NodeProp", "updated"));
- ApplicationDescriptor updatedApplication = admin->getApplicationInfo("TestApp").descriptor;
- test(updatedApplication.nodes["node1"].propertySets.find("NodePropertySet1") ==
- updatedApplication.nodes["node1"].propertySets.end());
-
- update = empty;
- update.propertySets["ApplicationPropertySet"].properties.clear();
- update.propertySets["ApplicationPropertySet"].properties.push_back(
- createProperty("ApplicationProp", "updated"));
- update.removePropertySets.push_back("ApplicationPropertySet1");
- admin->updateApplication(update);
- info = admin->getServerInfo("Server");
- test(hasProperty(info.descriptor, "ApplicationProp", "updated"));
- updatedApplication = admin->getApplicationInfo("TestApp").descriptor;
- test(updatedApplication.propertySets.find("ApplicationPropertySet1") ==
- updatedApplication.propertySets.end());
-
- admin->removeApplication("TestApp");
- cout << "ok" << endl;
+ cout << "testing property set update... " << flush;
+
+ ServiceDescriptorPtr service = new ServiceDescriptor();
+ service->name = "${name}";
+ service->entry = "dummy";
+ addProperty(service, "ServiceProp", "test");
+
+ TemplateDescriptor svcTempl;
+ svcTempl.parameters.push_back("name");
+ svcTempl.descriptor = service;
+
+ ServiceInstanceDescriptor serviceInstance;
+ serviceInstance._cpp_template = "ServiceTemplate";
+ serviceInstance.parameterValues["name"] = "Service";
+ serviceInstance.propertySet.properties.push_back(createProperty("ServiceInstanceProp", "test"));
+
+ IceBoxDescriptorPtr server = new IceBoxDescriptor();
+ server->id = "${name}";
+ server->exe = "server";
+ server->pwd = ".";
+ server->propertySet.references.push_back("ApplicationPropertySet");
+ server->propertySet.references.push_back("NodePropertySet");
+ addProperty(server, "ServerProp", "test");
+ server->services.push_back(serviceInstance);
+
+ TemplateDescriptor templ;
+ templ.parameters.push_back("name");
+ templ.descriptor = server;
+
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+ testApp.variables["appvar"] = "AppValue";
+ testApp.serverTemplates["ServerTemplate"] = templ;
+ testApp.serviceTemplates["ServiceTemplate"] = svcTempl;
+ testApp.propertySets["ApplicationPropertySet"].properties.push_back(createProperty("ApplicationProp","test"));
+ testApp.propertySets["ApplicationPropertySet1"].properties.push_back(createProperty("ApplicationProp", "d"));
+
+ NodeDescriptor node;
+ node.variables["nodevar"] = "NodeValue";
+ node.propertySets["NodePropertySet"].properties.push_back(createProperty("NodeProp", "test"));
+ node.propertySets["NodePropertySet1"].properties.push_back(createProperty("NodeProp", "test"));
+
+ ServerInstanceDescriptor serverInstance;
+ serverInstance._cpp_template = "ServerTemplate";
+ serverInstance.parameterValues["name"] = "Server";
+ serverInstance.propertySet.properties.push_back(createProperty("ServerInstanceProp", "test"));
+ node.serverInstances.push_back(serverInstance);
+
+ testApp.nodes["node1"] = node;
+
+ try
+ {
+ admin->addApplication(testApp);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ ServerInfo info = admin->getServerInfo("Server");
+ test(hasProperty(info.descriptor, "ServerProp", "test"));
+ test(hasProperty(info.descriptor, "NodeProp", "test"));
+ test(hasProperty(info.descriptor, "ApplicationProp", "test"));
+ test(hasProperty(info.descriptor, "ServerInstanceProp", "test"));
+
+ ServiceDescriptorPtr svc = IceBoxDescriptorPtr::dynamicCast(info.descriptor)->services[0].descriptor;
+ test(hasProperty(svc, "ServiceProp", "test"));
+
+ ApplicationUpdateDescriptor empty;
+ empty.name = "TestApp";
+ ApplicationUpdateDescriptor update;
+
+ update = empty;
+ service->propertySet.properties.clear();
+ addProperty(service, "ServiceProp", "updated");
+ svcTempl.descriptor = service;
+ update.serviceTemplates["ServiceTemplate"] = svcTempl;
+ admin->updateApplication(update);
+ info = admin->getServerInfo("Server");
+ svc = IceBoxDescriptorPtr::dynamicCast(info.descriptor)->services[0].descriptor;
+ test(hasProperty(svc, "ServiceProp", "updated"));
+
+ update = empty;
+ serviceInstance.propertySet.properties.clear();
+ serviceInstance.propertySet.properties.push_back(createProperty("ServiceInstanceProp", "updated"));
+ server->services.clear();
+ server->services.push_back(serviceInstance);
+ templ.descriptor = server;
+ update.serverTemplates["ServerTemplate"] = templ;
+ admin->updateApplication(update);
+ info = admin->getServerInfo("Server");
+ svc = IceBoxDescriptorPtr::dynamicCast(info.descriptor)->services[0].descriptor;
+ test(hasProperty(svc, "ServiceInstanceProp", "updated"));
+
+ update = empty;
+ server->propertySet.properties.clear();
+ addProperty(server, "ServerProp", "updated");
+ templ.descriptor = server;
+ update.serverTemplates["ServerTemplate"] = templ;
+ admin->updateApplication(update);
+ info = admin->getServerInfo("Server");
+ test(hasProperty(info.descriptor, "ServerProp", "updated"));
+
+ update = empty;
+ serverInstance.propertySet.properties.clear();
+ serverInstance.propertySet.properties.push_back(createProperty("ServerInstanceProp", "updated"));
+ NodeUpdateDescriptor nodeUpdate;
+ nodeUpdate.name = "node1";
+ nodeUpdate.serverInstances.push_back(serverInstance);
+ update.nodes.push_back(nodeUpdate);
+ admin->updateApplication(update);
+ info = admin->getServerInfo("Server");
+ test(hasProperty(info.descriptor, "ServerInstanceProp", "updated"));
+
+ update = empty;
+ nodeUpdate.name = "node1";
+ nodeUpdate.serverInstances.clear();
+ nodeUpdate.propertySets["NodePropertySet"].properties.clear();
+ nodeUpdate.propertySets["NodePropertySet"].properties.push_back(
+ createProperty("NodeProp", "updated"));
+ nodeUpdate.removePropertySets.push_back("NodePropertySet1");
+ update.nodes.push_back(nodeUpdate);
+ admin->updateApplication(update);
+ info = admin->getServerInfo("Server");
+ test(hasProperty(info.descriptor, "NodeProp", "updated"));
+ ApplicationDescriptor updatedApplication = admin->getApplicationInfo("TestApp").descriptor;
+ test(updatedApplication.nodes["node1"].propertySets.find("NodePropertySet1") ==
+ updatedApplication.nodes["node1"].propertySets.end());
+
+ update = empty;
+ update.propertySets["ApplicationPropertySet"].properties.clear();
+ update.propertySets["ApplicationPropertySet"].properties.push_back(
+ createProperty("ApplicationProp", "updated"));
+ update.removePropertySets.push_back("ApplicationPropertySet1");
+ admin->updateApplication(update);
+ info = admin->getServerInfo("Server");
+ test(hasProperty(info.descriptor, "ApplicationProp", "updated"));
+ updatedApplication = admin->getApplicationInfo("TestApp").descriptor;
+ test(updatedApplication.propertySets.find("ApplicationPropertySet1") ==
+ updatedApplication.propertySets.end());
+
+ admin->removeApplication("TestApp");
+ cout << "ok" << endl;
}
{
- cout << "testing description update... " << flush;
-
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
- testApp.description = "Description";
- try
- {
- admin->addApplication(testApp);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- testApp = admin->getApplicationInfo("TestApp").descriptor;
- test(testApp.description == "Description");
-
- ApplicationUpdateDescriptor update;
- update.name = "TestApp";
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- testApp = admin->getApplicationInfo("TestApp").descriptor;
- test(testApp.description == "Description");
-
- update.description = new BoxedString("updatedDescription");
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- testApp = admin->getApplicationInfo("TestApp").descriptor;
- test(testApp.description == "updatedDescription");
-
- update.description = new BoxedString("");
- try
- {
- admin->updateApplication(update);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- testApp = admin->getApplicationInfo("TestApp").descriptor;
- test(testApp.description == "");
-
- admin->removeApplication("TestApp");
-
- cout << "ok" << endl;
+ cout << "testing description update... " << flush;
+
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+ testApp.description = "Description";
+ try
+ {
+ admin->addApplication(testApp);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ testApp = admin->getApplicationInfo("TestApp").descriptor;
+ test(testApp.description == "Description");
+
+ ApplicationUpdateDescriptor update;
+ update.name = "TestApp";
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ testApp = admin->getApplicationInfo("TestApp").descriptor;
+ test(testApp.description == "Description");
+
+ update.description = new BoxedString("updatedDescription");
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ testApp = admin->getApplicationInfo("TestApp").descriptor;
+ test(testApp.description == "updatedDescription");
+
+ update.description = new BoxedString("");
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ testApp = admin->getApplicationInfo("TestApp").descriptor;
+ test(testApp.description == "");
+
+ admin->removeApplication("TestApp");
+
+ cout << "ok" << endl;
}
{
- cout << "testing server node move... " << flush;
-
- ApplicationDescriptor nodeApp;
- nodeApp.name = "NodeApp";
-
- ServerDescriptorPtr server = new ServerDescriptor();
- server->id = "node-${index}";
- server->exe = properties->getProperty("IceDir") + "/bin/icegridnode";
- server->pwd = ".";
- server->options.push_back("--nowarn");
- AdapterDescriptor adapter;
- adapter.name = "IceGrid.Node";
- adapter.id = "IceGrid.Node.node-${index}";
- adapter.registerProcess = true;
- adapter.serverLifetime = false;
- server->adapters.push_back(adapter);
-
- addProperty(server, "IceGrid.Node.Name", "node-${index}");
- addProperty(server, "IceGrid.Node.Data", properties->getProperty("TestDir") + "/db/node-${index}");
- addProperty(server, "Ice.OA.IceGrid.Node.Endpoints", "default");
- addProperty(server, "IceGrid.Node.PropertiesOverride", properties->getProperty("NodePropertiesOverride"));
-
- nodeApp.serverTemplates["nodeTemplate"].descriptor = server;
- nodeApp.serverTemplates["nodeTemplate"].parameters.push_back("index");
-
- ServerInstanceDescriptor instance;
- instance._cpp_template = "nodeTemplate";
- instance.parameterValues["index"] = "1";
- nodeApp.nodes["localnode"].serverInstances.push_back(instance);
- instance.parameterValues["index"] = "2";
- nodeApp.nodes["localnode"].serverInstances.push_back(instance);
-
- try
- {
- admin->addApplication(nodeApp);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- admin->startServer("node-1");
- admin->startServer("node-2");
-
- //
- // We need to wait because the node might not be fully started
- // here (the node adapter isn't indirect, so we can't use the
- // wait-for-activation feature here.)
- //
- int retry = 0;
- while(retry < 20)
- {
- try
- {
- if(admin->pingNode("node-1") && admin->pingNode("node-2"))
- {
- break;
- }
- }
- catch(const NodeNotExistException&)
- {
- }
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
- ++retry;
- }
- test(admin->pingNode("node-1"));
- test(admin->pingNode("node-2"));
-
- ApplicationDescriptor testApp;
- testApp.name = "TestApp";
- server = new ServerDescriptor();
- server->id = "Server";
- server->exe = properties->getProperty("TestDir") + "/server";
- server->pwd = ".";
- adapter.name = "Server";
- adapter.id = "ServerAdapter";
- adapter.registerProcess = true;
- adapter.serverLifetime = true;
- server->adapters.push_back(adapter);
- addProperty(server, "Ice.OA.Server.Endpoints", "default");
- testApp.nodes["node-1"].servers.push_back(server);
-
- try
- {
- admin->addApplication(testApp);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
-
- try
- {
- admin->startServer("Server");
- test(admin->getServerState("Server") == Active);
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- ApplicationUpdateDescriptor update;
- update.name = "TestApp";
-
- NodeUpdateDescriptor nodeUpdate;
- nodeUpdate.name = "node-1";
- nodeUpdate.removeServers.push_back("Server");
- update.nodes.push_back(nodeUpdate);
- nodeUpdate.name = "node-2";
- nodeUpdate.servers.push_back(server);
- nodeUpdate.removeServers.clear();
- update.nodes.push_back(nodeUpdate);
-
- try
- {
- admin->updateApplication(update);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
- test(admin->getServerInfo("Server").node == "node-2" && admin->getServerState("Server") == Inactive);
-
- admin->startServer("Server");
- test(admin->getServerState("Server") == Active);
-
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
-
- update = ApplicationUpdateDescriptor();
- update.name = "TestApp";
- nodeUpdate = NodeUpdateDescriptor();
- nodeUpdate.name = "node-2";
- nodeUpdate.removeServers.push_back("Server");
- update.nodes.push_back(nodeUpdate);
- nodeUpdate = NodeUpdateDescriptor();
- nodeUpdate.name = "unknownNode";
- nodeUpdate.servers.push_back(server);
- update.nodes.push_back(nodeUpdate);
-
- try
- {
- admin->updateApplication(update);
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
-
- try
- {
- admin->getServerState("Server");
- test(false);
- }
- catch(const NodeUnreachableException&)
- {
- }
-
- try
- {
- admin->removeApplication("TestApp");
- }
- catch(const DeploymentException& ex)
- {
- cerr << ex.reason << endl;
- test(false);
- }
-
- admin->stopServer("node-1");
- admin->stopServer("node-2");
-
- try
- {
- admin->removeApplication("NodeApp");
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- test(false);
- }
-
- cout << "ok" << endl;
+ cout << "testing server node move... " << flush;
+
+ ApplicationDescriptor nodeApp;
+ nodeApp.name = "NodeApp";
+
+ ServerDescriptorPtr server = new ServerDescriptor();
+ server->id = "node-${index}";
+ server->exe = properties->getProperty("IceDir") + "/bin/icegridnode";
+ server->pwd = ".";
+ server->options.push_back("--nowarn");
+ AdapterDescriptor adapter;
+ adapter.name = "IceGrid.Node";
+ adapter.id = "IceGrid.Node.node-${index}";
+ adapter.registerProcess = true;
+ adapter.serverLifetime = false;
+ server->adapters.push_back(adapter);
+
+ addProperty(server, "IceGrid.Node.Name", "node-${index}");
+ addProperty(server, "IceGrid.Node.Data", properties->getProperty("TestDir") + "/db/node-${index}");
+ addProperty(server, "Ice.OA.IceGrid.Node.Endpoints", "default");
+ addProperty(server, "IceGrid.Node.PropertiesOverride", properties->getProperty("NodePropertiesOverride"));
+
+ nodeApp.serverTemplates["nodeTemplate"].descriptor = server;
+ nodeApp.serverTemplates["nodeTemplate"].parameters.push_back("index");
+
+ ServerInstanceDescriptor instance;
+ instance._cpp_template = "nodeTemplate";
+ instance.parameterValues["index"] = "1";
+ nodeApp.nodes["localnode"].serverInstances.push_back(instance);
+ instance.parameterValues["index"] = "2";
+ nodeApp.nodes["localnode"].serverInstances.push_back(instance);
+
+ try
+ {
+ admin->addApplication(nodeApp);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ admin->startServer("node-1");
+ admin->startServer("node-2");
+
+ //
+ // We need to wait because the node might not be fully started
+ // here (the node adapter isn't indirect, so we can't use the
+ // wait-for-activation feature here.)
+ //
+ int retry = 0;
+ while(retry < 20)
+ {
+ try
+ {
+ if(admin->pingNode("node-1") && admin->pingNode("node-2"))
+ {
+ break;
+ }
+ }
+ catch(const NodeNotExistException&)
+ {
+ }
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(500));
+ ++retry;
+ }
+ test(admin->pingNode("node-1"));
+ test(admin->pingNode("node-2"));
+
+ ApplicationDescriptor testApp;
+ testApp.name = "TestApp";
+ server = new ServerDescriptor();
+ server->id = "Server";
+ server->exe = properties->getProperty("TestDir") + "/server";
+ server->pwd = ".";
+ adapter.name = "Server";
+ adapter.id = "ServerAdapter";
+ adapter.registerProcess = true;
+ adapter.serverLifetime = true;
+ server->adapters.push_back(adapter);
+ addProperty(server, "Ice.OA.Server.Endpoints", "default");
+ testApp.nodes["node-1"].servers.push_back(server);
+
+ try
+ {
+ admin->addApplication(testApp);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+
+ try
+ {
+ admin->startServer("Server");
+ test(admin->getServerState("Server") == Active);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ ApplicationUpdateDescriptor update;
+ update.name = "TestApp";
+
+ NodeUpdateDescriptor nodeUpdate;
+ nodeUpdate.name = "node-1";
+ nodeUpdate.removeServers.push_back("Server");
+ update.nodes.push_back(nodeUpdate);
+ nodeUpdate.name = "node-2";
+ nodeUpdate.servers.push_back(server);
+ nodeUpdate.removeServers.clear();
+ update.nodes.push_back(nodeUpdate);
+
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+ test(admin->getServerInfo("Server").node == "node-2" && admin->getServerState("Server") == Inactive);
+
+ admin->startServer("Server");
+ test(admin->getServerState("Server") == Active);
+
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
+
+ update = ApplicationUpdateDescriptor();
+ update.name = "TestApp";
+ nodeUpdate = NodeUpdateDescriptor();
+ nodeUpdate.name = "node-2";
+ nodeUpdate.removeServers.push_back("Server");
+ update.nodes.push_back(nodeUpdate);
+ nodeUpdate = NodeUpdateDescriptor();
+ nodeUpdate.name = "unknownNode";
+ nodeUpdate.servers.push_back(server);
+ update.nodes.push_back(nodeUpdate);
+
+ try
+ {
+ admin->updateApplication(update);
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+
+ try
+ {
+ admin->getServerState("Server");
+ test(false);
+ }
+ catch(const NodeUnreachableException&)
+ {
+ }
+
+ try
+ {
+ admin->removeApplication("TestApp");
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << ex.reason << endl;
+ test(false);
+ }
+
+ admin->stopServer("node-1");
+ admin->stopServer("node-2");
+
+ try
+ {
+ admin->removeApplication("NodeApp");
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+
+ cout << "ok" << endl;
}
keepAlive->destroy();
diff --git a/cpp/test/IceGrid/update/Client.cpp b/cpp/test/IceGrid/update/Client.cpp
index 47f910e24da..940ae6bec73 100644
--- a/cpp/test/IceGrid/update/Client.cpp
+++ b/cpp/test/IceGrid/update/Client.cpp
@@ -27,28 +27,28 @@ main(int argc, char* argv[])
int status;
Ice::CommunicatorPtr communicator;
try
- {
- communicator = Ice::initialize(argc, argv);
- communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
- status = run(argc, argv, communicator);
+ {
+ communicator = Ice::initialize(argc, argv);
+ communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceGrid/update/run.py b/cpp/test/IceGrid/update/run.py
index 1d4fee7324c..ffc218efb4b 100755
--- a/cpp/test/IceGrid/update/run.py
+++ b/cpp/test/IceGrid/update/run.py
@@ -39,7 +39,7 @@ else:
nodeOverrideOptions = "--IceDir=\"" + toplevel + "\" --TestDir=\"" + testdir + "\"" + \
' --NodePropertiesOverride="' + \
TestUtil.clientServerOptions.replace("--", "") + \
- ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0' + '"'
+ ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0' + '"'
IceGridAdmin.iceGridTest(name, "", nodeOverrideOptions)
sys.exit(0)
diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp
index b5ae334bcd5..bb8430472ab 100644
--- a/cpp/test/IceSSL/configuration/AllTests.cpp
+++ b/cpp/test/IceSSL/configuration/AllTests.cpp
@@ -25,13 +25,13 @@ public:
virtual string getPassword()
{
- ++_count;
- return _password;
+ ++_count;
+ return _password;
}
int count() const
{
- return _count;
+ return _count;
}
private:
@@ -47,59 +47,59 @@ public:
CertificateVerifierI()
{
- reset();
+ reset();
}
virtual bool
verify(const IceSSL::ConnectionInfo& info)
{
- if(info.certs.size() > 0)
- {
- vector<pair<int, string> > subjectAltNames = info.certs[0]->getSubjectAlternativeNames();
- vector<string> ipAddresses;
- vector<string> dnsNames;
- for(vector<pair<int, string> >::const_iterator p = subjectAltNames.begin();
- p != subjectAltNames.end(); ++p)
- {
- if(p->first == 7)
- {
- ipAddresses.push_back(p->second);
- }
- else if(p->first == 2)
- {
- dnsNames.push_back(p->second);
- }
- }
-
- test(find(dnsNames.begin(), dnsNames.end(), "server") != dnsNames.end());
- test(find(ipAddresses.begin(), ipAddresses.end(), "127.0.0.1") != ipAddresses.end());
- }
-
- _hadCert = info.certs.size() != 0;
- _invoked = true;
- return _returnValue;
+ if(info.certs.size() > 0)
+ {
+ vector<pair<int, string> > subjectAltNames = info.certs[0]->getSubjectAlternativeNames();
+ vector<string> ipAddresses;
+ vector<string> dnsNames;
+ for(vector<pair<int, string> >::const_iterator p = subjectAltNames.begin();
+ p != subjectAltNames.end(); ++p)
+ {
+ if(p->first == 7)
+ {
+ ipAddresses.push_back(p->second);
+ }
+ else if(p->first == 2)
+ {
+ dnsNames.push_back(p->second);
+ }
+ }
+
+ test(find(dnsNames.begin(), dnsNames.end(), "server") != dnsNames.end());
+ test(find(ipAddresses.begin(), ipAddresses.end(), "127.0.0.1") != ipAddresses.end());
+ }
+
+ _hadCert = info.certs.size() != 0;
+ _invoked = true;
+ return _returnValue;
}
void reset()
{
- _returnValue = true;
- _invoked = false;
- _hadCert = false;
+ _returnValue = true;
+ _invoked = false;
+ _hadCert = false;
}
void returnValue(bool b)
{
- _returnValue = b;
+ _returnValue = b;
}
bool invoked() const
{
- return _invoked;
+ return _invoked;
}
bool hadCert() const
{
- return _hadCert;
+ return _hadCert;
}
private:
@@ -118,7 +118,7 @@ createClientProps(const string& defaultDir, const string& defaultHost)
result->setProperty("IceSSL.DefaultDir", defaultDir);
if(!defaultHost.empty())
{
- result->setProperty("Ice.Default.Host", defaultHost);
+ result->setProperty("Ice.Default.Host", defaultHost);
}
return result;
}
@@ -131,7 +131,7 @@ createServerProps(const string& defaultDir, const string& defaultHost)
result["IceSSL.DefaultDir"] = defaultDir;
if(!defaultHost.empty())
{
- result["Ice.Default.Host"] = defaultHost;
+ result["Ice.Default.Host"] = defaultHost;
}
return result;
}
@@ -155,1316 +155,1316 @@ allTests(const CommunicatorPtr& communicator, const string& testDir)
cout << "testing manual initialization... " << flush;
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("Ice.InitPlugins", "0");
- CommunicatorPtr comm = initialize(initData);
- ObjectPrx p = comm->stringToProxy("dummy:ssl -p 9999");
- try
- {
- p->ice_ping();
- test(false);
- }
- catch(const PluginInitializationException&)
- {
- // Expected.
- }
- catch(const LocalException&)
- {
- test(false);
- }
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("Ice.InitPlugins", "0");
+ CommunicatorPtr comm = initialize(initData);
+ ObjectPrx p = comm->stringToProxy("dummy:ssl -p 9999");
+ try
+ {
+ p->ice_ping();
+ test(false);
+ }
+ catch(const PluginInitializationException&)
+ {
+ // Expected.
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("Ice.InitPlugins", "0");
- initData.properties->setProperty("IceSSL.Ciphers", "ADH");
- initData.properties->setProperty("IceSSL.VerifyPeer", "0");
- CommunicatorPtr comm = initialize(initData);
- PluginManagerPtr pm = comm->getPluginManager();
- pm->initializePlugins();
- ObjectPrx obj = comm->stringToProxy(factoryRef);
- test(obj);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(obj);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.Ciphers"] = "ADH";
- d["IceSSL.VerifyPeer"] = "0";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("Ice.InitPlugins", "0");
+ initData.properties->setProperty("IceSSL.Ciphers", "ADH");
+ initData.properties->setProperty("IceSSL.VerifyPeer", "0");
+ CommunicatorPtr comm = initialize(initData);
+ PluginManagerPtr pm = comm->getPluginManager();
+ pm->initializePlugins();
+ ObjectPrx obj = comm->stringToProxy(factoryRef);
+ test(obj);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(obj);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.Ciphers"] = "ADH";
+ d["IceSSL.VerifyPeer"] = "0";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing certificate verification... " << flush;
{
- //
- // Test IceSSL.VerifyPeer=0. Client does not have a certificate,
- // but it still verifies the server's.
- //
+ //
+ // Test IceSSL.VerifyPeer=0. Client does not have a certificate,
+ // but it still verifies the server's.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.VerifyPeer", "0");
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- CommunicatorPtr comm = initialize(initData);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "0";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->noCert();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- //
- // Validate that we can get the connection info.
- //
- try
- {
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
- test(info.certs.size() == 2);
- }
- catch(const IceSSL::ConnectionInvalidException&)
- {
- test(false);
- }
- fact->destroyServer(server);
-
- //
- // Test IceSSL.VerifyPeer=1. Client does not have a certificate.
- //
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "1";
- server = fact->createServer(d);
- try
- {
- server->noCert();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
-
- //
- // Test IceSSL.VerifyPeer=2. This should fail because the client
- // does not supply a certificate.
- //
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "2";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected.
- }
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.VerifyPeer", "0");
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ CommunicatorPtr comm = initialize(initData);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "0";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->noCert();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ //
+ // Validate that we can get the connection info.
+ //
+ try
+ {
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
+ test(info.certs.size() == 2);
+ }
+ catch(const IceSSL::ConnectionInvalidException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+
+ //
+ // Test IceSSL.VerifyPeer=1. Client does not have a certificate.
+ //
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "1";
+ server = fact->createServer(d);
+ try
+ {
+ server->noCert();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+
+ //
+ // Test IceSSL.VerifyPeer=2. This should fail because the client
+ // does not supply a certificate.
+ //
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "2";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected.
+ }
#ifdef _WIN32
- catch(const ConnectionLostException&)
- {
- // Expected.
- }
+ catch(const ConnectionLostException&)
+ {
+ // Expected.
+ }
#endif
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
-
- comm->destroy();
-
- //
- // Test IceSSL.VerifyPeer=1. Client has a certificate.
- //
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- comm = initialize(initData);
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "1";
- server = fact->createServer(d);
- try
- {
- IceSSL::CertificatePtr clientCert =
- IceSSL::Certificate::load(defaultDir + "/c_rsa_nopass_ca1_pub.pem");
- server->checkCert(clientCert->getSubjectDN(), clientCert->getIssuerDN());
-
- //
- // Validate that we can get the connection info. Validate
- // that the certificates have the same DN.
- //
- // Validate some aspects of the Certificate class.
- //
- IceSSL::CertificatePtr serverCert =
- IceSSL::Certificate::load(defaultDir + "/s_rsa_nopass_ca1_pub.pem");
- test(IceSSL::Certificate::decode(serverCert->encode()) == serverCert);
- test(serverCert == serverCert);
- test(serverCert->checkValidity());
- test(!serverCert->checkValidity(IceUtil::Time::seconds(0)));
-
- IceSSL::CertificatePtr caCert = IceSSL::Certificate::load(defaultDir + "/cacert1.pem");
- test(caCert == caCert);
- test(caCert->checkValidity());
- test(!caCert->checkValidity(IceUtil::Time::seconds(0)));
-
- test(!serverCert->verify(serverCert->getPublicKey()));
- test(serverCert->verify(caCert->getPublicKey()));
- test(caCert->verify(caCert->getPublicKey()));
-
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
-
- test(info.certs.size() == 2);
-
- test(caCert == info.certs[1]);
- test(serverCert == info.certs[0]);
-
- test(serverCert != info.certs[1]);
- test(caCert != info.certs[0]);
-
- test(info.certs[0]->checkValidity() && info.certs[1]->checkValidity());
- test(!info.certs[0]->checkValidity(IceUtil::Time::seconds(0)) &&
- !info.certs[1]->checkValidity(IceUtil::Time::seconds(0)));
- test(info.certs[0]->verify(info.certs[1]->getPublicKey()));
- test(info.certs.size() == 2 &&
- info.certs[0]->getSubjectDN() == serverCert->getSubjectDN() &&
- info.certs[0]->getIssuerDN() == serverCert->getIssuerDN());
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
-
- //
- // Test IceSSL.VerifyPeer=2. Client has a certificate.
- //
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "2";
- server = fact->createServer(d);
- try
- {
- IceSSL::CertificatePtr clientCert =
- IceSSL::Certificate::load(defaultDir + "/c_rsa_nopass_ca1_pub.pem");
- server->checkCert(clientCert->getSubjectDN(), clientCert->getIssuerDN());
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
-
- comm->destroy();
-
- //
- // Test IceSSL.VerifyPeer=1. This should fail because the
- // client doesn't trust the server's CA.
- //
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert2.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca2_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca2_priv.pem");
- comm = initialize(initData);
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "1";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected.
- }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+
+ comm->destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=1. Client has a certificate.
+ //
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ comm = initialize(initData);
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "1";
+ server = fact->createServer(d);
+ try
+ {
+ IceSSL::CertificatePtr clientCert =
+ IceSSL::Certificate::load(defaultDir + "/c_rsa_nopass_ca1_pub.pem");
+ server->checkCert(clientCert->getSubjectDN(), clientCert->getIssuerDN());
+
+ //
+ // Validate that we can get the connection info. Validate
+ // that the certificates have the same DN.
+ //
+ // Validate some aspects of the Certificate class.
+ //
+ IceSSL::CertificatePtr serverCert =
+ IceSSL::Certificate::load(defaultDir + "/s_rsa_nopass_ca1_pub.pem");
+ test(IceSSL::Certificate::decode(serverCert->encode()) == serverCert);
+ test(serverCert == serverCert);
+ test(serverCert->checkValidity());
+ test(!serverCert->checkValidity(IceUtil::Time::seconds(0)));
+
+ IceSSL::CertificatePtr caCert = IceSSL::Certificate::load(defaultDir + "/cacert1.pem");
+ test(caCert == caCert);
+ test(caCert->checkValidity());
+ test(!caCert->checkValidity(IceUtil::Time::seconds(0)));
+
+ test(!serverCert->verify(serverCert->getPublicKey()));
+ test(serverCert->verify(caCert->getPublicKey()));
+ test(caCert->verify(caCert->getPublicKey()));
+
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
+
+ test(info.certs.size() == 2);
+
+ test(caCert == info.certs[1]);
+ test(serverCert == info.certs[0]);
+
+ test(serverCert != info.certs[1]);
+ test(caCert != info.certs[0]);
+
+ test(info.certs[0]->checkValidity() && info.certs[1]->checkValidity());
+ test(!info.certs[0]->checkValidity(IceUtil::Time::seconds(0)) &&
+ !info.certs[1]->checkValidity(IceUtil::Time::seconds(0)));
+ test(info.certs[0]->verify(info.certs[1]->getPublicKey()));
+ test(info.certs.size() == 2 &&
+ info.certs[0]->getSubjectDN() == serverCert->getSubjectDN() &&
+ info.certs[0]->getIssuerDN() == serverCert->getIssuerDN());
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+
+ //
+ // Test IceSSL.VerifyPeer=2. Client has a certificate.
+ //
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "2";
+ server = fact->createServer(d);
+ try
+ {
+ IceSSL::CertificatePtr clientCert =
+ IceSSL::Certificate::load(defaultDir + "/c_rsa_nopass_ca1_pub.pem");
+ server->checkCert(clientCert->getSubjectDN(), clientCert->getIssuerDN());
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+
+ comm->destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=1. This should fail because the
+ // client doesn't trust the server's CA.
+ //
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert2.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca2_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca2_priv.pem");
+ comm = initialize(initData);
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "1";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected.
+ }
#ifdef _WIN32
- catch(const ConnectionLostException&)
- {
- // Expected.
- }
+ catch(const ConnectionLostException&)
+ {
+ // Expected.
+ }
#endif
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
-
- comm->destroy();
-
- //
- // Test IceSSL.VerifyPeer=1. This should fail because the
- // server doesn't trust the client's CA.
- //
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca2_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca2_priv.pem");
- comm = initialize(initData);
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "1";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected.
- }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+
+ comm->destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=1. This should fail because the
+ // server doesn't trust the client's CA.
+ //
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca2_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca2_priv.pem");
+ comm = initialize(initData);
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "1";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected.
+ }
#ifdef _WIN32
- catch(const ConnectionLostException&)
- {
- // Expected.
- }
+ catch(const ConnectionLostException&)
+ {
+ // Expected.
+ }
#endif
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
-
- comm->destroy();
-
- //
- // Verify that IceSSL.CheckCertName has no effect in a server.
- //
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- comm = initialize(initData);
-
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.CheckCertName"] = "1";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+
+ comm->destroy();
+
+ //
+ // Verify that IceSSL.CheckCertName has no effect in a server.
+ //
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ comm = initialize(initData);
+
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.CheckCertName"] = "1";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing custom certificate verifier... " << flush;
{
- //
- // ADH is allowed but will not have a certificate.
- //
+ //
+ // ADH is allowed but will not have a certificate.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.Ciphers", "ADH");
- initData.properties->setProperty("IceSSL.VerifyPeer", "0");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
- CertificateVerifierIPtr verifier = new CertificateVerifierI;
- plugin->setCertificateVerifier(verifier);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.Ciphers"] = "ADH";
- d["IceSSL.VerifyPeer"] = "0";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- string cipherSub = "ADH-";
- server->checkCipher(cipherSub);
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
- test(info.cipher.compare(0, cipherSub.size(), cipherSub) == 0);
- }
- catch(const LocalException&)
- {
- test(false);
- }
- test(verifier->invoked());
- test(!verifier->hadCert());
-
- //
- // Have the verifier return false. Close the connection explicitly
- // to force a new connection to be established.
- //
- verifier->reset();
- verifier->returnValue(false);
- server->ice_getConnection()->close(false);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const SecurityException&)
- {
- // Expected.
- }
- catch(const LocalException&)
- {
- test(false);
- }
- test(verifier->invoked());
- test(!verifier->hadCert());
-
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.Ciphers", "ADH");
+ initData.properties->setProperty("IceSSL.VerifyPeer", "0");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+ CertificateVerifierIPtr verifier = new CertificateVerifierI;
+ plugin->setCertificateVerifier(verifier);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.Ciphers"] = "ADH";
+ d["IceSSL.VerifyPeer"] = "0";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ string cipherSub = "ADH-";
+ server->checkCipher(cipherSub);
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
+ test(info.cipher.compare(0, cipherSub.size(), cipherSub) == 0);
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ test(verifier->invoked());
+ test(!verifier->hadCert());
+
+ //
+ // Have the verifier return false. Close the connection explicitly
+ // to force a new connection to be established.
+ //
+ verifier->reset();
+ verifier->returnValue(false);
+ server->ice_getConnection()->close(false);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const SecurityException&)
+ {
+ // Expected.
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ test(verifier->invoked());
+ test(!verifier->hadCert());
+
+ fact->destroyServer(server);
+ comm->destroy();
}
{
- //
- // Verify that a server certificate is present.
- //
+ //
+ // Verify that a server certificate is present.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.VerifyPeer", "0");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
- CertificateVerifierIPtr verifier = new CertificateVerifierI;
- plugin->setCertificateVerifier(verifier);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.VerifyPeer"] = "2";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- test(verifier->invoked());
- test(verifier->hadCert());
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.VerifyPeer", "0");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+ CertificateVerifierIPtr verifier = new CertificateVerifierI;
+ plugin->setCertificateVerifier(verifier);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.VerifyPeer"] = "2";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ test(verifier->invoked());
+ test(verifier->hadCert());
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing protocols... " << flush;
{
- //
- // This should fail because the client and server have no protocol
- // in common.
- //
+ //
+ // This should fail because the client and server have no protocol
+ // in common.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.Ciphers", "ADH");
- initData.properties->setProperty("IceSSL.VerifyPeer", "0");
- initData.properties->setProperty("IceSSL.Protocols", "ssl3");
- CommunicatorPtr comm = initialize(initData);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.Ciphers"] = "ADH";
- d["IceSSL.VerifyPeer"] = "0";
- d["IceSSL.Protocols"] = "tls1";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected on some platforms.
- }
- catch(const ConnectionLostException&)
- {
- // Expected on some platforms.
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
-
- //
- // This should succeed.
- //
- comm = initialize(initData);
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.Ciphers"] = "ADH";
- d["IceSSL.VerifyPeer"] = "0";
- d["IceSSL.Protocols"] = "tls1, ssl3";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.Ciphers", "ADH");
+ initData.properties->setProperty("IceSSL.VerifyPeer", "0");
+ initData.properties->setProperty("IceSSL.Protocols", "ssl3");
+ CommunicatorPtr comm = initialize(initData);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.Ciphers"] = "ADH";
+ d["IceSSL.VerifyPeer"] = "0";
+ d["IceSSL.Protocols"] = "tls1";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected on some platforms.
+ }
+ catch(const ConnectionLostException&)
+ {
+ // Expected on some platforms.
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
+
+ //
+ // This should succeed.
+ //
+ comm = initialize(initData);
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.Ciphers"] = "ADH";
+ d["IceSSL.VerifyPeer"] = "0";
+ d["IceSSL.Protocols"] = "tls1, ssl3";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing expired certificates... " << flush;
{
- //
- // This should fail because the server's certificate is expired.
- //
- {
- IceSSL::CertificatePtr cert =
- IceSSL::Certificate::load(defaultDir + "/s_rsa_nopass_ca1_exp_pub.pem");
- test(!cert->checkValidity());
- }
+ //
+ // This should fail because the server's certificate is expired.
+ //
+ {
+ IceSSL::CertificatePtr cert =
+ IceSSL::Certificate::load(defaultDir + "/s_rsa_nopass_ca1_exp_pub.pem");
+ test(!cert->checkValidity());
+ }
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- CommunicatorPtr comm = initialize(initData);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_exp_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_exp_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected.
- }
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ CommunicatorPtr comm = initialize(initData);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_exp_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_exp_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected.
+ }
#ifdef _WIN32
- catch(const ConnectionLostException&)
- {
- // Expected.
- }
+ catch(const ConnectionLostException&)
+ {
+ // Expected.
+ }
#endif
- catch(const LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
-
- //
- // This should fail because the client's certificate is expired.
- //
- {
- IceSSL::CertificatePtr cert =
- IceSSL::Certificate::load(defaultDir + "/c_rsa_nopass_ca1_exp_pub.pem");
- test(!cert->checkValidity());
- }
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_exp_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_exp_priv.pem");
- comm = initialize(initData);
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected.
- }
+ catch(const LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
+
+ //
+ // This should fail because the client's certificate is expired.
+ //
+ {
+ IceSSL::CertificatePtr cert =
+ IceSSL::Certificate::load(defaultDir + "/c_rsa_nopass_ca1_exp_pub.pem");
+ test(!cert->checkValidity());
+ }
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_exp_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_exp_priv.pem");
+ comm = initialize(initData);
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected.
+ }
#ifdef _WIN32
- catch(const ConnectionLostException&)
- {
- // Expected.
- }
+ catch(const ConnectionLostException&)
+ {
+ // Expected.
+ }
#endif
- catch(const LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ catch(const LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing CA certificate directory... " << flush;
{
- //
- // Don't specify CertAuthFile explicitly; we let OpenSSL find the CA
- // certificate in the default directory.
- //
+ //
+ // Don't specify CertAuthFile explicitly; we let OpenSSL find the CA
+ // certificate in the default directory.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- CommunicatorPtr comm = initialize(initData);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ CommunicatorPtr comm = initialize(initData);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing password prompt... " << flush;
{
- //
- // Use the correct password.
- //
+ //
+ // Use the correct password.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_pass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_pass_ca1_priv.pem");
- initData.properties->setProperty("Ice.InitPlugins", "0");
- CommunicatorPtr comm = initialize(initData);
- PluginManagerPtr pm = comm->getPluginManager();
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(pm->getPlugin("IceSSL"));
- test(plugin);
- PasswordPromptIPtr prompt = new PasswordPromptI("client");
- plugin->setPasswordPrompt(prompt);
- pm->initializePlugins();
- test(prompt->count() == 1);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
-
- //
- // Use an incorrect password and check that retries are attempted.
- //
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_pass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_pass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.PasswordRetryMax", "4");
- initData.properties->setProperty("Ice.InitPlugins", "0");
- comm = initialize(initData);
- pm = comm->getPluginManager();
- plugin = IceSSL::PluginPtr::dynamicCast(pm->getPlugin("IceSSL"));
- test(plugin);
- prompt = new PasswordPromptI("invalid");
- plugin->setPasswordPrompt(prompt);
- try
- {
- pm->initializePlugins();
- }
- catch(const PluginInitializationException&)
- {
- // Expected.
- }
- catch(const LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- test(prompt->count() == 4);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_pass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_pass_ca1_priv.pem");
+ initData.properties->setProperty("Ice.InitPlugins", "0");
+ CommunicatorPtr comm = initialize(initData);
+ PluginManagerPtr pm = comm->getPluginManager();
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(pm->getPlugin("IceSSL"));
+ test(plugin);
+ PasswordPromptIPtr prompt = new PasswordPromptI("client");
+ plugin->setPasswordPrompt(prompt);
+ pm->initializePlugins();
+ test(prompt->count() == 1);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
+
+ //
+ // Use an incorrect password and check that retries are attempted.
+ //
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_pass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_pass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.PasswordRetryMax", "4");
+ initData.properties->setProperty("Ice.InitPlugins", "0");
+ comm = initialize(initData);
+ pm = comm->getPluginManager();
+ plugin = IceSSL::PluginPtr::dynamicCast(pm->getPlugin("IceSSL"));
+ test(plugin);
+ prompt = new PasswordPromptI("invalid");
+ plugin->setPasswordPrompt(prompt);
+ try
+ {
+ pm->initializePlugins();
+ }
+ catch(const PluginInitializationException&)
+ {
+ // Expected.
+ }
+ catch(const LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ test(prompt->count() == 4);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing ciphers... " << flush;
{
- //
- // The server has a certificate but the client doesn't. They should
- // negotiate to use ADH since we explicitly enable it.
- //
+ //
+ // The server has a certificate but the client doesn't. They should
+ // negotiate to use ADH since we explicitly enable it.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.Ciphers", "ADH");
- CommunicatorPtr comm = initialize(initData);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.Ciphers"] = "RSA:ADH";
- d["IceSSL.VerifyPeer"] = "1";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- string cipherSub = "ADH-";
- server->checkCipher(cipherSub);
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
- test(info.cipher.compare(0, cipherSub.size(), cipherSub) == 0);
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.Ciphers", "ADH");
+ CommunicatorPtr comm = initialize(initData);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.Ciphers"] = "RSA:ADH";
+ d["IceSSL.VerifyPeer"] = "1";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ string cipherSub = "ADH-";
+ server->checkCipher(cipherSub);
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(server->ice_getConnection());
+ test(info.cipher.compare(0, cipherSub.size(), cipherSub) == 0);
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
- //
- // Configure a server with RSA and DSA certificates.
- //
- // First try a client with a DSA certificate.
- //
+ //
+ // Configure a server with RSA and DSA certificates.
+ //
+ // First try a client with a DSA certificate.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertFile", "c_dsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_dsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.Ciphers", "DEFAULT:DSS");
- CommunicatorPtr comm = initialize(initData);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem" + sep + "s_dsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem" + sep + "s_dsa_nopass_ca1_priv.pem";
- d["IceSSL.Ciphers"] = "DEFAULT:DSS";
- d["IceSSL.VerifyPeer"] = "1";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
-
- //
- // Next try a client with an RSA certificate.
- //
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- comm = initialize(initData);
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem" + sep + "s_dsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem" + sep + "s_dsa_nopass_ca1_priv.pem";
- d["IceSSL.Ciphers"] = "DEFAULT:DSS";
- d["IceSSL.VerifyPeer"] = "1";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
-
- //
- // Next try a client with ADH. This should fail.
- //
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.Ciphers", "ADH");
- comm = initialize(initData);
- fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem" + sep + "s_dsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem" + sep + "s_dsa_nopass_ca1_priv.pem";
- d["IceSSL.Ciphers"] = "DEFAULT:DSS";
- d["IceSSL.VerifyPeer"] = "1";
- server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected.
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertFile", "c_dsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_dsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.Ciphers", "DEFAULT:DSS");
+ CommunicatorPtr comm = initialize(initData);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem" + sep + "s_dsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem" + sep + "s_dsa_nopass_ca1_priv.pem";
+ d["IceSSL.Ciphers"] = "DEFAULT:DSS";
+ d["IceSSL.VerifyPeer"] = "1";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
+
+ //
+ // Next try a client with an RSA certificate.
+ //
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ comm = initialize(initData);
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem" + sep + "s_dsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem" + sep + "s_dsa_nopass_ca1_priv.pem";
+ d["IceSSL.Ciphers"] = "DEFAULT:DSS";
+ d["IceSSL.VerifyPeer"] = "1";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
+
+ //
+ // Next try a client with ADH. This should fail.
+ //
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.Ciphers", "ADH");
+ comm = initialize(initData);
+ fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem" + sep + "s_dsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem" + sep + "s_dsa_nopass_ca1_priv.pem";
+ d["IceSSL.Ciphers"] = "DEFAULT:DSS";
+ d["IceSSL.VerifyPeer"] = "1";
+ server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected.
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
- //
- // Configure a server with RSA and a client with DSA. This should fail.
- //
+ //
+ // Configure a server with RSA and a client with DSA. This should fail.
+ //
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertFile", "c_dsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_dsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.Ciphers", "DSS");
- CommunicatorPtr comm = initialize(initData);
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const ProtocolException&)
- {
- // Expected.
- }
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertFile", "c_dsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_dsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.Ciphers", "DSS");
+ CommunicatorPtr comm = initialize(initData);
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const ProtocolException&)
+ {
+ // Expected.
+ }
#ifdef _WIN32
- catch(const ConnectionLostException&)
- {
- // Expected.
- }
+ catch(const ConnectionLostException&)
+ {
+ // Expected.
+ }
#endif
- catch(const LocalException& ex)
- {
- cerr << ex << endl;
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ catch(const LocalException& ex)
+ {
+ cerr << ex << endl;
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing IceSSL.TrustOnly... " << flush;
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly", "C=US, ST=Florida, O=ZeroC\\, Inc.,"
- "OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly", "C=US, ST=Florida, O=ZeroC\\, Inc.,"
+ "OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly", "C=US, ST=Florida, O=\"ZeroC, Inc.\","
- "OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly", "C=US, ST=Florida, O=\"ZeroC, Inc.\","
+ "OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
-
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.TrustOnly"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,"
- "CN=Client";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.TrustOnly"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,"
+ "CN=Client";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly", "CN=Server");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly", "CN=Server");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
-
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.TrustOnly"] = "CN=Client";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.TrustOnly"] = "CN=Client";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly", "CN=Client");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const LocalException&)
- {
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly", "CN=Client");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const LocalException&)
+ {
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
-
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.TrustOnly"] = "CN=Server";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const LocalException&)
- {
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.TrustOnly"] = "CN=Server";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const LocalException&)
+ {
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly", "C=Canada,CN=Server");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const LocalException&)
- {
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly", "C=Canada,CN=Server");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const LocalException&)
+ {
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly", "C=Canada;CN=Server");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly", "C=Canada;CN=Server");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing IceSSL.TrustOnly.Client... " << flush;
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly.Client", "C=US, ST=Florida, O=ZeroC\\, Inc.,"
- "OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- // Should have no effect.
- d["IceSSL.TrustOnly.Client"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,"
- "CN=Client";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly.Client", "C=US, ST=Florida, O=ZeroC\\, Inc.,"
+ "OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ // Should have no effect.
+ d["IceSSL.TrustOnly.Client"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,"
+ "CN=Client";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- initData.properties->setProperty("IceSSL.TrustOnly.Client", "CN=Client");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const LocalException&)
- {
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ initData.properties->setProperty("IceSSL.TrustOnly.Client", "CN=Client");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const LocalException&)
+ {
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing IceSSL.TrustOnly.Server... " << flush;
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- // Should have no effect.
- initData.properties->setProperty("IceSSL.TrustOnly.Server", "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice,"
- "emailAddress=info@zeroc.com,CN=Client");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.TrustOnly.Server"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,"
- "CN=Client";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ // Should have no effect.
+ initData.properties->setProperty("IceSSL.TrustOnly.Server", "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice,"
+ "emailAddress=info@zeroc.com,CN=Client");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.TrustOnly.Server"] = "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,"
+ "CN=Client";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.TrustOnly.Server"] = "CN=Server";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const LocalException&)
- {
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.TrustOnly.Server"] = "CN=Server";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const LocalException&)
+ {
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
cout << "testing IceSSL.TrustOnly.Server.<AdapterName>... " << flush;
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.TrustOnly.Server"] = "CN=bogus";
- d["IceSSL.TrustOnly.Server.ServerAdapter"] =
- "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,CN=Client";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- }
- catch(const LocalException&)
- {
- test(false);
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.TrustOnly.Server"] = "CN=bogus";
+ d["IceSSL.TrustOnly.Server.ServerAdapter"] =
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com,CN=Client";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ }
+ catch(const LocalException&)
+ {
+ test(false);
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
{
InitializationData initData;
- initData.properties = createClientProps(defaultDir, defaultHost);
- initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
- initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
- initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
- CommunicatorPtr comm = initialize(initData);
- IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
- test(plugin);
-
- Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
- test(fact);
- Test::Properties d = createServerProps(defaultDir, defaultHost);
- d["IceSSL.CertAuthFile"] = "cacert1.pem";
- d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
- d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
- d["IceSSL.TrustOnly.Server.ServerAdapter"] = "CN=bogus";
- Test::ServerPrx server = fact->createServer(d);
- try
- {
- server->ice_ping();
- test(false);
- }
- catch(const LocalException&)
- {
- }
- fact->destroyServer(server);
- comm->destroy();
+ initData.properties = createClientProps(defaultDir, defaultHost);
+ initData.properties->setProperty("IceSSL.CertAuthFile", "cacert1.pem");
+ initData.properties->setProperty("IceSSL.CertFile", "c_rsa_nopass_ca1_pub.pem");
+ initData.properties->setProperty("IceSSL.KeyFile", "c_rsa_nopass_ca1_priv.pem");
+ CommunicatorPtr comm = initialize(initData);
+ IceSSL::PluginPtr plugin = IceSSL::PluginPtr::dynamicCast(comm->getPluginManager()->getPlugin("IceSSL"));
+ test(plugin);
+
+ Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
+ test(fact);
+ Test::Properties d = createServerProps(defaultDir, defaultHost);
+ d["IceSSL.CertAuthFile"] = "cacert1.pem";
+ d["IceSSL.CertFile"] = "s_rsa_nopass_ca1_pub.pem";
+ d["IceSSL.KeyFile"] = "s_rsa_nopass_ca1_priv.pem";
+ d["IceSSL.TrustOnly.Server.ServerAdapter"] = "CN=bogus";
+ Test::ServerPrx server = fact->createServer(d);
+ try
+ {
+ server->ice_ping();
+ test(false);
+ }
+ catch(const LocalException&)
+ {
+ }
+ fact->destroyServer(server);
+ comm->destroy();
}
cout << "ok" << endl;
diff --git a/cpp/test/IceSSL/configuration/Client.cpp b/cpp/test/IceSSL/configuration/Client.cpp
index 4a60e4a9be4..be76b51b598 100644
--- a/cpp/test/IceSSL/configuration/Client.cpp
+++ b/cpp/test/IceSSL/configuration/Client.cpp
@@ -16,8 +16,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
if(argc < 2)
{
- cerr << "Usage: " << argv[0] << " testdir" << endl;
- return 1;
+ cerr << "Usage: " << argv[0] << " testdir" << endl;
+ return 1;
}
void allTests(const Ice::CommunicatorPtr&, const string&);
@@ -35,26 +35,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceSSL/configuration/Server.cpp b/cpp/test/IceSSL/configuration/Server.cpp
index e1e5ef05071..b9978ab4b31 100644
--- a/cpp/test/IceSSL/configuration/Server.cpp
+++ b/cpp/test/IceSSL/configuration/Server.cpp
@@ -33,26 +33,26 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceSSL/configuration/TestI.cpp b/cpp/test/IceSSL/configuration/TestI.cpp
index 0f3a1b49a3f..dd36b125080 100644
--- a/cpp/test/IceSSL/configuration/TestI.cpp
+++ b/cpp/test/IceSSL/configuration/TestI.cpp
@@ -26,12 +26,12 @@ ServerI::noCert(const Ice::Current& c)
{
try
{
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(c.con);
- test(info.certs.size() == 0);
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(c.con);
+ test(info.certs.size() == 0);
}
catch(const IceSSL::ConnectionInvalidException&)
{
- test(false);
+ test(false);
}
}
@@ -40,14 +40,14 @@ ServerI::checkCert(const string& subjectDN, const string& issuerDN, const Ice::C
{
try
{
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(c.con);
- test(info.certs.size() == 2 &&
- info.certs[0]->getSubjectDN() == IceSSL::DistinguishedName(subjectDN) &&
- info.certs[0]->getIssuerDN() == IceSSL::DistinguishedName(issuerDN));
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(c.con);
+ test(info.certs.size() == 2 &&
+ info.certs[0]->getSubjectDN() == IceSSL::DistinguishedName(subjectDN) &&
+ info.certs[0]->getIssuerDN() == IceSSL::DistinguishedName(issuerDN));
}
catch(const IceSSL::ConnectionInvalidException&)
{
- test(false);
+ test(false);
}
}
@@ -56,12 +56,12 @@ ServerI::checkCipher(const string& cipher, const Ice::Current& c)
{
try
{
- IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(c.con);
- test(info.cipher.compare(0, cipher.size(), cipher) == 0);
+ IceSSL::ConnectionInfo info = IceSSL::getConnectionInfo(c.con);
+ test(info.cipher.compare(0, cipher.size(), cipher) == 0);
}
catch(const IceSSL::ConnectionInvalidException&)
{
- test(false);
+ test(false);
}
}
@@ -78,7 +78,7 @@ ServerFactoryI::createServer(const Test::Properties& props, const Current& curre
initData.properties = createProperties();
for(Test::Properties::const_iterator p = props.begin(); p != props.end(); ++p)
{
- initData.properties->setProperty(p->first, p->second);
+ initData.properties->setProperty(p->first, p->second);
}
CommunicatorPtr communicator = initialize(initData);
@@ -97,8 +97,8 @@ ServerFactoryI::destroyServer(const Test::ServerPrx& srv, const Ice::Current&)
map<Identity, ServerIPtr>::iterator p = _servers.find(srv->ice_getIdentity());
if(p != _servers.end())
{
- p->second->destroy();
- _servers.erase(p);
+ p->second->destroy();
+ _servers.erase(p);
}
}
diff --git a/cpp/test/IceStorm/federation/Publisher.cpp b/cpp/test/IceStorm/federation/Publisher.cpp
index d9ee2935453..d5273b081be 100644
--- a/cpp/test/IceStorm/federation/Publisher.cpp
+++ b/cpp/test/IceStorm/federation/Publisher.cpp
@@ -24,52 +24,52 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
ObjectPrx base = communicator->stringToProxy(managerProxy);
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
TopicPrx fed1;
try
{
- fed1 = manager->retrieve("fed1");
+ fed1 = manager->retrieve("fed1");
}
catch(const NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
-
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
+
}
TopicPrx fed2;
try
{
- fed2 = manager->retrieve("fed2");
+ fed2 = manager->retrieve("fed2");
}
catch(const NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
-
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
+
}
TopicPrx fed3;
try
{
- fed3 = manager->retrieve("fed3");
+ fed3 = manager->retrieve("fed3");
}
catch(const NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
-
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
+
}
EventPrx eventFed1 = EventPrx::uncheckedCast(fed1->getPublisher()->ice_oneway());
@@ -82,37 +82,37 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
context["cost"] = "0";
for(i = 0; i < 10; ++i)
{
- eventFed1->pub("fed1:0", context);
+ eventFed1->pub("fed1:0", context);
}
context["cost"] = "10";
for(i = 0; i < 10; ++i)
{
- eventFed1->pub("fed1:10", context);
+ eventFed1->pub("fed1:10", context);
}
context["cost"] = "15";
for(i = 0; i < 10; ++i)
{
- eventFed1->pub("fed1:15", context);
+ eventFed1->pub("fed1:15", context);
}
context["cost"] = "0";
for(i = 0; i < 10; ++i)
{
- eventFed2->pub("fed2:0", context);
+ eventFed2->pub("fed2:0", context);
}
context["cost"] = "5";
for(i = 0; i < 10; ++i)
{
- eventFed2->pub("fed2:5", context);
+ eventFed2->pub("fed2:5", context);
}
context["cost"] = "0";
for(i = 0; i < 10; ++i)
{
- eventFed3->pub("fed3:0", context);
+ eventFed3->pub("fed3:0", context);
}
//
@@ -134,26 +134,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/federation/Subscriber.cpp b/cpp/test/IceStorm/federation/Subscriber.cpp
index c6c3efc8578..876a09686fe 100644
--- a/cpp/test/IceStorm/federation/Subscriber.cpp
+++ b/cpp/test/IceStorm/federation/Subscriber.cpp
@@ -24,19 +24,19 @@ class EventI : public Event
public:
EventI(const CommunicatorPtr& communicator) :
- _communicator(communicator)
+ _communicator(communicator)
{
}
virtual void
pub(const string& data, const Ice::Current&)
{
- IceUtil::StaticMutex::Lock sync(_countMutex);
+ IceUtil::StaticMutex::Lock sync(_countMutex);
- if(++_count == 30 + 40 + 30)
- {
- _communicator->shutdown();
- }
+ if(++_count == 30 + 40 + 30)
+ {
+ _communicator->shutdown();
+ }
}
private:
@@ -56,11 +56,11 @@ void
usage(const char* appName)
{
cerr << "Usage: " << appName << " [options]\n";
- cerr <<
- "Options:\n"
- "-h, --help Show this message.\n"
- "-b Use batch reliability.\n"
- ;
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-b Use batch reliability.\n"
+ ;
}
int
@@ -71,27 +71,27 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
int idx = 1;
while(idx < argc)
{
- if(strcmp(argv[idx], "-b") == 0)
- {
+ if(strcmp(argv[idx], "-b") == 0)
+ {
batch = true;
- for(int i = idx ; i + 1 < argc ; ++i)
- {
- argv[i] = argv[i + 1];
- }
- --argc;
- }
- else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
- {
- usage(argv[0]);
- return EXIT_SUCCESS;
- }
- else if(argv[idx][0] == '-')
- {
- cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+ else if(argv[idx][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
PropertiesPtr properties = communicator->getProperties();
@@ -99,16 +99,16 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
ObjectPrx base = communicator->stringToProxy(managerProxy);
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default");
@@ -128,15 +128,15 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
IceStorm::QoS qos;
if(batch)
{
- objFed1 = objFed1->ice_batchOneway();
- objFed2 = objFed1->ice_batchOneway();
- objFed3 = objFed1->ice_batchOneway();
+ objFed1 = objFed1->ice_batchOneway();
+ objFed2 = objFed1->ice_batchOneway();
+ objFed3 = objFed1->ice_batchOneway();
}
else
{
- objFed1 = objFed1->ice_oneway();
- objFed2 = objFed1->ice_oneway();
- objFed3 = objFed1->ice_oneway();
+ objFed1 = objFed1->ice_oneway();
+ objFed2 = objFed1->ice_oneway();
+ objFed3 = objFed1->ice_oneway();
}
TopicPrx fed1;
@@ -151,8 +151,8 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
catch(const IceStorm::NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
}
fed1->subscribeAndGetPublisher(qos, objFed1);
@@ -176,26 +176,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py
index eb8998394b5..36f479fb2b3 100755
--- a/cpp/test/IceStorm/federation/run.py
+++ b/cpp/test/IceStorm/federation/run.py
@@ -53,7 +53,7 @@ def doTest(batch):
command = subscriber + batchOptions + TestUtil.clientServerOptions + iceStormReference
if TestUtil.debug:
- print "(" + command + ")",
+ print "(" + command + ")",
subscriberPipe = os.popen(command + " 2>&1")
TestUtil.getServerPid(subscriberPipe)
TestUtil.getAdapterReady(subscriberPipe)
@@ -64,7 +64,7 @@ def doTest(batch):
#
command = publisher + TestUtil.clientOptions + iceStormReference
if TestUtil.debug:
- print "(" + command + ")",
+ print "(" + command + ")",
publisherPipe = os.popen(command + " 2>&1")
TestUtil.printOutputFromPipe(publisherPipe)
diff --git a/cpp/test/IceStorm/federation2/Publisher.cpp b/cpp/test/IceStorm/federation2/Publisher.cpp
index 6dc8a216ba9..0b5484f20fe 100644
--- a/cpp/test/IceStorm/federation2/Publisher.cpp
+++ b/cpp/test/IceStorm/federation2/Publisher.cpp
@@ -24,35 +24,35 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
ObjectPrx base = communicator->stringToProxy(managerProxy);
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
TopicPrx fed1;
try
{
- fed1 = manager->retrieve("fed1");
+ fed1 = manager->retrieve("fed1");
}
catch(const NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
-
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
+
}
EventPrx eventFed1 = EventPrx::uncheckedCast(fed1->getPublisher()->ice_oneway());
for(int i = 0; i < 10; ++i)
{
- eventFed1->pub("fed1");
+ eventFed1->pub("fed1");
}
//
@@ -72,26 +72,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/federation2/Subscriber.cpp b/cpp/test/IceStorm/federation2/Subscriber.cpp
index 88a4408c54d..2afdc080189 100644
--- a/cpp/test/IceStorm/federation2/Subscriber.cpp
+++ b/cpp/test/IceStorm/federation2/Subscriber.cpp
@@ -32,19 +32,19 @@ class EventI : public Event
public:
EventI(const CommunicatorPtr& communicator) :
- _communicator(communicator)
+ _communicator(communicator)
{
}
virtual void
pub(const string& data, const Ice::Current&)
{
- IceUtil::StaticMutex::Lock sync(_countMutex);
+ IceUtil::StaticMutex::Lock sync(_countMutex);
- if(++_count == 10)
- {
- _communicator->shutdown();
- }
+ if(++_count == 10)
+ {
+ _communicator->shutdown();
+ }
}
private:
@@ -64,11 +64,11 @@ void
usage(const char* appName)
{
cerr << "Usage: " << appName << " [options]\n";
- cerr <<
- "Options:\n"
- "-h, --help Show this message.\n"
- "-b Use batch reliability.\n"
- ;
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-b Use batch reliability.\n"
+ ;
}
int
@@ -79,27 +79,27 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
int idx = 1;
while(idx < argc)
{
- if(strcmp(argv[idx], "-b") == 0)
- {
+ if(strcmp(argv[idx], "-b") == 0)
+ {
batch = true;
- for(int i = idx ; i + 1 < argc ; ++i)
- {
- argv[i] = argv[i + 1];
- }
- --argc;
- }
- else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
- {
- usage(argv[0]);
- return EXIT_SUCCESS;
- }
- else if(argv[idx][0] == '-')
- {
- cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+ else if(argv[idx][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
PropertiesPtr properties = communicator->getProperties();
@@ -107,16 +107,16 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
ObjectPrx base = communicator->stringToProxy(managerProxy);
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default");
@@ -132,11 +132,11 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
IceStorm::QoS qos;
if(batch)
{
- obj = obj->ice_batchOneway();
+ obj = obj->ice_batchOneway();
}
else
{
- obj = obj->ice_oneway();
+ obj = obj->ice_oneway();
}
TopicPrx fed1;
@@ -147,8 +147,8 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
catch(const IceStorm::NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
}
fed1->subscribeAndGetPublisher(qos, obj);
@@ -168,26 +168,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py
index 2d5ba98bebb..36d520fb274 100755
--- a/cpp/test/IceStorm/federation2/run.py
+++ b/cpp/test/IceStorm/federation2/run.py
@@ -35,8 +35,8 @@ iceStormService = " --IceBox.Service.IceStorm=IceStormService," + TestUtil.getIc
' --Ice.OA.IceStorm.TopicManager.Endpoints="default -p 12011"' + \
' --Ice.OA.IceStorm.Publish.Endpoints="default -p 12012"' + \
' --IceStorm.InstanceName=TestIceStorm1 ' + \
- ' --IceStorm.Discard.Interval=2' + \
- ' --IceBox.PrintServicesReady=IceStorm' + \
+ ' --IceStorm.Discard.Interval=2' + \
+ ' --IceBox.PrintServicesReady=IceStorm' + \
" --IceBox.InheritContainerProperties=1"
iceStormReference = ' --IceStorm.TopicManager.Proxy="TestIceStorm1/TopicManager: default -p 12011"'
@@ -46,8 +46,8 @@ iceStormService2 = " --IceBox.Service.IceStorm=IceStormService," + TestUtil.getI
' --Ice.OA.IceStorm.TopicManager.Endpoints="default -p 12021"' + \
' --Ice.OA.IceStorm.Publish.Endpoints="default -p 12022"' + \
' --IceStorm.InstanceName=TestIceStorm2 ' + \
- ' --IceStorm.Discard.Interval=2' + \
- ' --IceBox.PrintServicesReady=IceStorm' + \
+ ' --IceStorm.Discard.Interval=2' + \
+ ' --IceBox.PrintServicesReady=IceStorm' + \
" --IceBox.InheritContainerProperties=1"
iceStormReference2 = ' --IceStorm.TopicManager.Proxy="TestIceStorm2/TopicManager: default -p 12021"'
@@ -70,11 +70,11 @@ def doTest(batch, subscriberRef = None):
batchOptions = ""
if subscriberRef == None:
- subscriberRef = iceStormReference2
+ subscriberRef = iceStormReference2
command = subscriber + batchOptions + TestUtil.clientServerOptions + subscriberRef
if TestUtil.debug:
- print "(" + command + ")",
+ print "(" + command + ")",
subscriberPipe = os.popen(command + " 2>&1")
TestUtil.getServerPid(subscriberPipe)
TestUtil.getAdapterReady(subscriberPipe)
@@ -85,7 +85,7 @@ def doTest(batch, subscriberRef = None):
#
command = publisher + TestUtil.clientOptions + iceStormReference
if TestUtil.debug:
- print "(" + command + ")",
+ print "(" + command + ")",
publisherPipe = os.popen(command + " 2>&1")
TestUtil.printOutputFromPipe(publisherPipe)
@@ -105,13 +105,13 @@ def startServers():
global iceStormDBEnv2
command = iceBox + TestUtil.clientServerOptions + iceBoxEndpoints + iceStormService + iceStormDBEnv
if TestUtil.debug:
- print "(" + command + ")",
+ print "(" + command + ")",
iceBoxPipe = os.popen(command + " 2>&1")
TestUtil.getServerPid(iceBoxPipe)
TestUtil.waitServiceReady(iceBoxPipe, "IceStorm")
command = iceBox + TestUtil.clientServerOptions + iceBoxEndpoints2 + iceStormService2 + iceStormDBEnv2
if TestUtil.debug:
- print "(" + command + ")",
+ print "(" + command + ")",
iceBoxPipe2 = os.popen(command + " 2>&1")
TestUtil.getServerPid(iceBoxPipe2)
TestUtil.waitServiceReady(iceBoxPipe2, "IceStorm")
@@ -125,21 +125,21 @@ def stopServers(p1, p2 = None):
global iceBoxEndpoints2
command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints + r' shutdown'
if TestUtil.debug:
- print "(" + command + ")",
+ print "(" + command + ")",
pipe = os.popen(command + " 2>&1")
status = TestUtil.closePipe(pipe)
if status or TestUtil.specificServerStatus(p1):
- TestUtil.killServers()
- sys.exit(1)
+ TestUtil.killServers()
+ sys.exit(1)
if p2:
- command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints2 + r' shutdown'
- if TestUtil.debug:
- print "(" + command + ")",
- pipe = os.popen(command + " 2>&1")
- status = TestUtil.closePipe(pipe)
- if status or TestUtil.specificServerStatus(p2):
- TestUtil.killServers()
- sys.exit(1)
+ command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints2 + r' shutdown'
+ if TestUtil.debug:
+ print "(" + command + ")",
+ pipe = os.popen(command + " 2>&1")
+ status = TestUtil.closePipe(pipe)
+ if status or TestUtil.specificServerStatus(p2):
+ TestUtil.killServers()
+ sys.exit(1)
dbHome = os.path.join(testdir, "db")
TestUtil.cleanDbDir(dbHome)
@@ -241,9 +241,9 @@ stopServers(iceBoxPipe1, iceBoxPipe2)
#
class ExpectorThread(threading.Thread):
def __init__(self, pipe):
- self.mutex = threading.Lock()
+ self.mutex = threading.Lock()
self.pipe = pipe
- # Suppress "adapter ready" messages. Under windows the eol isn't \n.
+ # Suppress "adapter ready" messages. Under windows the eol isn't \n.
self.re = [ [ re.compile(" ready\r?\n$"), 0 ] ]
threading.Thread.__init__(self)
@@ -252,41 +252,41 @@ class ExpectorThread(threading.Thread):
while 1:
line = self.pipe.readline()
if not line: break
- found = False;
- self.mutex.acquire()
- for item in self.re:
- if item[0].search(line):
- found = True
- item[1] = item[1] + 1
- break
- self.mutex.release()
- if not found:
- print line,
+ found = False;
+ self.mutex.acquire()
+ for item in self.re:
+ if item[0].search(line):
+ found = True
+ item[1] = item[1] + 1
+ break
+ self.mutex.release()
+ if not found:
+ print line,
except IOError:
pass
- self.status = TestUtil.closePipe(self.pipe)
+ self.status = TestUtil.closePipe(self.pipe)
# To comply with the ReaderThread protocol.
def getPipe(self):
- return self.pipe
+ return self.pipe
# To comply with the ReaderThread protocol.
def getStatus(self):
- return self.status
+ return self.status
def matches(self, index):
- self.mutex.acquire()
- m = self.re[index][1]
- self.mutex.release()
- return m
+ self.mutex.acquire()
+ m = self.re[index][1]
+ self.mutex.release()
+ return m
def expect(self, r):
- self.mutex.acquire()
- self.re.append([r, 0])
- l = len(self.re)-1
- self.mutex.release()
- return l
+ self.mutex.acquire()
+ self.re.append([r, 0])
+ l = len(self.re)-1
+ self.mutex.release()
+ return l
#
# Test #3:
@@ -430,8 +430,8 @@ iceStormAdminPipe = os.popen(command + " 2>&1")
line = iceStormAdminPipe.readline()
try:
if line and len(line) > 0:
- TestUtil.killServers()
- sys.exit(1)
+ TestUtil.killServers()
+ sys.exit(1)
except IOError:
pass
iceStormAdminStatus = TestUtil.closePipe(iceStormAdminPipe)
diff --git a/cpp/test/IceStorm/single/Publisher.cpp b/cpp/test/IceStorm/single/Publisher.cpp
index 0dab4de5ffd..454973b1d05 100644
--- a/cpp/test/IceStorm/single/Publisher.cpp
+++ b/cpp/test/IceStorm/single/Publisher.cpp
@@ -24,28 +24,28 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
- communicator->stringToProxy(managerProxy));
+ communicator->stringToProxy(managerProxy));
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
TopicPrx topic;
try
{
- topic = manager->retrieve("single");
+ topic = manager->retrieve("single");
}
catch(const NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
-
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
+
}
assert(topic);
@@ -56,7 +56,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
SinglePrx single = SinglePrx::uncheckedCast(topic->getPublisher()->ice_twoway());
for(int i = 0; i < 1000; ++i)
{
- single->event(i);
+ single->event(i);
}
return EXIT_SUCCESS;
@@ -70,26 +70,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp
index b1857119707..88d28a4e21e 100644
--- a/cpp/test/IceStorm/single/Subscriber.cpp
+++ b/cpp/test/IceStorm/single/Subscriber.cpp
@@ -23,10 +23,10 @@ class SingleI : public Single, public IceUtil::Monitor<IceUtil::Mutex>
public:
SingleI(const CommunicatorPtr& communicator, const string& name) :
- _communicator(communicator),
- _name(name),
- _count(0),
- _last(0)
+ _communicator(communicator),
+ _name(name),
+ _count(0),
+ _last(0)
{
}
@@ -34,64 +34,64 @@ public:
event(int i, const Current& current)
{
- if((_name == "default" || _name == "oneway" || _name == "batch" || _name == "datagram" ||
- _name == "batch datagram") && current.requestId != 0)
- {
- cerr << endl << "expected oneway request";
- test(false);
- }
- else if((_name == "twoway" || _name == "twoway ordered") && current.requestId == 0)
- {
- cerr << endl << "expected twoway request";
- }
- if(_name == "twoway ordered" && i != _last)
- {
- cerr << endl << "received unordered event for `" << _name << "': " << i << " " << _last;
- test(false);
- }
- if((_name == "datagram" || _name == "batch datagram") && current.con->type() != "udp")
- {
- cerr << endl << "expected datagram to be received over udp";
- test(false);
- }
- Lock sync(*this);
- ++_last;
- if(++_count == 1000)
- {
- notify();
- }
+ if((_name == "default" || _name == "oneway" || _name == "batch" || _name == "datagram" ||
+ _name == "batch datagram") && current.requestId != 0)
+ {
+ cerr << endl << "expected oneway request";
+ test(false);
+ }
+ else if((_name == "twoway" || _name == "twoway ordered") && current.requestId == 0)
+ {
+ cerr << endl << "expected twoway request";
+ }
+ if(_name == "twoway ordered" && i != _last)
+ {
+ cerr << endl << "received unordered event for `" << _name << "': " << i << " " << _last;
+ test(false);
+ }
+ if((_name == "datagram" || _name == "batch datagram") && current.con->type() != "udp")
+ {
+ cerr << endl << "expected datagram to be received over udp";
+ test(false);
+ }
+ Lock sync(*this);
+ ++_last;
+ if(++_count == 1000)
+ {
+ notify();
+ }
}
virtual void
waitForEvents()
{
- Lock sync(*this);
- cout << "testing " << _name << " reliability... " << flush;
- bool datagram = _name == "datagram" || _name == "batch datagram";
- IceUtil::Time timeout = (datagram) ? IceUtil::Time::seconds(5) : IceUtil::Time::seconds(20);
- while(_count < 1000)
- {
- if(!timedWait(timeout))
- {
- if(datagram && _count > 0)
- {
- if(_count < 100)
- {
- cout << "[" << _count << "/1000: This may be an error!!]";
- }
- else
- {
- cout << "[" << _count << "/1000] ";
- }
- break;
- }
- else
- {
- test(false);
- }
- }
- }
- cout << "ok" << endl;
+ Lock sync(*this);
+ cout << "testing " << _name << " reliability... " << flush;
+ bool datagram = _name == "datagram" || _name == "batch datagram";
+ IceUtil::Time timeout = (datagram) ? IceUtil::Time::seconds(5) : IceUtil::Time::seconds(20);
+ while(_count < 1000)
+ {
+ if(!timedWait(timeout))
+ {
+ if(datagram && _count > 0)
+ {
+ if(_count < 100)
+ {
+ cout << "[" << _count << "/1000: This may be an error!!]";
+ }
+ else
+ {
+ cout << "[" << _count << "/1000] ";
+ }
+ break;
+ }
+ else
+ {
+ test(false);
+ }
+ }
+ }
+ cout << "ok" << endl;
}
private:
@@ -112,16 +112,16 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
ObjectPrx base = communicator->stringToProxy(managerProxy);
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default:udp");
@@ -133,8 +133,8 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
catch(const IceStorm::NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
}
//
@@ -145,84 +145,84 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
// First we use the old deprecated API.
//
{
- subscribers.push_back(new SingleI(communicator, "default"));
- topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back()));
+ subscribers.push_back(new SingleI(communicator, "default"));
+ topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back()));
}
{
- subscribers.push_back(new SingleI(communicator, "oneway"));
- IceStorm::QoS qos;
- qos["reliability"] = "oneway";
- topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
+ subscribers.push_back(new SingleI(communicator, "oneway"));
+ IceStorm::QoS qos;
+ qos["reliability"] = "oneway";
+ topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
}
{
- subscribers.push_back(new SingleI(communicator, "twoway"));
- IceStorm::QoS qos;
- qos["reliability"] = "twoway";
- topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
+ subscribers.push_back(new SingleI(communicator, "twoway"));
+ IceStorm::QoS qos;
+ qos["reliability"] = "twoway";
+ topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
}
{
- subscribers.push_back(new SingleI(communicator, "batch"));
- IceStorm::QoS qos;
- qos["reliability"] = "batch";
- topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
+ subscribers.push_back(new SingleI(communicator, "batch"));
+ IceStorm::QoS qos;
+ qos["reliability"] = "batch";
+ topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
}
{
- subscribers.push_back(new SingleI(communicator, "twoway ordered")); // Ordered
- IceStorm::QoS qos;
- qos["reliability"] = "twoway ordered";
- topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
+ subscribers.push_back(new SingleI(communicator, "twoway ordered")); // Ordered
+ IceStorm::QoS qos;
+ qos["reliability"] = "twoway ordered";
+ topic->subscribe(qos, adapter->addWithUUID(subscribers.back()));
}
{
- subscribers.push_back(new SingleI(communicator, "datagram"));
- IceStorm::QoS qos;
- qos["reliability"] = "oneway";
- topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram());
+ subscribers.push_back(new SingleI(communicator, "datagram"));
+ IceStorm::QoS qos;
+ qos["reliability"] = "oneway";
+ topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram());
}
{
- subscribers.push_back(new SingleI(communicator, "batch datagram"));
- IceStorm::QoS qos;
- qos["reliability"] = "batch";
- topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram());
+ subscribers.push_back(new SingleI(communicator, "batch datagram"));
+ IceStorm::QoS qos;
+ qos["reliability"] = "batch";
+ topic->subscribe(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram());
}
//
// Next we use the new API call with the new proxy semantics.
//
{
- subscribers.push_back(new SingleI(communicator, "default"));
- topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_oneway());
+ subscribers.push_back(new SingleI(communicator, "default"));
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_oneway());
}
{
- subscribers.push_back(new SingleI(communicator, "oneway"));
- topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_oneway());
+ subscribers.push_back(new SingleI(communicator, "oneway"));
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_oneway());
}
{
- subscribers.push_back(new SingleI(communicator, "twoway"));
- topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back()));
+ subscribers.push_back(new SingleI(communicator, "twoway"));
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back()));
}
{
- subscribers.push_back(new SingleI(communicator, "batch"));
- topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_batchOneway());
+ subscribers.push_back(new SingleI(communicator, "batch"));
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_batchOneway());
}
{
- subscribers.push_back(new SingleI(communicator, "twoway ordered")); // Ordered
- IceStorm::QoS qos;
- qos["reliability"] = "ordered";
- topic->subscribeAndGetPublisher(qos, adapter->addWithUUID(subscribers.back()));
+ subscribers.push_back(new SingleI(communicator, "twoway ordered")); // Ordered
+ IceStorm::QoS qos;
+ qos["reliability"] = "ordered";
+ topic->subscribeAndGetPublisher(qos, adapter->addWithUUID(subscribers.back()));
}
{
- subscribers.push_back(new SingleI(communicator, "datagram"));
- topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram());
+ subscribers.push_back(new SingleI(communicator, "datagram"));
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_datagram());
}
{
- subscribers.push_back(new SingleI(communicator, "batch datagram"));
- topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_batchDatagram());
+ subscribers.push_back(new SingleI(communicator, "batch datagram"));
+ topic->subscribeAndGetPublisher(IceStorm::QoS(), adapter->addWithUUID(subscribers.back())->ice_batchDatagram());
}
adapter->activate();
for(vector<SingleIPtr>::const_iterator p = subscribers.begin(); p != subscribers.end(); ++p)
{
- (*p)->waitForEvents();
+ (*p)->waitForEvents();
}
return EXIT_SUCCESS;
@@ -236,26 +236,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/stress/Publisher.cpp b/cpp/test/IceStorm/stress/Publisher.cpp
index ad0fb64ed85..0be735c52c6 100644
--- a/cpp/test/IceStorm/stress/Publisher.cpp
+++ b/cpp/test/IceStorm/stress/Publisher.cpp
@@ -30,20 +30,20 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ return EXIT_FAILURE;
}
int events = 1000;
string s = opts.optArg("events");
if(!s.empty())
{
- events = atoi(s.c_str());
+ events = atoi(s.c_str());
}
if(events <= 0)
{
- cerr << argv[0] << ": events must be > 0." << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": events must be > 0." << endl;
+ return EXIT_FAILURE;
}
bool oneway = opts.isSet("oneway");
@@ -53,53 +53,53 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
- communicator->stringToProxy(managerProxy));
+ communicator->stringToProxy(managerProxy));
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
TopicPrx topic;
try
{
- topic = manager->retrieve("fed1");
+ topic = manager->retrieve("fed1");
}
catch(const NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
-
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
+
}
EventPrx twowayProxy = EventPrx::uncheckedCast(topic->getPublisher()->ice_twoway());
EventPrx proxy;
if(oneway)
{
- proxy = EventPrx::uncheckedCast(twowayProxy->ice_oneway());
+ proxy = EventPrx::uncheckedCast(twowayProxy->ice_oneway());
}
else
{
- proxy = twowayProxy;
+ proxy = twowayProxy;
}
for(int i = 0; i < events; ++i)
{
- proxy->pub(i);
+ proxy->pub(i);
}
if(oneway)
{
- //
- // Before we exit, we ping all proxies as twoway, to make sure
- // that all oneways are delivered.
- //
- twowayProxy->ice_ping();
+ //
+ // Before we exit, we ping all proxies as twoway, to make sure
+ // that all oneways are delivered.
+ //
+ twowayProxy->ice_ping();
}
return EXIT_SUCCESS;
@@ -113,26 +113,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/stress/Subscriber.cpp b/cpp/test/IceStorm/stress/Subscriber.cpp
index 0a10931b223..01590e4702f 100644
--- a/cpp/test/IceStorm/stress/Subscriber.cpp
+++ b/cpp/test/IceStorm/stress/Subscriber.cpp
@@ -28,14 +28,14 @@ class EventI : public Event, public IceUtil::Mutex
public:
EventI(const CommunicatorPtr& communicator, int total) :
- _communicator(communicator), _total(total), _count(0)
+ _communicator(communicator), _total(total), _count(0)
{
}
int count() const
{
- Lock sync(*this);
- return _count;
+ Lock sync(*this);
+ return _count;
}
protected:
@@ -51,24 +51,24 @@ class OrderEventI : public EventI
public:
OrderEventI(const CommunicatorPtr& communicator, int total) :
- EventI(communicator, total)
+ EventI(communicator, total)
{
}
virtual void
pub(int counter, const Ice::Current&)
{
- Lock sync(*this);
-
- if(counter != _count || counter == _total-1)
- {
- if(counter != _count)
- {
- cerr << "failed! expected event: " << _count << " received event: " << counter << endl;
- }
- _communicator->shutdown();
- }
- _count++;
+ Lock sync(*this);
+
+ if(counter != _count || counter == _total-1)
+ {
+ if(counter != _count)
+ {
+ cerr << "failed! expected event: " << _count << " received event: " << counter << endl;
+ }
+ _communicator->shutdown();
+ }
+ _count++;
}
};
@@ -77,19 +77,19 @@ class CountEventI : public EventI
public:
CountEventI(const CommunicatorPtr& communicator, int total) :
- EventI(communicator, total)
+ EventI(communicator, total)
{
}
virtual void
pub(int, const Ice::Current&)
{
- Lock sync(*this);
+ Lock sync(*this);
- if(++_count == _total)
- {
- _communicator->shutdown();
- }
+ if(++_count == _total)
+ {
+ _communicator->shutdown();
+ }
}
};
@@ -98,28 +98,28 @@ class SlowEventI : public EventI
public:
SlowEventI(const CommunicatorPtr& communicator, int total) :
- EventI(communicator, total)
+ EventI(communicator, total)
{
}
virtual void
pub(int, const Ice::Current&)
{
- Lock sync(*this);
-
- //
- // Ignore events over and above the expected.
- //
- if(_count >= _total)
- {
- return;
- }
- // Sleep for 3 seconds
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(3));
- if(++_count == _total)
- {
- _communicator->shutdown();
- }
+ Lock sync(*this);
+
+ //
+ // Ignore events over and above the expected.
+ //
+ if(_count >= _total)
+ {
+ return;
+ }
+ // Sleep for 3 seconds
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(3));
+ if(++_count == _total)
+ {
+ _communicator->shutdown();
+ }
}
};
@@ -128,32 +128,32 @@ class ErraticEventI : public EventI
public:
ErraticEventI(const CommunicatorPtr& communicator, int total) :
- EventI(communicator, total), _done(false)
+ EventI(communicator, total), _done(false)
{
- IceUtil::StaticMutex::Lock sync(_remainingMutex);
- ++_remaining;
+ IceUtil::StaticMutex::Lock sync(_remainingMutex);
+ ++_remaining;
}
virtual void
pub(int, const Ice::Current& current)
{
- Lock sync(*this);
-
- // Randomly close the connection.
- if(!_done && (IceUtil::random(10) == 1 || ++_count == _total))
- {
- _done = true;
- current.con->close(true);
- _count = _total;
- {
- IceUtil::StaticMutex::Lock sync(_remainingMutex);
- --_remaining;
- if(_remaining == 0)
- {
- _communicator->shutdown();
- }
- }
- }
+ Lock sync(*this);
+
+ // Randomly close the connection.
+ if(!_done && (IceUtil::random(10) == 1 || ++_count == _total))
+ {
+ _done = true;
+ current.con->close(true);
+ _count = _total;
+ {
+ IceUtil::StaticMutex::Lock sync(_remainingMutex);
+ --_remaining;
+ if(_remaining == 0)
+ {
+ _communicator->shutdown();
+ }
+ }
+ }
}
private:
@@ -189,20 +189,20 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ return EXIT_FAILURE;
}
int events = 1000;
string s = opts.optArg("events");
if(!s.empty())
{
- events = atoi(s.c_str());
+ events = atoi(s.c_str());
}
if(events <= 0)
{
- cerr << argv[0] << ": events must be > 0." << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": events must be > 0." << endl;
+ return EXIT_FAILURE;
}
IceStorm::QoS qos;
@@ -210,13 +210,13 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
vector<string> sqos = opts.argVec("qos");
for(vector<string>::const_iterator q = sqos.begin(); q != sqos.end(); ++q)
{
- string::size_type off = q->find(",");
- if(off == string::npos)
- {
- cerr << argv[0] << ": parse error: no , in QoS" << endl;
- return EXIT_FAILURE;
- }
- qos[q->substr(0, off)] = q->substr(off+1);
+ string::size_type off = q->find(",");
+ if(off == string::npos)
+ {
+ cerr << argv[0] << ": parse error: no , in QoS" << endl;
+ return EXIT_FAILURE;
+ }
+ qos[q->substr(0, off)] = q->substr(off+1);
}
bool slow = opts.isSet("slow");
@@ -225,13 +225,13 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
s = opts.optArg("erratic");
if(!s.empty())
{
- erratic = true;
- erraticNum = atoi(s.c_str());
+ erratic = true;
+ erraticNum = atoi(s.c_str());
}
if(events <= 0)
{
- cerr << argv[0] << ": events must be > 0." << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": events must be > 0." << endl;
+ return EXIT_FAILURE;
}
PropertiesPtr properties = communicator->getProperties();
@@ -239,16 +239,16 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
string managerProxy = properties->getProperty(managerProxyProperty);
if(managerProxy.empty())
{
- cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
}
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(
- communicator->stringToProxy(managerProxy));
+ communicator->stringToProxy(managerProxy));
if(!manager)
{
- cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl;
+ return EXIT_FAILURE;
}
vector<Subscription> subs;
@@ -259,40 +259,40 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
EventIPtr servant;
if(erratic)
{
- for(int i = 0 ; i< erraticNum; ++i)
- {
- ostringstream os;
- os << "SubscriberAdapter" << i;
- Subscription item;
- item.adapter = communicator->createObjectAdapterWithEndpoints(os.str(), "default");
- item.servant = new ErraticEventI(communicator, events);
- item.qos["reliability"] = "twoway";
- subs.push_back(item);
- }
+ for(int i = 0 ; i< erraticNum; ++i)
+ {
+ ostringstream os;
+ os << "SubscriberAdapter" << i;
+ Subscription item;
+ item.adapter = communicator->createObjectAdapterWithEndpoints(os.str(), "default");
+ item.servant = new ErraticEventI(communicator, events);
+ item.qos["reliability"] = "twoway";
+ subs.push_back(item);
+ }
}
else if(slow)
{
- servant = new SlowEventI(communicator, events);
+ servant = new SlowEventI(communicator, events);
}
else
{
- map<string, string>::iterator p = qos.find("reliability");
- if(p != qos.end())
- {
- reliability = p->second;
- if(reliability != "ordered")
- {
- qos.erase(p);
- }
- }
- if(reliability == "ordered")
- {
- servant = new OrderEventI(communicator, events);
- }
- else
- {
- servant = new CountEventI(communicator, events);
- }
+ map<string, string>::iterator p = qos.find("reliability");
+ if(p != qos.end())
+ {
+ reliability = p->second;
+ if(reliability != "ordered")
+ {
+ qos.erase(p);
+ }
+ }
+ if(reliability == "ordered")
+ {
+ servant = new OrderEventI(communicator, events);
+ }
+ else
+ {
+ servant = new CountEventI(communicator, events);
+ }
}
//
@@ -300,11 +300,11 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
//
if(subs.empty())
{
- Subscription item;
- item.adapter = adapter;
- item.servant = servant;
- item.qos = qos;
- subs.push_back(item);
+ Subscription item;
+ item.adapter = adapter;
+ item.servant = servant;
+ item.qos = qos;
+ subs.push_back(item);
}
TopicPrx topic;
@@ -314,43 +314,43 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
}
catch(const IceStorm::NoSuchTopic& e)
{
- cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
+ return EXIT_FAILURE;
}
{
- for(vector<Subscription>::iterator p = subs.begin(); p != subs.end(); ++p)
- {
- p->obj = p->adapter->addWithUUID(p->servant);
- if(reliability == "twoway" || reliability == "ordered")
- {
- // Do nothing.
- }
- else if(reliability == "batch")
- {
- p->obj = p->obj->ice_batchOneway();
- }
- else //if(reliability == "oneway")
- {
- p->obj = p->obj->ice_oneway();
- }
- p->adapter->activate();
- topic->subscribeAndGetPublisher(qos, p->obj);
- }
+ for(vector<Subscription>::iterator p = subs.begin(); p != subs.end(); ++p)
+ {
+ p->obj = p->adapter->addWithUUID(p->servant);
+ if(reliability == "twoway" || reliability == "ordered")
+ {
+ // Do nothing.
+ }
+ else if(reliability == "batch")
+ {
+ p->obj = p->obj->ice_batchOneway();
+ }
+ else //if(reliability == "oneway")
+ {
+ p->obj = p->obj->ice_oneway();
+ }
+ p->adapter->activate();
+ topic->subscribeAndGetPublisher(qos, p->obj);
+ }
}
communicator->waitForShutdown();
{
- for(vector<Subscription>::const_iterator p = subs.begin(); p != subs.end(); ++p)
- {
- topic->unsubscribe(p->obj);
- if(p->servant->count() != events)
- {
- cerr << "expected " << events << " events but got " << p->servant->count() << " events." << endl;
- return EXIT_FAILURE;
- }
- }
+ for(vector<Subscription>::const_iterator p = subs.begin(); p != subs.end(); ++p)
+ {
+ topic->unsubscribe(p->obj);
+ if(p->servant->count() != events)
+ {
+ cerr << "expected " << events << " events but got " << p->servant->count() << " events." << endl;
+ return EXIT_FAILURE;
+ }
+ }
}
return EXIT_SUCCESS;
@@ -364,26 +364,26 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
- status = run(argc, argv, communicator);
+ communicator = initialize(argc, argv);
+ status = run(argc, argv, communicator);
}
catch(const Exception& ex)
{
- cerr << ex << endl;
- status = EXIT_FAILURE;
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cpp/test/IceStorm/stress/run.py b/cpp/test/IceStorm/stress/run.py
index 7fc3b952ac0..0bf39f16d9c 100755
--- a/cpp/test/IceStorm/stress/run.py
+++ b/cpp/test/IceStorm/stress/run.py
@@ -35,8 +35,8 @@ iceStormService = " --IceBox.Service.IceStorm=IceStormService," + TestUtil.getIc
' --Ice.OA.IceStorm.TopicManager.Endpoints="default -p 12011"' + \
' --Ice.OA.IceStorm.Publish.Endpoints="default -p 12012"' + \
' --IceStorm.InstanceName=TestIceStorm1 ' + \
- ' --IceStorm.Discard.Interval=2' + \
- ' --IceBox.PrintServicesReady=IceStorm' + \
+ ' --IceStorm.Discard.Interval=2' + \
+ ' --IceBox.PrintServicesReady=IceStorm' + \
" --IceBox.InheritContainerProperties=1"
iceStormReference = ' --IceStorm.TopicManager.Proxy="TestIceStorm1/TopicManager: default -p 12011"'
@@ -46,8 +46,8 @@ iceStormService2 = " --IceBox.Service.IceStorm=IceStormService," + TestUtil.getI
' --Ice.OA.IceStorm.TopicManager.Endpoints="default -p 12021"' + \
' --Ice.OA.IceStorm.Publish.Endpoints="default -p 12022"' + \
' --IceStorm.InstanceName=TestIceStorm2 ' + \
- ' --IceStorm.Discard.Interval=2' + \
- ' --IceBox.PrintServicesReady=IceStorm' + \
+ ' --IceStorm.Discard.Interval=2' + \
+ ' --IceBox.PrintServicesReady=IceStorm' + \
" --IceBox.InheritContainerProperties=1"
iceStormReference2 = ' --IceStorm.TopicManager.Proxy="TestIceStorm2/TopicManager: default -p 12021"'
@@ -64,39 +64,39 @@ def doTest(subOpts, pubOpts):
subscriberPipes = []
if type(subOpts) != type([]):
- subOpts = [ subOpts ]
+ subOpts = [ subOpts ]
for opts in subOpts:
- command = subscriber + TestUtil.clientServerOptions + r' ' + opts
- if TestUtil.debug:
- print "(" + command + ")",
- sys.stdout.flush()
- pipe = os.popen(command + " 2>&1")
- TestUtil.getServerPid(pipe)
- TestUtil.getAdapterReady(pipe)
- subscriberPipes.append(pipe)
+ command = subscriber + TestUtil.clientServerOptions + r' ' + opts
+ if TestUtil.debug:
+ print "(" + command + ")",
+ sys.stdout.flush()
+ pipe = os.popen(command + " 2>&1")
+ TestUtil.getServerPid(pipe)
+ TestUtil.getAdapterReady(pipe)
+ subscriberPipes.append(pipe)
command = publisher + TestUtil.clientOptions + iceStormReference + r' ' + pubOpts
if TestUtil.debug:
- print "(" + command + ")",
- sys.stdout.flush()
+ print "(" + command + ")",
+ sys.stdout.flush()
publisherPipe = os.popen(command + " 2>&1")
TestUtil.printOutputFromPipe(publisherPipe)
publisherStatus = TestUtil.closePipe(publisherPipe)
if publisherStatus:
- print "(publisher failed)",
- return publisherStatus
+ print "(publisher failed)",
+ return publisherStatus
for p in subscriberPipes:
- try:
- sys.stdout.flush()
- subscriberStatus = TestUtil.specificServerStatus(p, 30)
- except:
- print "(subscriber failed)",
- return 1
- if subscriberStatus:
- print "(subscriber failed)",
- return subscriberStatus
+ try:
+ sys.stdout.flush()
+ subscriberStatus = TestUtil.specificServerStatus(p, 30)
+ except:
+ print "(subscriber failed)",
+ return 1
+ if subscriberStatus:
+ print "(subscriber failed)",
+ return subscriberStatus
return 0
@@ -113,15 +113,15 @@ def startServers():
# Clear the idle timeout otherwise the IceBox ThreadPool will timeout.
command = iceBox + TestUtil.clientServerOptions + iceBoxEndpoints + iceStormService + iceStormDBEnv + ' --Ice.ServerIdleTime=0'
if TestUtil.debug:
- print "(" + command + ")",
- sys.stdout.flush()
+ print "(" + command + ")",
+ sys.stdout.flush()
iceBoxPipe = os.popen(command + " 2>&1")
TestUtil.getServerPid(iceBoxPipe)
TestUtil.waitServiceReady(iceBoxPipe, "IceStorm")
command = iceBox + TestUtil.clientServerOptions + iceBoxEndpoints2 + iceStormService2 + iceStormDBEnv2 + ' --Ice.ServerIdleTime=0'
if TestUtil.debug:
- print "(" + command + ")",
- sys.stdout.flush()
+ print "(" + command + ")",
+ sys.stdout.flush()
iceBoxPipe2 = os.popen(command + " 2>&1")
TestUtil.getServerPid(iceBoxPipe2)
TestUtil.waitServiceReady(iceBoxPipe2, "IceStorm")
@@ -138,23 +138,23 @@ def stopServers(p1, p2 = None):
sys.stdout.flush()
command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints + r' shutdown'
if TestUtil.debug:
- print "(" + command + ")",
- sys.stdout.flush()
+ print "(" + command + ")",
+ sys.stdout.flush()
pipe = os.popen(command + " 2>&1")
status = TestUtil.closePipe(pipe)
if status or TestUtil.specificServerStatus(p1):
- TestUtil.killServers()
- sys.exit(1)
+ TestUtil.killServers()
+ sys.exit(1)
if p2:
- command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints2 + r' shutdown'
- if TestUtil.debug:
- print "(" + command + ")",
- sys.stdout.flush()
- pipe = os.popen(command + " 2>&1")
- status = TestUtil.closePipe(pipe)
- if status or TestUtil.specificServerStatus(p2):
- TestUtil.killServers()
- sys.exit(1)
+ command = iceBoxAdmin + TestUtil.clientOptions + iceBoxEndpoints2 + r' shutdown'
+ if TestUtil.debug:
+ print "(" + command + ")",
+ sys.stdout.flush()
+ pipe = os.popen(command + " 2>&1")
+ status = TestUtil.closePipe(pipe)
+ if status or TestUtil.specificServerStatus(p2):
+ TestUtil.killServers()
+ sys.exit(1)
print "ok"
dbHome = os.path.join(testdir, "db")
@@ -271,8 +271,8 @@ print "ok"
print "Sending 20000 unordered events with erratic subscriber across a link... ",
status = doTest(['--erratic 10 --events 20000' + iceStormReference, '--events 20000 ' + iceStormReference, \
- '--erratic 10 --events 20000' + iceStormReference2, '--events 20000 ' + iceStormReference2], \
- '--events 20000 --oneway')
+ '--erratic 10 --events 20000' + iceStormReference2, '--events 20000 ' + iceStormReference2], \
+ '--events 20000 --oneway')
if status:
print "failed!"
TestUtil.killServers()
diff --git a/cpp/test/IceUtil/ctrlCHandler/Client.cpp b/cpp/test/IceUtil/ctrlCHandler/Client.cpp
index 7f838b69eee..a71a95dba6c 100644
--- a/cpp/test/IceUtil/ctrlCHandler/Client.cpp
+++ b/cpp/test/IceUtil/ctrlCHandler/Client.cpp
@@ -23,13 +23,13 @@ void callback(int signal)
int main()
{
{
- cout << "First ignore CTRL+C and the like for 10 seconds (try it!)" << endl;
- CtrlCHandler handler;
- ThreadControl::sleep(Time::seconds(10));
-
- cout << "Then handling them for another 30 seconds (try it)" << endl;
- handler.setCallback(callback);
- ThreadControl::sleep(Time::seconds(10));
+ cout << "First ignore CTRL+C and the like for 10 seconds (try it!)" << endl;
+ CtrlCHandler handler;
+ ThreadControl::sleep(Time::seconds(10));
+
+ cout << "Then handling them for another 30 seconds (try it)" << endl;
+ handler.setCallback(callback);
+ ThreadControl::sleep(Time::seconds(10));
}
cout << "And another 10 seconds after ~CtrlCHandler" << endl;
ThreadControl::sleep(Time::seconds(10));
diff --git a/cpp/test/IceUtil/inputUtil/Client.cpp b/cpp/test/IceUtil/inputUtil/Client.cpp
index 0bec2c0317e..5a7ef96bc28 100644
--- a/cpp/test/IceUtil/inputUtil/Client.cpp
+++ b/cpp/test/IceUtil/inputUtil/Client.cpp
@@ -178,14 +178,14 @@ main(int, char**)
badQuoteCommands.push_back("-Dir=$'test");
for(vector<string>::const_iterator p = badQuoteCommands.begin(); p != badQuoteCommands.end(); ++p)
{
- try
- {
- IceUtil::Options::split(*p);
- test(false);
- }
- catch(const IceUtil::BadOptException&)
- {
- }
+ try
+ {
+ IceUtil::Options::split(*p);
+ test(false);
+ }
+ catch(const IceUtil::BadOptException&)
+ {
+ }
}
cout << "ok" << endl;
diff --git a/cpp/test/IceUtil/thread/AliveTest.cpp b/cpp/test/IceUtil/thread/AliveTest.cpp
index efb8ed26c6b..e1c526d2b54 100644
--- a/cpp/test/IceUtil/thread/AliveTest.cpp
+++ b/cpp/test/IceUtil/thread/AliveTest.cpp
@@ -21,24 +21,24 @@ class CondVar : public IceUtil::Monitor<IceUtil::RecMutex>
public:
CondVar() :
- _done(false)
+ _done(false)
{
}
void waitForSignal()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
- while(!_done)
- {
- wait();
- }
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
+ while(!_done)
+ {
+ wait();
+ }
}
void signal()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
- _done = true;
- notify();
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
+ _done = true;
+ notify();
}
private:
@@ -51,20 +51,20 @@ class AliveTestThread : public Thread
public:
AliveTestThread(CondVar& childCreated, CondVar& parentReady) :
- _childCreated(childCreated), _parentReady(parentReady)
+ _childCreated(childCreated), _parentReady(parentReady)
{
}
virtual void run()
{
- try
- {
- _childCreated.signal();
- _parentReady.waitForSignal();
- }
- catch(IceUtil::ThreadLockedException &)
- {
- }
+ try
+ {
+ _childCreated.signal();
+ _parentReady.waitForSignal();
+ }
+ catch(IceUtil::ThreadLockedException &)
+ {
+ }
}
private:
diff --git a/cpp/test/IceUtil/thread/Client.cpp b/cpp/test/IceUtil/thread/Client.cpp
index da04fabc81a..bea92fa446f 100644
--- a/cpp/test/IceUtil/thread/Client.cpp
+++ b/cpp/test/IceUtil/thread/Client.cpp
@@ -21,17 +21,17 @@ main(int argc, char** argv)
{
try
{
- initializeTestSuite();
+ initializeTestSuite();
- for(list<TestBasePtr>::const_iterator p = allTests.begin(); p != allTests.end(); ++p)
- {
- (*p)->start();
- }
+ for(list<TestBasePtr>::const_iterator p = allTests.begin(); p != allTests.end(); ++p)
+ {
+ (*p)->start();
+ }
}
catch(const TestFailed& e)
{
- cout << "test " << e.name << " failed" << endl;
- return EXIT_FAILURE;
+ cout << "test " << e.name << " failed" << endl;
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
diff --git a/cpp/test/IceUtil/thread/CountDownLatchTest.cpp b/cpp/test/IceUtil/thread/CountDownLatchTest.cpp
index ea30c1aa721..3a26c9349cd 100644
--- a/cpp/test/IceUtil/thread/CountDownLatchTest.cpp
+++ b/cpp/test/IceUtil/thread/CountDownLatchTest.cpp
@@ -24,28 +24,28 @@ class CountDownLatchTestThread : public Thread
public:
CountDownLatchTestThread(CountDownLatch& latch, int& val, bool takeOne) :
- _latch(latch),
- _val(val),
- _takeOne(takeOne)
+ _latch(latch),
+ _val(val),
+ _takeOne(takeOne)
{
}
virtual void run()
{
- if(_takeOne)
- {
- _latch.countDown();
- }
-
- if(_latch.getCount() == 0)
- {
- test(_val == magic);
- }
-
- _latch.await();
- test(_latch.getCount() == 0);
- test(_val == magic);
+ if(_takeOne)
+ {
+ _latch.countDown();
+ }
+
+ if(_latch.getCount() == 0)
+ {
+ test(_val == magic);
+ }
+
+ _latch.await();
+ test(_latch.getCount() == 0);
+ test(_val == magic);
}
private:
@@ -76,8 +76,8 @@ CountDownLatchTest::run()
ThreadPtr t1[wave1Count];
for(i = 0; i < wave1Count; i++)
{
- t1[i] = new CountDownLatchTestThread(latch, val, false);
- t1[i]->start();
+ t1[i] = new CountDownLatchTestThread(latch, val, false);
+ t1[i]->start();
}
//
@@ -92,8 +92,8 @@ CountDownLatchTest::run()
ThreadPtr t2[fullCount - 1];
for(i = 0; i < fullCount - 1; i++)
{
- t2[i] = new CountDownLatchTestThread(latch, val, true);
- t2[i]->start();
+ t2[i] = new CountDownLatchTestThread(latch, val, true);
+ t2[i]->start();
}
//
@@ -101,17 +101,17 @@ CountDownLatchTest::run()
//
do
{
- ThreadControl::sleep(Time::milliSeconds(100));
-
- for(i = 0; i < wave1Count; i++)
- {
- test(t1[i]->isAlive());
- }
-
- for(i = 0; i < fullCount - 1; i++)
- {
- test(t2[i]->isAlive());
- }
+ ThreadControl::sleep(Time::milliSeconds(100));
+
+ for(i = 0; i < wave1Count; i++)
+ {
+ test(t1[i]->isAlive());
+ }
+
+ for(i = 0; i < fullCount - 1; i++)
+ {
+ test(t2[i]->isAlive());
+ }
} while(latch.getCount() > 1);
@@ -127,12 +127,12 @@ CountDownLatchTest::run()
//
for(i = 0; i < wave1Count; i++)
{
- t1[i]->getThreadControl().join();
+ t1[i]->getThreadControl().join();
}
for(i = 0; i < fullCount - 1; i++)
{
- t2[i]->getThreadControl().join();
+ t2[i]->getThreadControl().join();
}
test(latch.getCount() == 0);
@@ -141,14 +141,14 @@ CountDownLatchTest::run()
ThreadPtr t3[wave2Count];
for(i = 0; i < wave2Count; i++)
{
- t3[i] = new CountDownLatchTestThread(latch, val, true);
- t3[i]->start();
+ t3[i] = new CountDownLatchTestThread(latch, val, true);
+ t3[i]->start();
}
test(latch.getCount() == 0);
for(i = 0; i < wave2Count; i++)
{
- t3[i]->getThreadControl().join();
+ t3[i]->getThreadControl().join();
}
test(latch.getCount() == 0);
}
diff --git a/cpp/test/IceUtil/thread/CreateTest.cpp b/cpp/test/IceUtil/thread/CreateTest.cpp
index a1ea843fb5a..04f9dc2ad42 100644
--- a/cpp/test/IceUtil/thread/CreateTest.cpp
+++ b/cpp/test/IceUtil/thread/CreateTest.cpp
@@ -25,13 +25,13 @@ class CreateTestThread : public Thread
public:
CreateTestThread() :
- threadran(false)
+ threadran(false)
{
}
virtual void run()
{
- threadran = true;
+ threadran = true;
}
bool threadran;
@@ -49,16 +49,16 @@ CreateTest::run()
{
for(int i = 0; i < 4096 ; ++i)
{
- CreateTestThreadPtr t = new CreateTestThread();
- ThreadControl control = t->start();
- control.join();
- test(t->threadran);
- if((i % 256) == 0)
- {
- char buf[5];
- sprintf(buf, "%04d", i);
- cout << buf << "" << flush;
- }
+ CreateTestThreadPtr t = new CreateTestThread();
+ ThreadControl control = t->start();
+ control.join();
+ test(t->threadran);
+ if((i % 256) == 0)
+ {
+ char buf[5];
+ sprintf(buf, "%04d", i);
+ cout << buf << "" << flush;
+ }
}
cout << " " << flush;
}
diff --git a/cpp/test/IceUtil/thread/MonitorMutexTest.cpp b/cpp/test/IceUtil/thread/MonitorMutexTest.cpp
index a993e661348..6cfc32d2cd6 100644
--- a/cpp/test/IceUtil/thread/MonitorMutexTest.cpp
+++ b/cpp/test/IceUtil/thread/MonitorMutexTest.cpp
@@ -20,33 +20,33 @@ class MonitorMutexTestThread : public Thread
public:
MonitorMutexTestThread(Monitor<Mutex>& m) :
- _monitor(m),
- _tryLock(false)
+ _monitor(m),
+ _tryLock(false)
{
}
virtual void run()
{
- Monitor<Mutex>::TryLock tlock(_monitor);
- test(!tlock.acquired());
-
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
-
- Monitor<Mutex>::Lock lock(_monitor);
+ Monitor<Mutex>::TryLock tlock(_monitor);
+ test(!tlock.acquired());
+
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
+
+ Monitor<Mutex>::Lock lock(_monitor);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -67,16 +67,16 @@ class MonitorMutexTestThread2 : public Thread
public:
MonitorMutexTestThread2(Monitor<Mutex>& monitor) :
- finished(false),
- _monitor(monitor)
+ finished(false),
+ _monitor(monitor)
{
}
virtual void run()
{
- Monitor<Mutex>::Lock lock(_monitor);
- _monitor.wait();
- finished = true;
+ Monitor<Mutex>::Lock lock(_monitor);
+ _monitor.wait();
+ finished = true;
}
bool finished;
@@ -106,27 +106,27 @@ MonitorMutexTest::run()
ThreadControl control2;
{
- Monitor<Mutex>::Lock lock(monitor);
-
- try
- {
- Monitor<Mutex>::TryLock tlock(monitor);
- test(!tlock.acquired());
- }
- catch(const ThreadLockedException&)
- {
- //
- // pthread_mutex_trylock returns EDEADLK in FreeBSD's new threading implementation
- // as well as in Fedora Core 5.
- //
- }
-
- // TEST: Start thread, try to acquire the mutex.
- t = new MonitorMutexTestThread(monitor);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ Monitor<Mutex>::Lock lock(monitor);
+
+ try
+ {
+ Monitor<Mutex>::TryLock tlock(monitor);
+ test(!tlock.acquired());
+ }
+ catch(const ThreadLockedException&)
+ {
+ //
+ // pthread_mutex_trylock returns EDEADLK in FreeBSD's new threading implementation
+ // as well as in Fedora Core 5.
+ //
+ }
+
+ // TEST: Start thread, try to acquire the mutex.
+ t = new MonitorMutexTestThread(monitor);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
@@ -145,8 +145,8 @@ MonitorMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<Mutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<Mutex>::Lock lock(monitor);
+ monitor.notify();
}
// Give one thread time to terminate
@@ -155,8 +155,8 @@ MonitorMutexTest::run()
test((t2->finished && !t3->finished) || (t3->finished && !t2->finished));
{
- Monitor<Mutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<Mutex>::Lock lock(monitor);
+ monitor.notify();
}
control.join();
control2.join();
@@ -171,8 +171,8 @@ MonitorMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<Mutex>::Lock lock(monitor);
- monitor.notifyAll();
+ Monitor<Mutex>::Lock lock(monitor);
+ monitor.notifyAll();
}
control.join();
@@ -180,7 +180,7 @@ MonitorMutexTest::run()
// TEST: timedWait
{
- Monitor<Mutex>::Lock lock(monitor);
- test(!monitor.timedWait(Time::milliSeconds(500)));
+ Monitor<Mutex>::Lock lock(monitor);
+ test(!monitor.timedWait(Time::milliSeconds(500)));
}
}
diff --git a/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp b/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp
index a2f24fa5630..79731b02849 100644
--- a/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp
+++ b/cpp/test/IceUtil/thread/MonitorRecMutexTest.cpp
@@ -20,34 +20,34 @@ class MonitorRecMutexTestThread : public Thread
public:
MonitorRecMutexTestThread(Monitor<RecMutex>& m) :
- _monitor(m),
- _tryLock(false)
+ _monitor(m),
+ _tryLock(false)
{
}
virtual void run()
{
-
- Monitor<RecMutex>::TryLock tlock(_monitor);
- test(!tlock.acquired());
-
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
-
- Monitor<RecMutex>::Lock lock(_monitor);
+
+ Monitor<RecMutex>::TryLock tlock(_monitor);
+ test(!tlock.acquired());
+
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
+
+ Monitor<RecMutex>::Lock lock(_monitor);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -68,16 +68,16 @@ class MonitorRecMutexTestThread2 : public Thread, public Monitor<RecMutex>
public:
MonitorRecMutexTestThread2(Monitor<RecMutex>& monitor) :
- finished(false),
- _monitor(monitor)
+ finished(false),
+ _monitor(monitor)
{
}
virtual void run()
{
- Monitor<RecMutex>::Lock lock(_monitor);
- _monitor.wait();
- finished = true;
+ Monitor<RecMutex>::Lock lock(_monitor);
+ _monitor.wait();
+ finished = true;
}
bool finished;
@@ -108,22 +108,22 @@ MonitorRecMutexTest::run()
{
- Monitor<RecMutex>::Lock lock(monitor);
-
- Monitor<RecMutex>::TryLock lock2(monitor);
- test(lock2.acquired());
-
- // TEST: TryLock
-
- Monitor<RecMutex>::TryLock tlock(monitor);
- test(tlock.acquired());
-
- // TEST: Start thread, try to acquire the mutex.
- t = new MonitorRecMutexTestThread(monitor);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ Monitor<RecMutex>::Lock lock(monitor);
+
+ Monitor<RecMutex>::TryLock lock2(monitor);
+ test(lock2.acquired());
+
+ // TEST: TryLock
+
+ Monitor<RecMutex>::TryLock tlock(monitor);
+ test(tlock.acquired());
+
+ // TEST: Start thread, try to acquire the mutex.
+ t = new MonitorRecMutexTestThread(monitor);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
@@ -142,8 +142,8 @@ MonitorRecMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<RecMutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<RecMutex>::Lock lock(monitor);
+ monitor.notify();
}
// Give one thread time to terminate
@@ -152,8 +152,8 @@ MonitorRecMutexTest::run()
test((t2->finished && !t3->finished) || (t3->finished && !t2->finished));
{
- Monitor<RecMutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<RecMutex>::Lock lock(monitor);
+ monitor.notify();
}
control.join();
control2.join();
@@ -168,8 +168,8 @@ MonitorRecMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<RecMutex>::Lock lock(monitor);
- monitor.notifyAll();
+ Monitor<RecMutex>::Lock lock(monitor);
+ monitor.notifyAll();
}
control.join();
@@ -177,7 +177,7 @@ MonitorRecMutexTest::run()
// TEST: timedWait
{
- Monitor<RecMutex>::Lock lock(monitor);
- test(!monitor.timedWait(Time::milliSeconds(500)));
+ Monitor<RecMutex>::Lock lock(monitor);
+ test(!monitor.timedWait(Time::milliSeconds(500)));
}
}
diff --git a/cpp/test/IceUtil/thread/MutexTest.cpp b/cpp/test/IceUtil/thread/MutexTest.cpp
index 0ae62305bd8..3c6f6d18fac 100644
--- a/cpp/test/IceUtil/thread/MutexTest.cpp
+++ b/cpp/test/IceUtil/thread/MutexTest.cpp
@@ -22,33 +22,33 @@ class MutexTestThread : public Thread
public:
MutexTestThread(Mutex& m) :
- _mutex(m),
- _tryLock(false)
+ _mutex(m),
+ _tryLock(false)
{
}
virtual void run()
- {
- Mutex::TryLock tlock(_mutex);
- test(!tlock.acquired());
+ {
+ Mutex::TryLock tlock(_mutex);
+ test(!tlock.acquired());
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
- Mutex::Lock lock(_mutex);
+ Mutex::Lock lock(_mutex);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -77,80 +77,80 @@ MutexTest::run()
ThreadControl control;
{
- Mutex::Lock lock(mutex);
-
- // LockT testing:
- //
-
- test(lock.acquired());
-
- try
- {
- lock.acquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- try
- {
- lock.tryAcquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(lock.acquired());
- lock.release();
- test(!lock.acquired());
-
- try
- {
- lock.release();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- Mutex::TryLock lock2(mutex);
- try
- {
- test(lock.tryAcquire() == false);
- }
- catch(const ThreadLockedException&)
- {
- }
- lock2.release();
- test(lock.tryAcquire() == true);
- test(lock.acquired());
-
- // Deadlock testing
- //
+ Mutex::Lock lock(mutex);
+
+ // LockT testing:
+ //
+
+ test(lock.acquired());
+
+ try
+ {
+ lock.acquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ lock.tryAcquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(lock.acquired());
+ lock.release();
+ test(!lock.acquired());
+
+ try
+ {
+ lock.release();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ Mutex::TryLock lock2(mutex);
+ try
+ {
+ test(lock.tryAcquire() == false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ }
+ lock2.release();
+ test(lock.tryAcquire() == true);
+ test(lock.acquired());
+
+ // Deadlock testing
+ //
#if !defined(NDEBUG) && !defined(_WIN32)
- try
- {
- Mutex::Lock lock3(mutex);
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
+ try
+ {
+ Mutex::Lock lock3(mutex);
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
#endif
- // TEST: Start thread, try to acquire the mutex.
- t = new MutexTestThread(mutex);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ // TEST: Start thread, try to acquire the mutex.
+ t = new MutexTestThread(mutex);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
diff --git a/cpp/test/IceUtil/thread/RWRecMutexTest.cpp b/cpp/test/IceUtil/thread/RWRecMutexTest.cpp
index af3180c8d80..72834b254f0 100644
--- a/cpp/test/IceUtil/thread/RWRecMutexTest.cpp
+++ b/cpp/test/IceUtil/thread/RWRecMutexTest.cpp
@@ -22,19 +22,19 @@ class RWRecMutexTestThread : public Thread
public:
RWRecMutexTestThread(RWRecMutex& m) :
- _mutex(m),
- _tryLock(false)
+ _mutex(m),
+ _tryLock(false)
{
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
protected:
@@ -54,23 +54,23 @@ class RWRecMutexReadTestThread : public RWRecMutexTestThread
public:
RWRecMutexReadTestThread(RWRecMutex& m) :
- RWRecMutexTestThread(m)
+ RWRecMutexTestThread(m)
{
}
virtual void
run()
{
- RWRecMutex::TryRLock tlock(_mutex);
- test(tlock.acquired());
-
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
+ RWRecMutex::TryRLock tlock(_mutex);
+ test(tlock.acquired());
+
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
- RWRecMutex::RLock lock(_mutex);
+ RWRecMutex::RLock lock(_mutex);
}
};
@@ -79,24 +79,24 @@ class RWRecMutexReadTestThread2 : public RWRecMutexTestThread
public:
RWRecMutexReadTestThread2(RWRecMutex& m) :
- RWRecMutexTestThread(m)
+ RWRecMutexTestThread(m)
{
}
virtual void
run()
{
-
- RWRecMutex::TryRLock tlock(_mutex);
- test(!tlock.acquired());
+
+ RWRecMutex::TryRLock tlock(_mutex);
+ test(!tlock.acquired());
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
- RWRecMutex::RLock lock(_mutex);
+ RWRecMutex::RLock lock(_mutex);
}
};
@@ -105,54 +105,54 @@ class RWRecMutexUpgradeReadThread : public Thread
public:
RWRecMutexUpgradeReadThread(RWRecMutex& m) :
- _mutex(m),
- _unlock(false),
- _lock(false)
+ _mutex(m),
+ _unlock(false),
+ _lock(false)
{
}
virtual void
run()
{
- RWRecMutex::RLock lock(_mutex);
+ RWRecMutex::RLock lock(_mutex);
- signalLock();
- waitUnlock();
+ signalLock();
+ waitUnlock();
}
void
waitUnlock()
{
- Mutex::Lock lock(_unlockMutex);
- while(!_unlock)
- {
- _unlockCond.wait(lock);
- }
+ Mutex::Lock lock(_unlockMutex);
+ while(!_unlock)
+ {
+ _unlockCond.wait(lock);
+ }
}
void
signalUnlock()
{
- Mutex::Lock lock(_unlockMutex);
- _unlock = true;
- _unlockCond.signal();
+ Mutex::Lock lock(_unlockMutex);
+ _unlock = true;
+ _unlockCond.signal();
}
void
signalLock()
{
- Mutex::Lock lock(_lockMutex);
- _lock = true;
- _lockCond.signal();
+ Mutex::Lock lock(_lockMutex);
+ _lock = true;
+ _lockCond.signal();
}
void
waitLock()
{
- Mutex::Lock lock(_lockMutex);
- while(!_lock)
- {
- _lockCond.wait(lock);
- }
+ Mutex::Lock lock(_lockMutex);
+ while(!_lock)
+ {
+ _lockCond.wait(lock);
+ }
}
private:
@@ -177,45 +177,45 @@ class RWRecMutexUpgradeTestThread : public Thread
public:
RWRecMutexUpgradeTestThread(RWRecMutex& m) :
- _mutex(m),
- _lock(false),
- _upgradeAcquired(false)
+ _mutex(m),
+ _lock(false),
+ _upgradeAcquired(false)
{
}
virtual void
run()
{
- RWRecMutex::RLock lock(_mutex);
+ RWRecMutex::RLock lock(_mutex);
- signalLock();
- lock.upgrade();
+ signalLock();
+ lock.upgrade();
- _upgradeAcquired = true;
+ _upgradeAcquired = true;
}
void
signalLock()
{
- Mutex::Lock lock(_lockMutex);
- _lock = true;
- _lockCond.signal();
+ Mutex::Lock lock(_lockMutex);
+ _lock = true;
+ _lockCond.signal();
}
void
waitLock()
{
- Mutex::Lock lock(_lockMutex);
- while(!_lock)
- {
- _lockCond.wait(lock);
- }
+ Mutex::Lock lock(_lockMutex);
+ while(!_lock)
+ {
+ _lockCond.wait(lock);
+ }
}
bool
upgradeAcquired() const
{
- return _upgradeAcquired;
+ return _upgradeAcquired;
}
private:
@@ -238,24 +238,24 @@ class RWRecMutexWriteTestThread : public RWRecMutexTestThread
public:
RWRecMutexWriteTestThread(RWRecMutex& m) :
- RWRecMutexTestThread(m)
+ RWRecMutexTestThread(m)
{
}
virtual void
run()
{
-
- RWRecMutex::TryWLock tlock(_mutex);
- test(!tlock.acquired());
+
+ RWRecMutex::TryWLock tlock(_mutex);
+ test(!tlock.acquired());
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
- RWRecMutex::WLock lock(_mutex);
+ RWRecMutex::WLock lock(_mutex);
}
};
typedef Handle<RWRecMutexTestThread> RWRecMutexTestThreadPtr;
@@ -266,79 +266,79 @@ public:
RWRecMutexUpgradeThread(RWRecMutex& m, bool timed = false)
: _m(m),
- _timed(timed),
- _destroyed(false),
- _upgrading(false),
- _hasWriteLock(false),
- _failed(false)
+ _timed(timed),
+ _destroyed(false),
+ _upgrading(false),
+ _hasWriteLock(false),
+ _failed(false)
{
}
virtual void
run()
{
- //
- // Acquire a read lock.
- //
- RWRecMutex::RLock tlock(_m);
-
- {
- Lock sync(*this);
- _upgrading = true;
- notify();
- }
-
- try
- {
- if(_timed)
- {
- if(!_m.timedUpgrade(IceUtil::Time::seconds(10)))
- {
- _failed = true;
- }
- }
- else
- {
- _m.upgrade();
- }
- }
- catch(DeadlockException&)
- {
- _failed = true;
- }
-
- {
- Lock sync(*this);
- _hasWriteLock = true;
- notify();
-
- while(!_destroyed)
- {
- wait();
- }
- }
+ //
+ // Acquire a read lock.
+ //
+ RWRecMutex::RLock tlock(_m);
+
+ {
+ Lock sync(*this);
+ _upgrading = true;
+ notify();
+ }
+
+ try
+ {
+ if(_timed)
+ {
+ if(!_m.timedUpgrade(IceUtil::Time::seconds(10)))
+ {
+ _failed = true;
+ }
+ }
+ else
+ {
+ _m.upgrade();
+ }
+ }
+ catch(DeadlockException&)
+ {
+ _failed = true;
+ }
+
+ {
+ Lock sync(*this);
+ _hasWriteLock = true;
+ notify();
+
+ while(!_destroyed)
+ {
+ wait();
+ }
+ }
}
void
waitUpgrade()
{
- Lock sync(*this);
+ Lock sync(*this);
- //
- // Wait for the _upgrading flag to be set.
- //
- while(!_upgrading)
- {
- wait();
- }
+ //
+ // Wait for the _upgrading flag to be set.
+ //
+ while(!_upgrading)
+ {
+ wait();
+ }
}
void
destroy()
{
- Lock sync(*this);
- _destroyed = true;
- notify();
+ Lock sync(*this);
+ _destroyed = true;
+ notify();
}
//
@@ -349,18 +349,18 @@ public:
bool
waitHasWriteLock()
{
- Lock sync(*this);
- if(!_hasWriteLock)
- {
- timedWait(Time::seconds(10));
- }
- return _hasWriteLock;
+ Lock sync(*this);
+ if(!_hasWriteLock)
+ {
+ timedWait(Time::seconds(10));
+ }
+ return _hasWriteLock;
}
bool
failed() const
{
- return _failed;
+ return _failed;
}
private:
@@ -380,70 +380,70 @@ public:
RWRecMutexWriteThread(RWRecMutex& m)
: _m(m),
- _destroyed(false),
- _waitWrite(false),
- _hasWriteLock(false)
+ _destroyed(false),
+ _waitWrite(false),
+ _hasWriteLock(false)
{
}
virtual void
run()
{
- {
- Lock sync(*this);
- _waitWrite = true;
- notify();
- }
- //
- // Acquire a read lock.
- //
- RWRecMutex::WLock sync(_m);
+ {
+ Lock sync(*this);
+ _waitWrite = true;
+ notify();
+ }
+ //
+ // Acquire a read lock.
+ //
+ RWRecMutex::WLock sync(_m);
- {
- Lock sync(*this);
- _hasWriteLock = true;
- notify();
+ {
+ Lock sync(*this);
+ _hasWriteLock = true;
+ notify();
- while(!_destroyed)
- {
- wait();
- }
- }
+ while(!_destroyed)
+ {
+ wait();
+ }
+ }
}
void
waitWrite()
{
- Lock sync(*this);
+ Lock sync(*this);
- //
- // Wait for the _upgrading flag to be set.
- //
- while(!_waitWrite)
- {
- wait();
- }
+ //
+ // Wait for the _upgrading flag to be set.
+ //
+ while(!_waitWrite)
+ {
+ wait();
+ }
- //
- // Its necessary to sleep for 1 second to ensure that the
- // thread is actually IN the upgrade and waiting.
- //
- ThreadControl::sleep(Time::seconds(1));
+ //
+ // Its necessary to sleep for 1 second to ensure that the
+ // thread is actually IN the upgrade and waiting.
+ //
+ ThreadControl::sleep(Time::seconds(1));
}
void
destroy()
{
- Lock sync(*this);
- _destroyed = true;
- notify();
+ Lock sync(*this);
+ _destroyed = true;
+ notify();
}
bool
hasWriteLock()
{
- Lock sync(*this);
- return _hasWriteLock;
+ Lock sync(*this);
+ return _hasWriteLock;
}
//
@@ -454,12 +454,12 @@ public:
bool
waitHasWriteLock()
{
- Lock sync(*this);
- if(!_hasWriteLock)
- {
- timedWait(Time::seconds(10));
- }
- return _hasWriteLock;
+ Lock sync(*this);
+ if(!_hasWriteLock)
+ {
+ timedWait(Time::seconds(10));
+ }
+ return _hasWriteLock;
}
private:
@@ -485,127 +485,127 @@ RWRecMutexTest::run()
// TEST: TryLock (read)
{
- RWRecMutex::RLock rlock(mutex);
-
- // RLock testing
- test(rlock.acquired());
-
- try
- {
- rlock.acquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- try
- {
- rlock.tryAcquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(rlock.acquired());
- rlock.release();
- test(!rlock.acquired());
-
- try
- {
- rlock.release();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(rlock.tryAcquire() == true);
- test(rlock.acquired());
-
- RWRecMutex::RLock rlock2(mutex);
-
- RWRecMutex::TryRLock trlock(mutex);
- test(trlock.acquired());
-
- RWRecMutex::TryWLock twlock(mutex);
- test(!twlock.acquired());
-
- RWRecMutex::TryWLock twlock2(mutex, Time::milliSeconds(10));
- test(!twlock2.acquired());
+ RWRecMutex::RLock rlock(mutex);
+
+ // RLock testing
+ test(rlock.acquired());
+
+ try
+ {
+ rlock.acquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ rlock.tryAcquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(rlock.acquired());
+ rlock.release();
+ test(!rlock.acquired());
+
+ try
+ {
+ rlock.release();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(rlock.tryAcquire() == true);
+ test(rlock.acquired());
+
+ RWRecMutex::RLock rlock2(mutex);
+
+ RWRecMutex::TryRLock trlock(mutex);
+ test(trlock.acquired());
+
+ RWRecMutex::TryWLock twlock(mutex);
+ test(!twlock.acquired());
+
+ RWRecMutex::TryWLock twlock2(mutex, Time::milliSeconds(10));
+ test(!twlock2.acquired());
}
// TEST: TryLock (write)
{
- RWRecMutex::WLock wlock(mutex);
-
- // WLock testing
- test(wlock.acquired());
-
- try
- {
- wlock.acquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- try
- {
- wlock.tryAcquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(wlock.acquired());
- wlock.release();
- test(!wlock.acquired());
-
- try
- {
- wlock.release();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(wlock.tryAcquire() == true);
- test(wlock.acquired());
-
- RWRecMutex::TryRLock trlock(mutex);
- test(!trlock.acquired());
-
- RWRecMutex::TryRLock trlock2(mutex, Time::milliSeconds(10));
- test(!trlock2.acquired());
-
- RWRecMutex::TryWLock twlock(mutex);
- test(twlock.acquired());
-
- RWRecMutex::TryWLock twlock2(mutex, Time::milliSeconds(10));
- test(twlock2.acquired());
+ RWRecMutex::WLock wlock(mutex);
+
+ // WLock testing
+ test(wlock.acquired());
+
+ try
+ {
+ wlock.acquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ wlock.tryAcquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(wlock.acquired());
+ wlock.release();
+ test(!wlock.acquired());
+
+ try
+ {
+ wlock.release();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(wlock.tryAcquire() == true);
+ test(wlock.acquired());
+
+ RWRecMutex::TryRLock trlock(mutex);
+ test(!trlock.acquired());
+
+ RWRecMutex::TryRLock trlock2(mutex, Time::milliSeconds(10));
+ test(!trlock2.acquired());
+
+ RWRecMutex::TryWLock twlock(mutex);
+ test(twlock.acquired());
+
+ RWRecMutex::TryWLock twlock2(mutex, Time::milliSeconds(10));
+ test(twlock2.acquired());
}
// TEST: read lock
{
- RWRecMutex::RLock rlock(mutex);
+ RWRecMutex::RLock rlock(mutex);
- // TEST: Start thread, try to acquire the mutex.
- t = new RWRecMutexReadTestThread(mutex);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ // TEST: Start thread, try to acquire the mutex.
+ t = new RWRecMutexReadTestThread(mutex);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
@@ -616,14 +616,14 @@ RWRecMutexTest::run()
// TEST: write lock
{
- RWRecMutex::WLock wlock(mutex);
+ RWRecMutex::WLock wlock(mutex);
- // TEST: Start thread, try to acquire the mutex.
- t = new RWRecMutexWriteTestThread(mutex);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ // TEST: Start thread, try to acquire the mutex.
+ t = new RWRecMutexWriteTestThread(mutex);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
@@ -634,22 +634,22 @@ RWRecMutexTest::run()
// TEST: Lock precedence. Writers have precedence over readers.
{
- RWRecMutex::RLock rlock(mutex);
+ RWRecMutex::RLock rlock(mutex);
- // Start thread that tries to acquire write lock
- t = new RWRecMutexWriteTestThread(mutex);
- control = t->start();
+ // Start thread that tries to acquire write lock
+ t = new RWRecMutexWriteTestThread(mutex);
+ control = t->start();
- // TEST: Wait until the tryLock has been tested. The thread is
- // now waiting on a write lock.
- t->waitTryLock();
+ // TEST: Wait until the tryLock has been tested. The thread is
+ // now waiting on a write lock.
+ t->waitTryLock();
- // It's necessary for a small sleep here to ensure that the
- // thread is actually waiting on a write lock.
- ThreadControl::sleep(Time::seconds(1));
+ // It's necessary for a small sleep here to ensure that the
+ // thread is actually waiting on a write lock.
+ ThreadControl::sleep(Time::seconds(1));
- RWRecMutex::TryRLock trlock(mutex);
- test(!trlock.acquired());
+ RWRecMutex::TryRLock trlock(mutex);
+ test(!trlock.acquired());
}
//
@@ -660,24 +660,24 @@ RWRecMutexTest::run()
// TEST: Lock upgrading.
{
- RWRecMutex::RLock rlock(mutex);
+ RWRecMutex::RLock rlock(mutex);
- //
- // Mutex now holds a write lock.
- //
- mutex.upgrade();
+ //
+ // Mutex now holds a write lock.
+ //
+ mutex.upgrade();
- // Start thread that tries to acquire write lock
- t = new RWRecMutexReadTestThread2(mutex);
- control = t->start();
+ // Start thread that tries to acquire write lock
+ t = new RWRecMutexReadTestThread2(mutex);
+ control = t->start();
- // TEST: Wait until the tryLock has been tested. The thread is
- // now waiting on a read lock.
- t->waitTryLock();
+ // TEST: Wait until the tryLock has been tested. The thread is
+ // now waiting on a read lock.
+ t->waitTryLock();
- // It's necessary for a small sleep here to ensure that the
- // thread is actually waiting on a read lock.
- ThreadControl::sleep(Time::seconds(1));
+ // It's necessary for a small sleep here to ensure that the
+ // thread is actually waiting on a read lock.
+ ThreadControl::sleep(Time::seconds(1));
}
//
@@ -696,182 +696,182 @@ RWRecMutexTest::run()
// TEST: Lock upgrading. This time a reader thread is started
// first.
{
- RWRecMutexUpgradeReadThreadPtr t1 = new RWRecMutexUpgradeReadThread(mutex);
- control = t1->start();
-
- // Wait for the thread to acquire the read lock.
- t1->waitLock();
-
- // Spawn a thread to try acquiring the lock
- RWRecMutexUpgradeTestThreadPtr t2 = new RWRecMutexUpgradeTestThread(mutex);
- ThreadControl control2 = t2->start();
- t2->waitLock();
-
- //
- // Small sleep to find out whether the thread actually
- // terminates (which means that the write lock upgrade was
- // mistakenly acquired).
- //
- ThreadControl::sleep(Time::seconds(1));
-
- test(!t2->upgradeAcquired());
-
- //
- // A read lock at this point should fail.
- //
- RWRecMutex::TryRLock trlock(mutex);
- test(!trlock.acquired());
-
- //
- // As should a write lock.
- //
- RWRecMutex::TryWLock twlock(mutex);
- test(!twlock.acquired());
-
- //
- // Once the read lock is released then the upgrade should
- // succeed & the thread should terminate.
- //
- t1->signalUnlock();
-
- control2.join();
- control.join();
-
- //
- // Now both a read & write lock should be available.
- //
- {
- RWRecMutex::WLock rlock2(mutex);
- }
- {
- RWRecMutex::RLock rlock2(mutex);
- }
+ RWRecMutexUpgradeReadThreadPtr t1 = new RWRecMutexUpgradeReadThread(mutex);
+ control = t1->start();
+
+ // Wait for the thread to acquire the read lock.
+ t1->waitLock();
+
+ // Spawn a thread to try acquiring the lock
+ RWRecMutexUpgradeTestThreadPtr t2 = new RWRecMutexUpgradeTestThread(mutex);
+ ThreadControl control2 = t2->start();
+ t2->waitLock();
+
+ //
+ // Small sleep to find out whether the thread actually
+ // terminates (which means that the write lock upgrade was
+ // mistakenly acquired).
+ //
+ ThreadControl::sleep(Time::seconds(1));
+
+ test(!t2->upgradeAcquired());
+
+ //
+ // A read lock at this point should fail.
+ //
+ RWRecMutex::TryRLock trlock(mutex);
+ test(!trlock.acquired());
+
+ //
+ // As should a write lock.
+ //
+ RWRecMutex::TryWLock twlock(mutex);
+ test(!twlock.acquired());
+
+ //
+ // Once the read lock is released then the upgrade should
+ // succeed & the thread should terminate.
+ //
+ t1->signalUnlock();
+
+ control2.join();
+ control.join();
+
+ //
+ // Now both a read & write lock should be available.
+ //
+ {
+ RWRecMutex::WLock rlock2(mutex);
+ }
+ {
+ RWRecMutex::RLock rlock2(mutex);
+ }
}
#endif
// TEST: Ensure that only one reader can upgrade to a writer.
// Other readers get a DeadlockException.
{
- mutex.readLock();
+ mutex.readLock();
- RWRecMutexUpgradeThreadPtr t1 = new RWRecMutexUpgradeThread(mutex);
- ThreadControl control1 = t1->start();
+ RWRecMutexUpgradeThreadPtr t1 = new RWRecMutexUpgradeThread(mutex);
+ ThreadControl control1 = t1->start();
- //
- // Wait for the thread to get into the upgrade call. The
- // upgrade will hang since the readLock is held by this thread
- // and therefore cannot succeed until we release our read
- // lock.
- //
- t1->waitUpgrade();
+ //
+ // Wait for the thread to get into the upgrade call. The
+ // upgrade will hang since the readLock is held by this thread
+ // and therefore cannot succeed until we release our read
+ // lock.
+ //
+ t1->waitUpgrade();
- //
- // Its necessary to sleep for 1 second to ensure that the
- // thread is actually IN the upgrade and waiting.
- //
- ThreadControl::sleep(Time::seconds(1));
+ //
+ // Its necessary to sleep for 1 second to ensure that the
+ // thread is actually IN the upgrade and waiting.
+ //
+ ThreadControl::sleep(Time::seconds(1));
- try
- {
- mutex.upgrade();
- test(false);
- }
- catch(const DeadlockException&)
- {
- }
+ try
+ {
+ mutex.upgrade();
+ test(false);
+ }
+ catch(const DeadlockException&)
+ {
+ }
- //
- // Release the waiting thread, join.
- //
- mutex.unlock();
- t1->destroy();
- control1.join();
+ //
+ // Release the waiting thread, join.
+ //
+ mutex.unlock();
+ t1->destroy();
+ control1.join();
- test(!t1->failed());
+ test(!t1->failed());
}
// TEST: Same as previous test, but for a timedUpgrade.
{
- mutex.readLock();
+ mutex.readLock();
- RWRecMutexUpgradeThreadPtr t1 = new RWRecMutexUpgradeThread(mutex, true);
- ThreadControl control1 = t1->start();
+ RWRecMutexUpgradeThreadPtr t1 = new RWRecMutexUpgradeThread(mutex, true);
+ ThreadControl control1 = t1->start();
- t1->waitUpgrade();
- //
- // Its necessary to sleep for 1 second to ensure that the
- // thread is actually IN the upgrade and waiting.
- //
- ThreadControl::sleep(Time::seconds(1));
+ t1->waitUpgrade();
+ //
+ // Its necessary to sleep for 1 second to ensure that the
+ // thread is actually IN the upgrade and waiting.
+ //
+ ThreadControl::sleep(Time::seconds(1));
- try
- {
- mutex.upgrade();
- test(false);
- }
- catch(const DeadlockException&)
- {
- }
+ try
+ {
+ mutex.upgrade();
+ test(false);
+ }
+ catch(const DeadlockException&)
+ {
+ }
- //
- // Release the waiting thread, join.
- //
- mutex.unlock();
- t1->destroy();
- control1.join();
+ //
+ // Release the waiting thread, join.
+ //
+ mutex.unlock();
+ t1->destroy();
+ control1.join();
- test(!t1->failed());
+ test(!t1->failed());
}
// TEST: Check that an upgrader is given preference over a writer.
{
- mutex.readLock();
+ mutex.readLock();
- RWRecMutexUpgradeThreadPtr t1 = new RWRecMutexUpgradeThread(mutex);
-
- ThreadControl control1 = t1->start();
+ RWRecMutexUpgradeThreadPtr t1 = new RWRecMutexUpgradeThread(mutex);
+
+ ThreadControl control1 = t1->start();
- //
- // Its not necessary to sleep here, since the upgrade thread
- // acquires the read lock before signalling. Therefore the
- // write thread cannot get the write lock.
- //
- t1->waitUpgrade();
+ //
+ // Its not necessary to sleep here, since the upgrade thread
+ // acquires the read lock before signalling. Therefore the
+ // write thread cannot get the write lock.
+ //
+ t1->waitUpgrade();
- RWRecMutexWriteThreadPtr t2 = new RWRecMutexWriteThread(mutex);
- ThreadControl control2 = t2->start();
- t2->waitWrite();
- //
- // Its necessary to sleep for 1 second to ensure that the
- // thread is actually IN the write lock and waiting.
- //
- ThreadControl::sleep(Time::seconds(1));
-
- //
- // Unlocking the read mutex lets the upgrade continue. At this
- // point t1 should have the write-lock, and t2 should not.
- //
- test(!t2->hasWriteLock());
- mutex.unlock();
-
- //
- // Wait for t1 to get the write lock. It will not release it
- // until the thread is destroyed. t2 should not have the write
- // lock.
- //
- test(!t1->failed());
- test(t1->waitHasWriteLock());
- test(!t2->hasWriteLock());
- t1->destroy();
- t2->destroy();
-
- //
- // After the thread has terminated the thread must have
- // acquired the write lock.
- //
- test(t2->waitHasWriteLock());
-
- control1.join();
- control2.join();
+ RWRecMutexWriteThreadPtr t2 = new RWRecMutexWriteThread(mutex);
+ ThreadControl control2 = t2->start();
+ t2->waitWrite();
+ //
+ // Its necessary to sleep for 1 second to ensure that the
+ // thread is actually IN the write lock and waiting.
+ //
+ ThreadControl::sleep(Time::seconds(1));
+
+ //
+ // Unlocking the read mutex lets the upgrade continue. At this
+ // point t1 should have the write-lock, and t2 should not.
+ //
+ test(!t2->hasWriteLock());
+ mutex.unlock();
+
+ //
+ // Wait for t1 to get the write lock. It will not release it
+ // until the thread is destroyed. t2 should not have the write
+ // lock.
+ //
+ test(!t1->failed());
+ test(t1->waitHasWriteLock());
+ test(!t2->hasWriteLock());
+ t1->destroy();
+ t2->destroy();
+
+ //
+ // After the thread has terminated the thread must have
+ // acquired the write lock.
+ //
+ test(t2->waitHasWriteLock());
+
+ control1.join();
+ control2.join();
}
}
diff --git a/cpp/test/IceUtil/thread/RecMutexTest.cpp b/cpp/test/IceUtil/thread/RecMutexTest.cpp
index e4bad16fc22..0668f565383 100644
--- a/cpp/test/IceUtil/thread/RecMutexTest.cpp
+++ b/cpp/test/IceUtil/thread/RecMutexTest.cpp
@@ -22,34 +22,34 @@ class RecMutexTestThread : public Thread
public:
RecMutexTestThread(RecMutex& m) :
- _mutex(m),
- _tryLock(false)
+ _mutex(m),
+ _tryLock(false)
{
}
virtual void run()
{
-
- RecMutex::TryLock tlock(_mutex);
- test(!tlock.acquired());
-
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
-
- RecMutex::Lock lock(_mutex);
+
+ RecMutex::TryLock tlock(_mutex);
+ test(!tlock.acquired());
+
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
+
+ RecMutex::Lock lock(_mutex);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -78,22 +78,22 @@ RecMutexTest::run()
ThreadControl control;
{
- RecMutex::Lock lock(mutex);
-
- // TEST: lock twice
- RecMutex::Lock lock2(mutex);
-
- // TEST: TryLock
- RecMutex::TryLock lock3(mutex);
- test(lock3.acquired());
-
- // TEST: Start thread, try to acquire the mutex.
- t = new RecMutexTestThread(mutex);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
-
+ RecMutex::Lock lock(mutex);
+
+ // TEST: lock twice
+ RecMutex::Lock lock2(mutex);
+
+ // TEST: TryLock
+ RecMutex::TryLock lock3(mutex);
+ test(lock3.acquired());
+
+ // TEST: Start thread, try to acquire the mutex.
+ t = new RecMutexTestThread(mutex);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
+
}
//
diff --git a/cpp/test/IceUtil/thread/StartTest.cpp b/cpp/test/IceUtil/thread/StartTest.cpp
index a07f7e1804e..1f1af376ea1 100644
--- a/cpp/test/IceUtil/thread/StartTest.cpp
+++ b/cpp/test/IceUtil/thread/StartTest.cpp
@@ -50,8 +50,8 @@ StartTest::run()
control.join();
try
{
- t->start();
- test(false);
+ t->start();
+ test(false);
}
catch(const ThreadStartedException&)
{
@@ -62,11 +62,11 @@ StartTest::run()
//
for(int i = 0; i < 50; i++)
{
- for(int j = 0; j < 50; j++)
- {
- Thread* t = new StartTestThread;
- t->start().detach();
- }
- ThreadControl::sleep(Time::milliSeconds(5));
+ for(int j = 0; j < 50; j++)
+ {
+ Thread* t = new StartTestThread;
+ t->start().detach();
+ }
+ ThreadControl::sleep(Time::milliSeconds(5));
}
}
diff --git a/cpp/test/IceUtil/thread/StaticMutexTest.cpp b/cpp/test/IceUtil/thread/StaticMutexTest.cpp
index 7868b2a4b32..f42b7c4345a 100644
--- a/cpp/test/IceUtil/thread/StaticMutexTest.cpp
+++ b/cpp/test/IceUtil/thread/StaticMutexTest.cpp
@@ -24,32 +24,32 @@ class StaticMutexTestThread : public Thread
public:
StaticMutexTestThread() :
- _tryLock(false)
+ _tryLock(false)
{
}
virtual void run()
- {
- StaticMutex::TryLock tlock(staticMutex);
- test(!tlock.acquired());
+ {
+ StaticMutex::TryLock tlock(staticMutex);
+ test(!tlock.acquired());
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
- StaticMutex::Lock lock(staticMutex);
+ StaticMutex::Lock lock(staticMutex);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -76,65 +76,65 @@ StaticMutexTest::run()
ThreadControl control;
{
- StaticMutex::Lock lock(staticMutex);
-
- // LockT testing:
- //
-
- test(lock.acquired());
-
- try
- {
- lock.acquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- try
- {
- lock.tryAcquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(lock.acquired());
- lock.release();
- test(!lock.acquired());
-
- try
- {
- lock.release();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- StaticMutex::TryLock lock2(staticMutex);
- try
- {
- test(lock.tryAcquire() == false);
- }
- catch(const ThreadLockedException&)
- {
- }
- lock2.release();
- test(lock.tryAcquire() == true);
- test(lock.acquired());
-
- // TEST: Start thread, try to acquire the mutex.
- t = new StaticMutexTestThread;
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ StaticMutex::Lock lock(staticMutex);
+
+ // LockT testing:
+ //
+
+ test(lock.acquired());
+
+ try
+ {
+ lock.acquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ lock.tryAcquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(lock.acquired());
+ lock.release();
+ test(!lock.acquired());
+
+ try
+ {
+ lock.release();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ StaticMutex::TryLock lock2(staticMutex);
+ try
+ {
+ test(lock.tryAcquire() == false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ }
+ lock2.release();
+ test(lock.tryAcquire() == true);
+ test(lock.acquired());
+
+ // TEST: Start thread, try to acquire the mutex.
+ t = new StaticMutexTestThread;
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
diff --git a/cpp/test/IceUtil/thread/TestBase.cpp b/cpp/test/IceUtil/thread/TestBase.cpp
index 54b565d9bb0..71bf59cce24 100644
--- a/cpp/test/IceUtil/thread/TestBase.cpp
+++ b/cpp/test/IceUtil/thread/TestBase.cpp
@@ -35,12 +35,12 @@ TestBase::start()
cout << "running " << _name << " test... " << flush;
try
{
- run();
+ run();
}
catch(const IceUtil::Exception& e)
{
- cout << e << " failed" << endl;
- throw TestFailed(_name);
+ cout << e << " failed" << endl;
+ throw TestFailed(_name);
}
cout << "ok" << endl;
}
diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp
index 475d6ee4aac..da91e03fee1 100644
--- a/cpp/test/IceUtil/unicode/Client.cpp
+++ b/cpp/test/IceUtil/unicode/Client.cpp
@@ -25,12 +25,12 @@ main(int argc, char** argv)
if(argc > 1)
{
- dir = argv[1];
+ dir = argv[1];
#ifdef _WIN32
- dir += "\\";
+ dir += "\\";
#else
- dir += "/";
-#endif
+ dir += "/";
+#endif
}
@@ -45,119 +45,119 @@ main(int argc, char** argv)
string wcoeurFile = string("coeur.") + wstringEncoding;
{
- cout << "testing UTF-8 to wstring (" << wstringEncoding << ") conversion...";
-
- ifstream is((dir + "coeur.utf8").c_str());
- test(is.good());
- ifstream bis((dir + wcoeurFile).c_str(), ios_base::binary);
- test(bis.good());
-
- int lineNumber = 0;
-
- do
- {
- string line;
- getline(is, line, '\n');
- test(isLegalUTF8Sequence(reinterpret_cast<const Byte*>(line.data()),
- reinterpret_cast<const Byte*>(line.data() + line.size())));
- lineNumber++;
- wstring wline = stringToWstring(line);
-
- for(size_t i = 0; i < wline.length(); ++i)
- {
- wchar_t wc = wline[i];
- const char* buffer = reinterpret_cast<char*>(&wc);
- for(size_t j = 0; j < sizeof(wchar_t); ++j)
- {
- test(bis.good());
- char c;
- bis.get(c);
- if(buffer[j] != c)
- {
- cerr << "Error at line " << lineNumber << " column " << i << endl;
- cerr << "buffer[j] == " << hex << (int)static_cast<unsigned char>(buffer[j]) << endl;
- cerr << "c == " << hex << (int)static_cast<unsigned char>(c) << endl;
- }
- test(buffer[j] == c);
- }
- }
- //
- // Skip newline character (Unix-style newline)
- //
- if(is.good())
- {
- for(size_t j = 0; j < sizeof(wchar_t); ++j)
- {
- test(bis.good());
- char c;
- bis.get(c);
- }
- }
- else
- {
- char c;
- bis.get(c);
- test(bis.eof());
- }
- } while(is.good());
+ cout << "testing UTF-8 to wstring (" << wstringEncoding << ") conversion...";
+
+ ifstream is((dir + "coeur.utf8").c_str());
+ test(is.good());
+ ifstream bis((dir + wcoeurFile).c_str(), ios_base::binary);
+ test(bis.good());
+
+ int lineNumber = 0;
+
+ do
+ {
+ string line;
+ getline(is, line, '\n');
+ test(isLegalUTF8Sequence(reinterpret_cast<const Byte*>(line.data()),
+ reinterpret_cast<const Byte*>(line.data() + line.size())));
+ lineNumber++;
+ wstring wline = stringToWstring(line);
+
+ for(size_t i = 0; i < wline.length(); ++i)
+ {
+ wchar_t wc = wline[i];
+ const char* buffer = reinterpret_cast<char*>(&wc);
+ for(size_t j = 0; j < sizeof(wchar_t); ++j)
+ {
+ test(bis.good());
+ char c;
+ bis.get(c);
+ if(buffer[j] != c)
+ {
+ cerr << "Error at line " << lineNumber << " column " << i << endl;
+ cerr << "buffer[j] == " << hex << (int)static_cast<unsigned char>(buffer[j]) << endl;
+ cerr << "c == " << hex << (int)static_cast<unsigned char>(c) << endl;
+ }
+ test(buffer[j] == c);
+ }
+ }
+ //
+ // Skip newline character (Unix-style newline)
+ //
+ if(is.good())
+ {
+ for(size_t j = 0; j < sizeof(wchar_t); ++j)
+ {
+ test(bis.good());
+ char c;
+ bis.get(c);
+ }
+ }
+ else
+ {
+ char c;
+ bis.get(c);
+ test(bis.eof());
+ }
+ } while(is.good());
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
{
- cout << "wstring (" << wstringEncoding << ") to UTF-8 conversion...";
+ cout << "wstring (" << wstringEncoding << ") to UTF-8 conversion...";
- ifstream bis((dir + wcoeurFile).c_str(), ios_base::binary);
- test(bis.good());
+ ifstream bis((dir + wcoeurFile).c_str(), ios_base::binary);
+ test(bis.good());
- wstring ws;
- char c;
+ wstring ws;
+ char c;
- do
- {
- wchar_t wc;
- char* buffer = reinterpret_cast<char*>(&wc);
-
- for(size_t j = 0; j < sizeof(wchar_t); ++j)
- {
- if(!bis.good())
- {
- break;
- }
- bis.get(c);
- buffer[j] = c;
- }
+ do
+ {
+ wchar_t wc;
+ char* buffer = reinterpret_cast<char*>(&wc);
+
+ for(size_t j = 0; j < sizeof(wchar_t); ++j)
+ {
+ if(!bis.good())
+ {
+ break;
+ }
+ bis.get(c);
+ buffer[j] = c;
+ }
- if(bis.good())
- {
- ws.push_back(wc);
- }
- } while(bis.good());
-
- string s = wstringToString(ws);
-
- ifstream nbis((dir + "coeur.utf8").c_str(), ios_base::binary);
- test(nbis.good());
-
- for(size_t i = 0; i < s.size(); ++i)
- {
- test(nbis.good());
- nbis.get(c);
- char ci = s[i];
+ if(bis.good())
+ {
+ ws.push_back(wc);
+ }
+ } while(bis.good());
+
+ string s = wstringToString(ws);
+
+ ifstream nbis((dir + "coeur.utf8").c_str(), ios_base::binary);
+ test(nbis.good());
+
+ for(size_t i = 0; i < s.size(); ++i)
+ {
+ test(nbis.good());
+ nbis.get(c);
+ char ci = s[i];
- if(c != ci)
- {
- cerr << "i == " << i << endl;
- cerr << "ci == " << hex << (int)static_cast<unsigned char>(ci) << endl;
- cerr << "c == " << hex << (int)static_cast<unsigned char>(c) << endl;
- }
- test(c == s[i]);
- }
- test(!nbis.eof());
- nbis.get(c);
- test(nbis.eof());
+ if(c != ci)
+ {
+ cerr << "i == " << i << endl;
+ cerr << "ci == " << hex << (int)static_cast<unsigned char>(ci) << endl;
+ cerr << "c == " << hex << (int)static_cast<unsigned char>(c) << endl;
+ }
+ test(c == s[i]);
+ }
+ test(!nbis.eof());
+ nbis.get(c);
+ test(nbis.eof());
- cout << "ok" << endl;
+ cout << "ok" << endl;
}
return EXIT_SUCCESS;
diff --git a/cpp/test/IceUtil/uuid/Client.cpp b/cpp/test/IceUtil/uuid/Client.cpp
index e405ae74939..bda63c8795d 100644
--- a/cpp/test/IceUtil/uuid/Client.cpp
+++ b/cpp/test/IceUtil/uuid/Client.cpp
@@ -34,35 +34,35 @@ public:
typedef set<T> ItemSet;
InsertThread(int threadId, ItemSet& itemSet, GenerateFunc func, long howMany, bool verbose)
- : _threadId(threadId), _itemSet(itemSet), _func(func), _howMany(howMany), _verbose(verbose)
+ : _threadId(threadId), _itemSet(itemSet), _func(func), _howMany(howMany), _verbose(verbose)
{
}
void run()
{
- for(long i = 0; i < _howMany; i++)
- {
- T item = _func();
+ for(long i = 0; i < _howMany; i++)
+ {
+ T item = _func();
- StaticMutex::Lock lock(staticMutex);
+ StaticMutex::Lock lock(staticMutex);
#if defined(_MSC_VER) && (_MSC_VER < 1300)
- pair<ItemSet::iterator, bool> ok = _itemSet.insert(item);
+ pair<ItemSet::iterator, bool> ok = _itemSet.insert(item);
#else
- pair<typename ItemSet::iterator, bool> ok = _itemSet.insert(item);
+ pair<typename ItemSet::iterator, bool> ok = _itemSet.insert(item);
#endif
- if(!ok.second)
- {
- cerr << "******* iteration " << i << endl;
- cerr << "******* Duplicate item: " << *ok.first << endl;
- }
-
- test(ok.second);
-
- if(_verbose && i > 0 && (i % 100000 == 0))
- {
- cout << "Thread " << _threadId << ": generated " << i << " UUIDs." << endl;
- }
- }
+ if(!ok.second)
+ {
+ cerr << "******* iteration " << i << endl;
+ cerr << "******* Duplicate item: " << *ok.first << endl;
+ }
+
+ test(ok.second);
+
+ if(_verbose && i > 0 && (i % 100000 == 0))
+ {
+ cout << "Thread " << _threadId << ": generated " << i << " UUIDs." << endl;
+ }
+ }
}
@@ -80,7 +80,7 @@ struct GenerateUUID
string
operator()()
{
- return generateUUID();
+ return generateUUID();
}
};
@@ -89,15 +89,15 @@ struct GenerateRandomString
string
operator()()
{
- string s;
- s.resize(20);
- char buf[20];
- IceUtil::generateRandom(buf, static_cast<int>(sizeof(buf)));
- for(unsigned int i = 0; i < sizeof(buf); ++i)
- {
- s[i] = 33 + buf[i] % (127-33); // We use ASCII 33-126 (from ! to ~, w/o space).
- }
- return s;
+ string s;
+ s.resize(20);
+ char buf[20];
+ IceUtil::generateRandom(buf, static_cast<int>(sizeof(buf)));
+ for(unsigned int i = 0; i < sizeof(buf); ++i)
+ {
+ s[i] = 33 + buf[i] % (127-33); // We use ASCII 33-126 (from ! to ~, w/o space).
+ }
+ return s;
}
};
IceUtil::StaticMutex lock;
@@ -108,7 +108,7 @@ public:
int
operator()()
{
- return IceUtil::random();
+ return IceUtil::random();
}
};
@@ -119,17 +119,17 @@ runTest(int threadCount, GenerateFunc func, long howMany, bool verbose, string n
cout << "Generating " << howMany << " " << name << "s using " << threadCount << " thread";
if(threadCount > 1)
{
- cout << "s";
+ cout << "s";
}
cout << "... ";
if(verbose)
{
- cout << endl;
+ cout << endl;
}
else
{
- cout << flush;
+ cout << flush;
}
set<T> itemSet;
@@ -139,12 +139,12 @@ runTest(int threadCount, GenerateFunc func, long howMany, bool verbose, string n
Time start = Time::now();
for(int i = 0; i < threadCount; i++)
{
- ThreadPtr t = new InsertThread<T, GenerateFunc>(i, itemSet, func, howMany / threadCount, verbose);
- threads.push_back(t->start());
+ ThreadPtr t = new InsertThread<T, GenerateFunc>(i, itemSet, func, howMany / threadCount, verbose);
+ threads.push_back(t->start());
}
for(vector<ThreadControl>::iterator p = threads.begin(); p != threads.end(); ++p)
{
- p->join();
+ p->join();
}
Time finish = Time::now();
@@ -153,9 +153,9 @@ runTest(int threadCount, GenerateFunc func, long howMany, bool verbose, string n
if(verbose)
{
cout << "Each " << name << " took an average of "
- << (double) ((finish - start).toMicroSeconds()) / howMany
- << " micro seconds to generate and insert into a set."
- << endl;
+ << (double) ((finish - start).toMicroSeconds()) / howMany
+ << " micro seconds to generate and insert into a set."
+ << endl;
}
}
@@ -167,33 +167,33 @@ int main(int argc, char* argv[])
if(argc > 3)
{
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
else if(argc == 3)
{
- howMany = atol(argv[1]);
- if (howMany == 0)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- threadCount = atoi(argv[2]);
- if(threadCount <= 0)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- verbose = true;
+ howMany = atol(argv[1]);
+ if (howMany == 0)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ threadCount = atoi(argv[2]);
+ if(threadCount <= 0)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ verbose = true;
}
else if(argc == 2)
{
- howMany = atol(argv[1]);
- if (howMany == 0)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ howMany = atol(argv[1]);
+ if (howMany == 0)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
runTest<string, GenerateUUID>(threadCount, GenerateUUID(), howMany, verbose, "UUID");
diff --git a/cpp/test/Slice/errorDetection/CaseInsensitive.ice b/cpp/test/Slice/errorDetection/CaseInsensitive.ice
index 74f30d56e36..0760387509f 100644
--- a/cpp/test/Slice/errorDetection/CaseInsensitive.ice
+++ b/cpp/test/Slice/errorDetection/CaseInsensitive.ice
@@ -263,12 +263,12 @@ module CI
{
interface base1
{
- void op();
+ void op();
};
interface base2
{
- void OP();
+ void OP();
};
interface derived extends base1, base2
diff --git a/cpp/test/Slice/errorDetection/ChangedMeaning.ice b/cpp/test/Slice/errorDetection/ChangedMeaning.ice
index e853190070e..0286ec8e3f4 100644
--- a/cpp/test/Slice/errorDetection/ChangedMeaning.ice
+++ b/cpp/test/Slice/errorDetection/ChangedMeaning.ice
@@ -16,24 +16,24 @@ sequence<long> ls;
struct s00
{
- ls ls; // Changed meaning
+ ls ls; // Changed meaning
};
struct s0
{
- Test::ls ls; // OK
+ Test::ls ls; // OK
};
struct s1
{
ls mem;
- long ls; // Changed meaning
+ long ls; // Changed meaning
};
struct s2
{
Test::ls mem;
- long ls; // OK
+ long ls; // OK
};
module M
@@ -46,21 +46,21 @@ sequence<long> ls;
interface i1
{
M::ls op();
- void M(); // Changed meaning
+ void M(); // Changed meaning
};
interface i2
{
M::ls op();
- long M(); // Changed meaning
+ long M(); // Changed meaning
};
module N
{
interface n1 extends i1 {};
- interface i1 {}; // Changed meaning
- interface i2 extends i2 {}; // Changed meaning
+ interface i1 {}; // Changed meaning
+ interface i2 extends i2 {}; // Changed meaning
};
@@ -68,8 +68,8 @@ module O
{
interface n1 extends ::Test::i1 {};
- interface i1 {}; // OK
- interface i2 extends ::Test::i2 {}; // OK
+ interface i1 {}; // OK
+ interface i2 extends ::Test::i2 {}; // OK
};
@@ -81,8 +81,8 @@ module E
{
exception ee1 extends e1 {};
- exception e1 {}; // Changed meaning
- exception e2 extends e2 {}; // Changed meaning
+ exception e1 {}; // Changed meaning
+ exception e2 extends e2 {}; // Changed meaning
};
@@ -94,8 +94,8 @@ module C
{
class cc1 implements c1 {};
- class c1 {}; // Changed meaning
- class c2 extends c2 {}; // Changed meaning
+ class c1 {}; // Changed meaning
+ class c2 extends c2 {}; // Changed meaning
};
@@ -106,7 +106,7 @@ module B
const color fc = blue;
- interface blue {}; // Changed meaning
+ interface blue {}; // Changed meaning
};
@@ -123,40 +123,40 @@ interface ParamTest
{
void op(long param);
void op2(counter param);
- void param(counter counter); // Changed meaning
- void op3(long counter, counter x); // Second "counter" is not a type
+ void param(counter counter); // Changed meaning
+ void op3(long counter, counter x); // Second "counter" is not a type
void op4(long param, long param);
};
sequence<int> IS;
struct x
{
- IS is; // Changed meaning (case-insensitive)
+ IS is; // Changed meaning (case-insensitive)
};
struct y
{
- ::Test::IS is; // OK, nothing introduced
+ ::Test::IS is; // OK, nothing introduced
};
interface Blah
{
- void op1() throws ::Test::E::ee1; // Nothing introduced
- void E(); // OK
- void op2() throws E; // Changed meaning
+ void op1() throws ::Test::E::ee1; // Nothing introduced
+ void E(); // OK
+ void op2() throws E; // Changed meaning
};
interface Blah2
{
- void op3() throws ::Test::E::ee1; // Nothing introduced
- void E(); // OK
- void op4() throws E::ee1; // Changed meaning
+ void op3() throws ::Test::E::ee1; // Nothing introduced
+ void E(); // OK
+ void op4() throws E::ee1; // Changed meaning
};
interface Blah3
{
- void op5() throws E::ee1; // Introduces E
- void E(); // Changed meaning
+ void op5() throws E::ee1; // Introduces E
+ void E(); // Changed meaning
};
module M1
@@ -165,7 +165,7 @@ module M1
struct smnpStruct
{
- smnpEnum e;
+ smnpEnum e;
};
exception smnpException
diff --git a/cpp/test/Slice/errorDetection/ConstDef.ice b/cpp/test/Slice/errorDetection/ConstDef.ice
index 1f92f5a92d1..0af93184258 100644
--- a/cpp/test/Slice/errorDetection/ConstDef.ice
+++ b/cpp/test/Slice/errorDetection/ConstDef.ice
@@ -72,57 +72,57 @@ const float nf9 = -1E+1;
const float nf10 = -1E+1f;
const float nf11 = -1E1F;
-const XXX ic1 = 1; // no such type
-const long f11 = 1; // redefinition
-const long F10 = 1; // case-insensitive redefinition
+const XXX ic1 = 1; // no such type
+const long f11 = 1; // redefinition
+const long F10 = 1; // case-insensitive redefinition
sequence<long> LS;
-const LS ic2 = 1; // illegal constant type
-const Object ic3 = 0; // illegal constant type
+const LS ic2 = 1; // illegal constant type
+const Object ic3 = 0; // illegal constant type
-const bool ic4 = 0; // type mismatch
-const byte ic5 = "hello"; // type mismatch
-const short ic6 = 1.1; // type mismatch
-const int ic7 = blue; // type mismatch
-const long ic8 = false; // type mismatch
+const bool ic4 = 0; // type mismatch
+const byte ic5 = "hello"; // type mismatch
+const short ic6 = 1.1; // type mismatch
+const int ic7 = blue; // type mismatch
+const long ic8 = false; // type mismatch
-const long = 0; // missing identifier
+const long = 0; // missing identifier
enum digit { one, two };
-const color ic9 = two; // wrong enumerator type
-const color ic10 = 0; // wrong initializer type
+const color ic9 = two; // wrong enumerator type
+const color ic10 = 0; // wrong initializer type
//
// Range checks
//
-const long r1 = 9223372036854775807; // LLONG_MAX, OK
-const long r2 = -9223372036854775807; // -LLONG_MAX, OK
+const long r1 = 9223372036854775807; // LLONG_MAX, OK
+const long r2 = -9223372036854775807; // -LLONG_MAX, OK
//
// TODO: This should work, but doesn't. STLport can't handle inserting
// LLONG_MIN onto a stream and inserts garbage. We can periodically try
// this again as new versions of STLport come out...
//
-// const long r3 = -9223372036854775808; // LLONG_MIN, OK
+// const long r3 = -9223372036854775808; // LLONG_MIN, OK
//
-const long r4 = -9223372036854775809; // underflow
-const long r5 = +9223372036854775808; // overflow
+const long r4 = -9223372036854775809; // underflow
+const long r5 = +9223372036854775808; // overflow
-const int i1 = -2147483648; // INT_MIN, OK
-const int i2 = +2147483647; // INT_MAX, OK
-const int i3 = -2147483649; // underflow
-const int i4 = +2147483648; // overflow
+const int i1 = -2147483648; // INT_MIN, OK
+const int i2 = +2147483647; // INT_MAX, OK
+const int i3 = -2147483649; // underflow
+const int i4 = +2147483648; // overflow
-const short s1 = -32768; // SHORT_MIN, OK
-const short s2 = +32767; // SHORT_MAX, OK
-const short s3 = -32769; // underflow
-const short s4 = +32768; // overflow
+const short s1 = -32768; // SHORT_MIN, OK
+const short s2 = +32767; // SHORT_MAX, OK
+const short s3 = -32769; // underflow
+const short s4 = +32768; // overflow
-const byte b1 = 0; // OK
-const byte b2 = 255; // OK
-const byte b3 = -1; // underflow
-const byte b4 = 256; // overflow
+const byte b1 = 0; // OK
+const byte b2 = 255; // OK
+const byte b3 = -1; // underflow
+const byte b4 = 256; // overflow
const string nullstring1 = "a\000";
const string nullstring2 = "a\x000";
diff --git a/cpp/test/Slice/errorDetection/DerivedRedefinition.ice b/cpp/test/Slice/errorDetection/DerivedRedefinition.ice
index 483d8483fb8..dc99aca5084 100644
--- a/cpp/test/Slice/errorDetection/DerivedRedefinition.ice
+++ b/cpp/test/Slice/errorDetection/DerivedRedefinition.ice
@@ -20,8 +20,8 @@ interface Base1
interface Derived1 extends Base1
{
- void op(); // error
- long op(); // error
+ void op(); // error
+ long op(); // error
void foo();
};
@@ -32,22 +32,22 @@ interface Base2
interface D1 extends Base1
{
- void foo(); // OK
+ void foo(); // OK
};
interface D2 extends D1
{
- void op(); // error, op() in Base1
+ void op(); // error, op() in Base1
};
interface D3 extends D1, Base2
{
- void bar(); // error, op() in Base1 and Base2
+ void bar(); // error, op() in Base1 and Base2
};
class c1 { long l; };
-class c2 extends c1 { double l; }; // error
-class c3 extends c1 { double d; }; // OK
-class c4 extends c3 { short l; }; // error, l in c1
+class c2 extends c1 { double l; }; // error
+class c3 extends c1 { double d; }; // OK
+class c4 extends c3 { short l; }; // error, l in c1
};
diff --git a/cpp/test/Slice/errorDetection/IdentAsKeyword.ice b/cpp/test/Slice/errorDetection/IdentAsKeyword.ice
index 44a5e50e424..6e940706bb4 100644
--- a/cpp/test/Slice/errorDetection/IdentAsKeyword.ice
+++ b/cpp/test/Slice/errorDetection/IdentAsKeyword.ice
@@ -83,14 +83,14 @@ interface i8 { void op(double BYTE); };
interface i9 { void op(out double byte); };
interface i10 { void op(out double BYTE); };
-interface \true {}; // OK, escaped keyword
+interface \true {}; // OK, escaped keyword
-interface _a; // Illegal leading underscore
-interface _true; // Illegal leading underscore
-interface \_true; // Illegal leading underscore
+interface _a; // Illegal leading underscore
+interface _true; // Illegal leading underscore
+interface \_true; // Illegal leading underscore
-interface b_; // Illegal underscore
-interface tr_ue; // Illegal underscore
-interface \tr_ue; // Illegal underscore
+interface b_; // Illegal underscore
+interface tr_ue; // Illegal underscore
+interface \tr_ue; // Illegal underscore
};
diff --git a/cpp/test/Slice/errorDetection/IllegalDictionary.ice b/cpp/test/Slice/errorDetection/IllegalDictionary.ice
index e7863ef7b62..18b59a7a812 100644
--- a/cpp/test/Slice/errorDetection/IllegalDictionary.ice
+++ b/cpp/test/Slice/errorDetection/IllegalDictionary.ice
@@ -12,48 +12,48 @@
module Test
{
-dictionary<bool, long> d1; // OK
-dictionary<byte, long> d2; // OK
-dictionary<short, long> d3; // OK
-dictionary<int, long> d4; // OK
-dictionary<long, long> d5; // OK
-dictionary<string, long> d6; // OK
-
-dictionary<float, long> b1; // Bad
-dictionary<double, long> b2; // Bad
-dictionary<Object, long> b3; // Bad
-dictionary<Object*, long> b4; // Bad
-dictionary<LocalObject, long> b5; // Bad
+dictionary<bool, long> d1; // OK
+dictionary<byte, long> d2; // OK
+dictionary<short, long> d3; // OK
+dictionary<int, long> d4; // OK
+dictionary<long, long> d5; // OK
+dictionary<string, long> d6; // OK
+
+dictionary<float, long> b1; // Bad
+dictionary<double, long> b2; // Bad
+dictionary<Object, long> b3; // Bad
+dictionary<Object*, long> b4; // Bad
+dictionary<LocalObject, long> b5; // Bad
sequence<byte> s1;
-dictionary<s1, long> d7; // OK
+dictionary<s1, long> d7; // OK
sequence<float> s2;
-dictionary<s2, long> b6; // Bad
+dictionary<s2, long> b6; // Bad
sequence<s1> s3;
-dictionary<s3, long> b7; // OK
+dictionary<s3, long> b7; // OK
struct st1
{
long x;
long y;
};
-dictionary<st1, long> d8; // OK
+dictionary<st1, long> d8; // OK
struct st2
{
long x;
float y;
};
-dictionary<st2, long> b8; // Bad
+dictionary<st2, long> b8; // Bad
enum e { e1, e2 };
-dictionary<e, long> d9; // OK
+dictionary<e, long> d9; // OK
sequence<e> s4;
-dictionary<s4, long> d10; // OK
+dictionary<s4, long> d10; // OK
-dictionary<d9, long> b9; // Bad
+dictionary<d9, long> b9; // Bad
};
diff --git a/cpp/test/Slice/errorDetection/IllegalLocal.ice b/cpp/test/Slice/errorDetection/IllegalLocal.ice
index 44fad05de27..8ab2d9b63a8 100644
--- a/cpp/test/Slice/errorDetection/IllegalLocal.ice
+++ b/cpp/test/Slice/errorDetection/IllegalLocal.ice
@@ -14,51 +14,51 @@ module Test
interface i1 {};
-local interface i2 extends i1 {}; // error
+local interface i2 extends i1 {}; // error
-interface i3 extends i2 {}; // error
+interface i3 extends i2 {}; // error
-local interface i4 extends i2 {}; // OK
+local interface i4 extends i2 {}; // OK
-class c1 implements i1 {}; // OK
+class c1 implements i1 {}; // OK
-class c2 implements i2 {}; // error
+class c2 implements i2 {}; // error
local exception le {};
interface i
{
- void op() throws le; // error
+ void op() throws le; // error
};
-exception le2 extends le {}; // error
+exception le2 extends le {}; // error
local sequence<long> lls;
class c3
{
- LocalObject lo1; // error
- i2* lo2; // error
- i2 lo3; // error
- lls ls; // error
+ LocalObject lo1; // error
+ i2* lo2; // error
+ i2 lo3; // error
+ lls ls; // error
};
struct s1
{
- lls ls; // error
+ lls ls; // error
};
exception e3
{
- lls ls; // error
+ lls ls; // error
};
-sequence<LocalObject> los; // error
+sequence<LocalObject> los; // error
local sequence<byte> bs;
-dictionary<bs, long> d1; // error
-dictionary<long, bs> d2; // error
-dictionary<bs, bs> d3; // error
+dictionary<bs, long> d1; // error
+dictionary<long, bs> d2; // error
+dictionary<bs, bs> d3; // error
local interface i4;
struct s2
@@ -84,12 +84,12 @@ exception E
local interface i6
{
- void op() throws E; // error
+ void op() throws E; // error
};
local class c7
{
- void op() throws E; // error
+ void op() throws E; // error
};
};
diff --git a/cpp/test/Slice/errorDetection/IllegalMI.ice b/cpp/test/Slice/errorDetection/IllegalMI.ice
index 4dc2d4bd731..395a4b0b7c5 100644
--- a/cpp/test/Slice/errorDetection/IllegalMI.ice
+++ b/cpp/test/Slice/errorDetection/IllegalMI.ice
@@ -59,7 +59,7 @@ module M2
void op();
};
- interface A3 extends A2, B2 // Error
+ interface A3 extends A2, B2 // Error
{
void ia3();
};
@@ -200,7 +200,7 @@ module M7
void ic1();
};
- interface A2 extends A1, B1, C1 // Error
+ interface A2 extends A1, B1, C1 // Error
{
void ia2();
};
@@ -228,7 +228,7 @@ module M8
void op();
};
- interface A2 extends A1, B1, C1 // Error
+ interface A2 extends A1, B1, C1 // Error
{
void ia2();
};
@@ -256,7 +256,7 @@ module M9
void op();
};
- interface A2 extends A1, B1, C1 // Error
+ interface A2 extends A1, B1, C1 // Error
{
void ia2();
};
@@ -286,7 +286,7 @@ module M10
void op();
};
- interface A2 extends A1, B1, C1 // Error
+ interface A2 extends A1, B1, C1 // Error
{
void ia2();
};
@@ -350,7 +350,7 @@ module M12
void id1();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -384,7 +384,7 @@ module M13
void id1();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -417,7 +417,7 @@ module M14
void op();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -451,7 +451,7 @@ module M15
void id1();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -485,7 +485,7 @@ module M16
void op();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -519,7 +519,7 @@ module M17
void op();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -554,7 +554,7 @@ module M18
void id1();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -624,7 +624,7 @@ module M20
void op();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -659,7 +659,7 @@ module M21
void op();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -695,7 +695,7 @@ module M22
void op();
};
- interface A2 extends A1, B1, C1, D1 // Error
+ interface A2 extends A1, B1, C1, D1 // Error
{
void ia2();
};
@@ -737,7 +737,7 @@ module M23
void id1();
};
- interface A2 extends A1, B1, C1, D1 // OK
+ interface A2 extends A1, B1, C1, D1 // OK
{
void ia2();
};
@@ -899,7 +899,7 @@ module M26
void ib3();
};
- interface A4 extends A3, B3 // OK
+ interface A4 extends A3, B3 // OK
{
void ia4();
};
@@ -973,7 +973,7 @@ module M27
void ib3();
};
- interface A4 extends A3, B3 // Error
+ interface A4 extends A3, B3 // Error
{
void ia4();
};
@@ -1047,7 +1047,7 @@ module M28
void ib3();
};
- interface A4 extends A3, B3 // Error
+ interface A4 extends A3, B3 // Error
{
void ia4();
};
@@ -1121,7 +1121,7 @@ module M29
void ib3();
};
- interface A4 extends A3, B3 // Error
+ interface A4 extends A3, B3 // Error
{
void ia4();
};
@@ -1193,7 +1193,7 @@ module M30
void ib3();
};
- interface A4 extends A3, B3 // Error
+ interface A4 extends A3, B3 // Error
{
void ia4();
};
@@ -1265,7 +1265,7 @@ module M31
void ib3();
};
- interface A4 extends A3, B3 // Error
+ interface A4 extends A3, B3 // Error
{
void ia4();
};
diff --git a/cpp/test/Slice/errorDetection/Reserved.ice b/cpp/test/Slice/errorDetection/Reserved.ice
index c14a5a449a7..b1519bbcbe8 100644
--- a/cpp/test/Slice/errorDetection/Reserved.ice
+++ b/cpp/test/Slice/errorDetection/Reserved.ice
@@ -12,7 +12,7 @@
-#include <include/IcePrefix.ice> // No error should be caused by this file
+#include <include/IcePrefix.ice> // No error should be caused by this file
module OK
{
diff --git a/cpp/test/Slice/errorDetection/SelfContainment.ice b/cpp/test/Slice/errorDetection/SelfContainment.ice
index 9e7ddde676d..0b256b7fce0 100644
--- a/cpp/test/Slice/errorDetection/SelfContainment.ice
+++ b/cpp/test/Slice/errorDetection/SelfContainment.ice
@@ -15,13 +15,13 @@ module Test
struct x
{
int i;
- x j; // Error
+ x j; // Error
};
class y
{
int i;
- y j; // OK
+ y j; // OK
};
};
diff --git a/cpp/test/Slice/errorDetection/StructMembers.ice b/cpp/test/Slice/errorDetection/StructMembers.ice
index 86429390781..89c5a2799ca 100644
--- a/cpp/test/Slice/errorDetection/StructMembers.ice
+++ b/cpp/test/Slice/errorDetection/StructMembers.ice
@@ -12,41 +12,41 @@
module Test
{
-struct s1 // Illegal empty struct
+struct s1 // Illegal empty struct
{
};
struct s2
{
- long l; // One member, OK
+ long l; // One member, OK
};
struct s4
{
- [ "Hi" ] long l; // One member with metadata, OK
+ [ "Hi" ] long l; // One member with metadata, OK
};
-struct s5 // Two members, OK
+struct s5 // Two members, OK
{
long l;
byte b;
};
struct s6
-{ // Two members with metadata, OK
- [ "Hi" ] long l;
- byte b;
+{ // Two members with metadata, OK
+ [ "Hi" ] long l;
+ byte b;
};
-struct s7 // Two members with metadata, OK
+struct s7 // Two members with metadata, OK
{
- [ "Hi" ] long l;
- [ "there" ] byte b;
+ [ "Hi" ] long l;
+ [ "there" ] byte b;
};
struct s8
{
- [ "hi" ] long ; // Missing data member name
+ [ "hi" ] long ; // Missing data member name
};
struct s9
@@ -56,12 +56,12 @@ struct s9
struct s10
{
- long ; // Missing data member name
+ long ; // Missing data member name
};
struct s11
{
- long // Missing data member name
+ long // Missing data member name
};
};
diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py
index 70e7550f1d6..52b20f94051 100755
--- a/cpp/test/Slice/errorDetection/run.py
+++ b/cpp/test/Slice/errorDetection/run.py
@@ -39,9 +39,9 @@ for file in files:
print file + "...",
if file == "CaseSensitive.ice":
- command = slice2cpp + " --case-sensitive -I. " + os.path.join(directory, file);
+ command = slice2cpp + " --case-sensitive -I. " + os.path.join(directory, file);
else:
- command = slice2cpp + " -I. " + os.path.join(directory, file);
+ command = slice2cpp + " -I. " + os.path.join(directory, file);
stdin, stdout, stderr = os.popen3(command)
lines1 = stdout.readlines()
lines2 = open(os.path.join(directory, regex1.sub(".err", file)), "r").readlines()