Savarese Software Research Corporation
wisp_struct.h File Reference

This header defines the WISP_STRUCT generative macro. More...

#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/control/expr_iif.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/comparison/less_equal.hpp>
#include <boost/preprocessor/comparison/greater_equal.hpp>
#include <boost/preprocessor/seq.hpp>
#include <boost/preprocessor/array/elem.hpp>
#include <boost/preprocessor/array/push_front.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/call_traits.hpp>
#include <ssrc/wisp-packages.h>
Include dependency graph for wisp_struct.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct   wisp_struct
 

Macros

#define  __WISP_STRUCT_MEMBER(r, data, arg)   BOOST_PP_TUPLE_ELEM(2, 0, arg) BOOST_PP_TUPLE_ELEM(2, 1, arg);
 
#define  __WISP_STRUCT_DEFAULT_INIT_MEMBER(r, data, i, arg)   BOOST_PP_COMMA_IF(i) BOOST_PP_TUPLE_ELEM(2, 1, arg)()
 
#define  __WISP_STRUCT_INIT_MEMBER(r, data, i, arg)   BOOST_PP_COMMA_IF(i) BOOST_PP_TUPLE_ELEM(2, 1, arg)(BOOST_PP_TUPLE_ELEM(2, 1, arg))
 
#define  __WISP_STRUCT_PARAM(r, in_template, i, arg)   BOOST_PP_COMMA_IF(i) BOOST_PP_EXPR_IIF(in_template, typename) boost::call_traits<BOOST_PP_TUPLE_ELEM(2, 0, arg)>::param_type BOOST_PP_TUPLE_ELEM(2, 1, arg)
 
#define  __WISP_STRUCT_PARAM_INIT(r, init, i, arg)   BOOST_PP_COMMA_IF(i) BOOST_PP_EXPR_IIF(BOOST_PP_ARRAY_ELEM(0, init), typename) boost::call_traits<BOOST_PP_TUPLE_ELEM(2, 0, arg)>::param_type BOOST_PP_TUPLE_ELEM(2, 1, arg) BOOST_PP_EXPR_IIF(BOOST_PP_GREATER_EQUAL(i, BOOST_PP_ARRAY_ELEM(1, init)), = BOOST_PP_ARRAY_ELEM(BOOST_PP_SUB(BOOST_PP_ADD(i, 2), BOOST_PP_ARRAY_ELEM(1, init)), init))
 
#define  __WISP_STRUCT_SERIALIZE(r, data, arg)   & BOOST_PP_TUPLE_ELEM(2, 1, arg)
 
#define  __WISP_STRUCT_SERIALIZE_MEMBERS(members)
 
#define  __WISP_STRUCT_EQOP_TEST(r, data, i, arg)   BOOST_PP_EXPR_IF(i, &&) (o1.BOOST_PP_TUPLE_ELEM(2, 1, arg) == o2.BOOST_PP_TUPLE_ELEM(2, 1, arg))
 
#define  __WISP_STRUCT_EQOP(name, seq)
 
#define  __WISP_STRUCT_VISIT_MEMBERS(r, v, arg)    (BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(2, 1, arg)), BOOST_PP_TUPLE_ELEM(2, 1, arg))
 
#define  __WISP_STRUCT_VISIT(members)
 
#define  __WISP_STRUCT(in_template, name, members)
 
#define  __WISP_STRUCT_WITH_INIT(in_template, name, members, initializers)
 
#define  WISP_STRUCT(name, members)   struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT(0, name, members) }
 
#define  WISP_STRUCT_T(name, members)   struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT(1, name, members) }
 
#define  WISP_STRUCT_WITH_INIT(name, members, initializers)    struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT_WITH_INIT(0, name, members, BOOST_PP_SEQ_TO_ARRAY(initializers)) }
 
#define  WISP_STRUCT_WITH_INIT_T(name, members, initializers)    struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT_WITH_INIT(1, name, members, BOOST_PP_SEQ_TO_ARRAY(initializers)) }
 

Detailed Description

This header defines the WISP_STRUCT generative macro.

Definition in file wisp_struct.h.

Macro Definition Documentation

#define __WISP_STRUCT (   in_template,
  name,
  members 
)
Value:
BOOST_PP_SEQ_FOR_EACH(__WISP_STRUCT_MEMBER, _, members) \
name() : \
BOOST_PP_SEQ_FOR_EACH_I(__WISP_STRUCT_DEFAULT_INIT_MEMBER, _, members) { } \
explicit name(BOOST_PP_SEQ_FOR_EACH_I(__WISP_STRUCT_PARAM, in_template, members)) : \
BOOST_PP_SEQ_FOR_EACH_I(__WISP_STRUCT_INIT_MEMBER, _, members) { } \
__WISP_STRUCT_EQOP(name, members) \

Definition at line 109 of file wisp_struct.h.

#define __WISP_STRUCT_DEFAULT_INIT_MEMBER (   r,
  data,
  i,
  arg 
)    BOOST_PP_COMMA_IF(i) BOOST_PP_TUPLE_ELEM(2, 1, arg)()

Definition at line 51 of file wisp_struct.h.

#define __WISP_STRUCT_EQOP (   name,
  seq 
)
Value:
friend bool operator==(const name & o1, const name & o2) { \
return (BOOST_PP_SEQ_FOR_EACH_I(__WISP_STRUCT_EQOP_TEST, _, seq)); \
}

Definition at line 76 of file wisp_struct.h.

