/**************************************************************
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 * 
 *************************************************************/

#ifndef SYSTEM_STL_HASHMAP
#define SYSTEM_STL_HASHMAP

#ifdef HAVE_STL_INCLUDE_PATH
	// TODO: use computed include file name
	#include_next <unordered_map>
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
	#include <unordered_map>
#elif defined(_MSC_VER)
	#include <../../VC/include/unordered_map>
	#define STLP4_EMUBASE_NS ::std::tr1
#else // fall back to boost/tr1
	#include <boost/tr1/tr1/unordered_map>
	#define STLP4_EMUBASE_NS ::boost
#endif


#ifndef NO_STLPORT4_EMULATION

namespace std
{
#ifdef STLP4_EMUBASE_NS
	using STLP4_EMUBASE_NS::hash;
	using STLP4_EMUBASE_NS::unordered_map;
	using STLP4_EMUBASE_NS::unordered_multimap;
	#undef STLP4_EMUBASE_NS
#endif


template<
	typename __K,
	typename __T,
	typename __H = hash<__K>,
	typename __E = equal_to<__K>,
	typename __A = allocator<pair<__K,__T> > >
class hash_map
:	public unordered_map<__K,__T,__H,__E,__A>
{
public:
	typedef unordered_map<__K,__T,__H,__E,__A> _super;
	typedef __T data_type;

	hash_map( void) {}
	hash_map( size_t n) : _super( n) {}

private:
	// setting the hasher dynamically is not supported in the emulation!
	hash_map( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
};

template<
	typename __K,
	typename __T,
	typename __H = hash<__K>,
	typename __E = equal_to<__K>,
	typename __A = allocator<pair<__K,__T> > >
class hash_multimap
:	public unordered_multimap<__K,__T,__H,__E,__A>
{
public:
	typedef unordered_multimap<__K,__T,__H,__E,__A> _super;
	typedef __T data_type;

	hash_multimap( void) {}
	hash_multimap( size_t n) : _super( n) {}

private:
	// setting the hasher dynamically is not supported in the emulation!
	hash_multimap( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
};

} // namespace std

#endif // NO_STLPORT4_EMULATION

#endif