ROSE 0.11.145.147
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 76 of file AddressMap.h.

#include <Sawyer/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.
 
AddressMapConstraints prohibit (unsigned bits) const
 Prohibit certain access permissions.
 
AddressMapConstraints access (unsigned bits) const
 Require and prohibit certain access permissions.
 
AddressMapConstraints substr (const std::string &s) const
 Require certain segment names.
 
AddressMapConstraints any () const
 No constraints.
 
AddressMapConstraints none () const
 Constraints that match nothing.
 
AddressMapConstraints at (Address x) const
 Anchor at a certain address.
 
AddressMapConstraints at (const Sawyer::Container::Interval< Address > &x) const
 Anchor at a certain interval.
 
AddressMapConstraints limit (size_t x) const
 Limit matching length.
 
AddressMapConstraints atOrAfter (Address least) const
 Limit addresses.
 
AddressMapConstraints atOrBefore (Address greatest) const
 Limit addresses.
 
AddressMapConstraints within (const Sawyer::Container::Interval< Address > &x) const
 Limit addresses.
 
AddressMapConstraints within (Address lo, Address hi) const
 Limit addresses.
 
AddressMapConstraints baseSize (Address base, Address size) const
 Limit addresses.
 
AddressMapConstraints after (Address x) const
 Limit addresses.
 
AddressMapConstraints before (Address x) const
 Limit addreses.
 
AddressMapConstraints singleSegment () const
 Limit matching to single segment.
 
AddressMapConstraints segmentPredicate (SegmentPredicate< Address, Value > *p) const
 Limit segments.
 
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.
 
bool neverMatches () const
 Returns true if the constraint is not allowed to match anything.
 
bool isAnchored () const
 Determines whether constraints are anchored to an address.
 
AddressInterval anchored () const
 Returns the anchor points.
 
size_t limit () const
 Size limit.
 
const Optional< Address > & least () const
 Least possible address.
 
const Optional< Address > & greatest () const
 Greatest possible address.
 
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.
 
AddressMapConstraints addressConstraints () const
 Construct new constraints from existing address constraints.
 
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 Typedef Documentation

◆ Address

Definition at line 78 of file AddressMap.h.

◆ Value

Definition at line 79 of file AddressMap.h.

◆ AddressInterval

Definition at line 80 of file AddressMap.h.

Constructor & Destructor Documentation

◆ AddressMapConstraints()

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

Construct a constraint that matches everything.

Definition at line 97 of file AddressMap.h.

Member Function Documentation

◆ operator AddressMapConstraints< const AddressMap >()

Definition at line 129 of file AddressMap.h.

◆ print()

template<typename AddressMap >
void Sawyer::Container::AddressMapConstraints< AddressMap >::print ( std::ostream &  out) const
inline

◆ require()

◆ prohibit()

◆ access()

◆ substr() [1/2]

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

◆ any()

No constraints.

See AddressMap::any.

Definition at line 266 of file AddressMap.h.

◆ none()

◆ at() [1/2]

◆ at() [2/2]

◆ limit() [1/2]

◆ 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]

◆ within() [2/2]

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

◆ baseSize()

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

◆ after()

◆ before()

◆ singleSegment()

◆ segmentPredicate()

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

◆ segmentPredicates() [1/2]

template<typename AddressMap >
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::segmentPredicates ( const Callbacks< SegmentPredicate< Address, Value > * > &  predicates) const
inline

Definition at line 365 of file AddressMap.h.

◆ required()

Accessibility bits that are required to be set.

Definition at line 375 of file AddressMap.h.

◆ prohibited()

Accessibility bits that are required to be clear.

Definition at line 380 of file AddressMap.h.

◆ 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 385 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 392 of file AddressMap.h.

◆ isAnchored()

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

Determines whether constraints are anchored to an address.

Definition at line 397 of file AddressMap.h.

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

◆ anchored()

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 405 of file AddressMap.h.

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

◆ limit() [2/2]

Size limit.

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

