LOOS  v2.3.2
loos::TrajectoryWriter Class Referenceabstract

Base class for writing trajectories. More...

#include <trajwriter.hpp>

Inheritance diagram for loos::TrajectoryWriter:
Collaboration diagram for loos::TrajectoryWriter:

Public Member Functions

 TrajectoryWriter (const std::string &fname, const bool append=false)
 Write a trajectory to a file, optionally appending.
 
 TrajectoryWriter (std::iostream *s, const bool append=false)
 Write a trajectory to a stream. More...
 
virtual void setComments (const std::vector< std::string > &comments)
 Set comments in metadata (not all formats support)
 
virtual void setComments (const std::string &s)
 Set comment in metadata (not all formats support)
 
virtual void writeFrame (const AtomicGroup &model)=0
 Wirte a single frame.
 
virtual void writeFrame (const AtomicGroup &model, const uint step, const double time)
 Write a single frame specifying the step and timepoint. More...
 
virtual bool hasFrameStep () const
 Can format write step on a per-frame basis?
 
virtual bool hasFrameTime () const
 Can format write time on a per-frame basis?
 
virtual bool hasComments () const
 Does format support comments in metadata?
 
virtual uint framesWritten () const =0
 Total frames in output file. More...
 
bool isAppending () const
 Returns true if appending to an existing trajectory.
 

Protected Attributes

std::iostream * stream_
 
std::string _filename
 
bool appending_
 
bool delete_
 

Detailed Description

Base class for writing trajectories.

This is the interface for creating and writing to trajectories. The interface is kept simple on purpose to make it easy to work with multiple formats. This means that trajectory and frame metadata may be set to default values. If you need more control over how the trajectory is written, then use the derived classes explicitly.

Definition at line 53 of file trajwriter.hpp.

Constructor & Destructor Documentation

loos::TrajectoryWriter::TrajectoryWriter ( std::iostream *  s,
const bool  append = false 
)
inline

Write a trajectory to a stream.

Note that this constructor assumes that the stream is correctly prepped by the caller...if you need to seekp() to the end of the stream for appending, then this must be done before instantiating the TrajectoryWriter object.

Definition at line 75 of file trajwriter.hpp.

Member Function Documentation

virtual uint loos::TrajectoryWriter::framesWritten ( ) const
pure virtual

Total frames in output file.

For files being appended too, this includes the frames already written...

Implemented in loos::DCDWriter, and loos::XTCWriter.

virtual void loos::TrajectoryWriter::writeFrame ( const AtomicGroup model,
const uint  step,
const double  time 
)
inlinevirtual

Write a single frame specifying the step and timepoint.

Not all formats support this. By default, it will drop the extra data and call writeFrame()

Reimplemented in loos::XTCWriter.

Definition at line 102 of file trajwriter.hpp.


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