#include <map.h>
#include <ctree_map.h>
#include "map_ctree.h"
static int
map_ctree_check(PMEMobjpool *pop, TOID(struct map) map)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_check(pop, ctree_map);
}
static int
map_ctree_create(PMEMobjpool *pop, TOID(struct map) *map, void *arg)
{
TOID(struct ctree_map) *ctree_map =
(TOID(struct ctree_map) *)map;
return ctree_map_create(pop, ctree_map, arg);
}
static int
map_ctree_destroy(PMEMobjpool *pop, TOID(struct map) *map)
{
TOID(struct ctree_map) *ctree_map =
(TOID(struct ctree_map) *)map;
return ctree_map_destroy(pop, ctree_map);
}
static int
map_ctree_insert(PMEMobjpool *pop, TOID(struct map) map,
uint64_t key, PMEMoid value)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_insert(pop, ctree_map, key, value);
}
static int
map_ctree_insert_new(PMEMobjpool *pop, TOID(struct map) map,
uint64_t key, size_t size,
unsigned type_num,
void (*constructor)(PMEMobjpool *pop, void *ptr, void *arg),
void *arg)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_insert_new(pop, ctree_map, key, size,
type_num, constructor, arg);
}
static PMEMoid
map_ctree_remove(PMEMobjpool *pop, TOID(struct map) map, uint64_t key)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_remove(pop, ctree_map, key);
}
static int
map_ctree_remove_free(PMEMobjpool *pop, TOID(struct map) map, uint64_t key)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_remove_free(pop, ctree_map, key);
}
static int
map_ctree_clear(PMEMobjpool *pop, TOID(struct map) map)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_clear(pop, ctree_map);
}
static PMEMoid
map_ctree_get(PMEMobjpool *pop, TOID(struct map) map, uint64_t key)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_get(pop, ctree_map, key);
}
static int
map_ctree_lookup(PMEMobjpool *pop, TOID(struct map) map, uint64_t key)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_lookup(pop, ctree_map, key);
}
static int
map_ctree_foreach(PMEMobjpool *pop, TOID(struct map) map,
int (*cb)(uint64_t key, PMEMoid value, void *arg),
void *arg)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_foreach(pop, ctree_map, cb, arg);
}
static int
map_ctree_is_empty(PMEMobjpool *pop, TOID(struct map) map)
{
TOID(struct ctree_map) ctree_map;
TOID_ASSIGN(ctree_map, map.oid);
return ctree_map_is_empty(pop, ctree_map);
}
struct map_ops ctree_map_ops = {
map_ctree_check,
map_ctree_create,
map_ctree_destroy,
NULL,
map_ctree_insert,
map_ctree_insert_new,
map_ctree_remove,
map_ctree_remove_free,
map_ctree_clear,
map_ctree_get,
map_ctree_lookup,
map_ctree_foreach,
map_ctree_is_empty,
NULL,
NULL,
};