/*

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.

*/

/*!
	\file
	\brief Интерфейс объекта, отвечающего за хранение информации о
	подключенных к БД клиентах.
*/
#if !defined( _OESS_1__DB__IMPL__DB_CONTENT__CLIENT_MAP_HPP_ )
#define _OESS_1__DB__IMPL__DB_CONTENT__CLIENT_MAP_HPP_

#include <string>
#include <memory>

#include <oess_1/defs/h/types.hpp>

namespace oess_1 {

namespace db {

namespace impl {

namespace db_content {

//
// client_map_t
//

/*!
	\brief Интерфейс объекта, отвечающего за хранение информации о
	подключенных к БД клиентах.
*/
class	client_map_t {
	public :
		client_map_t();
		virtual ~client_map_t();

		//! Подключить еще одного клиента к БД.
		virtual void
		attach(
			const std::string & client_id ) = 0;

		//! Отключить указанного агента от БД.
		/*	Если такой клиент к БД не подключен, то это
			ошибкой не считается. */
		virtual void
		detach(
			const std::string & client_id ) = 0;

		//! Определить количество подключенных клиентов.
		virtual oess_1::uint_t
		count() const = 0;

		//! Найти клиента по имени.
		/*!	Если клиент не найден, то порождается
			исключение. */
		virtual void
		find(
			const std::string & client_id ) const = 0;

	private :
		client_map_t( const client_map_t & );
		client_map_t &
		operator=( const client_map_t & );
};

//
// create_std_client_map
//

/*!
	\brief Создание стандартной реализации интерфейса %client_map_t.

	\return указатель на динамически созданный объект,
	который должен быть уничтожен посредством оператора
	delete.
*/
std::auto_ptr< client_map_t >
create_std_client_map();

} /* namespace db_content */

} /* namespace impl */

} /* namespace db */

} /* namespace oess_1 */

#endif
