office-gobmx/connectivity/source/inc/OSubComponent.hxx
Oliver Bolte 39e949c290 CWS-TOOLING: integrate CWS dbaperf3
2009-08-28 08:04:41 +0200 oj  r275515 : wrong replacement
2009-08-28 07:57:44 +0200 oj  r275514 : declaration of 'nRealSize' shadows a previous local
2009-08-20 10:17:11 +0200 oj  r275168 : CWS-TOOLING: rebase CWS dbaperf3 to trunk@275001 (milestone: DEV300:m55)
2009-08-19 11:50:49 +0200 oj  r275145 : #ii102891# minimize metadata calls
2009-06-22 12:20:15 +0200 oj  r273213 : compile error
2009-06-22 12:19:45 +0200 oj  r273212 : compile error
2009-06-18 08:54:08 +0200 oj  r273099 : #i102891# reduce calls to databasemetadata
2009-06-18 08:19:55 +0200 oj  r273095 : #i102891# reduce calls to databasemetadata
2009-09-08 09:50:48 +00:00

95 lines
3.2 KiB
C++

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: OSubComponent.hxx,v $
* $Revision: 1.11 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_
#define _CONNECTIVITY_OSUBCOMPONENT_HXX_
#include <cppuhelper/weak.hxx>
#include <cppuhelper/interfacecontainer.h>
#include "connectivity/dbtoolsdllapi.hxx"
namespace com
{
namespace sun
{
namespace star
{
namespace lang
{
class XComponent;
}
}
}
}
namespace connectivity
{
OOO_DLLPUBLIC_DBTOOLS
void release(oslInterlockedCount& _refCount,
::cppu::OBroadcastHelper& rBHelper,
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
::com::sun::star::lang::XComponent* _pObject);
//************************************************************
// OSubComponent
//************************************************************
template <class SELF, class WEAK> class OSubComponent
{
protected:
// the parent must support the tunnel implementation
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
SELF* m_pDerivedImplementation;
public:
OSubComponent(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent,
SELF* _pDerivedImplementation)
:m_xParent(_xParent)
,m_pDerivedImplementation(_pDerivedImplementation)
{
}
protected:
void dispose_ChildImpl()
{
// avoid ambiguity
::osl::MutexGuard aGuard( m_pDerivedImplementation->WEAK::rBHelper.rMutex );
m_xParent.clear();
}
void relase_ChildImpl()
{
::connectivity::release(m_pDerivedImplementation->m_refCount,
m_pDerivedImplementation->WEAK::rBHelper,
m_xParent,
m_pDerivedImplementation);
m_pDerivedImplementation->WEAK::release();
}
};
}
#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_