OpenASIP  2.0
NullAddressSpace.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 NullAddressSpace.cc
26  *
27  * Implementation of NullAddressSpace class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: yellow
31  */
32 
33 #include "NullAddressSpace.hh"
34 #include "Machine.hh"
35 
36 namespace TTAMachine {
37 
39 NullAddressSpace NullAddressSpace::instance_;
40 
41 /**
42  * The constructor.
43  */
45  AddressSpace("NULL", 1, 0, 1, machine_) {
46 }
47 
48 
49 /**
50  * The destructor.
51  */
53 }
54 
55 
56 /**
57  * Returns the only instance of NullAddressSpace.
58  *
59  * @return The only instance of NullAddressSpace.
60  */
63  return instance_;
64 }
65 
66 
67 /**
68  * Aborts the program with error message.
69  *
70  * @return Never returns.
71  */
72 int
74  abortWithError("width()");
75  return 0;
76 }
77 
78 
79 /**
80  * Aborts the program with error message.
81  *
82  * @return Never returns.
83  */
86  abortWithError("start()");
87  return 0;
88 }
89 
90 
91 /**
92  * Aborts the program with error message.
93  *
94  * @return Never returns.
95  */
98  abortWithError("end()");
99  return 0;
100 }
101 
102 
103 /**
104  * Aborts the program with error message.
105  *
106  * @return Never returns.
107  */
108 TCEString
110  abortWithError("name()");
111  return "";
112 }
113 
114 
115 /**
116  * Aborts the program with error message.
117  *
118  * @exception ComponentAlreadyExists Never thrown.
119  * @exception InvalidName Never thrown.
120  */
121 void
122 NullAddressSpace::setName(const std::string&) {
123  abortWithError("setName()");
124 }
125 
126 /**
127  * Aborts the program with error message.
128  *
129  * @exception OutOfRange Never thrown.
130  */
131 void
133  abortWithError("setWidth()");
134 }
135 
136 /**
137  * Aborts the program with error message.
138  *
139  * @exception OutOfRange Never thrown.
140  */
141 void
143  abortWithError("setAddressBounds()");
144 }
145 
146 /**
147  * Aborts the program with error message.
148  *
149  * @exception ComponentAlreadyExists Never thrown.
150  */
151 void
153  abortWithError("setMachine()");
154 }
155 
156 /**
157  * Aborts the program with error message.
158  */
159 void
161  abortWithError("unsetMachine()");
162 }
163 
164 
165 /**
166  * Aborts the program with error message.
167  *
168  * @return Never returns.
169  */
170 Machine*
172  abortWithError("machine()");
173  return NULL;
174 }
175 
176 
177 /**
178  * Aborts the program with error message.
179  *
180  * @exception IllegalRegistration Never thrown.
181  */
182 void
184  abortWithError("ensureRegistration()");
185 }
186 
187 /**
188  * Aborts the program with error message.
189  *
190  * @return Never returns.
191  */
192 bool
194  abortWithError("isRegistered()");
195  return false;
196 }
197 
198 
199 /**
200  * Aborts the program with error message.
201  *
202  * @return Never returns.
203  */
206  abortWithError("saveState()");
207  return NULL;
208 }
209 
210 
211 /**
212  * Aborts the program with error message.
213  *
214  * @exception ObjectStateLoadingException Never thrown.
215  */
216 void
218  abortWithError("loadState()");
219 }
220 }
TTAMachine::NullAddressSpace::instance
static NullAddressSpace & instance()
Definition: NullAddressSpace.cc:62
TTAMachine::NullAddressSpace::machine_
static Machine machine_
Machine to which the null address space is registered.
Definition: NullAddressSpace.hh:74
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
TTAMachine::NullAddressSpace::unsetMachine
virtual void unsetMachine()
Definition: NullAddressSpace.cc:160
TTAMachine::NullAddressSpace::~NullAddressSpace
virtual ~NullAddressSpace()
Definition: NullAddressSpace.cc:52
TTAMachine::NullAddressSpace::width
virtual int width() const
Definition: NullAddressSpace.cc:73
ObjectState
Definition: ObjectState.hh:59
TTAMachine::NullAddressSpace::NullAddressSpace
NullAddressSpace()
Definition: NullAddressSpace.cc:44
TTAMachine::NullAddressSpace::instance_
static NullAddressSpace instance_
The only instance of NullAddressSpace.
Definition: NullAddressSpace.hh:72
TTAMachine::NullAddressSpace::start
virtual ULongWord start() const
Definition: NullAddressSpace.cc:85
TTAMachine::NullAddressSpace::machine
virtual Machine * machine() const
Definition: NullAddressSpace.cc:171
TTAMachine::NullAddressSpace::loadState
virtual void loadState(const ObjectState *state)
Definition: NullAddressSpace.cc:217
TTAMachine::NullAddressSpace::setName
virtual void setName(const std::string &name) override
Definition: NullAddressSpace.cc:122
TTAMachine::NullAddressSpace
Definition: NullAddressSpace.hh:45
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
TTAMachine::NullAddressSpace::end
virtual ULongWord end() const
Definition: NullAddressSpace.cc:97
NullAddressSpace.hh
TTAMachine::Component
Definition: MachinePart.hh:90
Machine.hh
TTAMachine::NullAddressSpace::name
virtual TCEString name() const override
Definition: NullAddressSpace.cc:109
TCEString
Definition: TCEString.hh:53
TTAMachine::NullAddressSpace::saveState
virtual ObjectState * saveState() const
Definition: NullAddressSpace.cc:205
ULongWord
unsigned long ULongWord
Definition: BaseType.hh:51
TTAMachine::NullAddressSpace::ensureRegistration
virtual void ensureRegistration(const Component &component) const
Definition: NullAddressSpace.cc:183
TTAMachine::NullAddressSpace::isRegistered
virtual bool isRegistered() const
Definition: NullAddressSpace.cc:193
TTAMachine
Definition: Assembler.hh:48
TTAMachine::NullAddressSpace::setMachine
virtual void setMachine(Machine &mach) override
Definition: NullAddressSpace.cc:152
TTAMachine::NullAddressSpace::setWidth
virtual void setWidth(int width) override
Definition: NullAddressSpace.cc:132
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::NullAddressSpace::setAddressBounds
virtual void setAddressBounds(ULongWord start, ULongWord end) override
Definition: NullAddressSpace.cc:142