summaryrefslogtreecommitdiff
path: root/comphelper/inc/comphelper/servicehelper.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/inc/comphelper/servicehelper.hxx')
-rw-r--r--comphelper/inc/comphelper/servicehelper.hxx32
1 files changed, 20 insertions, 12 deletions
diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx
index e691ea2bd76c..0cab5fa8eab4 100644
--- a/comphelper/inc/comphelper/servicehelper.hxx
+++ b/comphelper/inc/comphelper/servicehelper.hxx
@@ -29,6 +29,21 @@
#ifndef _COMPHELPER_SERVICEHELPER_HXX_
#define _COMPHELPER_SERVICEHELPER_HXX_
+#include <rtl/uuid.h>
+#include <rtl/instance.hxx>
+
+class UnoTunnelIdInit
+{
+private:
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aSeq;
+public:
+ UnoTunnelIdInit() : m_aSeq(16)
+ {
+ rtl_createUuid( (sal_uInt8*)m_aSeq.getArray(), 0, sal_True );
+ }
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
+};
+
/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
that gives access to your implementation for a given interface reference,
if possible.
@@ -49,20 +64,13 @@
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
+namespace \
+{ \
+ class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \
+} \
const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
{ \
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; \
- if( !pSeq ) \
- { \
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
- if( !pSeq ) \
- { \
- static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \
- pSeq = &aSeq; \
- } \
- } \
- return *pSeq; \
+ return the##classname##UnoTunnelId::get()::getSeq(); \
} \
\
classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \