activemq-cpp-3.8.2
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 #include <activemq/util/Config.h>
25 #include <cms/MapMessage.h>
26 #include <vector>
27 #include <string>
28 #include <memory>
29 
30 namespace activemq{
31 namespace commands{
32 
34  public ActiveMQMessageTemplate<cms::MapMessage> {
35 
36  private:
37 
38  // Map Structure to hold unmarshaled Map Data
39  mutable std::auto_ptr<util::PrimitiveMap> map;
40 
41  public:
42 
43  const static unsigned char ID_ACTIVEMQMAPMESSAGE = 25;
44 
45  private:
46 
48  ActiveMQMapMessage& operator= ( const ActiveMQMapMessage& );
49 
50  public:
51 
53 
54  virtual ~ActiveMQMapMessage() throw();
55 
56  virtual unsigned char getDataStructureType() const;
57 
58  virtual bool isMarshalAware() const {
59  return true;
60  }
61 
62  virtual ActiveMQMapMessage* cloneDataStructure() const;
63 
64  virtual void copyDataStructure( const DataStructure* src );
65 
66  virtual void beforeMarshal( wireformat::WireFormat* wireFormat );
67 
68  virtual std::string toString() const;
69 
70  virtual bool equals( const DataStructure* value ) const;
71 
72  virtual void clearBody() throw( cms::CMSException );
73 
74  public: // CMS Message
75 
76  virtual cms::MapMessage* clone() const {
77  ActiveMQMapMessage* clone = this->cloneDataStructure();
78  clone->setReadOnlyBody(false);
79  clone->setReadOnlyProperties(false);
80  return dynamic_cast<cms::MapMessage*>(clone);
81  }
82 
83  public: // CMS MapMessage
84 
88  virtual bool isEmpty() const;
89 
93  virtual std::vector< std::string > getMapNames() const;
94 
98  virtual bool itemExists( const std::string& name ) const;
99 
103  virtual cms::Message::ValueType getValueType(const std::string& key) const;
104 
108  virtual bool getBoolean( const std::string& name ) const;
109 
113  virtual void setBoolean( const std::string& name, bool value );
114 
118  virtual unsigned char getByte( const std::string& name ) const;
119 
123  virtual void setByte( const std::string& name, unsigned char value );
124 
128  virtual std::vector<unsigned char> getBytes( const std::string& name ) const;
129 
133  virtual void setBytes( const std::string& name, const std::vector<unsigned char>& value );
134 
138  virtual char getChar( const std::string& name ) const;
139 
143  virtual void setChar( const std::string& name, char value );
144 
148  virtual double getDouble( const std::string& name ) const;
149 
153  virtual void setDouble( const std::string& name, double value );
154 
158  virtual float getFloat( const std::string& name ) const;
159 
163  virtual void setFloat( const std::string& name, float value );
164 
168  virtual int getInt( const std::string& name ) const;
169 
173  virtual void setInt( const std::string& name, int value );
174 
178  virtual long long getLong( const std::string& name ) const;
179 
183  virtual void setLong( const std::string& name, long long value );
184 
188  virtual short getShort( const std::string& name ) const;
189 
193  virtual void setShort( const std::string& name, short value );
194 
198  virtual std::string getString( const std::string& name ) const;
199 
203  virtual void setString( const std::string& name, const std::string& value );
204 
205  protected:
206 
215  util::PrimitiveMap& getMap();
216  const util::PrimitiveMap& getMap() const;
217 
223  virtual void checkMapIsUnmarshalled() const;
224 
225  };
226 
227 }}
228 
229 #endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_*/
ValueType
Defines the Type Identifiers used to identify the type contained within a specific Message property o...
Definition: Message.h:112
#define AMQCPP_API
Definition: Config.h:30
virtual cms::MapMessage * clone() const
Clone this message exactly, returns a new instance that the caller is required to delete...
Definition: ActiveMQMapMessage.h:76
Definition: DataStructure.h:27
A MapMessage object is used to send a set of name-value pairs.
Definition: MapMessage.h:71
Map of named primitives.
Definition: PrimitiveMap.h:36
CMS API Exception that is the base for all exceptions thrown from CMS classes.
Definition: CMSException.h:50
Definition: ActiveMQMapMessage.h:33
void setReadOnlyBody(bool value)
Set the Read Only State of the Message Content.
Definition: Message.h:270
Provides a mechanism to marshal commands into and out of packets or into and out of streams...
Definition: WireFormat.h:43
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
#define const
Definition: zconf.h:198
Definition: ActiveMQMessageTemplate.h:41
void setReadOnlyProperties(bool value)
Set the Read Only State of the Message Properties.
Definition: Message.h:254