source: src/Potentials/Specifics/PotentialTypes.hpp@ 40fe06

FitPartialCharges_GlobalError
Last change on this file since 40fe06 was a86666, checked in by Frederik Heber <heber@…>, 12 years ago

Added PotentialTypes.

  • Property mode set to 100644
File size: 1.6 KB
Line 
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
18#include <boost/preprocessor/seq/elem.hpp>
19#include <boost/preprocessor/seq/seq.hpp>
20#include <boost/preprocessor/seq/size.hpp>
21#include <boost/preprocessor/iteration/local.hpp>
22
23
24#include "PotentialTypes.def"
25
26//!> function to print each member of the sequence in the enumeration
27#define sequence_print(z,n,seq) \
28 BOOST_PP_SEQ_ELEM(n, seq) ,
29
30 //!> enumeration of all known and createable potentials
31enum PotentialTypes {
32// some proprocessor magic to generate the body from the above sequence
33#if defined PotentialTypes_END // do we have parameters at all?
34#define BOOST_PP_LOCAL_MACRO(n) sequence_print(~, n, POTENTIALSEQUENCE)
35#define BOOST_PP_LOCAL_LIMITS (0, PotentialTypes_END-1)
36#include BOOST_PP_LOCAL_ITERATE()
37#undef BOOST_PP_LOCAL_MACRO
38#undef BOOST_PP_LOCAL_LIMITS
39#endif
40 PotentialTypes_end = PotentialTypes_END,
41 PotentialTypes_begin = BOOST_PP_SEQ_HEAD(POTENTIALSEQUENCE)
42};
43
44#undef sequence_print
45
46//!> Number of known PotentialTypes
47const size_t PotentialTypesMax = PotentialTypes_END;
48
49#include "PotentialTypes.undef"
50
51//!> Typedef for enumeration to ease its use
52typedef enum PotentialTypes PotentialTypes;
53
54/** Increment operator for the enumeration PotentialTypes to allow loops.
55 * \param &type value
56 * \return value incremented by one
57 */
58PotentialTypes &operator++(PotentialTypes &type);
59
60#endif /* POTENTIALTYPES_HPP_ */
61
Note: See TracBrowser for help on using the repository browser.