#ifndef GMX_OPTIONS_H
#define GMX_OPTIONS_H
+#include "options/basicoptioninfo.h"
#include "options/basicoptions.h"
+#include "options/filenameoptioninfo.h"
+#include "options/filenameoption.h"
#include "options/options.h"
#endif
basicoptions.h
cmdlinehelpwriter.h
cmdlineparser.h
+ filenameoption.h
+ filenameoptioninfo.h
optionfiletype.h
optionflags.h
optioninfo.h
class IntegerOptionStorage;
class DoubleOptionStorage;
class StringOptionStorage;
-class FileNameOptionStorage;
/*! \addtogroup module_options
* \{
explicit StringOptionInfo(StringOptionStorage *option);
};
-/*! \brief
- * Wrapper class for accessing file name option information.
- *
- * \inpublicapi
- */
-class FileNameOptionInfo : public OptionInfo
-{
- public:
- //! Creates an option info object for the given option.
- explicit FileNameOptionInfo(FileNameOptionStorage *option);
-
- //! Whether the option specifies an input file.
- bool isInputFile() const;
- //! Whether the option specifies an output file.
- bool isOutputFile() const;
- //! Whether the option specifies a file used for both input and output.
- bool isInputOutputFile() const;
- /*! \brief
- * Whether the option specifies a library file.
- *
- * \see FileNameOption::libraryFile()
- */
- bool isLibraryFile() const;
-
- private:
- const FileNameOptionStorage &option() const;
-};
-
/*!\}*/
} // namespace gmx
*/
/*! \internal \file
* \brief
- * Implements classes in basicoptions.h and basicoptionstorage.h.
+ * Implements classes in basicoptions.h, basicoptioninfo.h and
+ * basicoptionstorage.h.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
* \ingroup module_options
#include <vector>
#include "gromacs/options/basicoptioninfo.h"
-#include "gromacs/options/options.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/format.h"
return value;
}
-
-/********************************************************************
- * FileNameOptionStorage
- */
-
-FileNameOptionStorage::FileNameOptionStorage(const FileNameOption &settings)
- : MyBase(settings), info_(this), filetype_(settings.filetype_),
- bRead_(settings.bRead_), bWrite_(settings.bWrite_),
- bLibrary_(settings.bLibrary_)
-{
-}
-
-std::string FileNameOptionStorage::formatValue(int i) const
-{
- return values()[i];
-}
-
-void FileNameOptionStorage::convertValue(const std::string &value)
-{
- // TODO: Proper implementation.
- addValue(value);
-}
-
-/********************************************************************
- * FileNameOptionInfo
- */
-
-FileNameOptionInfo::FileNameOptionInfo(FileNameOptionStorage *option)
- : OptionInfo(option)
-{
-}
-
-const FileNameOptionStorage &FileNameOptionInfo::option() const
-{
- return static_cast<const FileNameOptionStorage &>(OptionInfo::option());
-}
-
-bool FileNameOptionInfo::isInputFile() const
-{
- return option().isInputFile();
-}
-
-bool FileNameOptionInfo::isOutputFile() const
-{
- return option().isOutputFile();
-}
-
-bool FileNameOptionInfo::isInputOutputFile() const
-{
- return option().isInputOutputFile();
-}
-
-bool FileNameOptionInfo::isLibraryFile() const
-{
- return option().isLibraryFile();
-}
-
-/********************************************************************
- * FileNameOption
- */
-
-AbstractOptionStoragePointer FileNameOption::createStorage() const
-{
- return AbstractOptionStoragePointer(new FileNameOptionStorage(*this));
-}
-
} // namespace gmx
#include "../utility/gmxassert.h"
#include "abstractoption.h"
-#include "optionfiletype.h"
namespace gmx
{
class IntegerOptionStorage;
class DoubleOptionStorage;
class StringOptionStorage;
-class FileNameOptionStorage;
-class Options;
/*! \addtogroup module_options
* \{
friend class StringOptionStorage;
};
-/*! \brief
- * Specifies an option that provides file names.
- *
- * Public methods in this class do not throw.
- *
- * This class is currently a stub implementation.
- *
- * \inpublicapi
- */
-class FileNameOption : public OptionTemplate<std::string, FileNameOption>
-{
- public:
- //! Initializes an option with the given name.
- explicit FileNameOption(const char *name)
- : MyBase(name), filetype_(eftUnknown),
- bRead_(false), bWrite_(false), bLibrary_(false)
- {
- }
-
- /*! \brief
- * Sets the type of the file this option accepts.
- *
- * This attribute must be provided.
- */
- MyClass &filetype(OptionFileType type)
- { filetype_ = type; return me(); }
- //! Tells that the file provided by this option is used read-only.
- MyClass &readOnly()
- { bRead_ = true; bWrite_ = false; return me(); }
- //! Tells that the file provided by this option is used write-only.
- MyClass &writeOnly()
- { bRead_ = false; bWrite_ = true; return me(); }
- /*! \brief
- * Tells that the file provided by this option is used for reading and
- * writing.
- */
- MyClass &readWrite()
- { bRead_ = bWrite_ = true; return me(); }
- /*! \brief
- * Tells that the file will be looked up in library directories in
- * addition to working directory.
- */
- MyClass &libraryFile() { bLibrary_ = true; return me(); }
-
- private:
- //! Creates a FileNameOptionStorage object.
- virtual AbstractOptionStoragePointer createStorage() const;
-
- OptionFileType filetype_;
- bool bRead_;
- bool bWrite_;
- bool bLibrary_;
-
- /*! \brief
- * Needed to initialize FileNameOptionStorage from this class without
- * otherwise unnecessary accessors.
- */
- friend class FileNameOptionStorage;
-};
-
/*!\}*/
} // namespace gmx
#include "basicoptions.h"
#include "basicoptioninfo.h"
-#include "optionfiletype.h"
#include "optionstoragetemplate.h"
namespace gmx
class IntegerOption;
class DoubleOption;
class StringOption;
-class FileNameOption;
/*! \addtogroup module_options
* \{
int *_enumIndexStore;
};
-/*! \internal \brief
- * Converts, validates, and stores file names.
- */
-class FileNameOptionStorage : public OptionStorageTemplate<std::string>
-{
- public:
- //! \copydoc StringOptionStorage::StringOptionStorage()
- explicit FileNameOptionStorage(const FileNameOption &settings);
-
- virtual OptionInfo &optionInfo() { return info_; }
- virtual const char *typeString() const { return "file"; }
- virtual std::string formatValue(int i) const;
-
- //! \copydoc FileNameOptionInfo::isInputFile()
- bool isInputFile() const { return bRead_ && !bWrite_; }
- //! \copydoc FileNameOptionInfo::isOutputFile()
- bool isOutputFile() const { return !bRead_ && bWrite_; }
- //! \copydoc FileNameOptionInfo::isInputOutputFile()
- bool isInputOutputFile() const { return bRead_ && bWrite_; }
- //! \copydoc FileNameOptionInfo::isLibraryFile()
- bool isLibraryFile() const { return bLibrary_; }
-
- private:
- virtual void convertValue(const std::string &value);
-
- FileNameOptionInfo info_;
- OptionFileType filetype_;
- bool bRead_;
- bool bWrite_;
- bool bLibrary_;
-};
-
/*!\}*/
} // namespace gmx
#include <string>
#include "gromacs/options/basicoptioninfo.h"
+#include "gromacs/options/filenameoptioninfo.h"
#include "gromacs/options/options.h"
#include "gromacs/options/optionsvisitor.h"
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ */
+/*! \internal \file
+ * \brief
+ * Implements classes in filenameoption.h, filenameoptioninfo.h and
+ * filenameoptionstorage.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_options
+ */
+#include "gromacs/options/filenameoption.h"
+
+#include <string>
+
+#include "gromacs/options/filenameoptioninfo.h"
+
+#include "filenameoptionstorage.h"
+
+namespace gmx
+{
+
+/********************************************************************
+ * FileNameOptionStorage
+ */
+
+FileNameOptionStorage::FileNameOptionStorage(const FileNameOption &settings)
+ : MyBase(settings), info_(this), filetype_(settings.filetype_),
+ bRead_(settings.bRead_), bWrite_(settings.bWrite_),
+ bLibrary_(settings.bLibrary_)
+{
+}
+
+std::string FileNameOptionStorage::formatValue(int i) const
+{
+ return values()[i];
+}
+
+void FileNameOptionStorage::convertValue(const std::string &value)
+{
+ // TODO: Proper implementation.
+ addValue(value);
+}
+
+/********************************************************************
+ * FileNameOptionInfo
+ */
+
+FileNameOptionInfo::FileNameOptionInfo(FileNameOptionStorage *option)
+ : OptionInfo(option)
+{
+}
+
+const FileNameOptionStorage &FileNameOptionInfo::option() const
+{
+ return static_cast<const FileNameOptionStorage &>(OptionInfo::option());
+}
+
+bool FileNameOptionInfo::isInputFile() const
+{
+ return option().isInputFile();
+}
+
+bool FileNameOptionInfo::isOutputFile() const
+{
+ return option().isOutputFile();
+}
+
+bool FileNameOptionInfo::isInputOutputFile() const
+{
+ return option().isInputOutputFile();
+}
+
+bool FileNameOptionInfo::isLibraryFile() const
+{
+ return option().isLibraryFile();
+}
+
+/********************************************************************
+ * FileNameOption
+ */
+
+AbstractOptionStoragePointer FileNameOption::createStorage() const
+{
+ return AbstractOptionStoragePointer(new FileNameOptionStorage(*this));
+}
+
+} // namespace gmx
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ */
+/*! \file
+ * \brief
+ * Declares gmx::FileNameOption for setting file name options.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \inpublicapi
+ * \ingroup module_options
+ */
+#ifndef GMX_OPTIONS_FILENAMEOPTION_H
+#define GMX_OPTIONS_FILENAMEOPTION_H
+
+#include <string>
+
+#include "abstractoption.h"
+#include "optionfiletype.h"
+
+namespace gmx
+{
+
+class FileNameOptionStorage;
+
+/*! \brief
+ * Specifies an option that provides file names.
+ *
+ * Public methods in this class do not throw.
+ *
+ * This class is currently a stub implementation.
+ *
+ * \inpublicapi
+ * \ingroup module_options
+ */
+class FileNameOption : public OptionTemplate<std::string, FileNameOption>
+{
+ public:
+ //! Initializes an option with the given name.
+ explicit FileNameOption(const char *name)
+ : MyBase(name), filetype_(eftUnknown),
+ bRead_(false), bWrite_(false), bLibrary_(false)
+ {
+ }
+
+ /*! \brief
+ * Sets the type of the file this option accepts.
+ *
+ * This attribute must be provided.
+ */
+ MyClass &filetype(OptionFileType type)
+ { filetype_ = type; return me(); }
+ //! Tells that the file provided by this option is used read-only.
+ MyClass &readOnly()
+ { bRead_ = true; bWrite_ = false; return me(); }
+ //! Tells that the file provided by this option is used write-only.
+ MyClass &writeOnly()
+ { bRead_ = false; bWrite_ = true; return me(); }
+ /*! \brief
+ * Tells that the file provided by this option is used for reading and
+ * writing.
+ */
+ MyClass &readWrite()
+ { bRead_ = bWrite_ = true; return me(); }
+ /*! \brief
+ * Tells that the file will be looked up in library directories in
+ * addition to working directory.
+ */
+ MyClass &libraryFile() { bLibrary_ = true; return me(); }
+
+ private:
+ //! Creates a FileNameOptionStorage object.
+ virtual AbstractOptionStoragePointer createStorage() const;
+
+ OptionFileType filetype_;
+ bool bRead_;
+ bool bWrite_;
+ bool bLibrary_;
+
+ /*! \brief
+ * Needed to initialize FileNameOptionStorage from this class without
+ * otherwise unnecessary accessors.
+ */
+ friend class FileNameOptionStorage;
+};
+
+} // namespace gmx
+
+#endif
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ */
+/*! \file
+ * \brief
+ * Declares gmx::FileNameOptionInfo.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \inpublicapi
+ * \ingroup module_options
+ */
+#ifndef GMX_OPTIONS_FILENAMEOPTIONINFO_H
+#define GMX_OPTIONS_FILENAMEOPTIONINFO_H
+
+#include "optioninfo.h"
+
+namespace gmx
+{
+
+class FileNameOptionStorage;
+
+/*! \brief
+ * Wrapper class for accessing file name option information.
+ *
+ * \inpublicapi
+ * \ingroup module_options
+ */
+class FileNameOptionInfo : public OptionInfo
+{
+ public:
+ //! Creates an option info object for the given option.
+ explicit FileNameOptionInfo(FileNameOptionStorage *option);
+
+ //! Whether the option specifies an input file.
+ bool isInputFile() const;
+ //! Whether the option specifies an output file.
+ bool isOutputFile() const;
+ //! Whether the option specifies a file used for both input and output.
+ bool isInputOutputFile() const;
+ /*! \brief
+ * Whether the option specifies a library file.
+ *
+ * \see FileNameOption::libraryFile()
+ */
+ bool isLibraryFile() const;
+
+ private:
+ const FileNameOptionStorage &option() const;
+};
+
+} // namespace gmx
+
+#endif
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ */
+/*! \internal \file
+ * \brief
+ * Declares gmx::FileNameOptionStorage.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_options
+ */
+#ifndef GMX_OPTIONS_FILENAMEOPTIONSTORAGE_H
+#define GMX_OPTIONS_FILENAMEOPTIONSTORAGE_H
+
+#include <string>
+
+#include "filenameoption.h"
+#include "filenameoptioninfo.h"
+#include "optionfiletype.h"
+#include "optionstoragetemplate.h"
+
+namespace gmx
+{
+
+class FileNameOption;
+
+/*! \internal \brief
+ * Converts, validates, and stores file names.
+ */
+class FileNameOptionStorage : public OptionStorageTemplate<std::string>
+{
+ public:
+ //! \copydoc StringOptionStorage::StringOptionStorage()
+ explicit FileNameOptionStorage(const FileNameOption &settings);
+
+ virtual OptionInfo &optionInfo() { return info_; }
+ virtual const char *typeString() const { return "file"; }
+ virtual std::string formatValue(int i) const;
+
+ //! \copydoc FileNameOptionInfo::isInputFile()
+ bool isInputFile() const { return bRead_ && !bWrite_; }
+ //! \copydoc FileNameOptionInfo::isOutputFile()
+ bool isOutputFile() const { return !bRead_ && bWrite_; }
+ //! \copydoc FileNameOptionInfo::isInputOutputFile()
+ bool isInputOutputFile() const { return bRead_ && bWrite_; }
+ //! \copydoc FileNameOptionInfo::isLibraryFile()
+ bool isLibraryFile() const { return bLibrary_; }
+
+ private:
+ virtual void convertValue(const std::string &value);
+
+ FileNameOptionInfo info_;
+ OptionFileType filetype_;
+ bool bRead_;
+ bool bWrite_;
+ bool bLibrary_;
+};
+
+} // namespace gmx
+
+#endif
#include "gromacs/analysisdata/analysisdata.h"
#include "gromacs/analysisdata/modules/plot.h"
#include "gromacs/options/basicoptions.h"
+#include "gromacs/options/filenameoption.h"
#include "gromacs/options/options.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/analysisdata/analysisdata.h"
#include "gromacs/analysisdata/modules/plot.h"
#include "gromacs/options/basicoptions.h"
+#include "gromacs/options/filenameoption.h"
#include "gromacs/options/options.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/analysisdata/datamodule.h"
#include "gromacs/analysisdata/modules/plot.h"
#include "gromacs/options/basicoptions.h"
+#include "gromacs/options/filenameoption.h"
#include "gromacs/options/options.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "vec.h"
#include "gromacs/options/basicoptions.h"
+#include "gromacs/options/filenameoption.h"
#include "gromacs/options/options.h"
#include "gromacs/selection/indexutil.h"
#include "gromacs/selection/selectioncollection.h"