diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index c41aa5c..1368294 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -1195,19 +1195,20 @@ ServiceHelper::ServiceHelper(const ServiceDescriptorPtr& descriptor) : } bool -ServiceHelper::operator==(const ServiceHelper& helper) const +ServiceHelper::operator==(const CommunicatorHelper& h) const { - if(!CommunicatorHelper::operator==(helper)) + const ServiceHelper* helper = dynamic_cast(&h); + if(!helper || !CommunicatorHelper::operator==(h)) { return false; } - if(_desc->name != helper._desc->name) + if(_desc->name != helper->_desc->name) { return false; } - if(_desc->entry != helper._desc->entry) + if(_desc->entry != helper->_desc->entry) { return false; } @@ -1216,7 +1217,7 @@ ServiceHelper::operator==(const ServiceHelper& helper) const } bool -ServiceHelper::operator!=(const ServiceHelper& helper) const +ServiceHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } @@ -1272,66 +1273,67 @@ ServerHelper::ServerHelper(const ServerDescriptorPtr& descriptor) : } bool -ServerHelper::operator==(const ServerHelper& helper) const +ServerHelper::operator==(const CommunicatorHelper& h) const { - if(!CommunicatorHelper::operator==(helper)) + const ServerHelper* helper = dynamic_cast(&h); + if(!helper || !CommunicatorHelper::operator==(h)) { return false; } - if(_desc->id != helper._desc->id) + if(_desc->id != helper->_desc->id) { return false; } - if(_desc->exe != helper._desc->exe) + if(_desc->exe != helper->_desc->exe) { return false; } - if(_desc->pwd != helper._desc->pwd) + if(_desc->pwd != helper->_desc->pwd) { return false; } if(set(_desc->options.begin(), _desc->options.end()) != - set(helper._desc->options.begin(), helper._desc->options.end())) + set(helper->_desc->options.begin(), helper->_desc->options.end())) { return false; } if(set(_desc->envs.begin(), _desc->envs.end()) != - set(helper._desc->envs.begin(), helper._desc->envs.end())) + set(helper->_desc->envs.begin(), helper->_desc->envs.end())) { return false; } - if(_desc->activation != helper._desc->activation) + if(_desc->activation != helper->_desc->activation) { return false; } - if(_desc->activationTimeout != helper._desc->activationTimeout) + if(_desc->activationTimeout != helper->_desc->activationTimeout) { return false; } - if(_desc->deactivationTimeout != helper._desc->deactivationTimeout) + if(_desc->deactivationTimeout != helper->_desc->deactivationTimeout) { return false; } - if(_desc->distrib != helper._desc->distrib) + if(_desc->distrib != helper->_desc->distrib) { return false; } - if(_desc->allocatable != helper._desc->allocatable) + if(_desc->allocatable != helper->_desc->allocatable) { return false; } - if(_desc->user != helper._desc->user) + if(_desc->user != helper->_desc->user) { return false; } @@ -1340,7 +1342,7 @@ ServerHelper::operator==(const ServerHelper& helper) const } bool -ServerHelper::operator!=(const ServerHelper& helper) const +ServerHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } @@ -1483,14 +1485,15 @@ IceBoxHelper::IceBoxHelper(const IceBoxDescriptorPtr& descriptor) : } bool -IceBoxHelper::operator==(const IceBoxHelper& helper) const +IceBoxHelper::operator==(const CommunicatorHelper& h) const { - if(!ServerHelper::operator==(helper)) + const IceBoxHelper* helper = dynamic_cast(&h); + if(!helper || !ServerHelper::operator==(h)) { return false; } - - if(_services != helper._services) + + if(_services != helper->_services) { return false; } @@ -1499,7 +1502,7 @@ IceBoxHelper::operator==(const IceBoxHelper& helper) const } bool -IceBoxHelper::operator!=(const IceBoxHelper& helper) const +IceBoxHelper::operator!=(const CommunicatorHelper& helper) const { return !operator==(helper); } diff --git a/cpp/src/IceGrid/DescriptorHelper.h b/cpp/src/IceGrid/DescriptorHelper.h index e222940..f16d50a 100644 --- a/cpp/src/IceGrid/DescriptorHelper.h +++ b/cpp/src/IceGrid/DescriptorHelper.h @@ -86,8 +86,8 @@ public: CommunicatorHelper() { } virtual ~CommunicatorHelper() { } - bool operator==(const CommunicatorHelper&) const; - bool operator!=(const CommunicatorHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; virtual void getIds(std::multiset&, std::multiset&) const; virtual void getReplicaGroups(std::set&) const; @@ -115,8 +115,8 @@ public: ServiceHelper(const ServiceDescriptorPtr&); ServiceHelper() { } - bool operator==(const ServiceHelper&) const; - bool operator!=(const ServiceHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; ServiceDescriptorPtr getDescriptor() const; ServiceDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, @@ -141,8 +141,8 @@ public: ServerHelper(const ServerDescriptorPtr&); ServerHelper() { } - bool operator==(const ServerHelper&) const; - bool operator!=(const ServerHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; ServerDescriptorPtr getDescriptor() const; virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, @@ -203,8 +203,8 @@ public: IceBoxHelper(const IceBoxDescriptorPtr&); IceBoxHelper() { } - bool operator==(const IceBoxHelper&) const; - bool operator!=(const IceBoxHelper&) const; + virtual bool operator==(const CommunicatorHelper&) const; + virtual bool operator!=(const CommunicatorHelper&) const; virtual ServerDescriptorPtr instantiate(const Resolver&, const PropertyDescriptorSeq&, const PropertySetDescriptorDict&) const; @@ -267,8 +267,8 @@ public: NodeHelper(const std::string&, const NodeDescriptor&, const Resolver&, bool); virtual ~NodeHelper() { } - bool operator==(const NodeHelper&) const; - bool operator!=(const NodeHelper&) const; + virtual bool operator==(const NodeHelper&) const; + virtual bool operator!=(const NodeHelper&) const; NodeUpdateDescriptor diff(const NodeHelper&) const; NodeDescriptor update(const NodeUpdateDescriptor&, const Resolver&) const;