// (C) Copyright Jonathan Turkanis 2004.
// (C) Copyright David Abrahams 2004.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
// Disclaimer: Not a Boost library.
#ifndef BOOST_IDL_DETAIL_IDL_END_HPP_INCLUDED
#define BOOST_IDL_DETAIL_IDL_HPP_INCLUDED
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <boost/interfaces/interface_fwd.hpp>
#include <boost/interfaces/is_interface.hpp>
#include <boost/interfaces/access.hpp>
#include <boost/interfaces/detail/generate.hpp>
#include <boost/interfaces/detail/interface_base.hpp>
#include <boost/interfaces/detail/macros/befriend_template.hpp>
#include <boost/interfaces/detail/macros/interface_support.hpp>
#include <boost/interfaces/detail/macros/template_args.hpp>
#include <boost/interfaces/detail/macros/template_decl.hpp>
#include <boost/interfaces/detail/util.hpp> // disable_if_same, always_false,
#include <boost/mpl/bool.hpp> // table_holder, augmented_table.
#include <boost/mpl/fold.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/type_traits/detail/yes_no_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#define BOOST_INTERFACE_END_INTERFACE_TABLE() \
typedef BOOST_IDL_AUGMENTED_TABLE( \
typename base_type_::interface_table \
) interface_table; \
/**/
#define BOOST_INTERFACE_END_IMPL(name, arity) \
::boost::mpl::na > > { }; \
public: \
struct index { \
template<typename N> \
struct apply \
: tracker_< ::boost::mpl::int_<N::value>, int > \
{ }; \
}; \
}; \
}; \
BOOST_IDL_TEMPLATE_DECL(arity, XXX_) \
class name \
: public ::boost::interfaces::detail::interface_base< \
BOOST_PP_CAT(name, _interface_impl_) \
BOOST_IDL_TEMPLATE_ARGS(arity, XXX_), \
__LINE__ - BOOST_PP_CAT(name, _interface_impl_) \
BOOST_IDL_TEMPLATE_ARGS(arity, XXX_)::start_line_ \
>::BOOST_PP_EXPR_IF(arity, template) generator< \
name BOOST_IDL_TEMPLATE_ARGS(arity, XXX_) \
> \
{ \
private: \
typedef BOOST_PP_CAT(name, _interface_impl_) \
BOOST_IDL_TEMPLATE_ARGS(arity, XXX_) implementation_type; \
typedef BOOST_PP_EXPR_IF(arity, typename) \
::boost::interfaces::detail::interface_base< \
implementation_type, \
__LINE__ - implementation_type::start_line_ \
>::BOOST_PP_EXPR_IF(arity, template) generator< \
name BOOST_IDL_TEMPLATE_ARGS(arity, XXX_) \
> base_type_; \
friend class ::boost::interfaces::access; \
public: \
BOOST_PP_EXPR_IF(arity, BOOST_INTERFACE_END_INTERFACE_TABLE()) \
template<typename XXX_> \
struct interface_functions \
: base_type_::BOOST_PP_EXPR_IF(arity, template) interface_functions<XXX_>, \
::boost::interfaces::detail::table_holder<interface_table, XXX_> \
{ }; \
template< typename DDD_, \
typename CCC_ = ::boost::mpl::false_, \
typename BBB_ = ::boost::interfaces::detail::empty_base > \
struct generator \
: ::boost::interfaces::detail::interface_base< \
BOOST_PP_CAT(name, _interface_impl_) \
BOOST_IDL_TEMPLATE_ARGS(arity, XXX_), \
__LINE__ - BOOST_PP_CAT(name, _interface_impl_) \
BOOST_IDL_TEMPLATE_ARGS(arity, XXX_) ::start_line_ \
>::BOOST_PP_EXPR_IF(arity, template) generator<DDD_, CCC_, BBB_> \
{ }; \
BOOST_IDL_CTORS(name, XXX_) \
BOOST_IDL_CORE_INTERFACE_SUPPORT(name) \
}; \
template< typename XXX_ BOOST_PP_COMMA_IF(arity) \
BOOST_PP_ENUM_PARAMS(arity, typename XXX_) > \
::boost::type_traits::yes_type \
is_interface_helper( name BOOST_IDL_TEMPLATE_ARGS(arity, XXX_)*, \
XXX_*, \
typename \
::boost::interfaces::detail::enable_if_same< \
XXX_, \
name BOOST_IDL_TEMPLATE_ARGS(arity, XXX_) \
>::type* = 0 ); \
/**/
#define BOOST_IDL_END(name) BOOST_INTERFACE_END_IMPL(name, 0)
#define BOOST_IDL_END_TEMPLATE(name, arity) \
BOOST_INTERFACE_END_IMPL(name, arity) \
/**/
#endif // #ifndef BOOST_IDL_DETAIL_IDL_END_HPP_INCLUDED