|
Pteros
2.0
Molecular modeling library for human beings!
|
32 #include "pteros/core/system.h"
33 #include "pteros/core/selection.h"
45 bool atoms()
const {
return flags[0]; }
46 FileContent atoms(
bool val){ flags[0] = val;
return *
this;}
49 bool coord()
const {
return flags[1]; }
50 FileContent coord(
bool val){ flags[1] = val;
return *
this;}
53 bool traj()
const {
return flags[2]; }
54 FileContent traj(
bool val){ flags[2] = val;
return *
this;}
57 bool top()
const {
return flags[3]; }
58 FileContent top(
bool val){ flags[3] = val;
return *
this;}
61 bool rand()
const {
return flags[4]; }
62 FileContent rand(
bool val){ flags[4] = val;
return *
this;}
71 using FileHandler_ptr = std::unique_ptr<FileHandler>;
77 static FileHandler_ptr
recognize(std::string fname);
86 static FileHandler_ptr
open(std::string fname,
char open_mode);
89 virtual void open(
char open_mode) = 0;
114 void sanity_check_read(
System* sys,
Frame* frame,
const FileContent &what)
const;
115 void sanity_check_write(
const Selection& sel,
const FileContent& what)
const;
118 virtual bool do_read(
System* sys,
Frame* frame,
const FileContent& what) = 0;
121 virtual void do_write(
const Selection& sel,
const FileContent& what) = 0;
126 class FileHandlerRandomAccess:
public FileHandler {
128 FileHandlerRandomAccess(std::string& file_name):
FileHandler(file_name) {}
132 virtual void seek_frame(
int fr) = 0;
135 virtual void seek_time(
float t) = 0;
138 virtual void tell_current_frame_and_time(
int& step,
float& t) = 0;
141 virtual void tell_last_frame_and_time(
int& step,
float& t) = 0;
Selection class.
Definition: selection.h:65
Generic API for reading and writing any molecule file formats.
Definition: file_handler.h:74
void write(const Selection &sel, const FileContent &what)
Write data from selection specidied by what.
Definition: file_handler.cpp:69
bool read(System *sys, Frame *frame, const FileContent &what)
Reads data, which are specified by what.
Definition: file_handler.cpp:64
static FileHandler_ptr open(std::string fname, char open_mode)
Recognize file extension, open file for reading or writing and return a file handler.
Definition: file_handler.cpp:131
The system of atoms.
Definition: system.h:93
static FileHandler_ptr recognize(std::string fname)
Recognizes file extension and returns a file handler.
Definition: file_handler.cpp:109
virtual FileContent get_content_type() const =0
Reports content of this file type.
Definition of single trajectory frame.
Definition: system.h:51