bool BrokerInfo::equals()

in activemq-cpp/src/main/activemq/commands/BrokerInfo.cpp [156:218]


bool BrokerInfo::equals(const DataStructure* value) const {

    if (this == value) {
        return true;
    }

    const BrokerInfo* valuePtr = dynamic_cast<const BrokerInfo*>(value);

    if (valuePtr == NULL || value == NULL) {
        return false;
    }

    if (this->getBrokerId() != NULL) {
        if (!this->getBrokerId()->equals(valuePtr->getBrokerId().get())) {
            return false;
        }
    } else if (valuePtr->getBrokerId() != NULL) {
        return false;
    }
    if (this->getBrokerURL() != valuePtr->getBrokerURL()) {
        return false;
    }
    for (size_t ipeerBrokerInfos = 0; ipeerBrokerInfos < this->getPeerBrokerInfos().size(); ++ipeerBrokerInfos) {
        if (this->getPeerBrokerInfos()[ipeerBrokerInfos] != NULL ) {
            if (!this->getPeerBrokerInfos()[ipeerBrokerInfos]->equals(valuePtr->getPeerBrokerInfos()[ipeerBrokerInfos].get())) {
                return false;
            }
        } else if (valuePtr->getPeerBrokerInfos()[ipeerBrokerInfos] != NULL) {
            return false;
        }
    }
    if (this->getBrokerName() != valuePtr->getBrokerName()) {
        return false;
    }
    if (this->isSlaveBroker() != valuePtr->isSlaveBroker()) {
        return false;
    }
    if (this->isMasterBroker() != valuePtr->isMasterBroker()) {
        return false;
    }
    if (this->isFaultTolerantConfiguration() != valuePtr->isFaultTolerantConfiguration()) {
        return false;
    }
    if (this->isDuplexConnection() != valuePtr->isDuplexConnection()) {
        return false;
    }
    if (this->isNetworkConnection() != valuePtr->isNetworkConnection()) {
        return false;
    }
    if (this->getConnectionId() != valuePtr->getConnectionId()) {
        return false;
    }
    if (this->getBrokerUploadUrl() != valuePtr->getBrokerUploadUrl()) {
        return false;
    }
    if (this->getNetworkProperties() != valuePtr->getNetworkProperties()) {
        return false;
    }
    if (!BaseCommand::equals(value)) {
        return false;
    }
    return true;
}