Mike Dodd | 8cfa702 | 2010-11-17 11:12:26 -0800 | [diff] [blame] | 1 | /** |
| 2 | * @file symbol_functors.h |
| 3 | * Functors for symbol/sample comparison |
| 4 | * |
| 5 | * @remark Copyright 2002, 2003 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author Philippe Elie |
| 9 | * @author John Levon |
| 10 | */ |
| 11 | |
| 12 | #ifndef SYMBOL_FUNCTORS_H |
| 13 | #define SYMBOL_FUNCTORS_H |
| 14 | |
| 15 | #include "symbol.h" |
| 16 | |
| 17 | /// compare based on file location |
| 18 | struct less_by_file_loc { |
| 19 | bool operator()(sample_entry const * lhs, |
| 20 | sample_entry const * rhs) const { |
| 21 | return lhs->file_loc < rhs->file_loc; |
| 22 | } |
| 23 | |
| 24 | bool operator()(symbol_entry const * lhs, |
| 25 | symbol_entry const * rhs) const { |
| 26 | return lhs->sample.file_loc < rhs->sample.file_loc; |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | |
| 31 | /// compare based on symbol contents |
| 32 | struct less_symbol { |
| 33 | // implementation compare by id rather than by string |
| 34 | bool operator()(symbol_entry const & lhs, |
| 35 | symbol_entry const & rhs) const; |
| 36 | }; |
| 37 | |
| 38 | #endif /* SYMBOL_FUNCTORS_H */ |