Jack Hansdampf / mbed-mqtt-GSOE1

Dependents:   ESP8266MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TestTree23.h Source File

TestTree23.h

00001 /**************************************************************************************
00002  * Copyright (c) 2016, Tomoaki Yamaguchi
00003  *
00004  * All rights reserved. This program and the accompanying materials
00005  * are made available under the terms of the Eclipse Public License v1.0
00006  * and Eclipse Distribution License v1.0 which accompany this distribution.
00007  *
00008  * The Eclipse Public License is available at
00009  *    http://www.eclipse.org/legal/epl-v10.html
00010  * and the Eclipse Distribution License is available at
00011  *   http://www.eclipse.org/org/documents/edl-v10.php.
00012  *
00013  * Contributors:
00014  *    Tomoaki Yamaguchi - initial API and implementation 
00015  **************************************************************************************/
00016 #ifndef MQTTSNGATEWAY_SRC_TESTS_TESTTREE23_H_
00017 #define MQTTSNGATEWAY_SRC_TESTS_TESTTREE23_H_
00018 
00019 #include "MQTTSNGWProcess.h"
00020 
00021 namespace MQTTSNGW
00022 {
00023 
00024 class Integer
00025 {
00026 public:
00027     int _val;
00028     Integer(){_val = 0;}
00029     Integer(int val){_val = val;}
00030 };
00031 
00032 class Key
00033 {
00034 public:
00035     string _key;
00036     Key(){};
00037     Key(string key){_key = key;}
00038     int compare(Key* obj){
00039         if ( _key == obj->_key )
00040         {
00041             return 0;
00042         }
00043         else if ( _key < obj->_key )
00044         {
00045             return -1;
00046         }
00047         else
00048         {
00049             return 1;
00050         }
00051     }
00052 };
00053 
00054 
00055 
00056 class TestTree23
00057 {
00058 public:
00059     TestTree23();
00060     ~TestTree23();
00061     void add(Key* key, Integer* val){_tree23.add(key, val);}
00062     Tree23Node<Key, Integer>* add(Tree23Node<Key, Integer>* n, Tree23Elm<Key, Integer>* elm){return _tree23.add(n, elm);}
00063     void remove(Key* k){_tree23.remove(k);}
00064     Tree23Node<Key, Integer>* remove(Tree23Node<Key, Integer>* node, Key* k){return _tree23.remove(node, k);}
00065     bool find(Key* key){return _tree23.find(key);}
00066     Integer* getVal(Key* key){return _tree23.getVal(key);}
00067     void test(void);
00068 private:
00069     Tree23<Key, Integer> _tree23;
00070 };
00071 
00072 }
00073 
00074 #endif /* MQTTSNGATEWAY_SRC_TESTS_TESTTREE23_H_ */