BALL  1.4.1
molecularGraph.h
Go to the documentation of this file.
00001 #ifndef BALL_DATATYPE_MOLECULARGRAPH_H
00002 #define BALL_DATATYPE_MOLECULARGRAPH_H
00003 
00004 #include <boost/graph/properties.hpp>
00005 #include <boost/graph/graph_traits.hpp>
00006 #include <boost/graph/adjacency_list.hpp>
00007 #include <boost/graph/copy.hpp>
00008 
00009 #include <list>
00010 
00011 #ifndef BALL_COMMON_GLOBAL_H
00012 # include <BALL/COMMON/global.h>
00013 #endif
00014 
00015 #ifndef BALL_DATATYPE_GRAPH_GRAPHALGORITHMS_H
00016 # include <BALL/DATATYPE/GRAPH/graphAlgorithms.h>
00017 #endif
00018 
00019 namespace BALL
00020 {
00021   //Forward declarations
00022   class Atom;
00023   class Bond;
00024   class AtomContainer;
00025 
00026   //Define a properly adjusted boost graph type
00027   typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
00028                                 boost::property<boost::vertex_atom_ptr_t, const Atom*>,
00029                                 boost::property<boost::edge_bond_ptr_t, const Bond*>
00030   > MolecularGraphBase;
00031 
00046   class MolecularGraph 
00047     : public MolecularGraphBase
00048   {
00049     public:
00051       enum ExportOptions { INCLUDE_ALL = -1 };
00052 
00053       typedef boost::graph_traits<MolecularGraph>::vertex_descriptor Vertex;
00054       typedef boost::graph_traits<MolecularGraph>::edge_descriptor   Edge;
00055 
00056       typedef boost::graph_traits<MolecularGraph>::vertex_iterator VertexIterator;
00057       typedef boost::graph_traits<MolecularGraph>::edge_iterator   EdgeIterator;
00058       typedef boost::property_map<MolecularGraphBase, boost::vertex_atom_ptr_t>::type AtomPtrMap;
00059       typedef boost::property_map<MolecularGraphBase, boost::edge_bond_ptr_t>::type   BondPtrMap;
00060       typedef boost::property_map<MolecularGraphBase, boost::vertex_atom_ptr_t>::const_type ConstAtomPtrMap;
00061       typedef boost::property_map<MolecularGraphBase, boost::edge_bond_ptr_t>::const_type   ConstBondPtrMap;
00062 
00063       typedef GRAPH::GraphTraits<MolecularGraph>::EditableGraph EditableGraph;
00064 
00065       MolecularGraph(AtomContainer& ac, ExportOptions opt = INCLUDE_ALL);
00066 
00067       const Edge&   getEdge  (const Bond* bond) const;
00068       const Vertex& getVertex(const Atom* atom) const;
00069 
00070       void editableCopy(EditableGraph& eg);
00071 
00072     private:
00073       std::map<const Bond*, Edge>   bond_to_edge_;
00074       std::map<const Atom*, Vertex> atom_to_vertex_;
00075   };
00076 
00077   typedef GRAPH::GraphTraits<MolecularGraph> MolecularGraphTraits;
00078   typedef MolecularGraph::EditableGraph EditableMolecularGraph;
00079 }
00080 
00081 #endif //BALL_DATATYPE_MOLECULARGRAPH_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines