bool ConsumerInfo::equals()

in activemq-cpp/src/main/activemq/commands/ConsumerInfo.cpp [201:298]


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

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

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

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

    if (this->getConsumerId() != NULL) {
        if (!this->getConsumerId()->equals(valuePtr->getConsumerId().get())) {
            return false;
        }
    } else if (valuePtr->getConsumerId() != NULL) {
        return false;
    }
    if (this->isBrowser() != valuePtr->isBrowser()) {
        return false;
    }
    if (this->getDestination() != NULL) {
        if (!this->getDestination()->equals(valuePtr->getDestination().get())) {
            return false;
        }
    } else if (valuePtr->getDestination() != NULL) {
        return false;
    }
    if (this->getPrefetchSize() != valuePtr->getPrefetchSize()) {
        return false;
    }
    if (this->getMaximumPendingMessageLimit() != valuePtr->getMaximumPendingMessageLimit()) {
        return false;
    }
    if (this->isDispatchAsync() != valuePtr->isDispatchAsync()) {
        return false;
    }
    if (this->getSelector() != valuePtr->getSelector()) {
        return false;
    }
    if (this->getClientId() != valuePtr->getClientId()) {
        return false;
    }
    if (this->getSubscriptionName() != valuePtr->getSubscriptionName()) {
        return false;
    }
    if (this->isNoLocal() != valuePtr->isNoLocal()) {
        return false;
    }
    if (this->isExclusive() != valuePtr->isExclusive()) {
        return false;
    }
    if (this->isRetroactive() != valuePtr->isRetroactive()) {
        return false;
    }
    if (this->getPriority() != valuePtr->getPriority()) {
        return false;
    }
    for (size_t ibrokerPath = 0; ibrokerPath < this->getBrokerPath().size(); ++ibrokerPath) {
        if (this->getBrokerPath()[ibrokerPath] != NULL ) {
            if (!this->getBrokerPath()[ibrokerPath]->equals(valuePtr->getBrokerPath()[ibrokerPath].get())) {
                return false;
            }
        } else if (valuePtr->getBrokerPath()[ibrokerPath] != NULL) {
            return false;
        }
    }
    if (this->getAdditionalPredicate() != NULL) {
        if (!this->getAdditionalPredicate()->equals(valuePtr->getAdditionalPredicate().get())) {
            return false;
        }
    } else if (valuePtr->getAdditionalPredicate() != NULL) {
        return false;
    }
    if (this->isNetworkSubscription() != valuePtr->isNetworkSubscription()) {
        return false;
    }
    if (this->isOptimizedAcknowledge() != valuePtr->isOptimizedAcknowledge()) {
        return false;
    }
    if (this->isNoRangeAcks() != valuePtr->isNoRangeAcks()) {
        return false;
    }
    for (size_t inetworkConsumerPath = 0; inetworkConsumerPath < this->getNetworkConsumerPath().size(); ++inetworkConsumerPath) {
        if (this->getNetworkConsumerPath()[inetworkConsumerPath] != NULL ) {
            if (!this->getNetworkConsumerPath()[inetworkConsumerPath]->equals(valuePtr->getNetworkConsumerPath()[inetworkConsumerPath].get())) {
                return false;
            }
        } else if (valuePtr->getNetworkConsumerPath()[inetworkConsumerPath] != NULL) {
            return false;
        }
    }
    if (!BaseCommand::equals(value)) {
        return false;
    }
    return true;
}