activemq-cpp-3.3.0

src/main/activemq/commands/ActiveMQMapMessage.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_
00019 #define _ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_
00020 
00021 // Turn off warning message for ignored exception specification
00022 #ifdef _MSC_VER
00023 #pragma warning( disable : 4290 )
00024 #endif
00025 
00026 #include <activemq/util/Config.h>
00027 #include <activemq/commands/ActiveMQMessageTemplate.h>
00028 #include <activemq/util/PrimitiveMap.h>
00029 #include <decaf/lang/exceptions/NullPointerException.h>
00030 #include <cms/MapMessage.h>
00031 #include <vector>
00032 #include <string>
00033 #include <memory>
00034 
00035 namespace activemq{
00036 namespace commands{
00037 
00038     class AMQCPP_API ActiveMQMapMessage :
00039         public ActiveMQMessageTemplate<cms::MapMessage> {
00040 
00041     private:
00042 
00043         // Map Structure to hold unmarshaled Map Data
00044         mutable std::auto_ptr<util::PrimitiveMap> map;
00045 
00046     public:
00047 
00048         const static unsigned char ID_ACTIVEMQMAPMESSAGE = 25;
00049 
00050     private:
00051 
00052         ActiveMQMapMessage( const ActiveMQMapMessage& );
00053         ActiveMQMapMessage& operator= ( const ActiveMQMapMessage& );
00054 
00055     public:
00056 
00057         ActiveMQMapMessage();
00058 
00059         virtual ~ActiveMQMapMessage() throw();
00060 
00061         virtual unsigned char getDataStructureType() const;
00062 
00063         virtual bool isMarshalAware() const {
00064             return true;
00065         }
00066 
00067         virtual ActiveMQMapMessage* cloneDataStructure() const;
00068 
00069         virtual void copyDataStructure( const DataStructure* src );
00070 
00071         virtual void beforeMarshal( wireformat::WireFormat* wireFormat );
00072 
00073         virtual std::string toString() const;
00074 
00075         virtual bool equals( const DataStructure* value ) const;
00076 
00077         virtual void clearBody() throw( cms::CMSException );
00078 
00079     public:   // CMS Message
00080 
00081         virtual cms::MapMessage* clone() const {
00082             return dynamic_cast<cms::MapMessage*>( this->cloneDataStructure() );
00083         }
00084 
00085     public:   // CMS MapMessage
00086 
00090         virtual bool isEmpty() const;
00091 
00095         virtual std::vector< std::string > getMapNames() const;
00096 
00100         virtual bool itemExists( const std::string& name ) const;
00101 
00105         virtual bool getBoolean( const std::string& name ) const;
00106 
00110         virtual void setBoolean( const std::string& name, bool value );
00111 
00115         virtual unsigned char getByte( const std::string& name ) const;
00116 
00120         virtual void setByte( const std::string& name, unsigned char value );
00121 
00125         virtual std::vector<unsigned char> getBytes( const std::string& name ) const;
00126 
00130         virtual void setBytes( const std::string& name, const std::vector<unsigned char>& value );
00131 
00135         virtual char getChar( const std::string& name ) const;
00136 
00140         virtual void setChar( const std::string& name, char value );
00141 
00145         virtual double getDouble( const std::string& name ) const;
00146 
00150         virtual void setDouble( const std::string& name, double value );
00151 
00155         virtual float getFloat( const std::string& name ) const;
00156 
00160         virtual void setFloat( const std::string& name, float value );
00161 
00165         virtual int getInt( const std::string& name ) const;
00166 
00170         virtual void setInt( const std::string& name, int value );
00171 
00175         virtual long long getLong( const std::string& name ) const;
00176 
00180         virtual void setLong( const std::string& name, long long value );
00181 
00185         virtual short getShort( const std::string& name ) const;
00186 
00190         virtual void setShort( const std::string& name, short value );
00191 
00195         virtual std::string getString( const std::string& name ) const;
00196 
00200         virtual void setString( const std::string& name, const std::string& value );
00201 
00202     protected:
00203 
00212         util::PrimitiveMap& getMap();
00213         const util::PrimitiveMap& getMap() const;
00214 
00220         virtual void checkMapIsUnmarshalled() const;
00221 
00222     };
00223 
00224 }}
00225 
00226 #endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_*/