ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/outil/src/HypergraphLib_Arc.h
Revision: 253
Committed: Tue Jul 13 19:40:46 2010 UTC (14 years, 10 months ago) by francois
Content type: text/plain
File size: 1874 byte(s)
Log Message:
changement de hiearchie et utilisation de ccmake + mise a jour

File Contents

# User Rev Content
1 foucault 27 #ifndef ARC_H
2     #define ARC_H
3    
4     #include "HypergraphLib_GraphObject.h"
5     #include <map>
6     #include <vector>
7    
8     #define ARC_FOR_EACH_NODE_CONST(A,N)\
9     for(HypergraphLib::Arc::MultimapNodesById::const_iterator N = A->Nodes().begin();\
10     N != A->Nodes().end(); N++)
11    
12     namespace HypergraphLib {
13    
14     class Node;
15    
16     class HYPERGRAPHLIB_ITEM Arc : public GraphObject {
17     public:
18     typedef std::multimap < int, Node * > MultimapNodesById;
19     typedef std::pair < int, Node * > Int_Node_Pair;
20    
21     /**
22     * Constructs an empty Arc
23     */
24     Arc(Graph* __owner, int __id);
25    
26     /**
27     * Constructor taking the graph, the arc's ID, and the array
28     * of node IDs of the arc
29     */
30     Arc(Graph* __owner, int __id, const std::vector <int> & __nodesId);
31    
32     /**
33     * Copy constructor
34     */
35     Arc(const Arc &, Graph * __owner=0);
36     ~Arc();
37    
38     /**
39     * Returns the array of nodes of the arc
40     */
41     MultimapNodesById & Nodes();
42    
43     /**
44     * Adds one node to the arc
45     */
46     void Add (Node *);
47    
48     /**
49     * Removes one occurence of the node ID in this arc
50     * Returns 1 if one occurence was found, but 0 if no
51     * occurences were found
52     */
53     int Remove (int __id);
54     int Remove (Node * __node);
55    
56     /**
57     * Returns the rank of this node
58     */
59     int Rank() const;
60    
61     /**
62     * Returns the number of ocurences of the specified node
63     * in this arc : this function will return "2" if it is a loop
64     * on this node
65     */
66     int NodeCount(int) const;
67    
68     /** Returns the first node in the arc */
69     Node * First() const;
70     /** Returns the last node in the arc */
71     Node * Last() const;
72     /** Returns wether this arc is a loop of the node X */
73     bool IsLoopOfNode(int __NodeId);
74     /** Returns wether this arc is a simple loop : has rank = 2
75     * and 2 times the same node */
76     bool IsLoop();
77    
78     private:
79     MultimapNodesById _nodes;
80     };
81    
82     }
83    
84     #endif