activemq-cpp-3.8.2
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 Acknowledgement 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  };
63 
77  NUM_OPTIONS
78  };
79 
84  enum URIParam {
95  NUM_PARAMS
96  };
97 
98  static const std::string& toString(const DestinationOption option) {
99  return StaticInitializer::destOptions[option];
100  }
101 
102  static DestinationOption toDestinationOption(const std::string& option) {
103  std::map<std::string, DestinationOption>::iterator iter = StaticInitializer::destOptionMap.find(option);
104 
105  if (iter == StaticInitializer::destOptionMap.end()) {
106  return NUM_OPTIONS;
107  }
108 
109  return iter->second;
110  }
111 
112  static const std::string& toString(const URIParam option) {
113  return StaticInitializer::uriParams[option];
114  }
115 
116  static URIParam toURIOption(const std::string& option) {
117  std::map<std::string, URIParam>::iterator iter = StaticInitializer::uriParamsMap.find(option);
118 
119  if (iter == StaticInitializer::uriParamsMap.end()) {
120  return NUM_PARAMS;
121  }
122 
123  return iter->second;
124  }
125 
127  public:
129  virtual ~StaticInitializer() {}
130 
131  static std::string destOptions[NUM_OPTIONS];
132  static std::string uriParams[NUM_PARAMS];
133  static std::map<std::string, DestinationOption> destOptionMap;
134  static std::map<std::string, URIParam> uriParamsMap;
135  };
136 
137  private:
138 
139  static StaticInitializer staticInits;
140 
141  };
142 
143 }}
144 
145 #endif /*_ACTIVEMQ_CORE_ACTIVEMQCONSTANTS_H_*/
static const std::string & toString(const URIParam option)
Definition: ActiveMQConstants.h:112
static std::map< std::string, DestinationOption > destOptionMap
Definition: ActiveMQConstants.h:133
#define AMQCPP_API
Definition: Config.h:30
static std::map< std::string, URIParam > uriParamsMap
Definition: ActiveMQConstants.h:134
virtual ~StaticInitializer()
Definition: ActiveMQConstants.h:129
AckType
Definition: ActiveMQConstants.h:55
TransactionState
Definition: ActiveMQConstants.h:36
Definition: ActiveMQConstants.h:93
DestinationOption
These values represent the options that can be appended to an Destination name, i.e.
Definition: ActiveMQConstants.h:68
static URIParam toURIOption(const std::string &option)
Definition: ActiveMQConstants.h:116
URIParam
These values represent the parameters that can be added to the connection URI that affect the ActiveM...
Definition: ActiveMQConstants.h:84
Definition: ActiveMQConstants.h:126
Definition: ActiveMQConstants.h:92
Definition: ActiveMQConstants.h:71
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
DestinationActions
Definition: ActiveMQConstants.h:48
Definition: ActiveMQConstants.h:94
static const std::string & toString(const DestinationOption option)
Definition: ActiveMQConstants.h:98
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:102