activemq-cpp-3.9.5
ActiveMQStreamMessage.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_ACTIVEMQSTREAMMESSAGE_H_
19#define _ACTIVEMQ_COMMANDS_ACTIVEMQSTREAMMESSAGE_H_
20
24#include <cms/StreamMessage.h>
32#include <string>
33#include <memory>
34
35namespace activemq {
36namespace commands {
37
38 class ActiveMQStreamMessageImpl;
39
40 class AMQCPP_API ActiveMQStreamMessage: public ActiveMQMessageTemplate<cms::StreamMessage> {
41 private:
42
43 ActiveMQStreamMessageImpl* impl;
44
45 mutable std::auto_ptr<decaf::io::DataInputStream> dataIn;
46 mutable std::auto_ptr<decaf::io::DataOutputStream> dataOut;
47
48 public:
49
50 const static unsigned char ID_ACTIVEMQSTREAMMESSAGE;
51
52 private:
53
54 ActiveMQStreamMessage(const ActiveMQStreamMessage&);
55 ActiveMQStreamMessage& operator=(const ActiveMQStreamMessage&);
56
57 public:
58
60
61 virtual ~ActiveMQStreamMessage() throw ();
62
63 virtual unsigned char getDataStructureType() const;
64
65 virtual ActiveMQStreamMessage* cloneDataStructure() const;
66
68
69 virtual std::string toString() const;
70
71 virtual bool equals(const DataStructure* value) const;
72
73 virtual void onSend();
74
75 public: // CMS Message
76
77 virtual cms::StreamMessage* clone() const;
78
79 virtual void clearBody();
80
81 public: // CMS Stream Message
82
84
85 virtual void reset();
86
87 virtual bool readBoolean() const;
88
89 virtual void writeBoolean(bool value);
90
91 virtual unsigned char readByte() const;
92
93 virtual void writeByte(unsigned char value);
94
95 virtual int readBytes(std::vector<unsigned char>& value) const;
96
97 virtual void writeBytes(const std::vector<unsigned char>& value);
98
99 virtual int readBytes(unsigned char* buffer, int length) const;
100
101 virtual void writeBytes(const unsigned char* value, int offset, int length);
102
103 virtual char readChar() const;
104
105 virtual void writeChar(char value);
106
107 virtual float readFloat() const;
108
109 virtual void writeFloat(float value);
110
111 virtual double readDouble() const;
112
113 virtual void writeDouble(double value);
114
115 virtual short readShort() const;
116
117 virtual void writeShort(short value);
118
119 virtual unsigned short readUnsignedShort() const;
120
121 virtual void writeUnsignedShort(unsigned short value);
122
123 virtual int readInt() const;
124
125 virtual void writeInt(int value);
126
127 virtual long long readLong() const;
128
129 virtual void writeLong(long long value);
130
131 virtual std::string readString() const;
132
133 virtual void writeString(const std::string& value);
134
135 private:
136
137 void storeContent();
138
139 void initializeReading() const;
140
141 void initializeWriting();
142
143 };
144
145}}
146
147#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQSTREAMMESSAGE_H_*/
#define AMQCPP_API
Definition Config.h:30
ActiveMQMessageTemplate()
Definition ActiveMQMessageTemplate.h:48
virtual ValueType getNextValueType() const
Returns the value type for the element in the StreamMessage.
virtual void clearBody()
Clears out the body of the message.
virtual bool readBoolean() const
Reads a Boolean from the Stream message stream.
virtual void writeLong(long long value)
Writes a long long to the Stream message stream as a 8 byte value.
virtual unsigned short readUnsignedShort() const
Reads a 16 bit unsigned short from the Stream message stream.
static const unsigned char ID_ACTIVEMQSTREAMMESSAGE
Definition ActiveMQStreamMessage.h:50
virtual void writeDouble(double value)
Writes a double to the Stream message stream as a 8 byte value.
virtual cms::StreamMessage * clone() const
Clone this message exactly, returns a new instance that the caller is required to delete.
virtual unsigned char getDataStructureType() const
Get the DataStructure Type as defined in CommandTypes.h.
virtual void writeFloat(float value)
Writes a float to the Stream message stream as a 4 byte value.
virtual void writeInt(int value)
Writes a signed int to the Stream message stream as a 4 byte value.
virtual int readInt() const
Reads a 32 bit signed integer from the Stream message stream.
virtual void writeUnsignedShort(unsigned short value)
Writes a unsigned short to the Stream message stream as a 2 byte value.
virtual short readShort() const
Reads a 16 bit signed short from the Stream message stream.
virtual void writeChar(char value)
Writes a char to the Stream message stream as a 1-byte value.
virtual void copyDataStructure(const DataStructure *src)
Copy the contents of the passed object into this objects members, overwriting any existing data.
virtual bool equals(const DataStructure *value) const
Compares the DataStructure passed in to this one, and returns if they are equivalent.
virtual std::string readString() const
Reads an ASCII String from the Stream message stream.
virtual void writeString(const std::string &value)
Writes an ASCII String to the Stream message stream.
virtual float readFloat() const
Reads a 32 bit float from the Stream message stream.
virtual int readBytes(std::vector< unsigned char > &value) const
Reads a byte array from the Stream message stream.
virtual void onSend()
Allows derived Message classes to perform tasks before a message is sent.
virtual char readChar() const
Reads a Char from the Stream message stream.
virtual void reset()
Puts the message body in read-only mode and repositions the stream of bytes to the beginning.
virtual long long readLong() const
Reads a 64 bit long from the Stream message stream.
virtual unsigned char readByte() const
Reads a Byte from the Stream message stream.
virtual void writeShort(short value)
Writes a signed short to the Stream message stream as a 2 byte value.
virtual ActiveMQStreamMessage * cloneDataStructure() const
Clone this obbject and return a new instance that the caller now owns, this will be an exact copy of ...
virtual void writeByte(unsigned char value)
Writes a byte to the Stream message stream as a 1-byte value.
virtual std::string toString() const
Returns a string containing the information for this DataStructure such as its type and value of its ...
virtual double readDouble() const
Reads a 64 bit double from the Stream message stream.
virtual void writeBytes(const std::vector< unsigned char > &value)
Writes a byte array to the Stream message stream using the vector size as the number of bytes to writ...
virtual void writeBoolean(bool value)
Writes a boolean to the Stream message stream as a 1-byte value.
Definition DataStructure.h:27
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
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