You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2007/02/07 22:59:23 UTC
svn commit: r504708 - in /incubator/qpid/branches/qpid.0-9/cpp/lib/broker:
BrokerMessage.cpp Content.h InMemoryContent.cpp InMemoryContent.h
LazyLoadedContent.cpp LazyLoadedContent.h
Author: aconway
Date: Wed Feb 7 13:59:22 2007
New Revision: 504708
URL: http://svn.apache.org/viewvc?view=rev&rev=504708
Log:
* cpp/lib/broker/Content.h: removed destroy. Destructor cleans up.
* cpp/lib/broker/BrokerMessage.cpp: Removed Content::destroy call,
* cpp/lib/broker/InMemoryContent.cpp/.h: Remove empty destroy() and destructor.
* cpp/lib/broker/LazyLoadedContent.cpp/.h: Moved destroy() to destructor
Modified:
incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessage.cpp
incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Content.h
incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.cpp
incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.h
incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.cpp
incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.h
Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessage.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessage.cpp?view=diff&rev=504708&r1=504707&r2=504708
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessage.cpp (original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/BrokerMessage.cpp Wed Feb 7 13:59:22 2007
@@ -58,9 +58,7 @@
BasicMessage::BasicMessage() : size(0)
{}
-BasicMessage::~BasicMessage(){
- if (content.get()) content->destroy();
-}
+BasicMessage::~BasicMessage(){}
void BasicMessage::setHeader(AMQHeaderBody::shared_ptr _header){
this->header = _header;
Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Content.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Content.h?view=diff&rev=504708&r1=504707&r2=504708
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Content.h (original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Content.h Wed Feb 7 13:59:22 2007
@@ -21,6 +21,8 @@
#ifndef _Content_
#define _Content_
+#include <boost/function.hpp>
+
#include <AMQContentBody.h>
#include <Buffer.h>
#include <OutputHandler.h>
@@ -34,13 +36,31 @@
namespace broker {
class Content{
public:
+ typedef std::string DataBlock;
+ typedef boost::function1<void, const DataBlock&> SendFn;
+
+ virtual ~Content(){}
+
+ /** Add a block of data to the content */
+ // FIXME aconway 2007-02-07:
+ // virtual void add(const DataBlock& data) = 0;
virtual void add(framing::AMQContentBody::shared_ptr data) = 0;
+
+ /** Total size of content in bytes */
virtual u_int32_t size() = 0;
- virtual void send(framing::ChannelAdapter& channel,
- u_int32_t framesize) = 0;
+
+ /**
+ * Iterate over the content calling SendFn for each block.
+ * Subdivide blocks if necessary to ensure each block is
+ * <= framesize bytes long.
+ */
+ // FIXME aconway 2007-02-07:
+ // virtual void send(SendFn send, u_int32_t framesize) = 0;
+ virtual void send(framing::ChannelAdapter& channel, u_int32_t framesize) = 0;
+
+ //FIXME aconway 2007-02-07: This is inconsistently implemented
+ //find out what is needed.
virtual void encode(qpid::framing::Buffer& buffer) = 0;
- virtual void destroy() = 0;
- virtual ~Content(){}
};
}}
Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.cpp?view=diff&rev=504708&r1=504707&r2=504708
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.cpp (original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.cpp Wed Feb 7 13:59:22 2007
@@ -71,6 +71,3 @@
}
}
-void InMemoryContent::destroy()
-{
-}
Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.h?view=diff&rev=504708&r1=504707&r2=504708
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.h (original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/InMemoryContent.h Wed Feb 7 13:59:22 2007
@@ -37,8 +37,6 @@
u_int32_t size();
void send(framing::ChannelAdapter&, u_int32_t framesize);
void encode(qpid::framing::Buffer& buffer);
- void destroy();
- ~InMemoryContent(){}
};
}
}
Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.cpp?view=diff&rev=504708&r1=504707&r2=504708
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.cpp (original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.cpp Wed Feb 7 13:59:22 2007
@@ -25,6 +25,11 @@
using namespace qpid::broker;
using namespace qpid::framing;
+LazyLoadedContent::~LazyLoadedContent()
+{
+ store->destroy(msg);
+}
+
LazyLoadedContent::LazyLoadedContent(MessageStore* const _store, Message* const _msg, u_int64_t _expectedSize) :
store(_store), msg(_msg), expectedSize(_expectedSize) {}
@@ -61,7 +66,3 @@
//do nothing as all content is written as soon as it is added
}
-void LazyLoadedContent::destroy()
-{
- store->destroy(msg);
-}
Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.h?view=diff&rev=504708&r1=504707&r2=504708
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.h (original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/LazyLoadedContent.h Wed Feb 7 13:59:22 2007
@@ -34,14 +34,13 @@
LazyLoadedContent(
MessageStore* const store, Message* const msg,
u_int64_t expectedSize);
+ ~LazyLoadedContent();
void add(qpid::framing::AMQContentBody::shared_ptr data);
u_int32_t size();
void send(
framing::ChannelAdapter&,
u_int32_t framesize);
void encode(qpid::framing::Buffer& buffer);
- void destroy();
- ~LazyLoadedContent(){}
};
}
}