macro LFDS711_BTREE_AU_GET_USER_STATE_FROM_STATE

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_btree_addonly_unbalanced.h

Opaque Structures

struct lfds711_btree_au_state;

Macro

#define LFDS711_BTREE_AU_GET_USER_STATE_FROM_STATE( btree_au_state )

Parameters

btree_au_state

An initialized struct lfds711_btree_au_state. Not a pointer to it - the struct itself.

Return Value

Returns a void *, the user_state argument from lfds711_btree_au_init_valid_on_current_logical_core.

Notes

The user state value can only be set the once, when the data structure instance is initialized.

As with all liblfds macros, the macro operates on the structure itself, not a pointer to it.

Example

#include <stdio.h>
#include "liblfds711.h"

int main()
{
  char
    btree_name[64] = "Staggerlee";

  struct lfds711_btree_au_state
    baus;

  void
    *user_state;

  lfds711_misc_library_init_valid_on_current_logical_core();

  lfds711_btree_au_init_valid_on_current_logical_core( &baus, strcmp, LFDS711_BTREE_AU_LINK_RESULT_SUCCESS_OVERWRITE, (void *) btree_name );

  user_state = LFDS711_BTREE_AU_GET_USER_STATE_FROM_STATE( baus );

  printf( "btree name is \"%s\"\n", (char *) user_state );

  lfds711_btree_au_cleanup( &baus, NULL );

  lfds711_misc_library_cleanup();

  return( EXIT_SUCCESS );
}

See Also