activemq-cpp-3.8.2
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 
35  public ActiveMQMessageTemplate< cms::BytesMessage > {
36  private:
37 
43 
47  mutable std::auto_ptr<decaf::io::DataInputStream> dataIn;
48 
52  std::auto_ptr<decaf::io::DataOutputStream> dataOut;
53 
57  mutable int length;
58 
59  public:
60 
61  const static unsigned char ID_ACTIVEMQBYTESMESSAGE = 24;
62 
63  private:
64 
66  ActiveMQBytesMessage& operator= ( const ActiveMQBytesMessage& );
67 
68  public:
69 
71 
72  virtual ~ActiveMQBytesMessage() throw();
73 
74  virtual unsigned char getDataStructureType() const;
75 
76  virtual ActiveMQBytesMessage* cloneDataStructure() const;
77 
78  virtual void copyDataStructure( const DataStructure* src );
79 
80  virtual std::string toString() const;
81 
82  virtual bool equals( const DataStructure* value ) const;
83 
84  public: // CMS Message
85 
86  virtual cms::BytesMessage* clone() const {
87  ActiveMQBytesMessage* clone = this->cloneDataStructure();
88  clone->setReadOnlyBody(false);
89  clone->setReadOnlyProperties(false);
90  return dynamic_cast<cms::BytesMessage*>(clone);
91  }
92 
93  virtual void clearBody();
94 
95  virtual void onSend();
96 
97  public: // CMS BytesMessage
98 
99  virtual void setBodyBytes( const unsigned char* buffer, int numBytes );
100 
101  virtual unsigned char* getBodyBytes() const;
102 
103  virtual int getBodyLength() const;
104 
105  virtual void reset();
106 
107  virtual bool readBoolean() const;
108 
109  virtual void writeBoolean( bool value );
110 
111  virtual unsigned char readByte() const;
112 
113  virtual void writeByte( unsigned char value );
114 
115  virtual int readBytes( std::vector<unsigned char>& value ) const;
116 
117  virtual void writeBytes( const std::vector<unsigned char>& value );
118 
119  virtual int readBytes( unsigned char* buffer, int length ) const;
120 
121  virtual void writeBytes( const unsigned char* value, int offset, int length );
122 
123  virtual char readChar() const;
124 
125  virtual void writeChar( char value );
126 
127  virtual float readFloat() const;
128 
129  virtual void writeFloat( float value );
130 
131  virtual double readDouble() const;
132 
133  virtual void writeDouble( double value );
134 
135  virtual short readShort() const;
136 
137  virtual void writeShort( short value );
138 
139  virtual unsigned short readUnsignedShort() const;
140 
141  virtual void writeUnsignedShort( unsigned short value );
142 
143  virtual int readInt() const;
144 
145  virtual void writeInt( int value );
146 
147  virtual long long readLong() const;
148 
149  virtual void writeLong( long long value );
150 
151  virtual std::string readString() const;
152 
153  virtual void writeString( const std::string& value );
154 
155  virtual std::string readUTF() const;
156 
157  virtual void writeUTF( const std::string& value );
158 
159  private:
160 
161  void storeContent();
162 
163  void initializeReading() const;
164 
165  void initializeWriting();
166 
167  };
168 
169 }}
170 
171 #endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQBYTESMESSAGE_H_*/
#define AMQCPP_API
Definition: Config.h:30
Definition: ArrayPointer.h:432
A BytesMessage object is used to send a message containing a stream of unsigned bytes.
Definition: BytesMessage.h:66
Definition: DataStructure.h:27
Definition: ByteArrayOutputStream.h:31
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: DestinationResolver.h:23
Definition: ActiveMQBytesMessage.h:34
void setReadOnlyBody(bool value)
Set the Read Only State of the Message Content.
Definition: Message.h:270
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
#define const
Definition: zconf.h:198
Definition: ActiveMQMessageTemplate.h:41
void setReadOnlyProperties(bool value)
Set the Read Only State of the Message Properties.
Definition: Message.h:254