48 #include <boost/preprocessor/facilities/empty.hpp> 49 #include <boost/preprocessor/seq/for_each.hpp> 53 #define GETID(field) field##_ID 54 #define VISIT_SC(mask, superclass, method) \ 56 if(((1 << GETID(superclass)) & (mask)) == 0) \ 57 this->superclass::method 58 #define VISIT_MEMBER_NAMED(ref_obj_name, mask, ref_obj, method) \ 60 if(((1 << GETID(ref_obj_name)) & (mask)) == 0 && (ref_obj)) \ 62 #define VISIT_MEMBER(mask, ref_obj, method) VISIT_MEMBER_NAMED(ref_obj, mask, ref_obj, method) 63 #define SEQ_VISIT_MEMBER(mask, seq, seqbasetype, method, visitor_type, visitor_obj) \ 65 if(((1 << GETID(seq)) & (mask)) == 0 && !(seq).empty()) \ 66 std::for_each((seq).begin(), (seq).end(), \ 67 for_each_functor<seqbasetype, visitor_type>(&seqbasetype::method, visitor_obj)) 72 #define SET_NO_VISIT_INDEX(mask, index) ((mask) |= (1U << GETID(index))) 74 #define SET_VISIT_INDEX(mask, index) ((mask) &= ~(1U << GETID(index))) 77 #ifndef VISITED_OBJ_SEQ1 78 #error "VISITED_OBJ_SEQ1 has to be defined in the following form #define VISITED_OBJ_SEQ1 (w)(x)(y)(z)" 80 #ifndef VISITED_OBJ_SEQ2 81 #error "VISITED_OBJ_SEQ2 has to be defined in the following form #define VISITED_OBJ_SEQ2 (w)(x)(y)(z)" 84 #define OPERATOR_MACRO_HEADER(r, data, elem) virtual void operator()(const elem*, unsigned int&) 85 #define OPERATOR_MACRO_DECL(r, data, elem) OPERATOR_MACRO_HEADER(r, data, elem); 86 #define OPERATOR_MACRO(r, data, elem) \ 87 OPERATOR_MACRO_HEADER(r, data, elem) \ 90 #define OPERATOR_MACRO_HEADERO(r, data, elem) void operator()(const elem*, unsigned int&) override 91 #define OPERATOR_MACRO_DECLO(r, data, elem) OPERATOR_MACRO_HEADERO(r, data, elem); 92 #define OPERATOR_MACROO(r, data, elem) \ 93 OPERATOR_MACRO_HEADERO(r, data, elem) \ 98 #define FORWARD_DECLARATION_MACRO(r, data, elem) class elem; 101 #undef FORWARD_DECLARATION_MACRO 127 #undef VISITED_OBJ_SEQ1 128 #undef VISITED_OBJ_SEQ2 132 template <
class T,
class visitor_obj>
142 : visitor_function(_visitor_function), vo(_vo)
148 ((x.
get())->*visitor_function)(vo);
#define VISITED_OBJ_SEQ1
sequence of all objects
void(T::*const)(visitor_type) const visitor_function_type
#define FORWARD_DECLARATION_MACRO(r, data, elem)
forward declaration macro
#define OPERATOR_MACRO(r, data, elem)
virtual ~object_visitor()
destructor
for_each_functor(const visitor_function_type _visitor_function, visitor_type _vo)
constructor
BOOST_PP_SEQ_FOR_EACH(OPERATOR_MACRO, BOOST_PP_EMPTY, VISITED_OBJ_SEQ1)
virtual template object functor
Template definition of refcount.
visitor_type vo
visitor object
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
visitor_obj *const visitor_type
visitor type definition
functor used to traverse sequences with std::for_each
x
Return the smallest n such that 2^n >= _x.
void operator()(const refcount< T > &x) const
functor
const visitor_function_type visitor_function
visitor member