ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExtentMap Class Reference

#include <Cxx_Grammar.h>

Inheritance diagram for ExtentMap:
Collaboration diagram for ExtentMap:

Public Member Functions

 ExtentMap ()
 
template<class Other >
 ExtentMap (const Other &other)
 
ExtentMap subtract_from (const Extent &e) const
 
void allocate_at (const Extent &request)
 Allocate the specified extent, which must be in the free list. More...
 
Extent allocate_best_fit (const rose_addr_t size)
 Allocate an extent of the specified size (best fit first) from the extent map, removing the returned extent from the map. More...
 
Extent allocate_first_fit (const rose_addr_t size)
 Allocate an extent of the specified size (first fit) from the extent map, removing the returned extent from the map. More...
 
void dump_extents (std::ostream &, const std::string &prefix="", const std::string &label="") const
 
void dump_extents (FILE *f, const char *prefix, const char *label, bool pad=true) const
 Print info about an extent map. More...
 
- Public Member Functions inherited from RangeMap< Extent >
 RangeMap ()
 Create a new, empty map. More...
 
 RangeMap (const Other &other)
 Create a new map from an existing map. More...
 
bool empty () const
 Returns true if this RangeMap is empty. More...
 
size_t nranges () const
 Returns the number of ranges in the range map. More...
 
Range::Value size () const
 Returns the number of values represented by this RangeMap. More...
 
Range::Value min () const
 Returns the minimum value in an extent map. More...
 
Range::Value max () const
 Returns the maximum value in an extent map. More...
 
Range minmax () const
 Returns the range of values in this map. More...
 
void clear (bool notify=true)
 Clears the map. More...
 
void erase (const Range &erase_range)
 Erases the specified range from this map. More...
 
void erase_ranges (const OtherMap &other)
 Erase ranges from this map. More...
 
iterator insert (Range new_range, Value new_value=Value(), bool make_hole=true)
 Insert a range/value pair into the map. More...
 
void insert_ranges (const RangeMap &x, bool make_hole=true)
 Insert one rangemap into another. More...
 
void insert_ranges (const_iterator start, const_iterator stop, bool make_hole=true)
 Insert part of one rangemap into another. More...
 
bool overlaps (const RangeMap &x) const
 Determines if two range maps overlap. More...
 
bool overlaps (const Range &r) const
 Determines if a range map overlaps with a specified range. More...
 
bool distinct (const Range &r) const
 Determines if a range map does not contain any part of the specified range. More...
 
bool distinct (const RangeMap &x) const
 Determines if two range maps are distinct. More...
 
bool contains (Range need) const
 Determines if this range map contains all of the specified range. More...
 
bool contains (const RangeMap &x) const
 Determins if this range map contains all of some other range map. More...
 
ResultMap invert () const
 Create an inverse of a range map. More...
 
ResultMap invert_within (const Range &limits) const
 Create a range map that's the inverse of some other map. More...
 
RangeMap select_overlapping_ranges (const Range &selector) const
 Select ranges overlapping selector range. More...
 
void check () const
 
void print (std::ostream &o) const
 Prints unformatted RangeMap on a single line. More...
 
iterator begin ()
 First-item iterator. More...
 
const_iterator begin () const
 First-item iterator. More...
 
iterator end ()
 End-item iterator. More...
 
const_iterator end () const
 End-item iterator. More...
 
reverse_iterator rbegin ()
 Returns a reverse iterator referring to the last item of the map, the rend() iterator if the RangeMap is empty. More...
 
const_reverse_iterator rbegin () const
 Returns a reverse iterator referring to the last item of the map, the rend() iterator if the RangeMap is empty. More...
 
reverse_iterator rend ()
 Returns a reverse iterator referring to the element right before the first element in the map, which is considered its reverse end. More...
 
const_reverse_iterator rend () const
 Returns a reverse iterator referring to the element right before the first element in the map, which is considered its reverse end. More...
 
iterator find (const typename Range::Value &addr)
 Find the range containing specified value. More...
 
const_iterator find (const typename Range::Value &addr) const
 Find the range containing specified value. More...
 
iterator lower_bound (const typename Range::Value &addr)
 Finds the first range ending above the specified value. More...
 
const_iterator lower_bound (const typename Range::Value &addr) const
 Finds the first range ending above the specified value. More...
 
iterator find_prior (const typename Range::Value &addr)
 Finds the last range starting at or below the specified value. More...
 
const_iterator find_prior (const typename Range::Value &addr) const
 Finds the last range starting at or below the specified value. More...
 
