Loading...
Searching...
No Matches
optransform.h
Go to the documentation of this file.
/**********************************************************************
optransform.h: makes option to transform molecule as specified in a datafile
Copyright (C) 2008 Chris Morley
This file is part of the Open Babel project.
For more information, see <http://openbabel.org/>
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 <openbabel/babelconfig.h>
#include <openbabel/phmodel.h>
#include <openbabel/mol.h>
#include <openbabel/op.h>
#include <vector>
namespace OpenBabel
{
class OBMol;
class OpTransform : public OBOp
{
public:
OpTransform(const char* ID, const char* filename, const char* descr)
: OBOp(ID, false), _filename(filename), _descr(descr), _dataLoaded(false){}
~OpTransform(){}
virtual const char* Description();
virtual bool WorksWith(OBBase* pOb)const{ return dynamic_cast<OBMol*>(pOb)!=nullptr; }
virtual bool Do(OBBase* pOb, const char* OptionText=nullptr, OpMap* pOptions=nullptr, OBConversion* pConv=nullptr);
virtual OpTransform* MakeInstance(const std::vector<std::string>& textlines)
{
OpTransform* pTransform = new OpTransform(
textlines[1].c_str(),textlines[2].c_str(),textlines[3].c_str());
pTransform->_textlines = textlines;
return pTransform;
}
private:
bool Initialize();
void ParseLine(const char *buffer);
private:
const char* _filename;
const char* _descr;
std::vector<std::string> _textlines;
bool _dataLoaded;
std::vector<OBChemTsfm> _transforms;
};
}//namespace
OpenBabel::OBBase
Base Class.
Definition base.h:240
OpenBabel::OBConversion
Class to convert from one format to another.
Definition obconversion.h:60
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel::OBOp
Operations to modify molecules before output.
Definition op.h:34
OpenBabel::OBOp::OpMap
const std::map< std::string, std::string > OpMap
Definition op.h:38
OpenBabel::OpTransform::WorksWith
virtual bool WorksWith(OBBase *pOb) const
Checks that this op is being applied to the right kind of object(OBMol).
Definition optransform.h:43
OpenBabel::OpTransform::OpTransform
OpTransform(const char *ID, const char *filename, const char *descr)
constructor. Each instance provides an ID, a datafile and a description.
Definition optransform.h:35
OpenBabel::OpTransform::Do
virtual bool Do(OBBase *pOb, const char *OptionText=nullptr, OpMap *pOptions=nullptr, OBConversion *pConv=nullptr)
Carries out the transform.
OpenBabel::OpTransform::~OpTransform
~OpTransform()
Definition optransform.h:38
OpenBabel::OpTransform::Description
virtual const char * Description()
Required description of a sub-type.
OpenBabel::OpTransform::MakeInstance
virtual OpTransform * MakeInstance(const std::vector< std::string > &textlines)
Definition optransform.h:48
mol.h
Handle molecules. Declarations of OBMol, OBAtom, OBBond, OBResidue. (the main header for Open Babel).
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
op.h
Base plugin class for operations on molecules.
phmodel.h
Read pH rules and assign charges.