File: generic.cpp

package info (click to toggle)
ghemical 1.01-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,984 kB
  • ctags: 19,443
  • sloc: ansic: 69,073; cpp: 60,583; fortran: 35,324; sh: 5,419; makefile: 506; perl: 91
file content (158 lines) | stat: -rw-r--r-- 3,116 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**********************************************************************
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
***********************************************************************/

#include "mol.h"

using namespace std;

namespace OpenBabel {

//
//member functions for OBGenericData class
//

OBGenericData::OBGenericData()
{
  _type = obUndefinedData;
  _attr = "undefined";
}

OBGenericData::OBGenericData(const OBGenericData &src)
{
  _type = src.GetDataType();
  _attr = src.GetAttribute();
}

//
//member functions for OBCommentData class
//

OBCommentData::OBCommentData() 
{
  _type = obCommentData; 
  _attr = "Comment";
}

OBCommentData::OBCommentData(const OBCommentData &src)
{
  _type = obCommentData;
  _attr = "Comment";
  _data = src.GetData();
}

//
//member functions for OBExternalBond class
//
OBExternalBond::OBExternalBond(OBAtom *atom,OBBond *bond,int idx) 
{
  _idx = idx;
  _atom = atom;
  _bond = bond;
}

OBExternalBond::OBExternalBond(const OBExternalBond &src)
{
  _idx = src.GetIdx();
  _atom = src.GetAtom();
  _bond = src.GetBond();
}

//
//member functions for OBExternalBondData class
//

OBExternalBondData::OBExternalBondData()
{
  _type = obExternalBondData;
  _attr = "ExternalBondData";
}

void OBExternalBondData::SetData(OBAtom *atom,OBBond *bond,int idx)
{
  OBExternalBond xb(atom,bond,idx);
  _vexbnd.push_back(xb);
}

//
//member functions for OBCompressData class
//

OBCompressData::OBCompressData() 
{
  _size = 0;
  _data = (unsigned char*)NULL; 
  _type = obCompressData;
  _attr = "CompressData";
}

OBCompressData::~OBCompressData()
{
  if (_data) {delete [] _data; _data = (unsigned char*)NULL;}
}

void OBCompressData::SetData(unsigned char *d,int size)
{
  if (size <= 0) return;
  
  if (_data) {delete [] _data; _data = (unsigned char*)NULL;}
  
  _data = new unsigned char[size];
  memcpy(_data,(char*) d, size);
  _size = size;
}

//
//member functions for OBPairData class
//

OBPairData::OBPairData()
{
  _type = obPairData; 
  _attr = "PairData";
}

//
//member functions for OBVirtualBond class
//OBVirtualBond is used to temporarily store bonds that reference
//an atom that has not yet been added to a molecule 
//

OBVirtualBond::OBVirtualBond()
{
	_type = obVirtualBondData;
	_attr = "VirtualBondData";
	_bgn = _end = _ord = 0;
}

OBVirtualBond::OBVirtualBond(int bgn,int end,int ord,int stereo)
{
	_type = obVirtualBondData;
	_attr = "VirtualBondData";
	_bgn = bgn;
	_end = end;
	_ord = ord;
	_stereo = stereo;
}

//
//member functions for OBRingData class - stores SSSR set
//

OBRingData::OBRingData()
{
	_type = obRingData;
	_attr = "RingData";
	_vr.clear();
}

} //end namespace OpenBabel