CInt64Map

Overview

Module that defines the CInt64Map and the associated functions.

Example
#include "clingo/container/CInt64Map.h"
#include "clingo/io/print.h"
#include "clingo/lang/expect.h"

void print_info( cMapInfo const* info )
{
   pjotln_c_( lfjds, 1024,
              "empty: ", map_is_empty_c( info ), " / ",
              "cap: ", map_cap_c( info ), " / ",
              "load: ", map_load_c( info ), " / ",
              "max load: ", info->maxLoad );
}

void print_map( CInt64Map const* map )
{
   int64_t const* key;
   int64_t const* val;
   iterate_map_c_( itr, key, val, map, next_in_int64_map_c )
   {
      cRecorder* rec = &recorder_c_( 128 );
      write_c_( rec, "({i64}/{i64}/{i64}) ", itr, *key, *val );
      print_recorded_c( rec );
   }
   printf( "\n" );
}

int main( void )
{
   init_tap_c_();

   CInt64Map* map = retain_c( make_int64_map_c( 4, 0.5f ) );
   cMapInfo const* info = info_of_int64_map_c( map );
   print_info( info );
   {
      set_on_int64_map_c( map, 123, 1 );
      set_on_int64_map_c( map, 314434, 2 );
      set_on_int64_map_c( map, -3424, 41234 );
      set_on_int64_map_c( map, 1234, 4636 );
      set_on_int64_map_c( map, 3245245, 32566234 );
      set_on_int64_map_c( map, 123, 2 );
   }
   print_info( info_of_int64_map_c( map ) );

   print_map( map );
   require_c_( remove_from_int64_map_c( map, 123 ) );
   print_map( map );

   release_c( map );

   return finish_tap_c_();
}

Types and Definitions

Generated

CInt64Map

struct CInt64Map;
typedef struct CInt64Map CInt64Map;

Via the macros VAL_VAL_MAP_DEF_C_ and VAL_VAL_MAP_IMPL_C_ declared and implemented struct. The macros declare and implement also the following globals and functions.

cMeta const C_Int64MapMeta;
/* create */
CInt64Map* make_int64_map_c( int64_t size, float maxLoad );
CInt64Map* new_int64_map_c();
/* manage */
cMapInfo const* info_of_int64_map_c( CInt64Map const* map );
bool resize_int64_map_c( CInt64Map* map, int64_t cap );
bool set_max_load_of_int64_map_c( CInt64Map* map, float maxLoad );
/* iterate */
cMapItr next_in_int64_map_c( CInt64Map const* map,
                             cMapItr itr,
                             int64_t const* key[static 1],
                             int64_t const* val[static 1 ]);
cMapItr next_var_in_int64_map_c( CInt64Map* map,
                                 cMapItr itr,
                                 int64_t const* key[static 1],
                                 int64_t* val[static 1 ]);
/* api */
int64_t const* get_from_int64_map_c( CInt64Map const* map, int64_t const* key );
bool in_int64_map_c( CInt64Map const* map, int64_t const* key );
bool remove_from_int64_map_c( CInt64Map* map, int64_t const* key );
bool set_on_int64_map_c( CInt64Map* map,
                         int64_t const* key,
                         int64_t const* val );