OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
coord_source.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_MOL_COORD_SOURCE_HH
20 #define OST_MOL_COORD_SOURCE_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <boost/shared_ptr.hpp>
26 #include <ost/mol/module_config.hh>
27 #include <ost/mol/coord_frame.hh>
28 #include <ost/mol/entity_handle.hh>
29 
30 
31 namespace ost { namespace mol {
32 
34 
35 typedef boost::shared_ptr<CoordSource> CoordSourcePtr;
36 
43 public:
44  CoordSource(const AtomHandleList& atoms);
45 
46  virtual ~CoordSource();
47 
48  CoordSourcePtr Extract(int start=0, int stop=-1, int step=1);
49 
50  virtual uint GetFrameCount()=0;
51 
52  virtual CoordFramePtr GetFrame(uint frame_id) const = 0;
53 
54  int GetAtomCount() const;
55 
56  EntityHandle GetEntity() const;
57 
58  const AtomHandleList& GetAtomList() const;
59 
60  void SetAtomPos(uint frame, AtomHandle atom, const geom::Vec3& pos);
61 
62  geom::Vec3 GetAtomPos(uint frame, AtomHandle atom) const;
63 
65  void CopyFrame(uint frame);
66  bool IsMutable() const;
67 
68  void Capture();
69  void CaptureInto(int pos);
70  void Capture(uint f);
71 
72  virtual void AddFrame(const std::vector<geom::Vec3>& coords) = 0;
73  virtual void AddFrame(const std::vector<geom::Vec3>& coords,const geom::Vec3& cell_size,const geom::Vec3& cell_angles) = 0;
74  virtual void InsertFrame(int pos, const std::vector<geom::Vec3>& coords) = 0;
75 protected:
76  void SetMutable(bool flag);
77 private:
78  AtomHandleList atoms_;
79  EntityHandle entity_;
80  bool mutable_;
81  std::map<long,uint> atom_dict_;
82 };
83 
84 }}
85 
86 #endif