SubBlock.hh (10086:bd1089db3a88) | SubBlock.hh (11025:4872dbdea907) |
---|---|
1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 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; --- 25 unchanged lines hidden (view full) --- 34 35#include "mem/ruby/common/Address.hh" 36#include "mem/ruby/common/DataBlock.hh" 37 38class SubBlock 39{ 40 public: 41 SubBlock() { } | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 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; --- 25 unchanged lines hidden (view full) --- 34 35#include "mem/ruby/common/Address.hh" 36#include "mem/ruby/common/DataBlock.hh" 37 38class SubBlock 39{ 40 public: 41 SubBlock() { } |
42 SubBlock(const Address& addr, int size); | 42 SubBlock(Addr addr, int size); |
43 ~SubBlock() { } 44 | 43 ~SubBlock() { } 44 |
45 const Address& getAddress() const { return m_address; } 46 void setAddress(const Address& addr) { m_address = addr; } | 45 Addr getAddress() const { return m_address; } 46 void setAddress(Addr addr) { m_address = addr; } |
47 48 int getSize() const { return m_data.size(); } 49 void resize(int size) { m_data.resize(size); } 50 uint8_t getByte(int offset) const { return m_data[offset]; } 51 void setByte(int offset, uint8_t data) { m_data[offset] = data; } 52 53 // Shorthands 54 uint8_t readByte() const { return getByte(0); } --- 6 unchanged lines hidden (view full) --- 61 62 void print(std::ostream& out) const; 63 64 private: 65 void internalMergeTo(DataBlock& data) const; 66 void internalMergeFrom(const DataBlock& data); 67 68 // Data Members (m_ prefix) | 47 48 int getSize() const { return m_data.size(); } 49 void resize(int size) { m_data.resize(size); } 50 uint8_t getByte(int offset) const { return m_data[offset]; } 51 void setByte(int offset, uint8_t data) { m_data[offset] = data; } 52 53 // Shorthands 54 uint8_t readByte() const { return getByte(0); } --- 6 unchanged lines hidden (view full) --- 61 62 void print(std::ostream& out) const; 63 64 private: 65 void internalMergeTo(DataBlock& data) const; 66 void internalMergeFrom(const DataBlock& data); 67 68 // Data Members (m_ prefix) |
69 Address m_address; | 69 Addr m_address; |
70 std::vector<uint8_t> m_data; 71}; 72 73inline std::ostream& 74operator<<(std::ostream& out, const SubBlock& obj) 75{ 76 obj.print(out); 77 out << std::flush; 78 return out; 79} 80 81#endif // __MEM_RUBY_COMMON_SUBBLOCK_HH__ | 70 std::vector<uint8_t> m_data; 71}; 72 73inline std::ostream& 74operator<<(std::ostream& out, const SubBlock& obj) 75{ 76 obj.print(out); 77 out << std::flush; 78 return out; 79} 80 81#endif // __MEM_RUBY_COMMON_SUBBLOCK_HH__ |