8#ifndef IMPDISPLAY_WRITER_H
9#define IMPDISPLAY_WRITER_H
11#include <IMP/display/display_config.h>
13#include "internal/writers.h"
18#include <boost/format.hpp>
20IMPDISPLAY_BEGIN_NAMESPACE
47 void set_frame(
unsigned int i);
48 int get_frame()
const {
return frame_; }
64 for (
unsigned int i = 0; i < g.size(); ++i) {
93 std::string file_name_;
120 if (file_name_.find(
"%1%") != std::string::npos) {
122 std::ostringstream oss;
123 oss << boost::format(file_name_) % get_frame();
143class IMPDISPLAYEXPORT WriterAdaptor :
public InputAdaptor {
147 WriterAdaptor(std::string name) : writer_(
create_writer(name)) {}
148 WriterAdaptor(
Writer* w) : writer_(w) {}
150 Writer* operator->()
const {
return writer_; }
151 operator Writer*()
const {
return writer_; }
153 Writer* get_writer()
const {
return writer_; }
160IMPDISPLAY_END_NAMESPACE
Provide a standard geometry processing framework.
A nullptr-initialized pointer to an IMP Object.
#define IMP_CHECK_OBJECT(obj)
Perform some basic validity checks on the object for memory debugging.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Common base class for heavy weight IMP objects.
Provide a standard geometry processing framework.
The base class for geometry.
virtual void do_set_frame() override
in case you want to take action on a new frame
TextWriter(std::string name)
Create a write for a file or files with the passed name or pattern.
virtual ~TextWriter()
Write the data and close the file.
std::string get_current_file_name() const
get the name of the current file being written
TextWriter(TextOutput fn)
Create a writer opening the file with the passed sink.
std::ostream & get_stream()
Get the stream for inheriting classes to write to.
Base class for writing geometry to a file.
Writer(std::string name)
Create a writer opening the file with the passed name.
virtual void do_close()=0
A hook for implementation classes to use to take actions on file close.
virtual void do_set_frame()
in case you want to take action on a new frame
virtual void do_open()=0
A hook for implementation classes to use to take actions on file open.
virtual ~Writer()
Write the data and close the file.
Implement geometry for the basic shapes from IMP.algebra.
IMP::Vector< WriterAdaptor > WriterAdaptors
Writer * create_writer(std::string filename)
IMP::Vector< IMP::Pointer< Geometry > > Geometries
IMP::Vector< IMP::Pointer< TextWriter > > TextWriters
IMP::Vector< IMP::Pointer< Writer > > Writers
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
A smart pointer to a ref-counted Object that is a class member.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.