76 typedef typename base_t::reverse_iterator reverse_iterator; |
76 typedef typename base_t::reverse_iterator reverse_iterator; |
77 typedef typename base_t::const_reverse_iterator const_reverse_iterator; |
77 typedef typename base_t::const_reverse_iterator const_reverse_iterator; |
78 |
78 |
79 private: |
79 private: |
80 void reset(void); /* clear all entries... */ |
80 void reset(void); /* clear all entries... */ |
|
81 const char *symbol_to_string(const symbol_c *symbol); |
81 |
82 |
82 public: |
83 public: |
83 dsymtable_c(void) {}; |
84 dsymtable_c(void) {}; |
84 |
85 |
85 void insert(const char *identifier_str, value_t value); |
86 void insert(const char *identifier_str, value_t value); |
86 void insert(const symbol_c *symbol, value_t value); |
87 void insert(const symbol_c *symbol, value_t value); |
87 |
88 |
|
89 /* Determine how many entries are associated to key identifier_str */ |
|
90 /* returns: |
|
91 * 0: if no entry is found |
|
92 * 1: if 1 entry is found |
|
93 * 2: if more than 1 entry is found |
|
94 */ |
|
95 int multiplicity(const char *identifier_str); |
|
96 int multiplicity(const symbol_c *symbol) {return multiplicity(symbol_to_string(symbol));} |
|
97 |
88 /* Search for an entry. Will return end_value() if not found */ |
98 /* Search for an entry. Will return end_value() if not found */ |
89 value_t end_value(void) {return null_value;} |
99 value_t end_value(void) {return null_value;} |
90 value_t find_value(const char *identifier_str); |
100 value_t find_value(const char *identifier_str); |
91 value_t find_value(const symbol_c *symbol); |
101 value_t find_value(const symbol_c *symbol) {return find_value(symbol_to_string(symbol));} |
92 |
102 |
93 iterator find(const char *identifier_str) {return _base.find(identifier_str);} |
103 /* Search for an entry associated with identifier_str. Will return end() if not found */ |
|
104 iterator find(const char *identifier_str) {return _base.find(identifier_str);} |
|
105 iterator find(const symbol_c *symbol) {return find(symbol_to_string(symbol));} |
|
106 |
|
107 /* Search for the first entry associated with (i.e. with key ==) identifier_str. Will return end() if not found */ |
|
108 /* Basically, the same as find() */ |
|
109 iterator lower_bound(const char *identifier_str) {return _base.lower_bound(identifier_str);} |
|
110 iterator lower_bound(const symbol_c *symbol) {return lower_bound(symbol_to_string(symbol));} |
|
111 |
|
112 /* Search for the first entry with key greater than identifier_str. Will return end() if not found */ |
|
113 iterator upper_bound(const char *identifier_str) {return _base.upper_bound(identifier_str);} |
|
114 iterator upper_bound(const symbol_c *symbol) {return upper_bound(symbol_to_string(symbol));} |
|
115 |
|
116 /* get the value to which an iterator is pointing to... */ |
|
117 value_t get_value(const iterator i) {return i->second;} |
94 |
118 |
95 /* iterators pointing to beg/end of map... */ |
119 /* iterators pointing to beg/end of map... */ |
96 iterator begin() {return _base.begin();} |
120 iterator begin() {return _base.begin();} |
97 const_iterator begin() const {return _base.begin();} |
121 const_iterator begin() const {return _base.begin();} |
98 iterator end() {return _base.end();} |
122 iterator end() {return _base.end();} |