ROSE  0.11.96.11
Public Types | Public Member Functions | List of all members
Sawyer::Container::AddressMapConstraints< AddressMap > Class Template Reference

Description

template<typename AddressMap>
class Sawyer::Container::AddressMapConstraints< AddressMap >

Constraints are used to select addresses from a memory map.

Users don't normally see this class since it's almost always created as a temporary. In fact, most of the public methods in this class are also present in the AddressMap class, and that's where they're documented.

The purpose of this class is to curry the arguments that would otherwise need to be passed to the various map I/O methods and which would significantly complicate the API since many of these arguments are optional.

Definition at line 80 of file AddressMap.h.

#include <AddressMap.h>

Public Types

typedef AddressMap::Address Address
 
typedef AddressMap::Value Value
 
typedef Sawyer::Container::Interval< Address > AddressInterval
 

Public Member Functions

 AddressMapConstraints (AddressMap *map)
 Construct a constraint that matches everything.
 
 operator AddressMapConstraints< const AddressMap > () const
 
void print (std::ostream &out) const
 Print constraints in a human readable form.
 
AddressMapConstraints require (unsigned bits) const
 Require certain access permissions. More...
 
AddressMapConstraints prohibit (unsigned bits) const
 Prohibit certain access permissions. More...
 
AddressMapConstraints access (unsigned bits) const
 Require and prohibit certain access permissions. More...
 
AddressMapConstraints substr (const std::string &s) const
 Require certain segment names. More...
 
AddressMapConstraints any () const
 No constraints. More...
 
AddressMapConstraints none () const
 Constraints that match nothing. More...
 
AddressMapConstraints at (Address x) const
 Anchor at a certain address. More...
 
AddressMapConstraints at (const Sawyer::Container::Interval< Address > &x) const
 Anchor at a certain interval. More...
 
AddressMapConstraints limit (size_t x) const
 Limit matching length. More...
 
AddressMapConstraints atOrAfter (Address least) const
 Limit addresses. More...
 
AddressMapConstraints atOrBefore (Address greatest) const
 Limit addresses. More...
 
AddressMapConstraints within (const Sawyer::Container::Interval< Address > &x) const
 Limit addresses. More...
 
AddressMapConstraints within (Address lo, Address hi) const
 Limit addresses. More...
 
AddressMapConstraints baseSize (Address base, Address size) const
 Limit addresses. More...
 
AddressMapConstraints after (Address x) const
 Limit addresses. More...
 
AddressMapConstraints before (Address x) const
 Limit addreses. More...
 
AddressMapConstraints singleSegment () const
 Limit matching to single segment. More...
 
AddressMapConstraints segmentPredicate (SegmentPredicate< Address, Value > *p) const
 Limit segments. More...
 
AddressMapConstraints segmentPredicates (const Callbacks< SegmentPredicate< Address, Value > * > &predicates) const
 
unsigned required () const
 Accessibility bits that are required to be set.
 
unsigned prohibited () const
 Accessibility bits that are required to be clear.
 
const std::string & substr () const
 Section name substring. More...
 
bool neverMatches () const
 Returns true if the constraint is not allowed to match anything. More...
 
bool isAnchored () const
 Determines whether constraints are anchored to an address.
 
AddressInterval anchored () const
 Returns the anchor points. More...
 
size_t limit () const
 Size limit. More...
 
const Optional< Address > & least () const
 Least possible address. More...
 
const Optional< Address > & greatest () const
 Greatest possible address. More...
 
bool isSingleSegment () const
 Returns true if the single-segment constraint is set.
 
const Callbacks< SegmentPredicate< Address, Value > * > segmentPredicates () const
 Returns the segment predicates.
 
AddressMapmap () const
 Returns a pointer to the memory map for this constraint object.
 
bool hasNonAddressConstraints () const
 Determines whether non-address constraints are present. More...
 
AddressMapConstraints addressConstraints () const
 Construct new constraints from existing address constraints. More...
 
boost::iterator_range< typename AddressMapTraits< AddressMap >::NodeIterator > nodes (MatchFlags flags=0) const
 
boost::iterator_range< typename AddressMapTraits< AddressMap >::SegmentIterator > segments (MatchFlags flags=0) const
 
