2 #ifndef GGL_CHEM_SMILES_GRAMMAR_HH_
3 #define GGL_CHEM_SMILES_GRAMMAR_HH_
6 #if HAVE_UNORDERED_MAP > 0
7 #include <unordered_map>
8 #elif HAVE_TR1_UNORDERED_MAP > 0
9 #include <tr1/unordered_map>
10 #elif HAVE_GNU_HASH_MAP > 0
11 #include <ext/hash_map>
22 #if !defined(BOOST_SPIRIT_CLOSURE_LIMIT)
23 #define BOOST_SPIRIT_CLOSURE_LIMIT 5
24 #elif BOOST_SPIRIT_CLOSURE_LIMIT < 5
25 #error "GGL_CHEM_SMILES_GRAMMAR : BOOST_SPIRIT_CLOSURE_LIMIT too low, has to be at least 5"
29 #if !defined(PHOENIX_LIMIT)
30 #define PHOENIX_LIMIT 5
31 #elif PHOENIX_LIMIT < 5
32 #error "GGL_CHEM_SMILES_GRAMMAR : PHOENIX_LIMIT too low, has to be at least 5"
35 #include <boost/version.hpp>
36 #if BOOST_VERSION >= 103800
37 #include <boost/spirit/include/classic.hpp>
38 #include <boost/spirit/include/phoenix1.hpp>
39 #define NS_BOOSTSPIRIT boost::spirit::classic
41 #include <boost/spirit.hpp>
42 #include <boost/spirit/phoenix.hpp>
43 #define NS_BOOSTSPIRIT boost::spirit
100 :
public NS_BOOSTSPIRIT::grammar< SMILES_grammar >
114 boost::property_map<Molecule, PropNodeLabel>::type
119 boost::property_map<Molecule, PropEdgeLabel>::type
125 addAtom(
const std::string& label )
const;
132 addBond(
const int atom1,
const int atom2,
const std::string& label )
const;
161 std::pair< Molecule, int >
163 throw (std::invalid_argument);
177 std::pair< Molecule, int >
179 throw (std::invalid_argument);
183 template <
typename ScannerT>
192 NS_BOOSTSPIRIT::rule<ScannerT>
const&
219 template <
typename CharT>
223 != std::string::npos;
244 template <
typename CharT>
276 template <
typename CharT>
292 struct bond_parser :
public NS_BOOSTSPIRIT::char_parser<bond_parser>
303 template <
typename CharT>
339 typename SuperClass::member3
cnt;
341 typename SuperClass::member4
rc;
343 typename SuperClass::member5
hcnt;
347 typedef NS_BOOSTSPIRIT::rule< ScannerT
348 ,
typename Atom_closure::context_t
353 typedef std::vector<std::pair<bond_t,std::string> >
bonds_t;
359 : label(label), atomID(atomID), isAromatic(isAromatic)
365 #if HAVE_UNORDERED_MAP > 0
366 typedef std::unordered_map<int,int>
rcs_t;
367 typedef std::unordered_map<int,std::string>
rcb_t;
368 #elif HAVE_TR1_UNORDERED_MAP > 0
369 typedef std::tr1::unordered_map<int,int>
rcs_t;
370 typedef std::tr1::unordered_map<int,std::string>
rcb_t;
371 #elif HAVE_GNU_HASH_MAP > 0
375 size_t operator()(
const int& v)
const
381 typedef __gnu_cxx::hash_map<int,int,hash_int>
rcs_t;
382 typedef __gnu_cxx::hash_map<int,std::string,hash_int>
rcb_t;
385 typedef std::map<int,std::string>
rcb_t;
421 memorize_atom(
int atom, std::string& alabel, std::string& blabel )
422 throw (std::invalid_argument);
437 memorize_rc(
int rc,
int atom1, std::string blabel )
438 throw (std::invalid_argument);
477 #include "ggl/chem/SMILES_grammar.icc"