ROSE
0.11.96.11
|
A homogeneous interval of an address space.
A segment imparts access permissions and other address-map related characteristics to a buffer. The segment represents one contiguous, homogeneous interval of an address space and thus points to one buffer that implements the value-storage for that part of the address space.
A segment doesn't store information about where it's mapped in an address space since that's the responsibility of the map containing the segment. A segment points to a buffer which might not be the same size as what is entered in the map; buffers that are longer than the mapped interval of address space have data which is not accessible (at least not through that segment), and buffers that are shorter may return short data from read and write operations.
Definition at line 37 of file AddressSegment.h.
#include <AddressSegment.h>
Public Types | |
typedef A | Address |
Address types expected to be used by the underlying buffer. | |
typedef T | Value |
Type of values stored by the underlying buffer. | |
Public Member Functions | |
AddressSegment () | |
Default constructor. More... | |
AddressSegment (const AddressSegment &other) | |
Copy constructor. More... | |
AddressSegment (const typename Buffer< Address, Value >::Ptr &buffer, Address offset=0, unsigned accessBits=0, const std::string &name="") | |
Construct a segment with buffer. More... | |
bool | isAccessible (unsigned requiredAccess, unsigned prohibitedAccess) const |
Determines whether this segment is accessible. More... | |
Buffer< A, T >::Ptr | buffer () const |
Property: buffer. More... | |
AddressSegment & | buffer (const typename Buffer< A, T >::Ptr &b) |
Property: buffer. More... | |
A | offset () const |
Property: buffer offset. More... | |
AddressSegment & | offset (A n) |
Property: buffer offset. More... | |
unsigned | accessibility () const |
Property: access rights. More... | |
AddressSegment & | accessibility (unsigned bits) |
Property: access rights. More... | |
const std::string & | name () const |
Property: name. More... | |
AddressSegment & | name (const std::string &s) |
Property: name. More... | |
Static Public Member Functions | |
static AddressSegment | nullInstance (Address size, unsigned accessBits=0, const std::string &name="") |
Create a segment that points to no data. More... | |
static AddressSegment | anonymousInstance (Address size, unsigned accessBits=0, const std::string &name="") |
Create a segment with no backing store. More... | |
static AddressSegment | fileInstance (const std::string &fileName, unsigned accessBits=Access::READABLE, const std::string &name="") |
Map a file into an address space. | |
static AddressSegment | staticInstance (Value *buffer, Address size, unsigned accessBits=0, const std::string &name="") |
Create a segment that points to a static buffer. More... | |
static AddressSegment | staticInstance (const Value *buffer, Address size, unsigned accessBits=0, const std::string &name="") |
Create a segment that points to a static buffer. More... | |
|
inline |
Default constructor.
Constructs a segment that does not point to any buffer. This is mainly to fulfill the requirement that values in an IntervalMap are default constructable.
Definition at line 70 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressSegment< A, boost::uint8_t >::anonymousInstance(), Sawyer::Container::AddressSegment< A, boost::uint8_t >::fileInstance(), Sawyer::Container::AddressSegment< A, boost::uint8_t >::nullInstance(), and Sawyer::Container::AddressSegment< A, boost::uint8_t >::staticInstance().
|
inline |
Copy constructor.
Creates a new segment that's an exact copy of other
. Both segments will point to the same underlying buffer, which is reference counted.
Definition at line 76 of file AddressSegment.h.
|
inlineexplicit |
Construct a segment with buffer.
This is the usual way that segments are created: by specifying a buffer and some access permissions.
Definition at line 82 of file AddressSegment.h.
|
inlinestatic |
Create a segment that points to no data.
Creates a segment of the specified size that points to a NullBuffer. This creates a segment which returns default constructed values when read, which fails when written. Such a segment is appropriate and efficient for mapping very large areas of an address space.
Definition at line 96 of file AddressSegment.h.
|
inlinestatic |
Create a segment with no backing store.
Creates a segment by allocating default-constructed values. Writes to this segment will update the underlying buffer, but the buffer is only stored in memory and not attached to any type of file or permanent storage.
Definition at line 104 of file AddressSegment.h.
|
inlinestatic |
Create a segment that points to a static buffer.
Ownership of the buffer is not transferred to the segment.
Definition at line 113 of file AddressSegment.h.
|
inlinestatic |
Create a segment that points to a static buffer.
Ownership of the buffer is not transferred to the segment.
Definition at line 116 of file AddressSegment.h.
|
inline |
Property: buffer.
This is the Buffer object that represents the values stored in this interval of the address space. The first value in this segment, no matter where or if it's mapped in an address-mapping container, corresponds to the value stored at address zero of the buffer.
Definition at line 141 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressMap< A, T >::AddressMap(), Sawyer::Container::AddressMap< A, T >::checkConsistency(), Sawyer::Container::AddressSegment< A, boost::uint8_t >::staticInstance(), and Sawyer::Container::AddressMap< A, T >::write().
|
inline |
Property: buffer.
This is the Buffer object that represents the values stored in this interval of the address space. The first value in this segment, no matter where or if it's mapped in an address-mapping container, corresponds to the value stored at address zero of the buffer.
Definition at line 142 of file AddressSegment.h.
|
inline |
Property: buffer offset.
The offset into the buffer corresponding to the first value of this segment.
Definition at line 150 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressMap< A, T >::changeAccess(), Sawyer::Container::AddressMap< A, T >::checkConsistency(), and Sawyer::Container::AddressMap< A, T >::write().
|
inline |
Property: buffer offset.
The offset into the buffer corresponding to the first value of this segment.
Definition at line 151 of file AddressSegment.h.
|
inline |
Property: access rights.
This property stores access rights as an unsigned integer. It makes no interpretation of what the various bits mean since the meaning is imparted by the mapping container.
Definition at line 160 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressMap< A, T >::changeAccess().
|
inline |
Property: access rights.
This property stores access rights as an unsigned integer. It makes no interpretation of what the various bits mean since the meaning is imparted by the mapping container.
Definition at line 161 of file AddressSegment.h.
|
inline |
Property: name.
Each segment may be given a name which can be used for debugging.
Definition at line 169 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressSegment< A, boost::uint8_t >::anonymousInstance(), Sawyer::Container::AddressSegment< A, boost::uint8_t >::fileInstance(), Sawyer::Container::AddressSegment< A, boost::uint8_t >::nullInstance(), and Sawyer::Container::AddressSegment< A, boost::uint8_t >::staticInstance().
|
inline |
Property: name.
Each segment may be given a name which can be used for debugging.
Definition at line 170 of file AddressSegment.h.
|
inline |
Determines whether this segment is accessible.
Returns true if all bits that are set in requiredAccess
are also set in this segment, and none of the bits set in prohibitedAccess
are set in this segment.
Definition at line 181 of file AddressSegment.h.