summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2011-03-15 01:49:37 +0000
committerAlan Conway <aconway@apache.org>2011-03-15 01:49:37 +0000
commita537010f4dc49fbcb05820eefa132c879f96b7ba (patch)
treef2d58ff36aa968d461b284d2b74a534cfaf077eb /cpp/src/qpid/cluster
parent5f3fc9ce1861acb0ccb912f9a2326c82f0ad760c (diff)
downloadqpid-python-a537010f4dc49fbcb05820eefa132c879f96b7ba.tar.gz
NO-JIRA: Refactor RefCountedBuffer to be simpler and more flexible.
RefCountedBuffer::pointer is replaced by a separate class BufferRef. BufferRef is independent of RefCountedBuffer, it can be used to manage other reference-counted buffer classes e.g. to implement buffer pools. BufferRef also provides beginning and end of the buffer, not just beginning. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1081631 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster')
-rw-r--r--cpp/src/qpid/cluster/Event.cpp5
-rw-r--r--cpp/src/qpid/cluster/Event.h12
2 files changed, 9 insertions, 8 deletions
diff --git a/cpp/src/qpid/cluster/Event.cpp b/cpp/src/qpid/cluster/Event.cpp
index cd775ce2f1..da2bc89d8c 100644
--- a/cpp/src/qpid/cluster/Event.cpp
+++ b/cpp/src/qpid/cluster/Event.cpp
@@ -7,9 +7,9 @@
* 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
@@ -23,6 +23,7 @@
#include "qpid/cluster/Cpg.h"
#include "qpid/framing/Buffer.h"
#include "qpid/framing/AMQFrame.h"
+#include "qpid/RefCountedBuffer.h"
#include "qpid/assert.h"
#include <ostream>
#include <iterator>
diff --git a/cpp/src/qpid/cluster/Event.h b/cpp/src/qpid/cluster/Event.h
index c2dca073d1..13283edff7 100644
--- a/cpp/src/qpid/cluster/Event.h
+++ b/cpp/src/qpid/cluster/Event.h
@@ -23,7 +23,7 @@
*/
#include "qpid/cluster/types.h"
-#include "qpid/RefCountedBuffer.h"
+#include "qpid/BufferRef.h"
#include "qpid/framing/AMQFrame.h"
#include <sys/uio.h> // For iovec
#include <iosfwd>
@@ -88,12 +88,12 @@ class Event : public EventHeader {
static Event control(const framing::AMQFrame&, const ConnectionId&);
// Data excluding header.
- char* getData() { return store + HEADER_SIZE; }
- const char* getData() const { return store + HEADER_SIZE; }
+ char* getData() { return store.begin() + HEADER_SIZE; }
+ const char* getData() const { return store.begin() + HEADER_SIZE; }
// Store including header
- char* getStore() { return store; }
- const char* getStore() const { return store; }
+ char* getStore() { return store.begin(); }
+ const char* getStore() const { return store.begin(); }
const framing::AMQFrame& getFrame() const;
@@ -104,7 +104,7 @@ class Event : public EventHeader {
private:
void encodeHeader() const;
- RefCountedBuffer::pointer store;
+ BufferRef store;
mutable framing::AMQFrame frame;
};