/*

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
*/

/*!
	\file
	\since v.1.4.0
	\brief Команда получения имен существующих разделов.
*/

#if !defined( _OESS_1__DB__SITE__IMPL__SLICE_NAMES_CMD_HPP_ )
#define _OESS_1__DB__SITE__IMPL__SLICE_NAMES_CMD_HPP_

#include <set>

#include <oess_1/db/site/impl/h/request.hpp>
#include <oess_1/db/site/impl/h/response.hpp>

namespace oess_1 {

namespace db {

namespace site {

namespace impl {

//
// slice_names_cmd_t
//

/*!
	\since v.1.4.0
	\brief Запрос на получение имен существующих разделов.
*/
class	slice_names_cmd_t :
	public request_t
{
	OESS_SERIALIZER( slice_names_cmd_t )
	public :
		slice_names_cmd_t();
		slice_names_cmd_t(
			//! Клиент, который инициирует операцию.
			const std::string & client_id,
			//! Имя БД из которой запрашиваются разделы.
			const std::string & db_logic_name );
		virtual ~slice_names_cmd_t();

		enum {
			e_id = 1300
		};

		virtual oess_1::uint_t
		query_req_id() const;

		//! Имя БД из которой запрашиваются разделы.
		const std::string &
		query_db_logic_name() const;

	private :
		//! Имя БД из которой запрашиваются разделы.
		std::string	m_db_logic_name;
};

//
// slice_names_cmd_result_t
//

/*!
	\since v.1.4.0
	\brief Ответ на запрос slice_names.
*/
class	slice_names_cmd_result_t :
	public response_t
{
	OESS_SERIALIZER( slice_names_cmd_result_t )
	public :
		/*!
			Устанавливает признак того, что раздела не существует.
		*/
		slice_names_cmd_result_t();
		//! Конструктор на случай успешной обработки запроса.
		slice_names_cmd_result_t(
			//! Имена существующих разделов.
			const std::set< std::string > & names );
		//! Конструктор для случая ошибки.
		slice_names_cmd_result_t(
			const result_t & result );
		virtual ~slice_names_cmd_result_t();

		enum {
			e_id = 1301
		};

		virtual oess_1::uint_t
		query_resp_id() const;

		/*!
			\return Множество имен существующих разделов.
		*/
		const std::set< std::string >	&
		names() const;

	private :
		//! Имена существующих разделов.
		std::set< std::string > m_names;
};

} /* namespace impl */

} /* namespace site */

} /* namespace db */

} /* namespace oess_1 */

#endif