iterator best_fit (const typename Range::Value &size, iterator start)
 Find range with closest size. More...
 
const_iterator best_fit (const typename Range::Value &size, const_iterator start) const
 Find range with closest size. More...
 
iterator first_fit (const typename Range::Value &size, iterator start)
 Find first range of larger size. More...
 
const_iterator first_fit (const typename Range::Value &size, const_iterator start)
 Find first range of larger size. More...
 
iterator find_overlap (const RangeMap &x)
 Find the first overlap between two RangeMap objects. More...
 
const_iterator first_overlap (const RangeMap &x) const
 Find the first overlap between two RangeMap objects. More...
 
iterator find_overlap (iterator start, iterator stop, const RangeMap &x)
 Find an overlap between two RangeMap objects. More...
 
const_iterator find_overlap (const_iterator start, const_iterator stop, const RangeMap &x) const
 Find an overlap between two RangeMap objects. More...
 

Static Public Member Functions

static char category (const Extent &a, const Extent &b)
 Class method comparing two extents. More...
 

Additional Inherited Members

- Public Types inherited from RangeMap< Extent >
typedef Extent Range
 
typedef RangeMapVoid< ExtentValue
 A type having the Range interface, used as keys in the underlying std::map. More...
 
typedef Map::iterator iterator
 
typedef Map::const_iterator const_iterator
 
typedef Map::reverse_iterator reverse_iterator
 
typedef Map::const_reverse_iterator const_reverse_iterator
 
- Protected Types inherited from RangeMap< Extent >
typedef std::pair< Range, RangeRangePair
 
typedef std::pair< Range, ValueMapPair
 
typedef std::map< Range, Value,
RangeCompare > 
Map
 
- Protected Attributes inherited from RangeMap< Extent >
Map ranges
 

Detailed Description

Definition at line 6362 of file Cxx_Grammar.h.

Constructor & Destructor Documentation

ExtentMap::ExtentMap ( )
inline

Definition at line 6364 of file Cxx_Grammar.h.

template<class Other >
ExtentMap::ExtentMap ( const Other &  other)
inline

Definition at line 6365 of file Cxx_Grammar.h.

Member Function Documentation

char ExtentMap::category ( const Extent a,
const Extent b 
)
static

Class method comparing two extents.

The return value is one of the following letters, depending on how extent A is related to extent B: C (congruent): A and B are congruent L (left): A is left of B R (right): A is right of B O (outer): A contains B, but A and B are not congruent I (inner): A is contained by B, but A and B are not congruent B (beginning): A overlaps with the beginning of B but does not contain B E (ending): A overlaps with the end of B but does not contain B

Definition at line 18 of file ExtentMap.C.

References Range< T >::relaxed_first(), and Range< T >::size().

Referenced by SgAsmGenericFile::shift_extend().

void ExtentMap::allocate_at ( const Extent request)

Allocate the specified extent, which must be in the free list.

Definition at line 61 of file ExtentMap.C.

References RangeMap< Extent >::erase(), RangeMap< Extent >::size(), and subtract_from().

Referenced by SgAsmElfStrtab::allocate_overlap().

Extent ExtentMap::allocate_best_fit ( const rose_addr_t  size)

Allocate an extent of the specified size (best fit first) from the extent map, removing the returned extent from the map.

Definition at line 37 of file ExtentMap.C.

References RangeMap< Extent >::begin(), RangeMap< Extent >::best_fit(), RangeMap< Extent >::end(), RangeMap< Extent >::erase(), and RangeMap< Extent >::size().

Referenced by SgAsmGenericStrtab::reallocate().

Extent ExtentMap::allocate_first_fit ( const rose_addr_t  size)

Allocate an extent of the specified size (first fit) from the extent map, removing the returned extent from the map.

Definition at line 49 of file ExtentMap.C.

References RangeMap< Extent >::begin(), RangeMap< Extent >::end(), RangeMap< Extent >::erase(), RangeMap< Extent >::first_fit(), and RangeMap< Extent >::size().

void ExtentMap::dump_extents ( std::ostream &  o,
const std::string &  prefix = "",
const std::string &  label = "" 
) const
void ExtentMap::dump_extents ( FILE *  f,
const char *  prefix,
const char *  label,
bool  pad = true 
) const

Print info about an extent map.

This is a little different format than the ostream "<<" operator.

Definition at line 150 of file ExtentMap.C.

References RangeMap< Extent >::begin(), DUMP_FIELD_WIDTH, RangeMap< Extent >::end(), and max.


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