OpenASIP 2.2
Loading...
Searching...
No Matches
NodeIdCompList.hh
Go to the documentation of this file.
1/*
2 Copyright 2002-2008 Tampere University. All Rights
3 Reserved.
4
5 This file is part of TTA-Based Codesign Environment (TCE).
6
7 TCE is free software; you can redistribute it and/or modify it under the
8 terms of the GNU General Public License version 2 as published by the Free
9 Software Foundation.
10
11 TCE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 details.
15
16 You should have received a copy of the GNU General Public License along
17 with TCE; if not, write to the Free Software Foundation, Inc., 51 Franklin
18 St, Fifth Floor, Boston, MA 02110-1301 USA
19
20 As a special exception, you may use this file as part of a free software
21 library without restriction. Specifically, if other files instantiate
22 templates or use macros or inline functions from this file, or you compile
23 this file and link it with other files to produce an executable, this
24 file does not by itself cause the resulting executable to be covered by
25 the GNU General Public License. This exception does not however
26 invalidate any other reasons why the executable file might be covered by
27 the GNU General Public License.
28*/
29/**
30 * @file NodeIdCompList.hh
31 *
32 * Declaration of NodeIdCompList class.
33 *
34 * @author Heikki Kultala 2008 (hkultala-no.spam-cs.tut.fi)
35 * @note rating: red
36 */
37
38#ifndef TTA_NODE_ID_COMP_LIST_HH
39#define TTA_NODE_ID_COMP_LIST_HH
40
41#include <vector>
42#include <queue>
43
44/**
45 * A function object for prioritizing the ready list according to the move's
46 * node id. stupid but working order.
47 *
48 */
50 public std::binary_function<MoveNode*, MoveNode*, bool> {
51public:
52 /**
53 * Compares two nodes according to their priority in the ready list.
54 *
55 * @param a Node a.
56 * @param b Node b.
57 * @return True if b should be scheduled before a (b greater than a).
58 */
60
61 if (b.isScheduled()) {
62 // keep scheduled MoveNodeSets on a top of a queue
63 // so they will be poped out
64 return true;
65 }
66 if (a.isScheduled()) {
67 // keep scheduled MoveNodeSets on a top of a queue
68 // so they will be poped out
69 return false;
70 }
71
72 return b.node(0).nodeID() < a.node(0).nodeID();
73 }
74};
75
76/// A prioritized list for the ready-to-be-scheduled move node groups.
77typedef std::priority_queue<
78 MoveNodeGroup, std::vector<MoveNodeGroup>,
80
81#endif
std::priority_queue< MoveNodeGroup, std::vector< MoveNodeGroup >, RLPriorityNodeId > NodeIdCompList
A prioritized list for the ready-to-be-scheduled move node groups.
int nodeID() const
MoveNode & node(int index) const
bool isScheduled() const
bool operator()(MoveNodeGroup &a, MoveNodeGroup &b)