OpenASIP
2.0
src
base
program
MoveNodeSet.cc
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 MoveNodeSet.cc
26
*
27
* Implementation of MoveNodeSet class.
28
*
29
* @author Vladimir Guzma 2006 (vladimir.guzma-no.spam-tut.fi)
30
* @note rating: red
31
*/
32
33
#include "
MoveNodeSet.hh
"
34
35
/**
36
* Fairly empty constructor.
37
*/
38
MoveNodeSet::MoveNodeSet
() {
39
}
40
41
42
/**
43
* Returns the disassembly of the moves in the set in a single line.
44
*
45
* @return the disassembly.
46
*/
47
std::string
48
MoveNodeSet::toString
()
const
{
49
std::string disasm =
""
;
50
for
(
int
i = 0; i <
count
(); ++i) {
51
disasm +=
moveNodes_
.at(i)->toString() +
" ; "
;
52
}
53
return
disasm;
54
}
55
56
/**
57
* Add MoveNode to the MoveNodeSet
58
*
59
* @param newMove New MoveNode to add to set
60
*/
61
void
62
MoveNodeSet::addMoveNode
(
MoveNode
& newMove){
63
for
(std::vector<MoveNode*>::iterator i =
moveNodes_
.begin();
64
i !=
moveNodes_
.end(); i++) {
65
if
(*i == &newMove) {
66
return
;
// already in the set. please even play to be a set if named a set
67
}
68
}
69
moveNodes_
.push_back(&newMove);
70
}
71
72
void
73
MoveNodeSet::removeMoveNode
(
MoveNode
& node) {
74
for
(std::vector<MoveNode*>::iterator i =
moveNodes_
.begin();
75
i !=
moveNodes_
.end(); i++) {
76
if
(*i == &node) {
77
moveNodes_
.erase(i);
78
return
;
79
}
80
}
81
throw
IllegalRegistration
(
82
__FILE__,__LINE__,
__func__
,
"MoveNode not in MoveNodeSet"
);
83
}
MoveNodeSet::toString
std::string toString() const
Definition:
MoveNodeSet.cc:48
MoveNodeSet::removeMoveNode
void removeMoveNode(MoveNode &)
Definition:
MoveNodeSet.cc:73
MoveNode
Definition:
MoveNode.hh:65
__func__
#define __func__
Definition:
Application.hh:67
MoveNodeSet::moveNodes_
std::vector< MoveNode * > moveNodes_
Definition:
MoveNodeSet.hh:55
IllegalRegistration
Definition:
Exception.hh:532
MoveNodeSet::count
int count() const
MoveNodeSet::addMoveNode
void addMoveNode(MoveNode &)
Definition:
MoveNodeSet.cc:62
MoveNodeSet.hh
MoveNodeSet::MoveNodeSet
MoveNodeSet()
Definition:
MoveNodeSet.cc:38
Generated by
1.8.17