activemq-cpp-3.9.0
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 {
97  NUM_PARAMS
98  };
99 
100  static const std::string& toString(const DestinationOption option) {
101  return StaticInitializer::destOptions[option];
102  }
103 
104  static DestinationOption toDestinationOption(const std::string& option) {
105  std::map<std::string, DestinationOption>::iterator iter = StaticInitializer::destOptionMap.find(option);
106 
107  if (iter == StaticInitializer::destOptionMap.end()) {
108  return NUM_OPTIONS;
109  }
110 
111  return iter->second;
112  }
113 
114  static const std::string& toString(const URIParam option) {
115  return StaticInitializer::uriParams[option];
116  }
117 
118  static URIParam toURIOption(const std::string& option) {
119  std::map<std::string, URIParam>::iterator iter = StaticInitializer::uriParamsMap.find(option);
120 
121  if (iter == StaticInitializer::uriParamsMap.end()) {
122  return NUM_PARAMS;
123  }
124 
125  return iter->second;
126  }
127 
129  public:
131  virtual ~StaticInitializer() {}
132 
133  static std::string destOptions[NUM_OPTIONS];
134  static std::string uriParams[NUM_PARAMS];
135  static std::map<std::string, DestinationOption> destOptionMap;
136  static std::map<std::string, URIParam> uriParamsMap;
137  };
138 
139  private:
140 
141  static StaticInitializer staticInits;
142 
143  };
144 
145 }}
146 
147 #endif /*_ACTIVEMQ_CORE_ACTIVEMQCONSTANTS_H_*/
static const std::string & toString(const URIParam option)
Definition: ActiveMQConstants.h:114
static std::map< std::string, DestinationOption > destOptionMap
Definition: ActiveMQConstants.h:135
#define AMQCPP_API
Definition: Config.h:30
static std::map< std::string, URIParam > uriParamsMap
Definition: ActiveMQConstants.h:136
virtual ~StaticInitializer()
Definition: ActiveMQConstants.h:131
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:118
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:128
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:100
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:104