/*

Copyright (c) 2002-2005, Yauheni Akhotnikau
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

- The name of the author may not be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.

*/

/*
	ObjESSty-1
*/
#if !defined( _OESS_1__DB__STORAGE__IMPL__MEM_DIRTY_PAGE_STORAGE_HPP_ )
#define _OESS_1__DB__STORAGE__IMPL__MEM_DIRTY_PAGE_STORAGE_HPP_

#include <map>

#include <oess_1/db/storage/h/dirty_page_storage.hpp>

namespace oess_1 {

namespace db {

namespace storage {

namespace impl {

//
// mem_dirty_page_storage_t
//

/*!
	\since v.1.3.1
	\brief Хранилище грязных страниц в оперативной памяти.

	\note В версии 1.3.1 это хранилище является штатных хранилищем
		грязных страниц.
*/
class	mem_dirty_page_storage_t
	:	public dirty_page_storage_t
	{
	public :
		mem_dirty_page_storage_t();
		virtual ~mem_dirty_page_storage_t();

	//! \name Реализация унаследованных методов.
	//! \{
		virtual void
		put(
			const ref_loaded_page_t & page );

		virtual bool
		find(
			oess_1::uint_t page_ordinal,
			ref_loaded_page_t & receiver ) const;

		virtual void
		for_each( dirty_page_actor_t & actor ) const;

		virtual void
		clear();

		virtual oess_1::uint_t
		size() const;
	//! \}

	private :
		//! Тип множества грязных страниц.
		typedef std::map< oess_1::uint_t, ref_loaded_page_t >	pages_map_t;

		//! Множество грязных страниц.
		pages_map_t	m_pages;
	};

} /* namespace impl */

} /* namespace storage */

} /* namespace db */

} /* namespace oess */

#endif

