ROSE  0.11.96.11
Public Types | Public Member Functions | List of all members
RangeMapVoid< R > Class Template Reference

Description

template<class R>
class RangeMapVoid< R >

Value type for a RangeMap with no useful data attached to the ranges.

This also serves as an example documenting the interface for the operations a RangeMap can perform on its values. The single template parameter is the Range type.

Definition at line 548 of file rangemap.h.

#include <rangemap.h>

Public Types

typedef R Range
 

Public Member Functions

template<class Other >
 RangeMapVoid (const Other &)
 
void removing (const Range &my_range)
 Remove a value from a RangeMap. More...
 
void truncate (const Range &my_range, const typename Range::Value &new_end)
 Truncate the RangeMap value. More...
 
bool merge (const Range &, const Range &, const RangeMapVoid &)
 Attempts to merge the specified range into this range. More...
 
RangeMapVoid split (const Range &my_range, const typename Range::Value &new_end)
 Split a value into two parts. More...
 
void print (std::ostream &o) const
 

Member Function Documentation

◆ removing()

template<class R >
void RangeMapVoid< R >::removing ( const Range my_range)
inline

Remove a value from a RangeMap.

This method is invoked by RangeMap when it is removing a value from the map, such as during an erase() or clear() operation. It is not called for the merge() argument after a successful merge.

Definition at line 561 of file rangemap.h.

◆ truncate()

template<class R >
void RangeMapVoid< R >::truncate ( const Range my_range,
const typename Range::Value &  new_end 
)
inline

Truncate the RangeMap value.

This is similar to the removing() method, but only discards part of the value. The new_end argument is the first value past the end of this range and must be such that the range would not become larger.

Definition at line 568 of file rangemap.h.

◆ merge()

template<class R >
bool RangeMapVoid< R >::merge ( const Range ,
const Range ,
const RangeMapVoid< R > &   
)
inline

Attempts to merge the specified range into this range.

The specified range must adjoin this range (on the left or right) but not overlap with this range. The my_range argument is the range associated with this value and the other_range argument is the adjoining range for the value to be merged into this one. The third argument is the value to be merged into this one.

Merging is optional. If two values cannot be merged then they will be represented as distinct elements in the RangeMap. However, merging can significantly reduce the size of large RangeMap objects.

If a merge occurs, then the removing() method of other_value is not invoked, but other_value will nonetheless be removed from the memory map. Therefore, if its removing() method needs to do anything it should be called explicitly. It must be done this way in order to allow the merge operation the possibility doing something more efficient than copying and then deleting other_value.

Returns true if merging occurred, false otherwise.

Definition at line 586 of file rangemap.h.

◆ split()

template<class R >
RangeMapVoid RangeMapVoid< R >::split ( const Range my_range,
const typename Range::Value &  new_end 
)
inline

Split a value into two parts.

This is the inverse of the merge() operation. In effect, it truncates this value so it ends at new_end (exclusive), but rather than discarding the right part, it returns it as a new value. The new_end must be inside my_range so that neither the modified nor returned ranges are empty. The my_range argument is the value's range before it is split.

Definition at line 594 of file rangemap.h.


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