From 95aff00802baf393cbabfcb05198ffc5f9979460 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Mon, 23 May 2011 20:20:17 +0000
Subject: Apply patch from pgiblox in ticket #694 to fix compilation without
 Raul::IntrusivePtr:

"Since Raul::IntrusivePtr was removed, ingen_server no longer compiles. We could either add another #define for IntrusivePtr, or just use boost::intrusive_ptr directly. Going with the direct approach since server seems to use boost::shared_ptr directly as well."

I would like easy portability to c++0x pointers, but unfortunately there is no intrusive_ptr there... it's an easy search/replace anyway, so this will do for now.


git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3307 a436a847-0d15-0410-975c-d299462d15a1
---
 src/server/Buffer.hpp                 |  2 --
 src/server/ConnectionImpl.cpp         |  9 +++++----
 src/server/ConnectionImpl.hpp         |  4 ++--
 src/server/InputPort.cpp              |  2 +-
 src/server/LV2Node.cpp                |  2 +-
 src/server/LV2Node.hpp                |  4 ++--
 src/server/NodeImpl.hpp               | 10 +++++-----
 src/server/events/RequestMetadata.cpp |  8 +++++---
 src/server/mix.hpp                    |  3 ++-
 9 files changed, 23 insertions(+), 21 deletions(-)

(limited to 'src')

diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp
index 0eefd430..e44915b3 100644
--- a/src/server/Buffer.hpp
+++ b/src/server/Buffer.hpp
@@ -28,8 +28,6 @@
 #include "types.hpp"
 #include "BufferFactory.hpp"
 
