[a86666] | 1 | /** \file PotentialTypes.hpp
|
---|
| 2 | *
|
---|
| 3 | * This is a enhanced enumeration to make it usable within a loop.
|
---|
| 4 | *
|
---|
| 5 | * date: Apr, 09 2013
|
---|
| 6 | * author: heber
|
---|
| 7 | *
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #ifndef POTENTIALTYPES_HPP_
|
---|
| 11 | #define POTENTIALTYPES_HPP_
|
---|
| 12 |
|
---|
| 13 | // include config.h
|
---|
| 14 | #ifdef HAVE_CONFIG_H
|
---|
| 15 | #include <config.h>
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
[aa91de0] | 18 | #include <cstddef>
|
---|
| 19 |
|
---|
[a86666] | 20 | #include <boost/preprocessor/seq/elem.hpp>
|
---|
| 21 | #include <boost/preprocessor/seq/seq.hpp>
|
---|
| 22 | #include <boost/preprocessor/seq/size.hpp>
|
---|
| 23 | #include <boost/preprocessor/iteration/local.hpp>
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | #include "PotentialTypes.def"
|
---|
| 27 |
|
---|
| 28 | //!> function to print each member of the sequence in the enumeration
|
---|
| 29 | #define sequence_print(z,n,seq) \
|
---|
| 30 | BOOST_PP_SEQ_ELEM(n, seq) ,
|
---|
| 31 |
|
---|
| 32 | //!> enumeration of all known and createable potentials
|
---|
| 33 | enum PotentialTypes {
|
---|
| 34 | // some proprocessor magic to generate the body from the above sequence
|
---|
| 35 | #if defined PotentialTypes_END // do we have parameters at all?
|
---|
| 36 | #define BOOST_PP_LOCAL_MACRO(n) sequence_print(~, n, POTENTIALSEQUENCE)
|
---|
| 37 | #define BOOST_PP_LOCAL_LIMITS (0, PotentialTypes_END-1)
|
---|
| 38 | #include BOOST_PP_LOCAL_ITERATE()
|
---|
| 39 | #undef BOOST_PP_LOCAL_MACRO
|
---|
| 40 | #undef BOOST_PP_LOCAL_LIMITS
|
---|
| 41 | #endif
|
---|
| 42 | PotentialTypes_end = PotentialTypes_END,
|
---|
| 43 | PotentialTypes_begin = BOOST_PP_SEQ_HEAD(POTENTIALSEQUENCE)
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | #undef sequence_print
|
---|
| 47 |
|
---|
| 48 | //!> Number of known PotentialTypes
|
---|
| 49 | const size_t PotentialTypesMax = PotentialTypes_END;
|
---|
| 50 |
|
---|
| 51 | #include "PotentialTypes.undef"
|
---|
| 52 |
|
---|
| 53 | //!> Typedef for enumeration to ease its use
|
---|
| 54 | typedef enum PotentialTypes PotentialTypes;
|
---|
| 55 |
|
---|
| 56 | /** Increment operator for the enumeration PotentialTypes to allow loops.
|
---|
| 57 | * \param &type value
|
---|
| 58 | * \return value incremented by one
|
---|
| 59 | */
|
---|
| 60 | PotentialTypes &operator++(PotentialTypes &type);
|
---|
| 61 |
|
---|
| 62 | #endif /* POTENTIALTYPES_HPP_ */
|
---|
| 63 |
|
---|