/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2017,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
private:
//! Possible flags for \a flags_.
- enum Flag
+ enum Flag : uint64_t
{
efSet = 1 << 0, //!< Value has been set.
efErrorSet = 1 << 1, //!< Error estimate has been set.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2014,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* The flags related to default values are confusing, consider reorganizing
* them.
*/
-enum OptionFlag
+enum OptionFlag : uint64_t
{
//! %Option has been set.
efOption_Set = 1 << 0,
* These flags are not part of the public interface, even though they are in an
* installed header. They are needed in the implementation of SelectionOption.
*/
-enum SelectionFlag
+enum SelectionFlag : uint64_t
{
efSelection_OnlyStatic = 1 << 0,
efSelection_OnlyAtoms = 1 << 1,
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
class SelectionCollectionDataTest : public SelectionCollectionTest
{
public:
- enum TestFlag
+ enum TestFlag : uint64_t
{
efTestEvaluation = 1 << 0,
efTestPositionAtoms = 1 << 1,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2019, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \brief
* Template class for typesafe handling of combination of flags.
*
- * \tparam FlagType An enumerated type that holds the possible single flags.
+ * \tparam FlagType An enumerated type that holds the possible single flags. The enum
+ * must be of unsigned underlying type.
*
* This class is not used publicly, but is present in an installed header
* because it is used internally in public template classes.
class FlagsTemplate
{
public:
+ static_assert(std::is_enum_v<FlagType> && std::is_unsigned_v<std::underlying_type_t<FlagType>>,
+ "Flags must be an unsigned enum type.");
//! Creates a flags object with no flags set.
FlagsTemplate() : flags_(0) {}
//! Creates a flags object from a single flag.
//! Creates a flags object with the given flags.
explicit FlagsTemplate(unsigned long flags) : flags_(flags) {}
- unsigned long flags_;
+ uint64_t flags_;
};
} // namespace gmx