Merge remote branch 'origin/release-4-5-patches'
[alexxy/gromacs.git] / src / gromacs / options / optionflags.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11  * Copyright (c) 2001-2009, The GROMACS development team,
12  * check out http://www.gromacs.org for more information.
13
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * If you want to redistribute modifications, please consider that
20  * scientific software is very special. Version control is crucial -
21  * bugs must be traceable. We will be happy to consider code for
22  * inclusion in the official distribution, but derived work must not
23  * be called official GROMACS. Details are found in the README & COPYING
24  * files - if they are missing, get the official version at www.gromacs.org.
25  *
26  * To help us fund GROMACS development, we humbly ask that you cite
27  * the papers on the package - you can find them in the top README file.
28  *
29  * For more info, check our website at http://www.gromacs.org
30  */
31 /*! \internal \file
32  * \brief
33  * Defines flags used in option implementation.
34  *
35  * Symbols in this header are considered an implementation detail, and should
36  * not be accessed outside the module.
37  * Because of details in the implementation, it is still installed.
38  *
39  * \author Teemu Murtola <teemu.murtola@cbr.su.se>
40  * \ingroup module_options
41  */
42 #ifndef GMX_OPTIONS_OPTIONFLAGS_H
43 #define GMX_OPTIONS_OPTIONFLAGS_H
44
45 #include "../utility/flags.h"
46
47 namespace gmx
48 {
49
50 /*! \internal \brief
51  * Flags for options.
52  *
53  * These flags are not part of the public interface, even though they are in an
54  * installed header.  They are needed in a few template class implementations.
55  */
56 enum OptionFlag
57 {
58     //! %Option has been set.
59     efSet                 = 1<<0,
60     /*! \brief
61      * The current value of the option is a default value.
62      *
63      * This flag is also set when a new option source starts, such that values
64      * from the new source will overwrite old ones.
65      */
66     efHasDefaultValue     = 1<<1,
67     //! %Option is required to be set.
68     efRequired            = 1<<2,
69     //! %Option can be specified multiple times.
70     efMulti               = 1<<3,
71     //! %Option is hidden from standard help.
72     efHidden              = 1<<4,
73     /*! \brief
74      * %Option provides a boolean value.
75      *
76      * This is used to optionally support an alternative syntax where an
77      * option provided with no value sets the value to true and an
78      * option prefixed with "no" clears the value.
79      */
80     efBoolean             = 1<<5,
81     /*! \brief
82      * %Option value is a vector, but a single value is also accepted.
83      *
84      * If only a single value is provided, the storage object should fill the
85      * whole vector with that value.  The length of the vector must be fixed.
86      * The default length is 3 elements.
87      */
88     efVector              = 1<<6,
89     efExternalStore       = 1<<8,
90     efExternalStoreArray  = 1<<9,
91     efExternalValueVector = 1<<10,
92     //! %Option does not support default values.
93     efNoDefaultValue      = 1<<7,
94     /*! \brief
95      * Storage object may add zero values even when a value is provided.
96      *
97      * In order to do proper error checking, this flag should be set when it is
98      * possible that the AbstractOptionStorage::appendValue() method of the
99      * storage object does not add any values for the option and still
100      * succeeds.
101      */
102     efConversionMayNotAddValues = 1<<11,
103     /*! \brief
104      * Storage object does its custom checking for minimum value count.
105      *
106      * If this flag is set, the class derived from AbstractOptionStorage should
107      * implement processSet(), processAll(), and possible other functions it
108      * provides such that it always fails if not enough values are provided.
109      * This is useful to override the default check, which is done in
110      * AbstractOptionStorage::processSet().
111      */
112     efDontCheckMinimumCount     = 1<<16,
113     efFile                = 1<<12,
114     efFileRead            = 1<<13,
115     efFileWrite           = 1<<14,
116     efFileLibrary         = 1<<15,
117     //efDynamic             = 1<<16,
118     //efRanges              = 1<<17,
119     //efEnum                = 1<<18,
120     //efStaticEnum          = 1<<19,
121     //efVarNum              = 1<<20,
122     //efAtomVal             = 1<<21,
123 };
124
125 //! Holds a combination of ::OptionFlag values.
126 typedef FlagsTemplate<OptionFlag> OptionFlags;
127
128 } // namespace gmx
129
130 #endif