summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/Buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/framing/Buffer.cpp')
-rw-r--r--cpp/src/qpid/framing/Buffer.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/cpp/src/qpid/framing/Buffer.cpp b/cpp/src/qpid/framing/Buffer.cpp
index 7eadf377b9..c0cd210042 100644
--- a/cpp/src/qpid/framing/Buffer.cpp
+++ b/cpp/src/qpid/framing/Buffer.cpp
@@ -74,6 +74,31 @@ void Buffer::putLongLong(uint64_t i){
putLong(lo);
}
+void Buffer::putFloat(float f){
+ union {
+ uint32_t i;
+ float f;
+ } val;
+
+ val.f = f;
+ putLong (val.i);
+}
+
+void Buffer::putDouble(double f){
+ union {
+ uint64_t i;
+ double f;
+ } val;
+
+ val.f = f;
+ putLongLong (val.i);
+}
+
+void Buffer::putBin128(uint8_t* b){
+ memcpy (data + position, b, 16);
+ position += 16;
+}
+
uint8_t Buffer::getOctet(){
return (uint8_t) data[position++];
}
@@ -104,6 +129,24 @@ uint64_t Buffer::getLongLong(){
return hi | lo;
}
+float Buffer::getFloat(){
+ union {
+ uint32_t i;
+ float f;
+ } val;
+ val.i = getLong();
+ return val.f;
+}
+
+double Buffer::getDouble(){
+ union {
+ uint64_t i;
+ double f;
+ } val;
+ val.i = getLongLong();
+ return val.f;
+}
+
template <>
uint64_t Buffer::getUInt<1>() {
return getOctet();
@@ -172,6 +215,11 @@ void Buffer::getLongString(string& s){
position += len;
}
+void Buffer::getBin128(uint8_t* b){
+ memcpy (b, data + position, 16);
+ position += 16;
+}
+
void Buffer::putRawData(const string& s){
uint32_t len = s.length();
s.copy(data + position, len);