diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-02-08 18:02:47 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-02-08 18:02:47 -0500 |
commit | cee5e5067eff15b5a22a247805edb6c8dda77074 (patch) | |
tree | e67d772a753e3ffa491571a101afb43a24824e5e /cpp | |
parent | Update Debug settings for VS 2017 (VC141) (diff) | |
download | ice-cee5e5067eff15b5a22a247805edb6c8dda77074.tar.bz2 ice-cee5e5067eff15b5a22a247805edb6c8dda77074.tar.xz ice-cee5e5067eff15b5a22a247805edb6c8dda77074.zip |
Removed cpp:unscoped from all Ice enums
CompressBatch is now "scoped" in C++98 and ObjC
Diffstat (limited to 'cpp')
61 files changed, 420 insertions, 390 deletions
diff --git a/cpp/include/Ice/Application.h b/cpp/include/Ice/Application.h index 91e7ff5f69c..866c52b4e76 100644 --- a/cpp/include/Ice/Application.h +++ b/cpp/include/Ice/Application.h @@ -17,13 +17,18 @@ namespace Ice { -enum SignalPolicy { HandleSignals, NoSignalHandling } ; +#ifdef ICE_CPP11_MAPPING +enum class SignalPolicy : unsigned char +#else +enum SignalPolicy +#endif +{ HandleSignals, NoSignalHandling }; class ICE_API Application : private IceUtil::noncopyable { public: - Application(SignalPolicy = HandleSignals); + Application(SignalPolicy = ICE_ENUM(SignalPolicy, HandleSignals)); virtual ~Application(); // diff --git a/cpp/include/Ice/Format.h b/cpp/include/Ice/Format.h index 12fc3bb5c36..a5d7ac71856 100644 --- a/cpp/include/Ice/Format.h +++ b/cpp/include/Ice/Format.h @@ -18,7 +18,12 @@ namespace Ice // // This enumeration describes the possible formats for classes and exceptions. // + +#ifdef ICE_CPP11_MAPPING +enum class FormatType : unsigned char +#else enum FormatType +#endif { // // Indicates that no preference was specified. diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h index 9d7924aa9b7..de0bec23cdd 100644 --- a/cpp/include/Ice/OutputStream.h +++ b/cpp/include/Ice/OutputStream.h @@ -704,7 +704,7 @@ private: public: - Encaps() : format(DefaultFormat), encoder(0), previous(0) + Encaps() : format(ICE_ENUM(FormatType, DefaultFormat)), encoder(0), previous(0) { // Inlined for performance reasons. } diff --git a/cpp/include/Ice/StreamHelpers.h b/cpp/include/Ice/StreamHelpers.h index 991ba55e703..bc1a972f3d7 100644 --- a/cpp/include/Ice/StreamHelpers.h +++ b/cpp/include/Ice/StreamHelpers.h @@ -46,19 +46,33 @@ const StreamHelperCategory StreamHelperCategoryUserException = 9; // and how it can be skipped by the unmarshaling code if the optional // isn't known to the receiver. // + +#ifdef ICE_CPP11_MAPPING +enum class OptionalFormat : unsigned char +{ + F1 = 0, // Fixed 1-byte encoding + F2 = 1, // Fixed 2 bytes encoding + F4 = 2, // Fixed 4 bytes encoding + F8 = 3, // Fixed 8 bytes encoding + Size = 4, // "Size encoding" on 1 to 5 bytes, e.g. enum, class identifier + VSize = 5, // "Size encoding" on 1 to 5 bytes followed by data, e.g. string, fixed size + // struct, or containers whose size can be computed prior to marshaling + FSize = 6, // Fixed size on 4 bytes followed by data, e.g. variable-size struct, container. + Class = 7 +}; +#else enum OptionalFormat { - OptionalFormatF1 = 0, // Fixed 1-byte encoding - OptionalFormatF2 = 1, // Fixed 2 bytes encoding - OptionalFormatF4 = 2, // Fixed 4 bytes encoding - OptionalFormatF8 = 3, // Fixed 8 bytes encoding - OptionalFormatSize = 4, // "Size encoding" on 1 to 5 bytes, e.g. enum, class identifier - OptionalFormatVSize = 5, // "Size encoding" on 1 to 5 bytes followed by data, e.g. string, fixed size - // struct, or containers whose size can be computed prior to marshaling - OptionalFormatFSize = 6, // Fixed size on 4 bytes followed by data, e.g. variable-size struct, container. + OptionalFormatF1 = 0, // see above + OptionalFormatF2 = 1, + OptionalFormatF4 = 2, + OptionalFormatF8 = 3, + OptionalFormatSize = 4, + OptionalFormatVSize = 5, + OptionalFormatFSize = 6, OptionalFormatClass = 7 }; - +#endif // // Is the provided type a container? @@ -636,43 +650,43 @@ struct GetOptionalFormat; template<> struct GetOptionalFormat<StreamHelperCategoryBuiltin, 1, true> { - static const OptionalFormat value = OptionalFormatF1; + static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F1); }; template<> struct GetOptionalFormat<StreamHelperCategoryBuiltin, 2, true> { - static const OptionalFormat value = OptionalFormatF2; + static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F2); }; template<> struct GetOptionalFormat<StreamHelperCategoryBuiltin, 4, true> { - static const OptionalFormat value = OptionalFormatF4; + static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F4); }; template<> struct GetOptionalFormat<StreamHelperCategoryBuiltin, 8, true> { - static const OptionalFormat value = OptionalFormatF8; + static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F8); }; template<> struct GetOptionalFormat<StreamHelperCategoryBuiltin, 1, false> { - static const OptionalFormat value = OptionalFormatVSize; + static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, VSize); }; template<> struct GetOptionalFormat<StreamHelperCategoryClass, 1, false> { - static const OptionalFormat value = OptionalFormatClass; + static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, Class); }; template<int minWireSize> struct GetOptionalFormat<StreamHelperCategoryEnum, minWireSize, false> { - static const OptionalFormat value = OptionalFormatSize; + static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, Size); }; @@ -706,7 +720,7 @@ struct StreamOptionalHelper template<typename T> struct StreamOptionalHelper<T, StreamHelperCategoryStruct, true> { - static const OptionalFormat optionalFormat = OptionalFormatVSize; + static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, VSize); template<class S> static inline void write(S* stream, const T& v) @@ -727,7 +741,7 @@ struct StreamOptionalHelper<T, StreamHelperCategoryStruct, true> template<typename T> struct StreamOptionalHelper<T, StreamHelperCategoryStruct, false> { - static const OptionalFormat optionalFormat = OptionalFormatFSize; + static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, FSize); template<class S> static inline void write(S* stream, const T& v) @@ -773,7 +787,7 @@ struct StreamOptionalContainerHelper; template<typename T, int sz> struct StreamOptionalContainerHelper<T, false, sz> { - static const OptionalFormat optionalFormat = OptionalFormatFSize; + static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, FSize); template<class S> static inline void write(S* stream, const T& v, Int) @@ -796,7 +810,7 @@ struct StreamOptionalContainerHelper<T, false, sz> template<typename T, int sz> struct StreamOptionalContainerHelper<T, true, sz> { - static const OptionalFormat optionalFormat = OptionalFormatVSize; + static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, VSize); template<class S> static inline void write(S* stream, const T& v, Int n) @@ -827,7 +841,7 @@ struct StreamOptionalContainerHelper<T, true, sz> template<typename T> struct StreamOptionalContainerHelper<T, true, 1> { - static const OptionalFormat optionalFormat = OptionalFormatVSize; + static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, VSize); template<class S> static inline void write(S* stream, const T& v, Int) diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 8ba6572b72e..177723391a0 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -370,6 +370,7 @@ typedef long long Int64; # define ICE_MAKE_SHARED(T, ...) ::std::make_shared<T>(__VA_ARGS__) # define ICE_DEFINE_PTR(TPtr, T) using TPtr = ::std::shared_ptr<T> # define ICE_ENUM(CLASS,ENUMERATOR) CLASS::ENUMERATOR +# define ICE_SCOPED_ENUM(CLASS,ENUMERATOR) CLASS::ENUMERATOR # define ICE_NULLPTR nullptr # define ICE_DYNAMIC_CAST(T,V) ::std::dynamic_pointer_cast<T>(V) # define ICE_SHARED_FROM_THIS shared_from_this() @@ -390,6 +391,7 @@ typedef long long Int64; # define ICE_MAKE_SHARED(T, ...) new T(__VA_ARGS__) # define ICE_DEFINE_PTR(TPtr, T) typedef ::IceUtil::Handle<T> TPtr # define ICE_ENUM(CLASS,ENUMERATOR) ENUMERATOR +# define ICE_SCOPED_ENUM(CLASS,ENUMERATOR) CLASS##ENUMERATOR # define ICE_NULLPTR 0 # define ICE_DYNAMIC_CAST(T,V) T##Ptr::dynamicCast(V) # define ICE_SHARED_FROM_THIS this diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp index 423b52b4e87..8fa3644cd2d 100644 --- a/cpp/src/Glacier2/RequestQueue.cpp +++ b/cpp/src/Glacier2/RequestQueue.cpp @@ -374,7 +374,7 @@ Glacier2::RequestQueue::flush() if(flushBatchRequests) { - Ice::AsyncResultPtr result = _connection->begin_flushBatchRequests(Ice::BasedOnProxy, _flushCallback); + Ice::AsyncResultPtr result = _connection->begin_flushBatchRequests(ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), _flushCallback); if(!result->sentSynchronously() && !result->isCompleted()) { _pendingSend = true; diff --git a/cpp/src/Glacier2Lib/Application.cpp b/cpp/src/Glacier2Lib/Application.cpp index 447ac923430..b318af47f92 100644 --- a/cpp/src/Glacier2Lib/Application.cpp +++ b/cpp/src/Glacier2Lib/Application.cpp @@ -158,7 +158,7 @@ Glacier2::Application::doMain(Ice::StringSeq& args, const Ice::InitializationDat // // The default is to destroy when a signal is received. // - if(_signalPolicy == Ice::HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { destroyOnInterrupt(); } @@ -195,7 +195,7 @@ Glacier2::Application::doMain(Ice::StringSeq& args, const Ice::InitializationDat { Ice::ConnectionPtr connection = _router->ice_getCachedConnection(); assert(connection); - connection->setACM(acmTimeout, IceUtil::None, Ice::HeartbeatAlways); + connection->setACM(acmTimeout, IceUtil::None, ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); #ifdef ICE_CPP11_MAPPING auto app = this; connection->setCloseCallback( @@ -288,7 +288,7 @@ Glacier2::Application::doMain(Ice::StringSeq& args, const Ice::InitializationDat // it would not make sense to release a held signal to run // shutdown or destroy. // - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { ignoreInterrupt(); } diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 9048320f801..e0062fe898b 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -788,7 +788,7 @@ SessionHelperI::connected(const Glacier2::RouterPrxPtr& router, const Glacier2:: { Ice::ConnectionPtr connection = _router->ice_getCachedConnection(); assert(connection); - connection->setACM(acmTimeout, IceUtil::None, Ice::HeartbeatAlways); + connection->setACM(acmTimeout, IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); #ifdef ICE_CPP11_MAPPING auto self = shared_from_this(); connection->setCloseCallback([self](Ice::ConnectionPtr) diff --git a/cpp/src/Ice/ACM.cpp b/cpp/src/Ice/ACM.cpp index 9990d76f995..8795874212a 100644 --- a/cpp/src/Ice/ACM.cpp +++ b/cpp/src/Ice/ACM.cpp @@ -24,14 +24,14 @@ IceUtil::Shared* IceInternal::upCast(FactoryACMMonitor* p) { return p; } #endif IceInternal::ACMConfig::ACMConfig(bool server) : - timeout(IceUtil::Time::seconds(60)), - heartbeat(Ice::HeartbeatOnInvocation), - close(server ? Ice::CloseOnInvocation : Ice::CloseOnInvocationAndIdle) + timeout(IceUtil::Time::seconds(60)), + heartbeat(ICE_ENUM(ACMHeartbeat, HeartbeatOnInvocation)), + close(server ? ICE_ENUM(ACMClose, CloseOnInvocation) : ICE_ENUM(ACMClose, CloseOnInvocationAndIdle)) { } -IceInternal::ACMConfig::ACMConfig(const Ice::PropertiesPtr& p, - const Ice::LoggerPtr& l, +IceInternal::ACMConfig::ACMConfig(const Ice::PropertiesPtr& p, + const Ice::LoggerPtr& l, const string& prefix, const ACMConfig& dflt) { @@ -45,10 +45,10 @@ IceInternal::ACMConfig::ACMConfig(const Ice::PropertiesPtr& p, timeoutProperty = prefix + ".Timeout"; }; - this->timeout = IceUtil::Time::seconds(p->getPropertyAsIntWithDefault(timeoutProperty, + this->timeout = IceUtil::Time::seconds(p->getPropertyAsIntWithDefault(timeoutProperty, static_cast<int>(dflt.timeout.toSeconds()))); - int hb = p->getPropertyAsIntWithDefault(prefix + ".Heartbeat", dflt.heartbeat); - if(hb >= Ice::HeartbeatOff && hb <= Ice::HeartbeatAlways) + int hb = p->getPropertyAsIntWithDefault(prefix + ".Heartbeat", static_cast<int>(dflt.heartbeat)); + if(hb >= static_cast<int>(ICE_ENUM(ACMHeartbeat, HeartbeatOff)) && hb <= static_cast<int>(ICE_ENUM(ACMHeartbeat, HeartbeatAlways))) { this->heartbeat = static_cast<Ice::ACMHeartbeat>(hb); } @@ -58,8 +58,8 @@ IceInternal::ACMConfig::ACMConfig(const Ice::PropertiesPtr& p, this->heartbeat = dflt.heartbeat; } - int cl = p->getPropertyAsIntWithDefault(prefix + ".Close", dflt.close); - if(cl >= Ice::CloseOff && cl <= Ice::CloseOnIdleForceful) + int cl = p->getPropertyAsIntWithDefault(prefix + ".Close", static_cast<int>(dflt.close)); + if(cl >= static_cast<int>(ICE_ENUM(ACMClose, CloseOff)) && cl <= static_cast<int>(ICE_ENUM(ACMClose, CloseOnIdleForceful))) { this->close = static_cast<Ice::ACMClose>(cl); } @@ -138,8 +138,8 @@ IceInternal::FactoryACMMonitor::reap(const ConnectionIPtr& connection) } ACMMonitorPtr -IceInternal::FactoryACMMonitor::acm(const IceUtil::Optional<int>& timeout, - const IceUtil::Optional<Ice::ACMClose>& close, +IceInternal::FactoryACMMonitor::acm(const IceUtil::Optional<int>& timeout, + const IceUtil::Optional<Ice::ACMClose>& close, const IceUtil::Optional<Ice::ACMHeartbeat>& heartbeat) { Lock sync(*this); @@ -208,7 +208,7 @@ IceInternal::FactoryACMMonitor::runTimerTask() } } - + // // Monitor connections outside the thread synchronization, so // that connections can be added or removed during monitoring. @@ -217,11 +217,11 @@ IceInternal::FactoryACMMonitor::runTimerTask() for(set<ConnectionIPtr>::const_iterator p = _connections.begin(); p != _connections.end(); ++p) { try - { + { (*p)->monitor(now, _config); } catch(const exception& ex) - { + { handleException(ex); } catch(...) @@ -239,7 +239,7 @@ FactoryACMMonitor::handleException(const exception& ex) { return; } - + Error out(_instance->initializationData().logger); out << "exception in connection monitor:\n" << ex.what(); } @@ -252,12 +252,12 @@ FactoryACMMonitor::handleException() { return; } - + Error out(_instance->initializationData().logger); out << "unknown exception in connection monitor"; } -IceInternal::ConnectionACMMonitor::ConnectionACMMonitor(const FactoryACMMonitorPtr& parent, +IceInternal::ConnectionACMMonitor::ConnectionACMMonitor(const FactoryACMMonitorPtr& parent, const IceUtil::TimerPtr& timer, const ACMConfig& config) : _parent(parent), _timer(timer), _config(config) @@ -300,8 +300,8 @@ IceInternal::ConnectionACMMonitor::reap(const ConnectionIPtr& connection) } ACMMonitorPtr -IceInternal::ConnectionACMMonitor::acm(const IceUtil::Optional<int>& timeout, - const IceUtil::Optional<Ice::ACMClose>& close, +IceInternal::ConnectionACMMonitor::acm(const IceUtil::Optional<int>& timeout, + const IceUtil::Optional<Ice::ACMClose>& close, const IceUtil::Optional<Ice::ACMHeartbeat>& heartbeat) { return _parent->acm(timeout, close, heartbeat); @@ -329,13 +329,13 @@ IceInternal::ConnectionACMMonitor::runTimerTask() } connection = _connection; } - + try - { + { connection->monitor(IceUtil::Time::now(IceUtil::Time::Monotonic), _config); } catch(const exception& ex) - { + { _parent->handleException(ex); } catch(...) diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp index 35adba8549c..279e30d9b82 100644 --- a/cpp/src/Ice/Application.cpp +++ b/cpp/src/Ice/Application.cpp @@ -36,7 +36,7 @@ bool Ice::Application::_interrupted = false; string Ice::Application::_appName; Ice::CommunicatorPtr Ice::Application::_communicator; -Ice::SignalPolicy Ice::Application::_signalPolicy = Ice::HandleSignals; +Ice::SignalPolicy Ice::Application::_signalPolicy = ICE_ENUM(SignalPolicy, HandleSignals); Ice::Application* Ice::Application::_application = 0; namespace @@ -177,7 +177,7 @@ Ice::Application::main(int argc, char* argv[], const InitializationData& initial _application = this; - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { try { @@ -258,7 +258,7 @@ Ice::Application::communicator() void Ice::Application::destroyOnInterrupt() { - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { if(_ctrlCHandler != 0) { @@ -281,7 +281,7 @@ Ice::Application::destroyOnInterrupt() void Ice::Application::shutdownOnInterrupt() { - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { if(_ctrlCHandler != 0) { @@ -304,7 +304,7 @@ Ice::Application::shutdownOnInterrupt() void Ice::Application::ignoreInterrupt() { - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { if(_ctrlCHandler != 0) { @@ -327,7 +327,7 @@ Ice::Application::ignoreInterrupt() void Ice::Application::callbackOnInterrupt() { - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { if(_ctrlCHandler != 0) { @@ -350,7 +350,7 @@ Ice::Application::callbackOnInterrupt() void Ice::Application::holdInterrupt() { - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { if(_ctrlCHandler != 0) { @@ -374,7 +374,7 @@ Ice::Application::holdInterrupt() void Ice::Application::releaseInterrupt() { - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { if(_ctrlCHandler != 0) { @@ -437,7 +437,7 @@ Ice::Application::doMain(int argc, char* argv[], const InitializationData& initD // // The default is to destroy when a signal is received. // - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { destroyOnInterrupt(); } @@ -474,7 +474,7 @@ Ice::Application::doMain(int argc, char* argv[], const InitializationData& initD // it would not make sense to release a held signal to run // shutdown or destroy. // - if(_signalPolicy == HandleSignals) + if(_signalPolicy == ICE_ENUM(SignalPolicy, HandleSignals)) { ignoreInterrupt(); } diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 9b9e00ce239..3e31b9c7c71 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -138,11 +138,11 @@ CommunicatorFlushBatchAsync::flushConnection(const ConnectionIPtr& con, Ice::Com } else { - if(compressBatch == Ice::Yes) + if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, Yes)) { compress = true; } - else if(compressBatch == Ice::No) + else if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, No)) { compress = false; } diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 598f4c983d3..223326203d1 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -153,14 +153,14 @@ private: typedef IceUtil::Handle<ConnectionFlushBatchAsync> ConnectionFlushBatchAsyncPtr; ConnectionState connectionStateMap[] = { - ConnectionStateValidating, // StateNotInitialized - ConnectionStateValidating, // StateNotValidated - ConnectionStateActive, // StateActive - ConnectionStateHolding, // StateHolding - ConnectionStateClosing, // StateClosing - ConnectionStateClosing, // StateClosingPending - ConnectionStateClosed, // StateClosed - ConnectionStateClosed, // StateFinished + ICE_ENUM(ConnectionState, ConnectionStateValidating), // StateNotInitialized + ICE_ENUM(ConnectionState, ConnectionStateValidating), // StateNotValidated + ICE_ENUM(ConnectionState, ConnectionStateActive), // StateActive + ICE_ENUM(ConnectionState, ConnectionStateHolding), // StateHolding + ICE_ENUM(ConnectionState, ConnectionStateClosing), // StateClosing + ICE_ENUM(ConnectionState, ConnectionStateClosing), // StateClosingPending + ICE_ENUM(ConnectionState, ConnectionStateClosed), // StateClosed + ICE_ENUM(ConnectionState, ConnectionStateClosed), // StateFinished }; } @@ -195,11 +195,11 @@ ConnectionFlushBatchAsync::invoke(const string& operation, Ice::CompressBatch co } else { - if(compressBatch == Ice::Yes) + if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, Yes)) { compress = true; } - else if(compressBatch == Ice::No) + else if(compressBatch == ICE_SCOPED_ENUM(CompressBatch, No)) { compress = false; } @@ -498,17 +498,17 @@ Ice::ConnectionI::close(ConnectionClose mode) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - if(mode == CloseForcefully) + if(mode == ICE_ENUM(ConnectionClose, CloseForcefully)) { setState(StateClosed, ConnectionManuallyClosedException(__FILE__, __LINE__, false)); } - else if(mode == CloseGracefully) + else if(mode == ICE_ENUM(ConnectionClose, CloseGracefully)) { setState(StateClosing, ConnectionManuallyClosedException(__FILE__, __LINE__, true)); } else { - assert(mode == CloseGracefullyAndWait); + assert(mode == ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); // // Wait until all outstanding requests have been completed. @@ -646,10 +646,10 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm) // per timeout period because the monitor() method is still only // called every (timeout / 2) period. // - if(acm.heartbeat == HeartbeatAlways || - (acm.heartbeat != HeartbeatOff && _writeStream.b.empty() && now >= (_acmLastActivity + acm.timeout / 4))) + if(acm.heartbeat == ICE_ENUM(ACMHeartbeat, HeartbeatAlways) || + (acm.heartbeat != ICE_ENUM(ACMHeartbeat, HeartbeatOff) && _writeStream.b.empty() && now >= (_acmLastActivity + acm.timeout / 4))) { - if(acm.heartbeat != HeartbeatOnInvocation || _dispatchCount > 0) + if(acm.heartbeat != ICE_ENUM(ACMHeartbeat, HeartbeatOnInvocation) || _dispatchCount > 0) { sendHeartbeatNow(); } @@ -666,9 +666,9 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm) return; } - if(acm.close != CloseOff && now >= (_acmLastActivity + acm.timeout)) + if(acm.close != ICE_ENUM(ACMClose, CloseOff) && now >= (_acmLastActivity + acm.timeout)) { - if(acm.close == CloseOnIdleForceful || (acm.close != CloseOnIdle && !_asyncRequests.empty())) + if(acm.close == ICE_ENUM(ACMClose, CloseOnIdleForceful) || (acm.close != ICE_ENUM(ACMClose, CloseOnIdle) && !_asyncRequests.empty())) { // // Close the connection if we didn't receive a heartbeat in @@ -676,7 +676,7 @@ Ice::ConnectionI::monitor(const IceUtil::Time& now, const ACMConfig& acm) // setState(StateClosed, ConnectionTimeoutException(__FILE__, __LINE__)); } - else if(acm.close != CloseOnInvocation && _dispatchCount == 0 && _batchRequestQueue->isEmpty() && + else if(acm.close != ICE_ENUM(ACMClose, CloseOnInvocation) && _dispatchCount == 0 && _batchRequestQueue->isEmpty() && _asyncRequests.empty()) { // @@ -1180,8 +1180,8 @@ Ice::ConnectionI::getACM() IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); ACM acm; acm.timeout = 0; - acm.close = CloseOff; - acm.heartbeat = HeartbeatOff; + acm.close = ICE_ENUM(ACMClose, CloseOff); + acm.heartbeat = ICE_ENUM(ACMHeartbeat, HeartbeatOff); return _monitor ? _monitor->getACM() : acm; } diff --git a/cpp/src/Ice/DefaultsAndOverrides.cpp b/cpp/src/Ice/DefaultsAndOverrides.cpp index 4c83a32799e..823cd1ebca3 100644 --- a/cpp/src/Ice/DefaultsAndOverrides.cpp +++ b/cpp/src/Ice/DefaultsAndOverrides.cpp @@ -112,11 +112,11 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro value = properties->getPropertyWithDefault("Ice.Default.EndpointSelection", "Random"); if(value == "Random") { - defaultEndpointSelection = Random; + defaultEndpointSelection = ICE_ENUM(EndpointSelectionType, Random); } else if(value == "Ordered") { - defaultEndpointSelection = Ordered; + defaultEndpointSelection = ICE_ENUM(EndpointSelectionType, Ordered); } else { @@ -163,5 +163,6 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro checkSupportedEncoding(defaultEncoding); bool slicedFormat = properties->getPropertyAsIntWithDefault("Ice.Default.SlicedFormat", 0) > 0; - const_cast<FormatType&>(defaultFormat) = slicedFormat ? SlicedFormat : CompactFormat; + const_cast<FormatType&>(defaultFormat) = slicedFormat ? + ICE_ENUM(FormatType, SlicedFormat) : ICE_ENUM(FormatType, CompactFormat); } diff --git a/cpp/src/Ice/IPEndpointI.cpp b/cpp/src/Ice/IPEndpointI.cpp index aca36399b13..846e5151f49 100644 --- a/cpp/src/Ice/IPEndpointI.cpp +++ b/cpp/src/Ice/IPEndpointI.cpp @@ -607,7 +607,7 @@ IceInternal::EndpointHostResolver::run() if(threadObserver) { - threadObserver->stateChanged(ThreadStateIdle, ThreadStateInUseForOther); + threadObserver->stateChanged(ICE_ENUM(ThreadState, ThreadStateIdle), ICE_ENUM(ThreadState, ThreadStateInUseForOther)); } try @@ -634,7 +634,7 @@ IceInternal::EndpointHostResolver::run() if(threadObserver) { - threadObserver->stateChanged(ThreadStateInUseForOther, ThreadStateIdle); + threadObserver->stateChanged(ICE_ENUM(ThreadState, ThreadStateInUseForOther), ICE_ENUM(ThreadState, ThreadStateIdle)); } } @@ -642,7 +642,7 @@ IceInternal::EndpointHostResolver::run() { if(threadObserver) { - threadObserver->stateChanged(ThreadStateInUseForOther, ThreadStateIdle); + threadObserver->stateChanged(ICE_ENUM(ThreadState, ThreadStateInUseForOther), ICE_ENUM(ThreadState, ThreadStateIdle)); } if(r.observer) { @@ -678,7 +678,7 @@ IceInternal::EndpointHostResolver::updateObserver() const CommunicatorObserverPtr& obsv = _instance->initializationData().observer; if(obsv) { - _observer.attach(obsv->getThreadObserver("Communicator", name(), ThreadStateIdle, _observer.get())); + _observer.attach(obsv->getThreadObserver("Communicator", name(), ICE_ENUM(ThreadState, ThreadStateIdle), _observer.get())); } } diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 3db0c3ae2a1..b60e9135ce0 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -52,7 +52,7 @@ IceInternal::IncomingBase::IncomingBase(Instance* instance, ResponseHandler* res bool response, Byte compress, Int requestId) : _response(response), _compress(compress), - _format(Ice::DefaultFormat), + _format(Ice::ICE_ENUM(FormatType, DefaultFormat)), _os(instance, Ice::currentProtocolEncoding), _responseHandler(responseHandler) { diff --git a/cpp/src/Ice/InputStream.cpp b/cpp/src/Ice/InputStream.cpp index 9389fb247b5..8d885109612 100644 --- a/cpp/src/Ice/InputStream.cpp +++ b/cpp/src/Ice/InputStream.cpp @@ -1485,52 +1485,52 @@ Ice::InputStream::skipOptional(OptionalFormat type) { switch(type) { - case Ice::OptionalFormatF1: - { - skip(1); - break; - } - case Ice::OptionalFormatF2: - { - skip(2); - break; - } - case Ice::OptionalFormatF4: - { - skip(4); - break; - } - case Ice::OptionalFormatF8: - { - skip(8); - break; - } - case Ice::OptionalFormatSize: - { - skipSize(); - break; - } - case Ice::OptionalFormatVSize: - { - skip(readSize()); - break; - } - case Ice::OptionalFormatFSize: - { - Int sz; - read(sz); - if(sz < 0) + case ICE_SCOPED_ENUM(OptionalFormat, F1): { - throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); + skip(1); + break; + } + case ICE_SCOPED_ENUM(OptionalFormat, F2): + { + skip(2); + break; + } + case ICE_SCOPED_ENUM(OptionalFormat, F4): + { + skip(4); + break; + } + case ICE_SCOPED_ENUM(OptionalFormat, F8): + { + skip(8); + break; + } + case ICE_SCOPED_ENUM(OptionalFormat, Size): + { + skipSize(); + break; + } + case ICE_SCOPED_ENUM(OptionalFormat, VSize): + { + skip(readSize()); + break; + } + case ICE_SCOPED_ENUM(OptionalFormat, FSize): + { + Int sz; + read(sz); + if(sz < 0) + { + throw UnmarshalOutOfBoundsException(__FILE__, __LINE__); + } + skip(sz); + break; + } + case ICE_SCOPED_ENUM(OptionalFormat, Class): + { + read(0, 0); + break; } - skip(sz); - break; - } - case Ice::OptionalFormatClass: - { - read(0, 0); - break; - } } } diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 105f6b0bd39..af602c387e2 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -231,7 +231,7 @@ Timer::updateObserver(const Ice::Instrumentation::CommunicatorObserverPtr& obsv) assert(obsv); _observer.attach(obsv->getThreadObserver("Communicator", "Ice.Timer", - Ice::Instrumentation::ThreadStateIdle, + Instrumentation::ICE_ENUM(ThreadState, ThreadStateIdle), _observer.get())); _hasObserver.exchange(_observer.get() ? 1 : 0); } @@ -248,8 +248,8 @@ Timer::runTimerTask(const IceUtil::TimerTaskPtr& task) } if(threadObserver) { - threadObserver->stateChanged(Ice::Instrumentation::ThreadStateIdle, - Ice::Instrumentation::ThreadStateInUseForOther); + threadObserver->stateChanged(Instrumentation::ICE_ENUM(ThreadState, ThreadStateIdle), + Instrumentation::ICE_ENUM(ThreadState, ThreadStateInUseForOther)); } try { @@ -259,14 +259,14 @@ Timer::runTimerTask(const IceUtil::TimerTaskPtr& task) { if(threadObserver) { - threadObserver->stateChanged(Ice::Instrumentation::ThreadStateInUseForOther, - Ice::Instrumentation::ThreadStateIdle); + threadObserver->stateChanged(Instrumentation::ICE_ENUM(ThreadState, ThreadStateInUseForOther), + Instrumentation::ICE_ENUM(ThreadState, ThreadStateIdle)); } } if(threadObserver) { - threadObserver->stateChanged(Ice::Instrumentation::ThreadStateInUseForOther, - Ice::Instrumentation::ThreadStateIdle); + threadObserver->stateChanged(Instrumentation::ICE_ENUM(ThreadState, ThreadStateInUseForOther), + Instrumentation::ICE_ENUM(ThreadState, ThreadStateIdle)); } } else diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp index 0f816647a11..4ee747d1296 100644 --- a/cpp/src/Ice/InstrumentationI.cpp +++ b/cpp/src/Ice/InstrumentationI.cpp @@ -36,17 +36,17 @@ getThreadStateMetric(ThreadState s) { switch(s) { - case ThreadStateIdle: - return 0; - case ThreadStateInUseForIO: - return &ThreadMetrics::inUseForIO; - case ThreadStateInUseForUser: - return &ThreadMetrics::inUseForUser; - case ThreadStateInUseForOther: - return &ThreadMetrics::inUseForOther; - default: - assert(false); - return 0; + case ICE_ENUM(ThreadState, ThreadStateIdle): + return 0; + case ICE_ENUM(ThreadState, ThreadStateInUseForIO): + return &ThreadMetrics::inUseForIO; + case ICE_ENUM(ThreadState, ThreadStateInUseForUser): + return &ThreadMetrics::inUseForUser; + case ICE_ENUM(ThreadState, ThreadStateInUseForOther): + return &ThreadMetrics::inUseForOther; + default: + assert(false); + return 0; } } @@ -58,11 +58,11 @@ struct ThreadStateChanged void operator()(const ThreadMetricsPtr& v) { - if(oldState != ThreadStateIdle) + if(oldState != ICE_ENUM(ThreadState, ThreadStateIdle)) { --(v.get()->*getThreadStateMetric(oldState)); } - if(newState != ThreadStateIdle) + if(newState != ICE_ENUM(ThreadState, ThreadStateIdle)) { ++(v.get()->*getThreadStateMetric(newState)); } @@ -145,19 +145,19 @@ public: { switch(_state) { - case ConnectionStateValidating: - return "validating"; - case ConnectionStateHolding: - return "holding"; - case ConnectionStateActive: - return "active"; - case ConnectionStateClosing: - return "closing"; - case ConnectionStateClosed: - return "closed"; - default: - assert(false); - return ""; + case ICE_ENUM(ConnectionState, ConnectionStateValidating): + return "validating"; + case ICE_ENUM(ConnectionState, ConnectionStateHolding): + return "holding"; + case ICE_ENUM(ConnectionState, ConnectionStateActive): + return "active"; + case ICE_ENUM(ConnectionState, ConnectionStateClosing): + return "closing"; + case ICE_ENUM(ConnectionState, ConnectionStateClosed): + return "closed"; + default: + assert(false); + return ""; } } @@ -686,7 +686,7 @@ public: virtual void initMetrics(const ThreadMetricsPtr& v) const { - if(_state != ThreadStateIdle) + if(_state != ICE_ENUM(ThreadState, ThreadStateIdle)) { ++(v.get()->*getThreadStateMetric(_state)); } diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index 0871c59377e..d6b9e2c29c7 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -541,7 +541,7 @@ IceInternal::LocatorInfo::getLocatorRegistry() // endpoint selection in case the locator returned a proxy // with some endpoints which are prefered to be tried first. // - _locatorRegistry = locatorRegistry->ice_locator(0)->ice_endpointSelection(Ice::Ordered); + _locatorRegistry = locatorRegistry->ice_locator(0)->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered)); return _locatorRegistry; } } diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 3f75d0f9270..f00d2e48f1e 100755 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -128,7 +128,7 @@ struct RandomNumberGenerator : public std::unary_function<ptrdiff_t, ptrdiff_t> void sortAddresses(vector<Address>& addrs, ProtocolSupport protocol, Ice::EndpointSelectionType selType, bool preferIPv6) { - if(selType == Ice::Random) + if(selType == Ice::ICE_ENUM(EndpointSelectionType, Random)) { RandomNumberGenerator rng; random_shuffle(addrs.begin(), addrs.end(), rng); @@ -1216,7 +1216,7 @@ IceInternal::getAddressForServer(const string& host, int port, ProtocolSupport p #endif return addr; } - vector<Address> addrs = getAddresses(host, port, protocol, Ice::Ordered, preferIPv6, canBlock); + vector<Address> addrs = getAddresses(host, port, protocol, Ice::ICE_ENUM(EndpointSelectionType, Ordered), preferIPv6, canBlock); return addrs.empty() ? Address() : addrs[0]; } @@ -2366,7 +2366,7 @@ IceInternal::doBind(SOCKET fd, const Address& addr, const string&) Address IceInternal::getNumericAddress(const std::string& address) { - vector<Address> addrs = getAddresses(address, 0, EnableBoth, Ice::Ordered, false, false); + vector<Address> addrs = getAddresses(address, 0, EnableBoth, Ice::ICE_ENUM(EndpointSelectionType, Ordered), false, false); if(addrs.empty()) { return Address(); diff --git a/cpp/src/Ice/NetworkProxy.cpp b/cpp/src/Ice/NetworkProxy.cpp index b4055bad7b9..6e70012e15f 100644 --- a/cpp/src/Ice/NetworkProxy.cpp +++ b/cpp/src/Ice/NetworkProxy.cpp @@ -168,7 +168,7 @@ NetworkProxyPtr SOCKSNetworkProxy::resolveHost(ProtocolSupport protocol) const { assert(!_host.empty()); - return new SOCKSNetworkProxy(getAddresses(_host, _port, protocol, Ice::Random, false, true)[0]); + return new SOCKSNetworkProxy(getAddresses(_host, _port, protocol, Ice::ICE_ENUM(EndpointSelectionType, Random), false, true)[0]); } Address @@ -272,7 +272,7 @@ NetworkProxyPtr HTTPNetworkProxy::resolveHost(ProtocolSupport protocol) const { assert(!_host.empty()); - return new HTTPNetworkProxy(getAddresses(_host, _port, protocol, Ice::Random, false, true)[0], protocol); + return new HTTPNetworkProxy(getAddresses(_host, _port, protocol, Ice::ICE_ENUM(EndpointSelectionType, Random), false, true)[0], protocol); } Address diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp index 2be3b400dcb..54aca2386f7 100644 --- a/cpp/src/Ice/OpaqueEndpointI.cpp +++ b/cpp/src/Ice/OpaqueEndpointI.cpp @@ -100,7 +100,7 @@ OpaqueEndpointInfoI::OpaqueEndpointInfoI(Ice::Short type, const Ice::EncodingVer void IceInternal::OpaqueEndpointI::streamWrite(OutputStream* s) const { - s->startEncapsulation(_rawEncoding, DefaultFormat); + s->startEncapsulation(_rawEncoding, ICE_ENUM(FormatType, DefaultFormat)); s->writeBlob(_rawBytes); s->endEncapsulation(); } diff --git a/cpp/src/Ice/OutputStream.cpp b/cpp/src/Ice/OutputStream.cpp index 4c80fe57604..fe931ecebc3 100644 --- a/cpp/src/Ice/OutputStream.cpp +++ b/cpp/src/Ice/OutputStream.cpp @@ -76,7 +76,7 @@ Ice::OutputStream::OutputStream() : _instance(0), _closure(0), _encoding(currentEncoding), - _format(CompactFormat), + _format(ICE_ENUM(FormatType, CompactFormat)), _currentEncaps(0) { } @@ -216,7 +216,7 @@ Ice::OutputStream::startEncapsulation() } else { - startEncapsulation(_encoding, Ice::DefaultFormat); + startEncapsulation(_encoding, Ice::ICE_ENUM(FormatType, DefaultFormat)); } } @@ -898,7 +898,7 @@ Ice::OutputStream::initEncaps() _currentEncaps->encoding = _encoding; } - if(_currentEncaps->format == Ice::DefaultFormat) + if(_currentEncaps->format == Ice::ICE_ENUM(FormatType, DefaultFormat)) { _currentEncaps->format = _format; } @@ -1120,7 +1120,7 @@ Ice::OutputStream::EncapsEncoder11::write(const ValuePtr& v) { _stream->writeSize(0); // Nil reference. } - else if(_current && _encaps->format == SlicedFormat) + else if(_current && _encaps->format == ICE_ENUM(FormatType, SlicedFormat)) { // // If writing an instance within a slice and using the sliced @@ -1188,7 +1188,7 @@ Ice::OutputStream::EncapsEncoder11::startSlice(const string& typeId, int compact _current->sliceFlagsPos = _stream->b.size(); _current->sliceFlags = 0; - if(_encaps->format == SlicedFormat) + if(_encaps->format == ICE_ENUM(FormatType, SlicedFormat)) { _current->sliceFlags |= FLAG_HAS_SLICE_SIZE; // Encode the slice size if using the sliced format. } @@ -1210,7 +1210,7 @@ Ice::OutputStream::EncapsEncoder11::startSlice(const string& typeId, int compact // Encode the type ID (only in the first slice for the compact // encoding). // - if(_encaps->format == SlicedFormat || _current->firstSlice) + if(_encaps->format == ICE_ENUM(FormatType, SlicedFormat) || _current->firstSlice) { if(compactId >= 0) { @@ -1275,7 +1275,7 @@ Ice::OutputStream::EncapsEncoder11::endSlice() // if(!_current->indirectionTable.empty()) { - assert(_encaps->format == SlicedFormat); + assert(_encaps->format == ICE_ENUM(FormatType, SlicedFormat)); _current->sliceFlags |= FLAG_HAS_INDIRECTION_TABLE; // @@ -1330,7 +1330,7 @@ Ice::OutputStream::EncapsEncoder11::writeSlicedData(const SlicedDataPtr& slicedD // essentially "slices" the instance into the most-derived type // known by the sender. // - if(_encaps->format != SlicedFormat) + if(_encaps->format != ICE_ENUM(FormatType, SlicedFormat)) { return; } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 2535c05c1e4..ab75dced077 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -161,7 +161,7 @@ Ice::ObjectPrx::_iceI_isA(const shared_ptr<IceInternal::OutgoingAsyncT<bool>>& o const Context& ctx) { _checkTwowayOnly(ice_isA_name); - outAsync->invoke(ice_isA_name, OperationMode::Nonmutating, DefaultFormat, ctx, + outAsync->invoke(ice_isA_name, OperationMode::Nonmutating, ICE_ENUM(FormatType, DefaultFormat), ctx, [&](Ice::OutputStream* os) { os->write(typeId, false); @@ -172,14 +172,14 @@ Ice::ObjectPrx::_iceI_isA(const shared_ptr<IceInternal::OutgoingAsyncT<bool>>& o void Ice::ObjectPrx::_iceI_ping(const shared_ptr<IceInternal::OutgoingAsyncT<void>>& outAsync, const Context& ctx) { - outAsync->invoke(ice_ping_name, OperationMode::Nonmutating, DefaultFormat, ctx, nullptr, nullptr); + outAsync->invoke(ice_ping_name, OperationMode::Nonmutating, ICE_ENUM(FormatType, DefaultFormat), ctx, nullptr, nullptr); } void Ice::ObjectPrx::_iceI_ids(const shared_ptr<IceInternal::OutgoingAsyncT<vector<string>>>& outAsync, const Context& ctx) { _checkTwowayOnly(ice_ids_name); - outAsync->invoke(ice_ids_name, OperationMode::Nonmutating, DefaultFormat, ctx, nullptr, nullptr, + outAsync->invoke(ice_ids_name, OperationMode::Nonmutating, ICE_ENUM(FormatType, DefaultFormat), ctx, nullptr, nullptr, [](Ice::InputStream* stream) { vector<string> v; @@ -192,7 +192,7 @@ void Ice::ObjectPrx::_iceI_id(const shared_ptr<IceInternal::OutgoingAsyncT<string>>& outAsync, const Context& ctx) { _checkTwowayOnly(ice_id_name); - outAsync->invoke(ice_id_name, OperationMode::Nonmutating, DefaultFormat, ctx, nullptr, nullptr, + outAsync->invoke(ice_id_name, OperationMode::Nonmutating, ICE_ENUM(FormatType, DefaultFormat), ctx, nullptr, nullptr, [](Ice::InputStream* stream) { string v; @@ -292,7 +292,7 @@ IceProxy::Ice::Object::_iceI_begin_ice_isA(const string& typeId, try { result->prepare(ice_isA_name, Nonmutating, ctx); - ::Ice::OutputStream* ostr = result->startWriteParams(DefaultFormat); + ::Ice::OutputStream* ostr = result->startWriteParams(ICE_ENUM(FormatType, DefaultFormat)); ostr->write(typeId, false); result->endWriteParams(); result->invoke(ice_isA_name); diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index b222b506352..99bcdcdf030 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -643,7 +643,7 @@ IceInternal::FixedReference::getPreferSecure() const Ice::EndpointSelectionType IceInternal::FixedReference::getEndpointSelection() const { - return Random; + return ICE_ENUM(EndpointSelectionType, Random); } int @@ -1262,7 +1262,7 @@ IceInternal::RoutableReference::toProperty(const string& prefix) const properties[prefix + ".CollocationOptimized"] = _collocationOptimized ? "1" : "0"; properties[prefix + ".ConnectionCached"] = _cacheConnection ? "1" : "0"; properties[prefix + ".PreferSecure"] = _preferSecure ? "1" : "0"; - properties[prefix + ".EndpointSelection"] = _endpointSelection == Random ? "Random" : "Ordered"; + properties[prefix + ".EndpointSelection"] = _endpointSelection == ICE_ENUM(EndpointSelectionType, Random) ? "Random" : "Ordered"; { ostringstream s; s << _locatorCacheTimeout; @@ -1916,13 +1916,13 @@ IceInternal::RoutableReference::filterEndpoints(const vector<EndpointIPtr>& allE // switch(getEndpointSelection()) { - case Random: + case ICE_ENUM(EndpointSelectionType, Random): { RandomNumberGenerator rng; random_shuffle(endpoints.begin(), endpoints.end(), rng); break; } - case Ordered: + case ICE_ENUM(EndpointSelectionType, Ordered): { // Nothing to do. break; diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index d4198699609..a73f3e52b33 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -857,11 +857,11 @@ IceInternal::ReferenceFactory::create(const Identity& ident, string type = properties->getProperty(property); if(type == "Random") { - endpointSelection = Random; + endpointSelection = ICE_ENUM(EndpointSelectionType, Random); } else if(type == "Ordered") { - endpointSelection = Ordered; + endpointSelection = ICE_ENUM(EndpointSelectionType, Ordered); } else { diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 8294b7c272a..d79a0900293 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -703,7 +703,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) current._handler = ICE_GET_SHARED_FROM_THIS(_nextHandler->first); current.operation = _nextHandler->second; ++_nextHandler; - thread->setState(ThreadStateInUseForIO); + thread->setState(ICE_ENUM(ThreadState, ThreadStateInUseForIO)); } else { @@ -727,7 +727,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) _handlers.clear(); _selector.startSelect(); select = true; - thread->setState(ThreadStateIdle); + thread->setState(ICE_ENUM(ThreadState, ThreadStateIdle)); } } else if(_sizeMax > 1) @@ -822,7 +822,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - thread->setState(ThreadStateInUseForIO); + thread->setState(ICE_ENUM(ThreadState, ThreadStateInUseForIO)); } try @@ -865,7 +865,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) assert(_inUse > 0); --_inUse; } - thread->setState(ThreadStateIdle); + thread->setState(ICE_ENUM(ThreadState, ThreadStateIdle)); } } #endif @@ -878,7 +878,7 @@ IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current) current._ioCompleted = true; // Set the IO completed flag to specifiy that ioCompleted() has been called. - current._thread->setState(ThreadStateInUseForUser); + current._thread->setState(ICE_ENUM(ThreadState, ThreadStateInUseForUser)); if(_sizeMax > 1) { @@ -1078,7 +1078,7 @@ IceInternal::ThreadPool::followerWait(ThreadPoolCurrent& current) { assert(!current._leader); - current._thread->setState(ThreadStateIdle); + current._thread->setState(ICE_ENUM(ThreadState, ThreadStateIdle)); // // It's important to clear the handler before waiting to make sure that @@ -1135,7 +1135,7 @@ IceInternal::ThreadPool::nextThreadId() IceInternal::ThreadPool::EventHandlerThread::EventHandlerThread(const ThreadPoolPtr& pool, const string& name) : IceUtil::Thread(name), _pool(pool), - _state(Ice::Instrumentation::ThreadStateIdle) + _state(ICE_ENUM(ThreadState, ThreadStateIdle)) { updateObserver(); } diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp index 6d042c73f45..f37bbf30ce5 100644 --- a/cpp/src/IceGrid/Client.cpp +++ b/cpp/src/IceGrid/Client.cpp @@ -872,7 +872,7 @@ Client::run(StringSeq& originalArgs) if(acmTimeout > 0) { - session->ice_getConnection()->setACM(acmTimeout, IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(acmTimeout, IceUtil::None, ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); } else if(sessionTimeout > 0) { diff --git a/cpp/src/IceGrid/SessionManager.cpp b/cpp/src/IceGrid/SessionManager.cpp index 57ded43015f..c9b371000ff 100644 --- a/cpp/src/IceGrid/SessionManager.cpp +++ b/cpp/src/IceGrid/SessionManager.cpp @@ -58,7 +58,7 @@ SessionManager::findAllQueryObjects(bool cached) { try { - connection->close(Ice::CloseGracefullyAndWait); + connection->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } catch(const Ice::LocalException&) { diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 8b3219bf0fd..fd61a1272b7 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -1112,23 +1112,23 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList& string Slice::operationModeToString(Operation::Mode mode, bool cpp11) { + string prefix = cpp11 ? "::Ice::OperationMode::" : "::Ice::"; switch(mode) { case Operation::Normal: { - return cpp11 ? "::Ice::OperationMode::Normal" : "::Ice::Normal"; + return prefix + "Normal"; } case Operation::Nonmutating: { - return cpp11 ? "::Ice::OperationMode::Nonmutating" : "::Ice::Nonmutating"; + return prefix + "Nonmutating"; } case Operation::Idempotent: { - return cpp11 ? "::Ice::OperationMode::Idempotent" : "::Ice::Idempotent"; + return prefix + "Idempotent"; } - default: { assert(false); @@ -1139,16 +1139,18 @@ Slice::operationModeToString(Operation::Mode mode, bool cpp11) } string -Slice::opFormatTypeToString(const OperationPtr& op) +Slice::opFormatTypeToString(const OperationPtr& op, bool cpp11) { + string prefix = cpp11 ? "::Ice::FormatType::" : "::Ice::"; + switch(op->format()) { case DefaultFormat: - return "::Ice::DefaultFormat"; + return prefix + "DefaultFormat"; case CompactFormat: - return "::Ice::CompactFormat"; + return prefix + "CompactFormat"; case SlicedFormat: - return "::Ice::SlicedFormat"; + return prefix + "SlicedFormat"; default: assert(false); diff --git a/cpp/src/Slice/CPlusPlusUtil.h b/cpp/src/Slice/CPlusPlusUtil.h index 61690026d1f..a57b33c9e68 100644 --- a/cpp/src/Slice/CPlusPlusUtil.h +++ b/cpp/src/Slice/CPlusPlusUtil.h @@ -43,7 +43,7 @@ std::string returnTypeToString(const TypePtr&, bool, const StringList& = StringL std::string inputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0); std::string outputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0); std::string operationModeToString(Operation::Mode, bool = false); -std::string opFormatTypeToString(const OperationPtr&); +std::string opFormatTypeToString(const OperationPtr&, bool); std::string fixKwd(const std::string&); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index f33bfcb7896..7845b53633c 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2033,7 +2033,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) } else { - C << nl << "::Ice::OutputStream* ostr = result->startWriteParams(" << opFormatTypeToString(p) <<");"; + C << nl << "::Ice::OutputStream* ostr = result->startWriteParams(" << opFormatTypeToString(p, false) <<");"; writeMarshalCode(C, inParams, 0, true, TypeContextInParam); if(p->sendsClasses(false)) { @@ -3057,7 +3057,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) } if(p->format() != DefaultFormat) { - C << nl << "inS.setFormat(" << opFormatTypeToString(p) << ");"; + C << nl << "inS.setFormat(" << opFormatTypeToString(p, false) << ");"; } if(!amd) @@ -6107,7 +6107,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p) C << sp; C << nl << "outAsync->invoke(" << flatName << ", "; - C << operationModeToString(p->sendMode(), true) << ", " << opFormatTypeToString(p) << ", context, "; + C << operationModeToString(p->sendMode(), true) << ", " << opFormatTypeToString(p, true) << ", context, "; C.inc(); C << nl; @@ -6178,7 +6178,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << "_checkTwowayOnly(" << flatName << ");"; } C << nl << "outAsync->invoke(" << flatName << ", "; - C << operationModeToString(p->sendMode(), true) << ", " << opFormatTypeToString(p) << ", context, "; + C << operationModeToString(p->sendMode(), true) << ", " << opFormatTypeToString(p, true) << ", context, "; C.inc(); C << nl; @@ -7042,7 +7042,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p) C << nl << "MarshaledResult(current)"; C.dec(); C << sb; - C << nl << "ostr->startEncapsulation(current.encoding, " << opFormatTypeToString(p) << ");"; + C << nl << "ostr->startEncapsulation(current.encoding, " << opFormatTypeToString(p, true) << ");"; writeMarshalCode(C, outParams, p, true, TypeContextCpp11, "ostr"); if(p->returnsClasses(false)) { @@ -7085,7 +7085,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p) } if(p->format() != DefaultFormat) { - C << nl << "inS.setFormat(" << opFormatTypeToString(p) << ");"; + C << nl << "inS.setFormat(" << opFormatTypeToString(p, true) << ");"; } if(!amd) diff --git a/cpp/test/Ice/acm/AllTests.cpp b/cpp/test/Ice/acm/AllTests.cpp index 8e6563ede85..73356220f55 100644 --- a/cpp/test/Ice/acm/AllTests.cpp +++ b/cpp/test/Ice/acm/AllTests.cpp @@ -575,20 +575,21 @@ public: Ice::ACM acm; acm = proxy->ice_getCachedConnection()->getACM(); test(acm.timeout == 15); - test(acm.close == Ice::CloseOnIdleForceful); - test(acm.heartbeat == Ice::HeartbeatOff); + test(acm.close == Ice::ICE_ENUM(ACMClose, CloseOnIdleForceful)); + test(acm.heartbeat == Ice::ICE_ENUM(ACMHeartbeat, HeartbeatOff)); proxy->ice_getCachedConnection()->setACM(IceUtil::None, IceUtil::None, IceUtil::None); acm = proxy->ice_getCachedConnection()->getACM(); test(acm.timeout == 15); - test(acm.close == Ice::CloseOnIdleForceful); - test(acm.heartbeat == Ice::HeartbeatOff); + test(acm.close == Ice::ICE_ENUM(ACMClose, CloseOnIdleForceful)); + test(acm.heartbeat == Ice::ICE_ENUM(ACMHeartbeat, HeartbeatOff)); - proxy->ice_getCachedConnection()->setACM(1, Ice::CloseOnInvocationAndIdle, Ice::HeartbeatAlways); + proxy->ice_getCachedConnection()->setACM(1, Ice::ICE_ENUM(ACMClose, CloseOnInvocationAndIdle), + Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); acm = proxy->ice_getCachedConnection()->getACM(); test(acm.timeout == 1); - test(acm.close == Ice::CloseOnInvocationAndIdle); - test(acm.heartbeat == Ice::HeartbeatAlways); + test(acm.close == Ice::ICE_ENUM(ACMClose, CloseOnInvocationAndIdle)); + test(acm.heartbeat == Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); // Make sure the client sends a few heartbeats to the server. proxy->startHeartbeatCount(); diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index d285f0498ab..1bea36d06d0 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -1865,7 +1865,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(p->opBatchCount() == 0); auto b1 = p->ice_batchOneway(); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); auto id = this_thread::get_id(); promise<void> promise; @@ -1941,7 +1941,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) auto b1 = Ice::uncheckedCast<Test::TestIntfPrx>( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); promise<void> promise; b1->ice_getConnection()->flushBatchRequestsAsync( @@ -2021,7 +2021,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) auto b1 = Ice::uncheckedCast<Test::TestIntfPrx>( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); promise<void> promise; auto id = this_thread::get_id(); @@ -2093,8 +2093,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b2->ice_getConnection(); // Ensure connection is established. b1->opBatch(); b2->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); - b2->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); + b2->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); promise<void> promise; auto id = this_thread::get_id(); @@ -2198,7 +2198,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) [s](exception_ptr ex) { s->set_exception(ex); }); results.push_back(s->get_future()); } - p->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + p->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(vector<future<void>>::iterator p = results.begin(); p != results.end(); ++p) { try @@ -3100,7 +3100,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(p->opBatchCount() == 0); Test::TestIntfPrx b1 = p->ice_batchOneway(); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); Ice::AsyncResultPtr r = b1->begin_ice_flushBatchRequests( Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); @@ -3118,7 +3118,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(p->opBatchCount() == 0); Test::TestIntfPrx b1 = p->ice_batchOneway(); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(cookie); b1->begin_ice_flushBatchRequests( Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync), cookie); @@ -3169,7 +3169,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(p->opBatchCount() == 0); Test::TestIntfPrx b1 = p->ice_batchOneway(); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); Ice::AsyncResultPtr r = b1->begin_ice_flushBatchRequests( Ice::newCallback_Object_ice_flushBatchRequests(cb, &FlushCallback::exception, @@ -3187,7 +3187,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(p->opBatchCount() == 0); Test::TestIntfPrx b1 = p->ice_batchOneway(); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(cookie); b1->begin_ice_flushBatchRequests( Ice::newCallback_Object_ice_flushBatchRequests(cb, &FlushCallback::exceptionWC, @@ -3215,7 +3215,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); cb->check(); test(r->isSent()); @@ -3224,7 +3224,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) // Ensure it also works with a twoway proxy cb = new FlushCallback(); - r = p->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + r = p->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); cb->check(); test(r->isSent()); @@ -3241,7 +3241,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(cookie); - b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync), cookie); cb->check(); test(p->waitForBatch(2)); @@ -3256,9 +3256,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushExCallbackPtr cb = new FlushExCallback(); - Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushExCallback::completedAsync, &FlushExCallback::sentAsync)); cb->check(); test(!r->isSent()); @@ -3275,9 +3275,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushExCallbackPtr cb = new FlushExCallback(cookie); - b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushExCallback::completedAsync, &FlushExCallback::sentAsync), cookie); cb->check(); test(p->opBatchCount() == 0); @@ -3293,7 +3293,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Connection_flushBatchRequests(cb, &FlushCallback::exception, &FlushCallback::sent)); cb->check(); test(r->isSent()); @@ -3311,7 +3311,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(cookie); - b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Connection_flushBatchRequests(cb, &FlushCallback::exceptionWC, &FlushCallback::sentWC), cookie); cb->check(); @@ -3327,9 +3327,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushExCallbackPtr cb = new FlushExCallback(); - Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Connection_flushBatchRequests(cb, &FlushExCallback::exception, &FlushExCallback::sent)); cb->check(); @@ -3347,9 +3347,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushExCallbackPtr cb = new FlushExCallback(cookie); - b1->ice_getConnection()->begin_flushBatchRequests(Ice::BasedOnProxy, + b1->ice_getConnection()->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Connection_flushBatchRequests(cb, &FlushExCallback::exceptionWC, &FlushExCallback::sentWC), cookie); cb->check(); @@ -3372,7 +3372,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); cb->check(); test(r->isSent()); @@ -3390,7 +3390,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(cookie); - communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync), cookie); cb->check(); test(p->waitForBatch(2)); @@ -3405,9 +3405,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); cb->check(); test(r->isSent()); // Exceptions are ignored! @@ -3424,9 +3424,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(cookie); - communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync), cookie); cb->check(); test(p->opBatchCount() == 0); @@ -3449,7 +3449,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b2->opBatch(); b2->opBatch(); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); cb->check(); test(r->isSent()); @@ -3475,9 +3475,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b2->ice_getConnection(); // Ensure connection is established. b1->opBatch(); b2->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); cb->check(); test(r->isSent()); // Exceptions are ignored! @@ -3502,10 +3502,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b2->ice_getConnection(); // Ensure connection is established. b1->opBatch(); b2->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); - b2->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); + b2->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback(cb, &FlushCallback::completedAsync, &FlushCallback::sentAsync)); cb->check(); test(r->isSent()); // Exceptions are ignored! @@ -3523,7 +3523,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception, &FlushCallback::sent)); cb->check(); @@ -3542,7 +3542,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b1->opBatch(); b1->opBatch(); FlushCallbackPtr cb = new FlushCallback(cookie); - communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exceptionWC, &FlushCallback::sentWC), cookie); cb->check(); @@ -3558,9 +3558,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception, &FlushCallback::sent)); cb->check(); @@ -3578,9 +3578,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Test::TestIntfPrx b1 = Test::TestIntfPrx::uncheckedCast( p->ice_getConnection()->createProxy(p->ice_getIdentity())->ice_batchOneway()); b1->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(cookie); - communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exceptionWC, &FlushCallback::sentWC), cookie); cb->check(); @@ -3605,7 +3605,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b2->opBatch(); b2->opBatch(); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception, &FlushCallback::sent)); cb->check(); @@ -3632,9 +3632,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b2->ice_getConnection(); // Ensure connection is established. b1->opBatch(); b2->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception, &FlushCallback::sent)); cb->check(); @@ -3660,10 +3660,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) b2->ice_getConnection(); // Ensure connection is established. b1->opBatch(); b2->opBatch(); - b1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); - b2->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + b1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); + b2->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); FlushCallbackPtr cb = new FlushCallback(); - Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy, + Ice::AsyncResultPtr r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy), Ice::newCallback_Communicator_flushBatchRequests(cb, &FlushCallback::exception, &FlushCallback::sent)); cb->check(); @@ -3782,7 +3782,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Ice::ConnectionPtr con = p->ice_getConnection(); p2 = p->ice_batchOneway(); p2->ice_ping(); - r = con->begin_flushBatchRequests(Ice::BasedOnProxy); + r = con->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy)); test(r->getConnection() == con); test(r->getCommunicator() == communicator); test(!r->getProxy()); // Expected @@ -3793,7 +3793,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) // p2 = p->ice_batchOneway(); p2->ice_ping(); - r = communicator->begin_flushBatchRequests(Ice::BasedOnProxy); + r = communicator->begin_flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy)); test(!r->getConnection()); // Expected test(r->getCommunicator() == communicator); test(!r->getProxy()); // Expected @@ -3882,7 +3882,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { results.push_back(p->begin_sleep(50)); } - p->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + p->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(vector<Ice::AsyncResultPtr>::const_iterator q = results.begin(); q != results.end(); ++q) { (*q)->waitForCompleted(); @@ -3972,7 +3972,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) p->ice_ping(); Ice::ConnectionPtr con = p->ice_getConnection(); Ice::AsyncResultPtr r = p->begin_sleep(100); - con->close(Ice::CloseGracefully); + con->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefully)); r->waitForCompleted(); try { @@ -4020,7 +4020,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) p->ice_ping(); Ice::ConnectionPtr con = p->ice_getConnection(); Ice::AsyncResultPtr r = p->begin_sleep(100); - con->close(Ice::CloseForcefully); + con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); r->waitForCompleted(); try { diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 4d6b82904d6..5654d66ec02 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -379,7 +379,7 @@ allTests(const Ice::CommunicatorPtr& communicator) #ifdef ICE_CPP11_MAPPING background->opAsync(); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); background->opAsync(); vector<future<void>> results; @@ -407,7 +407,7 @@ allTests(const Ice::CommunicatorPtr& communicator) } #else background->begin_op(); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); background->begin_op(); vector<Ice::AsyncResultPtr> results; @@ -452,7 +452,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr { test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); int i; for(i = 0; i < 4; ++i) @@ -560,7 +560,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr } configuration->connectException(new Ice::SocketException(__FILE__, __LINE__)); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10)); configuration->connectException(0); try @@ -592,7 +592,7 @@ initializeTests(const ConfigurationPtr& configuration, { test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); int i; for(i = 0; i < 4; i++) @@ -682,7 +682,7 @@ initializeTests(const ConfigurationPtr& configuration, cerr << ex << endl; test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); try { @@ -695,7 +695,7 @@ initializeTests(const ConfigurationPtr& configuration, cerr << ex << endl; test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); #endif // @@ -728,7 +728,7 @@ initializeTests(const ConfigurationPtr& configuration, { test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); try { @@ -764,7 +764,7 @@ initializeTests(const ConfigurationPtr& configuration, } configuration->initializeException(new Ice::SocketException(__FILE__, __LINE__)); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10)); configuration->initializeException(0); try @@ -784,12 +784,12 @@ initializeTests(const ConfigurationPtr& configuration, } configuration->initializeSocketOperation(IceInternal::SocketOperationWrite); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); background->ice_ping(); configuration->initializeSocketOperation(IceInternal::SocketOperationNone); ctl->initializeException(true); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10)); ctl->initializeException(false); try @@ -812,11 +812,11 @@ initializeTests(const ConfigurationPtr& configuration, { #if !defined(ICE_USE_IOCP) && !defined(ICE_USE_CFSTREAM) ctl->initializeSocketOperation(IceInternal::SocketOperationWrite); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); background->op(); ctl->initializeSocketOperation(IceInternal::SocketOperationNone); #else - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); background->op(); #endif } @@ -847,7 +847,7 @@ validationTests(const ConfigurationPtr& configuration, { test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); try { @@ -921,7 +921,7 @@ validationTests(const ConfigurationPtr& configuration, cerr << ex << endl; test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); try { @@ -1081,7 +1081,7 @@ validationTests(const ConfigurationPtr& configuration, cerr << ex << endl; test(false); } - background->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + background->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); try { @@ -1163,7 +1163,7 @@ validationTests(const ConfigurationPtr& configuration, #else backgroundBatchOneway->begin_ice_flushBatchRequests(); #endif - backgroundBatchOneway->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); ctl->holdAdapter(); backgroundBatchOneway->opWithPayload(seq); @@ -1183,10 +1183,10 @@ validationTests(const ConfigurationPtr& configuration, // in the flush to report a CloseConnectionException). Instead we // wait for the first flush to complete. // - //backgroundBatchOneway->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + //backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); backgroundBatchOneway->end_ice_flushBatchRequests(r); #endif - backgroundBatchOneway->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + backgroundBatchOneway->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } void @@ -1775,10 +1775,10 @@ readWriteTests(const ConfigurationPtr& configuration, IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10)); background->ice_ping(); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10)); - background->ice_getCachedConnection()->close(Ice::CloseForcefully); + background->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); } thread1->destroy(); diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index 26e7fa48aa6..511d186a205 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -170,7 +170,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(test2->ice_getConnection() == test3->ice_getConnection()); names.erase(test1->getAdapterName()); - test1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } // @@ -192,7 +192,7 @@ allTests(const Ice::CommunicatorPtr& communicator) for(vector<RemoteObjectAdapterPrxPtr>::const_iterator q = adapters.begin(); q != adapters.end(); ++q) { - (*q)->getTestIntf()->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + (*q)->getTestIntf()->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } } @@ -217,7 +217,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(test2->ice_getConnection() == test3->ice_getConnection()); names.erase(test1->getAdapterName()); - test1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } // @@ -314,7 +314,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { try { - (*q)->getTestIntf()->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + (*q)->getTestIntf()->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } catch(const Ice::LocalException&) { @@ -354,7 +354,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(test2->ice_getConnection() == test3->ice_getConnection()); names.erase(getAdapterNameWithAMI(test1)); - test1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } // @@ -376,7 +376,7 @@ allTests(const Ice::CommunicatorPtr& communicator) for(vector<RemoteObjectAdapterPrxPtr>::const_iterator q = adapters.begin(); q != adapters.end(); ++q) { - (*q)->getTestIntf()->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + (*q)->getTestIntf()->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } } @@ -401,7 +401,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(test2->ice_getConnection() == test3->ice_getConnection()); names.erase(test1->getAdapterName()); - test1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } // @@ -424,7 +424,7 @@ allTests(const Ice::CommunicatorPtr& communicator) adapters.push_back(com->createObjectAdapter("Adapter23", "default")); TestIntfPrxPtr test = createTestIntfPrx(adapters); - test(test->ice_getEndpointSelection() == Ice::Random); + test(test->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Random)); set<string> names; names.insert("Adapter21"); @@ -433,11 +433,11 @@ allTests(const Ice::CommunicatorPtr& communicator) while(!names.empty()) { names.erase(test->getAdapterName()); - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } - test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::Random)); - test(test->ice_getEndpointSelection() == Ice::Random); + test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random))); + test(test->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Random)); names.insert("Adapter21"); names.insert("Adapter22"); @@ -445,7 +445,7 @@ allTests(const Ice::CommunicatorPtr& communicator) while(!names.empty()) { names.erase(test->getAdapterName()); - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } deactivate(com, adapters); @@ -460,8 +460,8 @@ allTests(const Ice::CommunicatorPtr& communicator) adapters.push_back(com->createObjectAdapter("Adapter33", "default")); TestIntfPrxPtr test = createTestIntfPrx(adapters); - test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::Ordered)); - test(test->ice_getEndpointSelection() == Ice::Ordered); + test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered))); + test(test->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Ordered)); const int nRetry = 5; int i; @@ -473,7 +473,7 @@ allTests(const Ice::CommunicatorPtr& communicator) #if TARGET_OS_IPHONE > 0 if(i != nRetry) { - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter31"; i++); } #endif @@ -483,7 +483,7 @@ allTests(const Ice::CommunicatorPtr& communicator) #if TARGET_OS_IPHONE > 0 if(i != nRetry) { - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter32"; i++); } #endif @@ -493,7 +493,7 @@ allTests(const Ice::CommunicatorPtr& communicator) #if TARGET_OS_IPHONE > 0 if(i != nRetry) { - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter33"; i++); } #endif @@ -525,29 +525,29 @@ allTests(const Ice::CommunicatorPtr& communicator) #if TARGET_OS_IPHONE > 0 if(i != nRetry) { - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter36"; i++); } #endif test(i == nRetry); - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); adapters.push_back(com->createObjectAdapter("Adapter35", endpoints[1]->toString())); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter35"; i++); #if TARGET_OS_IPHONE > 0 if(i != nRetry) { - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter35"; i++); } #endif test(i == nRetry); - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); adapters.push_back(com->createObjectAdapter("Adapter34", endpoints[0]->toString())); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter34"; i++); #if TARGET_OS_IPHONE > 0 if(i != nRetry) { - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); for(i = 0; i < nRetry && test->getAdapterName() == "Adapter34"; i++); } #endif @@ -669,8 +669,8 @@ allTests(const Ice::CommunicatorPtr& communicator) adapters.push_back(com->createObjectAdapter("Adapter63", "default")); TestIntfPrxPtr test = createTestIntfPrx(adapters); - test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::Ordered)); - test(test->ice_getEndpointSelection() == Ice::Ordered); + test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered))); + test(test->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Ordered)); test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_connectionCached(false)); test(!test->ice_isConnectionCached()); const int nRetry = 5; @@ -756,8 +756,8 @@ allTests(const Ice::CommunicatorPtr& communicator) adapters.push_back(com->createObjectAdapter("AdapterAMI63", "default")); TestIntfPrxPtr test = createTestIntfPrx(adapters); - test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::Ordered)); - test(test->ice_getEndpointSelection() == Ice::Ordered); + test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered))); + test(test->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Ordered)); test = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_connectionCached(false)); test(!test->ice_isConnectionCached()); const int nRetry = 5; @@ -865,7 +865,7 @@ allTests(const Ice::CommunicatorPtr& communicator) for(i = 0; i < 5; i++) { test(test->getAdapterName() == "Adapter82"); - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } TestIntfPrxPtr testSecure = ICE_UNCHECKED_CAST(TestIntfPrx, test->ice_secure(true)); @@ -881,7 +881,7 @@ allTests(const Ice::CommunicatorPtr& communicator) for(i = 0; i < 5; i++) { test(test->getAdapterName() == "Adapter81"); - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } com->createObjectAdapter("Adapter83", (test->ice_getEndpoints()[1])->toString()); // Reactive tcp OA. @@ -889,7 +889,7 @@ allTests(const Ice::CommunicatorPtr& communicator) for(i = 0; i < 5; i++) { test(test->getAdapterName() == "Adapter83"); - test->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } com->deactivateObjectAdapter(adapters[0]); @@ -1098,7 +1098,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // Close the connection now to free a FD (it could be done after the sleep but // there could be race condiutation since the connection might not be closed // immediately due to threading). - test->ice_connectionId("0")->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + test->ice_connectionId("0")->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); // // The server closed the acceptor, wait one second and retry after freeing a FD. diff --git a/cpp/test/Ice/gc/Client.cpp b/cpp/test/Ice/gc/Client.cpp index d433146ecec..2404021d198 100644 --- a/cpp/test/Ice/gc/Client.cpp +++ b/cpp/test/Ice/gc/Client.cpp @@ -155,7 +155,7 @@ public: }; MyApplication::MyApplication() - : Ice::Application(Ice::NoSignalHandling) + : Ice::Application(Ice::ICE_ENUM(SignalPolicy, NoSignalHandling)) { } diff --git a/cpp/test/Ice/hold/AllTests.cpp b/cpp/test/Ice/hold/AllTests.cpp index 7cb0e59a53c..36e65746c86 100644 --- a/cpp/test/Ice/hold/AllTests.cpp +++ b/cpp/test/Ice/hold/AllTests.cpp @@ -290,7 +290,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { completed->get_future().get(); holdSerialized->ice_ping(); // Ensure everything's dispatched - holdSerialized->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + holdSerialized->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } } completed->get_future().get(); @@ -305,7 +305,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { result->waitForSent(); holdSerialized->ice_ping(); // Ensure everything's dispatched - holdSerialized->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + holdSerialized->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } } result->waitForCompleted(); diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp index 4e96a75a0d5..f87e2c32d0e 100644 --- a/cpp/test/Ice/location/AllTests.cpp +++ b/cpp/test/Ice/location/AllTests.cpp @@ -637,7 +637,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const string& ref) cout << "testing object migration... " << flush; hello = ICE_CHECKED_CAST(HelloPrx, communicator->stringToProxy("hello")); obj->migrateHello(); - hello->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + hello->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); hello->sayHello(); obj->migrateHello(); hello->sayHello(); diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index 8d30231b520..d5933489ea8 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -287,7 +287,7 @@ struct Connect { if(proxy->ice_getCachedConnection()) { - proxy->ice_getCachedConnection()->close(Ice::CloseGracefullyAndWait); + proxy->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } try { @@ -298,7 +298,7 @@ struct Connect } if(proxy->ice_getCachedConnection()) { - proxy->ice_getCachedConnection()->close(Ice::CloseGracefullyAndWait); + proxy->ice_getCachedConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } } @@ -534,8 +534,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt if(!collocated) { - metrics->ice_getConnection()->close(Ice::CloseGracefullyAndWait); - metrics->ice_connectionId("Con1")->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); + metrics->ice_connectionId("Con1")->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); waitForCurrent(clientMetrics, "View", "Connection", 0); waitForCurrent(serverMetrics, "View", "Connection", 0); @@ -645,7 +645,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt map = toMap(serverMetrics->getMetricsView("View", timestamp)["Connection"]); test(map["holding"]->current == 1); - metrics->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]); test(map["closing"]->current == 1); @@ -660,7 +660,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "none"; updateProps(clientProps, serverProps, update.get(), props, "Connection"); - metrics->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); metrics->ice_timeout(500)->ice_ping(); controller->hold(); @@ -717,7 +717,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastHost", ""); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastPort", ""); - m->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + m->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); waitForCurrent(clientMetrics, "View", "Connection", 0); waitForCurrent(serverMetrics, "View", "Connection", 0); @@ -736,7 +736,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt IceMX::MetricsPtr m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0]; test(m1->current == 0 && m1->total == 1 && m1->id == hostAndPort); - metrics->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + metrics->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); controller->hold(); try { @@ -788,7 +788,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt try { prx->ice_ping(); - prx->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + prx->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); } catch(const Ice::LocalException&) { diff --git a/cpp/test/Ice/metrics/TestAMDI.cpp b/cpp/test/Ice/metrics/TestAMDI.cpp index d5173e4380b..37c8b310e0a 100644 --- a/cpp/test/Ice/metrics/TestAMDI.cpp +++ b/cpp/test/Ice/metrics/TestAMDI.cpp @@ -22,7 +22,7 @@ MetricsI::opAsync(function<void()> response, function<void(exception_ptr)>, cons void MetricsI::failAsync(function<void()> response, function<void(exception_ptr)>, const Ice::Current& current) { - current.con->close(Ice::CloseForcefully); + current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); response(); } @@ -87,7 +87,7 @@ MetricsI::op_async(const Test::AMD_Metrics_opPtr& cb, const Ice::Current&) void MetricsI::fail_async(const Test::AMD_Metrics_failPtr& cb, const Ice::Current& current) { - current.con->close(Ice::CloseForcefully); + current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); cb->ice_response(); } diff --git a/cpp/test/Ice/metrics/TestI.cpp b/cpp/test/Ice/metrics/TestI.cpp index 30f7a98bf35..739fc99d4ae 100644 --- a/cpp/test/Ice/metrics/TestI.cpp +++ b/cpp/test/Ice/metrics/TestI.cpp @@ -18,7 +18,7 @@ MetricsI::op(const Ice::Current&) void MetricsI::fail(const Ice::Current& current) { - current.con->close(Ice::CloseForcefully); + current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); } void diff --git a/cpp/test/Ice/objects/TestI.cpp b/cpp/test/Ice/objects/TestI.cpp index b46797912c3..a9c453ee104 100644 --- a/cpp/test/Ice/objects/TestI.cpp +++ b/cpp/test/Ice/objects/TestI.cpp @@ -315,7 +315,7 @@ UnexpectedObjectExceptionTestI::ice_invoke(const std::vector<Ice::Byte>&, { Ice::CommunicatorPtr communicator = current.adapter->getCommunicator(); Ice::OutputStream out(communicator); - out.startEncapsulation(current.encoding, Ice::DefaultFormat); + out.startEncapsulation(current.encoding, Ice::ICE_ENUM(FormatType, DefaultFormat)); AlsoEmptyPtr obj = ICE_MAKE_SHARED(AlsoEmpty); out.write(obj); out.writePendingValues(); diff --git a/cpp/test/Ice/operations/BatchOneways.cpp b/cpp/test/Ice/operations/BatchOneways.cpp index c7466821faa..47bcf2e87c0 100644 --- a/cpp/test/Ice/operations/BatchOneways.cpp +++ b/cpp/test/Ice/operations/BatchOneways.cpp @@ -91,9 +91,9 @@ batchOneways(const Test::MyClassPrxPtr& p) batch->ice_flushBatchRequests(); // Empty flush if(batch->ice_getConnection()) { - batch->ice_getConnection()->flushBatchRequests(Ice::BasedOnProxy); + batch->ice_getConnection()->flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy)); } - batch->ice_getCommunicator()->flushBatchRequests(Ice::BasedOnProxy); + batch->ice_getCommunicator()->flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy)); int i; p->opByteSOnewayCallCount(); // Reset the call count @@ -126,7 +126,7 @@ batchOneways(const Test::MyClassPrxPtr& p) batch1->ice_ping(); batch2->ice_ping(); batch1->ice_flushBatchRequests(); - batch1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); batch1->ice_ping(); batch2->ice_ping(); @@ -134,7 +134,7 @@ batchOneways(const Test::MyClassPrxPtr& p) batch2->ice_getConnection(); batch1->ice_ping(); - batch1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); batch1->ice_ping(); batch2->ice_ping(); } @@ -211,26 +211,26 @@ batchOneways(const Test::MyClassPrxPtr& p) batch1->opByteSOneway(bs1); batch1->opByteSOneway(bs1); batch1->opByteSOneway(bs1); - batch1->ice_getConnection()->flushBatchRequests(Ice::Yes); + batch1->ice_getConnection()->flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, Yes)); batch2->opByteSOneway(bs1); batch2->opByteSOneway(bs1); batch2->opByteSOneway(bs1); - batch1->ice_getConnection()->flushBatchRequests(Ice::No); + batch1->ice_getConnection()->flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, No)); batch1->opByteSOneway(bs1); batch1->opByteSOneway(bs1); batch1->opByteSOneway(bs1); - batch1->ice_getConnection()->flushBatchRequests(Ice::BasedOnProxy); + batch1->ice_getConnection()->flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy)); batch1->opByteSOneway(bs1); batch2->opByteSOneway(bs1); batch1->opByteSOneway(bs1); - batch1->ice_getConnection()->flushBatchRequests(Ice::BasedOnProxy); + batch1->ice_getConnection()->flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy)); batch1->opByteSOneway(bs1); batch3->opByteSOneway(bs1); batch1->opByteSOneway(bs1); - batch1->ice_getConnection()->flushBatchRequests(Ice::BasedOnProxy); + batch1->ice_getConnection()->flushBatchRequests(Ice::ICE_SCOPED_ENUM(CompressBatch, BasedOnProxy)); } } diff --git a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp index 4545d8581cf..92984de8b33 100644 --- a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp +++ b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp @@ -127,7 +127,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p) batch1->ice_pingAsync().get(); batch2->ice_pingAsync().get(); batch1->ice_flushBatchRequestsAsync().get(); - batch1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); batch1->ice_pingAsync().get(); batch2->ice_pingAsync().get(); @@ -135,7 +135,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p) batch2->ice_getConnection(); batch1->ice_pingAsync().get(); - batch1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); batch1->ice_pingAsync().get(); batch2->ice_pingAsync().get(); @@ -182,7 +182,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p) batch1->end_ice_ping(batch1->begin_ice_ping()); batch2->end_ice_ping(batch2->begin_ice_ping()); batch1->end_ice_flushBatchRequests(batch1->begin_ice_flushBatchRequests()); - batch1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); batch1->end_ice_ping(batch1->begin_ice_ping()); batch2->end_ice_ping(batch2->begin_ice_ping()); @@ -190,7 +190,7 @@ batchOnewaysAMI(const Test::MyClassPrxPtr& p) batch2->ice_getConnection(); batch1->end_ice_ping(batch1->begin_ice_ping()); - batch1->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + batch1->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); batch1->end_ice_ping(batch1->begin_ice_ping()); batch2->end_ice_ping(batch2->begin_ice_ping()); diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index bdb2a82b4da..0d9bf825474 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -477,13 +477,13 @@ allTests(const Ice::CommunicatorPtr& communicator) prop->setProperty(property, ""); property = propertyPrefix + ".EndpointSelection"; - test(b1->ice_getEndpointSelection() == Ice::Random); + test(b1->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Random)); prop->setProperty(property, "Random"); b1 = communicator->propertyToProxy(propertyPrefix); - test(b1->ice_getEndpointSelection() == Ice::Random); + test(b1->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Random)); prop->setProperty(property, "Ordered"); b1 = communicator->propertyToProxy(propertyPrefix); - test(b1->ice_getEndpointSelection() == Ice::Ordered); + test(b1->ice_getEndpointSelection() == Ice::ICE_ENUM(EndpointSelectionType, Ordered)); prop->setProperty(property, ""); property = propertyPrefix + ".CollocationOptimized"; @@ -516,7 +516,7 @@ allTests(const Ice::CommunicatorPtr& communicator) b1 = b1->ice_collocationOptimized(true); b1 = b1->ice_connectionCached(true); b1 = b1->ice_preferSecure(false); - b1 = b1->ice_endpointSelection(Ice::Ordered); + b1 = b1->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered)); b1 = b1->ice_locatorCacheTimeout(100); b1 = b1->ice_invocationTimeout(1234); Ice::EncodingVersion v = { 1, 0 }; @@ -525,7 +525,7 @@ allTests(const Ice::CommunicatorPtr& communicator) router = router->ice_collocationOptimized(false); router = router->ice_connectionCached(true); router = router->ice_preferSecure(true); - router = router->ice_endpointSelection(Ice::Random); + router = router->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)); router = router->ice_locatorCacheTimeout(200); router = router->ice_invocationTimeout(1500); @@ -533,7 +533,7 @@ allTests(const Ice::CommunicatorPtr& communicator) locator = locator->ice_collocationOptimized(true); locator = locator->ice_connectionCached(false); locator = locator->ice_preferSecure(true); - locator = locator->ice_endpointSelection(Ice::Random); + locator = locator->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)); locator = locator->ice_locatorCacheTimeout(300); locator = locator->ice_invocationTimeout(1500); @@ -714,10 +714,10 @@ allTests(const Ice::CommunicatorPtr& communicator) test(Ice::targetLess(compObj->ice_connectionCached(false), compObj->ice_connectionCached(true))); test(Ice::targetGreaterEqual(compObj->ice_connectionCached(true), compObj->ice_connectionCached(false))); - test(Ice::targetEqualTo(compObj->ice_endpointSelection(Ice::Random), compObj->ice_endpointSelection(Ice::Random))); - test(Ice::targetNotEqualTo(compObj->ice_endpointSelection(Ice::Random), compObj->ice_endpointSelection(Ice::Ordered))); - test(Ice::targetLess(compObj->ice_endpointSelection(Ice::Random), compObj->ice_endpointSelection(Ice::Ordered))); - test(Ice::targetGreaterEqual(compObj->ice_endpointSelection(Ice::Ordered), compObj->ice_endpointSelection(Ice::Random))); + test(Ice::targetEqualTo(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)), compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)))); + test(Ice::targetNotEqualTo(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)), compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered)))); + test(Ice::targetLess(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)), compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered)))); + test(Ice::targetGreaterEqual(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered)), compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)))); test(Ice::targetEqualTo(compObj->ice_connectionId("id2"), compObj->ice_connectionId("id2"))); test(Ice::targetNotEqualTo(compObj->ice_connectionId("id1"), compObj->ice_connectionId("id2"))); @@ -884,10 +884,10 @@ allTests(const Ice::CommunicatorPtr& communicator) test(compObj->ice_connectionCached(false) < compObj->ice_connectionCached(true)); test(!(compObj->ice_connectionCached(true) < compObj->ice_connectionCached(false))); - test(compObj->ice_endpointSelection(Ice::Random) == compObj->ice_endpointSelection(Ice::Random)); - test(compObj->ice_endpointSelection(Ice::Random) != compObj->ice_endpointSelection(Ice::Ordered)); - test(compObj->ice_endpointSelection(Ice::Random) < compObj->ice_endpointSelection(Ice::Ordered)); - test(!(compObj->ice_endpointSelection(Ice::Ordered) < compObj->ice_endpointSelection(Ice::Random))); + test(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)) == compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random))); + test(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)) != compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered))); + test(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)) < compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered))); + test(!(compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Ordered)) < compObj->ice_endpointSelection(Ice::ICE_ENUM(EndpointSelectionType, Random)))); test(compObj->ice_connectionId("id2") == compObj->ice_connectionId("id2")); test(compObj->ice_connectionId("id1") != compObj->ice_connectionId("id2")); diff --git a/cpp/test/Ice/retry/TestI.cpp b/cpp/test/Ice/retry/TestI.cpp index 7fd3c0d4dd4..24a8d60cc6a 100644 --- a/cpp/test/Ice/retry/TestI.cpp +++ b/cpp/test/Ice/retry/TestI.cpp @@ -22,7 +22,7 @@ RetryI::op(bool kill, const Ice::Current& current) { if(current.con) { - current.con->close(Ice::CloseForcefully); + current.con->close(Ice::ICE_ENUM(ConnectionClose, CloseForcefully)); } else { diff --git a/cpp/test/Ice/timeout/AllTests.cpp b/cpp/test/Ice/timeout/AllTests.cpp index 1947f4e9aa1..4c297bfe755 100644 --- a/cpp/test/Ice/timeout/AllTests.cpp +++ b/cpp/test/Ice/timeout/AllTests.cpp @@ -294,7 +294,7 @@ allTests(const Ice::CommunicatorPtr& communicator) TimeoutPrxPtr to = ICE_CHECKED_CAST(TimeoutPrx, obj->ice_timeout(250)); Ice::ConnectionPtr connection = to->ice_getConnection(); timeout->holdAdapter(600); - connection->close(Ice::CloseGracefullyAndWait); + connection->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); try { connection->getInfo(); // getInfo() doesn't throw in the closing state. diff --git a/cpp/test/Ice/udp/AllTests.cpp b/cpp/test/Ice/udp/AllTests.cpp index f16b10baa70..c72145cfd89 100644 --- a/cpp/test/Ice/udp/AllTests.cpp +++ b/cpp/test/Ice/udp/AllTests.cpp @@ -116,7 +116,7 @@ allTests(const CommunicatorPtr& communicator) { test(seq.size() > 16384); } - obj->ice_getConnection()->close(CloseGracefullyAndWait); + obj->ice_getConnection()->close(ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); communicator->getProperties()->setProperty("Ice.UDP.SndSize", "64000"); seq.resize(50000); try diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp index 8892c284746..3ae92ba6e95 100644 --- a/cpp/test/IceGrid/activation/AllTests.cpp +++ b/cpp/test/IceGrid/activation/AllTests.cpp @@ -94,7 +94,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(registry); IceGrid::AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); IceGrid::AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/allocation/AllTests.cpp b/cpp/test/IceGrid/allocation/AllTests.cpp index 0a86f1011f3..82b7131aa6e 100644 --- a/cpp/test/IceGrid/allocation/AllTests.cpp +++ b/cpp/test/IceGrid/allocation/AllTests.cpp @@ -276,7 +276,7 @@ allTests(const Ice::CommunicatorPtr& communicator) communicator->stringToProxy(communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry")); test(registry); AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/deployer/AllTests.cpp b/cpp/test/IceGrid/deployer/AllTests.cpp index d4cfa91c6bd..2743d90d259 100644 --- a/cpp/test/IceGrid/deployer/AllTests.cpp +++ b/cpp/test/IceGrid/deployer/AllTests.cpp @@ -388,7 +388,7 @@ allTests(const Ice::CommunicatorPtr& comm) AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/distribution/AllTests.cpp b/cpp/test/IceGrid/distribution/AllTests.cpp index 3e6a156c6ec..6ba6cbc4046 100644 --- a/cpp/test/IceGrid/distribution/AllTests.cpp +++ b/cpp/test/IceGrid/distribution/AllTests.cpp @@ -27,7 +27,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(registry); AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp b/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp index fd9dff8b957..5fc6487f886 100644 --- a/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp +++ b/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp @@ -156,7 +156,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(registry); AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/replicaGroup/AllTests.cpp b/cpp/test/IceGrid/replicaGroup/AllTests.cpp index 32b7be843e4..74046be4f50 100644 --- a/cpp/test/IceGrid/replicaGroup/AllTests.cpp +++ b/cpp/test/IceGrid/replicaGroup/AllTests.cpp @@ -112,7 +112,7 @@ allTests(const Ice::CommunicatorPtr& comm) test(query); AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/replication/AllTests.cpp b/cpp/test/IceGrid/replication/AllTests.cpp index b6165fda4c9..5cf96d7b8ea 100644 --- a/cpp/test/IceGrid/replication/AllTests.cpp +++ b/cpp/test/IceGrid/replication/AllTests.cpp @@ -254,7 +254,7 @@ allTests(const Ice::CommunicatorPtr& comm) AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index fddfaf48756..5b9269b5c6b 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -493,7 +493,7 @@ allTests(const Ice::CommunicatorPtr& communicator) communicator->stringToProxy(communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry")); AdminSessionPrx session = registry->createAdminSession("admin3", "test3"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/simple/AllTests.cpp b/cpp/test/IceGrid/simple/AllTests.cpp index 30a6cda5cd1..fb230a0a4e2 100644 --- a/cpp/test/IceGrid/simple/AllTests.cpp +++ b/cpp/test/IceGrid/simple/AllTests.cpp @@ -238,7 +238,7 @@ allTestsWithDeploy(const Ice::CommunicatorPtr& communicator) IceGrid::AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); IceGrid::AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceGrid/update/AllTests.cpp b/cpp/test/IceGrid/update/AllTests.cpp index 5559b8436f9..b018cc446af 100644 --- a/cpp/test/IceGrid/update/AllTests.cpp +++ b/cpp/test/IceGrid/update/AllTests.cpp @@ -70,7 +70,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(registry); AdminSessionPrx session = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways); + session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); AdminPrx admin = session->getAdmin(); test(admin); diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index 96c1e527cb7..6d4147ea6e9 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -1585,7 +1585,7 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12) // verifier->reset(); verifier->returnValue(false); - server->ice_getConnection()->close(Ice::CloseGracefullyAndWait); + server->ice_getConnection()->close(Ice::ICE_ENUM(ConnectionClose, CloseGracefullyAndWait)); try { server->ice_ping(); diff --git a/cpp/test/Slice/errorDetection/ChangedMeaning.ice b/cpp/test/Slice/errorDetection/ChangedMeaning.ice index ed13ac5579e..71406d0c04d 100644 --- a/cpp/test/Slice/errorDetection/ChangedMeaning.ice +++ b/cpp/test/Slice/errorDetection/ChangedMeaning.ice @@ -107,7 +107,7 @@ module B const color fc = blue; - interface blue {}; // Ok as of 3.7: enums are now scoped + interface blue {}; // OK as of Ice 3.7 (enumerators are in their enum's namespace) }; |