25 #include <elm/utility.h>
26 #include <elm/string.h>
27 #include <elm/util/VarArg.h>
28 #include <elm/util/strong_type.h>
29 #include <elm/util/AutoComparator.h>
30 #include <elm/util/HashKey.h>
31 #include <elm/types.h>
32 #include <elm/type_info.h>
35 namespace elm {
namespace serial2 {
62 inline Address(
void): pg(null_page), off(0) { }
72 inline bool isNull(
void)
const {
return pg == null_page; }
89 { ASSERT(!isNull() && !address.
isNull()); ASSERT(pg == address.
pg);
return off - address.
off; }
94 { ASSERT(pg == address.
pg);
if(off < address.
off)
return -1;
else if(off > address.
off)
return 1;
else return 0; }
127 inline bool isNull(
void)
const {
return _base.isNull(); }
128 inline bool isEmpty(
void)
const {
return !_size; }
129 inline bool contains(
const Address& addr)
const {
return _base <= addr && addr <= lastAddress(); }
132 bool includes(
const MemArea& a)
const;
133 bool meets(
const MemArea& a)
const;
142 inline operator bool(
void)
const {
return isEmpty(); }
189 #endif // OTAWA_BASE_H
bool operator==(const Address &addr) const
Definition: base.h:95
Address & operator=(offset_t offset)
Definition: base.h:77
MemArea(const Address &base, ot::size size)
Definition: base.h:119
bool operator>(const MemArea &a) const
Definition: base.h:146
t::uint8 byte
Definition: base.h:44
bool contains(const Address &addr) const
Test whether the area contains the given address.
Definition: base.h:129
MemArea(const Address &base, const Address &top)
MemArea::MemArea(const MemArea& a); Copy an existing mem area.
Definition: base.h:120
bool isEmpty(void) const
Test whether the area is empty, that is, whether the size is null.
Definition: base.h:128
t::uint32 mask
Definition: base.h:45
void resize(const ot::size size)
Definition: base.h:140
static unsigned long hash(const otawa::Address &key)
Definition: base.h:183
page_t pg
Definition: base.h:103
Address lastAddress(void) const
Get the last address of the area, that is, the address of the last byte in the area.
Definition: base.h:125
offset_t off
Definition: base.h:104
Address operator+(t::uint32 offset) const
Definition: base.h:85
bool operator==(const MemArea &a) const
Definition: base.h:143
Address operator-(t::uint32 offset) const
Definition: base.h:87
bool equals(const Address &address) const
Test if two address are equals.
Definition: base.h:92
bool operator<(const MemArea &a) const
Definition: base.h:147
Address operator-(t::int32 offset) const
Definition: base.h:86
void set(const MemArea &a)
Definition: base.h:137
int compare(const Address &address) const
Compare two addresses and returns:
Definition: base.h:93
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
Address & operator=(const Address &address)
Definition: base.h:76
bool operator!=(const MemArea &a) const
Definition: base.h:144
MemArea operator&(const MemArea &a) const
Definition: base.h:150
bool isNull(void) const
Test if the area is null.
Definition: base.h:127
elm::io::IntFormat address(Address addr)
Build a format to display addresses.
Definition: base.cpp:213
bool isNull(void) const
Test if the address is null.
Definition: base.h:72
ot::size size(void) const
Get the size of the area.
Definition: base.h:123
bool operator>=(const MemArea &a) const
Definition: base.h:145
t::uint32 offset_t
Definition: base.h:57
bool operator!=(const Address &addr) const
Definition: base.h:96
void operator+=(const MemArea &a)
Definition: base.h:154
MemArea operator=(const MemArea &a)
Definition: base.h:152
t::uint32 size
Definition: base.h:46
void moveTop(const Address &top)
Definition: base.h:139
Address & operator-=(int offset)
Definition: base.h:80
void operator&=(const MemArea &a)
Definition: base.h:153
Address operator+(t::int32 offset) const
Definition: base.h:84
offset_t operator*(void) const
Short cut to offset().
Definition: base.h:71
offset_t offset(void) const
Get the offset value.
Definition: base.h:70
Utility class representing an area in the memory defined by a base address and a size.
Definition: base.h:113
bool equals(const MemArea &a) const
Test wether the current area and the given one are equal.
Definition: base.h:131
The representation of an address in OTAWA.
Definition: base.h:54
MemArea(void)
Build a null mem area.
Definition: base.h:117
bool operator<=(const MemArea &a) const
Definition: base.h:148
bool operator>(const Address &addr) const
Definition: base.h:99
t::uint32 page_t
Definition: base.h:56
static MemArea null
Null memory area.
Definition: base.h:115
sys::SystemOutStream & out
void move(const Address &base)
Definition: base.h:138
offset_t operator-(const Address &address) const
Definition: base.h:88
bool includes(const MemArea &a) const
Test if the current mem area includes (not strictly) the given one.
Definition: base.cpp:320
static Address null
Null address.
Definition: base.h:58
static bool equals(const otawa::Address &key1, const otawa::Address &key2)
Definition: base.h:184
MemArea operator+(const MemArea &a) const
Definition: base.h:151
MemArea(const MemArea &a)
Definition: base.h:118
bool operator<=(const Address &addr) const
Definition: base.h:98
Address(void)
Build a null address.
Definition: base.h:62
Address address_t
Definition: base.h:107
t::int64 time
Definition: base.h:47
Address & operator-=(t::uint32 offset)
Definition: base.h:81
Address & operator+=(t::uint32 offset)
Definition: base.h:79
Address _base
Definition: base.h:157
Address(page_t page, offset_t offset)
Build a full address.
Definition: base.h:64
bool operator<(const Address &addr) const
Definition: base.h:97
Address topAddress(void) const
Get the top address of the area, that is, the address of the first byte after the area...
Definition: base.h:124
bool operator>=(const Address &addr) const
Definition: base.h:100
Address(offset_t offset)
Build a simple absolute address.
Definition: base.h:63
ot::size _size
Definition: base.h:158
Address address(void) const
Get the base address of the area.
Definition: base.h:122
page_t page(void) const
Get the page number.
Definition: base.h:69
Address(const Address &address)
Build an address by cloning.
Definition: base.h:65
virtual String message(void)
Address & operator+=(int offset)
Definition: base.h:78