~vcs-imports/openbabel/trunk

« back to all changes in this revision

Viewing changes to ring.h

  • Committer: ghutchis
  • Date: 2001-11-27 18:50:36 UTC
  • Revision ID: svn-v4:86f38270-e075-4da6-bf68-7dcd545c500b:openbabel/trunk:46
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
 
3
 
 
4
This program is free software; you can redistribute it and/or modify
 
5
it under the terms of the GNU General Public License as published by
 
6
the Free Software Foundation version 2 of the License.
 
7
 
 
8
This program is distributed in the hope that it will be useful,
 
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
GNU General Public License for more details.
 
12
***********************************************************************/
 
13
 
 
14
#ifndef __RINGS_H__
 
15
#define __RINGS_H__
 
16
 
 
17
#include <deque>
 
18
 
 
19
namespace OpenEye {
 
20
 
 
21
class OEMol;
 
22
class OEAtom; 
 
23
class OEBond;
 
24
 
 
25
class OERTree
 
26
{
 
27
  OEAtom  *_atom;
 
28
  OERTree *_prv;
 
29
 public:
 
30
  OERTree(OEAtom*,OERTree*);
 
31
  ~OERTree() {}
 
32
  int  GetAtomIdx();
 
33
  void PathToRoot(vector<OEAtom*>&);
 
34
};
 
35
 
 
36
class OERing
 
37
{
 
38
  OEMol *_parent;
 
39
 public:
 
40
  //public data members
 
41
  vector<int> _path;
 
42
  OEBitVec _pathset;
 
43
  bool findCenterAndNormal(Vector & center, Vector &norm1, Vector &norm2);
 
44
 
 
45
  //constructors
 
46
  OERing(){};
 
47
  OERing(vector<int>&,int);
 
48
        OERing(const OERing &src);
 
49
        OERing& operator=(const OERing &src);
 
50
 
 
51
  //member functions
 
52
  int    Size()     const     {return(_path.size());}
 
53
  int    PathSize() const     {return(_path.size());}
 
54
  bool   IsMember(OEAtom *a);
 
55
        bool     IsMember(OEBond *b);
 
56
  bool   IsAromatic();
 
57
  bool   IsInRing(int i)      {return(_pathset.BitIsOn(i));}
 
58
  void   SetParent(OEMol *m)  {_parent = m;}
 
59
  OEMol *GetParent()          {return(_parent);}
 
60
};
 
61
 
 
62
bool CompareRingSize(const OERing *,const OERing *);
 
63
 
 
64
class OERingSearch
 
65
{
 
66
  vector<OEBond*> _bonds;
 
67
  vector<OERing*> _rlist;
 
68
 public:
 
69
  OERingSearch(){}
 
70
  ~OERingSearch();
 
71
  void    SortRings() {sort(_rlist.begin(),_rlist.end(),CompareRingSize);}
 
72
  void    RemoveRedundant(int);
 
73
  void    AddRingFromClosure(OEMol &,OEBond *,int);
 
74
  void    WriteRings();
 
75
  bool    SaveUniqueRing(deque<int>&,deque<int>&);
 
76
  vector<OERing*>::iterator BeginRings() {return(_rlist.begin());}
 
77
  vector<OERing*>::iterator EndRings() {return(_rlist.end());}
 
78
};
 
79
 
 
80
}
 
81
 
 
82
#endif //__RINGS_H__