Type.py (11283:4cc8b312f026) Type.py (12065:e3e51756dfef)
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;

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

454#include <iostream>
455#include <string>
456
457''')
458 if self.isStateDecl:
459 code('#include "mem/protocol/AccessPermission.hh"')
460
461 if self.isMachineType:
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;

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

454#include <iostream>
455#include <string>
456
457''')
458 if self.isStateDecl:
459 code('#include "mem/protocol/AccessPermission.hh"')
460
461 if self.isMachineType:
462 code('#include <functional>')
462 code('#include "base/misc.hh"')
463 code('#include "mem/ruby/common/Address.hh"')
464 code('#include "mem/ruby/common/TypeDefines.hh"')
465 code('struct MachineID;')
466
467 code('''
468
469// Class definition

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

493
494// Code to convert state to a string
495std::string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
496
497// Code to increment an enumeration type
498${{self.c_ident}} &operator++(${{self.c_ident}} &e);
499''')
500
463 code('#include "base/misc.hh"')
464 code('#include "mem/ruby/common/Address.hh"')
465 code('#include "mem/ruby/common/TypeDefines.hh"')
466 code('struct MachineID;')
467
468 code('''
469
470// Class definition

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

494
495// Code to convert state to a string
496std::string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
497
498// Code to increment an enumeration type
499${{self.c_ident}} &operator++(${{self.c_ident}} &e);
500''')
501
502 if self.isMachineType:
503 code('''
504
505// define a hash function for the MachineType class
506namespace std {
507template<>
508struct hash<MachineType> {
509 std::size_t operator()(const MachineType &mtype) const {
510 return hash<size_t>()(static_cast<size_t>(mtype));
511 }
512};
513}
514
515''')
501 # MachineType hack used to set the base component id for each Machine
502 if self.isMachineType:
503 code('''
504int ${{self.c_ident}}_base_level(const ${{self.c_ident}}& obj);
505MachineType ${{self.c_ident}}_from_base_level(int);
506int ${{self.c_ident}}_base_number(const ${{self.c_ident}}& obj);
507int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj);
508''')

--- 276 unchanged lines hidden ---
516 # MachineType hack used to set the base component id for each Machine
517 if self.isMachineType:
518 code('''
519int ${{self.c_ident}}_base_level(const ${{self.c_ident}}& obj);
520MachineType ${{self.c_ident}}_from_base_level(int);
521int ${{self.c_ident}}_base_number(const ${{self.c_ident}}& obj);
522int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj);
523''')

--- 276 unchanged lines hidden ---