activemq-cpp-3.9.5
ActiveMQConstants.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006 The Apache Software Foundation or its licensors, as
3  * applicable.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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 #ifndef _ACTIVEMQ_CORE_ACTIVEMQCONSTANTS_H_
18 #define _ACTIVEMQ_CORE_ACTIVEMQCONSTANTS_H_
19 
20 #include <string>
21 #include <map>
22 #include <activemq/util/Config.h>
23 
24 namespace activemq {
25 namespace core {
26 
33  public:
34 
35  // Flags to indicate Transaction States.
37  TRANSACTION_STATE_BEGIN = 0,
38  TRANSACTION_STATE_PREPARE = 1,
39  TRANSACTION_STATE_COMMITONEPHASE = 2,
40  TRANSACTION_STATE_COMMITTWOPHASE = 3,
41  TRANSACTION_STATE_ROLLBACK = 4,
42  TRANSACTION_STATE_RECOVER = 5,
43  TRANSACTION_STATE_FORGET = 6,
44  TRANSACTION_STATE_END = 7
45  };
46 
47  // Flags to be applied when sending the Destination Info Command.
49  DESTINATION_ADD_OPERATION = 0,
50  DESTINATION_REMOVE_OPERATION = 1
51  };
52 
53  // Represents the Acknowledgment types that are supported for the
54  // Message Ack Command.
55  enum AckType {
56  ACK_TYPE_DELIVERED = 0, // Message delivered but not consumed
57  ACK_TYPE_POISON = 1, // Message could not be processed due to
58  // poison pill but discard anyway
59  ACK_TYPE_CONSUMED = 2, // Message consumed, discard
60  ACK_TYPE_REDELIVERED = 3, // Message has been re-delivered.
61  ACK_TYPE_INDIVIDUAL = 4, // Acks a single message at a time.
62  ACK_TYPE_UNMATCHED = 5, // Durable sub doesn't match selector
63  ACK_TYPE_EXPIRED = 6 // Message expired.
64  };
65 
79  NUM_OPTIONS
80  };
81 
86  enum URIParam {
98  NUM_PARAMS
99  };
100 
101  static const std::string& toString(const DestinationOption option) {
102  return StaticInitializer::destOptions[option];
103  }
104 
105  static DestinationOption toDestinationOption(const std::string& option) {
106  std::map<std::string, DestinationOption>::iterator iter = StaticInitializer::destOptionMap.find(option);
107 
108  if (iter == StaticInitializer::destOptionMap.end()) {
109  return NUM_OPTIONS;
110  }
111 
112  return iter->second;
113  }
114 
115  static const std::string& toString(const URIParam option) {
116  return StaticInitializer::uriParams[option];
117  }
118 
119  static URIParam toURIOption(const std::string& option) {
120  std::map<std::string, URIParam>::iterator iter = StaticInitializer::uriParamsMap.find(option);
121 
122  if (iter == StaticInitializer::uriParamsMap.end()) {
123  return NUM_PARAMS;
124  }
125 
126  return iter->second;
127  }
128 
130  public:
132  virtual ~StaticInitializer() {}
133 
134  static std::string destOptions[NUM_OPTIONS];
135  static std::string uriParams[NUM_PARAMS];
136  static std::map<std::string, DestinationOption> destOptionMap;
137  static std::map<std::string, URIParam> uriParamsMap;
138  };
139 
140  private:
141 
142  static StaticInitializer staticInits;
143 
144  };
145 
146 }}
147 
148 #endif /*_ACTIVEMQ_CORE_ACTIVEMQCONSTANTS_H_*/
static const std::string & toString(const URIParam option)
Definition: ActiveMQConstants.h:115
static std::map< std::string, DestinationOption > destOptionMap
Definition: ActiveMQConstants.h:136
#define AMQCPP_API
Definition: Config.h:30
static std::map< std::string, URIParam > uriParamsMap
Definition: ActiveMQConstants.h:137
virtual ~StaticInitializer()
Definition: ActiveMQConstants.h:132
AckType
Definition: ActiveMQConstants.h:55
TransactionState
Definition: ActiveMQConstants.h:36
Definition: ActiveMQConstants.h:95
DestinationOption
These values represent the options that can be appended to an Destination name, i.e.
Definition: ActiveMQConstants.h:70
static URIParam toURIOption(const std::string &option)
Definition: ActiveMQConstants.h:119
URIParam
These values represent the parameters that can be added to the connection URI that affect the ActiveM...
Definition: ActiveMQConstants.h:86
Definition: ActiveMQConstants.h:129
Definition: ActiveMQConstants.h:94
Definition: ActiveMQConstants.h:73
DestinationActions
Definition: ActiveMQConstants.h:48
Definition: ActiveMQConstants.h:96
static const std::string & toString(const DestinationOption option)
Definition: ActiveMQConstants.h:101
Class holding constant values for various ActiveMQ specific things Each constant is defined as an enu...
Definition: ActiveMQConstants.h:32
static DestinationOption toDestinationOption(const std::string &option)
Definition: ActiveMQConstants.h:105