changeset 263:4454843ff384

* OK, we're going to have to place the host stuff in its own namespace too. Otherwise our new SV build on OSX fails to load old plugins because they pull in the host namespace PluginBase and thus report the wrong Vamp version... *sigh*
author cannam
date Thu, 20 Nov 2008 15:01:30 +0000
parents 4a0e998a1afd
children 91ac8f5e52ea
files README.compat src/vamp-hostsdk/PluginBufferingAdapter.cpp src/vamp-hostsdk/PluginChannelAdapter.cpp src/vamp-hostsdk/PluginHostAdapter.cpp src/vamp-hostsdk/PluginInputDomainAdapter.cpp src/vamp-hostsdk/PluginLoader.cpp src/vamp-hostsdk/PluginSummarisingAdapter.cpp src/vamp-hostsdk/PluginWrapper.cpp src/vamp-hostsdk/RealTime.cpp vamp-hostsdk/Plugin.h vamp-hostsdk/PluginBase.h vamp-hostsdk/PluginBufferingAdapter.h vamp-hostsdk/PluginChannelAdapter.h vamp-hostsdk/PluginHostAdapter.h vamp-hostsdk/PluginInputDomainAdapter.h vamp-hostsdk/PluginLoader.h vamp-hostsdk/PluginSummarisingAdapter.h vamp-hostsdk/PluginWrapper.h vamp-hostsdk/hostguard.h vamp-sdk/plugguard.h
diffstat 20 files changed, 94 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/README.compat	Fri Nov 14 14:20:47 2008 +0000
+++ b/README.compat	Thu Nov 20 15:01:30 2008 +0000
@@ -76,22 +76,25 @@
 
 Hosts that incorporate plugin code
 ----------------------------------
-One of the changes in this version of the SDK is that classes compiled
-into plugins are now internally enclosed in a special C++ namespace
-(the _VampPlugin namespace) to avoid any confusion between host and
-plugin namespaces in unusual linkage situations.  This is handled
-transparently in most circumstances, and neither plugin nor host
-authors will normally need to care about it.
+One of the changes in this version of the SDK is that separate
+top-level C++ namespaces are used for classes compiled into plugins
+(the _VampPlugin namespace) and hosts (the _VampHost namespace), to
+avoid any confusion between host and plugin namespaces in unusual
+linkage situations.  This is handled transparently in most
+circumstances, and neither plugin nor host authors will normally need
+to care about it.
 
 However, hosts that directly incorporate code from plugins, for
 example to provide functionality that is the same as those plugins
 without having to explicitly load them, may find that they can no
 longer resolve plugin functions at link time because of this namespace
 mismatch.  To avoid this, the host build process should define the
-preprocessor flag VAMP_NO_PLUGIN_NAMESPACE when compiling the plugin
+preprocessor flag _VAMP_NO_PLUGIN_NAMESPACE when compiling the plugin
 code to ensure that both host and plugin code exist at the same level
-of namespace.
+of namespace.  Note that the corresponding _VAMP_NO_HOST_NAMESPACE is
+also available.
 
 (If your host does this, why not make it load the plugins dynamically
 instead using the normal Vamp plugin loader method?  There are many
 advantages to that.)
+
--- a/src/vamp-hostsdk/PluginBufferingAdapter.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/PluginBufferingAdapter.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -43,6 +43,8 @@
 using std::vector;
 using std::map;
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginBufferingAdapter.cpp)
+
 namespace Vamp {
 	
 namespace HostExt {
@@ -654,4 +656,4 @@
 	
 }
 
-
+_VAMP_SDK_HOSTSPACE_END(PluginBufferingAdapter.cpp)
--- a/src/vamp-hostsdk/PluginChannelAdapter.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/PluginChannelAdapter.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -36,6 +36,8 @@
 
 #include <vamp-hostsdk/PluginChannelAdapter.h>
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginChannelAdapter.cpp)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -263,4 +265,6 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginChannelAdapter.cpp)
 
