Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

more/phys/level_graph.h

Go to the documentation of this file.
00001 //  Copyright (C) 2002  Petter Urkedal (petter.urkedal@matfys.lth.se)
00002 //
00003 //  This file is free software; you can redistribute it and/or modify
00004 //  it under the terms of the GNU General Public License as published by
00005 //  the Free Software Foundation; either version 2 of the License, or
00006 //  (at your option) any later version.
00007 //
00008 //  This file is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //  GNU General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU General Public License
00014 //  along with this program; if not, write to the Free Software
00015 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016 //
00017 //  As a special exception, you may use this file as part of a free
00018 //  software library without restriction.  Specifically, if other files
00019 //  instantiate templates or use macros or inline functions from this
00020 //  file, or you compile this file and link it with other files to
00021 //  produce an executable, this file does not by itself cause the
00022 //  resulting executable to be covered by the GNU General Public
00023 //  License.  This exception does not however invalidate any other
00024 //  reasons why the executable file might be covered by the GNU General
00025 //  Public License.
00026 //
00027 //  $Id: level_graph.h,v 1.1 2002/05/30 18:01:40 petter_urkedal Exp $
00028 
00029 
00030 namespace more {
00031 namespace phys {
00032 
00033   template<typename LevelTraits>
00034   struct level_graph
00035   {
00036       typedef LevelTraits level_traits;
00037 
00038   private:
00039       struct level_node;
00040 
00041       struct radiation_node
00042       {
00043           bool operator<(radiation_node const& rhs) const
00044           { return m_rad < rhs.m_rad; }
00045 
00046           radiation_type m_rad;
00047           level_node* m_initial;
00048           level_node* m_final;
00049       };
00050 
00051       struct level_node
00052       {
00053           bool operator<(level_node const& rhs) const
00054           { return m_lev < rhs.m_lev; }
00055 
00056           level_type m_lev;
00057           std::set<radiation_node> m_radiations;
00058       };
00059 
00060   public:
00061       typedef std::set<level_node>::iterator vertex_descriptor;
00062       typedef std::pair<vertex_descriptor, std::set<radiation_node>::iterator
00063 
00064       struct level_iterator
00065           : std::bidirectional_iterator<level_type, std::ptrdiff_t>
00066       {
00067           level_iterator() {}
00068           explicit level_iterator(std::set<level_node>::iterator it)
00069               : m_it_lev(it) {}
00070 
00071           level_iterator& operator++() { ++m_it_lev; return *this; }
00072           level_iterator& operator--() { --m_it_lev; return *this; }
00073           level_iterator operator++(int)
00074           { level_iterator tmp = *this; ++*this; return tmp; }
00075           level_iterator operator--(int)
00076           { level_iterator tmp = *this; ++*this; return tmp; }
00077 
00078           bool operator==(level_iterator const& rhs) const
00079           { return m_it_lev == rhs.m_it_lev; }
00080           bool operator!=(level_iterator const& rhs) const
00081           { return m_it_lev != rhs.m_it_lev; }
00082 
00083           level_type const& operator*() { return m_it_lev->m_lev; }
00084           level_type const* operator->() { return &m_it_lev->m_lev; }
00085 
00086       private:
00087           std::set<level_node>::iterator m_it_lev;
00088       };
00089       typedef level_iterator const_level_iterator;
00090 
00091       struct radiation_iterator
00092       {
00093       };
00094 
00095       level_iterator
00096 
00097   private:
00098       std::set<level_node> m_levels;
00099   };
00100 
00101 }}

Generated on Sat Sep 7 19:11:21 2002 for more with Doxygen 1.2.13.1. Doxygen 1.2.13.1 is written and copyright 1997-2002 by Dimitri van Heesch.