summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/amqp_0_10/Segment.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-04-07 23:22:36 +0000
committerAlan Conway <aconway@apache.org>2008-04-07 23:22:36 +0000
commit61d800d451a1f33fba781fbf5716ec97ff5adf7c (patch)
treefa70e501f27ad1afbc5f5f65c304cb53de5be99f /cpp/src/qpid/amqp_0_10/Segment.cpp
parent4c79a7d7d717cf28029237de6073c65670c2d7e9 (diff)
downloadqpid-python-61d800d451a1f33fba781fbf5716ec97ff5adf7c.tar.gz
src/qpid/amqp_0_10/Body.h, Header.h: placeholders.
src/qpid/amqp_0_10/Unit.h,.cpp - Decode "units" - command/control/header segments or body frames. Equivalent to preview AMQFrame class. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@645733 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/amqp_0_10/Segment.cpp')
-rw-r--r--cpp/src/qpid/amqp_0_10/Segment.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/cpp/src/qpid/amqp_0_10/Segment.cpp b/cpp/src/qpid/amqp_0_10/Segment.cpp
deleted file mode 100644
index 8eebeb276d..0000000000
--- a/cpp/src/qpid/amqp_0_10/Segment.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * 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 "Segment.h"
-#include "qpid/Exception.h"
-#include <boost/ref.hpp>
-#include <numeric>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-Segment::Segment() : missing() {}
-
-bool Segment::isComplete() const {
- return missing || (!frames.empty() && (frames.back().testFlags(Frame::LAST_FRAME)));
-}
-
-Segment::const_iterator Segment::begin() const {
- return Segment::const_iterator(frames, frames.begin(), frames.begin()->begin());
-}
-
-Segment::const_iterator Segment::end() const {
- return const_iterator(frames, frames.end(), frames.end()->end());
-}
-
-namespace {
-Frame::Flags segFlags(const Frame& f) {
- return f.testFlags(Frame::FIRST_SEGMENT | Frame::LAST_SEGMENT);
-}
-} // namespace
-
-void Segment::add(const Frame& frame) {
- // FIXME aconway 2008-03-07: ex types & messages.
- if (isComplete()) throw Exception("cannot add frame to complete segment");
- if (!frames.empty()) {
- if (frame.testFlags(Frame::FIRST_FRAME) ||
- frame.getType() != frames.front().getType() ||
- segFlags(frames.front()) != segFlags(frame))
- throw Exception("invalid frame");
- }
- frames.push_back(frame);
-}
-
-bool Segment::isFirst() const {
- return !frames.empty() && frames.front().testFlags(Frame::FIRST_SEGMENT);
-}
-
-bool Segment::isLast() const {
- return !frames.empty() && frames.front().testFlags(Frame::LAST_SEGMENT);
-}
-
-namespace {
-size_t accumulate_size(size_t total, const Frame& f) {
- return total+f.size();
-}
-}
-
-size_t Segment::size() const {
- return std::accumulate(frames.begin(), frames.end(), 0, &accumulate_size);
-}
-
-}} // namespace qpid::amqp_0_10
-
-