Optional< typename AddressMap::Addressnext (MatchFlags flags=0) const
 
Sawyer::Container::Interval< Address > available (MatchFlags flags=0) const
 
bool exists (MatchFlags flags=0) const
 
AddressMapTraits< AddressMap >::NodeIterator findNode (MatchFlags flags=0) const
 
template<typename Functor >
void traverse (Functor &functor, MatchFlags flags=0) const
 
void traverse (typename AddressMap::Visitor &visitor, MatchFlags flags=0) const
 
Sawyer::Container::Interval< Address > read (typename AddressMap::Value *buf, MatchFlags flags=0) const
 
Sawyer::Container::Interval< Address > read (std::vector< typename AddressMap::Value > &buf, MatchFlags flags=0) const
 
Sawyer::Container::Interval< Address > write (const typename AddressMap::Value *buf, MatchFlags flags=0) const
 
Sawyer::Container::Interval< Address > write (const std::vector< typename AddressMap::Value > &buf, MatchFlags flags=0)
 
void prune (MatchFlags flags=0) const
 
void keep (MatchFlags flags=0) const
 
void changeAccess (unsigned requiredAccess, unsigned prohibitedAccess, MatchFlags flags=0) const
 

Member Function Documentation

◆ require()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::require ( unsigned  bits) const
inline

Require certain access permissions.

See AddressMap::require.

Definition at line 243 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMapConstraints< AddressMap >::access(), and Sawyer::Container::AddressMap< A, T >::require().

Here is the caller graph for this function:

◆ prohibit()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::prohibit ( unsigned  bits) const
inline

Prohibit certain access permissions.

See AddressMap::prohibit.

Definition at line 250 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMapConstraints< AddressMap >::access(), Sawyer::Container::AddressMap< A, T >::prohibit(), and Sawyer::Container::AddressMap< A, T >::write().

Here is the caller graph for this function:

◆ access()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::access ( unsigned  bits) const
inline

Require and prohibit certain access permissions.

See AddressMap::access.

Definition at line 257 of file AddressMap.h.

References Sawyer::Container::AddressMapConstraints< AddressMap >::prohibit(), and Sawyer::Container::AddressMapConstraints< AddressMap >::require().

Referenced by Sawyer::Container::AddressMap< A, T >::access().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ substr() [1/2]

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::substr ( const std::string &  s) const
inline

Require certain segment names.

See AddressMap::substr.

Definition at line 262 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMap< A, T >::substr().

Here is the caller graph for this function:

◆ any()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::any ( ) const
inline

No constraints.

See AddressMap::any.

Definition at line 270 of file AddressMap.h.

◆ none()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::none ( ) const
inline

◆ at() [1/2]

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::at ( Address  x) const
inline

Anchor at a certain address.

See AddressMap::at.

Definition at line 282 of file AddressMap.h.

References Sawyer::Container::AddressMapConstraints< AddressMap >::none().

Referenced by Sawyer::Container::AddressMap< A, T >::at().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ at() [2/2]

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::at ( const Sawyer::Container::Interval< Address > &  x) const
inline

◆ limit() [1/2]

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::limit ( size_t  x) const
inline

◆ atOrAfter()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::atOrAfter ( Address  least) const
inline

◆ atOrBefore()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::atOrBefore ( Address  greatest) const
inline

◆ within() [1/2]

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::within ( const Sawyer::Container::Interval< Address > &  x) const
inline

◆ within() [2/2]

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::within ( Address  lo,
Address  hi 
) const
inline

Limit addresses.

See AddressMap::within.

Definition at line 334 of file AddressMap.h.

References Sawyer::Container::AddressMapConstraints< AddressMap >::none(), and Sawyer::Container::AddressMapConstraints< AddressMap >::within().

Here is the call graph for this function:

◆ baseSize()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::baseSize ( Address  base,
Address  size 
) const
inline

◆ after()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::after ( Address  x) const
inline

Limit addresses.

See AddressMap::after.

Definition at line 344 of file AddressMap.h.

References Sawyer::Container::AddressMapConstraints< AddressMap >::atOrAfter(), and Sawyer::Container::AddressMapConstraints< AddressMap >::none().

