Where is function 'as_stringmap_init' of C API?


#1

Below are part example codes for function “as_record_set_map” in file as_record.h :

  • as_map map;
  • as_stringmap_init(&map);
  • as_stringmap_set_int64(&map, “a”, 1);
  • as_stringmap_set_int64(&map, “b”, 2);
  • as_stringmap_set_int64(&map, “c”, 3);

But i cannot find where “as_stringmap_init” defined (http://www.aerospike.com/apidocs/c/index.html).

Any idea? Thanks


#2

This is actually documentation mistake.

The comment/code should be:

as_hashmap map;
as_hashmap_init(&map, 32);
as_stringmap_set_int64(&map, "a", 1);
as_stringmap_set_int64(&map, "b", 2);
as_stringmap_set_int64(&map, "c", 3);

The as_stringmap_xxx functions are purely helper functions for easily inserting a hashmap entry that has string as a key, instead of needing to create as_val and go through the following API:

int as_hashmap_set(as_hashmap * map, const as_val * key, const as_val * val);

Thanks for pointing this out. We will make documentation correction.


#3

Thanks . It works with add a type cast : as_map *p_map = (as_map *)↦