Definition at line 411 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 417 of file AddressMap.h.

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

◆ 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 423 of file AddressMap.h.

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

◆ isSingleSegment()

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

Returns true if the single-segment constraint is set.

Definition at line 428 of file AddressMap.h.

◆ segmentPredicates() [2/2]

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

Returns the segment predicates.

Definition at line 433 of file AddressMap.h.

◆ map()

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

◆ 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 444 of file AddressMap.h.

◆ addressConstraints()

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 452 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().

◆ nodes()

template<typename AddressMap >
boost::iterator_range< typename AddressMapTraits< AddressMap >::NodeIterator > Sawyer::Container::AddressMapConstraints< AddressMap >::nodes ( MatchFlags  flags = 0) const
inline

Definition at line 465 of file AddressMap.h.

◆ segments()

template<typename AddressMap >
boost::iterator_range< typename AddressMapTraits< AddressMap >::SegmentIterator > Sawyer::Container::AddressMapConstraints< AddressMap >::segments ( MatchFlags  flags = 0) const
inline

Definition at line 470 of file AddressMap.h.

◆ next()

Definition at line 475 of file AddressMap.h.

◆ available()

template<typename AddressMap >
Sawyer::Container::Interval< Address > Sawyer::Container::AddressMapConstraints< AddressMap >::available ( MatchFlags  flags = 0) const
inline

Definition at line 480 of file AddressMap.h.

◆ exists()

template<typename AddressMap >
bool Sawyer::Container::AddressMapConstraints< AddressMap >::exists ( MatchFlags  flags = 0) const
inline

Definition at line 485 of file AddressMap.h.

◆ findNode()

template<typename AddressMap >
AddressMapTraits< AddressMap >::NodeIterator Sawyer::Container::AddressMapConstraints< AddressMap >::findNode ( MatchFlags  flags = 0) const
inline

Definition at line 490 of file AddressMap.h.

◆ traverse() [1/2]

template<typename AddressMap >
template<typename Functor >
void Sawyer::Container::AddressMapConstraints< AddressMap >::traverse ( Functor functor,
MatchFlags  flags = 0 
) const
inline

Definition at line 496 of file AddressMap.h.

◆ traverse() [2/2]

template<typename AddressMap >
void Sawyer::Container::AddressMapConstraints< AddressMap >::traverse ( typename AddressMap::Visitor visitor,
MatchFlags  flags = 0 
) const
inline

Definition at line 500 of file AddressMap.h.

◆ read() [1/2]

Definition at line 505 of file AddressMap.h.

◆ read() [2/2]

template<typename AddressMap >
Sawyer::Container::Interval< Address > Sawyer::Container::AddressMapConstraints< AddressMap >::read ( std::vector< typename AddressMap::Value > &  buf,
MatchFlags  flags = 0 
) const
inline

Definition at line 510 of file AddressMap.h.

◆ write() [1/2]

Definition at line 516 of file AddressMap.h.

◆ write() [2/2]

template<typename AddressMap >
Sawyer::Container::Interval< Address > Sawyer::Container::AddressMapConstraints< AddressMap >::write ( const std::vector< typename AddressMap::Value > &  buf,
MatchFlags  flags = 0 
)
inline

Definition at line 521 of file AddressMap.h.

◆ prune()

template<typename AddressMap >
void Sawyer::Container::AddressMapConstraints< AddressMap >::prune ( MatchFlags  flags = 0) const
inline

Definition at line 526 of file AddressMap.h.

◆ keep()

template<typename AddressMap >
void Sawyer::Container::AddressMapConstraints< AddressMap >::keep ( MatchFlags  flags = 0) const
inline

Definition at line 531 of file AddressMap.h.

◆ changeAccess()

template<typename AddressMap >
void Sawyer::Container::AddressMapConstraints< AddressMap >::changeAccess ( unsigned  requiredAccess,
unsigned  prohibitedAccess,
MatchFlags  flags = 0 
) const
inline

Definition at line 536 of file AddressMap.h.


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