00001 /********************************************************************** 00002 optransform.h: makes option to transform molecule as specified in a datafile 00003 Copyright (C) 2008 Chris Morley 00004 00005 This file is part of the Open Babel project. 00006 For more information, see <http://openbabel.org/> 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation version 2 of the License. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 ***********************************************************************/ 00017 00018 #include <openbabel/babelconfig.h> 00019 #include <openbabel/mol.h> 00020 #include <openbabel/phmodel.h> 00021 #include <openbabel/op.h> 00022 #include <vector> 00023 00024 namespace OpenBabel 00025 { 00026 00031 class OpTransform : public OBOp 00032 { 00033 public: 00035 OpTransform(const char* ID, const char* filename, const char* descr) 00036 : OBOp(ID, false), _filename(filename), _descr(descr), _dataLoaded(false){} 00037 00038 ~OpTransform(){} 00039 00040 virtual const char* Description(); 00041 00043 virtual bool WorksWith(OBBase* pOb)const{ return dynamic_cast<OBMol*>(pOb)!=NULL; } 00044 00046 virtual bool Do(OBBase* pOb, const char* OptionText=NULL, OpMap* pOptions=NULL, OBConversion* pConv=NULL); 00047 00048 virtual OpTransform* MakeInstance(const std::vector<std::string>& textlines) 00049 { 00050 OpTransform* pTransform = new OpTransform( 00051 textlines[1].c_str(),textlines[2].c_str(),textlines[3].c_str()); 00052 pTransform->_textlines = textlines; 00053 return pTransform; 00054 } 00055 00056 private: 00057 bool Initialize(); 00058 void ParseLine(const char *buffer); 00059 00060 private: 00061 const char* _filename; 00062 const char* _descr; 00063 std::vector<std::string> _textlines; 00064 00065 bool _dataLoaded; 00066 std::vector<OBChemTsfm> _transforms; 00067 }; 00068 00069 }//namespace 00070
This file is part of the documentation for Open Babel, version 2.3.