PreviousUpNext

15.4.1456  src/lib/x-kit/xclient/pkg/stuff/hash-xid.pkg

## hash-xid.pkg
#
# A hashtable package for hashing on xids,
# which are by definition unique.

# Compiled by:
#     src/lib/x-kit/xclient/xclient-internals.sublib



stipulate
    package xt =  xtypes;                                               # xtypes        is from   src/lib/x-kit/xclient/pkg/wire/xtypes.pkg
herein

    package  hash_xid
    : (weak) Hash_Xid                                                   # Hash_Xid      is from   src/lib/x-kit/xclient/pkg/stuff/hash-xid.api
    {
        stipulate
            package xht
                =
                typelocked_hashtable_g (

                    Hash_Key
                        =
                        xt::Xid;

                    fun same_key (   xt::XID x1,
                                     xt::XID x2
                                 )
                        =
                        x1 == x2;

                    fun hash_value (xt::XID x)
                        =
                        x;
                );

        herein
            Xid_Map(X) = xht::Hashtable(X);

            exception XID_NOT_FOUND;

            fun make_map ()
                =
                xht::make_hashtable  { size_hint => 32,  not_found_exception => XID_NOT_FOUND };

            get    =  xht::get;
            set    =  xht::set;
            remove =  xht::remove;

            list = xht::keyvals_list;
        end;
    };

end;

## COPYRIGHT (c) 1990, 1991 by John H. Reppy.  See COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext