OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sdf_writer.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 /*
20  Author: Tobias Schmidt
21  */
22 #ifndef OST_IO_SDF_WRITER_HH
23 #define OST_IO_SDF_WRITER_HH
24 
25 #include <iostream>
26 #include <sstream>
27 #include <iomanip>
28 
29 #include <boost/filesystem/fstream.hpp>
30 #include <boost/filesystem/convenience.hpp>
31 #include <boost/algorithm/string.hpp>
32 #include <boost/lexical_cast.hpp>
33 #include <boost/format.hpp>
34 #include <ost/log.hh>
35 #include <ost/conop/conop.hh>
36 #include <ost/io/io_exception.hh>
38 
39 namespace ost { namespace io {
40 
42 public:
43  SDFWriter(std::ostream& ostream);
44  SDFWriter(const String& filename);
45  SDFWriter(const boost::filesystem::path& filename);
46 
47  void Write(const mol::EntityView& ent);
48  void Write(const mol::EntityHandle& ent);
49 
50 private:
51  virtual bool VisitChain(const mol::ChainView& chain);
52 
53  std::ofstream outfile_;
54  std::ostream& ostr_;
55  int counter_;
56  std::map<long,int> atom_indices_;
57 };
58 
59 }}
60 
61 #endif