Introduce SimulatorBuilder
[gromacs.git] / src / gromacs / coordinateio / ioutputadapter.h
blob30121cfdbc827253e6ae13a49721c49ac6015377
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2019, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
35 /*! \file
36 * \brief
37 * Declares gmx::IOutputAdapter interface for modifying coordinate
38 * file structures before writing them to disk.
40 * \author Paul Bauer <paul.bauer.q@gmail.com>
41 * \inlibraryapi
42 * \ingroup module_coordinateio
44 #ifndef GMX_COORDINATEIO_IOUTPUTADAPTER_H
45 #define GMX_COORDINATEIO_IOUTPUTADAPTER_H
47 #include <memory>
49 #include "gromacs/coordinateio/enums.h"
50 #include "gromacs/utility/classhelpers.h"
52 struct t_trxframe;
54 namespace gmx
57 /*!\brief
58 * OutputAdapter class for handling trajectory file flag setting and processing.
60 * This interface provides the base point upon which modules that modify trajectory frame
61 * datastructures should be build. The interface itself does not provide any direct means
62 * to modify the data, but only gives the virtual method to perform work on a
63 * t_trxframe object. Classes that modify trajectory frames should implement this interface.
65 * \inlibraryapi
66 * \ingroup module_coordinateio
69 class IOutputAdapter
71 public:
72 /*! \brief
73 * Default constructor for IOutputAdapter interface.
75 IOutputAdapter()
78 virtual ~IOutputAdapter()
81 //! Move constructor for old object.
82 explicit IOutputAdapter(IOutputAdapter &&old) noexcept = default;
84 /*! \brief
85 * Change t_trxframe according to user input.
87 * \param[in] framenumber Frame number as reported from the
88 * trajectoryanalysis framework or set by user.
89 * \param[in,out] input Pointer to trajectory analysis frame that will
90 * be worked on.
92 virtual void processFrame(int framenumber, t_trxframe *input) = 0;
94 /*! \brief
95 * Checks that the abilities of the output writer are sufficient for this adapter.
97 * It can happen that a method to write coordinate files does not match with
98 * a requested operation on the input data (e.g. the user requires velocities or
99 * forces to be written to a PDB file).
100 * To check those dependencies, derived classes need to implement a version of this
101 * function to make sure that only matching methods can be used.
103 * \param[in] abilities The abilities of an output method that need to be checked against
104 * the dependencies created by using the derived method.
105 * \throws InconsistentInputError If dependencies can not be matched to abilities.
107 virtual void checkAbilityDependencies(unsigned long abilities) const = 0;
109 GMX_DISALLOW_COPY_AND_ASSIGN(IOutputAdapter);
113 //! Smart pointer to manage the frame adapter object.
114 using OutputAdapterPointer = std::unique_ptr<IOutputAdapter>;
116 } // namespace gmx
118 #endif