![]() |
|
|||
File indexing completed on 2025-08-03 08:19:37
0001 /* This software is distributed under the GNU Lesser General Public License */ 0002 //========================================================================== 0003 // 0004 // node_map.h 0005 // 0006 //========================================================================== 0007 // $Id: node_map.h,v 1.8 2005/06/14 12:22:12 raitner Exp $ 0008 0009 #ifndef GTL_NODE_MAP_H 0010 #define GTL_NODE_MAP_H 0011 0012 #include <GTL/GTL.h> 0013 #include <GTL/node.h> 0014 #include <GTL/ne_map.h> 0015 0016 __GTL_BEGIN_NAMESPACE 0017 0018 class graph; 0019 0020 /** 0021 * @short A specialized map with nodes as keys 0022 * 0023 * A <code>node_map</code> is a specialized and optimized map 0024 * implementation with nodes as keys. Using a <code>node_map</code> is 0025 * the standard way to attach user defined information to 0026 * the nodes 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 * 0035 * node_map<string> label(g, "Default Label"); 0036 * 0037 * label[v1] = "v1"; 0038 * label[v2] = "v2"; 0039 * 0040 * assert(label[v1] != label[v2]); 0041 * </pre> 0042 * 0043 * The nodes used as keys for a <code>node_map</code> MUST be nodes 0044 * of the same graph. If you want to use nodes from different graphs, use 0045 * a <code>map<node,T></code> instead. A graph and a copy of it are 0046 * considered to be different. 0047 * 0048 * Most of the functionality of <code>node_map</code> is inherited from 0049 * @ref ne_map. 0050 * 0051 * @see edge_map 0052 */ 0053 template <class T, class Alloc = allocator<T> > 0054 class node_map : public ne_map<node, T, graph, Alloc> 0055 { 0056 public: 0057 0058 /** 0059 * Constructs an empty <code>node_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 node_map() : ne_map<node, T, graph, Alloc>() {}; 0065 0066 /** 0067 * Constructs a <code>node_map</code> associated to the graph 0068 * <code>g</code>. 0069 * The value associated to each node in <code>g</code> is set to 0070 * <code>t</code>. 0071 */ 0072 explicit node_map(const graph &g, T t=T()) : ne_map<node, T, graph, Alloc>(g,t) {}; 0073 }; 0074 0075 __GTL_END_NAMESPACE 0076 0077 #endif // GTL_NODE_MAP_H 0078 0079 //-------------------------------------------------------------------------- 0080 // end of file 0081 //--------------------------------------------------------------------------
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |