Listing 5

#define DEF_REFLECTED_ATTRIBUTE(ValueType, TagName) 		\
    struct TagName{};                             		\
    enum {TagName##GappedNum = __LINE__ - beginLineNo}; 	\
    template<int Dummy> struct AttributeNum<TagName##GappedNum,	\
                                         Dummy>    		\
{                                                   	\
        typedef int IsGap;                        		\
        typedef AttributeNum<TagName##GappedNum - 1,Dummy> 	\
                            PrevOrGap;                 	\
        enum {PrevIsGap = ::boost::is_same<                	\
                                   typename PrevOrGap::IsGap, 	\
                                   Gap_Num>::value};       	\
        typedef typename boost::ct_if<(PrevIsGap != 0),     	\
                                 typename PrevOrGap::PrevNoGap,\
                                 PrevOrGap >::type        	\
        PrevNoGap;                                        	\
                                                         	\
        enum { value =  PrevNoGap::value + 1};           	\
    };                                               	\
    enum {TagName##Num = AttributeNum<                     	\
                                TagName##GappedNum>::value}; 	\
    template<int Dummy> struct GetNameTag<TagName##Num, Dummy> 	\
    {                                                  	\
        typedef TagName type;                             	\
    };                                                   	\
    template<int Dummy> struct GetValueType<TagName##Num,   	\
                                            Dummy>         	\
    {                                                  	\
        typedef ValueType type;                          	\
    };                                                    	\
    template<int Dummy> struct GetValueTypeByTag<TagName,Dummy>	\
    {                                                    	\
        typedef ValueType type;                          	\
    };                                                  	\
    template<int Dummy> struct AttributePos<TagName, Dummy>  	\
    {                                                     	\
        enum {value = TagName##Num};                     	\
    };                                                 	\
    ValueType TagName##_;                            	\
    const ValueType& get##TagName() const               	\
    { return  TagName##_; }                            	\
    ValueType& get##TagName()                           	\
    { return  TagName##_; }                             	\
    void set##TagName(const ValueType& newValue)         	\
    {                                                 	\
        TagName##_ = newValue;                        	\
    }                                                   	\