1  /**************************************************************
2   *
3   * Licensed to the Apache Software Foundation (ASF) under one
4   * or more contributor license agreements.  See the NOTICE file
5   * distributed with this work for additional information
6   * regarding copyright ownership.  The ASF licenses this file
7   * to you under the Apache License, Version 2.0 (the
8   * "License"); you may not use this file except in compliance
9   * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   *
20   *************************************************************/
21  
22  
23  
24  #ifndef INCLUDED_UCB_CACHEMAPOBJECTCONTAINER2_HXX
25  #define INCLUDED_UCB_CACHEMAPOBJECTCONTAINER2_HXX
26  
27  #include "cppuhelper/weakref.hxx"
28  #include "osl/mutex.hxx"
29  #include "rtl/ref.hxx"
30  #include "sal/types.h"
31  
32  #ifndef INCLUDED_HASH_MAP
33  #include <hash_map>
34  #define INCLUDED_HASH_MAP
35  #endif
36  
37  namespace rtl {
38      class OUString;
39      struct OUStringHash;
40  }
41  namespace ucb { namespace cachemap { class Object2; } }
42  
43  namespace ucb { namespace cachemap {
44  
45  class ObjectContainer2
46  {
47  public:
48      ObjectContainer2();
49  
50      ~ObjectContainer2() SAL_THROW(());
51  
52      rtl::Reference< Object2 > get(rtl::OUString const & rKey);
53  
54  private:
55      typedef std::hash_map< rtl::OUString,
56                             com::sun::star::uno::WeakReference< Object2 >,
57                             rtl::OUStringHash >
58      Map;
59  
60      ObjectContainer2(ObjectContainer2 &); // not implemented
61      void operator =(ObjectContainer2); // not implemented
62  
63      Map m_aMap;
64      osl::Mutex m_aMutex;
65  };
66  
67  } }
68  
69  #endif // INCLUDED_UCB_CACHEMAPOBJECTCONTAINER2_HXX
70