Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:19:36

0001 /* This software is distributed under the GNU Lesser General Public License */
0002 //==========================================================================
0003 //
0004 //   edge_map.h
0005 //
0006 //==========================================================================
0007 // $Id: edge_map.h,v 1.8 2005/06/14 12:22:12 raitner Exp $
0008 
0009 #ifndef GTL_EDGE_MAP_H
0010 #define GTL_EDGE_MAP_H
0011 
0012 #include <GTL/GTL.h>
0013 #include <GTL/edge.h>
0014 #include <GTL/ne_map.h>
0015 
0016 __GTL_BEGIN_NAMESPACE
0017 
0018 class graph; 
0019 
0020 /**
0021  * @short A specialized map with edges as keys
0022  *
0023  * A <code>edge_map</code> is a specialized and optimized map
0024  * implementation with edges as keys. Using a <code>edge_map</code> is
0025  * the standard way to attach user defined information to 
0026  * the edges of a <code>graph</code>.
0027  *
0028  * An example of usage:
0029  * <pre>
0030  *   graph g;
0031  *
0032  *   node v1 = g.new_node();
0033  *   node v2 = g.new_node();
0034  *   edge e = g.new_edge(v1, v2);
0035  *
0036  *   edge_map&lt;string&gt; label(g, "Default Label");
0037  *
0038  *   label[e] = "An edge";
0039  *
0040  *   assert(label[e] == "An edge");
0041  * </pre>
0042  *
0043  * The edges used as keys for a <code>edge_map</code> MUST be edges
0044  * of the same graph. If you want to use edges from different graphs, use
0045  * a <code>map&lt;edge,T&gt;</code> instead. A graph and a copy of it are
0046  * considered to be different.
0047  *
0048  * Most of the functionality of <code>edge_map</code> is inherited from
0049  * @ref ne_map.
0050  *
0051  * @see node_map
0052  */
0053 template <class T, class Alloc = allocator<T> >
0054 class edge_map : public ne_map<edge, T, graph, Alloc>
0055 {
0056 public:
0057 
0058     /**
0059      * Constructs an empty <code>edge_map</code> not associated with any
0060      * <code>graph</code>. You may (but need not) call
0061      * <code>ne_map::init(const graph &, T)</code> to associate it to
0062      * a <code>graph</code>.
0063      */
0064     edge_map() : ne_map<edge, T, graph, Alloc>() {};
0065     
0066     /**
0067      * Constructs a <code>edge_map</code> associated to the graph
0068      * <code>g</code>.
0069      * The value associated to each edge in <code>g</code> is set to
0070      * <code>t</code>.
0071      */
0072      explicit edge_map(const graph &g, T t=T()) : 
0073         ne_map<edge, T, graph, Alloc>(g,t) {};
0074 };
0075 
0076 __GTL_END_NAMESPACE
0077 
0078 #endif // GTL_EDGE_MAP_H
0079 
0080 //--------------------------------------------------------------------------
0081 //   end of file
0082 //--------------------------------------------------------------------------