summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2007-09-06 10:36:17 +0000
committerAndrew Stitcher <astitcher@apache.org>2007-09-06 10:36:17 +0000
commit385243182f6f4dadb14fccfae79216f17fccea9d (patch)
treeebbe1a4f63110b8bd2a2a0fa6cbca7b1aeeef447 /cpp
parent168ebfd952c0a654b1419ee76eef473318e2d6dc (diff)
downloadqpid-python-385243182f6f4dadb14fccfae79216f17fccea9d.tar.gz
* Tidy up framing::Buffer class
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@573213 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/framing/Buffer.cpp41
-rw-r--r--cpp/src/qpid/framing/Buffer.h10
2 files changed, 4 insertions, 47 deletions
diff --git a/cpp/src/qpid/framing/Buffer.cpp b/cpp/src/qpid/framing/Buffer.cpp
index 215102807e..930e3162c1 100644
--- a/cpp/src/qpid/framing/Buffer.cpp
+++ b/cpp/src/qpid/framing/Buffer.cpp
@@ -22,57 +22,24 @@
#include "FramingContent.h"
#include "FieldTable.h"
-//qpid::framing::Buffer::Buffer(uint32_t _size) : size(_size), owner(true), position(0), limit(_size){
-// data = new char[size];
-//}
-
-qpid::framing::Buffer::Buffer(char* _data, uint32_t _size) : size(_size), owner(false), data(_data), position(0), limit(_size){
-}
-
-qpid::framing::Buffer::~Buffer(){
- if(owner) delete[] data;
+qpid::framing::Buffer::Buffer(char* _data, uint32_t _size)
+ : size(_size), data(_data), position(0) {
}
-//void qpid::framing::Buffer::flip(){
-// limit = position;
-// position = 0;
-//}
-
-//void qpid::framing::Buffer::clear(){
-// limit = size;
-// position = 0;
-//}
-
-//void qpid::framing::Buffer::compact(){
-// uint32_t p = limit - position;
-// //copy p chars from position to 0
-// memmove(data, data + position, p);
-// limit = size;
-// position = p;
-//}
-
void qpid::framing::Buffer::record(){
r_position = position;
- r_limit = limit;
}
void qpid::framing::Buffer::restore(){
position = r_position;
- limit = r_limit;
}
uint32_t qpid::framing::Buffer::available(){
- return limit - position;
+ return size - position;
}
-//char* qpid::framing::Buffer::start(){
-// return data + position;
-//}
+///////////////////////////////////////////////////
-//void qpid::framing::Buffer::move(uint32_t bytes){
-// position += bytes;
-//}
-
void qpid::framing::Buffer::putOctet(uint8_t i){
data[position++] = i;
}
diff --git a/cpp/src/qpid/framing/Buffer.h b/cpp/src/qpid/framing/Buffer.h
index d1eb58f14e..b8f3ddb6a9 100644
--- a/cpp/src/qpid/framing/Buffer.h
+++ b/cpp/src/qpid/framing/Buffer.h
@@ -32,27 +32,17 @@ class FieldTable;
class Buffer
{
const uint32_t size;
- const bool owner;//indicates whether the data is owned by this instance
char* data;
uint32_t position;
- uint32_t limit;
uint32_t r_position;
- uint32_t r_limit;
public:
- //Buffer(uint32_t size);
Buffer(char* data, uint32_t size);
- ~Buffer();
- //void flip();
- //void clear();
- //void compact();
void record();
void restore();
uint32_t available();
- //char* start();
- //void move(uint32_t bytes);
void putOctet(uint8_t i);
void putShort(uint16_t i);