1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cachemapobject3.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_UCB_CACHEMAPOBJECT3_HXX
32 #define INCLUDED_UCB_CACHEMAPOBJECT3_HXX
34 #include "osl/interlck.h"
35 #include "osl/mutex.hxx"
36 #include "rtl/ref.hxx"
37 #include "sal/types.h"
38 #include "salhelper/simplereferenceobject.hxx"
44 #ifndef INCLUDED_MEMORY
46 #define INCLUDED_MEMORY
49 namespace rtl
{ class OUString
; }
50 namespace ucb
{ namespace cachemap
{ class Object3
; } }
52 namespace ucb
{ namespace cachemap
{
54 class ObjectContainer3
: public salhelper::SimpleReferenceObject
59 virtual ~ObjectContainer3() SAL_THROW(());
61 rtl::Reference
< Object3
> get(rtl::OUString
const & rKey
);
64 typedef std::map
< rtl::OUString
, Object3
* > Map
;
69 void releaseElement(Object3
* pElement
) SAL_THROW(());
71 friend class Object3
; // to access Map, releaseElement()
77 inline void acquire() SAL_THROW(())
78 { osl_incrementInterlockedCount(&m_nRefCount
); }
80 void release() SAL_THROW(());
83 rtl::Reference
< ObjectContainer3
> m_xContainer
;
84 ObjectContainer3::Map::iterator m_aContainerIt
;
85 oslInterlockedCount m_nRefCount
;
87 inline Object3(rtl::Reference
< ObjectContainer3
> const & rContainer
);
89 inline ~Object3() SAL_THROW(());
91 Object3(Object3
&); // not implemented
92 void operator =(Object3
); // not implemented
94 friend class ObjectContainer3
;
95 // to access m_aContainerIt, m_nRefCount, Object3(), ~Object3()
97 friend struct std::auto_ptr
< Object3
>; // to access ~Object3()
98 // work around compiler bug...
100 friend class std::auto_ptr
< Object3
>; // to access ~Object3()
106 #endif // INCLUDED_UCB_CACHEMAPOBJECT3_HXX