summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qmf/SequenceManager.h
diff options
context:
space:
mode:
authorAidan Skinner <aidan@apache.org>2009-09-09 13:05:43 +0000
committerAidan Skinner <aidan@apache.org>2009-09-09 13:05:43 +0000
commitc1ebe66bfab328c5192a35c21ea290b5c45f40f5 (patch)
tree6e61e50d92442f29287a82c22b54de6beac43b2c /qpid/cpp/src/qmf/SequenceManager.h
parent7b28732091473d93ce7546c70fa1d2dbd685161a (diff)
downloadqpid-python-c1ebe66bfab328c5192a35c21ea290b5c45f40f5.tar.gz
Merge from trunk
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-network-refactor@812936 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qmf/SequenceManager.h')
-rw-r--r--qpid/cpp/src/qmf/SequenceManager.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/qpid/cpp/src/qmf/SequenceManager.h b/qpid/cpp/src/qmf/SequenceManager.h
new file mode 100644
index 0000000000..c027872313
--- /dev/null
+++ b/qpid/cpp/src/qmf/SequenceManager.h
@@ -0,0 +1,52 @@
+#ifndef _QmfSequenceManager_
+#define _QmfSequenceManager_
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "qpid/sys/Mutex.h"
+#include <map>
+
+namespace qmf {
+
+ class SequenceContext {
+ public:
+ SequenceContext() {}
+ virtual ~SequenceContext() {}
+
+ virtual void complete() = 0;
+ };
+
+ class SequenceManager {
+ public:
+ SequenceManager();
+
+ uint32_t reserve(SequenceContext* ctx);
+ void release(uint32_t sequence);
+
+ private:
+ mutable qpid::sys::Mutex lock;
+ uint32_t nextSequence;
+ std::map<uint32_t, SequenceContext*> contextMap;
+ };
+
+}
+
+#endif
+