-#define IntrusivePtr boost::intrusive_ptr
-
 namespace Ingen {
 namespace Server {
 
diff --git a/src/server/ConnectionImpl.cpp b/src/server/ConnectionImpl.cpp
index 8da76aeb..49c45f43 100644
--- a/src/server/ConnectionImpl.cpp
+++ b/src/server/ConnectionImpl.cpp
@@ -16,9 +16,9 @@
  */
 
 #include <algorithm>
+#include <boost/intrusive_ptr.hpp>
 #include "raul/log.hpp"
 #include "raul/Maid.hpp"
-#include "raul/IntrusivePtr.hpp"
 #include "shared/LV2URIMap.hpp"
 #include "AudioBuffer.hpp"
 #include "BufferFactory.hpp"
@@ -68,12 +68,12 @@ ConnectionImpl::dump() const
 
 void
 ConnectionImpl::get_sources(Context& context, uint32_t voice,
-		IntrusivePtr<Buffer>* srcs, uint32_t max_num_srcs, uint32_t& num_srcs)
+		boost::intrusive_ptr<Buffer>* srcs, uint32_t max_num_srcs, uint32_t& num_srcs)
 {
 	if (must_queue() && _queue->read_space() > 0) {
 		LV2_Atom obj;
 		_queue->peek(sizeof(LV2_Atom), &obj);
-		IntrusivePtr<Buffer> buf = context.engine().buffer_factory()->get(
+		boost::intrusive_ptr<Buffer> buf = context.engine().buffer_factory()->get(
 				dst_port()->buffer_type(), sizeof(LV2_Atom) + obj.size);
 		void* data = buf->port_data(PortType::MESSAGE, context.offset());
 		_queue->read(sizeof(LV2_Atom) + obj.size, (LV2_Atom*)data);
@@ -98,7 +98,8 @@ ConnectionImpl::queue(Context& context)
 	if (!must_queue())
 		return;
 
-	IntrusivePtr<EventBuffer> src_buf = PtrCast<EventBuffer>(_src_port->buffer(0));
+	boost::intrusive_ptr<EventBuffer> src_buf =
+			boost::dynamic_pointer_cast<EventBuffer>(_src_port->buffer(0));
 	if (!src_buf) {
 		error << "Queued connection but source is not an EventBuffer" << endl;
 		return;
diff --git a/src/server/ConnectionImpl.hpp b/src/server/ConnectionImpl.hpp
index ce30eaa4..5a04d81b 100644
--- a/src/server/ConnectionImpl.hpp
+++ b/src/server/ConnectionImpl.hpp
@@ -19,10 +19,10 @@
 #define INGEN_ENGINE_CONNECTIONIMPL_HPP
 
 #include <cstdlib>
+#include <boost/intrusive_ptr.hpp>
 #include <boost/utility.hpp>
 #include "raul/log.hpp"
 #include "raul/Deletable.hpp"
-#include "raul/IntrusivePtr.hpp"
 #include "ingen/PortType.hpp"
 #include "ingen/Connection.hpp"
 #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
@@ -67,7 +67,7 @@ public:
 	void queue(Context& context);
 
 	void get_sources(Context& context, uint32_t voice,
-			IntrusivePtr<Buffer>* srcs, uint32_t max_num_srcs, uint32_t& num_srcs);
+			boost::intrusive_ptr<Buffer>* srcs, uint32_t max_num_srcs, uint32_t& num_srcs);
 
 	/** Get the buffer for a particular voice.
 	 * A Connection is smart - it knows the destination port requesting the
diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp
index a79f808b..2f871e44 100644
--- a/src/server/InputPort.cpp
+++ b/src/server/InputPort.cpp
@@ -175,7 +175,7 @@ InputPort::pre_process(Context& context)
 	for (Connections::iterator c = _connections.begin(); c != _connections.end(); ++c)
 		max_num_srcs += (*c)->src_port()->poly();
 
-	IntrusivePtr<Buffer> srcs[max_num_srcs];
+	boost::intrusive_ptr<Buffer> srcs[max_num_srcs];
 
 	if (_connections.empty()) {
 		for (uint32_t v = 0; v < _poly; ++v) {
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp
index 7045ad19..c59a20f6 100644
--- a/src/server/LV2Node.cpp
+++ b/src/server/LV2Node.cpp
@@ -398,7 +398,7 @@ LV2Node::process(ProcessContext& context)
 
 void
 LV2Node::set_port_buffer(uint32_t voice, uint32_t port_num,
-		IntrusivePtr<Buffer> buf, SampleCount offset)
+		boost::intrusive_ptr<Buffer> buf, SampleCount offset)
 {
 	NodeImpl::set_port_buffer(voice, port_num, buf, offset);
 	lilv_instance_connect_port(instance(voice), port_num,
diff --git a/src/server/LV2Node.hpp b/src/server/LV2Node.hpp
index 81a6113d..0e7e08ed 100644
--- a/src/server/LV2Node.hpp
+++ b/src/server/LV2Node.hpp
@@ -19,8 +19,8 @@
 #define INGEN_ENGINE_LV2NODE_HPP
 
 #include <string>
+#include <boost/intrusive_ptr.hpp>
 #include "lilv/lilv.h"
-#include "raul/IntrusivePtr.hpp"
 #include "lv2/lv2plug.in/ns/ext/contexts/contexts.h"
 #include "types.hpp"
 #include "NodeImpl.hpp"
@@ -59,7 +59,7 @@ public:
 	void process(ProcessContext& context);
 
 	void set_port_buffer(uint32_t voice, uint32_t port_num,
-			IntrusivePtr<Buffer> buf, SampleCount offset);
+			boost::intrusive_ptr<Buffer> buf, SampleCount offset);
 
 protected:
 	inline LilvInstance* instance(uint32_t voice) {
diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp
index 3263727a..0009316e 100644
--- a/src/server/NodeImpl.hpp
+++ b/src/server/NodeImpl.hpp
@@ -19,9 +19,9 @@
 #define INGEN_ENGINE_NODEIMPL_HPP
 
 #include <string>
+#include <boost/intrusive_ptr.hpp>
 #include "raul/Array.hpp"
 #include "raul/AtomicInt.hpp"
-#include "raul/IntrusivePtr.hpp"
 #include "raul/Semaphore.hpp"
 #include "ingen/Node.hpp"
 #include "GraphObjectImpl.hpp"
@@ -140,10 +140,10 @@ public:
 
 	/** Set the buffer of a port to a given buffer (e.g. connect plugin to buffer) */
 	virtual void set_port_buffer(
-			uint32_t             voice,
-			uint32_t             port_num,
-			IntrusivePtr<Buffer> buf,
-			SampleCount          offset);
+			uint32_t                      voice,
+			uint32_t                      port_num,
+			boost::intrusive_ptr<Buffer>  buf,
+			SampleCount                   offset);
 
 	virtual Port*     port(uint32_t index)      const;
 	virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; }
diff --git a/src/server/events/RequestMetadata.cpp b/src/server/events/RequestMetadata.cpp
index 156fb51d..597a831b 100644
--- a/src/server/events/RequestMetadata.cpp
+++ b/src/server/events/RequestMetadata.cpp
@@ -15,7 +15,7 @@
  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "raul/IntrusivePtr.hpp"
+#include <boost/intrusive_ptr.hpp>
 #include "ingen/ClientInterface.hpp"
 #include "events/RequestMetadata.hpp"
 #include "shared/LV2Atom.hpp"
@@ -89,11 +89,13 @@ RequestMetadata::execute(ProcessContext& context)
 	if (_special_type == PORT_VALUE) {
 		PortImpl* port = dynamic_cast<PortImpl*>(_resource);
 		if (port) {
-			IntrusivePtr<AudioBuffer> abuf = PtrCast<AudioBuffer>(port->buffer(0));
+			boost::intrusive_ptr<AudioBuffer> abuf =
+					boost::dynamic_pointer_cast<AudioBuffer>(port->buffer(0));
 			if (abuf) {
 				_value = abuf->value_at(0);
 			} else {
-				IntrusivePtr<ObjectBuffer> obuf = PtrCast<ObjectBuffer>(port->buffer(0));
+				boost::intrusive_ptr<ObjectBuffer> obuf =
+						boost::dynamic_pointer_cast<ObjectBuffer>(port->buffer(0));
 				if (obuf) {
 					Ingen::Shared::LV2Atom::to_atom(*_engine.world()->uris().get(),
 					                                obuf->atom(),
diff --git a/src/server/mix.hpp b/src/server/mix.hpp
index 4b062ed9..79b02477 100644
--- a/src/server/mix.hpp
+++ b/src/server/mix.hpp
@@ -18,6 +18,7 @@
 #ifndef INGEN_ENGINE_MIX_HPP
 #define INGEN_ENGINE_MIX_HPP
 
+#include <boost/intrusive_ptr.hpp>
 #include "raul/log.hpp"
 #include "ingen/PortType.hpp"
 #include "Buffer.hpp"
@@ -29,7 +30,7 @@ namespace Ingen {
 namespace Server {
 
 inline void
-mix(Context& context, Buffer* dst, const IntrusivePtr<Buffer>* srcs, uint32_t num_srcs)
+mix(Context& context, Buffer* dst, const boost::intrusive_ptr<Buffer>* srcs, uint32_t num_srcs)
 {
 	using Ingen::PortType;
 	switch (dst->type().symbol()) {
-- 
cgit v1.2.1