4 #include <rudiments/stdio.h> 5 #include <rudiments/private/rudimentsinlines.h> 6 #include <rudiments/private/linkedlistutilinlines.h> 8 #define DICTIONARY_TEMPLATE \ 9 template <class keytype, class valuetype> 11 #define DICTIONARY_CLASS \ 12 dictionary<keytype,valuetype> 15 RUDIMENTS_TEMPLATE_INLINE
16 DICTIONARY_CLASS::dictionary() {
20 RUDIMENTS_TEMPLATE_INLINE
21 DICTIONARY_CLASS::~dictionary() {
26 RUDIMENTS_TEMPLATE_INLINE
27 void DICTIONARY_CLASS::setValue(keytype key, valuetype value) {
37 RUDIMENTS_TEMPLATE_INLINE
38 bool DICTIONARY_CLASS::getValue(keytype key, valuetype *value) {
48 RUDIMENTS_TEMPLATE_INLINE
49 valuetype DICTIONARY_CLASS::getValue(keytype key) {
58 RUDIMENTS_TEMPLATE_INLINE
68 RUDIMENTS_TEMPLATE_INLINE
69 bool DICTIONARY_CLASS::remove(keytype key) {
72 return dict.remove(node);
78 RUDIMENTS_TEMPLATE_INLINE
91 RUDIMENTS_TEMPLATE_INLINE
95 dict.getFirst(); node; node=node->
getNext()) {
96 if (!node->
getValue()->compare(key)) {
104 RUDIMENTS_TEMPLATE_INLINE
108 dict.getFirst(); node; node=node->
getNext()) {
115 RUDIMENTS_TEMPLATE_INLINE
121 RUDIMENTS_TEMPLATE_INLINE
122 void DICTIONARY_CLASS::clear() {
124 dict.getFirst(); node; node=node->
getNext()) {
131 RUDIMENTS_TEMPLATE_INLINE
132 void DICTIONARY_CLASS::print() {
134 dict.getFirst(); node; node=node->
getNext()) {
140 #define DICTIONARYNODE_TEMPLATE \ 141 template <class keytype, class valuetype> 143 #define DICTIONARYNODE_CLASS \ 144 dictionarynode<keytype,valuetype> 146 DICTIONARYNODE_TEMPLATE
147 RUDIMENTS_TEMPLATE_INLINE
148 DICTIONARYNODE_CLASS::dictionarynode(keytype key, valuetype value) {
153 DICTIONARYNODE_TEMPLATE
154 RUDIMENTS_TEMPLATE_INLINE
155 DICTIONARYNODE_CLASS::~dictionarynode() {}
157 DICTIONARYNODE_TEMPLATE
158 RUDIMENTS_TEMPLATE_INLINE
159 void DICTIONARYNODE_CLASS::setKey(keytype key) {
163 DICTIONARYNODE_TEMPLATE
164 RUDIMENTS_TEMPLATE_INLINE
165 void DICTIONARYNODE_CLASS::setValue(valuetype value) {
169 DICTIONARYNODE_TEMPLATE
170 RUDIMENTS_TEMPLATE_INLINE
171 keytype DICTIONARYNODE_CLASS::getKey()
const {
175 DICTIONARYNODE_TEMPLATE
176 RUDIMENTS_TEMPLATE_INLINE
177 valuetype DICTIONARYNODE_CLASS::getValue()
const {
181 DICTIONARYNODE_TEMPLATE
182 RUDIMENTS_TEMPLATE_INLINE
183 int32_t DICTIONARYNODE_CLASS::compare(keytype testkey)
const {
184 return _linkedlistutil_compare(key,testkey);
187 DICTIONARYNODE_TEMPLATE
188 RUDIMENTS_TEMPLATE_INLINE
189 void DICTIONARYNODE_CLASS::print()
const {
190 _linkedlistutil_print(key);
192 _linkedlistutil_print(value);
size_t printf(const char *format,...)
Definition: linkedlist.h:60
valuetype getValue() const
Definition: dictionary.h:12
void append(valuetype value)
Definition: linkedlist.h:11
linkedlistnode< valuetype > * getNext()