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 
21 #include <activemq/util/Config.h>
26 #include <cms/BytesMessage.h>
27 #include <vector>
28 #include <string>
29 #include <memory>
30 
31 namespace activemq {
32 namespace 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 
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 
77  virtual void copyDataStructure(const DataStructure* src);
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
Definition: DataStructure.h:27
Definition: ByteArrayOutputStream.h:31
static const unsigned char ID_ACTIVEMQBYTESMESSAGE
Definition: ActiveMQBytesMessage.h:60
Definition: ActiveMQBytesMessage.h:34
#define const
Definition: zconf.h:198
Definition: ActiveMQMessageTemplate.h:41