OpenASIP 2.2
Loading...
Searching...
No Matches
GraphEdge.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file GraphEdge.hh
26 *
27 * Prototype of graph-based program representation: declaration of graph
28 * edge.
29 *
30 * @author Andrea Cilio 2005 (cilio-no.spam-cs.tut.fi)
31 * @author Vladimir Guzma 2006 (vladimir.guzma-no.spam-tut.fi)
32 * @author Heikki Kultala 2008 (hkultala-no.spam-cs.tut.fi)
33 * @note rating: red
34 */
35
36#ifndef TTA_GRAPH_EDGE_HH
37#define TTA_GRAPH_EDGE_HH
38
39#include "TCEString.hh"
40
41/**
42 * Edge of the graph-based program representation. Each edge identifies a
43 * relation (dependency, ordering constraint) between two moves of the
44 * program.
45 *
46 * Edges are pure carriers of information about a node dependency. They do
47 * not store head and tail nodes. Edges are independent objects owned by a
48 * graph. They do not store a backpointer to their parent graph. All
49 * topological information about the graph is stored in ProgramGraph;
50 * nothing is distributed across nodes and edges.
51 */
52class GraphEdge {
53public:
54 GraphEdge();
55 GraphEdge(const GraphEdge& edge);
56
57 virtual GraphEdge* clone() const;
58
59 virtual ~GraphEdge();
60 virtual int edgeID() const;
61 virtual TCEString toString() const;
62 virtual TCEString dotString() const;
63 virtual bool isBackEdge() const {
64 return false;
65 }
66
67 struct Comparator {
68 inline bool operator()(GraphEdge* e1, GraphEdge* e2) const {
69 return e1->edgeID_ < e2->edgeID_;
70 }
71 };
72
73 int weight() const { return weight_; }
74 void setWeight(int w) { weight_ = w; }
75private:
78 static int edgeCounter_;
79};
80
81#endif
virtual TCEString toString() const
Definition GraphEdge.cc:66
virtual ~GraphEdge()
Definition GraphEdge.cc:38
void setWeight(int w)
Definition GraphEdge.hh:74
int weight_
Definition GraphEdge.hh:77
virtual TCEString dotString() const
Definition GraphEdge.cc:81
virtual GraphEdge * clone() const
Definition GraphEdge.cc:51
int weight() const
Definition GraphEdge.hh:73
static int edgeCounter_
Definition GraphEdge.hh:78
virtual bool isBackEdge() const
Definition GraphEdge.hh:63
int edgeID_
Definition GraphEdge.hh:76
virtual int edgeID() const
Definition GraphEdge.cc:92
bool operator()(GraphEdge *e1, GraphEdge *e2) const
Definition GraphEdge.hh:68