ROSE  0.11.145.0
Public Types | Public Member Functions | Friends | 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 79 of file AddressMap.h.

#include <util/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. More...
 
 operator AddressMapConstraints< const AddressMap > () const
 
void print (std::ostream &out) const
 Print constraints in a human readable form. More...
 
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. More...
 
unsigned prohibited () const
 Accessibility bits that are required to be clear. More...
 
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. More...
 
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. More...
 
const Callbacks< SegmentPredicate< Address, Value > * > segmentPredicates () const
 Returns the segment predicates. More...
 
AddressMapmap () const
 Returns a pointer to the memory map for this constraint object. More...
 
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
 

Friends

std::ostream & operator<< (std::ostream &out, const AddressMapConstraints &x)
 Print constraints in a human readable form. More...
 

Constructor & Destructor Documentation

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

Construct a constraint that matches everything.

Definition at line 100 of file AddressMap.h.

Member Function Documentation

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

Require certain access permissions.

See AddressMap::require.

Definition at line 242 of file AddressMap.h.

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

template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::prohibit ( unsigned  bits) const
inline
template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::access ( unsigned  bits) const
inline
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 261 of file AddressMap.h.

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

No constraints.

See AddressMap::any.

Definition at line 269 of file AddressMap.h.

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

Anchor at a certain address.

See AddressMap::at.

Definition at line 281 of file AddressMap.h.

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

template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::at ( const Sawyer::Container::Interval< Address > &  x) const
inline
template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::limit ( size_t  x) const
inline
template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::atOrAfter ( Address  least) const
inline
template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::atOrBefore ( Address  greatest) const
inline
template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::within ( const Sawyer::Container::Interval< Address > &  x) const
inline
template<typename AddressMap>
AddressMapConstraints Sawyer::Container::AddressMapConstraints< AddressMap >::within ( Address  lo,
Address  hi 
) const
inline

Limit addresses.

See AddressMap::within.

Definition at line 333 of file AddressMap.h.

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

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

Limit matching to single segment.

See AddressMap::singleSegment.

Definition at line 353 of file AddressMap.h.

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

Accessibility bits that are required to be set.

Definition at line 378 of file AddressMap.h.

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

Accessibility bits that are required to be clear.

Definition at line 383 of file AddressMap.h.

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

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

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

Determines whether constraints are anchored to an address.

Definition at line 400 of file AddressMap.h.

Referenced by Sawyer::Container::AddressMapConstraints< AddressMap >::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 408 of file AddressMap.h.

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

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

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

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

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

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

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

Returns true if the single-segment constraint is set.

Definition at line 431 of file AddressMap.h.

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

Returns the segment predicates.

Definition at line 436 of file AddressMap.h.

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

Returns a pointer to the memory map for this constraint object.

Definition at line 441 of file AddressMap.h.

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

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

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

Friends And Related Function Documentation

template<typename AddressMap>
std::ostream& operator<< ( std::ostream &  out,
const AddressMapConstraints< AddressMap > &  x 
)
friend

Print constraints in a human readable form.

Definition at line 233 of file AddressMap.h.


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