Referenced by Sawyer::Container::AddressMap< A, T >::after().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ before()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::before ( Address  x) const
inline

Limit addreses.

See AddressMap::before.

Definition at line 349 of file AddressMap.h.

References Sawyer::Container::AddressMapConstraints< AddressMap >::atOrBefore(), and Sawyer::Container::AddressMapConstraints< AddressMap >::none().

Referenced by Sawyer::Container::AddressMap< A, T >::before().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ singleSegment()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::singleSegment ( ) const
inline

Limit matching to single segment.

See AddressMap::singleSegment.

Definition at line 354 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMap< A, T >::singleSegment().

Here is the caller graph for this function:

◆ segmentPredicate()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::segmentPredicate ( SegmentPredicate< Address, Value > *  p) const
inline

Limit segments.

See AddressMap::segmentPredicate.

Definition at line 361 of file AddressMap.h.

References Sawyer::Container::AddressMapConstraints< AddressMap >::none().

Referenced by Sawyer::Container::AddressMap< A, T >::segmentPredicate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ substr() [2/2]

template<typename AddressMap >
const std::string& Sawyer::Container::AddressMapConstraints< AddressMap >::substr ( ) const
inline

Section name substring.

Returns the string that must be present as a substring in a section name.

Definition at line 389 of file AddressMap.h.

◆ neverMatches()

template<typename AddressMap >
bool Sawyer::Container::AddressMapConstraints< AddressMap >::neverMatches ( ) const
inline

Returns true if the constraint is not allowed to match anything.

This returns true if the none constraint is set, but it doesn't necessarily return true if a combination of other constraints results in something that cannot match.

Definition at line 396 of file AddressMap.h.

◆ anchored()

template<typename AddressMap >
AddressInterval Sawyer::Container::AddressMapConstraints< AddressMap >::anchored ( ) const
inline

Returns the anchor points.

Returns the anchor points as an interval, where the anchor(s) is an endpoint of the returned interval. For instance, if the at method was called, then anchored will return a singleton interval whose value was the at argument. The return value will be an empty interval if mutually exclusive anchors are set. This method should not be called without first calling isAnchored.

Definition at line 409 of file AddressMap.h.

References Sawyer::Container::AddressMapConstraints< AddressMap >::isAnchored().

Here is the call graph for this function:

◆ limit() [2/2]

template<typename AddressMap >
size_t Sawyer::Container::AddressMapConstraints< AddressMap >::limit ( ) const
inline

Size limit.

Returns the size limit or the maximum possible size_t value if not limit is in effect.

Definition at line 415 of file AddressMap.h.

◆ least()

template<typename AddressMap >
const Optional<Address>& Sawyer::Container::AddressMapConstraints< AddressMap >::least ( ) const
inline

Least possible address.

Returns the least possible address or nothing. The least address is in effect for the atOrAfter constraint.

Definition at line 421 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMapConstraints< AddressMap >::atOrAfter().

Here is the caller graph for this function:

◆ greatest()

template<typename AddressMap >
const Optional<Address>& Sawyer::Container::AddressMapConstraints< AddressMap >::greatest ( ) const
inline

Greatest possible address.

Returns the greatest possible address or nothing. The greatest address is in effect for the atOrBefore constraint.

Definition at line 427 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMapConstraints< AddressMap >::atOrBefore().

Here is the caller graph for this function:

◆ hasNonAddressConstraints()

template<typename AddressMap >
bool Sawyer::Container::AddressMapConstraints< AddressMap >::hasNonAddressConstraints ( ) const
inline

Determines whether non-address constraints are present.

The presence of non-address constraints requires iteration over matching addresses to find applicable regions of the address space.

Definition at line 448 of file AddressMap.h.

◆ addressConstraints()

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::addressConstraints ( ) const
inline

Construct new constraints from existing address constraints.

Constructs a new constraints object from an existing but using only the address constraints of the existing object and none of its non-address constraints.

Definition at line 456 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMap< A, T >::changeAccess(), Sawyer::Container::AddressMap< A, T >::keep(), and Sawyer::Container::AddressMap< A, T >::prune().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: