activemq-cpp-3.8.2
StompWireFormat.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_WIREFORMAT_STOMP_STOMPWIREFORMAT_H_
19 #define _ACTIVEMQ_WIREFORMAT_STOMP_STOMPWIREFORMAT_H_
20 
21 #include <activemq/util/Config.h>
25 #include <decaf/io/IOException.h>
26 #include <decaf/lang/Pointer.h>
27 
28 namespace activemq {
29 namespace wireformat {
30 namespace stomp {
31 
34 
35  class StompHelper;
36  class StompWireformatProperties;
37 
39  private:
40 
44  StompHelper* helper;
45 
46  // Stored after we connect to use when validating that a durable subscribe
47  // and unsubscribe are set to use the client Id.
48  std::string clientId;
49 
50  // Indicates when we are in the doUnmarshal call
52 
53  // Internal structure for holding class internal data that can change without
54  // affecting binary compatibility.
55  StompWireformatProperties* properties;
56 
57  private:
58 
60  StompWireFormat& operator=(const StompWireFormat&);
61 
62  public:
63 
65 
66  virtual ~StompWireFormat();
67 
68  public:
69 
83  virtual void marshal(const Pointer<commands::Command> command,
84  const activemq::transport::Transport* transport,
86 
97  virtual Pointer<commands::Command> unmarshal(const activemq::transport::Transport* transport,
99 
104  virtual void setVersion(int version AMQCPP_UNUSED) {}
105 
110  virtual int getVersion() const {
111  return 1;
112  }
113 
119  std::string getTopicPrefix() const;
120 
127  void setTopicPrefix(const std::string& prefix);
128 
134  std::string getQueuePrefix() const;
135 
142  void setQueuePrefix(const std::string& prefix);
143 
149  std::string getTempTopicPrefix() const;
150 
157  void setTempTopicPrefix(const std::string& prefix);
158 
164  std::string getTempQueuePrefix() const;
165 
172  void setTempQueuePrefix(const std::string& prefix);
173 
179  virtual bool inReceive() const {
180  return this->receiving.get();
181  }
182 
188  virtual bool hasNegotiator() const {
189  return false;
190  }
191 
198  virtual Pointer<transport::Transport> createNegotiator(
199  const Pointer<transport::Transport> transport);
200 
201  private:
202 
203  Pointer<Command> unmarshalMessage(const Pointer<StompFrame> frame);
204  Pointer<Command> unmarshalReceipt(const Pointer<StompFrame> frame);
205  Pointer<Command> unmarshalConnected(const Pointer<StompFrame> frame);
206  Pointer<Command> unmarshalError(const Pointer<StompFrame> frame);
207 
208  Pointer<StompFrame> marshalMessage(const Pointer<Command> command);
209  Pointer<StompFrame> marshalAck(const Pointer<Command> command);
210  Pointer<StompFrame> marshalConnectionInfo(const Pointer<Command> command);
211  Pointer<StompFrame> marshalTransactionInfo(const Pointer<Command> command);
212  Pointer<StompFrame> marshalShutdownInfo(const Pointer<Command> command);
213  Pointer<StompFrame> marshalRemoveInfo(const Pointer<Command> command);
214  Pointer<StompFrame> marshalConsumerInfo(const Pointer<Command> command);
215  Pointer<StompFrame> marshalRemoveSubscriptionInfo(const Pointer<Command> command);
216 
217  };
218 
219 }}}
220 
221 #endif /* _ACTIVEMQ_WIREFORMAT_STOMP_STOMPWIREFORMAT_H_ */
virtual bool inReceive() const
Is there a Message being unmarshaled?
Definition: StompWireFormat.h:179
virtual void setVersion(int version AMQCPP_UNUSED)
Set the Version.
Definition: StompWireFormat.h:104
virtual int getVersion() const
Get the Version.
Definition: StompWireFormat.h:110
#define AMQCPP_API
Definition: Config.h:30
Interface for a transport layer for command objects.
Definition: Transport.h:59
A data output stream lets an application write primitive Java data types to an output stream in a por...
Definition: DataOutputStream.h:34
A boolean value that may be updated atomically.
Definition: AtomicBoolean.h:34
A data input stream lets an application read primitive Java data types from an underlying input strea...
Definition: DataInputStream.h:46
Definition: StompWireFormat.h:38
Definition: Command.h:33
Provides a mechanism to marshal commands into and out of packets or into and out of streams...
Definition: WireFormat.h:43
virtual bool hasNegotiator() const
Returns true if this WireFormat has a Negotiator that needs to wrap the Transport that uses it...
Definition: StompWireFormat.h:188
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Utility Methods used when marshaling to and from StompFrame&#39;s.
Definition: StompHelper.h:51
bool get() const
Gets the current value of this AtomicBoolean.
Definition: AtomicBoolean.h:63
Decaf&#39;s implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53