activemq-cpp-3.6.0
ActiveMQMapMessage.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_
19 #define _ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_
20 
21 // Turn off warning message for ignored exception specification
22 #ifdef _MSC_VER
23 #pragma warning( disable : 4290 )
24 #endif
25 
26 #include <activemq/util/Config.h>
30 #include <cms/MapMessage.h>
31 #include <vector>
32 #include <string>
33 #include <memory>
34 
35 namespace activemq{
36 namespace commands{
37 
39  public ActiveMQMessageTemplate<cms::MapMessage> {
40 
41  private:
42 
43  // Map Structure to hold unmarshaled Map Data
44  mutable std::auto_ptr<util::PrimitiveMap> map;
45 
46  public:
47 
48  const static unsigned char ID_ACTIVEMQMAPMESSAGE = 25;
49 
50  private:
51 
53  ActiveMQMapMessage& operator= ( const ActiveMQMapMessage& );
54 
55  public:
56 
58 
59  virtual ~ActiveMQMapMessage() throw();
60 
61  virtual unsigned char getDataStructureType() const;
62 
63  virtual bool isMarshalAware() const {
64  return true;
65  }
66 
67  virtual ActiveMQMapMessage* cloneDataStructure() const;
68 
69  virtual void copyDataStructure( const DataStructure* src );
70 
71  virtual void beforeMarshal( wireformat::WireFormat* wireFormat );
72 
73  virtual std::string toString() const;
74 
75  virtual bool equals( const DataStructure* value ) const;
76 
77  virtual void clearBody() throw( cms::CMSException );
78 
79  public: // CMS Message
80 
81  virtual cms::MapMessage* clone() const {
82  ActiveMQMapMessage* clone = this->cloneDataStructure();
83  clone->setReadOnlyBody(false);
84  clone->setReadOnlyProperties(false);
85  return dynamic_cast<cms::MapMessage*>(clone);
86  }
87 
88  public: // CMS MapMessage
89 
93  virtual bool isEmpty() const;
94 
98  virtual std::vector< std::string > getMapNames() const;
99 
103  virtual bool itemExists( const std::string& name ) const;
104 
108  virtual cms::Message::ValueType getValueType(const std::string& key) const;
109 
113  virtual bool getBoolean( const std::string& name ) const;
114 
118  virtual void setBoolean( const std::string& name, bool value );
119 
123  virtual unsigned char getByte( const std::string& name ) const;
124 
128  virtual void setByte( const std::string& name, unsigned char value );
129 
133  virtual std::vector<unsigned char> getBytes( const std::string& name ) const;
134 
138  virtual void setBytes( const std::string& name, const std::vector<unsigned char>& value );
139 
143  virtual char getChar( const std::string& name ) const;
144 
148  virtual void setChar( const std::string& name, char value );
149 
153  virtual double getDouble( const std::string& name ) const;
154 
158  virtual void setDouble( const std::string& name, double value );
159 
163  virtual float getFloat( const std::string& name ) const;
164 
168  virtual void setFloat( const std::string& name, float value );
169 
173  virtual int getInt( const std::string& name ) const;
174 
178  virtual void setInt( const std::string& name, int value );
179 
183  virtual long long getLong( const std::string& name ) const;
184 
188  virtual void setLong( const std::string& name, long long value );
189 
193  virtual short getShort( const std::string& name ) const;
194 
198  virtual void setShort( const std::string& name, short value );
199 
203  virtual std::string getString( const std::string& name ) const;
204 
208  virtual void setString( const std::string& name, const std::string& value );
209 
210  protected:
211 
220  util::PrimitiveMap& getMap();
221  const util::PrimitiveMap& getMap() const;
222 
228  virtual void checkMapIsUnmarshalled() const;
229 
230  };
231 
232 }}
233 
234 #endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_*/