2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2018, 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.
36 #ifndef GMXAPI_SESSION_RESOURCES_IMPL_H
37 #define GMXAPI_SESSION_RESOURCES_IMPL_H
40 * \brief Implementation details for SessionResources infrastructure.
42 * Define the library interface for classes with opaque external interfaces.
44 * These are specifically details of the gmx Mdrunner session implementation.
46 * \author M. Eric Irrgang <ericirrgang@gmail.com>
50 #include "gmxapi/session/resources.h"
54 #include "gmxapi/md/mdsignals.h"
55 #include "gmxapi/session.h"
61 * \brief Consumer-specific access to Session resources.
63 * Each element of work that is managed by a Session and which may need access to Session resources
64 * is uniquely identified. SessionResources objects allow client code to be identified by the
65 * Session so that appropriate resources can be acquired when needed.
67 * Resources are configured at Session launch by SessionImpl::createResources()
71 class SessionResources final
75 * \brief Construct a resources object for the named operation.
77 * \param session implementation object backing these resources.
78 * \param name Unique name of workflow operation.
80 SessionResources(SessionImpl
* session
, std::string name
);
83 * \brief no default constructor.
85 * \see SessionResources(SessionImpl* session, std::string name)
87 SessionResources() = delete;
91 * \brief Not moveable or copyable.
93 * Objects of this type should only exist in their Session container.
94 * If necessary, ownership can be transferred by owning through a unique_ptr handle.
96 SessionResources(const SessionResources
&) = delete;
97 SessionResources
&operator=(const SessionResources
&) = delete;
98 SessionResources(SessionResources
&&) = delete;
99 SessionResources
&operator=(SessionResources
&&) = delete;
105 * \brief Get the name of the gmxapi operation for which these resources exist.
107 * \return workflow element name
109 const std::string
name() const;
112 * \brief Get a Signal instance implementing the requested MD signal.
114 * The caller is responsible for ensuring that the session is still active.
115 * Unfortunately, there isn't really a way to do that right now. This needs improvemnt
116 * in a near future version.
118 * Also, this is an external interface that should avoid throwing exceptions for ABI compatibility.
120 * \param signal currently must be gmxapi::md::signals::STOP
121 * \return callable object.
125 * auto signal = sessionResources->getMdrunnerSignal(md::signals::STOP);
128 * \throws gmxapi::NotImplementedError if an implementation is not available for the requested signal.
129 * \throws gmxapi::ProtocolError if the Session or Signaller is not available.
131 Signal
getMdrunnerSignal(md::signals signal
);
134 * \brief pointer to the session owning these resources
136 SessionImpl
* sessionImpl_
= nullptr;
139 * \brief name of the associated gmxapi operation
144 } // end namespace gmxapi
146 #endif //GMXAPI_SESSION_RESOURCES_IMPL_H