Pteros  2.0
Molecular modeling library for human beings!
vmd_molfile_plugin_wrapper.h
1 /*
2  * This file is a part of
3  *
4  * ============================================
5  * ### Pteros molecular modeling library ###
6  * ============================================
7  *
8  * https://github.com/yesint/pteros
9  *
10  * (C) 2009-2021, Semen Yesylevskyy
11  *
12  * All works, which use Pteros, should cite the following papers:
13  *
14  * 1. Semen O. Yesylevskyy, "Pteros 2.0: Evolution of the fast parallel
15  * molecular analysis library for C++ and python",
16  * Journal of Computational Chemistry, 2015, 36(19), 1480–1488.
17  * doi: 10.1002/jcc.23943.
18  *
19  * 2. Semen O. Yesylevskyy, "Pteros: Fast and easy to use open-source C++
20  * library for molecular analysis",
21  * Journal of Computational Chemistry, 2012, 33(19), 1632–1636.
22  * doi: 10.1002/jcc.22989.
23  *
24  * This is free software distributed under Artistic License:
25  * http://www.opensource.org/licenses/artistic-license-2.0.php
26  *
27 */
28 
29 #pragma once
30 
31 #include <string>
32 #include "pteros/core/system.h"
33 #include "pteros/core/selection.h"
34 #include "pteros/core/file_handler.h"
35 #include "molfile_plugin.h"
36 
37 namespace pteros {
38 
41 public:
42  // High-level API
43  VmdMolfilePluginWrapper(std::string& fname);
44  virtual void open(char open_mode);
45  virtual void close();
46 
47 protected:
48  void* r_handle; // Handle for reading
49  void* w_handle; // Handle for writing
50 
51  char mode;
52 
53  virtual bool do_read(System *sys, Frame *frame, const FileContent& what);
54  virtual void do_write(const Selection &sel, const FileContent& what);
55 
56  // molfile plugin instance (set in derived class)
57  molfile_plugin_t* plugin;
58 
59  // Static map of all registered plagins.
60  // Filled on first load of the library
61  static std::map<std::string,molfile_plugin_t*> molfile_plugins;
62 };
63 
64 }
65 
66 
67 
68 
pteros::Selection
Selection class.
Definition: selection.h:65
pteros::VmdMolfilePluginWrapper::open
virtual void open(char open_mode)
Opens a file with given access mode. Need to be defined by derived classes.
Definition: vmd_molfile_plugin_wrapper.cpp:103
pteros::FileHandler
Generic API for reading and writing any molecule file formats.
Definition: file_handler.h:74
pteros::System
The system of atoms.
Definition: system.h:93
pteros::VmdMolfilePluginWrapper
Generic API for reading and writing any molecule file formats.
Definition: vmd_molfile_plugin_wrapper.h:40
pteros::Frame
Definition of single trajectory frame.
Definition: system.h:51