activemq-cpp-3.8.2
BaseCommand.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_BASECOMMAND_H_
19 #define _ACTIVEMQ_COMMANDS_BASECOMMAND_H_
20 
21 #include <activemq/util/Config.h>
23 
24 namespace activemq {
25 namespace commands {
26 
27  class AMQCPP_API BaseCommand : public Command {
28  private:
29 
30  bool responseRequired;
31  int commandId;
32 
33  public:
34 
35  BaseCommand() : Command(), responseRequired(false), commandId(0) {
36  }
37 
38  virtual ~BaseCommand() {}
39 
40  virtual void setCommandId(int id) {
41  this->commandId = id;
42  }
43 
44  virtual int getCommandId() const {
45  return commandId;
46  }
47 
48  virtual void setResponseRequired(const bool required) {
49  this->responseRequired = required;
50  }
51 
52  virtual bool isResponseRequired() const {
53  return responseRequired;
54  }
55 
56  virtual void copyDataStructure(const DataStructure* src) {
57  const BaseCommand* command = dynamic_cast<const BaseCommand*> (src);
58  this->setResponseRequired(command->isResponseRequired());
59  this->setCommandId(command->getCommandId());
60  }
61 
67  virtual std::string toString() const {
68  std::ostringstream stream;
69 
70  stream << "Begin Class = BaseCommand" << std::endl;
71  stream << BaseDataStructure::toString();
72  stream << " Response Required = " << responseRequired << std::endl;
73  stream << " Command Id = " << commandId << std::endl;
74  stream << "End Class = BaseCommand" << std::endl;
75 
76  return stream.str();
77  }
78 
85  virtual bool equals(const DataStructure* value) const {
86  return BaseDataStructure::equals(value);
87  }
88 
89  virtual bool isBrokerInfo() const {
90  return false;
91  }
92  virtual bool isControlCommand() const {
93  return false;
94  }
95  virtual bool isConnectionControl() const {
96  return false;
97  }
98  virtual bool isConnectionError() const {
99  return false;
100  }
101  virtual bool isConnectionInfo() const {
102  return false;
103  }
104  virtual bool isConsumerInfo() const {
105  return false;
106  }
107  virtual bool isConsumerControl() const {
108  return false;
109  }
110  virtual bool isDestinationInfo() const {
111  return false;
112  }
113  virtual bool isFlushCommand() const {
114  return false;
115  }
116  virtual bool isMessage() const {
117  return false;
118  }
119  virtual bool isMessageAck() const {
120  return false;
121  }
122  virtual bool isMessagePull() const {
123  return false;
124  }
125  virtual bool isKeepAliveInfo() const {
126  return false;
127  }
128  virtual bool isMessageDispatch() const {
129  return false;
130  }
131  virtual bool isMessageDispatchNotification() const {
132  return false;
133  }
134  virtual bool isProducerAck() const {
135  return false;
136  }
137  virtual bool isProducerInfo() const {
138  return false;
139  }
140  virtual bool isResponse() const {
141  return false;
142  }
143  virtual bool isRemoveInfo() const {
144  return false;
145  }
146  virtual bool isRemoveSubscriptionInfo() const {
147  return false;
148  }
149  virtual bool isReplayCommand() const {
150  return false;
151  }
152  virtual bool isSessionInfo() const {
153  return false;
154  }
155  virtual bool isShutdownInfo() const {
156  return false;
157  }
158  virtual bool isTransactionInfo() const {
159  return false;
160  }
161  virtual bool isWireFormatInfo() const {
162  return false;
163  }
164 
165  };
166 
167 }}
168 
169 #endif /*_ACTIVEMQ_COMMANDS_BASECOMMAND_H_*/
virtual bool isMessageAck() const
Definition: BaseCommand.h:119
virtual bool isDestinationInfo() const
Definition: BaseCommand.h:110
virtual bool isRemoveSubscriptionInfo() const
Definition: BaseCommand.h:146
virtual bool equals(const DataStructure *value AMQCPP_UNUSED) const
Definition: BaseDataStructure.h:67
virtual int getCommandId() const
Gets the Command Id of this Message.
Definition: BaseCommand.h:44
virtual bool isWireFormatInfo() const
Definition: BaseCommand.h:161
#define AMQCPP_API
Definition: Config.h:30
virtual bool isSessionInfo() const
Definition: BaseCommand.h:152
virtual bool isReplayCommand() const
Definition: BaseCommand.h:149
virtual bool isFlushCommand() const
Definition: BaseCommand.h:113
virtual bool isConsumerInfo() const
Definition: BaseCommand.h:104
virtual std::string toString() const
Returns a string containing the information for this DataStructure such as its type and value of its ...
Definition: BaseCommand.h:67
virtual bool isConsumerControl() const
Definition: BaseCommand.h:107
virtual void copyDataStructure(const DataStructure *src)
Copy the contents of the passed object into this objects members, overwriting any existing data...
Definition: BaseCommand.h:56
virtual bool isConnectionInfo() const
Definition: BaseCommand.h:101
BaseCommand()
Definition: BaseCommand.h:35
virtual bool isMessage() const
Definition: BaseCommand.h:116
Definition: DataStructure.h:27
virtual bool isRemoveInfo() const
Definition: BaseCommand.h:143
virtual std::string toString() const
Returns a string containing the information for this DataStructure such as its type and value of its ...
Definition: BaseDataStructure.h:63
virtual bool isMessageDispatchNotification() const
Definition: BaseCommand.h:131
Definition: BaseCommand.h:27
virtual bool isControlCommand() const
Definition: BaseCommand.h:92
virtual bool isProducerAck() const
Definition: BaseCommand.h:134
virtual bool isResponseRequired() const
Is a Response required for this Command.
Definition: BaseCommand.h:52
virtual bool isMessagePull() const
Definition: BaseCommand.h:122
virtual bool isKeepAliveInfo() const
Definition: BaseCommand.h:125
virtual void setCommandId(int id)
Sets the Command Id of this Message.
Definition: BaseCommand.h:40
virtual bool isMessageDispatch() const
Definition: BaseCommand.h:128
virtual bool isBrokerInfo() const
Definition: BaseCommand.h:89
Definition: Command.h:33
virtual void setResponseRequired(const bool required)
Set if this Message requires a Response.
Definition: BaseCommand.h:48
virtual ~BaseCommand()
Definition: BaseCommand.h:38
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
virtual bool isResponse() const
Definition: BaseCommand.h:140
virtual bool isShutdownInfo() const
Definition: BaseCommand.h:155
virtual bool isConnectionControl() const
Definition: BaseCommand.h:95
virtual bool isProducerInfo() const
Definition: BaseCommand.h:137
virtual bool equals(const DataStructure *value) const
Compares the DataStructure passed in to this one, and returns if they are equivalent.
Definition: BaseCommand.h:85
virtual bool isConnectionError() const
Definition: BaseCommand.h:98
virtual bool isTransactionInfo() const
Definition: BaseCommand.h:158