#include <boost/typeof/typeof.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/seq/push_front.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/seq/transform.hpp>
#include <boost/preprocessor/seq/to_tuple.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
#include <boost/preprocessor/list/enum.hpp>
#include <boost/preprocessor/stringize.hpp>
Go to the source code of this file.
Classes | |
class | mace::stub::vtable< InterfaceType, InterfaceDelegate > |
Contains functors defined by InterfaceDelegate for each reflected member of InterfaceType. More... | |
struct | mace::stub::vtable_reflector< InterfaceType, InterfaceDelegate > |
Enables specialization of visit for InterfaceType. More... | |
class | mace::stub::vtable_base< t > |
Defines | |
#define | MACE_STUB_VTABLE_PUBLIC_BASE(r, data, elem) mace::stub::vtable<elem,data>, |
#define | MACE_STUB_VTABLE_DEFINE_MEMBER(r, data, elem) |
#define | MACE_STUB_VTABLE_VISIT_BASE(r, visitor, name) vtable_reflector<name,InterfaceDelegate>::visit( visitor ); |
#define | TEMPLATE template |
#define | MACE_STUB_VTABLE_VISIT_MEMBER(r, visitor, elem) visitor.TEMPLATE operator()<BOOST_TYPEOF(&vtable_type::elem),&vtable_type::elem>( BOOST_PP_STRINGIZE(elem) ); |
#define | MACE_STUB_SEQ_ENUM(X) |
#define | MACE_STUB_DERIVED(NAME, INHERITS, MEMBERS) |
#define | MACE_STUB(NAME, MEMBERS) MACE_STUB_DERIVED( NAME, BOOST_PP_SEQ_NIL, MEMBERS ) |
This class defines the macros and types used to implement a STUB interface.
Definition in file vtable.hpp.
#define MACE_STUB | ( | NAME, | |
MEMBERS | |||
) | MACE_STUB_DERIVED( NAME, BOOST_PP_SEQ_NIL, MEMBERS ) |
NAME | a fully qualified class name. |
MEMBERS | a sequence of member methods on NAME ie: (method1)(method2)(method3)... |
Definition at line 132 of file vtable.hpp.
#define MACE_STUB_DERIVED | ( | NAME, | |
INHERITS, | |||
MEMBERS | |||
) |
namespace mace { namespace stub { \ template<typename InterfaceDelegate > \ struct vtable<NAME,InterfaceDelegate> : BOOST_PP_SEQ_FOR_EACH( MACE_STUB_VTABLE_PUBLIC_BASE, InterfaceDelegate, INHERITS ) private vtable_base<NAME> { \ typedef NAME interface_type; \ typedef InterfaceDelegate delegate_type; \ BOOST_PP_SEQ_FOR_EACH( MACE_STUB_VTABLE_DEFINE_MEMBER, NAME, MEMBERS ) \ }; \ template<typename InterfaceDelegate> struct vtable_reflector<NAME,InterfaceDelegate> { \ typedef NAME interface_type; \ template<typename Visitor> \ static void visit( const Visitor& visitor ) { \ typedef mace::stub::vtable<NAME,InterfaceDelegate> vtable_type; \ BOOST_PP_SEQ_FOR_EACH( MACE_STUB_VTABLE_VISIT_BASE, visitor, INHERITS ) \ BOOST_PP_SEQ_FOR_EACH( MACE_STUB_VTABLE_VISIT_MEMBER, visitor, MEMBERS ) \ } \ };\ \ } }
NAME | a fully qualified class name. |
INHERITS | a sequence of fully qualified base classes that NAME inherits from ie: (method1)(method2)(method3)... |
MEMBERS | a sequence of member methods on NAME ie: (method1)(method2)(method3)... |
Definition at line 104 of file vtable.hpp.
#define MACE_STUB_SEQ_ENUM | ( | X | ) |
BOOST_PP_LIST_ENUM( \ BOOST_PP_LIST_REST( \ BOOST_PP_TUPLE_TO_LIST( BOOST_PP_INC(BOOST_PP_SEQ_SIZE(X)), BOOST_PP_SEQ_TO_TUPLE( \ BOOST_PP_SEQ_TRANSFORM( MACE_STUB_VTABLE_PUBLIC_BASE, InterfaceDelegate, BOOST_PP_SEQ_PUSH_FRONT(X,(null)) ) ) ) \ ) \ )
Definition at line 85 of file vtable.hpp.
#define MACE_STUB_VTABLE_DEFINE_MEMBER | ( | r, | |
data, | |||
elem | |||
) |
struct BOOST_PP_CAT( __stub__, elem) : \ public InterfaceDelegate::template calculate_type<BOOST_TYPEOF(&interface_type::elem)>::type { \ typedef typename InterfaceDelegate::template calculate_type<BOOST_TYPEOF(&interface_type::elem)>::type base_type; \ using base_type::operator=;\ template<typename Type>\ static decltype(&Type::elem) get_member_ptr() { return &Type::elem; } \ } elem;
Definition at line 61 of file vtable.hpp.