forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_map.h
More file actions
81 lines (71 loc) · 2.25 KB
/
node_map.h
File metadata and controls
81 lines (71 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* This software is distributed under the GNU Lesser General Public License */
//==========================================================================
//
// node_map.h
//
//==========================================================================
// $Id: node_map.h,v 1.8 2005/06/14 12:22:12 raitner Exp $
#ifndef GTL_NODE_MAP_H
#define GTL_NODE_MAP_H
#include <GTL/GTL.h>
#include <GTL/node.h>
#include <GTL/ne_map.h>
__GTL_BEGIN_NAMESPACE
class graph;
/**
* @short A specialized map with nodes as keys
*
* A <code>node_map</code> is a specialized and optimized map
* implementation with nodes as keys. Using a <code>node_map</code> is
* the standard way to attach user defined information to
* the nodes of a <code>graph</code>.
*
* An example of usage:
* <pre>
* graph g;
*
* node v1 = g.new_node();
* node v2 = g.new_node();
*
* node_map<string> label(g, "Default Label");
*
* label[v1] = "v1";
* label[v2] = "v2";
*
* assert(label[v1] != label[v2]);
* </pre>
*
* The nodes used as keys for a <code>node_map</code> MUST be nodes
* of the same graph. If you want to use nodes from different graphs, use
* a <code>map<node,T></code> instead. A graph and a copy of it are
* considered to be different.
*
* Most of the functionality of <code>node_map</code> is inherited from
* @ref ne_map.
*
* @see edge_map
*/
template <class T, class Alloc = std::allocator<T> >
class node_map : public ne_map<node, T, graph, Alloc>
{
public:
/**
* Constructs an empty <code>node_map</code> not associated with any
* <code>graph</code>. You may (but need not) call
* <code>ne_map::init(const graph &, T)</code> to associate it to
* a <code>graph</code>.
*/
node_map() : ne_map<node, T, graph, Alloc>() {};
/**
* Constructs a <code>node_map</code> associated to the graph
* <code>g</code>.
* The value associated to each node in <code>g</code> is set to
* <code>t</code>.
*/
explicit node_map(const graph &g, T t=T()) : ne_map<node, T, graph, Alloc>(g,t) {};
};
__GTL_END_NAMESPACE
#endif // GTL_NODE_MAP_H
//--------------------------------------------------------------------------
// end of file
//--------------------------------------------------------------------------