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
25#include <cms/MapMessage.h>
26#include <vector>
27#include <string>
28#include <memory>
29
30namespace activemq {
31namespace 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
45 ActiveMQMapMessage(const ActiveMQMapMessage&);
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
145
146 };
147
148}}
149
150#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQMAPMESSAGE_H_*/
#define AMQCPP_API
Definition Config.h:30
virtual bool isEmpty() const
Returns true if there are no values stored in the MapMessage body.
virtual void setChar(const std::string &name, char value)
Sets a Char value with the specified name into the Map.
virtual long long getLong(const std::string &name) const
Returns the Long value of the Specified name.
virtual bool itemExists(const std::string &name) const
Indicates whether an item exists in this MapMessage object.
virtual ActiveMQMapMessage * cloneDataStructure() const
Clone this obbject and return a new instance that the caller now owns, this will be an exact copy of ...
util::PrimitiveMap & getMap()
Fetches a reference to this objects PrimitiveMap, if one needs to be created or unmarshaled,...
virtual void beforeMarshal(wireformat::WireFormat *wireFormat)
Called before marshaling is started to prepare the object to be marshaled.
virtual unsigned char getByte(const std::string &name) const
Returns the Byte value of the Specified name.
virtual void setByte(const std::string &name, unsigned char value)
Sets a Byte value with the specified name into the Map.
virtual int getInt(const std::string &name) const
Returns the Int value of the Specified name.
virtual bool equals(const DataStructure *value) const
Compares the DataStructure passed in to this one, and returns if they are equivalent.
virtual void setLong(const std::string &name, long long value)
Sets a Long value with the specified name into the Map.
virtual void setFloat(const std::string &name, float value)
Sets a Float value with the specified name into the Map.
virtual bool isMarshalAware() const
Indicates that this command is aware of Marshaling, and needs to have its Marshaling methods invoked.
Definition ActiveMQMapMessage.h:56
virtual void setBytes(const std::string &name, const std::vector< unsigned char > &value)
Sets a Bytes value with the specified name into the Map.
virtual void setDouble(const std::string &name, double value)
Sets a Double value with the specified name into the Map.
virtual short getShort(const std::string &name) const
Returns the Short value of the Specified name.
virtual std::string getString(const std::string &name) const
Returns the String value of the Specified name.
virtual void setShort(const std::string &name, short value)
Sets a Short value with the specified name into the Map.
virtual unsigned char getDataStructureType() const
Get the DataStructure Type as defined in CommandTypes.h.
virtual bool getBoolean(const std::string &name) const
Returns the Boolean value of the Specified name.
virtual cms::Message::ValueType getValueType(const std::string &key) const
Returns the value type for the given key mapping.
virtual void setBoolean(const std::string &name, bool value)
Sets a boolean value with the specified name into the Map.
virtual void setString(const std::string &name, const std::string &value)
Sets a String value with the specified name into the Map.
virtual void checkMapIsUnmarshalled() const
Performs the unmarshal on the Map if needed, otherwise just returns.
virtual std::string toString() const
Returns a string containing the information for this DataStructure such as its type and value of its ...
virtual void copyDataStructure(const DataStructure *src)
Copy the contents of the passed object into this objects members, overwriting any existing data.
virtual std::vector< std::string > getMapNames() const
Returns an Enumeration of all the names in the MapMessage object.
static const unsigned char ID_ACTIVEMQMAPMESSAGE
Definition ActiveMQMapMessage.h:41
virtual void clearBody()
Clears out the body of the message.
virtual cms::MapMessage * clone() const
Clone this message exactly, returns a new instance that the caller is required to delete.
virtual void setInt(const std::string &name, int value)
Sets a Int value with the specified name into the Map.
virtual double getDouble(const std::string &name) const
Returns the Double value of the Specified name.
virtual char getChar(const std::string &name) const
Returns the Char value of the Specified name.
virtual float getFloat(const std::string &name) const
Returns the Float value of the Specified name.
virtual std::vector< unsigned char > getBytes(const std::string &name) const
Returns the Bytes value of the Specified name.
ActiveMQMessageTemplate()
Definition ActiveMQMessageTemplate.h:48
Definition DataStructure.h:27
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
ValueType
Defines the Type Identifiers used to identify the type contained within a specific Message property o...
Definition Message.h:112
Definition ActiveMQBlobMessage.h:28
Definition ActiveMQMessageTransformation.h:36
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition DestinationResolver.h:23
Definition ArrayPointer.h:432
#define const
Definition zconf.h:198