diff --git a/include/osg/Export b/include/osg/Export index 6df01ae8b..86ecd0552 100644 --- a/include/osg/Export +++ b/include/osg/Export @@ -17,7 +17,7 @@ // define USE_DEPRECATED_API is used to include in API which is being fazed out // if you can compile your apps with this turned off you are // well placed for compatablity with future versions. -#define USE_DEPRECATED_API +//#define USE_DEPRECATED_API #if defined(_MSC_VER) #pragma warning( disable : 4244 ) diff --git a/include/osg/Referenced b/include/osg/Referenced index f1cf53284..ac782c5ad 100644 --- a/include/osg/Referenced +++ b/include/osg/Referenced @@ -14,18 +14,26 @@ #ifndef OSG_REFERENCED #define OSG_REFERENCED 1 +// When building OSG with Java need to derive from Noodle::CBridgable class, +// therefore so OSG_JAVA_BUILD must be defined. Also the thread-safe ref/unref test +// as built in for the NoodleCore wrapping. NoodleCore has a Garbage collector mechanism +// which is very similar to osg::DeletionManager. So these aspects of osg::Referenced +// have been removed +//#define OSG_JAVA_BUILD #include - +#ifdef OSG_JAVA_BUILD +#include +#else #include +#endif namespace osg { - -// forward declar, declared after Refenced below. +#ifndef OSG_JAVA_BUILD +// forward declar, declared after Referenced below. class DeleteHandler; - /** Base class from providing referencing counted objects.*/ class SG_EXPORT Referenced { @@ -120,7 +128,21 @@ class DeleteHandler * The default implementation does a delete straight away.*/ virtual void requestDelete(const Referenced* object) { doDelete(object); } }; - +#else +/** Java wrappers use the CBridgable base-class for referencing + * and garbage collection. + */ +class SG_EXPORT Referenced : public Noodle::CBridgable +{ + public: + /** Method not used in NoodleCore referencing + */ + inline void unref_nodelete() const { --_refCount; } + inline int referenceCount() const { return _refCount; } + protected: + virtual ~Referenced() {} +}; +#endif //OSG_JAVA_BUILD } diff --git a/src/osg/Referenced.cpp b/src/osg/Referenced.cpp index 973770b89..8aafd7913 100644 --- a/src/osg/Referenced.cpp +++ b/src/osg/Referenced.cpp @@ -19,6 +19,7 @@ #include #include +#ifndef OSG_JAVA_BUILD namespace osg { @@ -110,3 +111,5 @@ void Referenced::unref_nodelete() const }; // end of namespace osg + +#endif //OSG_JAVA_BUILD