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

Compares number of bits in register descriptors. More...

#include <Registers.h>

Public Types

enum  Direction {
  ASCENDING,
  DESCENDING
}
 

Public Member Functions

 SortBySize (Direction d=DESCENDING)
 
bool operator() (const RegisterDescriptor &a, const RegisterDescriptor &b) const
 

Protected Attributes

Direction direction
 

Detailed Description

Compares number of bits in register descriptors.

This comparator is used to sort register descriptors in either ascending or descending order depending on the number of significant bits in the register. The default constructor uses a descending sort order.

For instance, to get a list of all descriptors sorted by descending number of significant bits, one could do:

RegisterDescriptors regs = dictionary.get_descriptors();
std::sort(regs.begin(), regs.end(), SortBySize());

Definition at line 122 of file Registers.h.

Member Enumeration Documentation

Enumerator
ASCENDING 
DESCENDING 

Definition at line 124 of file Registers.h.

Constructor & Destructor Documentation

RegisterDictionary::SortBySize::SortBySize ( Direction  d = DESCENDING)
inlineexplicit

Definition at line 125 of file Registers.h.

Member Function Documentation

bool RegisterDictionary::SortBySize::operator() ( const RegisterDescriptor a,
const RegisterDescriptor b 
) const
inline

Definition at line 126 of file Registers.h.

References ASCENDING, direction, and RegisterDescriptor::get_nbits().

Member Data Documentation

Direction RegisterDictionary::SortBySize::direction
protected

Definition at line 132 of file Registers.h.

Referenced by operator()().


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