+
--- a/src/vamp-hostsdk/PluginHostAdapter.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/PluginHostAdapter.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -41,6 +41,8 @@
 #error Incorrect Vamp SDK header included (not the expected 2.0 SDK)
 #endif
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginHostAdapter.cpp)
+
 namespace Vamp
 {
 
@@ -449,3 +451,6 @@
 }
 
 }
+
+_VAMP_SDK_HOSTSPACE_END(PluginHostAdapter.cpp)
+
--- a/src/vamp-hostsdk/PluginInputDomainAdapter.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/PluginInputDomainAdapter.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -70,6 +70,8 @@
 #endif
 
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginInputDomainAdapter.cpp)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -576,3 +578,5 @@
         
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginInputDomainAdapter.cpp)
+
--- a/src/vamp-hostsdk/PluginLoader.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/PluginLoader.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -66,6 +66,8 @@
 
 using namespace std;
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginLoader.cpp)
+
 namespace Vamp {
 	
 namespace HostExt {
@@ -634,3 +636,6 @@
 }
 
 }
+
+_VAMP_SDK_HOSTSPACE_END(PluginLoader.cpp)
+
--- a/src/vamp-hostsdk/PluginSummarisingAdapter.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/PluginSummarisingAdapter.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -44,6 +44,8 @@
 #define DEBUG_PLUGIN_SUMMARISING_ADAPTER 1
 //#define DEBUG_PLUGIN_SUMMARISING_ADAPTER_SEGMENT 1
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginSummarisingAdapter.cpp)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -906,3 +908,5 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginSummarisingAdapter.cpp)
+
--- a/src/vamp-hostsdk/PluginWrapper.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/PluginWrapper.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -36,6 +36,8 @@
 
 #include <vamp-hostsdk/PluginWrapper.h>
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginWrapper.cpp)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -199,3 +201,4 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginWrapper.cpp)
--- a/src/vamp-hostsdk/RealTime.cpp	Fri Nov 14 14:20:47 2008 +0000
+++ b/src/vamp-hostsdk/RealTime.cpp	Thu Nov 20 15:01:30 2008 +0000
@@ -34,5 +34,6 @@
     authorization.
 */
 
-#define _VAMP_IN_HOSTSDK
+#include <vamp-hostsdk/RealTime.h>
 #include "../vamp-sdk/RealTime.cpp"
+
--- a/vamp-hostsdk/Plugin.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/Plugin.h	Thu Nov 20 15:01:30 2008 +0000
@@ -41,6 +41,7 @@
 // use this header instead.
 
 #include "hostguard.h"
+
 #include <vamp-sdk/Plugin.h>
 
 #endif
--- a/vamp-hostsdk/PluginBase.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginBase.h	Thu Nov 20 15:01:30 2008 +0000
@@ -41,6 +41,7 @@
 // Always use this header instead.
 
 #include "hostguard.h"
+
 #include <vamp-sdk/PluginBase.h>
 
 #endif
--- a/vamp-hostsdk/PluginBufferingAdapter.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginBufferingAdapter.h	Thu Nov 20 15:01:30 2008 +0000
@@ -41,6 +41,8 @@
 #include "hostguard.h"
 #include "PluginWrapper.h"
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginBufferingAdapter.h)
+
 namespace Vamp {
 	
 namespace HostExt {
@@ -184,4 +186,6 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginBufferingAdapter.h)
+
 #endif
--- a/vamp-hostsdk/PluginChannelAdapter.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginChannelAdapter.h	Thu Nov 20 15:01:30 2008 +0000
@@ -40,6 +40,8 @@
 #include "hostguard.h"
 #include "PluginWrapper.h"
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginChannelAdapter.h)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -142,4 +144,6 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginChannelAdapter.h)
+
 #endif
