summaryrefslogtreecommitdiff
path: root/cpp/lib/broker
diff options
context:
space:
mode:
authorCarl C. Trieloff <cctrieloff@apache.org>2007-01-09 19:44:50 +0000
committerCarl C. Trieloff <cctrieloff@apache.org>2007-01-09 19:44:50 +0000
commit879413783bf64537e3a1c7d036e2fb34700cc4e5 (patch)
treedd10e99b938ed82523bf878d05edcc6e06f90231 /cpp/lib/broker
parentcb148a3cf74760e2af234896825cc117f13c506e (diff)
downloadqpid-python-879413783bf64537e3a1c7d036e2fb34700cc4e5.tar.gz
Most of remaining version changes for C++. Still need to deal with AMQFrame
defualt constructor and do some clean up here and there.. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@494540 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/broker')
-rw-r--r--cpp/lib/broker/BrokerMessage.cpp14
-rw-r--r--cpp/lib/broker/BrokerMessage.h2
-rw-r--r--cpp/lib/broker/Content.h3
-rw-r--r--cpp/lib/broker/InMemoryContent.cpp8
-rw-r--r--cpp/lib/broker/InMemoryContent.h3
-rw-r--r--cpp/lib/broker/LazyLoadedContent.cpp6
-rw-r--r--cpp/lib/broker/LazyLoadedContent.h2
7 files changed, 20 insertions, 18 deletions
diff --git a/cpp/lib/broker/BrokerMessage.cpp b/cpp/lib/broker/BrokerMessage.cpp
index 7fef77e1ff..6ba2131a74 100644
--- a/cpp/lib/broker/BrokerMessage.cpp
+++ b/cpp/lib/broker/BrokerMessage.cpp
@@ -80,8 +80,8 @@ void Message::deliver(OutputHandler* out, int channel,
u_int32_t framesize,
ProtocolVersion* version){
// CCT -- TODO - Update code generator to take pointer/ not instance to avoid extra contruction
- out->send(new AMQFrame(channel, new BasicDeliverBody(*version, consumerTag, deliveryTag, redelivered, exchange, routingKey)));
- sendContent(out, channel, framesize);
+ out->send(new AMQFrame(*version, channel, new BasicDeliverBody(*version, consumerTag, deliveryTag, redelivered, exchange, routingKey)));
+ sendContent(out, channel, framesize, version);
}
void Message::sendGetOk(OutputHandler* out,
@@ -91,16 +91,16 @@ void Message::sendGetOk(OutputHandler* out,
u_int32_t framesize,
ProtocolVersion* version){
// CCT -- TODO - Update code generator to take pointer/ not instance to avoid extra contruction
- out->send(new AMQFrame(channel, new BasicGetOkBody(*version, deliveryTag, redelivered, exchange, routingKey, messageCount)));
- sendContent(out, channel, framesize);
+ out->send(new AMQFrame(*version, channel, new BasicGetOkBody(*version, deliveryTag, redelivered, exchange, routingKey, messageCount)));
+ sendContent(out, channel, framesize, version);
}
-void Message::sendContent(OutputHandler* out, int channel, u_int32_t framesize){
+void Message::sendContent(OutputHandler* out, int channel, u_int32_t framesize, ProtocolVersion* version){
AMQBody::shared_ptr headerBody = static_pointer_cast<AMQBody, AMQHeaderBody>(header);
- out->send(new AMQFrame(channel, headerBody));
+ out->send(new AMQFrame(*version, channel, headerBody));
Mutex::ScopedLock locker(contentLock);
- if (content.get()) content->send(out, channel, framesize);
+ if (content.get()) content->send(*version, out, channel, framesize);
}
BasicHeaderProperties* Message::getHeaderProperties(){
diff --git a/cpp/lib/broker/BrokerMessage.h b/cpp/lib/broker/BrokerMessage.h
index 39142546bc..1f68e1004a 100644
--- a/cpp/lib/broker/BrokerMessage.h
+++ b/cpp/lib/broker/BrokerMessage.h
@@ -58,7 +58,7 @@ namespace qpid {
qpid::sys::Mutex contentLock;
void sendContent(qpid::framing::OutputHandler* out,
- int channel, u_int32_t framesize);
+ int channel, u_int32_t framesize, qpid::framing::ProtocolVersion* version);
public:
typedef boost::shared_ptr<Message> shared_ptr;
diff --git a/cpp/lib/broker/Content.h b/cpp/lib/broker/Content.h
index b5712c35ed..8aacf02959 100644
--- a/cpp/lib/broker/Content.h
+++ b/cpp/lib/broker/Content.h
@@ -24,6 +24,7 @@
#include <AMQContentBody.h>
#include <Buffer.h>
#include <OutputHandler.h>
+#include <ProtocolVersion.h>
namespace qpid {
namespace broker {
@@ -31,7 +32,7 @@ namespace qpid {
public:
virtual void add(qpid::framing::AMQContentBody::shared_ptr data) = 0;
virtual u_int32_t size() = 0;
- virtual void send(qpid::framing::OutputHandler* out, int channel, u_int32_t framesize) = 0;
+ virtual void send(qpid::framing::ProtocolVersion& version, qpid::framing::OutputHandler* out, int channel, u_int32_t framesize) = 0;
virtual void encode(qpid::framing::Buffer& buffer) = 0;
virtual void destroy() = 0;
virtual ~Content(){}
diff --git a/cpp/lib/broker/InMemoryContent.cpp b/cpp/lib/broker/InMemoryContent.cpp
index 8826b42d2c..07af8633e5 100644
--- a/cpp/lib/broker/InMemoryContent.cpp
+++ b/cpp/lib/broker/InMemoryContent.cpp
@@ -38,24 +38,24 @@ u_int32_t InMemoryContent::size()
return sum;
}
-void InMemoryContent::send(OutputHandler* out, int channel, u_int32_t framesize)
+void InMemoryContent::send(qpid::framing::ProtocolVersion& version, OutputHandler* out, int channel, u_int32_t framesize)
{
for (content_iterator i = content.begin(); i != content.end(); i++) {
if ((*i)->size() > framesize) {
u_int32_t offset = 0;
for (int chunk = (*i)->size() / framesize; chunk > 0; chunk--) {
string data = (*i)->getData().substr(offset, framesize);
- out->send(new AMQFrame(channel, new AMQContentBody(data)));
+ out->send(new AMQFrame(version, channel, new AMQContentBody(data)));
offset += framesize;
}
u_int32_t remainder = (*i)->size() % framesize;
if (remainder) {
string data = (*i)->getData().substr(offset, remainder);
- out->send(new AMQFrame(channel, new AMQContentBody(data)));
+ out->send(new AMQFrame(version, channel, new AMQContentBody(data)));
}
} else {
AMQBody::shared_ptr contentBody = static_pointer_cast<AMQBody, AMQContentBody>(*i);
- out->send(new AMQFrame(channel, contentBody));
+ out->send(new AMQFrame(version, channel, contentBody));
}
}
}
diff --git a/cpp/lib/broker/InMemoryContent.h b/cpp/lib/broker/InMemoryContent.h
index 79c7cf670b..1db1acd7e1 100644
--- a/cpp/lib/broker/InMemoryContent.h
+++ b/cpp/lib/broker/InMemoryContent.h
@@ -24,6 +24,7 @@
#include <Content.h>
#include <vector>
+
namespace qpid {
namespace broker {
class InMemoryContent : public Content{
@@ -34,7 +35,7 @@ namespace qpid {
public:
void add(qpid::framing::AMQContentBody::shared_ptr data);
u_int32_t size();
- void send(qpid::framing::OutputHandler* out, int channel, u_int32_t framesize);
+ void send(qpid::framing::ProtocolVersion& version, qpid::framing::OutputHandler* out, int channel, u_int32_t framesize);
void encode(qpid::framing::Buffer& buffer);
void destroy();
~InMemoryContent(){}
diff --git a/cpp/lib/broker/LazyLoadedContent.cpp b/cpp/lib/broker/LazyLoadedContent.cpp
index 51aa6c590b..ec1ca3e195 100644
--- a/cpp/lib/broker/LazyLoadedContent.cpp
+++ b/cpp/lib/broker/LazyLoadedContent.cpp
@@ -36,19 +36,19 @@ u_int32_t LazyLoadedContent::size()
return 0;//all content is written as soon as it is added
}
-void LazyLoadedContent::send(OutputHandler* out, int channel, u_int32_t framesize)
+void LazyLoadedContent::send(qpid::framing::ProtocolVersion& version, OutputHandler* out, int channel, u_int32_t framesize)
{
if (expectedSize > framesize) {
for (u_int64_t offset = 0; offset < expectedSize; offset += framesize) {
u_int64_t remaining = expectedSize - offset;
string data;
store->loadContent(msg, data, offset, remaining > framesize ? framesize : remaining);
- out->send(new AMQFrame(channel, new AMQContentBody(data)));
+ out->send(new AMQFrame(version, channel, new AMQContentBody(data)));
}
} else {
string data;
store->loadContent(msg, data, 0, expectedSize);
- out->send(new AMQFrame(channel, new AMQContentBody(data)));
+ out->send(new AMQFrame(version, channel, new AMQContentBody(data)));
}
}
diff --git a/cpp/lib/broker/LazyLoadedContent.h b/cpp/lib/broker/LazyLoadedContent.h
index 68e08c7c3f..80f8cce4eb 100644
--- a/cpp/lib/broker/LazyLoadedContent.h
+++ b/cpp/lib/broker/LazyLoadedContent.h
@@ -34,7 +34,7 @@ namespace qpid {
LazyLoadedContent(MessageStore* const store, Message* const msg, u_int64_t expectedSize);
void add(qpid::framing::AMQContentBody::shared_ptr data);
u_int32_t size();
- void send(qpid::framing::OutputHandler* out, int channel, u_int32_t framesize);
+ void send(qpid::framing::ProtocolVersion& version, qpid::framing::OutputHandler* out, int channel, u_int32_t framesize);
void encode(qpid::framing::Buffer& buffer);
void destroy();
~LazyLoadedContent(){}