#define __WISP_STRUCT_EQOP_TEST (   r,
  data,
  i,
  arg 
)    BOOST_PP_EXPR_IF(i, &&) (o1.BOOST_PP_TUPLE_ELEM(2, 1, arg) == o2.BOOST_PP_TUPLE_ELEM(2, 1, arg))

Definition at line 73 of file wisp_struct.h.

#define __WISP_STRUCT_INIT_MEMBER (   r,
  data,
  i,
  arg 
)    BOOST_PP_COMMA_IF(i) BOOST_PP_TUPLE_ELEM(2, 1, arg)(BOOST_PP_TUPLE_ELEM(2, 1, arg))

Definition at line 54 of file wisp_struct.h.

#define __WISP_STRUCT_MEMBER (   r,
  data,
  arg 
)    BOOST_PP_TUPLE_ELEM(2, 0, arg) BOOST_PP_TUPLE_ELEM(2, 1, arg);

Definition at line 48 of file wisp_struct.h.

#define __WISP_STRUCT_PARAM (   r,
  in_template,
  i,
  arg 
)    BOOST_PP_COMMA_IF(i) BOOST_PP_EXPR_IIF(in_template, typename) boost::call_traits<BOOST_PP_TUPLE_ELEM(2, 0, arg)>::param_type BOOST_PP_TUPLE_ELEM(2, 1, arg)

Definition at line 57 of file wisp_struct.h.

#define __WISP_STRUCT_PARAM_INIT (   r,
  init,
  i,
  arg 
)    BOOST_PP_COMMA_IF(i) BOOST_PP_EXPR_IIF(BOOST_PP_ARRAY_ELEM(0, init), typename) boost::call_traits<BOOST_PP_TUPLE_ELEM(2, 0, arg)>::param_type BOOST_PP_TUPLE_ELEM(2, 1, arg) BOOST_PP_EXPR_IIF(BOOST_PP_GREATER_EQUAL(i, BOOST_PP_ARRAY_ELEM(1, init)), = BOOST_PP_ARRAY_ELEM(BOOST_PP_SUB(BOOST_PP_ADD(i, 2), BOOST_PP_ARRAY_ELEM(1, init)), init))

Definition at line 60 of file wisp_struct.h.

#define __WISP_STRUCT_SERIALIZE (   r,
  data,
  arg 
)    & BOOST_PP_TUPLE_ELEM(2, 1, arg)

Definition at line 63 of file wisp_struct.h.

#define __WISP_STRUCT_SERIALIZE_MEMBERS (   members )
Value:
template<class Archive> \
void serialize(Archive & ar, const unsigned int) { \
ar BOOST_PP_SEQ_FOR_EACH(__WISP_STRUCT_SERIALIZE, _, members); \
} \

Definition at line 66 of file wisp_struct.h.

#define __WISP_STRUCT_VISIT (   members )
Value:
template<typename Visitor> \
void visit(Visitor && visitor) { \
visitor BOOST_PP_SEQ_FOR_EACH(__WISP_STRUCT_VISIT_MEMBERS, visitor, members); \
} \
template<typename Visitor> \
void visit(Visitor && visitor) const { \
visitor BOOST_PP_SEQ_FOR_EACH(__WISP_STRUCT_VISIT_MEMBERS, visitor, members); \
}

Definition at line 93 of file wisp_struct.h.

#define __WISP_STRUCT_VISIT_MEMBERS (   r,
  v,
  arg 
)    (BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(2, 1, arg)), BOOST_PP_TUPLE_ELEM(2, 1, arg))

Definition at line 88 of file wisp_struct.h.

#define __WISP_STRUCT_WITH_INIT (   in_template,
  name,
  members,
  initializers 
)
Value:
BOOST_PP_SEQ_FOR_EACH(__WISP_STRUCT_MEMBER, _, members) \
explicit name(BOOST_PP_SEQ_FOR_EACH_I(__WISP_STRUCT_PARAM_INIT, BOOST_PP_ARRAY_PUSH_FRONT(BOOST_PP_ARRAY_PUSH_FRONT(initializers, BOOST_PP_SUB(BOOST_PP_SEQ_SIZE(members), BOOST_PP_ARRAY_SIZE(initializers))), in_template), members)) : \
BOOST_PP_SEQ_FOR_EACH_I(__WISP_STRUCT_INIT_MEMBER, _, members) { } \
__WISP_STRUCT_EQOP(name, members) \

Definition at line 119 of file wisp_struct.h.

#define WISP_STRUCT (   name,
  members 
)    struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT(0, name, members) }

Definition at line 127 of file wisp_struct.h.

#define WISP_STRUCT_T (   name,
  members 
)    struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT(1, name, members) }

Definition at line 130 of file wisp_struct.h.

#define WISP_STRUCT_WITH_INIT (   name,
  members,
  initializers 
)    struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT_WITH_INIT(0, name, members, BOOST_PP_SEQ_TO_ARRAY(initializers)) }

Definition at line 133 of file wisp_struct.h.

#define WISP_STRUCT_WITH_INIT_T (   name,
  members,
  initializers 
)    struct name : public NS_SSRC_WISP_UTILITY::wisp_struct { __WISP_STRUCT_WITH_INIT(1, name, members, BOOST_PP_SEQ_TO_ARRAY(initializers)) }

Definition at line 136 of file wisp_struct.h.


Savarese Software Research Corporation
Copyright © 2006-2012 Savarese Software Research Corporation. All rights reserved.