activemq-cpp-3.9.5
ActiveMQBytesMessage.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_ACTIVEMQBYTESMESSAGE_H_
19#define _ACTIVEMQ_COMMANDS_ACTIVEMQBYTESMESSAGE_H_
20
26#include <cms/BytesMessage.h>
27#include <vector>
28#include <string>
29#include <memory>
30
31namespace activemq {
32namespace commands {
33
34 class AMQCPP_API ActiveMQBytesMessage : public ActiveMQMessageTemplate< cms::BytesMessage > {
35 private:
36
42
46 mutable std::auto_ptr<decaf::io::DataInputStream> dataIn;
47
51 std::auto_ptr<decaf::io::DataOutputStream> dataOut;
52
56 mutable int length;
57
58 public:
59
60 const static unsigned char ID_ACTIVEMQBYTESMESSAGE;
61
62 private:
63
64 ActiveMQBytesMessage(const ActiveMQBytesMessage&);
65 ActiveMQBytesMessage& operator=(const ActiveMQBytesMessage&);
66
67 public:
68
70
71 virtual ~ActiveMQBytesMessage() throw ();
72
73 virtual unsigned char getDataStructureType() const;
74
75 virtual ActiveMQBytesMessage* cloneDataStructure() const;
76
78
79 virtual std::string toString() const;
80
81 virtual bool equals(const DataStructure* value) const;
82
83 public: // CMS Message
84
85 virtual cms::BytesMessage* clone() const;
86
87 virtual void clearBody();
88
89 virtual void onSend();
90
91 public: // CMS BytesMessage
92
93 virtual void setBodyBytes(const unsigned char* buffer, int numBytes);
94
95 virtual unsigned char* getBodyBytes() const;
96
97 virtual int getBodyLength() const;
98
99 virtual void reset();
100
101 virtual bool readBoolean() const;
102
103 virtual void writeBoolean(bool value);
104
105 virtual unsigned char readByte() const;
106
107 virtual void writeByte(unsigned char value);
108
109 virtual int readBytes(std::vector<unsigned char>& value) const;
110
111 virtual void writeBytes(const std::vector<unsigned char>& value);
112
113 virtual int readBytes(unsigned char* buffer, int length) const;
114
115 virtual void writeBytes(const unsigned char* value, int offset, int length);
116
117 virtual char readChar() const;
118
119 virtual void writeChar(char value);
120
121 virtual float readFloat() const;
122
123 virtual void writeFloat(float value);
124
125 virtual double readDouble() const;
126
127 virtual void writeDouble(double value);
128
129 virtual short readShort() const;
130
131 virtual void writeShort(short value);
132
133 virtual unsigned short readUnsignedShort() const;
134
135 virtual void writeUnsignedShort(unsigned short value);
136
137 virtual int readInt() const;
138
139 virtual void writeInt(int value);
140
141 virtual long long readLong() const;
142
143 virtual void writeLong(long long value);
144
145 virtual std::string readString() const;
146
147 virtual void writeString(const std::string& value);
148
149 virtual std::string readUTF() const;
150
151 virtual void writeUTF(const std::string& value);
152
153 private:
154
155 void storeContent();
156
157 void initializeReading() const;
158
159 void initializeWriting();
160
161 };
162
163}}
164
165#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQBYTESMESSAGE_H_*/
#define AMQCPP_API
Definition Config.h:30
static const unsigned char ID_ACTIVEMQBYTESMESSAGE
Definition ActiveMQBytesMessage.h:60
virtual void writeBytes(const std::vector< unsigned char > &value)
Writes a byte array to the bytes message stream using the vector size as the number of bytes to write...
virtual int readInt() const
Reads a 32 bit signed integer from the Bytes message stream.
virtual void reset()
Puts the message body in read-only mode and repositions the stream of bytes to the beginning.
virtual cms::BytesMessage * clone() const
Clones this message.
virtual char readChar() const
Reads a Char from the Bytes message stream.
virtual void onSend()
Allows derived Message classes to perform tasks before a message is sent.
virtual void writeFloat(float value)
Writes a float to the bytes message stream as a 4 byte value.
virtual void setBodyBytes(const unsigned char *buffer, int numBytes)
sets the bytes given to the message body.
virtual void writeChar(char value)
Writes a char to the bytes message stream as a 1-byte value.
virtual void writeUnsignedShort(unsigned short value)
Writes a unsigned short to the bytes message stream as a 2 byte value.
virtual float readFloat() const
Reads a 32 bit float from the Bytes message stream.
virtual int readBytes(std::vector< unsigned char > &value) const
Reads a byte array from the bytes message stream.
virtual std::string toString() const
Returns a string containing the information for this DataStructure such as its type and value of its ...
virtual ActiveMQBytesMessage * cloneDataStructure() const
Clone this obbject and return a new instance that the caller now owns, this will be an exact copy of ...
virtual std::string readString() const
Reads an ASCII String from the Bytes message stream.
virtual unsigned char getDataStructureType() const
Get the DataStructure Type as defined in CommandTypes.h.
virtual unsigned char * getBodyBytes() const
Gets the bytes that are contained in this message and returns them in a newly allocated array that be...
virtual void writeDouble(double value)
Writes a double to the bytes message stream as a 8 byte value.
virtual void writeShort(short value)
Writes a signed short to the bytes message stream as a 2 byte value.
virtual bool readBoolean() const
Reads a Boolean from the Bytes message stream.
virtual std::string readUTF() const
Reads an UTF String from the BytesMessage stream.
virtual void writeBoolean(bool value)
Writes a boolean to the bytes message stream as a 1-byte value.
virtual void writeByte(unsigned char value)
Writes a byte to the bytes message stream as a 1-byte value.
virtual void writeInt(int value)
Writes a signed int to the bytes message stream as a 4 byte value.
virtual void writeUTF(const std::string &value)
Writes an UTF String to the BytesMessage stream.
virtual void writeLong(long long value)
Writes a long long to the bytes message stream as a 8 byte value.
virtual bool equals(const DataStructure *value) const
Compares the DataStructure passed in to this one, and returns if they are equivalent.
virtual unsigned char readByte() const
Reads a Byte from the Bytes message stream.
virtual void writeString(const std::string &value)
Writes an ASCII String to the Bytes message stream.
virtual unsigned short readUnsignedShort() const
Reads a 16 bit unsigned short from the Bytes message stream.
virtual long long readLong() const
Reads a 64 bit long from the Bytes message stream.
virtual void clearBody()
Clears out the body of the message.
virtual double readDouble() const
Reads a 64 bit double from the Bytes message stream.
virtual short readShort() const
Reads a 16 bit signed short from the Bytes message stream.
virtual int getBodyLength() const
Returns the number of bytes contained in the body of this message.
virtual void copyDataStructure(const DataStructure *src)
Copy the contents of the passed object into this objects members, overwriting any existing data.
ActiveMQMessageTemplate()
Definition ActiveMQMessageTemplate.h:48
Definition DataStructure.h:27
Definition ByteArrayOutputStream.h:31
Definition ActiveMQBlobMessage.h:28
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