ccp4srs  Version 1.0.0
ccp4srs_tree.h
Go to the documentation of this file.
1 // $Id: ccp4srs_tree.h $
2 // =================================================================
3 //
4 // CCP4 SRS Library: Storage, Retrieval and Search support for
5 // CCP4 ligand data.
6 //
7 // Copyright (C) Eugene Krissinel 2010-2013.
8 //
9 // This library is free software: you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License version 3, modified in accordance with the provisions
12 // of the license to address the requirements of UK law.
13 //
14 // You should have received a copy of the modified GNU Lesser
15 // General Public License along with this library. If not, copies
16 // may be downloaded from http://www.ccp4.ac.uk/ccp4license.php
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Lesser General Public License for more details.
22 //
23 // =================================================================
24 //
25 // 18.09.13 <-- Date of Last Modification.
26 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 // -----------------------------------------------------------------
28 //
29 // **** Module : ccp4srs_tree <interface>
30 // ~~~~~~~~~
31 // **** Classes : ccp4srs::Tree - structure tree
32 // ~~~~~~~~~
33 //
34 // (C) E. Krissinel 2010-2013
35 //
36 // =================================================================
37 //
38 
39 #ifndef CCP4SRS_TREE_H
40 #define CCP4SRS_TREE_H
41 
42 #include "ccp4srs_atom.h"
43 
44 namespace ccp4srs {
45 
46  DefineClass(Tree);
47 
48  class Tree {
49 
50  // atom connectivity types
51  enum {None,Start,End,Add};
52 
53  public:
54  Tree();
55  virtual ~Tree();
56 
57  void empty();
58 
59  inline int size() { return n_sections; }
60  inline int atom ( int secNo ) { return atom_tree [secNo]; }
61  inline int backward ( int secNo ) { return atom_backward[secNo]; }
62  inline int forward ( int secNo ) { return atom_forward [secNo]; }
63  inline int connect ( int secNo ) { return connect_type [secNo]; }
64 
65  int readFromCIF ( mmdb::mmcif::PLoop mmCIFLoop,
66  Container<Atom> & atoms );
67  void writeToCIF ( mmdb::mmcif::PData mmCIFData,
68  mmdb::cpstr monID,
69  Container<Atom> & atoms );
70 
71  void write_mem ( PMemIO memIO, int version );
72  bool read_mem ( PMemIO memIO, int version,
73  bool * Ok = NULL );
74 
75  void copy ( PTree tree, mmdb::ivector anmatch=NULL );
76 
77  protected:
78  int n_sections;
79  mmdb::ivector atom_tree;
80  mmdb::ivector atom_backward;
81  mmdb::ivector atom_forward;
82  mmdb::ivector connect_type;
83 
84  };
85 
86 } // namespace ccp4srs
87 
88 #endif // CCP4SRS_TREE_H
DefineClass(Angle)
int atom(int secNo)
Definition: ccp4srs_tree.h:60
Definition: ccp4srs_tree.h:48
virtual ~Tree()
Definition: ccp4srs_tree.cpp:54
mmdb::ivector atom_forward
next atom name
Definition: ccp4srs_tree.h:81
int size()
Definition: ccp4srs_tree.h:59
void write_mem(PMemIO memIO, int version)
Definition: ccp4srs_tree.cpp:160
Tree()
Definition: ccp4srs_tree.cpp:46
int backward(int secNo)
Definition: ccp4srs_tree.h:61
int connect(int secNo)
Definition: ccp4srs_tree.h:63
mmdb::ivector atom_tree
tree atom name
Definition: ccp4srs_tree.h:79
mmdb::ivector connect_type
type of connection
Definition: ccp4srs_tree.h:82
bool read_mem(PMemIO memIO, int version, bool *Ok=NULL)
Definition: ccp4srs_tree.cpp:203
void copy(PTree tree, mmdb::ivector anmatch=NULL)
Definition: ccp4srs_tree.cpp:172
Definition: ccp4srs_angle.cpp:42
Definition: ccp4srs_container.h:48
void writeToCIF(mmdb::mmcif::PData mmCIFData, mmdb::cpstr monID, Container< Atom > &atoms)
Definition: ccp4srs_tree.cpp:111
int n_sections
number of sections
Definition: ccp4srs_tree.h:78
int readFromCIF(mmdb::mmcif::PLoop mmCIFLoop, Container< Atom > &atoms)
Definition: ccp4srs_tree.cpp:66
void empty()
Definition: ccp4srs_tree.cpp:58
mmdb::ivector atom_backward
previous atom name
Definition: ccp4srs_tree.h:80
int forward(int secNo)
Definition: ccp4srs_tree.h:62