1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UCB_CACHEMAPOBJECT3_HXX
21 #define INCLUDED_UCB_CACHEMAPOBJECT3_HXX
23 #include "osl/interlck.h"
24 #include "osl/mutex.hxx"
25 #include "rtl/ref.hxx"
26 #include "sal/types.h"
27 #include "salhelper/simplereferenceobject.hxx"
32 namespace rtl
{ class OUString
; }
33 namespace ucb
{ namespace cachemap
{ class Object3
; } }
35 namespace ucb
{ namespace cachemap
{
37 class ObjectContainer3
: public salhelper::SimpleReferenceObject
42 virtual ~ObjectContainer3() SAL_THROW(());
44 rtl::Reference
< Object3
> get(OUString
const & rKey
);
47 typedef std::map
< OUString
, Object3
* > Map
;
52 void releaseElement(Object3
* pElement
) SAL_THROW(());
54 friend class Object3
; // to access Map, releaseElement()
60 inline void acquire() SAL_THROW(())
61 { osl_atomic_increment(&m_nRefCount
); }
63 void release() SAL_THROW(());
66 rtl::Reference
< ObjectContainer3
> m_xContainer
;
67 ObjectContainer3::Map::iterator m_aContainerIt
;
68 oslInterlockedCount m_nRefCount
;
70 inline Object3(rtl::Reference
< ObjectContainer3
> const & rContainer
);
72 inline ~Object3() SAL_THROW(());
74 Object3(Object3
&); // not implemented
75 void operator =(Object3
); // not implemented
77 friend class ObjectContainer3
;
78 // to access m_aContainerIt, m_nRefCount, Object3(), ~Object3()
80 friend struct std::auto_ptr
< Object3
>; // to access ~Object3()
81 // work around compiler bug...
83 friend class std::auto_ptr
< Object3
>; // to access ~Object3()
89 #endif // INCLUDED_UCB_CACHEMAPOBJECT3_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */