/* 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 "netinet/in.h" #include "marshal/ConsumerInfoMarshaller.h" #include "command/ConsumerInfo.h" #include "boost/shared_ptr.hpp" using namespace ActiveMQ::Marshalling; using namespace ActiveMQ::Command; using namespace ActiveMQ::IO; using std::auto_ptr; using boost::shared_ptr; /* * Marshalling code for Open Wire Format for ConsumerInfo * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module */ ConsumerInfoMarshaller::ConsumerInfoMarshaller() { // no-op } ConsumerInfoMarshaller::~ConsumerInfoMarshaller() { // no-op } auto_ptr ConsumerInfoMarshaller::createCommand() { return auto_ptr(new ConsumerInfo()); } char ConsumerInfoMarshaller::getDataStructureType() { return ConsumerInfo::TYPE; } /* * Un-marshal an object instance from the data input stream */ void ConsumerInfoMarshaller::unmarshal(ProtocolFormat& wireFormat, IDataStructure& o, BinaryReader& dataIn, BooleanStream& bs) { BaseCommandMarshaller::unmarshal(wireFormat, o, dataIn, bs); ConsumerInfo& info = (ConsumerInfo&) o; info.setConsumerId( shared_ptr(static_cast(unmarshalCachedObject(wireFormat, dataIn, bs).release())) ); info.setBrowser( bs.readBoolean() ); info.setDestination( shared_ptr(static_cast(unmarshalCachedObject(wireFormat, dataIn, bs).release())) ); info.setPrefetchSize( dataIn.readInt() ); info.setMaximumPendingMessageLimit( dataIn.readInt() ); info.setDispatchAsync( bs.readBoolean() ); info.setSelector( unmarshalString(wireFormat, dataIn, bs) ); info.setSubcriptionName( unmarshalString(wireFormat, dataIn, bs) ); info.setNoLocal( bs.readBoolean() ); info.setExclusive( bs.readBoolean() ); info.setRetroactive( bs.readBoolean() ); info.setPriority( dataIn.readByte() ); if (bs.readBoolean()) { short size = dataIn.readShort(); std::vector > value; for( int i=0; i < size; i++ ) value.push_back(shared_ptr(static_cast(unmarshalNestedObject(wireFormat,dataIn, bs).release()))); info.setBrokerPath( value ); } info.setNetworkSubscription( bs.readBoolean() ); info.setOptimizedAcknowledge( bs.readBoolean() ); info.setNoRangeAcks( bs.readBoolean() ); } /* * Write the booleans that this object uses to a BooleanStream */ size_t ConsumerInfoMarshaller::marshal1(ProtocolFormat& wireFormat, const IDataStructure& o, BooleanStream& bs) { ConsumerInfo& info = (ConsumerInfo&) o; int rc = BaseCommandMarshaller::marshal1(wireFormat, info, bs); rc += marshal1CachedObject(wireFormat, info.getConsumerId(), bs); bs.writeBoolean(info.isBrowser()); rc += marshal1CachedObject(wireFormat, info.getDestination(), bs); bs.writeBoolean(info.isDispatchAsync()); rc += writeString1(info.getSelector(), bs); rc += writeString1(info.getSubcriptionName(), bs); bs.writeBoolean(info.isNoLocal()); bs.writeBoolean(info.isExclusive()); bs.writeBoolean(info.isRetroactive()); rc += marshal1ObjectArray(wireFormat, info.getBrokerPath(), bs); bs.writeBoolean(info.isNetworkSubscription()); bs.writeBoolean(info.isOptimizedAcknowledge()); bs.writeBoolean(info.isNoRangeAcks()); return rc + 9; } /* * Write a object instance to data output stream */ void ConsumerInfoMarshaller::marshal2(ProtocolFormat& wireFormat, const IDataStructure& o, BinaryWriter& dataOut, BooleanStream& bs) { // } BaseCommandMarshaller::marshal2(wireFormat, o, dataOut, bs); ConsumerInfo& info = (ConsumerInfo&) o; marshal2CachedObject(wireFormat, info.getConsumerId(), dataOut, bs); bs.readBoolean(); marshal2CachedObject(wireFormat, info.getDestination(), dataOut, bs); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); bs.readBoolean(); writeString2(info.getSelector(), dataOut, bs); writeString2(info.getSubcriptionName(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); dataOut.writeByte(info.getPriority()); marshal2ObjectArray(wireFormat, info.getBrokerPath(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); }