diff options
-rw-r--r-- | cpp/demo/Freeze/bench/Client.cpp | 588 | ||||
-rw-r--r-- | cpp/src/IceGrid/Client.cpp | 88 | ||||
-rw-r--r-- | cpp/src/IceSSL/EndpointI.cpp | 12 | ||||
-rw-r--r-- | cpp/src/slice2cs/Gen.cpp | 26 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 33 | ||||
-rwxr-xr-x | cpp/test/Ice/stream/Client.cpp | 11 |
6 files changed, 361 insertions, 397 deletions
diff --git a/cpp/demo/Freeze/bench/Client.cpp b/cpp/demo/Freeze/bench/Client.cpp index d27dcad0efc..91414d56ae4 100644 --- a/cpp/demo/Freeze/bench/Client.cpp +++ b/cpp/demo/Freeze/bench/Client.cpp @@ -147,315 +147,31 @@ public: private: - // - // We need to define the template function here because of a VC6 bug :-(. - // - void IntIntMapIndexTest(IntIntMap&) {} + 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) - { - m.put(typename T::value_type(i, i)); - } - 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; - } - + template<class T> void IntIntMapTest(const string&, T* = 0); void generatedReadWithIndex(IntIntMap&, int, const GeneratorPtr&) {} 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); - } - - + template<class T> void generatedRead(T&, int, const GeneratorPtr&); void Struct1Struct2MapIndexTest(Struct1Struct2Map&) {} 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; - m.put(typename T::value_type(s1, s2)); - } - 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; - } - + template<class T> void Struct1Struct2MapTest(const string& mapName, T* = 0); void Struct1Class1MapIndexTest(Struct1Class1Map&) {} 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(); - m.put(typename T::value_type(s1, c1)); - } - 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; - } + template<class T> void Struct1Class1MapTest(const string& mapName, T* = 0); void IntIntMapReadIndexTest(IntIntMap&) {} 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) - { - m.put(typename T::value_type(i, i)); - } - 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; - */ - } - - + template<class T> void IntIntMapReadTest(const string& mapName, T* = 0); + void Struct1ObjectMapTest(); const string _envName; @@ -492,6 +208,69 @@ TestApp::IntIntMapIndexTest(IndexedIntIntMap& m) cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl; } +template<class T> void +TestApp::IntIntMapTest(const string& mapName, T*) +{ + T m(_connection, mapName); + // + // Populate the database. + // + int i; + _watch.start(); + { + Freeze::TransactionHolder txHolder(_connection); + for(i = 0; i < _repetitions; ++i) + { + m.put(typename T::value_type(i, i)); + } + 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; +} + void TestApp::generatedReadWithIndex(IndexedIntIntMap& m, int reads, const GeneratorPtr& gen) { @@ -511,7 +290,26 @@ TestApp::generatedReadWithIndex(IndexedIntIntMap& m, int reads, const GeneratorP cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl; } - +template<class T> void +TestApp::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); +} void TestApp::Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map& m) { @@ -545,6 +343,81 @@ TestApp::Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map& m) cout << "\ttime per indexed read: " << perRecord * 1000 << "ms" << endl; } +template<class T> void +TestApp::Struct1Struct2MapTest(const string& mapName, T*) +{ + 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; + m.put(typename T::value_type(s1, s2)); + } + 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; +} + void TestApp::Struct1Class1MapIndexTest(IndexedStruct1Class1Map& m) { @@ -568,6 +441,80 @@ TestApp::Struct1Class1MapIndexTest(IndexedStruct1Class1Map& m) cout << "\ttime per indexed read: " << perRecord * 1000 << "ms" << endl; } +template<class T> void +TestApp::Struct1Class1MapTest(const string& mapName, T*) +{ + 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(); + m.put(typename T::value_type(s1, c1)); + } + 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 TestApp::Struct1ObjectMapTest() @@ -666,6 +613,63 @@ TestApp::Struct1ObjectMapTest() cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } +template<class T> void +TestApp::IntIntMapReadTest(const string& mapName, T*) +{ + T m(_connection, mapName); + + // + // Populate the database. + // + int i; + _watch.start(); + { + Freeze::TransactionHolder txHolder(_connection); + for(i = 0; i < _repetitions; ++i) + { + m.put(typename T::value_type(i, i)); + } + 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; + */ +} + class MyFactory : public Ice::ObjectFactory { public: diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp index 1b38c97dfbe..052957900ac 100644 --- a/cpp/src/IceGrid/Client.cpp +++ b/cpp/src/IceGrid/Client.cpp @@ -34,7 +34,7 @@ #endif using namespace std; -//using namespace Ice; // COMPILERFIX: VC6 reports compilation error because of ambiguous Locator symbol. +using namespace Ice; using namespace IceGrid; class Client; @@ -92,7 +92,7 @@ public: { _session->keepAlive(); } - catch(const Ice::Exception&) + catch(const Exception&) { break; } @@ -115,40 +115,40 @@ private: }; typedef IceUtil::Handle<SessionKeepAliveThread> SessionKeepAliveThreadPtr; -class ReuseConnectionRouter : public Ice::Router +class ReuseConnectionRouter : public Router { public: - ReuseConnectionRouter(const Ice::ObjectPrx& proxy) : _clientProxy(proxy) + ReuseConnectionRouter(const ObjectPrx& proxy) : _clientProxy(proxy) { } - virtual Ice::ObjectPrx - getClientProxy(const Ice::Current&) const + virtual ObjectPrx + getClientProxy(const Current&) const { return _clientProxy; } - virtual Ice::ObjectPrx - getServerProxy(const Ice::Current&) const + virtual ObjectPrx + getServerProxy(const Current&) const { return 0; } virtual void - addProxy(const Ice::ObjectPrx&, const Ice::Current&) + addProxy(const ObjectPrx&, const Current&) { } - virtual Ice::ObjectProxySeq - addProxies(const Ice::ObjectProxySeq&, const Ice::Current&) + virtual ObjectProxySeq + addProxies(const ObjectProxySeq&, const Current&) { - return Ice::ObjectProxySeq(); + return ObjectProxySeq(); } private: - const Ice::ObjectPrx _clientProxy; + const ObjectPrx _clientProxy; }; class Client : public IceUtil::Monitor<IceUtil::Mutex> @@ -156,11 +156,11 @@ class Client : public IceUtil::Monitor<IceUtil::Mutex> public: void usage(); - int main(Ice::StringSeq& args); - int run(Ice::StringSeq& args); + int main(StringSeq& args); + int run(StringSeq& args); void interrupted(); - Ice::CommunicatorPtr communicator() const { return _communicator; } + CommunicatorPtr communicator() const { return _communicator; } const string& appName() const { return _appName; } string getPassword(const string&); @@ -168,7 +168,7 @@ public: private: IceUtil::CtrlCHandler _ctrlCHandler; - Ice::CommunicatorPtr _communicator; + CommunicatorPtr _communicator; string _appName; ParserPtr _parser; }; @@ -196,7 +196,7 @@ main(int argc, char* argv[]) #endif { Client app; - Ice::StringSeq args = Ice::argsToStringSeq(argc, argv); + StringSeq args = argsToStringSeq(argc, argv); return app.main(args); } @@ -220,22 +220,22 @@ Client::usage() int -Client::main(Ice::StringSeq& args) +Client::main(StringSeq& args) { int status = EXIT_SUCCESS; try { _appName = args[0]; - Ice::InitializationData id; - id.properties = Ice::createProperties(args); + InitializationData id; + id.properties = createProperties(args); // // We don't want to load DB plug-ins with icegridadmin, as this will // cause FileLock issues when run with the same configuration file // used by the service. // id.properties->setProperty("Ice.Plugin.DB", ""); - _communicator = Ice::initialize(id); + _communicator = initialize(id); { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> sync(_staticMutex); @@ -247,7 +247,7 @@ Client::main(Ice::StringSeq& args) { status = run(args); } - catch(const Ice::CommunicatorDestroyedException&) + catch(const CommunicatorDestroyedException&) { // Expected if the client is interrupted during the initialization. } @@ -284,10 +284,10 @@ Client::main(Ice::StringSeq& args) { _communicator->destroy(); } - catch(const Ice::CommunicatorDestroyedException&) + catch(const CommunicatorDestroyedException&) { } - catch(const Ice::Exception& ex) + catch(const Exception& ex) { cerr << ex << endl; status = EXIT_FAILURE; @@ -322,14 +322,14 @@ Client::interrupted() { _communicator->destroy(); } - catch(const Ice::Exception&) + catch(const Exception&) { } } } int -Client::run(Ice::StringSeq& originalArgs) +Client::run(StringSeq& originalArgs) { string commands; bool debug; @@ -376,10 +376,10 @@ Client::run(Ice::StringSeq& originalArgs) if(opts.isSet("server")) { - Ice::ObjectAdapterPtr adapter = + ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("FileParser", "tcp -h localhost"); adapter->activate(); - Ice::ObjectPrx proxy = adapter->add(new FileParserI, communicator()->stringToIdentity("FileParser")); + ObjectPrx proxy = adapter->add(new FileParserI, communicator()->stringToIdentity("FileParser")); cout << proxy << endl; communicator()->waitForShutdown(); @@ -413,7 +413,7 @@ Client::run(Ice::StringSeq& originalArgs) password = opts.optArg("password"); } - Ice::PropertiesPtr properties = communicator()->getProperties(); + PropertiesPtr properties = communicator()->getProperties(); string replica = properties->getProperty("IceGridAdmin.Replica"); if(!opts.optArg("replica").empty()) { @@ -439,7 +439,7 @@ Client::run(Ice::StringSeq& originalArgs) return EXIT_FAILURE; } } - catch(const Ice::LocalException& ex) + catch(const LocalException& ex) { cerr << _appName << ": could not contact the default router:" << endl << ex << endl; return EXIT_FAILURE; @@ -501,7 +501,7 @@ Client::run(Ice::StringSeq& originalArgs) // // Create the identity of the registry to connect to. // - Ice::Identity registryId; + Identity registryId; registryId.category = communicator()->getDefaultLocator()->ice_getIdentity().category; registryId.name = "Registry"; if(!replica.empty() && replica != "Master") @@ -526,7 +526,7 @@ Client::run(Ice::StringSeq& originalArgs) } localRegistry = locator->getLocalRegistry(); } - catch(const Ice::LocalException& ex) + catch(const LocalException& ex) { cerr << _appName << ": could not contact the default locator:" << endl << ex << endl; return EXIT_FAILURE; @@ -552,12 +552,12 @@ Client::run(Ice::StringSeq& originalArgs) cerr << _appName << ": could not contact an IceGrid registry" << endl; } } - catch(const Ice::NotRegisteredException&) + catch(const NotRegisteredException&) { cerr << _appName << ": no active registry replica named `" << replica << "'" << endl; return EXIT_FAILURE; } - catch(const Ice::LocalException& ex) + catch(const LocalException& ex) { if(!replica.empty()) { @@ -591,10 +591,10 @@ Client::run(Ice::StringSeq& originalArgs) if(registry->ice_getIdentity() == localRegistry->ice_getIdentity()) { properties->setProperty("CollocInternal.AdapterId", IceUtil::generateUUID()); - Ice::ObjectAdapterPtr colloc = communicator()->createObjectAdapter("CollocInternal"); + ObjectAdapterPtr colloc = communicator()->createObjectAdapter("CollocInternal"); colloc->setLocator(0); - Ice::ObjectPrx router = colloc->addWithUUID(new ReuseConnectionRouter(locator)); - communicator()->setDefaultRouter(Ice::RouterPrx::uncheckedCast(router)); + ObjectPrx router = colloc->addWithUUID(new ReuseConnectionRouter(locator)); + communicator()->setDefaultRouter(RouterPrx::uncheckedCast(router)); registry = registry->ice_router(communicator()->getDefaultRouter()); } @@ -654,8 +654,8 @@ Client::run(Ice::StringSeq& originalArgs) AdminPrx admin = session->getAdmin(); - Ice::SliceChecksumDict serverChecksums = admin->getSliceChecksums(); - Ice::SliceChecksumDict localChecksums = Ice::sliceChecksums(); + SliceChecksumDict serverChecksums = admin->getSliceChecksums(); + SliceChecksumDict localChecksums = sliceChecksums(); // // The following slice types are only used by the admin CLI. @@ -663,9 +663,9 @@ Client::run(Ice::StringSeq& originalArgs) localChecksums.erase("::IceGrid::FileParser"); localChecksums.erase("::IceGrid::ParseException"); - for(Ice::SliceChecksumDict::const_iterator q = localChecksums.begin(); q != localChecksums.end(); ++q) + for(SliceChecksumDict::const_iterator q = localChecksums.begin(); q != localChecksums.end(); ++q) { - Ice::SliceChecksumDict::const_iterator r = serverChecksums.find(q->first); + SliceChecksumDict::const_iterator r = serverChecksums.find(q->first); if(r == serverChecksums.end()) { cerr << appName() << ": server is using unknown Slice type `" << q->first << "'" << endl; @@ -734,7 +734,7 @@ Client::run(Ice::StringSeq& originalArgs) session->destroy(); } } - catch(const Ice::Exception&) + catch(const Exception&) { } throw; @@ -759,7 +759,7 @@ Client::run(Ice::StringSeq& originalArgs) session->destroy(); } } - catch(const Ice::Exception&) + catch(const Exception&) { // Ignore. If the registry has been shutdown this will cause // an exception. diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp index 4d389371d42..a9eb8e707d8 100644 --- a/cpp/src/IceSSL/EndpointI.cpp +++ b/cpp/src/IceSSL/EndpointI.cpp @@ -271,11 +271,8 @@ IceSSL::EndpointI::toString() const return s.str(); } -// -// COMPILERFIX: VC6 complains about an ambiguous "EndpointInfo" symbol when this class is defined inside -// getInfo(). Moving the definition into an anonymous namespace works around it. -// -namespace +Ice::EndpointInfoPtr +IceSSL::EndpointI::getInfo() const { class InfoI : public IceSSL::EndpointInfo { @@ -304,11 +301,6 @@ namespace return true; } }; -} - -Ice::EndpointInfoPtr -IceSSL::EndpointI::getInfo() const -{ return new InfoI(_protocol, _encoding, _timeout, _compress, _host, _port); } diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 0053fd2a01f..f636b758a77 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -28,20 +28,8 @@ using namespace std; using namespace Slice; - -// -// Don't use "using namespace IceUtil", or VC++ 6.0 complains about -// ambigious symbols for constructs like -// "IceUtil::constMemFun(&Slice::Exception::isLocal)". -// -using IceUtilInternal::Output; -using IceUtilInternal::nl; -using IceUtilInternal::sp; -using IceUtilInternal::sb; -using IceUtilInternal::eb; -using IceUtilInternal::spar; -using IceUtilInternal::epar; -using IceUtilInternal::trim; +using namespace IceUtil; +using namespace IceUtilInternal; static string // Should be an anonymous namespace, but VC++ 6 can't handle that. sliceModeToIceMode(Operation::Mode opMode) @@ -189,9 +177,9 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream) // 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), 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), constMemFun(&Contained::scoped)); #endif StringList other; @@ -615,9 +603,9 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream) // // 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), 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), constMemFun(&Contained::name)); #endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); @@ -2026,7 +2014,7 @@ Slice::Gen::generateChecksums(const UnitPtr& u) ChecksumMap map = createChecksums(u); if(!map.empty()) { - string className = "X" + IceUtil::generateUUID(); + string className = "X" + generateUUID(); for(string::size_type pos = 1; pos < className.size(); ++pos) { if(!isalnum(static_cast<unsigned char>(className[pos]))) diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 472acac73f7..3f0c23c2aca 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -21,19 +21,8 @@ using namespace std; using namespace Slice; - -// -// Don't use "using namespace IceUtil", or VC++ 6.0 complains -// about ambiguous symbols for constructs like -// "IceUtil::constMemFun(&Slice::Exception::isLocal)". -// -using IceUtilInternal::Output; -using IceUtilInternal::nl; -using IceUtilInternal::sp; -using IceUtilInternal::sb; -using IceUtilInternal::eb; -using IceUtilInternal::spar; -using IceUtilInternal::epar; +using namespace IceUtil; +using namespace IceUtilInternal; static string sliceModeToIceMode(Operation::Mode opMode) @@ -830,7 +819,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& ClassList allBases = p->allBases(); StringList ids; - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); + transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); @@ -840,7 +829,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& StringList::const_iterator firstIter = ids.begin(); StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped); assert(scopedIter != ids.end()); - StringList::difference_type scopedPos = IceUtilInternal::distance(firstIter, scopedIter); + StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter); out << sp << nl << "public static final String[] __ids ="; out << sb; @@ -1298,7 +1287,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& if(!allOps.empty()) { StringList allOpNames; - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun(&Contained::name)); allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -3102,11 +3091,11 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) } else { - IceUtil::Int64 v = 0; + Int64 v = 0; serialVersionUID = serialVersionUID.substr(pos); if(serialVersionUID != "0") { - if(!IceUtilInternal::stringToInt64(serialVersionUID, v)) // conversion error + if(!stringToInt64(serialVersionUID, v)) // conversion error { ostringstream os; os << "ignoring invalid serialVersionUID for class `" << p->scoped() @@ -3874,11 +3863,11 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) } else { - IceUtil::Int64 v = 0; + Int64 v = 0; serialVersionUID = serialVersionUID.substr(pos); if(serialVersionUID != "0") { - if(!IceUtilInternal::stringToInt64(serialVersionUID, v)) // conversion error + if(!stringToInt64(serialVersionUID, v)) // conversion error { ostringstream os; os << "ignoring invalid serialVersionUID for struct `" << p->scoped() @@ -4943,7 +4932,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); + transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); @@ -4953,7 +4942,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) StringList::const_iterator firstIter = ids.begin(); StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped); assert(scopedIter != ids.end()); - StringList::difference_type scopedPos = IceUtilInternal::distance(firstIter, scopedIter); + StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter); out << sp << nl << "public static final String[] __ids ="; out << sb; diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index ca9b7663734..949f2770746 100755 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -11,15 +11,6 @@ #include <TestCommon.h> #include <Test.h> -// -// We disable deprecation warning here, to allow clean compilation of -// test cases that uses the old stream api. Once the old stream API -// is gone this could be removed. -// -#ifdef _MSC_VER -# pragma warning( disable : 4996 ) -#endif - DEFINE_TEST("client") using namespace std; @@ -165,7 +156,7 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) vector<Ice::Byte> data; // - // Test the new stream api. + // Test the stream api. // cout << "testing primitive types... " << flush; |