activemq-cpp-3.9.5
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 
33  class AMQCPP_API ActiveMQMapMessage : public ActiveMQMessageTemplate<cms::MapMessage> {
34  private:
35 
36  // Map Structure to hold unmarshaled Map Data
37  mutable std::auto_ptr<util::PrimitiveMap> map;
38 
39  public:
40 
41  const static unsigned char ID_ACTIVEMQMAPMESSAGE;
42 
43  private:
44 
46  ActiveMQMapMessage& operator=(const ActiveMQMapMessage&);
47 
48  public:
49 
51 
52  virtual ~ActiveMQMapMessage() throw ();
53 
54  virtual unsigned char getDataStructureType() const;
55 
56  virtual bool isMarshalAware() const {
57  return true;
58  }
59 
60  virtual ActiveMQMapMessage* cloneDataStructure() const;
61 
62  virtual void copyDataStructure(const DataStructure* src);
63 
64  virtual void beforeMarshal(wireformat::WireFormat* wireFormat);
65 
66  virtual std::string toString() const;
67 
68  virtual bool equals(const DataStructure* value) const;
69 
70  virtual void clearBody() throw (cms::CMSException);
71 
72  public: // CMS Message
73 
74  virtual cms::MapMessage* clone() const;
75 
76  public: // CMS MapMessage
77 
78  virtual bool isEmpty() const;
79 
80  virtual std::vector<std::string> getMapNames() const;
81 
82  virtual bool itemExists(const std::string& name) const;
83 
84  virtual cms::Message::ValueType getValueType(const std::string& key) const;
85 
86  virtual bool getBoolean(const std::string& name) const;
87 
88  virtual void setBoolean(const std::string& name, bool value);
89 
90  virtual unsigned char getByte(const std::string& name) const;
91 
92  virtual void setByte(const std::string& name, unsigned char value);
93 
94  virtual std::vector<unsigned char> getBytes(const std::string& name) const;
95 
96  virtual void setBytes(const std::string& name, const std::vector<unsigned char>& value);
97 
98  virtual char getChar(const std::string& name) const;
99 
100  virtual void setChar(const std::string& name, char value);
101 
102  virtual double getDouble(const std::string& name) const;
103 
104  virtual void setDouble(const std::string& name, double value);
105 
106  virtual float getFloat(const std::string& name) const;
107 
108  virtual void setFloat(const std::string& name, float value);
109 
110  virtual int getInt(const std::string& name) const;
111 
112  virtual void setInt(const std::string& name, int value);
113 
114  virtual long long getLong(const std::string& name) const;
115 
116  virtual void setLong(const std::string& name, long long value);
117 
118  virtual short getShort(const std::string& name) const;
119 
120  virtual void setShort(const std::string& name, short value);
121 
122  virtual std::string getString(const std::string& name) const;
123 
124  virtual void setString(const std::string& name, const std::string& value);
125 
126  protected:
127 
136  util::PrimitiveMap& getMap();
137  const util::PrimitiveMap& getMap() const;
138 
144  virtual void checkMapIsUnmarshalled() const;
145 
146  };
147 
148 }}
149 
150 #endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_*/
#define AMQCPP_API
Definition: Config.h:30
Definition: DataStructure.h:27
Definition: ActiveMQMapMessage.h:33
Definition: Message.h:59
Provides a mechanism to marshal commands into and out of packets or into and out of streams...
Definition: WireFormat.h:43
#define const
Definition: zconf.h:198
Definition: ActiveMQMessageTemplate.h:41
static const unsigned char ID_ACTIVEMQMAPMESSAGE
Definition: ActiveMQMapMessage.h:41