--- a/vamp-hostsdk/PluginHostAdapter.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginHostAdapter.h	Thu Nov 20 15:01:30 2008 +0000
@@ -44,6 +44,8 @@
 
 #include <vector>
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginHostAdapter.h)
+
 namespace Vamp {
 
 /**
@@ -114,6 +116,8 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginHostAdapter.h)
+
 #endif
 
 
--- a/vamp-hostsdk/PluginInputDomainAdapter.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginInputDomainAdapter.h	Thu Nov 20 15:01:30 2008 +0000
@@ -40,6 +40,8 @@
 #include "hostguard.h"
 #include "PluginWrapper.h"
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginInputDomainAdapter.h)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -129,4 +131,6 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginInputDomainAdapter.h)
+
 #endif
--- a/vamp-hostsdk/PluginLoader.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginLoader.h	Thu Nov 20 15:01:30 2008 +0000
@@ -44,6 +44,8 @@
 #include "hostguard.h"
 #include "PluginWrapper.h"
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginLoader.h)
+
 namespace Vamp {
 
 class Plugin;
@@ -235,5 +237,7 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginLoader.h)
+
 #endif
 
--- a/vamp-hostsdk/PluginSummarisingAdapter.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginSummarisingAdapter.h	Thu Nov 20 15:01:30 2008 +0000
@@ -42,6 +42,8 @@
 
 #include <set>
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginSummarisingAdapter.h)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -188,4 +190,6 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginSummarisingAdapter.h)
+
 #endif
--- a/vamp-hostsdk/PluginWrapper.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/PluginWrapper.h	Thu Nov 20 15:01:30 2008 +0000
@@ -40,6 +40,8 @@
 #include "hostguard.h"
 #include <vamp-hostsdk/Plugin.h>
 
+_VAMP_SDK_HOSTSPACE_BEGIN(PluginWrapper.h)
+
 namespace Vamp {
 
 namespace HostExt {
@@ -128,4 +130,6 @@
 
 }
 
+_VAMP_SDK_HOSTSPACE_END(PluginWrapper.h)
+
 #endif
--- a/vamp-hostsdk/hostguard.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-hostsdk/hostguard.h	Thu Nov 20 15:01:30 2008 +0000
@@ -40,8 +40,30 @@
 #ifdef _VAMP_IN_PLUGINSDK
 #error You have included headers from both vamp-sdk and vamp-hostsdk in the same source file. Please include only vamp-sdk headers in plugin code, and only vamp-hostsdk headers in host code.
 #else
+
 #define _VAMP_IN_HOSTSDK
+
+#ifdef _VAMP_NO_HOST_NAMESPACE
+#define _VAMP_SDK_HOSTSPACE_BEGIN(h)
+#define _VAMP_SDK_HOSTSPACE_END(h)
+#define _VAMP_SDK_PLUGSPACE_BEGIN(h)
+#define _VAMP_SDK_PLUGSPACE_END(h)
+#else
+#define _VAMP_SDK_HOSTSPACE_BEGIN(h) \
+	namespace _VampHost {
+
+#define _VAMP_SDK_HOSTSPACE_END(h) \
+	} \
+	using namespace _VampHost;
+#define _VAMP_SDK_PLUGSPACE_BEGIN(h) \
+	namespace _VampHost {
+
+#define _VAMP_SDK_PLUGSPACE_END(h) \
+	} \
+	using namespace _VampHost;
 #endif
 
 #endif
 
+#endif
+
--- a/vamp-sdk/plugguard.h	Fri Nov 14 14:20:47 2008 +0000
+++ b/vamp-sdk/plugguard.h	Thu Nov 20 15:01:30 2008 +0000
@@ -67,12 +67,7 @@
  * vamp-hostsdk is included in the same file.  We can't catch that.
  */
 
-#ifdef _VAMP_IN_HOSTSDK
-
-#define _VAMP_SDK_PLUGSPACE_BEGIN(h)
-#define _VAMP_SDK_PLUGSPACE_END(h)
-
-#else
+#ifndef _VAMP_IN_HOSTSDK
 
 #define _VAMP_IN_PLUGINSDK 1