New upstream version 8.1.0
This commit is contained in:
24
client_module/source/common/toolkit/tree/IntMap.c
Normal file
24
client_module/source/common/toolkit/tree/IntMap.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <common/toolkit/tree/IntMap.h>
|
||||
#include <common/toolkit/tree/IntMapIter.h>
|
||||
|
||||
IntMapIter IntMap_find(IntMap* this, const int searchKey)
|
||||
{
|
||||
RBTreeElem* treeElem = _PointerRBTree_findElem(
|
||||
(RBTree*)this, (const void*)(const size_t)searchKey);
|
||||
|
||||
IntMapIter iter;
|
||||
IntMapIter_init(&iter, this, treeElem);
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
IntMapIter IntMap_begin(IntMap* this)
|
||||
{
|
||||
struct rb_node* node = rb_first(&this->rbTree.treeroot);
|
||||
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
|
||||
|
||||
IntMapIter iter;
|
||||
IntMapIter_init(&iter, this, treeElem);
|
||||
|
||||
return iter;
|
||||
}
|
||||
88
client_module/source/common/toolkit/tree/IntMap.h
Normal file
88
client_module/source/common/toolkit/tree/IntMap.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#ifndef INTMAP_H_
|
||||
#define INTMAP_H_
|
||||
|
||||
#include "PointerRBTree.h"
|
||||
#include "PointerRBTreeIter.h"
|
||||
|
||||
|
||||
/**
|
||||
* We assign the integer keys directly to the key pointers (i.e. no extra allocation involved,
|
||||
* but a lot of casting to convince gcc that we know what we're doing).
|
||||
* Values are just arbitrary pointers.
|
||||
*/
|
||||
|
||||
|
||||
struct IntMapElem;
|
||||
typedef struct IntMapElem IntMapElem;
|
||||
struct IntMap;
|
||||
typedef struct IntMap IntMap;
|
||||
|
||||
struct IntMapIter; // forward declaration of the iterator
|
||||
|
||||
static inline void IntMap_init(IntMap* this);
|
||||
static inline void IntMap_uninit(IntMap* this);
|
||||
|
||||
static inline bool IntMap_insert(IntMap* this, int newKey, char* newValue);
|
||||
static inline bool IntMap_erase(IntMap* this, const int eraseKey);
|
||||
static inline size_t IntMap_length(IntMap* this);
|
||||
|
||||
static inline void IntMap_clear(IntMap* this);
|
||||
|
||||
extern struct IntMapIter IntMap_find(IntMap* this, const int searchKey);
|
||||
extern struct IntMapIter IntMap_begin(IntMap* this);
|
||||
|
||||
|
||||
struct IntMapElem
|
||||
{
|
||||
RBTreeElem rbTreeElem;
|
||||
};
|
||||
|
||||
struct IntMap
|
||||
{
|
||||
RBTree rbTree;
|
||||
};
|
||||
|
||||
|
||||
void IntMap_init(IntMap* this)
|
||||
{
|
||||
PointerRBTree_init( (RBTree*)this, PointerRBTree_keyCompare);
|
||||
}
|
||||
|
||||
void IntMap_uninit(IntMap* this)
|
||||
{
|
||||
// (nothing alloc'ed by this sub map type => nothing special here to be free'd)
|
||||
|
||||
PointerRBTree_uninit( (RBTree*)this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param newValue just assigned, not copied.
|
||||
* @return true if element was inserted, false if key already existed (in which case
|
||||
* nothing is changed)
|
||||
*/
|
||||
bool IntMap_insert(IntMap* this, int newKey, char* newValue)
|
||||
{
|
||||
return PointerRBTree_insert( (RBTree*)this, (void*)(size_t)newKey, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false if no element with the given key existed
|
||||
*/
|
||||
bool IntMap_erase(IntMap* this, const int eraseKey)
|
||||
{
|
||||
return PointerRBTree_erase( (RBTree*)this, (const void*)(const size_t)eraseKey);
|
||||
}
|
||||
|
||||
size_t IntMap_length(IntMap* this)
|
||||
{
|
||||
return PointerRBTree_length( (RBTree*)this);
|
||||
}
|
||||
|
||||
|
||||
void IntMap_clear(IntMap* this)
|
||||
{
|
||||
PointerRBTree_clear(&this->rbTree);
|
||||
}
|
||||
|
||||
#endif /* INTMAP_H_ */
|
||||
45
client_module/source/common/toolkit/tree/IntMapIter.h
Normal file
45
client_module/source/common/toolkit/tree/IntMapIter.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef INTMAPITER_H_
|
||||
#define INTMAPITER_H_
|
||||
|
||||
#include "IntMap.h"
|
||||
|
||||
struct IntMapIter;
|
||||
typedef struct IntMapIter IntMapIter;
|
||||
|
||||
static inline void IntMapIter_init(IntMapIter* this, IntMap* map, RBTreeElem* treeElem);
|
||||
static inline char* IntMapIter_next(IntMapIter* this);
|
||||
static inline int IntMapIter_key(IntMapIter* this);
|
||||
static inline char* IntMapIter_value(IntMapIter* this);
|
||||
static inline bool IntMapIter_end(IntMapIter* this);
|
||||
|
||||
struct IntMapIter
|
||||
{
|
||||
RBTreeIter rbTreeIter;
|
||||
};
|
||||
|
||||
void IntMapIter_init(IntMapIter* this, IntMap* map, RBTreeElem* treeElem)
|
||||
{
|
||||
PointerRBTreeIter_init( (RBTreeIter*)this, (RBTree*)map, (RBTreeElem*)treeElem);
|
||||
}
|
||||
|
||||
char* IntMapIter_next(IntMapIter* this)
|
||||
{
|
||||
return (char*)PointerRBTreeIter_next( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
int IntMapIter_key(IntMapIter* this)
|
||||
{
|
||||
return (int)(size_t)PointerRBTreeIter_key( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
char* IntMapIter_value(IntMapIter* this)
|
||||
{
|
||||
return (char*)PointerRBTreeIter_value( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
bool IntMapIter_end(IntMapIter* this)
|
||||
{
|
||||
return PointerRBTreeIter_end( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
#endif /* INTMAPITER_H_ */
|
||||
24
client_module/source/common/toolkit/tree/PointerRBTree.c
Normal file
24
client_module/source/common/toolkit/tree/PointerRBTree.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <common/toolkit/tree/PointerRBTree.h>
|
||||
#include <common/toolkit/tree/PointerRBTreeIter.h>
|
||||
|
||||
|
||||
RBTreeIter PointerRBTree_find(RBTree* this, const void* searchKey)
|
||||
{
|
||||
RBTreeElem* treeElem = _PointerRBTree_findElem(this, searchKey);
|
||||
|
||||
RBTreeIter iter;
|
||||
PointerRBTreeIter_init(&iter, this, treeElem);
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
RBTreeIter PointerRBTree_begin(RBTree* this)
|
||||
{
|
||||
struct rb_node* node = rb_first(&this->treeroot);
|
||||
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
|
||||
|
||||
RBTreeIter iter;
|
||||
PointerRBTreeIter_init(&iter, this, treeElem);
|
||||
|
||||
return iter;
|
||||
}
|
||||
201
client_module/source/common/toolkit/tree/PointerRBTree.h
Normal file
201
client_module/source/common/toolkit/tree/PointerRBTree.h
Normal file
@@ -0,0 +1,201 @@
|
||||
#ifndef POINTERRBTREE_H_
|
||||
#define POINTERRBTREE_H_
|
||||
|
||||
#include <common/Common.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
|
||||
struct RBTreeElem;
|
||||
typedef struct RBTreeElem RBTreeElem;
|
||||
struct RBTree;
|
||||
typedef struct RBTree RBTree;
|
||||
|
||||
|
||||
/**
|
||||
* @return: <0 if key1<key2, 0 for equal keys, >0 otherwise
|
||||
*/
|
||||
typedef int (*TreeElemsComparator)(const void* key1, const void* key2);
|
||||
|
||||
|
||||
struct RBTreeIter; // forward declaration of the iterator
|
||||
|
||||
static inline void PointerRBTree_init(RBTree* this, TreeElemsComparator compareTreeElems);
|
||||
static inline void PointerRBTree_uninit(RBTree* this);
|
||||
|
||||
static inline RBTreeElem* _PointerRBTree_findElem(RBTree* this, const void* searchKey);
|
||||
|
||||
static inline bool PointerRBTree_insert(RBTree* this, void* newKey, void* newValue);
|
||||
static bool PointerRBTree_erase(RBTree* this, const void* eraseKey);
|
||||
static inline size_t PointerRBTree_length(RBTree* this);
|
||||
|
||||
static inline void PointerRBTree_clear(RBTree* this);
|
||||
|
||||
static inline int PointerRBTree_keyCompare(const void* a, const void* b);
|
||||
|
||||
extern struct RBTreeIter PointerRBTree_find(RBTree* this, const void* searchKey);
|
||||
extern struct RBTreeIter PointerRBTree_begin(RBTree* this);
|
||||
|
||||
struct RBTreeElem
|
||||
{
|
||||
struct rb_node treenode;
|
||||
|
||||
void* key;
|
||||
void* value;
|
||||
};
|
||||
|
||||
|
||||
struct RBTree
|
||||
{
|
||||
struct rb_root treeroot;
|
||||
|
||||
size_t length;
|
||||
|
||||
TreeElemsComparator compareTreeElems;
|
||||
};
|
||||
|
||||
|
||||
void PointerRBTree_init(RBTree* this, TreeElemsComparator compareTreeElems)
|
||||
{
|
||||
this->treeroot.rb_node = NULL;
|
||||
this->length = 0;
|
||||
|
||||
this->compareTreeElems = compareTreeElems;
|
||||
}
|
||||
|
||||
void PointerRBTree_uninit(RBTree* this)
|
||||
{
|
||||
PointerRBTree_clear(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return NULL if the element was not found
|
||||
*/
|
||||
RBTreeElem* _PointerRBTree_findElem(RBTree* this, const void* searchKey)
|
||||
{
|
||||
int compRes;
|
||||
|
||||
struct rb_node* node = this->treeroot.rb_node;
|
||||
|
||||
while(node)
|
||||
{
|
||||
RBTreeElem* treeElem = container_of(node, RBTreeElem, treenode);
|
||||
|
||||
compRes = this->compareTreeElems(searchKey, treeElem->key);
|
||||
|
||||
if(compRes < 0)
|
||||
node = node->rb_left;
|
||||
else
|
||||
if(compRes > 0)
|
||||
node = node->rb_right;
|
||||
else
|
||||
{ // element found => return it
|
||||
return treeElem;
|
||||
}
|
||||
}
|
||||
|
||||
// element not found
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return true if element was inserted, false if it already existed (in which case
|
||||
* nothing is changed) or if out of mem.
|
||||
*/
|
||||
bool PointerRBTree_insert(RBTree* this, void* newKey, void* newValue)
|
||||
{
|
||||
RBTreeElem* newElem;
|
||||
|
||||
// the parent's (left or right) link to which the child will be connected
|
||||
struct rb_node** link = &this->treeroot.rb_node;
|
||||
// the parent of the new node
|
||||
struct rb_node* parent = NULL;
|
||||
|
||||
while(*link)
|
||||
{
|
||||
int compRes;
|
||||
RBTreeElem* treeElem;
|
||||
|
||||
parent = *link;
|
||||
treeElem = container_of(parent, RBTreeElem, treenode);
|
||||
|
||||
compRes = this->compareTreeElems(newKey, treeElem->key);
|
||||
|
||||
if(compRes < 0)
|
||||
link = &(*link)->rb_left;
|
||||
else
|
||||
if(compRes > 0)
|
||||
link = &(*link)->rb_right;
|
||||
else
|
||||
{ // target already exists => do nothing (according to the behavior of c++ map::insert)
|
||||
//rbReplaceNode(parent, newElem, this);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// create new element
|
||||
|
||||
newElem = os_kmalloc(sizeof(*newElem) );
|
||||
newElem->key = newKey;
|
||||
newElem->value = newValue;
|
||||
|
||||
// link the new element
|
||||
rb_link_node(&newElem->treenode, parent, link);
|
||||
rb_insert_color(&newElem->treenode, &this->treeroot);
|
||||
|
||||
this->length++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false if no element with the given key existed
|
||||
*/
|
||||
bool PointerRBTree_erase(RBTree* this, const void* eraseKey)
|
||||
{
|
||||
RBTreeElem* treeElem;
|
||||
|
||||
treeElem = _PointerRBTree_findElem(this, eraseKey);
|
||||
if(!treeElem)
|
||||
{ // element not found
|
||||
return false;
|
||||
}
|
||||
|
||||
// unlink the element
|
||||
rb_erase(&treeElem->treenode, &this->treeroot);
|
||||
|
||||
kfree(treeElem);
|
||||
|
||||
this->length--;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t PointerRBTree_length(RBTree* this)
|
||||
{
|
||||
return this->length;
|
||||
}
|
||||
|
||||
void PointerRBTree_clear(RBTree* this)
|
||||
{
|
||||
while(this->length)
|
||||
{
|
||||
RBTreeElem* root = container_of(this->treeroot.rb_node, RBTreeElem, treenode);
|
||||
PointerRBTree_erase(this, root->key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PointerRBTree_keyCompare(const void* a, const void* b)
|
||||
{
|
||||
if (a < b)
|
||||
return -1;
|
||||
if (a == b)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /*POINTERRBTREE_H_*/
|
||||
57
client_module/source/common/toolkit/tree/PointerRBTreeIter.h
Normal file
57
client_module/source/common/toolkit/tree/PointerRBTreeIter.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef POINTERRBTREEITER_H_
|
||||
#define POINTERRBTREEITER_H_
|
||||
|
||||
#include "PointerRBTree.h"
|
||||
|
||||
struct RBTreeIter;
|
||||
typedef struct RBTreeIter RBTreeIter;
|
||||
|
||||
static inline void PointerRBTreeIter_init(
|
||||
RBTreeIter* this, RBTree* tree, RBTreeElem* treeElem);
|
||||
|
||||
static inline void* PointerRBTreeIter_next(RBTreeIter* this);
|
||||
static inline void* PointerRBTreeIter_key(RBTreeIter* this);
|
||||
static inline void* PointerRBTreeIter_value(RBTreeIter* this);
|
||||
static inline bool PointerRBTreeIter_end(RBTreeIter* this);
|
||||
|
||||
struct RBTreeIter
|
||||
{
|
||||
RBTree* tree;
|
||||
RBTreeElem* treeElem;
|
||||
};
|
||||
|
||||
|
||||
void PointerRBTreeIter_init(RBTreeIter* this, RBTree* tree, RBTreeElem* treeElem)
|
||||
{
|
||||
this->tree = tree;
|
||||
this->treeElem = treeElem;
|
||||
}
|
||||
|
||||
void* PointerRBTreeIter_next(RBTreeIter* this)
|
||||
{
|
||||
struct rb_node* next = rb_next(&this->treeElem->treenode);
|
||||
|
||||
this->treeElem = next ? container_of(next, RBTreeElem, treenode) : NULL;
|
||||
|
||||
return this->treeElem;
|
||||
}
|
||||
|
||||
void* PointerRBTreeIter_key(RBTreeIter* this)
|
||||
{
|
||||
return this->treeElem->key;
|
||||
}
|
||||
|
||||
void* PointerRBTreeIter_value(RBTreeIter* this)
|
||||
{
|
||||
return this->treeElem->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the end of the iterator was reached
|
||||
*/
|
||||
bool PointerRBTreeIter_end(RBTreeIter* this)
|
||||
{
|
||||
return (this->treeElem == NULL);
|
||||
}
|
||||
|
||||
#endif /*POINTERRBTREEITER_H_*/
|
||||
30
client_module/source/common/toolkit/tree/StrCpyMap.c
Normal file
30
client_module/source/common/toolkit/tree/StrCpyMap.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "StrCpyMap.h"
|
||||
#include "StrCpyMapIter.h"
|
||||
|
||||
StrCpyMapIter StrCpyMap_find(StrCpyMap* this, const char* searchKey)
|
||||
{
|
||||
RBTreeElem* treeElem = _PointerRBTree_findElem( (RBTree*)this, searchKey);
|
||||
|
||||
StrCpyMapIter iter;
|
||||
StrCpyMapIter_init(&iter, this, treeElem);
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
StrCpyMapIter StrCpyMap_begin(StrCpyMap* this)
|
||||
{
|
||||
struct rb_node* node = rb_first(&this->rbTree.treeroot);
|
||||
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
|
||||
|
||||
StrCpyMapIter iter;
|
||||
StrCpyMapIter_init(&iter, this, treeElem);
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
int compareStrCpyMapElems(const void* key1, const void* key2)
|
||||
{
|
||||
return strcmp(key1, key2);
|
||||
}
|
||||
|
||||
131
client_module/source/common/toolkit/tree/StrCpyMap.h
Normal file
131
client_module/source/common/toolkit/tree/StrCpyMap.h
Normal file
@@ -0,0 +1,131 @@
|
||||
#ifndef STRCPYMAP_H_
|
||||
#define STRCPYMAP_H_
|
||||
|
||||
#include <common/toolkit/tree/PointerRBTree.h>
|
||||
#include <common/toolkit/tree/PointerRBTreeIter.h>
|
||||
|
||||
struct StrCpyMapElem;
|
||||
typedef struct StrCpyMapElem StrCpyMapElem;
|
||||
struct StrCpyMap;
|
||||
typedef struct StrCpyMap StrCpyMap;
|
||||
|
||||
struct StrCpyMapIter; // forward declaration of the iterator
|
||||
|
||||
static inline void StrCpyMap_init(StrCpyMap* this);
|
||||
static inline void StrCpyMap_uninit(StrCpyMap* this);
|
||||
|
||||
static inline bool StrCpyMap_insert(StrCpyMap* this, const char* newKey,
|
||||
const char* newValue);
|
||||
static inline bool StrCpyMap_erase(StrCpyMap* this, const char* eraseKey);
|
||||
static inline size_t StrCpyMap_length(StrCpyMap* this);
|
||||
|
||||
static inline void StrCpyMap_clear(StrCpyMap* this);
|
||||
|
||||
extern struct StrCpyMapIter StrCpyMap_find(StrCpyMap* this, const char* searchKey);
|
||||
extern struct StrCpyMapIter StrCpyMap_begin(StrCpyMap* this);
|
||||
|
||||
extern int compareStrCpyMapElems(const void* key1, const void* key2);
|
||||
|
||||
|
||||
struct StrCpyMapElem
|
||||
{
|
||||
RBTreeElem rbTreeElem;
|
||||
};
|
||||
|
||||
struct StrCpyMap
|
||||
{
|
||||
RBTree rbTree;
|
||||
};
|
||||
|
||||
|
||||
void StrCpyMap_init(StrCpyMap* this)
|
||||
{
|
||||
PointerRBTree_init( (RBTree*)this, compareStrCpyMapElems);
|
||||
}
|
||||
|
||||
void StrCpyMap_uninit(StrCpyMap* this)
|
||||
{
|
||||
StrCpyMap_clear(this);
|
||||
|
||||
PointerRBTree_uninit( (RBTree*)this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return true if element was inserted, false if key already existed (in which case
|
||||
* nothing is changed)
|
||||
*/
|
||||
bool StrCpyMap_insert(StrCpyMap* this, const char* newKey, const char* newValue)
|
||||
{
|
||||
size_t keyLen;
|
||||
char* keyCopy;
|
||||
size_t valueLen;
|
||||
char* valueCopy;
|
||||
bool insRes;
|
||||
|
||||
// copy key
|
||||
keyLen = strlen(newKey)+1;
|
||||
keyCopy = (char*)os_kmalloc(keyLen);
|
||||
memcpy(keyCopy, newKey, keyLen);
|
||||
|
||||
// copy value
|
||||
valueLen = strlen(newValue)+1;
|
||||
valueCopy = (char*)os_kmalloc(valueLen);
|
||||
memcpy(valueCopy, newValue, valueLen);
|
||||
|
||||
insRes = PointerRBTree_insert( (RBTree*)this, keyCopy, valueCopy);
|
||||
if(!insRes)
|
||||
{
|
||||
// not inserted because the key already existed => free up the copies
|
||||
kfree(keyCopy);
|
||||
kfree(valueCopy);
|
||||
}
|
||||
|
||||
return insRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false if no element with the given key existed
|
||||
*/
|
||||
bool StrCpyMap_erase(StrCpyMap* this, const char* eraseKey)
|
||||
{
|
||||
bool eraseRes;
|
||||
void* elemKey;
|
||||
void* elemValue;
|
||||
|
||||
RBTreeElem* treeElem = _PointerRBTree_findElem( (RBTree*)this, eraseKey);
|
||||
if(!treeElem)
|
||||
{ // element not found
|
||||
return false;
|
||||
}
|
||||
|
||||
elemKey = treeElem->key;
|
||||
elemValue = treeElem->value;
|
||||
|
||||
eraseRes = PointerRBTree_erase( (RBTree*)this, eraseKey);
|
||||
if(eraseRes)
|
||||
{ // treeElem has been erased
|
||||
kfree(elemKey);
|
||||
kfree(elemValue);
|
||||
}
|
||||
|
||||
return eraseRes;
|
||||
}
|
||||
|
||||
size_t StrCpyMap_length(StrCpyMap* this)
|
||||
{
|
||||
return PointerRBTree_length( (RBTree*)this);
|
||||
}
|
||||
|
||||
|
||||
void StrCpyMap_clear(StrCpyMap* this)
|
||||
{
|
||||
while(this->rbTree.length)
|
||||
{
|
||||
RBTreeElem* root = container_of(this->rbTree.treeroot.rb_node, RBTreeElem, treenode);
|
||||
StrCpyMap_erase(this, root->key);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*STRCPYMAP_H_*/
|
||||
45
client_module/source/common/toolkit/tree/StrCpyMapIter.h
Normal file
45
client_module/source/common/toolkit/tree/StrCpyMapIter.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef STRCPYMAPITER_H_
|
||||
#define STRCPYMAPITER_H_
|
||||
|
||||
#include "StrCpyMap.h"
|
||||
|
||||
struct StrCpyMapIter;
|
||||
typedef struct StrCpyMapIter StrCpyMapIter;
|
||||
|
||||
static inline void StrCpyMapIter_init(StrCpyMapIter* this, StrCpyMap* map, RBTreeElem* treeElem);
|
||||
static inline char* StrCpyMapIter_next(StrCpyMapIter* this);
|
||||
static inline char* StrCpyMapIter_key(StrCpyMapIter* this);
|
||||
static inline char* StrCpyMapIter_value(StrCpyMapIter* this);
|
||||
static inline bool StrCpyMapIter_end(StrCpyMapIter* this);
|
||||
|
||||
struct StrCpyMapIter
|
||||
{
|
||||
RBTreeIter rbTreeIter;
|
||||
};
|
||||
|
||||
void StrCpyMapIter_init(StrCpyMapIter* this, StrCpyMap* map, RBTreeElem* treeElem)
|
||||
{
|
||||
PointerRBTreeIter_init( (RBTreeIter*)this, (RBTree*)map, (RBTreeElem*)treeElem);
|
||||
}
|
||||
|
||||
char* StrCpyMapIter_next(StrCpyMapIter* this)
|
||||
{
|
||||
return (char*)PointerRBTreeIter_next( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
char* StrCpyMapIter_key(StrCpyMapIter* this)
|
||||
{
|
||||
return (char*)PointerRBTreeIter_key( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
char* StrCpyMapIter_value(StrCpyMapIter* this)
|
||||
{
|
||||
return (char*)PointerRBTreeIter_value( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
bool StrCpyMapIter_end(StrCpyMapIter* this)
|
||||
{
|
||||
return PointerRBTreeIter_end( (RBTreeIter*)this);
|
||||
}
|
||||
|
||||
#endif /*STRCPYMAPITER_H_*/
|
||||
Reference in New Issue
Block a user