Deleted Added
sdiff udiff text old ( 7055:4e24742201d7 ) new ( 7453:1a5db3dd0f62 )
full compact
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 191 unchanged lines hidden (view full) ---

200 */
201
202#ifndef __${{self.c_ident}}_HH__
203#define __${{self.c_ident}}_HH__
204
205#include <iostream>
206
207#include "mem/ruby/common/Global.hh"
208''')
209
210 for dm in self.data_members.values():
211 if not dm.type.isPrimitive:
212 code('#include "mem/protocol/$0.hh"', dm.type.c_ident)
213
214 parent = ""
215 if "interface" in self:

--- 20 unchanged lines hidden (view full) ---

236 # Look for the type default
237 tid = dm.type.c_ident
238 code('m_$ident = ${{dm.type["default"]}}; // default value of $tid')
239 else:
240 code('// m_$ident has no default')
241 code.dedent()
242 code('}')
243
244 # ******** Copy constructor ********
245 if not self.isGlobal:
246 code('${{self.c_ident}}(const ${{self.c_ident}}&other)')
247
248 # Call superclass constructor
249 if "interface" in self:
250 code(' : ${{self["interface"]}}(other)')
251
252 code('{')
253 code.indent()
254
255 for dm in self.data_members.values():
256 code('m_${{dm.ident}} = other.m_${{dm.ident}};')
257
258 if self.isMessage:
259 code('proc_id = other.proc_id;')
260
261 code.dedent()
262 code('}')
263
264 # ******** Full init constructor ********
265 if not self.isGlobal:
266 params = [ 'const %s& local_%s' % (dm.type.c_ident, dm.ident) \
267 for dm in self.data_members.itervalues() ]
268
269 if self.isMessage:
270 params.append('const unsigned local_proc_id')
271

--- 12 unchanged lines hidden (view full) ---

284 code('m_${{dm.ident}}${{dm["nextLineCallHack"]}};')
285
286 if self.isMessage:
287 code('proc_id = local_proc_id;')
288
289 code.dedent()
290 code('}')
291
292 # create a static factory method and a clone member
293 code('''
294static ${{self.c_ident}}*
295create()
296{
297 return new ${{self.c_ident}}();
298}
299
300${{self.c_ident}}*
301clone() const
302{
303 return new ${{self.c_ident}}(*this);
304}
305''')
306
307 if not self.isGlobal:
308 # const Get methods for each field
309 code('// Const accessors methods for each field')
310 for dm in self.data_members.values():
311 code('''
312/** \\brief Const accessor method for ${{dm.ident}} field.

--- 89 unchanged lines hidden (view full) ---

402
403#include <iostream>
404
405#include "mem/protocol/${{self.c_ident}}.hh"
406
407using namespace std;
408''')
409
410 code('''
411/** \\brief Print the state of this object */
412void
413${{self.c_ident}}::print(ostream& out) const
414{
415 out << "[${{self.c_ident}}: ";
416''')
417

--- 288 unchanged lines hidden ---