ROSE 0.11.145.147
|
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 42 of file AddressSegment.h.
#include <Sawyer/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. | |
AddressSegment (const AddressSegment &other) | |
Copy constructor. | |
AddressSegment (const typename Buffer< Address, Value >::Ptr &buffer, Address offset=0, unsigned accessBits=0, const std::string &name="") | |
Construct a segment with buffer. | |
AddressSegment & | operator= (const AddressSegment &other) |
Assignment. | |
bool | isAccessible (unsigned requiredAccess, unsigned prohibitedAccess) const |
Determines whether this segment is accessible. | |
Buffer< A, T >::Ptr | buffer () const |
Property: buffer. | |
AddressSegment & | buffer (const typename Buffer< A, T >::Ptr &b) |
Property: buffer. | |
A | offset () const |
Property: buffer offset. | |
AddressSegment & | offset (A n) |
Property: buffer offset. | |
unsigned | accessibility () const |
Property: access rights. | |
AddressSegment & | accessibility (unsigned bits) |
Property: access rights. | |
const std::string & | name () const |
Property: name. | |
AddressSegment & | name (const std::string &s) |
Property: name. | |
Static Public Member Functions | |
static AddressSegment | nullInstance (Address size, unsigned accessBits=0, const std::string &name="") |
Create a segment that points to no data. | |
static AddressSegment | anonymousInstance (Address size, unsigned accessBits=0, const std::string &name="") |
Create a segment with no backing store. | |
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. | |
static AddressSegment | staticInstance (const Value *buffer, Address size, unsigned accessBits=0, const std::string &name="") |
Create a segment that points to a static buffer. | |
typedef A Sawyer::Container::AddressSegment< A, T >::Address |
Address types expected to be used by the underlying buffer.
Definition at line 49 of file AddressSegment.h.
typedef T Sawyer::Container::AddressSegment< A, T >::Value |
Type of values stored by the underlying buffer.
Definition at line 50 of file AddressSegment.h.
|
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 94 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressSegment< A, T >::anonymousInstance(), Sawyer::Container::AddressSegment< A, T >::fileInstance(), Sawyer::Container::AddressSegment< A, T >::nullInstance(), Sawyer::Container::AddressSegment< A, T >::staticInstance(), and Sawyer::Container::AddressSegment< A, 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 100 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 106 of file AddressSegment.h.
|
inline |
Assignment.
Definition at line 111 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 129 of file AddressSegment.h.
References Sawyer::Container::AddressSegment< A, T >::AddressSegment(), and Sawyer::Container::AddressSegment< A, T >::name().
|
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 137 of file AddressSegment.h.
References Sawyer::Container::AddressSegment< A, T >::AddressSegment(), and Sawyer::Container::AddressSegment< A, T >::name().
|
inlinestatic |
Create a segment that points to a static buffer.
Ownership of the buffer is not transferred to the segment.
Definition at line 146 of file AddressSegment.h.
References Sawyer::Container::AddressSegment< A, T >::AddressSegment(), Sawyer::Container::AddressSegment< A, T >::buffer(), and Sawyer::Container::AddressSegment< A, T >::name().
|
inlinestatic |
Create a segment that points to a static buffer.
Ownership of the buffer is not transferred to the segment.
Definition at line 149 of file AddressSegment.h.
References Sawyer::Container::AddressSegment< A, T >::AddressSegment(), Sawyer::Container::AddressSegment< A, T >::buffer(), and Sawyer::Container::AddressSegment< A, T >::name().
|
inlinestatic |
Map a file into an address space.
Definition at line 155 of file AddressSegment.h.
References Sawyer::Container::AddressSegment< A, T >::AddressSegment(), and Sawyer::Container::AddressSegment< A, T >::name().
|
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 174 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressSegment< A, T >::staticInstance(), and Sawyer::Container::AddressSegment< A, T >::staticInstance().
|
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 175 of file AddressSegment.h.
|
inline |
Property: buffer offset.
The offset into the buffer corresponding to the first value of this segment.
Definition at line 183 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressMap< A, T >::changeAccess().
|
inline |
Property: buffer offset.
The offset into the buffer corresponding to the first value of this segment.
Definition at line 184 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 193 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 194 of file AddressSegment.h.
|
inline |
Property: name.
Each segment may be given a name which can be used for debugging.
Definition at line 202 of file AddressSegment.h.
Referenced by Sawyer::Container::AddressSegment< A, T >::anonymousInstance(), Sawyer::Container::AddressSegment< A, T >::fileInstance(), Sawyer::Container::AddressSegment< A, T >::nullInstance(), Sawyer::Container::AddressSegment< A, T >::staticInstance(), and Sawyer::Container::AddressSegment< A, T >::staticInstance().
|
inline |
Property: name.
Each segment may be given a name which can be used for debugging.
Definition at line 203 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 214 of file AddressSegment.h.