Skip to content
Snippets Groups Projects
Commit 010128ec authored by marco's avatar marco
Browse files

moved chemdict parser from conop to io to avoid circular dependency

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2724 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 63d1de4e
No related branches found
No related tags found
No related merge requests found
......@@ -8,11 +8,9 @@ compound_lib.hh
module_config.hh
rule_based_builder.hh
ring_finder.hh
chemdict_parser.hh
)
set(OST_CONOP_SOURCES
chemdict_parser.cc
builder.cc
conop.cc
heuristic_builder.cc
......
......@@ -29,7 +29,7 @@
#include <boost/iostreams/filter/gzip.hpp>
#include <ost/conop/chemdict_parser.hh>
#include <ost/io/mol/chemdict_parser.hh>
using namespace ost;
......@@ -70,7 +70,7 @@ int main(int argc, char const *argv[])
filtered_istream.push(boost::iostreams::gzip_decompressor());
}
filtered_istream.push(istream);
conop::ChemdictParser cdp(filtered_istream, dialect);
io::ChemdictParser cdp(filtered_istream, dialect);
conop::CompoundLibPtr compound_lib;
if (!strcmp(argv[1], "create")) {
compound_lib=conop::CompoundLib::Create(argv[3]);
......
......@@ -12,12 +12,14 @@ save_entity.cc
load_entity.cc
surface_io_msms_handler.cc
load_surface.cc
chemdict_parser.cc
dcd_io.cc
star_parser.cc
PARENT_SCOPE
)
set(OST_IO_MOL_HEADERS
chemdict_parser.hh
star_parser.hh
dcd_io.hh
entity_io_crd_handler.hh
......
#include <ost/conop/chemdict_parser.hh>
#include <ost/io/mol/chemdict_parser.hh>
namespace ost { namespace conop {
namespace ost { namespace io {
using namespace ost::conop;
bool ChemdictParser::OnBeginData(const StringRef& data_name)
{
compound_.reset(new Compound(data_name.str()));
......@@ -15,7 +17,7 @@ bool ChemdictParser::OnBeginData(const StringRef& data_name)
return true;
}
bool ChemdictParser::OnBeginLoop(const io::StarLoopDesc& header)
bool ChemdictParser::OnBeginLoop(const StarLoopDesc& header)
{
if (header.GetCategory()=="chem_comp_atom") {
loop_type_=ATOM_SPEC;
......@@ -37,7 +39,7 @@ bool ChemdictParser::OnBeginLoop(const io::StarLoopDesc& header)
return false;
}
void ChemdictParser::OnDataRow(const io::StarLoopDesc& header,
void ChemdictParser::OnDataRow(const StarLoopDesc& header,
const std::vector<StringRef>& columns)
{
if (loop_type_==ATOM_SPEC) {
......@@ -65,7 +67,7 @@ void ChemdictParser::OnDataRow(const io::StarLoopDesc& header,
}
}
void ChemdictParser::OnDataItem(const io::StarDataItem& item)
void ChemdictParser::OnDataItem(const StarDataItem& item)
{
if (item.GetCategory()==StringRef("chem_comp", 9)) {
if (item.GetName()==StringRef("type", 4)) {
......
......@@ -28,7 +28,7 @@
#include <ost/io/mol/star_parser.hh>
#include <ost/conop/compound_lib.hh>
namespace ost { namespace conop {
namespace ost { namespace io {
typedef enum {
ATOM_SPEC,
......@@ -36,10 +36,10 @@ typedef enum {
DONT_KNOW
} LoopType;
class DLLEXPORT_OST_CONOP ChemdictParser : public io::StarParser {
class DLLEXPORT_OST_CONOP ChemdictParser : public StarParser {
public:
ChemdictParser(std::istream& stream, Compound::Dialect dialect):
io::StarParser(stream), compound_(new Compound("UNK")),
ChemdictParser(std::istream& stream, conop::Compound::Dialect dialect):
StarParser(stream), compound_(new conop::Compound("UNK")),
last_(0), loop_type_(DONT_KNOW), dialect_(dialect)
{
this->InitTypeMap();
......@@ -47,23 +47,23 @@ public:
virtual bool OnBeginData(const StringRef& data_name);
virtual bool OnBeginLoop(const io::StarLoopDesc& header);
virtual bool OnBeginLoop(const StarLoopDesc& header);
virtual void OnDataRow(const io::StarLoopDesc& header,
virtual void OnDataRow(const StarLoopDesc& header,
const std::vector<StringRef>& columns);
virtual void OnDataItem(const io::StarDataItem& item);
virtual void OnDataItem(const StarDataItem& item);
virtual void OnEndData();
void SetCompoundLib(const CompoundLibPtr& lib)
void SetCompoundLib(const conop::CompoundLibPtr& lib)
{
lib_=lib;
}
private:
void InitTypeMap();
CompoundLibPtr lib_;
CompoundPtr compound_;
conop::CompoundLibPtr lib_;
conop::CompoundPtr compound_;
typedef enum {
ATOM_NAME=0,
ALT_ATOM_NAME=1,
......@@ -82,8 +82,8 @@ private:
static std::map<String, mol::ChemClass> tm_;
std::map<String, int> atom_map_;
LoopType loop_type_;
AtomSpec atom_;
Compound::Dialect dialect_;
conop::AtomSpec atom_;
conop::Compound::Dialect dialect_;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment