bool DestinationInfo::equals()

in activemq-cpp/src/main/activemq/commands/DestinationInfo.cpp [138:183]


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

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

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

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

    if (this->getConnectionId() != NULL) {
        if (!this->getConnectionId()->equals(valuePtr->getConnectionId().get())) {
            return false;
        }
    } else if (valuePtr->getConnectionId() != NULL) {
        return false;
    }
    if (this->getDestination() != NULL) {
        if (!this->getDestination()->equals(valuePtr->getDestination().get())) {
            return false;
        }
    } else if (valuePtr->getDestination() != NULL) {
        return false;
    }
    if (this->getOperationType() != valuePtr->getOperationType()) {
        return false;
    }
    if (this->getTimeout() != valuePtr->getTimeout()) {
        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 (!BaseCommand::equals(value)) {
        return false;
    }
    return true;
}