blob: d7e9267ca333718c28b121765a24b38a236fd6a7 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <activemq/connector/openwire/commands/MessageId.h>
#include <activemq/exceptions/NullPointerException.h>
using namespace std;
using namespace activemq;
using namespace activemq::exceptions;
using namespace activemq::connector;
using namespace activemq::connector::openwire;
using namespace activemq::connector::openwire::commands;
/*
*
* Command and marshaling code for OpenWire format for MessageId
*
*
* NOTE!: This file is autogenerated - do not modify!
* if you need to make a change, please see the Java Classes in the
* activemq-core module
*
*/
////////////////////////////////////////////////////////////////////////////////
MessageId::MessageId()
{
this->producerId = NULL;
this->producerSequenceId = 0;
this->brokerSequenceId = 0;
}
////////////////////////////////////////////////////////////////////////////////
MessageId::~MessageId()
{
delete this->producerId;
}
////////////////////////////////////////////////////////////////////////////////
MessageId* MessageId::cloneDataStructure() const {
MessageId* messageId = new MessageId();
// Copy the data from the base class or classes
messageId->copyDataStructure( this );
return messageId;
}
////////////////////////////////////////////////////////////////////////////////
void MessageId::copyDataStructure( const DataStructure* src ) {
// Copy the data of the base class or classes
BaseDataStructure::copyDataStructure( src );
const MessageId* srcPtr = dynamic_cast<const MessageId*>( src );
if( srcPtr == NULL || src == NULL ) {
throw exceptions::NullPointerException(
__FILE__, __LINE__,
"MessageId::copyDataStructure - src is NULL or invalid" );
}
if( srcPtr->getProducerId() != NULL ) {
this->setProducerId(
dynamic_cast<ProducerId*>(
srcPtr->getProducerId()->cloneDataStructure() ) );
}
this->setProducerSequenceId( srcPtr->getProducerSequenceId() );
this->setBrokerSequenceId( srcPtr->getBrokerSequenceId() );
}
////////////////////////////////////////////////////////////////////////////////
unsigned char MessageId::getDataStructureType() const {
return MessageId::ID_MESSAGEID;
}
////////////////////////////////////////////////////////////////////////////////
std::string MessageId::toString() const {
ostringstream stream;
stream << "Begin Class = MessageId" << std::endl;
stream << " Value of MessageId::ID_MESSAGEID = 110" << std::endl;
stream << " Value of ProducerId is Below:" << std::endl;
if( this->getProducerId() != NULL ) {
stream << this->getProducerId()->toString() << std::endl;
} else {
stream << " Object is NULL" << std::endl;
}
stream << " Value of ProducerSequenceId = " << this->getProducerSequenceId() << std::endl;
stream << " Value of BrokerSequenceId = " << this->getBrokerSequenceId() << std::endl;
stream << BaseDataStructure::toString();
stream << "End Class = MessageId" << std::endl;
return stream.str();
}
////////////////////////////////////////////////////////////////////////////////
bool MessageId::equals( const DataStructure* value ) const {
const MessageId* valuePtr = dynamic_cast<const MessageId*>( value );
if( valuePtr == NULL || value == NULL ) {
return false;
}
if( this->getProducerId() != NULL ) {
if( !this->getProducerId()->equals( valuePtr->getProducerId() ) ) {
return false;
}
} else if( valuePtr->getProducerId() != NULL ) {
return false;
}
if( this->getProducerSequenceId() != valuePtr->getProducerSequenceId() ) {
return false;
}
if( this->getBrokerSequenceId() != valuePtr->getBrokerSequenceId() ) {
return false;
}
if( !BaseDataStructure::equals( value ) ) {
return false;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
const ProducerId* MessageId::getProducerId() const {
return producerId;
}
////////////////////////////////////////////////////////////////////////////////
ProducerId* MessageId::getProducerId() {
return producerId;
}
////////////////////////////////////////////////////////////////////////////////
void MessageId::setProducerId(ProducerId* producerId ) {
this->producerId = producerId;
}
////////////////////////////////////////////////////////////////////////////////
long long MessageId::getProducerSequenceId() const {
return producerSequenceId;
}
////////////////////////////////////////////////////////////////////////////////
void MessageId::setProducerSequenceId(long long producerSequenceId ) {
this->producerSequenceId = producerSequenceId;
}
////////////////////////////////////////////////////////////////////////////////
long long MessageId::getBrokerSequenceId() const {
return brokerSequenceId;
}
////////////////////////////////////////////////////////////////////////////////
void MessageId::setBrokerSequenceId(long long brokerSequenceId ) {
this->brokerSequenceId = brokerSequenceId;
}