Gromacs  2023.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::OutputAdapterContainer Class Reference

#include <gromacs/coordinateio/outputadaptercontainer.h>


Storage for output adapters that modify the state of a t_trxframe object.

The OutputAdapterContainer is responsible for storing the number of OutputAdapters, as well as the bitmask representing the current requirements for constructing an CoordinateFile object with the modules registered. It is responsible for ensuring that no module can be registered multiple times, and that the correct order for some modifications is observed (e.g. we can not reduce the number of coordinates written to a file before we have set all the other flags). Any other behaviour indicates a programming error and triggers an assertion.

The abilities that need to be cross checked for the container are usually constrained by the file format the coordinate data will be written to. When declaring new abilities, these must match the file type for the output.


Keeping track of those abilities has to be the responsibility of an object implementing and interface that declares it capabilities and will execute the the function of writing to a file.

This could be changed to instead construct the container with a pointer to an ICoordinateOutputWriter that can be passed to the IOutputAdapter modules to check their cross-dependencies.

Public Member Functions

 OutputAdapterContainer (unsigned long abilities)
 Only allow constructing the container with defined output abilities.
 OutputAdapterContainer (CoordinateFileFlags abilities)
 Allow abilities to be also defined using the enum class.
void addAdapter (OutputAdapterPointer adapter, CoordinateFileFlags type)
 Add an adapter of a type not previously added. More...
ArrayRef< const
getAdapters ()
 Get vector of all registered adapters.
bool isEmpty () const
 Get info if we have any registered adapters.

Member Function Documentation

void gmx::OutputAdapterContainer::addAdapter ( OutputAdapterPointer  adapter,
CoordinateFileFlags  type 

Add an adapter of a type not previously added.

Only one adapter of each type can be registered, and the order of adapters is predefined in the underlying storage object. Calls internal checks to make sure that the new adapter does not violate any of the preconditions set to make an CoordinateFile object containing the registered modules.

[in]adapterunique_ptr to adapter, with container taking ownership here.
[in]typeWhat kind of adapter is being added.
InternalErrorWhen registering an adapter of a type already registered .
InconsistentInputErrorWhen incompatible modules are added.

The documentation for this class was generated from the following files: