LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
psf.hpp
1/*
2 This file is part of LOOS.
3
4 LOOS (Lightweight Object-Oriented Structure library)
5 Copyright (c) 2008, Tod D. Romo, Alan Grossfield
6 Department of Biochemistry and Biophysics
7 School of Medicine & Dentistry, University of Rochester
8
9 This package (LOOS) is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation under version 3 of the License.
12
13 This package is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22
23
24#if !(defined LOOS_PSF_HPP)
25#define LOOS_PSF_HPP
26
27
28#include <fstream>
29#include <stdexcept>
30
31#include <loos_defs.hpp>
32#include <AtomicGroup.hpp>
33
34
35namespace loos {
36
38
60 class PSF : public AtomicGroup {
61 public:
62 PSF() { }
63 virtual ~PSF() {}
64
65 explicit PSF(const std::string& fname) : _max_index(0), _filename(fname) {
66 std::ifstream ifs(fname.c_str());
67 if (!ifs)
68 throw(FileOpenError(fname));
69 read(ifs);
70 }
71
72 explicit PSF(std::fstream &ifs) : _max_index(0), _filename("stream") {
73 read(ifs);
74 }
75
76 static pAtomicGroup create(const std::string& fname) {
77 return(pAtomicGroup(new PSF(fname)));
78 }
79
81 virtual PSF* clone(void) const;
82
84 PSF copy(void) const;
85
86 void read(std::istream& is);
87
88
89 private:
90
91 PSF(const AtomicGroup& grp) : AtomicGroup(grp) { }
92 void parseAtomRecord(const std::string s);
93
94 uint _max_index;
95 std::string _filename;
96 };
97
98
99}
100
101#endif
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Error while opening a file.
Definition exceptions.hpp:175
Class for reading a subset of the PSF format.
Definition psf.hpp:60
virtual PSF * clone(void) const
Clones an object for polymorphism (see AtomicGroup::clone() for more info)
Definition psf.cpp:29
PSF copy(void) const
Creates a deep copy (see AtomicGroup::copy() for more info)
Definition psf.cpp:33
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3